This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
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
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.Plugins.Projection Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.

This set of functions is available when the Projection plugin is loaded. This plugin allows creating multi-projector setups.

Notice
Projection plugin cannot be used in a Qt-based application

If the plugin is loaded together with the engine, the HAS_PROJECTION definition is set. This definition can be used, for example, to avoid errors if the plugin is not loaded: the code in which the plugin functions are executed can be wrapped around as follows:

Source code (UnigineScript)
#ifdef HAS_PROJECTION
	// engine.projection functions
#endif

Projection Class

Properties

int Primary#

The number of projection, which is used as a primary one.

bool PluginEnabled#

The A value indicating if the appprojection plugin is enabled.

float ResolutionUpscale#

The current resolution upscale factor.

Members


void ShowSetupWindow ( ) #

Shows the setup window for the Projection plugin.

int ProjectionGetWidth ( ) #

Returns the number of projections set via width CLI option.

Return value

Number of projections.

bool SaveState ( Stream stream ) #

Saves current states of all projections (warping, blending, color, etc.) to the specified stream.

Saving into the stream requires creating a blob to save into. To restore the saved state the RestoreState() method is used:

Source code (C#)
// set the projection state
//...//

// save state
Blob blob_state = new Blob();
appprojection1.SaveState(blob_state);

// change the state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
appprojection1.RestoreState(blob_state);

Arguments

  • Stream stream - Stream to save state data for all projections.

Return value

true on success; otherwise, false.

bool SaveState ( int num, Stream stream ) #

Saves the current state of the projection with the specified number to the specified stream.

Saving into the stream requires creating a blob to save into. To restore the saved state the RestoreState() method is used:

Source code (C#)
// set the projection state
//...//

// save state
Blob blob_state = new Blob();
appprojection1.SaveState(0, blob_state);

// change the state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
appprojection1.RestoreState(0, blob_state);

Arguments

Return value

true on success; otherwise, false.

bool RestoreState ( Stream stream ) #

Restores states of all projections (warping, blending, color, etc.) from the specified stream.

Restoring from the stream requires creating a blob to save into and saving the state using the SaveState() method:

Source code (C#)
// set the projection state
//...//

// save state
Blob blob_state = new Blob();
appprojection1.SaveState(blob_state);

// change the state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
appprojection1.RestoreState(blob_state);

Arguments

  • Stream stream - Stream containing saved state data for all projections.

Return value

true on success; otherwise, false.

bool RestoreState ( int num, Stream stream ) #

Restores the state of the projection with the specified number from the specified stream.

Restoring from the stream requires creating a blob to save into and saving the state using the SaveState() method:

Source code (C#)
// set the projection state
//...//

// save state
Blob blob_state = new Blob();
appprojection1.SaveState(0, blob_state);

// change the state
//...//

// restore state
blob_state.SeekSet(0);	// returning the carriage to the start of the blob
appprojection1.RestoreState(0, blob_state);

Arguments

Return value

true on success; otherwise, false.

void Save ( string file_name, int binary = 0 ) #

Saves configurations of all projections to the specified file.

Arguments

  • string file_name - Path to a .proj file, to which configurations of all projections are to be saved.
  • int binary - 1 to save in binary format, 0 to save in XML format. The default value is 0.

void Save ( int num, string file_name, int binary = 0 ) #

Saves configuration of the specified projection to the specified file.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • string file_name - Path to a .proj file, to which configuration of the specified projection is to be saved.
  • int binary - 1 to save in binary format, 0 to save in XML format. The default value is 0.

void Load ( string file_name, int binary = 0 ) #

Loads configurations of all projections from the specified file.

Arguments

  • string file_name - Path to a .proj file containing configurations of all projections.
  • int binary - 1 to save in binary format, 0 to save in XML format. The default value is 0.

void Load ( int num, string file_name, int binary = 0 ) #

Loads configuration of the specified projection from the specified file.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • string file_name - Path to a .proj file containing configuration of the specified projection.
  • int binary - 1 to save in binary format, 0 to save in XML format. The default value is 0.

void SetEnabled ( int num, int enable ) #

Enables the specified projection for viewport rendering.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int enable - 1 to enable the projection for rendering; 0 to disable it.

int IsEnabled ( int num ) #

Returns a value indicating if the specified projection is enabled for viewport rendering.

Arguments

Return value

1 if the projection is enabled for rendering; otherwise, 0.

void SetAngle ( int num, int angle ) #

Sets canvas rotation angle for the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int angle - Canvas rotation angle:
    • 0 - 0 degrees
    • 1 - 90 degrees
    • 2 - 180 degrees
    • 3 - 270 degrees

int GetAngle ( int num ) #

Returns the current canvas rotation angle for the specified projection.

Arguments

Return value

Current canvas rotation angle:
  • 0 - 0 degrees
  • 1 - 90 degrees
  • 2 - 180 degrees
  • 3 - 270 degrees

void SetFlipHorizontal ( int num, int flip ) #

Enables or disables horizontal flipping of canvas for the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int flip - 1 to enable horizontal flipping for the canvas of the specified projection, 0 to disable it.

int IsFlipHorizontal ( int num ) #

Returns a value indicating if the canvas of the specified projection is flipped horizontally.

Arguments

Return value

1 if the canvas of the specified projection is flipped horizontally; otherwise, 0.

void SetFlipVertical ( int num, int flip ) #

Enables or disables vertical flipping of canvas for the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int flip - 1 to enable vertical flipping for the canvas of the specified projection, 0 to disable it.

int IsFlipVertical ( int num ) #

Returns a value indicating if the canvas of the specified projection is flipped vertically.

Arguments

Return value

1 if the canvas of the specified projection is flipped vertically; otherwise, 0.

void SetDebugFillColor ( int num, int color_num ) #

Sets a color to be used for the specified projection in debug mode.
Notice
Setting individual colors for different projections enables you to visualize overlapping regions for different projections and facilitates the setup process.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int color_num - Color to be used for the specified projection in debug mode, one of the following values:
    • 0 - no color
    • 1 - red
    • 2 - green
    • 3 - blue
    • 4 - cyan
    • 5 - magenta
    • 6 - yellow
    • 7 - white
    • 8 - black

int GetDebugFillColor ( int num ) #

Returns the current color used for the specified projection in debug mode.
Notice
Setting individual colors for different projections enables you to visualize overlapping regions for different projections and facilitates the setup process.

Arguments

Return value

Color currently used for the specified projection in debug mode, one of the following values:
  • 0 - no color
  • 1 - red
  • 2 - green
  • 3 - blue
  • 4 - cyan
  • 5 - magenta
  • 6 - yellow
  • 7 - white
  • 8 - black

void SetDebugShowGrid ( int num, int show ) #

Enables or disables visualization of warping grid for the specified projection on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int show - 1 to enable visualization of warping grid for the specified projection on the screen, 0 to disable it.

int IsDebugShowGrid ( int num ) #

Returns a value indicating if warping grid for the specified projection is displayed on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

Return value

1 if warping grid for the specified projection is displayed on the screen; otherwise, 0.

void SetDebugShowWarpPoints ( int num, int show ) #

Enables or disables visualization of warping control points for the specified projection on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int show - 1 to enable visualization of warping control points for the specified projection on the screen, 0 to disable it.

int IsDebugShowWarpPoints ( int num ) #

Returns a value indicating if warping control points for the specified projection are displayed on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

Return value

1 if warping control points for the specified projection are displayed on the screen; otherwise, 0.

void SetWarpPoints ( int num, vec2[] points, int columns, int rows ) #

Sets warping grid size (width, height) and positions of all its control points for the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] points - Array containing positions of all warping grid points. Array size is determined by the values for columns and rows specified.
  • int columns - Grid width, defines the number of warping grid points horizontally.
  • int rows - Grid height, defines the number of warping grid points vertically.

void GetWarpPoints ( int num, vec2[] points, out int columns, out int rows ) #

Gets the current size (width, height) of the warping grid along with positions of all its control points for the specified projection and puts them to the specified variables.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] points - Array to which positions of all warping grid points are to be put.
  • out int columns - Grid width, defines the number of warping grid points horizontally.
  • out int rows - Grid height, defines the number of warping grid points vertically.

void SetWarpHandles ( int num, vec2[] handles ) #

Sets coordinates of control handles for all warping grid points of the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] handles - Array containing coordinates of handles for all warping grid points. First half - vertical handles, next half - horizontal ones.
    Notice
    The number of control handles must be twice as large as the number of grid points, as there are two handles for each point.

void GetWarpHandles ( int num, vec2[] handles ) #

Gets coordinates of control handles of all warping grid points for the specified projection and puts them to the specified array.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] handles - Array containing coordinates of control handles for all mask polygon points. First half - vertical handles, next half - horizontal ones.
    Notice
    The number of control handles must be twice as large as the number of grid points, as there are two handles for each point.

