OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::CompositorShadowNodeDef Class Reference

Shadow Nodes are special nodes (not to be confused with. More...

#include <OgreCompositorShadowNodeDef.h>

+ Inheritance diagram for Ogre::CompositorShadowNodeDef:

Public Member Functions

 CompositorShadowNodeDef (const String &name, CompositorManager2 *compositorManager)
 
 ~CompositorShadowNodeDef () override
 
virtual void _validateAndFinish ()
 Checks that paremeters are correctly set, and finalizes whatever needs to be done, probably because not enough data was available at the time of creation. More...
 
void addBufferInput (size_t inputChannel, IdString name) override
 Buffers. More...
 
ShadowTextureDefinitionaddShadowTextureDefinition (size_t lightIdx, size_t split, const String &name, const Vector2 &uvOffset, const Vector2 &uvLength, uint8 arrayIdx)
 Adds a new ShadowTexture definition. More...
 
IdString addTextureSourceName (const String &name, size_t index, TextureSource textureSource) override
 Overloaded to prevent creating input channels. More...
 
size_t getNumShadowTextureDefinitions () const
 Gets the number of shadow texture definitions in this node. More...
 
const ShadowTextureDefinitiongetShadowTextureDefinition (size_t texIndex) const
 Retrieves a shadow texture definition by its index. More...
 
ShadowTextureDefinitiongetShadowTextureDefinitionNonConst (size_t texIndex)
 
void postInitializePassDef (CompositorPassDef *passDef) override
 Called right after we create a pass definition. More...
 
void setDefaultTechnique (ShadowMapTechniques techn)
 
void setNumShadowTextureDefinitions (size_t numTex)
 Reserves enough memory for all texture definitions. More...
 
- Public Member Functions inherited from Ogre::CompositorNodeDef
 CompositorNodeDef (const String &name, CompositorManager2 *compositorManager)
 
virtual ~CompositorNodeDef ()
 
CompositorTargetDefaddTargetPass (const String &renderTargetName, uint32 rtIndex=0)
 Adds a new Target pass. More...
 
size_t calculateNumPasses () const
 Calculates the total number of passes in this node. More...
 
CompositorManager2getCompositorManager () const
 
IdString getName () const
 
String getNameStr () const
 
size_t getNumOutputChannels () const
 Returns the number of output channels. More...
 
size_t getNumTargetPasses () const
 Gets the number of target passes in this node. More...
 
size_t getPassNumber (const CompositorPassDef *passDef) const
 Returns the pass # of the given pass definition in this node. More...
 
bool getStartEnabled () const
 
CompositorTargetDefgetTargetPass (size_t passIndex)
 Retrieves an existing pass by it's given index. More...
 
const CompositorTargetDefgetTargetPass (size_t passIndex) const
 
void getTextureSource (IdString name, size_t &index, TextureSource &textureSource) const
 See http://www.research.att.com/~bs/bs_faq2.html#overloadderived. More...
 
void getTextureSource (size_t outputChannel, size_t &index, TextureSource &textureSource) const
 Retrieves in which container to look for when wanting to know the output texture using the mappings from input/local texture -> output. More...
 
void mapOutputBufferChannel (size_t outChannel, IdString bufferName)
 Maps the output channel to the given buffer name which can be either a local buffer or a reference to an input channel. More...
 
void mapOutputChannel (size_t outChannel, IdString textureName)
 Maps the output channel to the given texture name, which can be either a local texture or a reference to an input channel. More...
 
void removeTexture (IdString name) override
 WARNING: Be very careful with this function. More...
 
void setNumOutputBufferChannels (size_t numOuts)
 Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections) More...
 
void setNumOutputChannels (size_t numOuts)
 Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections) More...
 
void setNumTargetPass (size_t numPasses)
 Reserves enough memory for all passes. More...
 
void setStartEnabled (bool enabled)
 Whether the node should be start as enabled when instantiated. More...
 
- Public Member Functions inherited from Ogre::TextureDefinitionBase
 TextureDefinitionBase (TextureSource defaultSource)
 
TextureDefinition_addTextureDefinition (const IdString hashedName)
 For internal use. Don't call this directly. More...
 
void _addTextureSourceName (const IdString hashedName, size_t index, TextureSource textureSource)
 For internal use. Don't call this directly. More...
 
void addBufferDefinition (IdString name, size_t numElements, uint32 bytesPerElement, uint32 bindFlags, float widthFactor, float heightFactor)
 Creates an UAV buffer. More...
 
RenderTargetViewDefaddRenderTextureView (IdString name)
 
TextureDefinitionaddTextureDefinition (const String &name)
 Creates a TextureDefinition with a given name, must be unique. More...
 
const BufferDefinitionVecgetLocalBufferDefinitions () const
 
BufferDefinitionVecgetLocalBufferDefinitionsNonConst ()
 Returns the local buffer definitions. More...
 
const TextureDefinitionVecgetLocalTextureDefinitions () const
 
TextureDefinitionVecgetLocalTextureDefinitionsNonConst ()
 Returns the local texture definitions. More...
 
const NameToChannelMapgetNameToChannelMap () const
 
size_t getNumInputBufferChannels () const
 
size_t getNumInputChannels () const
 This has O(N) complexity! (not cached, we look in mNameToChannelMap) More...
 
const RenderTargetViewDefgetRenderTargetViewDef (IdString name) const
 
RenderTargetViewDefgetRenderTargetViewDefNonConstNoThrow (IdString name)
 
void getTextureSource (IdString name, size_t &index, TextureSource &textureSource) const
 Retrieves in which container to look for when looking to which texture is a given name associated with. More...
 
void removeAllRenderTextureViews ()
 
virtual void removeBuffer (IdString name)
 Remove a buffer. Buffer can come from an input channel, or a locally defined one. More...
 
void removeRenderTextureView (IdString name)
 
void renameBuffer (IdString oldName, const String &newName)
 Changes the name of a buffer. More...
 
void renameTexture (IdString oldName, const String &newName)
 Changes the name of a texture. More...
 
void setNumLocalBufferDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. More...
 
void setNumLocalTextureDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. More...
 

Additional Inherited Members

- Public Types inherited from Ogre::TextureDefinitionBase
typedef vector< BufferDefinition >::type BufferDefinitionVec
 
typedef map< IdString, uint32 >::type NameToChannelMap
 
typedef vector< PixelFormatGpu >::type PixelFormatGpuVec
 
typedef vector< TextureDefinition >::type TextureDefinitionVec
 
enum  TextureSource { TEXTURE_INPUT , TEXTURE_LOCAL , TEXTURE_GLOBAL , NUM_TEXTURES_SOURCES }
 
- Static Public Member Functions inherited from Ogre::TextureDefinitionBase
static UavBufferPackedcreateBuffer (const BufferDefinition &bufferDef, const TextureGpu *finalTarget, VaoManager *vaoManager)
 
static void createBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, const TextureGpu *finalTarget, RenderSystem *renderSys)
 Utility function to create the buffers based on a given set of buffer definitions and put them in a container. More...
 
static CompositorChannel createTexture (const TextureDefinition &textureDef, const String &texName, const TextureGpu *finalTarget, RenderSystem *renderSys)
 
static void createTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, IdType id, const TextureGpu *finalTarget, RenderSystem *renderSys)
 Utility function to create the textures based on a given set of texture definitions and put them in a container. More...
 
static void decodeTexSource (uint32 encodedVal, size_t &outIdx, TextureSource &outTexSource)
 
static void destroyBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, RenderSystem *renderSys)
 
static void destroyTextures (CompositorChannelVec &inOutTexContainer, RenderSystem *renderSys)
 
static void recreateResizableBuffers (const BufferDefinitionVec &bufferDefs, CompositorNamedBufferVec &inOutBufContainer, const TextureGpu *finalTarget, RenderSystem *renderSys, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 Destroys & recreates only the buffers that depend on the main RT (i.e. More...
 
static void recreateResizableTextures01 (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const TextureGpu *finalTarget)
 Destroys & recreates only the textures that depend on the main RT (e.g. More...
 
static void recreateResizableTextures02 (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 See recreateResizableTextures01 Updates involved RenderPassDescriptors. More...
 
static void setupTexture (TextureGpu *tex, const TextureDefinition &textureDef, const TextureGpu *finalTarget)
 
- Public Attributes inherited from Ogre::CompositorNodeDef
IdString mCustomIdentifier
 

Detailed Description

Shadow Nodes are special nodes (not to be confused with.

See also
CompositorNode) that are only used for rendering shadow maps. Normal Compositor Nodes can share or own a ShadowNode. The ShadowNode will render the scene enough times to fill all shadow maps so the main scene pass can use them.
ShadowNode are very flexible compared to Ogre 1.x; as they allow mixing multiple shadow camera setups for different lights.
Author
Matias N. Goldberg
Version
1.0

Constructor & Destructor Documentation

◆ CompositorShadowNodeDef()

Ogre::CompositorShadowNodeDef::CompositorShadowNodeDef ( const String name,
CompositorManager2 compositorManager 
)
inline

◆ ~CompositorShadowNodeDef()

Ogre::CompositorShadowNodeDef::~CompositorShadowNodeDef ( )
inlineoverride

Member Function Documentation

◆ _validateAndFinish()

virtual void Ogre::CompositorShadowNodeDef::_validateAndFinish ( )
virtual

Checks that paremeters are correctly set, and finalizes whatever needs to be done, probably because not enough data was available at the time of creation.

Remarks
If possible, try to validate parameters at creation time to avoid delaying when the error shows up. We should validate here if it's not possible to validate at any other time or if it's substantially easier to do so here.

◆ addBufferInput()

void Ogre::CompositorShadowNodeDef::addBufferInput ( size_t  inputChannel,
IdString  name 
)
overridevirtual

Buffers.

Specifies that buffer incoming from channel 'inputChannel' will be referenced by the name 'name'

Remarks
Don't leave gaps. (i.e. set channel 0 & 2, without setting channel 1) It's ok to map them out of order (i.e. set channel 2, then 0, then 1)
Parameters
inputChannelInput channel # the buffer comes from.
nameName to give to this buffer for referencing it locally from this scope. Duplicate names (including names from addBufferDefinition) will raise an exception when trying to instantiate the workspace.

Reimplemented from Ogre::TextureDefinitionBase.

◆ addShadowTextureDefinition()

ShadowTextureDefinition* Ogre::CompositorShadowNodeDef::addShadowTextureDefinition ( size_t  lightIdx,
size_t  split,
const String name,
const Vector2 uvOffset,
const Vector2 uvLength,
uint8  arrayIdx 
)

Adds a new ShadowTexture definition.

Remarks
WARNING: Calling this function may invalidate all previous returned pointers unless you've properly called setNumShadowTextureDefinitions
Parameters
lightIdxNth Closest Light to assign this texture to. Must be unique unless split is different.
splitSplit for the given light. Only valid for CSM/PSSM shadow maps. Must be unique for the same lightIdx.
nameName to a declared texture that will hold our shadow map. Must not contain the "global_" prefix.
uvOffsetValues in range [0; 1] to determine what region of the texture will hold our shadow map (i.e. UV atlas). Use Vector2::ZERO if it covers the entire texture.
uvLengthValues in range [0; 1] to determine what region of the texture will hold our shadow map (i.e. UV atlas). Use Vector2::UNIT_SCALE if it covers the entire texture.
arrayIdxIf the texture is an array texture, index to the slice that holds our shadow map.

◆ addTextureSourceName()

IdString Ogre::CompositorShadowNodeDef::addTextureSourceName ( const String name,
size_t  index,
TextureSource  textureSource 
)
overridevirtual

Overloaded to prevent creating input channels.

Reimplemented from Ogre::TextureDefinitionBase.

◆ getNumShadowTextureDefinitions()

size_t Ogre::CompositorShadowNodeDef::getNumShadowTextureDefinitions ( ) const
inline

Gets the number of shadow texture definitions in this node.

◆ getShadowTextureDefinition()

const ShadowTextureDefinition* Ogre::CompositorShadowNodeDef::getShadowTextureDefinition ( size_t  texIndex) const
inline

Retrieves a shadow texture definition by its index.

◆ getShadowTextureDefinitionNonConst()

ShadowTextureDefinition* Ogre::CompositorShadowNodeDef::getShadowTextureDefinitionNonConst ( size_t  texIndex)
inline

◆ postInitializePassDef()

void Ogre::CompositorShadowNodeDef::postInitializePassDef ( CompositorPassDef passDef)
overridevirtual

Called right after we create a pass definition.

Derived classes may want to do something with it

Parameters
passDefNewly created pass to toy with.

Reimplemented from Ogre::CompositorNodeDef.

◆ setDefaultTechnique()

void Ogre::CompositorShadowNodeDef::setDefaultTechnique ( ShadowMapTechniques  techn)
inline

◆ setNumShadowTextureDefinitions()

void Ogre::CompositorShadowNodeDef::setNumShadowTextureDefinitions ( size_t  numTex)

Reserves enough memory for all texture definitions.

Remarks
Calling this function is not obligatory, but recommended
Parameters
numTexThe number of shadow textures expected to contain.

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