This page has been translated automatically.
Programming
Fundamentals
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
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::WidgetSpriteViewport Class

Header:#include <UnigineWidgets.h>
Inherits:WidgetSprite

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


static WidgetSpriteViewportPtr create(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> cast(const Ptr<Widget> & widget)

Arguments

  • const Ptr<Widget> & widget

void setAspectCorrection(int correction)

Sets the aspect correction for the WidgetSpriteViewport. 1 enables correction, 0 disables.

Arguments

  • int correction - 1 to enable aspect correction, 0 to disable.

int getAspectCorrection()

Returns the value indicating if the aspect correction enabled for WidgetSpriteViewport.

Return value

1 if the aspect correction enabled, otherwise 0.

void setCamera(const Ptr<Camera> & camera)

Copies parameters of the given Camera instance.

Arguments

  • const Ptr<Camera> & camera - Camera to be copied.

Ptr<Camera> getCamera()

Copies the instance of camera.

Return value

Camera instance.

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.

float getIFps()

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

Return value

Frame duration in seconds (1 / FPS).

void setModelview(const Math::Mat4 & modelview)

Sets a model-view matrix for the associated camera.

Arguments

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

Math::Mat4 getModelview()

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

Return value

Model-view matrix.

void setPostMaterials(const char * materials)

Sets post postprocess materials that are applied after all other postprocess are rendered. They are used after engine.render.setPostMaterials(), if any.

Arguments

  • const char * materials - Comma-separated names of postprocess materials.

const char * getPostMaterials()

Returns names of the current post postprocess materials that are applied after all other postprocess are rendered. They are used after engine.render.getPostMaterials(), if any.

Return value

Name of the current post postprocess materials.

void setProjection(const Math::mat4 & projection)

Sets a projection matrix for the associated camera.

Arguments

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

Math::mat4 getProjection()

Returns the current projection matrix of the associated camera.

Return value

Projection matrix.

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.

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 setSkipFlags(int flags)

Sets the skip flag for the WidgetSpriteViewport viewport.

Arguments

  • int flags - A skip flag. Available flags:
    • SKIP_SHADOWS
    • SKIP_VISUALIZER
    • SKIP_POSTEFFECTS
    • SKIP_DYNAMIC_REFLECTIONS
    • SKIP_VELOCITY_BUFFER
    • SKIP_SRGB

int getSkipFlags()

Returns the skip flag set for the current viewport.

Return value

A skip flag. Available flags:
  • SKIP_SHADOWS
  • SKIP_VISUALIZER
  • SKIP_POSTEFFECTS
  • SKIP_DYNAMIC_REFLECTIONS
  • SKIP_VELOCITY_BUFFER
  • SKIP_SRGB

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.

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 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 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.

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.

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.

void appendSkipFlags(int flags)

Appends a new skip flag without rewriting already set.

Arguments

  • int flags - A skip flag. Available flags:
    • SKIP_SHADOWS
    • SKIP_VISUALIZER
    • SKIP_POSTEFFECTS
    • SKIP_DYNAMIC_REFLECTIONS
    • SKIP_VELOCITY_BUFFER
    • SKIP_SRGB

int checkSkipFlags(int flags)

Checks if given flags are already set.

Arguments

  • int flags - A skip flag. Available flags:
    • SKIP_SHADOWS
    • SKIP_VISUALIZER
    • SKIP_POSTEFFECTS
    • SKIP_DYNAMIC_REFLECTIONS
    • SKIP_VELOCITY_BUFFER
    • SKIP_SRGB

Return value

1 if flag/flags already set, otherwise 0.

void removeSkipFlags(int flags)

Removes the given skip flag without affecting other set flags.

Arguments

  • int flags - A skip flag to be removed. Available flags:
    • SKIP_SHADOWS
    • SKIP_VISUALIZER
    • SKIP_POSTEFFECTS
    • SKIP_DYNAMIC_REFLECTIONS
    • SKIP_VELOCITY_BUFFER
    • SKIP_SRGB

void renderImage(const Ptr<Image> & image)

Renders the sprite viewport into the image.

Arguments

  • const Ptr<Image> & image - Source image.
Last update: 03.07.2017
Build: ()