void ResetWarpGrid ( int num ) #

Resets warping grid for the specified projection to the default one.

Arguments

void SetBorderBlend ( int num, int border_num, vec4 blend ) #

Sets edge blending parameters for the specified side of the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int border_num - Number of projection's side:
    • 0 - left
    • 1 - right
    • 2 - top
    • 3 - bottom
  • vec4 blend - Four-component vector containing soft edge blending parameters for the specified side of the specified projection: (X - size, Y - alpha, Z - contrast, W - gamma).
    Notice
    The power component should have a non-zero value to enable blending.

vec4 GetBorderBlend ( int num, int border_num ) #

Returns current edge blending parameters for the specified side of the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int border_num - Number of projection's side:
    • 0 - left
    • 1 - right
    • 2 - top
    • 3 - bottom

Return value

Four-component vector containing soft edge blending parameters for the specified side of the specified projection: (X - size, Y - alpha, Z - contrast, W - gamma).
Notice
The power component should have a non-zero value to enable blending.

void SetMultiplyImage ( int num, Image image ) #

Sets the edge blending map for the specified projection.

Arguments

void SetMultiplyTexture ( int num, Texture texture ) #

Sets the edge blending map for the specified projection.

Arguments

Texture GetMultiplyTexture ( int num ) #

Returns the current edge blending map for the specified projection.

