ViewportData Class
Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
The object of this class stores all data on the viewport: transformations, viewport type settings, physical size of the display, VFOV, aspect, vertical and horizontal offsets, warping effect details, etc.
This object is accessible via the corresponding methods of the DisplaysConfig class.
The mask data are stored in the configuration file.
ViewportData Class
Members
int getID() const#
Returns the current viewport ID.
Return value
Current viewport ID.void setName ( String name ) #
Sets a new viewport name.
Arguments
- String name - The viewport name.
String getName() const#
Returns the current viewport name.
Return value
Current viewport name.void setComputerName ( String name ) #
Sets a new name of the computer, on which this viewport is to be rendered.
Arguments
- String name - The name of the computer, on which this viewport is to be rendered. If not set, the viewport is rendered on any PC.
String getComputerName() const#
Returns the current name of the computer, on which this viewport is to be rendered.
Return value
Current name of the computer, on which this viewport is to be rendered. If not set, the viewport is rendered on any PC.void setDisplayIndex ( int index ) #
Sets a new display index.
Arguments
- int index - The display index.
int getDisplayIndex() const#
Returns the current display index.
Return value
Current display index.void setWindowSize ( ivec2 size ) #
Sets a new size of the window, if it is in the Window mode.
Arguments
- ivec2 size - The window size.
ivec2 getWindowSize() const#
Returns the current size of the window, if it is in the Window mode.
Return value
Current window size.void setWindowPosition ( ivec2 position ) #
Sets a new window position on the screen.
Arguments
- ivec2 position - The coordinates of the top left corner of the window on the screen.
ivec2 getWindowPosition() const#
Returns the current window position on the screen.
Return value
Current coordinates of the top left corner of the window on the screen.void setWindowMode ( int mode ) #
Sets a new window mode for the rendered viewport: fullscreen imitation (frameless window adapted to the full window area) or window.
Arguments
- int mode - The window mode for the rendered viewport.
int getWindowMode() const#
Returns the current window mode for the rendered viewport: fullscreen imitation (frameless window adapted to the full window area) or window.
Return value
Current window mode for the rendered viewport.void setProjectionEnabled ( int enabled ) #
Sets a new value indicating if the projection rendering in viewport is enabled.
Arguments
- int enabled - The projection rendering
int isProjectionEnabled() const#
Returns the current value indicating if the projection rendering in viewport is enabled.
Return value
Current projection renderingvoid setPosition ( vec3 position ) #
Sets a new viewport position relative to the viewpoint in the setup.
Arguments
- vec3 position - The viewport position relative to the viewpoint in the setup.
vec3 getPosition() const#
Returns the current viewport position relative to the viewpoint in the setup.
Return value
Current viewport position relative to the viewpoint in the setup.void setRotation ( vec3 rotation ) #
Sets a new viewport rotation relative to its own center in the setup.
Arguments
- vec3 rotation - The viewport rotation relative to its own center in the setup.
vec3 getRotation() const#
Returns the current viewport rotation relative to its own center in the setup.
Return value
Current viewport rotation relative to its own center in the setup.void setOffset ( vec2 offset ) #
Sets a new offset of the FOV.
Arguments
- vec2 offset - The FOV offset.
vec2 getOffset() const#
Returns the current offset of the FOV.
Return value
Current FOV offset.void setType ( int type ) #
Sets a new type of the projection matrix distortion applied to the viewport: display or projector.
Arguments
- int type - The projection matrix distortion type applied to the viewport.
int getType() const#
Returns the current type of the projection matrix distortion applied to the viewport: display or projector.
Return value
Current projection matrix distortion type applied to the viewport.void setSize ( vec2 size ) #
Sets a new physical size of the display.
Arguments
- vec2 size - The physical size of the display.
vec2 getSize() const#
Returns the current physical size of the display.
Return value
Current physical size of the display.void setAspect ( float aspect ) #
Sets a new aspect ratio for the projector.
Arguments
- float aspect - The aspect ratio for the projector.
float getAspect() const#
Returns the current aspect ratio for the projector.
Return value
Current aspect ratio for the projector.void setVFov ( float vfov ) #
Sets a new vertical field of view for the projector.
Arguments
- float vfov - The vertical field of view for the projector, in degrees.
float getVFov() const#
Returns the current vertical field of view for the projector.
Return value
Current vertical field of view for the projector, in degrees.void setGroupID ( int id ) #
Sets a new ID of the group of viewports.
Arguments
- int id - The ID of the group of viewports.
int getGroupID() const#
Returns the current ID of the group of viewports.
Return value
Current ID of the group of viewports.static getEventBaseChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventWarpChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventEasyblendChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventBlendChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventMaskChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventColorChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventDebugChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.static getEventSomethingChanged() const#
The event handler signature is as follows: myhandler()Usage Example
Source code
Return value
Event reference.void setViewportRendering ( int rendering ) #
Sets a new value indicating whether the viewport rendering is enabled.
Arguments
- int rendering - The viewport rendering
int isViewportRendering() const#
Returns the current value indicating whether the viewport rendering is enabled.
Return value
Current viewport renderingvoid update ( ) #
Updates the data displayed in the viewport.void grabWindowParameters ( ) #
Updates the viewport data according to the current window parameters: display index, window size and position.int isGrouped ( ) #
Returns the value specifying if the viewport is in the group.Return value
1 if the viewport is a part of a group, otherwise 0.void loadEasyBlendSettings ( String filepath ) #
Loads the settings from the EasyBlend setup file.Arguments
- String filepath - Path to the EasyBlend setup file.
void removeEasyblendSetup ( ) #
Removes the EasyBlend setup.WarpGridData getWarpGrid ( ) #
Returns the warp grid data.Return value
WarpGridData class instance that stores the warp grid data.BlendZonesData getBlendZones ( ) #
Returns the blend zones data.Return value
BlendZonesData class instance that stores the blend zones data.MasksData getMasks ( ) #
Returns the masks data.Return value
MasksData class instance that stores the masks data.ColorCorrectionData getColorCorrection ( ) #
Returns the color correction data.Return value
ColorCorrectionData class instance that stores the color correction data.DebugData getDebug ( ) #
Returns the debug data.Return value
DebugData class instance that stores the debug data.EasyBlendData getEasyblendData ( ) #
Returns the EasyBlend data.Return value
EasyBlendData class instance that stores the EasyBlend data.void saveXml ( Xml xml ) #
Saves the viewport data to the given instance of the Xml class.Arguments
int restoreXml ( Xml xml ) #
Loads the viewport data from the specified instance of the Xml class.Arguments
Return value
1 if the data has been loaded successfully, otherwise 0.void save ( Stream stream ) #
Saves the viewport data to the specified stream.Arguments
- Stream stream - Stream to which the data is to be written.
void restore ( Stream stream ) #
Loads the viewport data from the specified stream.Arguments
- Stream stream - Stream the data from which is to be loaded.
void copy ( ViewportData data ) #
Copies the current viewport data to the specified instance of the ViewportData class.Arguments
- ViewportData data - Viewport data.
The information on this page is valid for UNIGINE 2.20 SDK.
Last update:
2025-04-29
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)