This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

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).

The Renderer class provides the following structures representing constant buffers:

Renderer Class

枚举

RENDER_STEREO_EYE#

Stereo eye enumeration.
Name说明/描 述
RENDER_STEREO_EYE_NONE = 0None of the stereo eyes.
RENDER_STEREO_EYE_LEFT = 1Left stereo eye.
RENDER_STEREO_EYE_RIGHT = 2Right stereo eye.
RENDER_STEREO_EYE_LEFT_FOCUS = 3Left eye focus view.
RENDER_STEREO_EYE_RIGHT_FOCUS = 4Right eye focus view.

结构体

struct CBufferCamera

A structure that represents a buffer for storing camera parameters.

Fields

  • Math::mat4 camera_projection - Camera projection matrix.
  • Math::mat4 camera_iprojection - Camera inverse projection matrix.
  • Math::mat4 oblique_frustum_plane - World coordinates of the oblique frustum culling plane in the format (Nx, Ny, Nz, D), where Nx, Ny, Nz are the coordinates of the plane normal, and D is the distance from the origin to the plane.
  • int is_oblique_frustum - Flag indicating if the viewing frustum is oblique.
  • Math::mat4 projection - Projection matrix.
  • Math::mat4 iprojection - Inverse projection matrix.
  • Math::mat4 projection_screen - Projection matrix for the screen space effect.
  • Math::mat4 iprojection_screen - Inverse projection matrix for the screen space effect.
  • Math::mat4 imodelview - Inverse view matrix.
  • Math::mat4 old_imodelview - Inverse old view matrix used for rendering of the previous frame.
  • Math::mat4 old_imodelview_delta - Delta of the old inverse view and inverse view matrices.
  • Math::mat4 modelview - View matrix.
  • Math::mat4 old_modelview - Old view matrix.
  • Math::vec3 camera_offset - Camera additional transformation (offset). This transformation is applied after the view transformation. The offset does not affect the view matrix or the camera position.
  • Math::vec3 camera_position - Camera position.
  • Math::vec3 camera_direction - Inverted normalized camera direction vector.
  • Math::vec3 projection_row_0 - The first row of the camera projection matrix.
  • Math::vec3 projection_row_1 - The second row of the camera projection matrix.
  • Math::vec3 projection_row_2 - The third row of the camera projection matrix.
  • Math::vec4 modelview_projection_x - The first row of the view projection matrix.
  • Math::vec4 modelview_projection_y - The second row of the view projection matrix.
  • Math::vec4 modelview_projection_w - The third row of the view projection matrix.
  • Math::vec4 modelview_projection_old_x - The first row of the old view projection matrix used for rendering of the previous frame.
  • Math::vec4 modelview_projection_old_y - The second row of the old view projection matrix used for rendering of the previous frame.
  • Math::vec4 modelview_projection_old_w - The third row of the old view projection matrix used for rendering of the previous frame.
  • float camera_fov - Camera vertical field of view.
  • int shadow_cascade_target - Current shadow cascade used for rendering shadows.

struct CBufferScattering

A structure that represents a buffer for storing scattering parameters.

