Torque3D Documentation / _generateds / SceneRenderState

SceneRenderState

Engine/source/scene/sceneRenderState.h

The SceneRenderState describes the state of the scene being rendered.

More...

Culling

Return the culling state for the scene.

Returns the root culling frustum.

Returns the root camera frustum.

Rendering

Get the AABB around the scene portion that we render.

Set the AABB of the space that should be rendered.

renderObjects(SceneObject ** objects, U32 numObjects)

Batch the given objects to the render pass manager and then render the batched instances.

Lighting

Return the ambient light color to use for rendering the scene.

Set the global ambient light color to render with.

bool

If true then Advanced Lighting bin draws are disabled during rendering with this scene state.

Passes

Return the RenderPassManager that manages rendering objects batched for this SceneRenderState.

Returns the type of scene rendering pass that we're doing.

bool

Returns true if this is a diffuse scene rendering pass.

bool

Returns true if this is a reflection scene rendering pass.

bool

Returns true if this is a shadow scene rendering pass.

bool

Returns true if this is not one of the other rendering passes.

Render Style

Get the rendering style used for the scene.

Set the rendering style used for the scene.

Transforms, projections, and viewports.

Return the screen-space viewport rectangle.

Return the world->view transform matrix.

Return the project transform matrix.

Return the inverse project transform matrix.

Returns the actual camera position.

Returns the camera transform (view->world) this SceneRenderState is using.

Returns the minimum distance something must be from the camera to not be culled.

Returns the maximum distance something can be from the camera to not be culled.

Returns the camera vector normalized to 1 / far distance.

Returns the possibly overloaded world to screen scale.

Set a new world to screen scale to overload future screen metrics operations.

projectRadius(F32 dist, F32 radius)

Returns the pixel size of the radius projected to the screen at a desired distance.

Returns the camera position used during the diffuse rendering pass which may be different from the actual camera position.

Set a new diffuse camera transform.

Material Overrides

When performing a special render pass like shadows this returns a specialized override material.

Returns the optional material override delegate which is used during some special render passes.

Public Types

MatDelegate 

The delegate used for material overrides.

Protected Attributes

Global ambient light color.

Culling state of the scene.

bool

Disables AdvancedLighting bin draws during rendering with this scene state.

The optional material override delegate.

The AABB that encloses the space in the scene that we render.

bool

If true (default) lightmapped meshes should be rendered.

bool

If true (default) non-lightmapped meshes should be rendered.

The render pass which we are setting up with this scene state.

SceneManager being rendered in this state.

The type of scene render pass we're doing.

The render style being performed.

bool

Forces bin based post effects to be disabled during rendering with this scene state.

The camera vector normalized to 1 / far dist.

The world to screen space scalar used for LOD calculations.

Public Functions

SceneRenderState(SceneManager * sceneManager, ScenePassType passType, const SceneCameraState & view, RenderPassManager * renderPass, bool usePostEffects)

Construct a new SceneRenderState.

Return the SceneManager that is being rendered in this SceneRenderState.

bool

If true then bin based post effects are disabled during rendering with this scene state.

usePostEffects(bool value)

Detailed Description

The SceneRenderState describes the state of the scene being rendered.

It keeps track of the information that objects need to render properly with regard to the camera position, any fog information, viewing frustum, the global environment map for reflections, viewable distance, etc.

It also owns the current culling state.

Culling

getCullingState()

Return the culling state for the scene.

getCullingState()

getCullingFrustum()

Returns the root culling frustum.

getCameraFrustum()

Returns the root camera frustum.

Rendering

getRenderArea()

Get the AABB around the scene portion that we render.

setRenderArea(const Box3F & area)

Set the AABB of the space that should be rendered.

renderObjects(SceneObject ** objects, U32 numObjects)

Batch the given objects to the render pass manager and then render the batched instances.

Parameters:

objects

List of objects.

numObjects

Number of objects in objects.

Lighting

getAmbientLightColor()

Return the ambient light color to use for rendering the scene.

At the moment, we only support a single global ambient color with which all objects in the scene are rendered. This is because when using Advanced Lighting, we are not resolving light contribution on a per-surface or per-object basis but rather do it globally by gathering light contribution to the whole scene and since the ambient factor is decided by the sun/vector light, it simply becomes a base light level onto which shadowing/lighting is blended based on the shadow maps of the sun/vector light.

return:

The ambient light color for rendering.

setAmbientLightColor(const LinearColorF & color)

Set the global ambient light color to render with.

disableAdvancedLightingBins()

If true then Advanced Lighting bin draws are disabled during rendering with this scene state.

disableAdvancedLightingBins(bool enabled)

renderLightmappedMeshes()

renderLightmappedMeshes(bool enabled)

renderNonLightmappedMeshes()

renderNonLightmappedMeshes(bool enabled)

Passes

getRenderPass()

Return the RenderPassManager that manages rendering objects batched for this SceneRenderState.

getScenePassType()

Returns the type of scene rendering pass that we're doing.

isDiffusePass()

Returns true if this is a diffuse scene rendering pass.

isReflectPass()

Returns true if this is a reflection scene rendering pass.

isShadowPass()

Returns true if this is a shadow scene rendering pass.

isOtherPass()

Returns true if this is not one of the other rendering passes.

Render Style

getSceneRenderStyle()

Get the rendering style used for the scene.

setSceneRenderStyle(SceneRenderStyle style)

Set the rendering style used for the scene.

Transforms, projections, and viewports.

getViewport()

Return the screen-space viewport rectangle.

getWorldViewMatrix()

Return the world->view transform matrix.

getProjectionMatrix()

Return the project transform matrix.

getInvProjectionMatrix()

Return the inverse project transform matrix.

getCameraPosition()

Returns the actual camera position.

getCameraTransform()

Returns the camera transform (view->world) this SceneRenderState is using.

getNearPlane()

Returns the minimum distance something must be from the camera to not be culled.

getFarPlane()

Returns the maximum distance something can be from the camera to not be culled.

getVectorEye()

Returns the camera vector normalized to 1 / far distance.

getWorldToScreenScale()

Returns the possibly overloaded world to screen scale.

setWorldToScreenScale(const Point2F & scale)

Set a new world to screen scale to overload future screen metrics operations.

projectRadius(F32 dist, F32 radius)

Returns the pixel size of the radius projected to the screen at a desired distance.

Internally this uses the stored world to screen scale and viewport extents. This allows the projection to be overloaded in special cases like when rendering shadows or reflections.

see:

getViewportExtent

getDiffuseCameraPosition()

Returns the camera position used during the diffuse rendering pass which may be different from the actual camera position.

This is useful when doing level of detail calculations that need to be relative to the diffuse pass.

getDiffuseCameraTransform()

setDiffuseCameraTransform(const MatrixF & mat)

Set a new diffuse camera transform.

Material Overrides

getOverrideMaterial(BaseMatInstance * matInst)

When performing a special render pass like shadows this returns a specialized override material.

It can return NULL if the override wants to disable rendering. If there is no override in place then the input material is returned unaltered.

getMaterialDelegate()

Returns the optional material override delegate which is used during some special render passes.

getMaterialDelegate()

Public Types

typedef Delegate< BaseMatInstance *(BaseMatInstance *) > MatDelegate 

The delegate used for material overrides.

Protected Attributes

LinearColorF mAmbientLightColor 

Global ambient light color.

SceneCullingState mCullingState 

Culling state of the scene.

MatrixF mDiffuseCameraTransform 
bool mDisableAdvancedLightingBins 

Disables AdvancedLighting bin draws during rendering with this scene state.

MatDelegate mMatDelegate 

The optional material override delegate.

Box3F mRenderArea 

The AABB that encloses the space in the scene that we render.

bool mRenderLightmappedMeshes 

If true (default) lightmapped meshes should be rendered.

bool mRenderNonLightmappedMeshes 

If true (default) non-lightmapped meshes should be rendered.

RenderPassManager * mRenderPass 

The render pass which we are setting up with this scene state.

SceneManager * mSceneManager 

SceneManager being rendered in this state.

ScenePassType mScenePassType 

The type of scene render pass we're doing.

SceneRenderStyle mSceneRenderStyle 

The render style being performed.

bool mUsePostEffects 

Forces bin based post effects to be disabled during rendering with this scene state.

Point3F mVectorEye 

The camera vector normalized to 1 / far dist.

Point2F mWorldToScreenScale 

The world to screen space scalar used for LOD calculations.

Public Functions

SceneRenderState(SceneManager * sceneManager, ScenePassType passType, const SceneCameraState & view, RenderPassManager * renderPass, bool usePostEffects)

Construct a new SceneRenderState.

Parameters:

sceneManager

SceneManager rendered in this SceneRenderState.

passType

Type of rendering pass that the SceneRenderState is for.

view

The view that is being rendered

renderPass

The render pass which is being set up by this SceneRenderState. If NULL, then Scene::getDefaultRenderPass() is used.

usePostEffect

Whether PostFX are enabled in the rendering pass.

~SceneRenderState()

getSceneManager()

Return the SceneManager that is being rendered in this SceneRenderState.

usePostEffects()

If true then bin based post effects are disabled during rendering with this scene state.

usePostEffects(bool value)