This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
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::Render Class

Unigine render. This interface provides access to Unigine rendering functions. For example, it is used by AppWall application to render onto multiple monitors.

To use this class, include the UnigineRender.h file.

Unigine::Render Class

Members


virtual ~Render ()

Virtual destructor.

static Render * get ()

Return a pointer to the existing render.

Return value

Pointer to the existing render.

static void addRenderer (Renderer * render)

Adds the external renderer.

Arguments

  • Renderer * render - Pointer to the external renderer.

static void removeRenderer (Renderer * render)

Removes the external renderer.

Arguments

  • Renderer * render - Pointer to the external renderer.

virtual void setEnabled (int enable) const =0

Enable or disable the render.

Arguments

  • int enable - 1 to enable the render, 0 to disable it.

virtual int isEnabled () const =0

Return a value indicating if the render is enabled.

Return value

Return 1 if the render is enabled; otherwise, 0 is returned.

virtual void setFirstFrame (int first) const =0

The first frame flag.

Arguments

  • int first - The first frame flag.

virtual int isFirstFrame () const =0

Return the first frame flag.

Return value

Return the first frame flag.

virtual void setData (const char * data) const =0

Sets user data associated with the world. In the *.world file, the data is set in the data tag.

Arguments

  • const char * data - New user data.

virtual const char * getData () const =0

Returns user string data associated with the world. This string is written directly into the data tag of the *.world file.

Return value

User string data.

virtual void setBudget (float budget) const =0

Sets the value of the render budget, which limits the number of loaded/created graphics resources during a frame according to the loading/creation time.

Arguments

  • float budget - The budget value in seconds.

virtual float getBudget () const =0

Returns the value of the render budget, which limits the number of loaded/created graphics resources during a frame according to the loading/creation time.

Return value

The budget value in seconds. The default value is 1/60.

virtual void updateCameraOffset (const UNIGINE_VEC3 & position) const =0

Update virtual camera offset.

Arguments

  • const UNIGINE_VEC3 & position - Camera position.

virtual void setCameraOffset (const UNIGINE_VEC3 & offset) const =0

Set virtual camera offset.

Arguments

  • const UNIGINE_VEC3 & offset - Virtual camera offset.

virtual UNIGINE_VEC3 getCameraOffset () const =0

Return virtual camera offset.

Return value

Return virtual camera offset.

virtual void setCameraThreshold (float threshold) const =0

Set virtual camera threshold.

Arguments

  • float threshold - Virtual camera threshold.

virtual float getCameraThreshold () const =0

Get virtual camera threshold.

Return value

Virtual camera threshold.

virtual void setShaderDefines (const char * defines) const =0

Set additional shader defines.

Arguments

  • const char * defines - Additional shader defines.

virtual const char * getShaderDefines () const =0

Return additional shader defines.

Return value

Additional shader defines.

virtual void setStereoDistance (float distance) const =0

Set stereo distance.

Arguments

  • float distance - Stereo distance.

virtual float getStereoDistance () const =0

Get stereo distance.

Return value

Stereo distance.

virtual void setStereoRadius (float radius) const =0

Set stereo radius.

Arguments

  • float radius - Stereo radius.

virtual float getStereoRadius () const =0

Get stereo radius.

Return value

Stereo radius.

virtual void setStereoOffset (float offset) const =0

Set stereo offset.

Arguments

  • float offset - Stereo offset.

virtual float getStereoOffset () const =0

Get stereo offset.

Return value

Stereo offset.

virtual TexturePtr getBlack2DTexture () const =0

Return black 2D texture.

Return value

Black 2D texture.

virtual TexturePtr getBlackCubeTexture () const =0

Return black Cube texture.

Return value

Black Cube texture.

virtual TexturePtr getWhite2DTexture () const =0

Return white 2D texture.

Return value

White 2D texture.

virtual TexturePtr getWhiteCubeTexture () const =0