Arguments

Return value

Current edge blending map.

int AddBlend ( int num, vec2[] points, vec2[] handles_left, vec2[] handles_right ) #

Adds a new screen-space blend area for the specified projection. The form of the new screen-space blend area is defined by the positions of points and control handles (left and right) stored in the arrays specified.
Notice
All three arrays must have the same size.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] points - Array containing positions of all screen-space blend area polygon points
  • vec2[] handles_left - Array containing coordinates of left control handles for all screen-space blend area polygon points.
  • vec2[] handles_right - Array containing coordinates of right control handles for all screen-space blend area polygon points.

Return value

Number of the last added screen-space blend area.

void GetBlend ( int num, int blend_num, vec2[] points, vec2[] handles_left, vec2[] handles_right ) #

Gets all points, along with their control handles, for the specified screen-space blend area of the specified projection and puts the data to the corresponding arrays specified.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int blend_num - Screen-space blend area number, in the range from 0 to the total number of screen-space blend areas.
  • vec2[] points - Array containing positions of all screen-space blend area polygon points
  • vec2[] handles_left - Array containing coordinates of left control handles for all screen-space blend area polygon points.
  • vec2[] handles_right - Array containing coordinates of right control handles for all screen-space blend area polygon points.

int GetNumBlends ( int num ) #

Returns the total number of screen-space blend areas assigned for the specified projection. Blends can be used for blending regions or to cut out certain areas (e.g. top and bottom areas for a curved screen projection).

Arguments

Return value

Total number of blends assigned for the specified projection, including the ones enabled and disabled.

void SetBlendEnabled ( int num, int blend_num, int enabled ) #

