This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Core Library
Containers
Engine Classes
Node-Related Classes
Physics-Related Classes
Bounds-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Viewport Class

The Viewport class is used to render an image from any camera. This class provides all capabilities of the main renderer: it allows rendering cube maps, visualizer, supports anti-aliasing and so on.

Viewport Class

Members


Viewport ()

Creates a new viewport with default settings.

void render (const Ptr<Camera> & camera)

Renders an image from the specified camera in the viewport.
Source code(UnigineScript)
Camera camera = new Camera();
camera.setModelview(Mat4(lookAt(Vec3(14.0f),Vec3(0.0f,0.0f,8.0f),vec3(0.0f,0.0f,1.0f)) * rotateZ(angle * 32.0f);));

Viewport viewport = new Viewport();
viewport.render(camera);

Arguments

  • const Ptr<Camera> & camera - A camera an image from which should be rendered in the viewport.

void renderStereo (const Ptr<Camera> & camera_left, const Ptr<Camera> & camera_right, const char * stereo_material)

Renders a stereo image in the current viewport.

Arguments

  • const Ptr<Camera> & camera_left - A camera that renders an image for the left eye.
  • const Ptr<Camera> & camera_right - A camera that renders an image for the right eye.
  • const char * stereo_material - Stereo materials.

void renderImageCube (const Ptr<Camera> & camera, const Ptr<Image> & image, int size, int hdr = 0)

Renders the image from the camera into the cube map of the specified size.

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Image> & image - A cube map.
  • int size - A cube map edge size.
  • int hdr -

void renderImageCube (const Ptr<Camera> & camera, const Ptr<Image> & image)

Renders the image from the camera into the cube map.

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Image> & image - A cube map.

void renderNode (const Ptr<Camera> & camera, const Ptr<Node> & node)

Renders the given node with all children into the current render target.

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Node> & node

void renderNodeTexture2D (const Ptr<Camera> & camera, const Ptr<Node> & node, const Ptr<Texture> & texture)

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Node> & node
  • const Ptr<Texture> & texture

void renderNodeImage2D (const Ptr<Camera> & camera, const Ptr<Node> & node, const Ptr<Image> & image, int width, int height, int hdr)

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Node> & node -
  • const Ptr<Image> & image -
  • int width - Image width.
  • int height - Image height.
  • int hdr

void renderNodeImage2D (const Ptr<Camera> & camera, const Ptr<Node> & node, const Ptr<Image> & image)

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Node> & node
  • const Ptr<Image> & image

void renderImage2D (const Ptr<Camera> & camera, const Ptr<Image> & image)

Renders an image from the camera into the given 2D image.

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Image> & image - A 2D image.

void renderImage2D (const Ptr<Camera> & camera, const Ptr<Image> & image, int width, int height, int hdr = 0)

Renders an image from the camera into the 2D image of the specified size.

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Image> & image - A 2D image.
  • int width - Width of the 2D image.
  • int height - Height of the 2D image.
  • int hdr -

void renderTexture2D (const Ptr<Camera> & camera, const Ptr<Texture> & texture)

Arguments

  • const Ptr<Camera> & camera - A camera, an image from which should be rendered.
  • const Ptr<Texture> & texture

void setMode (int mode)

Sets the rendering mode for the current viewport. It can be one of the stereo or panoramic modes or the default mode.

Arguments

  • int mode - A rendering mode.

int getMode ()

Returns the rendering mode set for the current viewport. It can be one of the stereo or panoramic modes or the default mode.

Return value

The current rendering mode.

void setStereoRadius (float radius)

Updates the radius for stereo (the half of the separation distance between the cameras (i.e. between eyes)).

Arguments

  • float radius - A stereo radius in units. If a negative value is provided, 0 will be used instead.

float getStereoRadius ()

Returns the current radius for stereo (the half of the separation distance between the cameras (i.e. between eyes)).

Return value

Stereo radius in units.

void setStereoDistance (float distance)

Sets the focal distance for stereo rendering (distance in the world space to the point where two views line up, i.e. to the zero parallax plane).

Arguments

  • float distance - A focal distance in units.

float getStereoDistance ()

Returns the focal distance for stereo rendering (distance in the world space to the point where two views line up, i.e. to the zero parallax plane).

Return value

A focal distance in units.

void setStereoOffset (float offset)

Updates the virtual camera offset (an offset after the perspective projection).

Arguments

  • float offset - A virtual camera offset in units.

float getStereoOffset ()

