UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Программирование
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and 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
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin

Unigine::Renderer Class

Header:#include <UnigineRender.h>

A basic interface for setting a renderer state (changing rendering passes parameters): pass shader uniforms, set modelview and projection matrices, etc. This class is used for rendering custom nodes (for example, a node inherited from ObjectExtern).

Renderer Class

Members


Renderer * get()

Returns a Renderer instance.

Return value

Renderer instance.

void clearStates()

Clears rendering states and textures.
Notice
The shader will also be cleared.

void clearShader()

Clears the shader.

void setBlendFunc(int pass, const Ptr<Material> & material)

Sets the light blending function for a given rendering pass and material.

Arguments

void setBufferMask(int pass, const Ptr<Material> & material)

Sets the buffer mask for a given rendering pass and material.
Notice
If the material does not use a depth mask and ambient pass is specified, the BUFFER_COLOR mask will be set; otherwise, the BUFFER_ALL mask will be set.

Arguments

  • int pass - Rendering pass. One of the following values:
  • const Ptr<Material> & material - Material smart pointer.

void setCameraPosition(const Math::Vec3 & position)

Sets a new camera position.

Arguments

  • const Math::Vec3 & position - New camera position.

Math::Vec3 getCameraPosition()

Returns current camera position.

Return value

Current camera position.

void setDepthFunc(int pass, const Ptr<Material> & material)

Sets depth function for a given rendering pass and material.
Notice
If the depth_test option of the material is enabled, the DEPTH_GEQUAL function will be used; otherwise the depth comparison function will be disabled.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables, except the following: PASS_DEFERRED, PASS_SHADOW, PASS_DEPTH_PRE_PASS, PASS_EMISSION.
  • const Ptr<Material> & material - Material smart pointer.

bool hasGeodeticPivot()

Returns a value indicating if the rendering scene has a GeodeticPivot.

Return value

true if the rendering scene has a GeodeticPivot; otherwise, false.

int getHeight()

Returns current screen height.

Return value

Screen height.

int getWidth()

Returns current screen width.

Return value

Screen width.

Math::Mat4 getIModelview()

Returns current inverse view matrix.

Return value

Returns current inverse view matrix.

void setMaterial(int pass, const Ptr<Material> & material)

Sets material and initialize all material textures.

Arguments

  • int pass - Rendering pass.
  • const Ptr<Material> & material - Material smart pointer.

void setModelview(const Math::Mat4 & modelview)

Sets current view matrix.

Arguments

  • const Math::Mat4 & modelview - New view matrix to be set.

Math::Mat4 getModelview()

Returns current view matrix.

Return value

Returns current view matrix.

bool isNode()

Returns a value indicates that the node rendering is in process.

Return value

true if the node rendering is in process.

Vector< Ptr<Object> > getObjects()

Retrieves the list of all rendering scene objects and puts it to the buffer.

Return value

Buffer containing all scene objects.

void setObliqueFrustum(int enabled)

Enables or disables obliqueness of the viewing frustum.
Notice
It is recommended to set oblique viewing frustum using this method, as it doesn't affect the projection matrix. To specify the near clipping plane use the setObliqueFrustumPlane() method.

Arguments

  • int enabled - 1 to enable oblique viewing frustum; 0 to disable it.

int isObliqueFrustum()

Returns a value indicating if the viewing frustum is oblique.

Return value

1 if the viewing frustum is oblique; otherwise, 0.

void setObliqueFrustumPlane(const Math::Vec4 & clipping_plane)

Sets the oblique near clipping plane of the viewing frustum.
Notice
This method does not affect the projection matrix. To enable the oblique frustum use the setObliqueFrustum() method.

Arguments

  • const Math::Vec4 & clipping_plane - World coordinates of the oblique near clipping plane to set (Nx, Ny, Nz, D), where Nx, Ny, Nz - coordinates of the plane normal, D - distance from the origin to the plane.

Math::Vec4 getObliqueFrustumPlane()

Returns the oblique near clipping plane of the viewing frustum.

Return value

World coordinates of the oblique near clipping plane to set (Nx, Ny, Nz, D), where Nx, Ny, Nz - coordinates of the plane normal, D - distance from the origin to the plane.

void setOldModelview(const Math::Mat4 & modelview)

Updates the old view matrix.

Arguments

  • const Math::Mat4 & modelview - Old view matrix to be set.

Math::Mat4 getOldModelview()

Returns the old view matrix.

Return value

Old view matrix.

void setOldProjection(const Math::mat4 & projection)

Updates the old projection matrix.

Arguments

  • const Math::mat4 & projection - Old projection matrix to be set.

Math::mat4 getOldProjection()

Returns the old projection matrix.

Return value

Old projection matrix.

void setPolygonCull(int pass, const Ptr<Material> & material)

Sets the polygon culling mode for a given rendering pass and material.
Notice
If the material is one-sided, the back-facing polygons will be culled; otherwise, polygon culling for the material will be disabled.

