This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
创建内容
内容优化
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::WidgetSpriteViewport Class

Header: #include <UnigineWidgets.h>
Inherits from: 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 and adds it to the specified GUI.

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.

static WidgetSpriteViewportPtr create ( int width, int height ) #

Constructor. Creates a new viewport sprite with given properties and adds it to the Engine GUI.

Arguments

  • int width - Width of the sprite.
  • int height - Height of the sprite.

void setAspectCorrection ( bool correction ) #

Sets the aspect correction for the WidgetSpriteViewport. true enables correction, false disables.

Arguments

  • bool correction - true to enable aspect correction, false to disable.

bool isAspectCorrection ( ) const#

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

Return value

true if the aspect correction enabled, otherwise false.

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 ( ) const#

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 ( ) const#

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 ( ) const#

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

Return value

Model-view matrix.

void setProjection ( const Math::mat4 & projection ) #

Sets a projection matrix for the associated camera.

Arguments

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

Math::mat4 getProjection ( ) const#

Returns the current projection matrix of the associated camera.

Return value

Projection matrix.

void setReflectionViewportMask ( 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 (one bit at least).

Arguments

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

int getReflectionViewportMask ( ) const#

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 (one bit at least).

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 ( ) const#

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 ( ) const#

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 ( ) const#

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 ( ) const#

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.

void setImage ( const Ptr<Image> & image, int dynamic = 0 ) #

Sets a loaded into memory image for the first (bottom) layer of the sprite. This layer always exists in the sprite. An additional flag can be set in case the sprite image is going to be updated often or even each frame (for optimized memory management).
Warning
This method is intended for changing the sprite's background texture and is valid only for the base WidgetSprite class. It cannot be used for the WidgetSpriteViewport!

Arguments

  • const Ptr<Image> & image - Pointer to the image.
  • int dynamic - Positive number if the image will be updated each frame; otherwise, 0.

const Ptr<Image> & getImage ( ) const#

Returns the loaded into memory image that is currently set for the first (bottom) layer of the sprite.
Warning
This method is valid only for the base WidgetSprite class. It cannot be used for the WidgetSpriteViewport!

Return value

Pointer to the image.

void setRender ( const Ptr<Texture> & texture, int flipped = 0 ) #

Sets a texture to be rendered for the first (bottom) layer of the sprite.
Warning
This method is intended for changing the sprite's background texture and is valid only for the base WidgetSprite class. It cannot be used for the WidgetSpriteViewport!

Arguments

  • const Ptr<Texture> & texture - Pointer to the texture.
  • int flipped - Flipped flag.

Ptr<Texture> getRender ( ) const#

Returns the pointer to the texture that is currently set for the first (bottom) layer of the sprite.
Warning
This method is valid only for the base WidgetSprite class. It cannot be used for the WidgetSpriteViewport!

Return value

Pointer to the texture.

void setUseTAAOffset ( bool offset ) #

Sets a value indicating if skipping render mode check is enabled for using TAA. Can be used to ensure proper TAA calculation when rendering mode for the Viewport is set to RENDER_DEPTH.

Arguments

  • bool offset - true to enable skipping render mode check and use TAA; otherwise false.

bool isUseTAAOffset ( ) const#

Returns a value indicating if skipping render mode check is enabled for using TAA. Can be used to ensure proper TAA calculation when rendering mode for the Viewport is set to RENDER_DEPTH.

Return value

true if skipping render mode check is enabled for using TAA; otherwise false.
Last update: 2022-03-10
Build: ()