Return white Cube texture.

Return value

White Cube texture.

virtual TexturePtr getGray2DTexture () const =0

Return gray 2D texture.

Return value

Gray 2D texture.

virtual TexturePtr getGrayCubeTexture () const =0

Return gray Cube texture.

Return value

Gray Cube texture.

virtual TexturePtr getEnvironmentTexture () const =0

Return environment texture.

Return value

Environment texture.

virtual void renderViewport (const mat4 & projection, const UNIGINE_MAT4 & modelview, const char * materials, int viewport_mask, int reflection_mask, int shadows, int visualizer) const =0

Renders the viewport into the current render target.

Arguments

  • const mat4 & projection - Projection matrix.
  • const UNIGINE_MAT4 & modelview - Modelview matrix.
  • const char * materials - Post materials (comma separated).
  • int viewport_mask - Viewport bit mask.
  • int reflection_mask - Reflection bit mask.
  • int shadows - Shadows toggle.
  • int visualizer - Visualizer toggle.

virtual void renderViewport (const mat4 & projection, const UNIGINE_MAT4 & modelview, const mat4 * projections, const UNIGINE_MAT4 * modelviews, const char * materials, int viewport_mask, int reflection_mask, int shadows, int visualizer) const =0

Renders the stereo viewport into the current render target.

Arguments

  • const mat4 & projection - Mono projection matrix.
  • const UNIGINE_MAT4 & modelview - Mono modelview matrix.
  • const mat4 * projections - Stereo projection matrices.
  • const UNIGINE_MAT4 * modelviews - Stereo modelview matrices.
  • const char * materials - Post materials (comma separated).
  • int viewport_mask - Viewport bit mask.
  • int reflection_mask - Reflection bit mask.
  • int shadows - Shadows toggle.
  • int visualizer - Visualizer toggle.

virtual void renderNode (const mat4 & projection, const UNIGINE_MAT4 & modelview, const NodePtr & node, const char * materials, int viewport_mask, int reflection_mask, int shadows) const =0

Renders a specific node with all children into the current render target.

Arguments

  • const mat4 & projection - Projection matrix.
  • const UNIGINE_MAT4 & modelview - Modelview matrix.
  • const NodePtr & node - Target node pointer.
  • const char * materials - Post materials (comma separated).
  • int viewport_mask - Viewport bit mask.
  • int reflection_mask - Reflection bit mask.
  • int shadows - Shadows toggle.

virtual void renderProcedurals (const Vector< MaterialPtr > & materials) const =0

Render procedural materials.

Arguments

  • const Vector< MaterialPtr > & materials - Procedural materials list.

virtual void renderImage2D (const mat4 & projection, const UNIGINE_MAT4 & modelview, const ImagePtr & image, int width, int height, const char * materials, int hdr) const =0

Renders the scene into a 2D image.

Arguments

  • const mat4 & projection - Projection matrix.
  • const UNIGINE_MAT4 & modelview - Modelview matrix.
  • const ImagePtr & image - Destination image pointer.
  • int width - Width of the image.
  • int height - Height of the image.
  • const char * materials - Post materials (comma separated).
  • int hdr - HDR toggle.

virtual void renderImageCube (const mat4 & projection, const UNIGINE_VEC3 & position, const ImagePtr & image, int size, const char * materials, int hdr) const =0

Renders the scene into a cube map image.

Arguments

  • const mat4 & projection - Projection matrix.
  • const UNIGINE_VEC3 & position - World position.
  • const ImagePtr & image - Destination image pointer.
  • int size - Size of the image.
  • const char * materials - Post materials (comma separated).
  • int hdr - HDR toggle.

virtual void setRenderMaterials (const char * materials) const =0

Sets render postprocess materials that are applied before all other postprocess (such as HDR, DOF, etc.) are rendered. Materials are applied in the order of listing.

Arguments

  • const char * materials - List of comma-separated postprocess material names.