Returns the virtual camera offset (an offset after the perspective projection).

Return value

A virtual camera offset in units.

void setNodeEnvironmentTextureName (const char * name)

Arguments

  • const char * name - A texture name.

void setAspectCorrection (int correction)

Arguments

  • int correction -

int getAspectCorrection ()

Return value

void setSkipFlags (int flags)

Sets the skip flag for the current viewport.

Arguments

int getSkipFlags ()

Returns the skip flag set for the current viewport.

Return value

A skip flag.

int checkSkipFlags (int flags)

Returns a value indicating if the specified skip flag is set for the current viewport.

Arguments

  • int flags - A skip flag to check.

Return value

1if the skip flag is set; otherwise, 0.

void setNodeLightUsage (int usage)

Arguments

  • int usage

int getNodeLightUsage ()

Return value

int isStereo ()

Returns a value indicating if the stereo rendering is enabled for the current viewport (one of the stereo modes is set).

Return value

1 if the stereo rendering is enabled; otherwise, 0.

int isPanorama180 ()

Returns a value indicating if a 180-degree panoramic rendering is enabled.

Return value

1 if a 180-degree panoramic rendering is enabled; otherwise, 0.

int isPanorama360 ()

Returns a value indicating if a 360-degree panoramic rendering is enabled.

Return value

1 if a 360-degree panoramic rendering is enabled; otherwise, 0.

int getID ()

Return value

void setFirstFrame (int frame)

Sets a value indicating if the first frame should be enabled over the current frame.

Arguments

  • int frame - 1 to set the first frame flag; otherwise, 0.

int getFirstFrame ()

Returns a value indicating if the first frame is enabled over the current frame.

Return value

1 if the first frame flag is set; otherwise, 0.

int SKIP_SHADOWS

Description

Skip shadows rendering in the viewport.

int SKIP_VISUALIZER

Description

Skip rendering of the visualizer in the viewport. This flag is set by default for a new viewport.

int SKIP_POSTEFFECTS

Description

Skip rendering of post effects in the viewport.

int SKIP_DYNAMIC_REFLECTIONS

Description

Skip rendering of dynamic reflections in the viewport.

int SKIP_VELOCITY_BUFFER

Description

Skip rendering to the velocity buffer for the viewport.

int SKIP_SRGB

Description

Skip rendering of the srgb color space.

int MODE_DEFAULT

Description

Enables the default stereo mode - no stereo and panoramic rendering in the current vviewport is available. This mode is set by default for a new viewport.

int MODE_STEREO_ANAGLYPH

Description

Enables the anaglyph stereo mode that is viewed with red-cyan anaglyph glasses.

int MODE_STEREO_INTERLACED

Description

Enables the interlaced stereo mode that is used with interlaced stereo monitors and polarized 3D glasses.

int MODE_STEREO_HORIZONTAL

Description

Enables the horizontal stereo mode that is supported on mobile devices.

int MODE_STEREO_VERTICAL

Description

Enables the vertical stereo mode that is supported on mobile devices.

int MODE_STEREO_SEPARATE

Description

Enables the separate images stereo mode. This mode serves to output two separate images for each of the eye. It can be used with any VR/AR output devices that support separate images output, e.g. for 3D video glasses or helmets (HMD).

int MODE_STEREO_REPLICATE

int MODE_PANORAMA_180_CURVED

Description

Enables rendering of the viewport as a 180-degree panorama with curved edges.

int MODE_PANORAMA_180_LINEAR

Description

Enables rendering of the viewport as a 180-degree linear panorama without distortion at the edges.

int MODE_PANORAMA_180_FISHEYE

Description

Enables rendering of the viewport as a 180-degree spherical panorama (fisheye).

int MODE_PANORAMA_360_CURVED

Description

Enables rendering of the viewport as a 360-degree panorama with curved edges.

int MODE_PANORAMA_360_LINEAR

Description

Enables rendering of the viewport as a 360-degree linear panorama without distortion at the edges.

int MODE_PANORAMA_360_FISHEYE

Description

Enables rendering of the viewport as a 360-degree spherical panorama (fisheye).

int USAGE_WORLD_LIGHT

Description

Use lighting from the LightWorld set in the current loaded world.

int USAGE_AUX_LIGHT

Description

Use lighting from the auxiliary virtual scene containing one LightWorld (with 45, 45 and 45 degrees slope angles), scattering is not used.

int USAGE_NODE_LIGHT

Description

Use the node lighting.
Last update: 2017-07-03
Build: ()