This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
UnigineEditor
界面概述
资产工作流程
设置和首选项
项目开发
调整节点参数
Setting Up Materials
Setting Up Properties
照明
Landscape Tool
Sandworm
使用编辑器工具执行特定任务
Extending Editor Functionality
嵌入式节点类型
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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


void clearStates ( ) #

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

void clearShader ( ) #

Clears the shader.

void setBlendFunc ( Render::PASS pass, const Ptr<Material> & material ) const#

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

Arguments

void setBufferMask ( Render::PASS pass, const Ptr<Material> & material ) const#

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

void setCameraPosition ( const Math::Vec3 & position ) #

Sets a new camera position.

Arguments

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

Math::Vec3 getCameraPosition ( ) const#

Returns current camera position.

Return value

Current camera position.

void setDepthFunc ( Render::PASS pass, const Ptr<Material> & material ) const#

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

  • Render::PASS 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

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

int getHeight ( ) const#

Returns current screen height.

Return value

Screen height.

int getWidth ( ) const#

Returns current screen width.

Return value

Screen width.

Math::Mat4 getIModelview ( ) const#

Returns current inverse view matrix.

Return value

Returns current inverse view matrix.

void setMaterial ( Render::PASS pass, const Ptr<Material> & material ) #

Sets material and initialize all material textures.

Arguments

void setModelview ( const Math::Mat4 & modelview ) #

Sets current view matrix.

Arguments

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

Math::Mat4 getModelview ( ) const#

Returns current view matrix.

Return value

Returns current view matrix.