Enables or disables the specified screen-space blend area of the specified projection.

Arguments

int IsBlendEnabled ( int num, int blend_num ) #

Returns a value indicating if the specified screen-space blend area of the specified projection is enabled.

Arguments

Return value

1 if warping grid for the specified projection is displayed on the screen; otherwise, 0.

void SetBlendAlpha ( int num, int blend_num, float alpha ) #

Sets a new transparency value for the specified screen-space blend area of the specified projection.

Arguments

float GetBlendAlpha ( int num, int blend_num ) #

Returns the current transparency value for the specified screen-space blend area of the specified projection.

Arguments

Return value

Current transparency value.

void SetBlendContrast ( int num, int blend_num, float alpha ) #

Sets a new gradient part contrast value for the specified screen-space blend area of the specified projection.

Arguments

float GetBlendContrast ( int num, int blend_num ) #

Returns the current gradient part contrast value for the specified screen-space blend area of the specified projection.

Arguments

Return value

Current gradient part contrast value.

void SetBlendGamma ( int num, int blend_num, float power ) #

Sets a new gamma correction value for the specified screen-space blend area of the specified projection.

Arguments

float GetBlendGamma ( int num, int blend_num ) #

Returns the current gamma correction value for the specified screen-space blend area of the specified projection.

Arguments

Return value

Current gamma correction value.

void ClearBlends ( int num ) #

Removes all screen-space blend area created for the specified projection.

Arguments

void SetDebugShowBlendPoints ( int num, int show ) #

Enables or disables visualization of screen-space blend area control points for the specified projection on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int show - 1 to enable visualization of screen-space blend area control points for the specified projection on the screen, 0 to disable it.

int IsDebugShowBlendPoints ( int num ) #

Returns a value indicating if screen-space blend area control points for the specified projection are displayed on the screen.
Notice
This option significantly facilitates the process of debugging configuration of a multi-projector setup.

Arguments

Return value

1 if screen-space blend area control points for the specified projection are displayed on the screen; otherwise, 0.

int AddMask ( int num, vec2[] points, vec2[] handles_left, vec2[] handles_right ) #

Adds a new mask for the specified projection. The form of the new mask is defined by the positions of points and control handles (left and right) stored in the arrays specified.
Notice
All three arrays must have the same size.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec2[] points - Array containing positions of all mask polygon points
  • vec2[] handles_left - Array containing coordinates of left control handles for all mask polygon points.
  • vec2[] handles_right - Array containing coordinates of right control handles for all mask polygon points.

Return value

Number of the last added mask.

void GetMask ( int num, int mask_num, vec2[] points, vec2[] handles_left, vec2[] handles_right ) #

Gets all points, along with their control handles, for the specified mask of the specified projection and puts the data to the corresponding arrays specified.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int mask_num - Mask number, in the range from 0 to the total number of masks.
  • vec2[] points - Array containing positions of all mask polygon points
  • vec2[] handles_left - Array containing coordinates of left control handles for all mask polygon points.
  • vec2[] handles_right - Array containing coordinates of right control handles for all mask polygon points.

int GetNumMasks ( int num ) #

Returns the total number of masks assigned for the specified projection. Masks can be used for blending regions or to cut out certain areas (e.g. top and bottom areas for a curved screen projection).

Arguments

Return value

Total number of masks assigned for the specified projection, including the ones enabled and disabled.

void SetMaskEnabled ( int num, int mask_num, int enabled ) #

Enables or disables the specified mask of the specified projection.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • int mask_num - Mask number, in the range from 0 to the total number of masks.
  • int enabled - 1 to enable the specified mask of the specified projection, 0 to disable it.

int IsMaskEnabled ( int num, int mask_num ) #

Returns a value indicating if the specified mask of the specified projection is enabled.

Arguments

Return value

1 if warping grid for the specified projection is displayed on the screen; otherwise, 0.

void SetMaskSmooth ( int num, int mask_num, int smooth ) #

Sets smoothing of edges of the specified mask of the specified projection. This value determines the number of additional points to be inserted between the control points of the mask.

