UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
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
应用程序接口
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

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.

int hasGeodeticPivot ( ) #

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

Return value

1 if the rendering scene has a GeodeticPivot; otherwise, 0.

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.

int isNode ( ) #

Returns a value indicating if node rendering is in progress.

Return value

1 if the node rendering is in progress, otherwise 0.

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 frustum ) #

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 frustum - 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 & 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 & 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.

int isReflection ( ) #

Returns a value indicating if reflection rendering is in progress.

Return value

1 if reflection rendering is in progress, otherwise 0.

int getReflectionViewportMask ( ) #

Returns the current reflection viewport mask.

Return value

Current reflection viewport mask.

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

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.
  • int is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.

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

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.
  • int is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.

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

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.
  • int is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.

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

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.
  • int is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.

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

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.
  • int is_screen_space - Screenspace flag: 1 to set the parameters for the screen space effect; otherwise 0.

int isShadow ( ) #

Returns a value indicating if shadows are rendered.

Return value

1 if shadows are rendered; otherwise, 0.

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.

int isStereo ( ) #

Returns a value indicating if stereo rendering is enabled.

Return value

1 if the stereo rendering is enabled; otherwise, 0.

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 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 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 ( ) #

Returns the SSR texture.

Return value

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<RenderTarget> getRenderTarget ( ) #

Returns the render target.

Return value

Render target.

Ptr<RenderTarget> getPostRenderTarget ( ) #

Returns the post texture render.

Return value

Post render target.

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.

void saveState ( ) #

Saves current renderer matrices.

int useDynamicReflections ( ) #

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

Return value

1 if rendering of dynamic reflections is enabled; otherwise, 0.

int useOcclusionQueries ( ) #

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

Return value

1 if the occlusion query test is enabled; otherwise, 0.

int usePostEffects ( ) #

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

Return value

1 if rendering of post effects is enabled; otherwise, 0.

int useShadows ( ) #

Returns a value indicating if rendering of shadows is enabled.

Return value

1 if rendering of shadows is enabled; otherwise, 0.

int useTAA ( ) #

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

Return value

1 if the Temporal Anti-Aliasing (TAA) is enabled; otherwise, 0.

int useVelocityBuffer ( ) #

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

Return value

1 if rendering to the velocity buffer is enabled; otherwise, 0.

int useVisualizer ( ) #

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

Return value

1 if rendering of the visualizer is enabled; otherwise, 0.

Ptr<Texture> getTextureSSCurvature ( ) #

Returns the texture used by the he Screen-Space Dirt (SSDirt) effect.

Return value

Curvature texture used by the Screen-Space Dirt (SSDirt) effect.

Ptr<Texture> getTextureAutoWhiteBalance ( ) #

Returns the auto white balance texture.

Return value

Auto-white-balance texture.

Ptr<Texture> getTextureRefractionMask ( ) #

Returns the refraction mask texture.

Return value

Refraction mask texture.

Ptr<Texture> createCustomTexture3D ( const char * name, int width, int height, int depth, int format, int flags = 0 ) #

Creates a custom 3D texture. Such textures can be used in your materials.

In your base material:

Source code (XML)
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->

Create a corresponding custom texture via code:

Source code (C++)
// ...
 // creating a custom texture
 Renderer::createCustomTexture3D("texture_name", 512, 512, 512, Texture::FORMAT_RGBA8);

Arguments

  • const char * name - Texture name.
  • int width - Texture width, in pixels.
  • int height - Texture height, in pixels.
  • int depth - Texture depth, in pixels.
  • int format - Texture format, one of the Texture::FORMAT_ values.
  • int flags - Texture flags. A combination of flags (such as Texture::USAGE_, Texture::WRAP_, etc.)

Return value

New created custom 3D texture.

Ptr<Texture> createCustomTexture2D ( const char * name, int width, int height, int format, int flags = 0 ) #

Creates a custom 2D texture array. Such texture can be used in your materials.

In your base material:

Source code (XML)
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->

Create a corresponding custom texture via code:

Source code (C++)
// ...
 // creating a custom texture
 Renderer::createCustomTexture2D("texture_name", 512, 512, Texture::FORMAT_RGBA8);

Arguments

  • const char * name - Texture name.
  • int width - Texture width, in pixels.
  • int height - Texture height, in pixels.
  • int format - Texture format, one of the Texture::FORMAT_ values.
  • int flags - Texture flags. A combination of flags (such as Texture::USAGE_, Texture::WRAP_, etc.)

Return value

New created custom 2D texture.

Ptr<Texture> createCustomTexture2DArray ( const char * name, int width, int height, int depth, int format, int flags = 0 ) #

Creates a custom 2D texture array. Such texture can be used in your materials.

Source code (XML)
<!-- ... -->
<texture type="texture_name"/>
<!-- ... -->

Create a corresponding custom texture via code:

Source code (C++)
// ...
 // creating a custom texture
 Renderer::createCustomTexture2DArray("texture_name", 512, 512, 16, Texture::FORMAT_RGBA8);

Arguments

  • const char * name - Texture name.
  • int width - Texture width, in pixels.
  • int height - Texture height, in pixels.
  • int depth - Number of elements in the array.
  • int format - Texture format, one of the Texture::FORMAT_ values.
  • int flags - Texture flags. A combination of flags (such as Texture::USAGE_, Texture::WRAP_, etc.)

Return value

New created custom 2D texture array.

Ptr<Texture> getCustomTexture ( const char * name ) #

Returns a custom texture by its name. Custom textures can be created using createCustomTexture3D(), createCustomTexture3D(), and createCustomTexture3D() methods.

Arguments

  • const char * name - Custom texture name.

Return value

Custom texture corresponding to the specified name, if it exists, otherwise nullptr.
Last update: 2019-11-28