Arguments

  • int pass - Rendering pass. One of the RENDER_PASS_* variables.
  • const Ptr<Material> & material - Material smart pointer.

void setPolygonOffset(int pass, const Ptr<Material> & material)

Sets the polygon bias offset value for a given rendering pass and material. Polygon offset can be used to prevent the Z-fighting effect.

Arguments

  • int pass - Rendering pass. One of the RENDER_PASS_* variables.
  • const Ptr<Material> & material - Material smart pointer.

Math::mat4 getProjectionWithoutTAA()

Returns current projection matrix without TAA.

Return value

Projection matrix without TAA.

void setProjection(const Math::mat4 & projection)

Updates the current projection matrix.
Notice
It is not recommended to use this method for setting obliqueness of the near clipping plane of the frustum, as in this case a number of features (such as clouds, shadows, TAA, a number of engine optimizations, etc.) will not function properly. Please, use the setObliqueFrustum() method instead.

Arguments

  • const Math::mat4 & projection - Projection matrix to be set.

Math::mat4 getProjection()

Returns current projection matrix.

Return value

Current projection matrix.

bool isReflection()

Returns a value indicating if the reflection rendering is in process.

Return value

true if the reflection rendering is in process.

int getReflectionMask()

Returns current reflection mask.

Return value

Returns current reflection mask.

void setShaderParameters(int pass, const Ptr<Shader> & shader, bool is_screen_space = false)

Sets the parameters of the specified shader for a given rendering pass.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables.
  • const Ptr<Shader> & shader - Shader smart pointer.
  • bool is_screen_space - Screenspace flag: true to set the parameters for the screen space effect; otherwise false.

void setShaderParameters(int pass, const Ptr<Shader> & shader, const Ptr<Material> & material, bool is_screen_space = false)

Sets the parameters of the specified shader for a given rendering pass and material.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables.
  • const Ptr<Shader> & shader - Shader smart pointer.
  • const Ptr<Material> & material - Material smart pointer.
  • bool is_screen_space - Screenspace flag: true to set the parameters for the screen space effect; otherwise false.

void setShaderParameters(int pass, const Ptr<Shader> & shader, const Ptr<Material> & material, const Ptr<Object> & object, int surface, bool is_screen_space = false)

Sets the parameters of the specified shader for a given rendering pass, material, object and surface.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables.
  • const Ptr<Shader> & shader - Shader smart pointer.
  • const Ptr<Material> & material - Material smart pointer.
  • const Ptr<Object> & object - Object smart pointer.
  • int surface - Surface number.
  • bool is_screen_space - Screenspace flag: true to set the parameters for the screen space effect; otherwise false.

void setShaderParameters(int pass, const Ptr<Material> & material, bool is_screen_space = false)

Sets the parameters of the shader for a given rendering pass and material.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables.
  • const Ptr<Material> & material - Material smart pointer.
  • bool is_screen_space - Screenspace flag: true to set the parameters for the screen space effect; otherwise false.

void setShaderParameters(int pass, const Ptr<Object> & object, int surface, bool is_screen_space = false)

Sets the parameters of the shader for a given rendering pass, object and surface.

Arguments

  • int pass - Rendering pass. One of the PASS_* variables.
  • const Ptr<Object> & object - Object smart pointer.
  • int surface - Surface number.
  • bool is_screen_space - Screenspace flag: true to set the parameters for the screen space effect; otherwise false.

bool isShadow()

Returns a value indicating if shadows are rendered.

Return value

true if shadows are rendered; otherwise, false.

int checkSkipFlags(int flags)

Returns a value indicating if the specified skip flag is set.

Arguments

Return value

1 if the specified skip flag is set; otherwise, 0.

int getSkipFlags()

Returns the skip flag set for the rendering viewport.

Return value

Skip flag.

bool isStereo()

Returns a value indicating if stereo rendering is enabled.

Return value

true if the stereo rendering is enabled; otherwise, false.

int getStereoMode()

Returns the current stereo mode.

Return value

One of the RENDER_STEREO_* variables:

Ptr<Texture> getTextureAutoExposure()

Returns the autoexposure texture.

Return value

Autoexposure texture.

Ptr<Texture> getTextureAuxiliary()

Returns the auxiliary texture.

Return value

Auxiliary texture.

Ptr<Texture> getTextureBentNormal()

Returns the bent normal texture. This texture is used during the Screen-Space Global Illumination stage.

Return value

Bent normal texture.

Ptr<Texture> getTextureClouds()

Returns the clouds texture. This texture is rendered during the separate clouds pass.

Return value

Clouds texture.

Ptr<Texture> getTextureColor()

Returns the color texture.

Return value

Color texture.

Ptr<Texture> getTextureColorOld()

Returns the color old texture.

Return value

Color old texture.

Ptr<Texture> getTextureColorOldReprojection()

Returns the color old reprojection texture.

Return value

Color old reprojection texture.

