OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::ForwardClustered Class Reference

Implementation of Clustered Forward Shading. More...

#include <OgreForwardClustered.h>

+ Inheritance diagram for Ogre::ForwardClustered:

Public Types

typedef vector< CachedGridBuffer >::type CachedGridBufferVec
 
enum  ForwardPlusMethods { MethodForward3D, MethodForwardClustered, NumForwardPlusMethods }
 

Public Member Functions

 ForwardClustered (uint32 width, uint32 height, uint32 numSlices, uint32 lightsPerCell, uint32 decalsPerCell, uint32 cubemapProbesPerCell, float minDistance, float maxDistance, SceneManager *sceneManager)
 
virtual ~ForwardClustered ()
 
void _changeRenderSystem (RenderSystem *newRs)
 
virtual void collectLights (Camera *camera)
 
virtual void execute (size_t threadId, size_t numThreads)
 Overload this function to perform whatever you want. More...
 
virtual void fillConstBufferData (Viewport *viewport, TextureGpu *renderTarget, IdString shaderSyntax, bool instancedStereo, float *RESTRICT_ALIAS passBufferPtr) const
 Fills 'passBufferPtr' with the necessary data for ForwardClustered rendering. More...
 
virtual size_t getConstBufferSize (void) const
 Returns the amount of bytes that fillConstBufferData is going to fill. More...
 
bool getDebugFrustum (void) const
 
bool getDebugMode (void) const
 
bool getDecalsEnabled (void) const
 
uint32 getDecalsPerCell (void) const
 
bool getEnableVpls (void) const
 
bool getFadeAttenuationRange (void) const
 
bool getFineLightMaskGranularity (void) const
 
virtual ForwardPlusMethods getForwardPlusMethod (void) const
 
bool getFreezeDebugFrustum (void) const
 
TexBufferPackedgetGlobalLightListBuffer (const Camera *camera) const
 Cache the return value as internally we perform an O(N) search. More...
 
TexBufferPackedgetGridBuffer (const Camera *camera) const
 Cache the return value as internally we perform an O(N) search. More...
 
uint32 getHeight (void) const
 
uint32 getLightsPerCell (void) const
 
float getMaxDistance (void) const
 
float getMinDistance (void) const
 
uint32 getNumSlices (void) const
 
uint32 getWidth (void) const
 
bool isCacheDirty (const Camera *camera) const
 
void operator delete (void *ptr)
 
void operator delete (void *ptr, void *)
 
void operator delete (void *ptr, const char *, int, const char *)
 
void operator delete[] (void *ptr)
 
void operator delete[] (void *ptr, const char *, int, const char *)
 
void * operator new (size_t sz, const char *file, int line, const char *func)
 operator new, with debug line info More...
 
void * operator new (size_t sz)
 
void * operator new (size_t sz, void *ptr)
 placement operator new More...
 
void * operator new[] (size_t sz, const char *file, int line, const char *func)
 array operator new, with debug line info More...
 
void * operator new[] (size_t sz)
 
void setDebugFrustum (bool bEnableDebugFrustumWireAabb)
 
void setDebugMode (bool debugMode)
 Turns on visualization of light cell occupancy. More...
 
void setEnableVpls (bool enable)
 
void setFadeAttenuationRange (bool fade)
 Attenuates the light by the attenuation range, causing smooth endings when at the end of the light range instead of a sudden sharp termination. More...
 
void setFineLightMaskGranularity (bool useFineGranularity)
 Toggles whether light masks will be obeyed per object & per light by doing: if( movableObject->getLightMask() & light->getLightMask() ) doLighting( movableObject light ); Note this toggle only affects Forward+ lights. More...
 
void setFreezeDebugFrustum (bool freezeDebugFrustum)
 
virtual void setHlmsPassProperties (Hlms *hlms)
 

Static Public Attributes

static const size_t MaxCubemapProbeRq
 
static const size_t MaxDecalRq
 
static const size_t MinCubemapProbeRq
 
static const size_t MinDecalRq
 

Detailed Description

Implementation of Clustered Forward Shading.

Member Typedef Documentation

◆ CachedGridBufferVec