Fields

  • Math::vec3 scattering_sun_dir - Direction vector of the World light source having the Sun scattering mode.
  • Math::vec3 scattering_moon_dir - Direction vector of the World light source having the Moon scattering mode.
  • float environment_ambient_intensity - Intensity of the environment ambient lighting. The higher the value, the more ambient lighting affects the environment. 0s means no environment reflection.
  • float environment_reflection_intensity - Intensity of the environment reflection.
  • float environment_sky_intensity - Intensity of the environment sky. 0 means no environment sky.
  • Math::vec4 haze_color - Haze color.
  • float haze_max_distance - Distance starting from which the haze becomes completely solid, so nothing will be seen behind.
  • float haze_density - Haze density.
  • float haze_physical_start_height - Reference height value for the half visibility distance and half faloff height.
  • float haze_physical_density - Distance to the boundary at which the visibility comprises 50%. There is no zero-visibility in the real world, so the half-visibility boundary is used to adjust haze distance.
  • float haze_physical_falloff - Height of the haze density gradient. The higher the value, the longer the haze desity reduces as the height grows, making the transition between the clear sky and haze smoother.
  • float haze_physical_zero_visibility_height - Height at which the haze completely overlaps the scene.
  • float haze_physical_screen_space_global_illumination - Value indicating if the Screen-Space Haze Global Illumination effect is enabled.
  • float haze_physical_ambient_light_intensity - Intensity of the impact of the ambient lighting on haze (how much the ambient lighting affects the haze).
  • float haze_physical_ambient_color_saturation - Intensity of the ambient color's contribution to the haze (how much the sunlight affects the haze).
  • float haze_physical_sun_light_intensity - Intensity of the impact of the sunlight on haze (how much the sunlight affects the haze).
  • float haze_physical_sun_color_saturation - Intensity of the impact of the sunlight on haze (how much the sunlight affects the haze).
  • float haze_scattering_mie_intensity - Minimum Mie intensity value for geometry-occluded areas. This value specifies the fraction of Mie intensity visible when the surface is viewed from straight on.
  • float haze_scattering_mie_front_side_intensity - Falloff of the Fresnel effect for Mie intensity. This value is used to control occlusion of light from a World light source by the geometry.
  • float haze_scattering_mie_fresnel_power - Power of the Fresnel effect for Mie visibility. Higher values will tighten up the areas affected, while lower ones will allow more areas to be affected by the Fresnel effect.
  • Math::vec3 sky_up - Sky up vector.
  • float sky_altitude - Sky altitude.
  • Math::mat4 sky_transform - Sky transformation matrix.
  • Math::vec3 sun_color - Sun color.
  • Math::mat4 sun_rotation - Sun rotation matrix.
  • Math::mat4 moon_rotation - Moon rotation matrix.

struct CBufferTonemapper

A structure that represents a buffer for storing tone mapping parameters.

Fields

  • Math::vec4 filmic_curve - Vector of parameters for a tone mapping curve.
  • Math::vec4 filmic_white - Parameter determining the brightness at which a pixel becomes pure white in the resulting image.
  • float filmic_saturation_recovery - Color saturation recovery value for the filmic tonemapper.
  • float aces_white_clip - White clip parameter for the ACES operator. Controls the cut-off point for white.
  • float aces_toe - Toe parameter for the ACES operator. Controls the dark color. Higher values result in darker colors.
  • float aces_shoulder_angle - Shoulder angle parameter for the ACES operator. Controls how much overshoot should be added to the curve's shoulder.
  • float aces_shoulder_strength - Shoulder strength parameter for the ACES operator. Controls the strength of the transition between the curve's midsection and the curve's shoulder.
  • float aces_shoulder_length - Shoulder length parameter for the ACES operator. Controls the amount of f-stops to add to the dynamic range of the curve. Defines how much of the highlights the curve takes into account.
  • float aces_with_reinhard_mix - ACES with Reinhard tone mapping operator contribution.
  • float aces_with_reinhard_white_clip - White clip parameter for the ACES with Reinhard operator. Controls the cut-off point for white.ACES with Reinhard operator's white clip.
  • float aces_with_reinhard_toe - Toe parameter for the ACES with Reinhard operator. Controls the dark color. Higher values result in darker colors.
  • float aces_with_reinhard_shoulder_angle - Shoulder angle parameter for the ACES with Reinhard operator. Controls how much overshoot should be added to the curve's shoulder.
  • float aces_with_reinhard_shoulder_strength - Shoulder strength parameter for the ACES with Reinhard operator. Controls the strength of the transition between the curve's midsection and the curve's shoulder.
  • float aces_with_reinhard_shoulder_length - Shoulder length parameter for the ACES with Reinhard operator. Controls the amount of f-stops to add to the dynamic range of the curve. Defines how much of the highlights the curve takes into account.
  • float reinhard_contribution - Reinhard tone mapping operator contribution.
  • float reinhard_luma_based_contribution - Reinhard Luma-Based tone mapping operator contribution. Controls the overall contribution that the Reinhard operator makes to the final color grading of the image.

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 for the specified rendeting pass.

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, bool 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.
  • bool 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, bool 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.
  • bool 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, bool 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.
  • bool 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, bool 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.
  • bool 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, bool 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.
  • bool 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.