Ptr<Texture> getTextureColorOpacity()

Returns the color opacity texture.

Return value

Color opacity texture.

Ptr<Texture> getTextureCurrentDepth()

Returns the current depth texture.

Return value

Current depth texture.

Ptr<Texture> getTextureDOFMask()

Returns the DoF mask texture. This texture is used at the camera effects stage.

Return value

DoF mask texture

Ptr<Texture> getTextureGBufferFeatures()

Returns the texture that stores intensity of the screen-space bevel effect.

Return value

Texture storing intensity of the bevels. The texture is RGBA8, the intensity value is written to the R channel.

Ptr<Texture> getTextureGBufferAlbedo()

Returns the Gbuffer albedo texture.

Return value

Gbuffer albedo texture.

Ptr<Texture> getTextureTerrainFlatPosition()

Returns the terrain geodetic flat position texture.

Return value

Terrain geodetic flat position texture.

Ptr<Texture> getTextureGBufferLightmap()

Returns the Gbuffer lightmap texture.

Return value

Gbuffer lightmap texture.

Ptr<Texture> getTextureGBufferMaterialMask()

Returns the Gbuffer material mask texture.

Return value

Gbuffer material mask texture.

Ptr<Texture> getTextureGBufferNormal()

Returns the Gbuffer normal texture.

Return value

Gbuffer normal texture.

Ptr<Texture> getTextureGBufferShading()

Returns the Gbuffer shading texture.

Return value

Gbuffer shading texture.

Ptr<Texture> getTextureGBufferVelocity()

Returns the Gbuffer velocity texture.

Return value

Gbuffer velocity texture.

Ptr<Texture> getTextureLights()

Returns the array texture storing contents of the deferred light map buffer and the deferred reflections buffer. The texture contains four RG11B10F textures: the first layer stores the diffuse light, the second layer stores the specular light, the third one is for the environment reflection color, and the fourth one is for the environment ambient light.

Return value

A texture storing contents of the deferred light map buffer and the deferred reflections buffer.

Ptr<Texture> getTextureOpacityDepth()

Returns the opacity depth texture.

Return value

Opacity depth texture.

Ptr<Texture> getTextureRefraction()

Returns the refraction texture.

Return value

Refraction texture.

Ptr<Texture> getTextureSSR()

Return value

SSR texture.Returns the SSR texture.

Ptr<Texture> getTextureSSAO()

Returns the SSAO texture.

Return value

SSAO texture.

Ptr<Texture> getTextureSSGI()

Returns the SSGI texture.

Return value

SSGI texture.

Ptr<Texture> getTextureTransparentBlur()

Returns the transparent blur texture. This texture is rendered during the transparent blur pass.

Return value

Transparent blur texture.

Ptr<TextureRender> getTextureRender()

Returns the texture render.

Return value

Texture render smart pointer.

Ptr<TextureRender> getPostTextureRender()

Returns the post texture render.

Return value

Post texture render smart pointer.

Ptr<Viewport> getViewport()

Returns the rendering viewport.

Return value

Rendering viewport smart pointer.

int getViewportMask()

Returns current viewport mask.

Return value

Returns current viewport mask.

float getZFar()

Return current far clipping plane.

Return value

Returns current far clipping plane.

float getZNear()

Returns current near clipping plane.

Return value

Returns current near clipping plane.

void restoreState()

Restores current renderer matrices.
Warning
This function is deprecated and will be removed in the next release.

void saveState()

Saves current renderer matrices.
Warning
This function is deprecated and will be removed in the next release.

bool useDynamicReflections()

Returns a value indicating if rendering of dynamic reflections is enabled.

Return value

true if rendering of dynamic reflections is enabled; otherwise, false.

bool useOcclusionQueries()

Returns a value indicating if the occlusion query test is enabled.

Return value

true if the occlusion query test is enabled; otherwise, false.

bool usePostEffects()

Returns a value indicating if rendering of post effects is enabled.

Return value

true if rendering of post effects is enabled; otherwise, false.

bool useShadows()

Returns a value indicating if rendering of shadows is enabled.

Return value

true if rendering of shadows is enabled; otherwise, false.

bool useTAA()

Returns a value indicating if the Temporal Anti-Aliasing (TAA) is enabled.

Return value

true if the Temporal Anti-Aliasing (TAA) is enabled; otherwise, false.

bool useVelocityBuffer()

Returns a value indicating if rendering to the velocity buffer is enabled.

Return value

true if rendering to the velocity buffer is enabled; otherwise, false.

bool useVisualizer()

Returns a value indicating if rendering of the visualizer is enabled.

Return value

true if rendering of the visualizer is enabled; otherwise, false.

int RENDER_STEREO_VERTICAL

Description

Vertical split stereo mode.

int RENDER_STEREO_HORIZONTAL

Description

Horizontal split stereo mode.

int RENDER_STEREO_DEFAULT

Description

Default stereo mode.
Last update: 04.06.2018