Member Enumeration Documentation

◆ ForwardPlusMethods

Enumerator
MethodForward3D 
MethodForwardClustered 
NumForwardPlusMethods 

Constructor & Destructor Documentation

◆ ForwardClustered()

Ogre::ForwardClustered::ForwardClustered ( uint32  width,
uint32  height,
uint32  numSlices,
uint32  lightsPerCell,
uint32  decalsPerCell,
uint32  cubemapProbesPerCell,
float  minDistance,
float  maxDistance,
SceneManager sceneManager 
)

◆ ~ForwardClustered()

virtual Ogre::ForwardClustered::~ForwardClustered ( )
virtual

Member Function Documentation

◆ _changeRenderSystem()

void Ogre::ForwardPlusBase::_changeRenderSystem ( RenderSystem newRs)
inherited

◆ collectLights()

virtual void Ogre::ForwardClustered::collectLights ( Camera camera)
virtual

Implements Ogre::ForwardPlusBase.

◆ execute()

virtual void Ogre::ForwardClustered::execute ( size_t  threadId,
size_t  numThreads 
)
virtual

Overload this function to perform whatever you want.

It will be called from all worker threads at the same time.

Parameters
threadIdThe index of the thread it is being called from. An index is guaranteed to be in range [0; numThreads)
numThreadsNumber of total threads

Implements Ogre::UniformScalableTask.

◆ fillConstBufferData()

virtual void Ogre::ForwardClustered::fillConstBufferData ( Viewport viewport,
TextureGpu renderTarget,
IdString  shaderSyntax,
bool  instancedStereo,
float *RESTRICT_ALIAS  passBufferPtr 
) const
virtual

Fills 'passBufferPtr' with the necessary data for ForwardClustered rendering.

See also
getConstBufferSize
Remarks
Assumes 'passBufferPtr' is aligned to a vec4/float4 boundary.

Implements Ogre::ForwardPlusBase.

◆ getConstBufferSize()

virtual size_t Ogre::ForwardClustered::getConstBufferSize ( void  ) const
virtual

Returns the amount of bytes that fillConstBufferData is going to fill.

Implements Ogre::ForwardPlusBase.

◆ getDebugFrustum()

bool Ogre::ForwardClustered::getDebugFrustum ( void  ) const

◆ getDebugMode()

bool Ogre::ForwardPlusBase::getDebugMode ( void  ) const
inlineinherited

◆ getDecalsEnabled()

bool Ogre::ForwardPlusBase::getDecalsEnabled ( void  ) const
inlineinherited

◆ getDecalsPerCell()

uint32 Ogre::ForwardClustered::getDecalsPerCell ( void  ) const
inline

◆ getEnableVpls()

bool Ogre::ForwardPlusBase::getEnableVpls ( void  ) const
inlineinherited

◆ getFadeAttenuationRange()

bool Ogre::ForwardPlusBase::getFadeAttenuationRange ( void  ) const
inlineinherited

◆ getFineLightMaskGranularity()

bool Ogre::ForwardPlusBase::getFineLightMaskGranularity ( void  ) const
inlineinherited

◆ getForwardPlusMethod()

virtual ForwardPlusMethods Ogre::ForwardClustered::getForwardPlusMethod ( void  ) const
inlinevirtual

Implements Ogre::ForwardPlusBase.

◆ getFreezeDebugFrustum()

bool Ogre::ForwardClustered::getFreezeDebugFrustum ( void  ) const

◆ getGlobalLightListBuffer()

TexBufferPacked* Ogre::ForwardPlusBase::getGlobalLightListBuffer ( const Camera camera) const
inherited

Cache the return value as internally we perform an O(N) search.

◆ getGridBuffer()

TexBufferPacked* Ogre::ForwardPlusBase::getGridBuffer ( const Camera camera) const
inherited

Cache the return value as internally we perform an O(N) search.

◆ getHeight()

uint32 Ogre::ForwardClustered::getHeight ( void  ) const
inline

◆ getLightsPerCell()

uint32 Ogre::ForwardClustered::getLightsPerCell ( void  ) const
inline

◆ getMaxDistance()