static void getAllSurfaces ( Vector <Renderer::RenderSurface> & surfaces ) #

Retrieves all RenderSurfaces visible via the current viewport/camera and puts them to the specified output vector. The RenderSurface structure contains information about an object to which the surface belongs as well as the index of this surface and is defined as follows:
Source code
struct RenderSurface
{
	Ptr<Object> object;
	int surface;
};
This data can be used, for example, to implement a custom rendering pass .
Source code (C++)
#include "AppWorldLogic.h"

#include <Unigine.h>

using namespace Unigine;

// World logic, it takes effect only when the world is loaded.
// These methods are called right after corresponding world script's (UnigineScript) methods.

class MyRenderPass
{
public:
	static constexpr const char *"my_custom_pass" = "my_custom_pass";

	void Register()
	{
		connection_id = Render::getEventBeginAuxiliaryBuffer().connect(this, &MyRenderPass::pass);
	}

	void Unregister()
	{
		Render::getEventBeginAuxiliaryBuffer().disconnect(connection_id);
	}

private:

	// implementation of a custom rendering pass 
	void pass()
	{
		// declaring a target array to store RenderSurfaces and collecting all currently visible render surfaces to this array
		Vector<Renderer::RenderSurface> surfaces;
		Renderer::getAllSurfaces(surfaces);

		// creating a new render target and creating a texture for our rendering pass
		RenderTargetPtr render_target = Render::getTemporaryRenderTarget();
		TexturePtr texture = Renderer::createCustomTexture2D("My Pass Texture", RenderState::getWidth(), RenderState::getHeight(), Texture::FORMAT_RGBA8, Texture::FORMAT_USAGE_RENDER);

		// setting necessary textures (color and depth in our case) and enabling the render target
		render_target->bindColorTexture2D(0, texture);
		render_target->bindDepthTexture(Renderer::getTextureCurrentDepth());
		render_target->enable();
		// render all visible surfaces in our custom pass if their current material supports this pass
		{
			RenderState::clearBuffer(RenderState::BUFFER_COLOR, Math::vec4_zero);

			for (const auto &s : surfaces)
			{
				MaterialPtr material = s.object->getMaterial(s.surface);
				Render::PASS pass = material->getRenderPass("my_custom_pass");
				if (pass == -1)
					continue;

				RenderState::setDepthFunc(material->isDepthTest() ? RenderState::DEPTH_GEQUAL : RenderState::DEPTH_NONE);
				s.object->render(pass, s.surface);
			}
		}
		// disabling the render target and releasing resources
		render_target->disable();
		render_target->unbindColorTexture(0);
		render_target->unbindDepthTexture();
		Render::releaseTemporaryRenderTarget(render_target);
	}
	EventConnectionId connection_id;
};

MyRenderPass my_pass;

AppWorldLogic::AppWorldLogic()
{}

AppWorldLogic::~AppWorldLogic()
{}

int AppWorldLogic::init()
{
	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.
	my_pass.Register();
	return 1;
}

////////////////////////////////////////////////////////////////////////////////
// start of the main loop
////////////////////////////////////////////////////////////////////////////////

int AppWorldLogic::update()
{
	// Write here code to be called before updating each render frame: specify all graphics-related functions you want to be called every frame while your application executes.
	return 1;
}

int AppWorldLogic::postUpdate()
{
	// The engine calls this function after updating each render frame: correct behavior after the state of the node has been updated.
	return 1;
}

int AppWorldLogic::updatePhysics()
{
	// Write here code to be called before updating each physics frame: control physics in your application and put non-rendering calculations.
	// The engine calls updatePhysics() with the fixed rate (60 times per second by default) regardless of the FPS value.
	// WARNING: do not create, delete or change transformations of nodes here, because rendering is already in progress.
	return 1;
}

////////////////////////////////////////////////////////////////////////////////
// end of the main loop
////////////////////////////////////////////////////////////////////////////////

int AppWorldLogic::shutdown()
{
	// Write here code to be called on world shutdown: delete resources that were created during world script execution to avoid memory leaks.
	my_pass.Unregister();
	return 1;
}

