Unigine::AppProjectionInterface Class
This set of functions is available when the AppProjection plugin is loaded. This plugin allows creating multi-projector setups.
If the plugin is loaded together with the engine, the HAS_APP_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:
#ifdef HAS_APP_PROJECTION
// engine.projection functions
#endif
AppProjection Class
Members
int addMesh(int num, const Ptr<Mesh> & mesh, const Math::Mat4 & transform)
Adds a new mesh for the specified projection.Arguments
- int num - Projection number.
- const Ptr<Mesh> & mesh - Pointer to a mesh to be added.
- const Math::Mat4 & transform - Mesh transformation.
Return value
Total number of meshes for the specified projection.void clear()
Sets the default values for options of each projection (i.e. for the color bias, color scale, positions of projection corners, etc.).Math::vec4 getBorders(int num, const Variable & id)
Returns edge correction for the specified projection.Arguments
- int num - Projection number in range from 0 to the number of projections.
- const Variable & id - Vector with correction values for four sides.
Return value
Vector with correction values for four sides (left, right, top, bottom). The first value specifies area size (where 1 equals half of the screen) and the second power of blending.Math::vec4 getColorBias(int num)
Returns the color bias for the specified projection.Arguments
- int num - Projection number in range from 0 to the number of projections.
Return value
Per-channel color bias.Math::vec4 getColorScale(int num)
Returns the color multiplier for the specified projection.Arguments
- int num - Projection number in range from 0 to the number of projections.
Return value
Per-channel color scale.Math::ivec2 getGridSize(int num)
Returns grid sizes for the specified projection as a 2-component vector (X size, Y size).Arguments
- int num - Projection number.
Return value
Vector with X and Y components representing grid sizes along the X and Y axes respectively.Math::vec2 getGridPoint(int num, int x, int y)
Returns the coordinates of the specified grid point for the specified projection.Arguments
- int num - Projection number.
- int x - Index of the grid point along the X axis.
- int y - Index of the grid point along the Y axis.
Return value
Coordinates of the grid point.getGui(int num)
Returns a GUI instance to draw interface on the specified projection.Arguments
- int num - Projection number.
Return value
GUI instance.void getLinearity(int num, const Variable & id)
Gets non-linear stretching ratio values for each side of the specified projection (left, right, top or bottom).Arguments
- int num - Projection number in range from 0 to the number of projections.
- const Variable & id - Array with correction values for four sides.
Ptr<Mesh> getMesh(int num, int mesh_num)
Returns the specified mesh of the specified projection.Arguments
- int num - Projection number.
- int mesh_num - Mesh number.
Return value
Mesh pointer.Math::Mat4 getMeshTransform(int num, int mesh_num)
Returns the transformation of the specified mesh of the specified projection.Arguments
- int num - Projection number.
- int mesh_num - Mesh number.
Return value
Mesh transformation.Math::Mat4 getModelview(int num)
Gets the current model-view matrix used for the specified projection.Arguments
- int num - Projection number.
Return value
Model-view matrix used for the specified projection.Ptr<Texture> getMultiplyTexture(int num)
Returns the current edge blending map for the specified projection.Arguments
- int num - Projection number.
Return value
Current edge blending map.int getPrimary()
Returns the number of projection, which is used as a primary one.Return value
Projection number.Math::mat4 getProjection(int num)
Returns the current projection matrix used for the specified projection.Arguments
- int num - Projection number.
Return value
Projection matrix used for the specified projection.Math::Mat4 getProjectorModelview(int num)
Returns the current projector's model-view matrix for the specified projection.Arguments
- int num - Projection number.
Return value
Projector's model-view matrix.Math::mat4 getProjectorProjection(int num)
Returns the current projector's projection matrix for the specified projection.Arguments
- int num - Projection number.
Return value
Projector's projection matrix.float getResolutionUpscale()
Returns the current resolution upscale factor.Return value
Resolution upscale factor.Math::Mat4 getViewerModelview(int num)
Returns the current viewer's model-view matrix for the specified projection.Arguments
- int num - Projection number.
Return value
Viewer's model-view matrix.Math::mat4 getViewerProjection(int num)
Returns the current viewer's projection matrix for the specified projection.Arguments
- int num - Projection number.
Return value
Viewer's projection matrix.int isEnabled(int num)
Returns a value indicating if the specified AppProjection projection is enabled for viewport rendering.Arguments
- int num - Projection number.
Return value
1 if the projection is enabled for rendering; otherwise, 0.int isPluginEnabled()
Returns a value indicating if the AppProjection plugin is enabled.Return value
1 if the AppProjection plugin is enabled; otherwise, 0.float projectionGetGamma()
Returns the current gamma correction value for projections.Return value
Gamma correction value.int projectionGetWidth()
Returns the number of projections set via video_width CLI option.Return value
Number of projections.void projectionSetGamma(float gamma)
Sets the gamma correction value for projections.Arguments
- float gamma - Gamma correction value.
void resetGrid(int num)
Resets the grid size for the specified projection to 2 x 2.Arguments
- int num - Projection number.
void resetMesh(int num)
Resets the mesh for the specified projection.Meshes are used for complex-shaped projection screens.
Arguments
- int num - Projection number.
int restoreState(const Ptr<Stream> & stream)
Restores the state of the projections from a stream.Arguments
- const Ptr<Stream> & stream - Stream with saved state data of the projections.
Return value
1 if the state is restored successfully; otherwise, 0.int saveState(const Ptr<Stream> & stream)
Saves the state of the projections in a stream.Arguments
- const Ptr<Stream> & stream - Stream to save state data of the projections.
Return value
1 if the state is saved successfully; otherwise, 0.void setAngle(int angle)
Specifies the angle between projections, if there are more than one of them.Arguments
- int angle - Angles between surfaces on which the images are projected in degrees.
void setBorders(int num, const Variable & id)
Sets edge correction for the specified projection.Arguments
- int num - Projection number.
- const Variable & id - Vector with correction values for four sides (left, right, top, bottom). The first value specifies area size (where 1 equals half of the screen) and the second power of blending.
void setColorBias(int num, const Math::vec4 & bias)
Sets the color bias for the specified projection.Arguments
- int num - Projection number.
- const Math::vec4 & bias - Per-channel color bias.
void setColorScale(int num, const Math::vec4 & scale)
Sets the color multiplier for the specified projection.Arguments
- int num - Projection number.
- const Math::vec4 & scale - Per-channel color scale.
void setEnabled(int num, int enable)
Enables the specified AppProjection projection for viewport rendering.Arguments
- int num - Projection number.
- int enable - 1 to enable the projection for rendering; 0 to disable it.
void setGridSize(int num, int x, int y)
Sets grid sizes for the specified projection.Arguments
- int num - Projection number.
- int x - Grid size along the X axis.
- int y - Grid size along the Y axis.
void setGridPoint(int num, int x, int y, const Math::vec2 & point)
Sets the coordinates of the specified grid point for the specified projection.Arguments
- int num - Projection number.
- int x - Index of the grid point along the X axis.
- int y - Index of the grid point along the Y axis.
- const Math::vec2 & point - Coordinates of the grid point to be set.
void setLinearity(int num, const Variable & id)
Sets non-linear stretching ratio values for each side of the specified projection (left, right, top or bottom).Arguments
- int num - Projection number in range from 0 to the number of projections.
- const Variable & id - Array with correction values for four sides.
void setMaterials(int num, const char * materials)
Sets postprocess materials to be applied to the specified projection.Arguments
- int num - Projection number.
- const char * materials - Postprocess materials (comma-separated list).
void setModelview(int num, const Math::Mat4 & modelview)
Sets the model-view matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::Mat4 & modelview - Model-view matrix.
void setMultiplyImage(int num, const Ptr<Image> & image)
Sets the edge blending map for the specified projection.Arguments
- int num - Projection number.
- const Ptr<Image> & image - Pointer to an image with an edge blending map to be set.
void setMultiplyTexture(int num, const Ptr<Texture> & texture)
Sets the edge blending map for the specified projection.Arguments
- int num - Projection number.
- const Ptr<Texture> & texture - Pointer to a texture with an edge blending map to be set.
void setPluginEnabled(int enable)
Enables or disables the AppProjection plugin.All distortions will be removed.
Arguments
- int enable - 1 to enable the AppProjection plugin; 0 to disable it.
void setPrimary(int primary)
Specifies what projection to use as a primary one.Arguments
- int primary - Projection number.
void setProjection(int num, const Math::mat4 & projection)
Sets the projection matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::mat4 & projection - Projection matrix.
void setProjectorModelview(int num, const Math::Mat4 & modelview)
Sets the projector's model-view matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::Mat4 & modelview - Projector's model-view matrix.
void setProjectorProjection(int num, const Math::mat4 & projection)
Sets the projector's projection matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::mat4 & projection - Projector's projection matrix.
void setResolutionUpscale(float upscale)
Sets the resolution upscale factor.Arguments
- float upscale - Resolution upscale factor.
void setViewerModelview(int num, const Math::Mat4 & modelview)
Sets the viewer's model-view matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::Mat4 & modelview - Viewer's model-view matrix.
void setViewerProjection(int num, const Math::mat4 & projection)
Sets the viewer's projection matrix for the specified projection.Arguments
- int num - Projection number.
- const Math::mat4 & projection - Viewer's projection matrix.
void setReflectionMask(int num, int mask)
Sets a bit mask for rendering reflections on the specified projection. Reflections are rendered in the viewport if masks of reflective materials match this one (one matching bit is enough).Arguments
- int num - Projection number.
- int mask - Integer, each bit of which is a mask.
void setViewportMask(int num, int mask)
Sets a viewport bit mask for the specified projection. Object surfaces, materials, decals, lights and GUI objects will be rendered into this viewport only if their viewport mask matches this one (one matching bit is enough).Arguments
- int num - Projection number.
- int mask - Integer, each bit of which is a mask.
void showSetupWindow()
Shows the setup window for the AppProjection plugin.Last update: 2017-12-21
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)