float Ogre::ForwardClustered::getMaxDistance ( void  ) const
inline

References RESTRICT_ALIAS.

◆ getMinDistance()

float Ogre::ForwardClustered::getMinDistance ( void  ) const
inline

◆ getNumSlices()

uint32 Ogre::ForwardClustered::getNumSlices ( void  ) const
inline

◆ getWidth()

uint32 Ogre::ForwardClustered::getWidth ( void  ) const
inline

◆ isCacheDirty()

bool Ogre::ForwardPlusBase::isCacheDirty ( const Camera camera) const
inherited

◆ operator delete() [1/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

◆ operator delete() [2/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
void *   
)
inlineinherited

◆ operator delete() [3/3]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator delete[]() [1/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr)
inlineinherited

◆ operator delete[]() [2/2]

template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete[] ( void *  ptr,
const char *  ,
int  ,
const char *   
)
inlineinherited

◆ operator new() [1/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

operator new, with debug line info

◆ operator new() [2/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz)
inlineinherited

◆ operator new() [3/3]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new ( size_t  sz,
void *  ptr 
)
inlineinherited

placement operator new

◆ operator new[]() [1/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz,
const char *  file,
int  line,
const char *  func 
)
inlineinherited

array operator new, with debug line info

◆ operator new[]() [2/2]

template<class Alloc >
void* Ogre::AllocatedObject< Alloc >::operator new[] ( size_t  sz)
inlineinherited

◆ setDebugFrustum()

void Ogre::ForwardClustered::setDebugFrustum ( bool  bEnableDebugFrustumWireAabb)

◆ setDebugMode()

void Ogre::ForwardPlusBase::setDebugMode ( bool  debugMode)
inlineinherited

Turns on visualization of light cell occupancy.

◆ setEnableVpls()

void Ogre::ForwardPlusBase::setEnableVpls ( bool  enable)
inlineinherited

◆ setFadeAttenuationRange()

void Ogre::ForwardPlusBase::setFadeAttenuationRange ( bool  fade)
inlineinherited

Attenuates the light by the attenuation range, causing smooth endings when at the end of the light range instead of a sudden sharp termination.

This isn't physically based (light's range is infinite), but looks very well, and makes more intuitive to manipulate a light by controlling its range instead of controlling its radius.

See also
Light::setAttenuationBasedOnRadius and
setAttenuation. And even when controlling the light by its radius, you don't have to worry so much about the threshold's value being accurate. It has a tendency to make lights dimmer though. That's the price to pay for this optimization and having more intuitive controls. Enabled by default.

In math: atten *= max( (attenRange - fDistance) / attenRange, 0.0f );

◆ setFineLightMaskGranularity()

void Ogre::ForwardPlusBase::setFineLightMaskGranularity ( bool  useFineGranularity)
inlineinherited

Toggles whether light masks will be obeyed per object & per light by doing: if( movableObject->getLightMask() & light->getLightMask() ) doLighting( movableObject light ); Note this toggle only affects Forward+ lights.

You may want to see HlmsPbs::setFineLightMaskGranularity for control over Forward lights. If you only need coarse granularity control over Forward+ lights, you may get higher performance via CompositorPassSceneDef::mLightVisibilityMask (light_visibility_mask keyword in scripts).

◆ setFreezeDebugFrustum()

void Ogre::ForwardClustered::setFreezeDebugFrustum ( bool  freezeDebugFrustum)

◆ setHlmsPassProperties()

virtual void Ogre::ForwardClustered::setHlmsPassProperties ( Hlms hlms)
virtual

Reimplemented from Ogre::ForwardPlusBase.

Member Data Documentation

◆ MaxCubemapProbeRq

const size_t Ogre::ForwardPlusBase::MaxCubemapProbeRq
staticinherited

◆ MaxDecalRq

const size_t Ogre::ForwardPlusBase::MaxDecalRq
staticinherited

◆ MinCubemapProbeRq

const size_t Ogre::ForwardPlusBase::MinCubemapProbeRq
staticinherited

◆ MinDecalRq

const size_t Ogre::ForwardPlusBase::MinDecalRq
staticinherited

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