int AppWorldLogic::save(const Unigine::StreamPtr &stream)
{
	// Write here code to be called when the world is saving its state (i.e. state_save is called): save custom user data to a file.
	UNIGINE_UNUSED(stream);
	return 1;
}

int AppWorldLogic::restore(const Unigine::StreamPtr &stream)
{
	// Write here code to be called when the world is restoring its state (i.e. state_restore is called): restore custom user data to a file here.
	UNIGINE_UNUSED(stream);
	return 1;
}

Arguments

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.

Renderer::RENDER_STEREO_EYE getStereoCurrentEye ( ) const#

Returns the current stereo eye.

Return value

One of the RENDER_STEREO_EYE_* 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> getTextureDirectLights ( ) const#

Returns the array texture storing contents of the deferred light buffer. The texture contains two RG11B10F textures: the first layer stores the diffuse light, and the second layer stores the specular light.

Return value

A texture storing contents of the deferred light buffer.

Ptr<Texture> getTextureIndirectLights ( ) const#

Returns the array texture storing contents of the deferred reflections buffer. The texture contains two RG11B10F textures: the first layer stores the environment reflection color, and the second layer stores the environment ambient light.

Return value

A texture storing contents of 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> getTextureSSShadowShafts ( ) const#

Returns the Screen-Space Shadow Shafts texture.

Return value

Screen-Space Shadow Shafts 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.

void setUseTAAOffset ( bool offset ) #

Sets a value indicating if skipping render mode check is enabled for using TAA. Can be used to ensure proper TAA calculation when rendering mode for the Viewport is set to RENDER_DEPTH.

Arguments

  • bool offset - true to enable skipping render mode check and use TAA; otherwise false.

bool isUseTAAOffset ( ) const#

Returns a value indicating if skipping render mode check is enabled for using TAA. Can be used to ensure proper TAA calculation when rendering mode for the Viewport is set to RENDER_DEPTH.

Return value

true if skipping render mode check is enabled for using TAA; otherwise false.

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 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::FORMAT_USAGE_, Texture::SAMPLER_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

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::FORMAT_USAGE_, Texture::SAMPLER_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 event handler 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 event handler 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 event handler (see BeginShadows event).

Return value

Currently rendered light source.

void setOverlapEnvironmentTexture ( const Ptr<Texture> & texture ) #

Sets a new environment cubemap texture.

Arguments

  • const Ptr<Texture> & texture - Environment cubemap texture to be used.

Ptr<Texture> getOverlapEnvironmentTexture ( ) const#

Returns the currently used environment cubemap texture.

Return value

Currently used environment cubemap texture.

void resetOverlapEnvironmentTexture ( ) #

Resets the environment cubemap texture to default (no environment texture is used).

Ptr<Texture> getTextureNormalUnpack ( ) const#

Returns the texture that stores unpacked normals. Available for the following post-effects: SSR, SSGI, SSRTGI, Shadows screen space.

Return value

The texture that stores unpacked normals.

Ptr<Texture> getTextureLinearDepth ( ) const#

Returns the texture that stores linear depth data.

Return value

The texture that stores linear depth data.

void renderMeshStatic ( const Ptr<MeshStatic> & mesh, const Ptr<Material> & material, const char * pass_name, const Math::Mat4 & transform, const Ptr<Camera> & camera ) #

Renders the specified static mesh with the specified material applied to it during the specified render pass as viewed from by specified camera.

Arguments

  • const Ptr<MeshStatic> & mesh - Static mesh to be rendered.
  • const Ptr<Material> & material - Material to be used to render the mesh.
  • const char * pass_name - Name of the rendering pass during which the mesh is to be rendered.
  • const Math::Mat4 & transform - Transformation to be passed to shader for rendering.
  • const Ptr<Camera> & camera - Camera to be used for mesh rendering.

bool isStereoPeripheral ( ) const#

Returns a value indicating if the Stereo Peripheral rendering mode is enabled. This rendering mode is used for HMDs having context (low-res) and focus (high-res) displays.

Return value

true if stereo peripheral rendering is enabled; otherwise false.

Renderer::CBufferTonemapper getShaderCBufferTonemapper ( ) const#

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

Return value

Buffer containing tone mapping parameters to be passed to a custom shader.
Last update: 2024-02-27
Build: ()