virtual const char * getRenderMaterials () const =0

Returns names of the current postprocess materials that are applied before all other postprocess (such as HDR, DOF, etc.) are rendered. Materials are applied in the order of listing.

Return value

Names of the current render materials.

virtual void setCompositeMaterial (const char * materials) const =0

Sets a custom composite material that specifies a custom shader used for the final composition of the full-screen image instead of the default one.

Arguments

  • const char * materials - Name of the composite material.

virtual const char * getCompositeMaterial () const =0

Returns a name of the current composite material that specifies a custom shader used for the final composition of the full-screen image instead of the default one.

Return value

Name of the current composite material.

virtual void setPostMaterials (const char * materials) const =0

Sets post postprocess materials that are applied after all other postprocess (such as HDR, DOF, etc.) are rendered. Materials are applied in the order of listing. They are used together with Unigine::Player::setPostMaterials(), if any.

Arguments

  • const char * materials - List of comma-separated post postprocess material names.

virtual const char * getPostMaterials () const =0

Returns names of the current post postprocess materials that are applied after all other postprocess (such as HDR, DOF, etc.) are rendered. Materials are applied in the order of listing.

Return value

Names of the current post postprocess materials.

virtual void setFadeColor (const vec4 & color) const =0

Sets the current fade color for the scene on the screen. By gradually changing this value it is possible to create "fade in" and "fade out" effects depending on the w component of the given vector. For example, when the following vectors are passed the result will be:
  • vec4(1,1,1,1) - a fully white screen. Positive w results in additive blending.
  • vec4(0.5,0.5,0.5,1) - light colors on the screen.
  • vec4(1,0,0,1) - R channel for all screen colors is to its maximum; G and B without changes.
  • vec4(0,0,0,0) - there is no fading (no color alterations are done to the screen).
  • vec4(1,1,1,-1) - a fully black screen. Negative w results in scene colors * (1 - RGB), where RGB is the first three components of the passed vector.
  • vec4(0.5,0.5,0.5,-1) - dark colors on the screen.

Arguments

  • const vec4 & color - Fade color for the scene on the screen. The provided vector represents RGB channel values (first three components) and a fading coefficient (w component). All components are saturated in the range [-1; 1].

virtual vec4 getFadeColor () const =0

Returns the current fade color of the scene.

Return value

The current fade color.

virtual int loadSettings (const char * name) const =0

Loads the render settings from a given file.

Arguments

  • const char * name - Path to an XML file with desired settings.

Return value

Returns 1 if the settings are loaded successfully; otherwise, 0.

virtual int saveSettings (const char * name, int force) const =0

Saves the current render settings to a given file.

Arguments

  • const char * name - Path to an XML file to which settings will be saved.
  • int force - Forced saving of render settings.

Return value

Returns 1 if the settings are saved successfully ; otherwise, 0.

virtual int loadWorld (const XmlPtr & xml) const =0

Loads a render state from the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int saveWorld (const XmlPtr & xml, int force) const =0

Saves a render state into the Xml.

Arguments

  • const XmlPtr & xml - Xml smart pointer.
  • int force - Forced saving of the render state.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int saveState (const StreamPtr & stream) const =0

Saves a render state into the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

virtual int restoreState (const StreamPtr & stream) const =0

Restores a render state from the stream.

Arguments

  • const StreamPtr & stream - Stream smart pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

Unigine::Render::anonymous_93 Enumeration

PASS_WIREFRAME = 0
PASS_DEFERRED
PASS_AUXILIARY
PASS_REFRACTION
PASS_VELOCITY
PASS_AMBIENT
PASS_LIGHT_PROB
PASS_LIGHT_SPOT
PASS_LIGHT_OMNI
PASS_LIGHT_PROJ
PASS_LIGHT_WORLD
PASS_TRANSLUCENT
PASS_SHADOW
PASS_POST
Last update: 2017-07-03
Build: ()