bool isNode ( ) const#

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 ( bool 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

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

bool isObliqueFrustum ( ) const#

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

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

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

Returns the old projection matrix.

Return value

Old projection matrix.

void setPolygonCull ( Render::PASS pass, const Ptr<Material> & material ) const#

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

Math::mat4 getProjectionWithoutTAA ( ) const#

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

Returns current projection matrix.

Return value

Current projection matrix.

bool isReflection ( ) const#

Returns a value indicating if reflection rendering is in progress.

Return value

1 if reflection rendering is in progress, otherwise 0.

int getReflectionViewportMask ( ) const#

Returns the current reflection viewport mask.

Return value

Current reflection viewport mask.

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

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

Arguments

  • Render::PASS 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 ( Render::PASS 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

  • Render::PASS 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 ( Render::PASS 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

  • Render::PASS 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 ( Render::PASS pass, const Ptr<Material> & material, int is_screen_space = 0 ) #

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

Arguments

  • Render::PASS 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 ( Render::PASS 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

  • Render::PASS 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.

bool isShadow ( ) const#

Returns a value indicating if shadows are rendered.

Return value

1 if shadows are rendered; otherwise, 0.

int checkSkipFlags ( int flags ) const#

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

Returns the skip flag set for the rendering viewport.

Return value

Skip flag.

bool isStereo ( ) const#

Returns a value indicating if stereo rendering is enabled.

Return value

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

int getStereoMode ( ) const#

Returns the current stereo mode.

Return value

One of the RENDER_STEREO_* variables:

Ptr<Texture> getTextureAutoExposure ( ) const#

Returns the autoexposure texture.

Return value

Autoexposure texture.

Ptr<Texture> getTextureAuxiliary ( ) const#

Returns the auxiliary texture.

Return value

Auxiliary texture.

Ptr<Texture> getTextureBentNormal ( ) const#

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

Return value

Bent normal texture.

Ptr<Texture> getTextureClouds ( ) const#

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

Return value

Clouds texture.

Ptr<Texture> getTextureColor ( ) const#

Returns the color texture.

Return value

Color texture.

Ptr<Texture> getTextureColorOld ( ) const#

Returns the color old texture.

Return value

Color old texture.

Ptr<Texture> getTextureColorOldReprojection ( ) const#

Returns the color old reprojection texture.

Return value

Color old reprojection texture.

Ptr<Texture> getTextureColorOpacity ( ) const#

Returns the color opacity texture.

Return value

Color opacity texture.

Ptr<Texture> getTextureCurrentDepth ( ) const#

Returns the current depth texture.

Return value

Current depth texture.

Ptr<Texture> getTextureDOFMask ( ) const#

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

Return value

DoF mask texture

Ptr<Texture> getTextureGBufferFeatures ( ) const#

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

Returns the Gbuffer albedo texture.

Return value

Gbuffer albedo texture.

Ptr<Texture> getTextureGBufferMaterialMask ( ) const#

Returns the Gbuffer material mask texture.

Return value

Gbuffer material mask texture.

Ptr<Texture> getTextureGBufferNormal ( ) const#

Returns the Gbuffer normal texture.

Return value

Gbuffer normal texture.

Ptr<Texture> getTextureGBufferShading ( ) const#

Returns the Gbuffer shading texture.

Return value

Gbuffer shading texture.

Ptr<Texture> getTextureGBufferVelocity ( ) const#

Returns the Gbuffer velocity texture.

Return value

Gbuffer velocity texture.

Ptr<Texture> getTextureLights ( ) const#

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

Returns the opacity depth texture.

Return value

Opacity depth texture.

Ptr<Texture> getTextureRefraction ( ) const#

Returns the refraction texture.

Return value

Refraction texture.

Ptr<Texture> getTextureSSR ( ) const#

Returns the SSR texture.

Return value

SSR texture.

Ptr<Texture> getTextureSSAO ( ) const#

Returns the SSAO texture.

Return value

SSAO texture.

Ptr<Texture> getTextureSSGI ( ) const#

Returns the SSGI texture.

Return value

SSGI texture.

Ptr<Texture> getTextureTransparentBlur ( ) const#

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

Return value

Transparent blur texture.

Ptr<RenderTarget> getRenderTarget ( ) const#

Returns the render target.

Return value

Render target.

Ptr<RenderTarget> getPostRenderTarget ( ) const#

Returns the post texture render.

Return value

Post render target.

Ptr<Viewport> getViewport ( ) const#

Returns the rendering viewport.

Return value

Rendering viewport smart pointer.

int getViewportMask ( ) const#

Returns current viewport mask.

Return value

Returns current viewport mask.

float getZFar ( ) const#

Return current far clipping plane.

Return value

Returns current far clipping plane.

float getZNear ( ) const#

Returns current near clipping plane.

Return value

Returns current near clipping plane.

void saveState ( ) #

Saves current renderer matrices.

void restoreState ( ) #

Restores current renderer matrices.

bool useDynamicReflections ( ) const#

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

Return value

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

bool useOcclusionQueries ( ) const#

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

Return value

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

bool usePostEffects ( ) const#

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

Return value

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

bool useShadows ( ) const#

Returns a value indicating if rendering of shadows is enabled.

Return value

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

bool useTAA ( ) const#

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.

bool useVelocityBuffer ( ) const#

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.

bool useVisualizer ( ) const#

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

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

Returns the auto white balance texture.

Return value

Auto-white-balance texture.

Ptr<Texture> getTextureRefractionMask ( ) const#

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.

Renderer::CBufferCamera getShaderCBufferCamera ( ) const#

Returns a buffer containing camera parameters to be passed to a custom shader. This method can be used in a callback to obtain camera parameters at a certain stage of the rendering sequence and pass them to a custom shader.

Return value

Buffer containing camera parameters to be passed to a custom shader.

Renderer::CBufferScattering getShaderCBufferScattering ( ) const#

Returns a buffer containing scattering parameters to be passed to a custom shader. This method can be used in a callback to obtain scattering parameters at a certain stage of the rendering sequence and pass them to a custom shader.

Return value

Buffer containing scattering parameters to be passed to a custom shader.

Ptr<Light> getCurrentLight ( ) const#

Returns the currently rendered light source. This method can be used to obtain shadow maps for a certain light source in a callback (see BEGIN_SHADOWS callbacks).

Return value

Currently rendered light source.
Last update: 2021-04-09
Build: ()