Gazebo Rendering

API Reference

6.6.3

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

#include <rendering/rendering.hh>

Public Types

enum  LightingModel { SSLM_PerVertexLighting, SSLM_PerPixelLighting, SSLM_NormalMapLightingTangentSpace, SSLM_NormalMapLightingObjectSpace }
 The type of lighting. More...
 

Public Member Functions

void AddScene (OgreScenePtr _scene)
 Add a scene manager. More...
 
void ApplyShadows (OgreScenePtr _scene)
 Apply shadows to a scene. More...
 
void AttachEntity (OgreSubMesh *_vis)
 Set an Ogre::Entity to use RT shaders. More...
 
void Clear ()
 Clear the shader system. More...
 
void DetachEntity (OgreSubMesh *_vis)
 Remove and entity. More...
 
void Fini ()
 Finalize the shader system. More...
 
void GenerateShaders (OgreSubMesh *_subMesh)
 Generate shaders for an entity. More...
 
bool Init ()
 Initialize the run time shader system. More...
 
bool IsInitialized () const
 Get if RTShaderSystem is initialized or not. More...
 
Ogre::PSSMShadowCameraSetup * PSSMShadowCameraSetup () const
 Get the Ogre PSSM Shadows camera setup. More...
 
void RemoveScene (const std::string &_scene)
 Remove a scene. More...
 
void RemoveScene (OgreScenePtr _scene)
 Remove a scene. More...
 
void RemoveShaders (OgreSubMesh *_subMesh)
 Generate shaders for an entity. More...
 
void RemoveShadows (OgreScenePtr _scene)
 Remove shadows from a scene. More...
 
void SetPerPixelLighting (bool _set)
 Set the lighting model to per pixel or per vertex. More...
 
bool SetShadowTextureSize (const unsigned int _size)
 Set the shadow texture size. More...
 
unsigned int ShadowTextureSize () const
 Get the shadow texture size. More...
 
void Update ()
 Update the RT shaders. The call will only take effect if shadow properties changed, e.g. texture size, or the shaders have been marked dirty by UpdateShaders, e.g. when entities are added. The function reapplies shadows if properties have changed, and iterates through all entities added to RTShaderSystem and regenerates shader programs for each entity if shaders are dirty. This function is currently called by OgreScene::PreRender. More...
 
void UpdateShaders ()
 Update the shaders. This should not be called frequently. More...
 

Static Public Member Functions

static void AttachViewport (Ogre::Viewport *_viewport, OgreScenePtr _scene)
 Set a viewport to use shaders. More...
 
static void DetachViewport (Ogre::Viewport *_viewport, OgreScenePtr _scene)
 Set a viewport to not use shaders. More...
 
- Static Public Member Functions inherited from SingletonT< OgreRTShaderSystem >
static T * Instance ()
 

Additional Inherited Members

- Protected Member Functions inherited from SingletonT< OgreRTShaderSystem >
 SingletonT ()
 
virtual ~SingletonT ()
 

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

◆ LightingModel

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

◆ AddScene()

void AddScene ( OgreScenePtr  _scene)

Add a scene manager.

Parameters
[in]_sceneThe scene to process

◆ ApplyShadows()

void ApplyShadows ( OgreScenePtr  _scene)

Apply shadows to a scene.

Parameters
[in]_sceneThe scene to receive shadows.

◆ AttachEntity()

void AttachEntity ( OgreSubMesh _vis)

Set an Ogre::Entity to use RT shaders.

Parameters
[in]_visOgreSubMesh that will use the OgreRTShaderSystem.

◆ AttachViewport()

static void AttachViewport ( Ogre::Viewport *  _viewport,
OgreScenePtr  _scene 
)
static

Set a viewport to use shaders.

Parameters
[in]_viewportThe viewport to add.
[in]_sceneThe scene that the viewport uses.

◆ Clear()

void Clear ( )

Clear the shader system.

◆ DetachEntity()

void DetachEntity ( OgreSubMesh _vis)

Remove and entity.

Parameters
[in]_visRemove this visual.

◆ DetachViewport()

static void DetachViewport ( Ogre::Viewport *  _viewport,
OgreScenePtr  _scene 
)
static

Set a viewport to not use shaders.

Parameters
[in]_viewportThe viewport to remove.
[in]_sceneThe scene that the viewport uses.

◆ Fini()

void Fini ( )

Finalize the shader system.

◆ GenerateShaders()

void GenerateShaders ( OgreSubMesh _subMesh)

Generate shaders for an entity.

Parameters
[in]_subMeshThe submesh to generate shaders for.

◆ Init()

bool Init ( )

Initialize the run time shader system.

Returns
True if the run time shader system is initialized successfully.

◆ IsInitialized()

bool IsInitialized ( ) const

Get if RTShaderSystem is initialized or not.

Returns
True if intialized.

◆ PSSMShadowCameraSetup()

Ogre::PSSMShadowCameraSetup* PSSMShadowCameraSetup ( ) const

Get the Ogre PSSM Shadows camera setup.

Returns
The Ogre PSSM Shadows camera setup.

◆ RemoveScene() [1/2]

void RemoveScene ( const std::string _scene)

Remove a scene.

Parameters
[in]_sceneName of the scene to remove.

◆ RemoveScene() [2/2]

void RemoveScene ( OgreScenePtr  _scene)

Remove a scene.

Parameters
[in]_sceneThe scene to remove

◆ RemoveShaders()

void RemoveShaders ( OgreSubMesh _subMesh)

Generate shaders for an entity.

Parameters
[in]_subMeshThe submesh to remove shaders for.

◆ RemoveShadows()

void RemoveShadows ( OgreScenePtr  _scene)

Remove shadows from a scene.

Parameters
[in]_sceneThe scene to remove shadows from.

◆ SetPerPixelLighting()

void SetPerPixelLighting ( bool  _set)

Set the lighting model to per pixel or per vertex.

Parameters
[in]_setTrue means to use per-pixel shaders.

◆ SetShadowTextureSize()

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.

◆ ShadowTextureSize()

unsigned int ShadowTextureSize ( ) const

Get the shadow texture size.

Returns
Size of the shadow texture. The default size is 1024.

◆ Update()

void Update ( )

Update the RT shaders. The call will only take effect if shadow properties changed, e.g. texture size, or the shaders have been marked dirty by UpdateShaders, e.g. when entities are added. The function reapplies shadows if properties have changed, and iterates through all entities added to RTShaderSystem and regenerates shader programs for each entity if shaders are dirty. This function is currently called by OgreScene::PreRender.

See also
OgreScene::PreRender

◆ UpdateShaders()

void UpdateShaders ( )

Update the shaders. This should not be called frequently.


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