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
Rendering-Related Classes
Physics-Related Classes
Bounds-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes

WidgetSpriteViewport Class

This class is used to create virtual monitors that display data from arbitrary cameras in the world. This widget is used to render the whole scene, with all engine post-processes like HDR, DOF, motion blur, glow, etc. Unlike WidgetSpriteNode, this widget does not support alpha channel masking.

Notice
By default, the sprite viewport is rendered at the same frame rate as the main Unigine viewport. For it to be rendered at different frame rate (for example, lower one in order to decrease the rendering load), use setIFps().

The following sample demonstrates the usage of the WidgetSpriteViewport class:

WidgetSpriteViewport Class

Members


WidgetSpriteViewport (const Ptr<Gui> & gui, int width, int height)

Constructor. Creates a new viewport sprite with given properties.

Arguments

  • const Ptr<Gui> & gui - GUI, to which the new sprite will belong.
  • int width - Width of the sprite.
  • int height - Height of the sprite.

Ptr<WidgetSpriteViewport> create (const Ptr<Widget> & widget)

Arguments

  • const Ptr<Widget> & widget

Return value

int getTextureWidth ()

Returns the width of the texture buffer used for a widget that affects the widget size.

Return value

Width of the texture buffer size.

int getTextureHeight ()

Returns the height of the texture buffer used for a widget that affects the widget size.

Return value

Height of the texture buffer size.

void appendSkipFlags (int flags)

Arguments

  • int flags

void setCamera (const Ptr<Camera> & camera)

Arguments

  • const Ptr<Camera> & camera

void renderImage (const Ptr<Image> & image)

Renders the sprite viewport into the image.

Arguments

  • const Ptr<Image> & image - Source image.

void setViewportMask (int mask)

Sets a bit mask for rendering into the viewport. Nodes are rendered in this sprite viewport if their masks match this one.

Arguments

  • int mask - Integer, each bit of which is a mask.

float getIFps ()

Returns the current constant frame duration used to render WidgetSpriteViewport viewport.

Return value

Frame duration in seconds (1 / FPS).

void setAspectCorrection (int correction)

Arguments

  • int correction

Math::mat4 getProjection ()

Returns the current projection matrix of the associated camera.

Return value

Projection matrix.

int getViewportMask ()

Returns the current bit mask for rendering into the viewport. Nodes are rendered in the sprite viewport if their masks match this one.

Return value

Integer, each bit of which is a mask.

const char * getPostMaterials ()

Return value

Math::Mat4 getModelview ()

Returns the current model-view matrix of the associated camera.

Return value

Model-view matrix.

void setTextureHeight (int height)

Sets the height of the texture buffer used for a widget. This affects the widget size accordingly.

Arguments

  • int height - Height of the texture buffer size.

void setPostMaterials (const char * materials)

Arguments

  • const char * materials

void setIFps (float ifps)

Sets a constant frame duration used to render sprite viewport. It can be used to decrease the frame rate to get higher performance. (For example, if the widget is used to create a TV set, lowered frame rate makes no visual difference, but allows for faster rendering of the scene.)

Arguments

  • float ifps - Frame duration in seconds (1/FPS). If a too small value is provided, 1E-6 will be used instead. 0 means that a widget is rendered at the same frame rate as the main application window.

int getAspectCorrection ()

Return value

void setReflectionMask (int mask)

Sets a bit mask for rendering reflections into the viewport. Reflections are rendered in the sprite viewport if masks of reflective materials match this one.

Arguments

  • int mask - Integer, each bit of which is a mask.

void setSkipFlags (int flags)

Arguments

  • int flags

void setProjection (const Math::mat4 & projection)

Sets a projection matrix for the associated camera.

Arguments

  • const Math::mat4 & projection - Projection matrix.

Ptr<Camera> getCamera ()

Return value

int checkSkipFlags (int flags)

Arguments

  • int flags

Return value

void setModelview (const Math::Mat4 & modelview)

Sets a model-view matrix for the associated camera.

Arguments

  • const Math::Mat4 & modelview - Model-view matrix.

int getReflectionMask ()

Returns the current bit mask for rendering reflections into the viewport. Reflections are rendered in the sprite viewport if masks of reflective materials match this one.

Return value

Integer, each bit of which is a mask.

void removeSkipFlags (int flags)

Arguments

  • int flags

void setTextureWidth (int width)

Sets the width of the texture buffer used for a widget. This affects the widget size accordingly.

Arguments

  • int width - Width of the texture buffer size.

int getSkipFlags ()

Return value

Last update: 2017-07-03