Arguments

int GetMaskSmooth ( int num, int mask_num ) #

Returns the current smoothing value used for edges of the specified mask of the specified projection. This value determines the number of additional points to be inserted between the control points of the mask.

Arguments

Return value

Current smoothing value.

void ClearMasks ( int num ) #

Removes all mask created for the specified projection.

Arguments

void SetColorScale ( int num, vec4 scale ) #

Sets the color multiplier for the specified projection.

Arguments

vec4 GetColorScale ( int num ) #

Returns the color multiplier for the specified projection.

Arguments

Return value

Per-channel color scale.

void SetColorBias ( int num, vec4 bias ) #

Sets the color bias for the specified projection.

Arguments

vec4 GetColorBias ( int num ) #

Returns the color bias for the specified projection.

Arguments

Return value

Per-channel color bias.

void SetCornerBrightness ( int num, vec4 brightness ) #

Sets brightness correction values for corners of the specified projection using a four-component vector specified.

Arguments

  • int num - Projection number, in the range from 0 to the total number of projections.
  • vec4 brightness - Four-component vector containing brightness values, in the [0.0f, 1.0f] range, for projection's corners (upper left, upper right, lower left, lower right).

vec4 GetCornerBrightness ( int num ) #

Returns current brightness correction values for corners of the specified projection as a four-component vector.

Arguments

Return value

Four-component vector containing brightness values, in the [0.0f, 1.0f] range, for projection's corners (upper left, upper right, lower left, lower right).

int AddMesh ( int num, Mesh mesh, mat4 transform ) #

Adds a new mesh for the specified projection.
Notice
Meshes are used for complex-shaped projection screens.

Arguments

Return value

Total number of meshes for the specified projection.

Mesh GetMesh ( int num, int mesh_num ) #

Returns the specified mesh of the specified projection.
Notice
Meshes are used for complex-shaped projection screens.

Arguments

Return value

Mesh.

mat4 GetMeshTransform ( int num, int mesh_num ) #

Returns the transformation of the specified mesh of the specified projection.
Notice
Meshes are used for complex-shaped projection screens.

Arguments

Return value

Mesh transformation.

void ResetMesh ( int num ) #

Resets the mesh for the specified projection.
Notice
Meshes are used for complex-shaped projection screens.

Arguments

void SetProjectorModelview ( int num, mat4 modelview ) #

Sets the projector's model-view matrix for the specified projection.

Arguments

mat4 GetProjectorModelview ( int num ) #

Returns the current projector's model-view matrix for the specified projection.

Arguments

Return value

Projector's model-view matrix.

void SetProjectorProjection ( int num, mat4 projection ) #

Sets the projector's projection matrix for the specified projection.

Arguments

mat4 GetProjectorProjection ( int num ) #

Returns the current projector's projection matrix for the specified projection.

Arguments

Return value

Projector's projection matrix.

void SetViewerModelview ( int num, mat4 modelview ) #

Sets the viewer's model-view matrix for the specified projection.

Arguments

mat4 GetViewerModelview ( int num ) #

Returns the current viewer's model-view matrix for the specified projection.

Arguments

Return value

Viewer's model-view matrix.

void SetViewerProjection ( int num, mat4 projection ) #

Sets the viewer's projection matrix for the specified projection.

Arguments

mat4 GetViewerProjection ( int num ) #

Returns the current viewer's projection matrix for the specified projection.

Arguments

Return value

Viewer's projection matrix.

Gui GetGui ( int num ) #

Returns a GUI instance to draw interface on for the specified projection.

Arguments

Return value

GUI instance.

void SetCamera ( int num, Camera camera ) #

Copies the camera from the specified display to the provided camera.

Arguments

  • int num - Display index.
  • Camera camera - Camera to copy the data to.

Camera GetCamera ( int num ) #

Returns the camera from the display with the specified index.

Arguments

  • int num - Display index.

Return value

Camera.
Last update: 2022-12-14
Build: ()