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.
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
This class inherits from WidgetSpriteMembers
WidgetSpriteViewport (Gui gui, int width, int height)
Constructor. Creates a new viewport sprite with given properties.Arguments
- Gui gui - GUI, to which the new sprite will belong.
- int width - Width of the sprite.
- int height - Height of the sprite.
vec3 getCameraOffset ()
Returns an offset vector of the camera.Return value
Offset of the camera, X, Y and Z axes.float getIFps ()
Returns the current constant frame duration used to render WidgetSpriteViewport viewport.Return value
Frame duration in seconds (1 / FPS).string getMaterials ()
Returns materials used for postprocessing visual effects.Return value
Comma-separated list of material names.mat4 getModelview ()
Returns the current model-view matrix of the associated camera.Return value
Model-view matrix.mat4 getProjection ()
Returns the current projection matrix of the associated camera.Return value
Projection 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.int getShadows ()
Returns a value indicating if the shadows rendering is enabled.Return value
1 if the shadows are enabled; 0 if disabled.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.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 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 renderImage (Image image)
Renders the sprite viewport into the image.Arguments
- Image image - Source image.
void setCameraOffset (vec3 offset)
Sets an offset vector of the camera.Arguments
- vec3 offset - Offset of the camera, X, Y and Z axes.
void setIFps (float time)
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 time - 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.
void setMaterials (string materials)
Sets postprocessing materials which are used to create special visual effects. Materials are applied in the order of listing.Arguments
- string materials - Comma-separated list of material names.
void setModelview (mat4 matrix)
Sets a model-view matrix for the associated camera.Arguments
- mat4 matrix - Model-view matrix.
void setProjection (mat4 matrix)
Sets a projection matrix for the associated camera.Arguments
- mat4 matrix - 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.
void setShadows (int shadows)
Enables/disables shadows rendering.Arguments
- int shadows - 1 to enable shadows, 0 to disable.
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 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.
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.
Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter