RTShaderSystem Class Reference

Implements Ogre's Run-Time Shader system. More...

#include <rendering/rendering.hh>

Inherits SingletonT< RTShaderSystem >.

Public Types

enum  LightingModel { SSLM_PerVertexLighting, SSLM_PerPixelLighting, SSLM_NormalMapLightingTangentSpace, SSLM_NormalMapLightingObjectSpace }
 

Public Member Functions

void AddScene (ScenePtr _scene)
 Add a scene manager. More...
 
void ApplyShadows (ScenePtr _scene)
 Apply shadows to a scene. More...
 
void Fini ()
 Finalize the shader system. More...
 
void GenerateShaders (const VisualPtr &_vis)
 Generate shaders for an entity. More...
 
Ogre::PSSMShadowCameraSetup * GetPSSMShadowCameraSetup () const
 Get the Ogre PSSM Shadows camera setup. More...
 
void Init ()
 Init the run time shader system. More...
 
void RemoveScene (ScenePtr _scene)
 Remove a scene. More...
 
void RemoveScene (const std::string &_scene)
 Remove a scene. More...
 
void RemoveShadows (ScenePtr _scene)
 Remove shadows from a scene. More...
 
void SetPerPixelLighting (bool _set)
 Set the lighting model to per pixel or per vertex. More...
 
void SetShadowClipDist (const double _near, const double _far)
 Set the shadow clip distances. More...
 
void SetShadowSplitLambda (const double _lambda)
 Set the PSSM lambda value for determining how linear or logarithmic choice of split points will be. More...
 
void SetShadowSplitPadding (const double _padding)
 Set the overlap between PSSM shadow maps. More...
 
bool SetShadowTextureSize (const unsigned int _size)
 Set the shadow texture size. More...
 
double ShadowFarClip () const
 Get the shadow far clip distance. More...
 
double ShadowNearClip () const
 Get the shadow near clip distance. More...
 
double ShadowSplitLambda () const
 Get the PSSM split point lambda value. More...
 
double ShadowSplitPadding () const
 Get the PSSM split point overlap. More...
 
unsigned int ShadowTextureSize () const
 Get the shadow texture size. More...
 
void Update ()
 Update the RT shaders. This should not be called frequently. More...
 
void UpdateShaders ()
 Queue a call to update the shaders. More...
 

Static Public Member Functions

static void AttachViewport (Ogre::Viewport *_viewport, ScenePtr _scene)
 Set a viewport to use shaders. More...
 
static void DetachViewport (Ogre::Viewport *_viewport, ScenePtr _scene)
 Set a viewport to not use shaders. More...
 
static RTShaderSystemInstance ()
 Get an instance of the singleton. More...
 

Detailed Description

Implements Ogre's Run-Time Shader system.

This class allows Gazebo to generate per-pixel shaders for every material at run-time.

Member Enumeration Documentation

The type of lighting.

Enumerator
SSLM_PerVertexLighting 

Per-Vertex lighting: best performance.

SSLM_PerPixelLighting 

Per-Pixel lighting: best look.

SSLM_NormalMapLightingTangentSpace 

Normal Map lighting: lighting calculations have been stored in a light map (texture) using tangent space.

SSLM_NormalMapLightingObjectSpace 

Normal Map lighting: lighting calculations have been stored in a light map (texture) using object space.

Member Function Documentation

void AddScene ( ScenePtr  _scene)

Add a scene manager.

Parameters
[in]_sceneThe scene to process
void ApplyShadows ( ScenePtr  _scene)

Apply shadows to a scene.

Parameters
[in]_sceneThe scene to receive shadows.
static void AttachViewport ( Ogre::Viewport *  _viewport,
ScenePtr  _scene 
)
static

Set a viewport to use shaders.

Parameters
[in]_viewportThe viewport to add.
[in]_sceneThe scene that the viewport uses.
static void DetachViewport ( Ogre::Viewport *  _viewport,
ScenePtr  _scene 
)
static

Set a viewport to not use shaders.

Parameters
[in]_viewportThe viewport to remove.
[in]_sceneThe scene that the viewport uses.
void Fini ( )

Finalize the shader system.

void GenerateShaders ( const VisualPtr _vis)

Generate shaders for an entity.

Parameters
[in]_visThe visual to generate shaders for.
Ogre::PSSMShadowCameraSetup* GetPSSMShadowCameraSetup ( ) const

Get the Ogre PSSM Shadows camera setup.

Returns
The Ogre PSSM Shadows camera setup.
void Init ( )

Init the run time shader system.

static RTShaderSystem * Instance ( )
inlinestaticinherited

Get an instance of the singleton.

void RemoveScene ( ScenePtr  _scene)

Remove a scene.

Parameters
[in]Thescene to remove
void RemoveScene ( const std::string &  _scene)

Remove a scene.

Parameters
[in]Nameof the scene to remove.
void RemoveShadows ( ScenePtr  _scene)

Remove shadows from a scene.

Parameters
[in]_sceneThe scene to remove shadows from.
void SetPerPixelLighting ( bool  _set)

Set the lighting model to per pixel or per vertex.

Parameters
[in]_setTrue means to use per-pixel shaders.
void SetShadowClipDist ( const double  _near,
const double  _far 
)

Set the shadow clip distances.

Parameters
[in]_nearNear clip distance.
[in]_farFar clip distance.
void SetShadowSplitLambda ( const double  _lambda)

Set the PSSM lambda value for determining how linear or logarithmic choice of split points will be.

Parameters
[in]_lambdaPSSM split point lambda.
void SetShadowSplitPadding ( const double  _padding)

Set the overlap between PSSM shadow maps.

Parameters
[in]_paddingPSSM split point overlap.
bool SetShadowTextureSize ( const unsigned int  _size)

Set the shadow texture size.

Parameters
[in]_sizeSize of shadow texture to set to. This must be a power of 2. The default size is 1024.
Returns
True if size is set successfully, false otherwise.
double ShadowFarClip ( ) const

Get the shadow far clip distance.

Returns
Far clip distance.
double ShadowNearClip ( ) const

Get the shadow near clip distance.

Returns
Near clip distance.
double ShadowSplitLambda ( ) const

Get the PSSM split point lambda value.

Returns
PSSM split point lambda.
double ShadowSplitPadding ( ) const

Get the PSSM split point overlap.

Returns
PSSM split point overlap.
unsigned int ShadowTextureSize ( ) const

Get the shadow texture size.

Returns
Size of the shadow texture. The default size is 1024.
void Update ( )

Update the RT shaders. This should not be called frequently.

void UpdateShaders ( )

Queue a call to update the shaders.


The documentation for this class was generated from the following file: