OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::CompositorShadowNodeDef Class Reference

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

#include <OgreCompositorShadowNodeDef.h>

+ Inheritance diagram for Ogre::CompositorShadowNodeDef:
+ Collaboration diagram for Ogre::CompositorShadowNodeDef:

Public Types

enum  BoolSetting { BoolFalse, BoolTrue, BoolUndefined }
 
enum  TextureSource { TEXTURE_INPUT, TEXTURE_LOCAL, TEXTURE_GLOBAL, NUM_TEXTURES_SOURCES }
 

Public Member Functions

 CompositorShadowNodeDef (const String &name, CompositorManager2 *compositorManager)
 
virtual ~CompositorShadowNodeDef ()
 
virtual void _validateAndFinish (void)
 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...
 
ShadowTextureDefinitionaddShadowTextureDefinition (size_t lightIdx, size_t split, const String &name, bool isAtlas)
 Adds a new ShadowTexture definition. More...
 
CompositorTargetDefaddTargetPass (const String &renderTargetName, uint32 rtIndex=0)
 Adds a new Target pass. More...
 
TextureDefinitionaddTextureDefinition (const String &name)
 Creates a TextureDefinition with a given name, must be unique. More...
 
virtual IdString addTextureSourceName (const String &name, size_t index, TextureSource textureSource)
 Overloaded to prevent creating input channels. More...
 
CompositorManager2getCompositorManager (void) const
 
IdString getName (void) const
 
String getNameStr (void) const
 
size_t getNumInputChannels (void) const
 This has O(N) complexity! (not cached, we look in mNameToChannelMap) More...
 
size_t getNumOutputChannels (void) const
 Returns the number of output channels. More...
 
size_t getNumTargetPasses (void) const
 Gets the number of passes in this node. More...
 
bool getStartEnabled (void) const
 
CompositorTargetDefgetTargetPass (size_t passIndex)
 Retrieves an existing pass by it's given index. 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 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 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 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 setDefaultTechnique (ShadowMapTechniques techn)
 
void setNumLocalTextureDefinitions (size_t numTDs)
 Reserves enough memory for all texture definitions. 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 setNumShadowTextureDefinitions (size_t numTex)
 Reserves enough memory for all texture definitions. 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...
 

Static Public Member Functions

static CompositorChannel createTexture (const TextureDefinition &textureDef, const String &texName, const RenderTarget *finalTarget, RenderSystem *renderSys)
 
static void createTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, IdType id, bool uniqueNames, const RenderTarget *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 destroyTextures (CompositorChannelVec &inOutTexContainer, RenderSystem *renderSys)
 createTextures More...
 
static void recreateResizableTextures (const TextureDefinitionVec &textureDefs, CompositorChannelVec &inOutTexContainer, const RenderTarget *finalTarget, RenderSystem *renderSys, const CompositorNodeVec &connectedNodes, const CompositorPassVec *passes)
 Destroys & recreates only the textures that depend on the main RT (i.e. More...
 

Public Attributes

IdString mCustomIdentifier
 

Protected Types

typedef map< IdString, uint32 >
::type 
NameToChannelMap
 
typedef vector
< ShadowTextureDefinition >
::type 
ShadowMapTexDefVec
 
typedef vector
< TextureDefinition >::type 
TextureDefinitionVec
 

Protected Member Functions

IdString addShadowTextureSourceName (const String &name, size_t index, TextureSource textureSource)
 

Static Protected Member Functions

static void decodeTexSource (uint32 encodedVal, size_t &outIdx, TextureSource &outTexSource)
 
static uint32 encodeTexSource (size_t index, TextureSource textureSource)
 

Protected Attributes

CompositorManager2mCompositorManager
 
TextureSource mDefaultLocalTextureSource
 TextureSource to use by addLocalTextureDefinition. More...
 
ShadowMapTechniques mDefaultTechnique
 
TextureDefinitionVec mLocalTextureDefs
 
size_t mMaxRq
 
size_t mMinRq
 
IdString mName
 
String mNameStr
 
NameToChannelMap mNameToChannelMap
 Similar to. More...
 
size_t mNumLights
 Not the same as mShadowMapTexDefinitions.size(), because splits aren't included. More...
 
ChannelMappings mOutChannelMapping
 Tells where to grab the RenderTarget from for the output channel. More...
 
ShadowMapTexDefVec mShadowMapTexDefinitions
 
bool mStartEnabled
 
CompositorTargetDefVec mTargetPasses
 

Friends

class CompositorShadowNode
 

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

Definition at line 108 of file OgreCompositorShadowNodeDef.h.

Member Typedef Documentation

Definition at line 114 of file OgreTextureDefinition.h.

Definition at line 113 of file OgreTextureDefinition.h.

Member Enumeration Documentation

Enumerator
BoolFalse 
BoolTrue 
BoolUndefined 

Definition at line 65 of file OgreTextureDefinition.h.

Enumerator
TEXTURE_INPUT 
TEXTURE_LOCAL 

We got the texture through an input channel.

TEXTURE_GLOBAL 

We own the texture.

NUM_TEXTURES_SOURCES 

It's a global texture. Ask the manager for it.

Definition at line 57 of file OgreTextureDefinition.h.

Constructor & Destructor Documentation

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

Definition at line 126 of file OgreCompositorShadowNodeDef.h.

virtual Ogre::CompositorShadowNodeDef::~CompositorShadowNodeDef ( )
inlinevirtual

Definition at line 129 of file OgreCompositorShadowNodeDef.h.

Member Function Documentation

virtual void Ogre::CompositorShadowNodeDef::_validateAndFinish ( void  )
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.
ShadowTextureDefinition* Ogre::CompositorShadowNodeDef::addShadowTextureDefinition ( size_t  lightIdx,
size_t  split,
const String name,
bool  isAtlas 
)

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 alias this texture for reference. Must be unique and not contain the "global_" prefix.
isAtlasTrue if this shadow map is rendered in an UV atlas; which means we don't create our own texture, but rather reference another through the local name.
IdString Ogre::CompositorShadowNodeDef::addShadowTextureSourceName ( const String name,
size_t  index,
TextureSource  textureSource 
)
protected
CompositorTargetDef* Ogre::CompositorNodeDef::addTargetPass ( const String renderTargetName,
uint32  rtIndex = 0 
)
inherited

Adds a new Target pass.

Remarks
WARNING: Calling this function may invalidate all previous returned pointers unless you've properly called setNumTargetPass
Parameters
renderTargetNameWe need the full name, not just the hash; so we can check whether it has the global_ prefix
rtIndexThe RT to address if it is intended to use with a 3D texture (or a cubemap or a 2D Array) CompositorPassDef::mRtIndex. Default: 0
TextureDefinition* Ogre::TextureDefinitionBase::addTextureDefinition ( const String name)
inherited

Creates a TextureDefinition with a given name, must be unique.

Remarks
WARNING: Calling this function may invalidate all previous returned pointers unless you've properly called setLocalTextureDefinitions
addTextureSourceName remarks for what it can throw
Textures are local when the derived class is a Node definition, and it's global when the derived class is a Workspace definition
Parameters
nameThe name of the texture. Names are usually valid only throughout this node. We need the name, not its hash because we need to validate the global_ prefix is used correctly.
virtual IdString Ogre::CompositorShadowNodeDef::addTextureSourceName ( const String name,
size_t  index,
TextureSource  textureSource 
)
virtual

Overloaded to prevent creating input channels.

Reimplemented from Ogre::TextureDefinitionBase.

static CompositorChannel Ogre::TextureDefinitionBase::createTexture ( const TextureDefinition textureDef,
const String texName,
const RenderTarget finalTarget,
RenderSystem renderSys 
)
staticinherited
static void Ogre::TextureDefinitionBase::createTextures ( const TextureDefinitionVec textureDefs,
CompositorChannelVec inOutTexContainer,
IdType  id,
bool  uniqueNames,
const RenderTarget finalTarget,
RenderSystem renderSys 
)
staticinherited

Utility function to create the textures based on a given set of texture definitions and put them in a container.

Remarks
Useful because both Workspace & CompositorNode share the same functionality (create global/local textures respectively) without having to create a whole base class just for one function. It's confusing that Nodes & Workspace would share the same base class, as if they were the same base object or share similar functionality (when in fact, workspace manages nodes)
Parameters
textureDefsArray of texture definitions
inOutTexContainerWhere we'll store the newly created RTs & textures
idUnique id in the case we want textures to have unique names (uniqueNames must be true)
uniqueNamesSet to true if each RT will have a unique name based on given Id, or we don't. The latter is useful for global textures (let them get access through materials)
finalTargetThe final render target (usually the render window) we have to clone parameters from (eg. when using auto width & height, or fsaa settings)
renderSysThe RenderSystem to use
static void Ogre::TextureDefinitionBase::decodeTexSource ( uint32  encodedVal,
size_t &  outIdx,
TextureSource outTexSource 
)
staticprotectedinherited
static void Ogre::TextureDefinitionBase::destroyTextures ( CompositorChannelVec inOutTexContainer,
RenderSystem renderSys 
)
staticinherited

createTextures

static uint32 Ogre::TextureDefinitionBase::encodeTexSource ( size_t  index,
TextureSource  textureSource 
)
inlinestaticprotectedinherited

Definition at line 127 of file OgreTextureDefinition.h.

CompositorManager2* Ogre::CompositorNodeDef::getCompositorManager ( void  ) const
inlineinherited

Definition at line 184 of file OgreCompositorNodeDef.h.

IdString Ogre::CompositorNodeDef::getName ( void  ) const
inlineinherited

Definition at line 107 of file OgreCompositorNodeDef.h.

String Ogre::CompositorNodeDef::getNameStr ( void  ) const
inlineinherited

Definition at line 108 of file OgreCompositorNodeDef.h.

size_t Ogre::TextureDefinitionBase::getNumInputChannels ( void  ) const
inherited

This has O(N) complexity! (not cached, we look in mNameToChannelMap)

size_t Ogre::CompositorNodeDef::getNumOutputChannels ( void  ) const
inlineinherited

Returns the number of output channels.

Definition at line 165 of file OgreCompositorNodeDef.h.

size_t Ogre::CompositorNodeDef::getNumTargetPasses ( void  ) const
inlineinherited

Gets the number of passes in this node.

Definition at line 153 of file OgreCompositorNodeDef.h.

bool Ogre::CompositorNodeDef::getStartEnabled ( void  ) const
inlineinherited

Definition at line 112 of file OgreCompositorNodeDef.h.

CompositorTargetDef* Ogre::CompositorNodeDef::getTargetPass ( size_t  passIndex)
inlineinherited

Retrieves an existing pass by it's given index.

Definition at line 150 of file OgreCompositorNodeDef.h.

void Ogre::CompositorNodeDef::getTextureSource ( size_t  outputChannel,
size_t &  index,
TextureSource textureSource 
) const
inherited

Retrieves in which container to look for when wanting to know the output texture using the mappings from input/local texture -> output.

Parameters
outputChannel[in] The output channel we want to know about
index[out] The index at the container in which the texture associated with the output channel is stored
textureSource[out] Where to get this texture from
void Ogre::TextureDefinitionBase::getTextureSource ( IdString  name,
size_t &  index,
TextureSource textureSource 
) const
inherited

Retrieves in which container to look for when looking to which texture is a given name associated with.

Remarks
Throws if name is not found.
Parameters
nameThe name of the texture. Names are usually valid only throughout this node.
index[out] The index at the container in which the texture associated with the output channel is stored
textureSource[out] Where to get this texture from
void Ogre::CompositorNodeDef::mapOutputChannel ( size_t  outChannel,
IdString  textureName 
)
inherited

Maps the output channel to the given texture name, which can be either a local texture or a reference to an input channel.

Global textures can't be used as output.

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) Prefer calling
See also
setNumOutputChannels beforehand Will throw if the local texture hasn't been declared yet or the input channel name hasn't been set yet (declaration order is important!).
Parameters
outChannelOutput channel # to map
textureNameName of the texture, which can be to a local texture, or an input channel's name. Global textures aren't supported.
template<class Alloc >
void Ogre::AllocatedObject< Alloc >::operator delete ( void *  ptr)
inlineinherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

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

Definition at line 102 of file OgreMemoryAllocatedObject.h.

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

Definition at line 108 of file OgreMemoryAllocatedObject.h.

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

Definition at line 113 of file OgreMemoryAllocatedObject.h.

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

Definition at line 119 of file OgreMemoryAllocatedObject.h.

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

Definition at line 68 of file OgreMemoryAllocatedObject.h.

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

Definition at line 73 of file OgreMemoryAllocatedObject.h.

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

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

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

Definition at line 86 of file OgreMemoryAllocatedObject.h.

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

Definition at line 91 of file OgreMemoryAllocatedObject.h.

static void Ogre::TextureDefinitionBase::recreateResizableTextures ( const TextureDefinitionVec textureDefs,
CompositorChannelVec inOutTexContainer,
const RenderTarget finalTarget,
RenderSystem renderSys,
const CompositorNodeVec connectedNodes,
const CompositorPassVec passes 
)
staticinherited

Destroys & recreates only the textures that depend on the main RT (i.e.

the RenderWindow) resolution

Parameters
textureDefsArray of texture definitions, so we know which ones depend on main RT's resolution
inOutTexContainerWhere we'll replace the RTs & textures
finalTargetThe final render target (usually the render window) we have to clone parameters from (eg. when using auto width & height, or fsaa settings)
renderSysThe RenderSystem to use
connectedNodesArray of connected nodes that may be using our textures and need to be notified.
passesArray of Compositor Passes which may contain the texture being recreated When the pointer is null, we don't iterate through it.
void Ogre::CompositorShadowNodeDef::setDefaultTechnique ( ShadowMapTechniques  techn)
inline

Definition at line 135 of file OgreCompositorShadowNodeDef.h.

void Ogre::TextureDefinitionBase::setNumLocalTextureDefinitions ( size_t  numTDs)
inlineinherited

Reserves enough memory for all texture definitions.

Remarks
Calling this function is not obligatory, but recommended
Parameters
numPassesThe number of texture definitions expected to contain.

Definition at line 189 of file OgreTextureDefinition.h.

void Ogre::CompositorNodeDef::setNumOutputChannels ( size_t  numOuts)
inlineinherited

Reserves enough memory for all output channel mappings (efficient allocation, better than using linked lists or other containers with two level of indirections)

Remarks
Calling this function is not obligatory, but recommended
Parameters
numPassesThe number of output channels expected to contain.

Definition at line 162 of file OgreCompositorNodeDef.h.

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

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.

Definition at line 143 of file OgreCompositorShadowNodeDef.h.

void Ogre::CompositorNodeDef::setNumTargetPass ( size_t  numPasses)
inlineinherited

Reserves enough memory for all passes.

Remarks
Calling this function is obligatory, otherwise unexpected crashes may occur. CompositorTargetDef doesn't follow the Rule of Three.
Parameters
numPassesThe number of passes expected to contain.

Definition at line 135 of file OgreCompositorNodeDef.h.

void Ogre::CompositorNodeDef::setStartEnabled ( bool  enabled)
inlineinherited

Whether the node should be start as enabled when instantiated.

Definition at line 111 of file OgreCompositorNodeDef.h.

Friends And Related Function Documentation

friend class CompositorShadowNode
friend

Definition at line 110 of file OgreCompositorShadowNodeDef.h.

Member Data Documentation

CompositorManager2* Ogre::CompositorNodeDef::mCompositorManager
protectedinherited

Definition at line 96 of file OgreCompositorNodeDef.h.

IdString Ogre::CompositorNodeDef::mCustomIdentifier
inherited

Definition at line 99 of file OgreCompositorNodeDef.h.

TextureSource Ogre::TextureDefinitionBase::mDefaultLocalTextureSource
protectedinherited

TextureSource to use by addLocalTextureDefinition.

Could be either TEXTURE_LOCAL or TEXTURE_GLOBAL (depends on our derived class)

Definition at line 119 of file OgreTextureDefinition.h.

ShadowMapTechniques Ogre::CompositorShadowNodeDef::mDefaultTechnique
protected

Definition at line 115 of file OgreCompositorShadowNodeDef.h.

TextureDefinitionVec Ogre::TextureDefinitionBase::mLocalTextureDefs
protectedinherited

Definition at line 120 of file OgreTextureDefinition.h.

size_t Ogre::CompositorShadowNodeDef::mMaxRq
protected

Definition at line 120 of file OgreCompositorShadowNodeDef.h.

size_t Ogre::CompositorShadowNodeDef::mMinRq
protected

Definition at line 119 of file OgreCompositorShadowNodeDef.h.

IdString Ogre::CompositorNodeDef::mName
protectedinherited

Definition at line 82 of file OgreCompositorNodeDef.h.

String Ogre::CompositorNodeDef::mNameStr
protectedinherited

Definition at line 94 of file OgreCompositorNodeDef.h.

NameToChannelMap Ogre::TextureDefinitionBase::mNameToChannelMap
protectedinherited

Similar to.

See also
CompositorNodeDef::mOutChannelMapping, associates a given name with the input, local or global textures.

Definition at line 125 of file OgreTextureDefinition.h.

size_t Ogre::CompositorShadowNodeDef::mNumLights
protected

Not the same as mShadowMapTexDefinitions.size(), because splits aren't included.

Definition at line 118 of file OgreCompositorShadowNodeDef.h.

ChannelMappings Ogre::CompositorNodeDef::mOutChannelMapping
protectedinherited

Tells where to grab the RenderTarget from for the output channel.

They can come either from an input channel, or from local textures. The first 30 bits indicate the channel #, the last 30th & 31sts bit are used to determine whether it comes from the input channel, the local texture, or it is global.

Definition at line 90 of file OgreCompositorNodeDef.h.

ShadowMapTexDefVec Ogre::CompositorShadowNodeDef::mShadowMapTexDefinitions
protected

Definition at line 114 of file OgreCompositorShadowNodeDef.h.

bool Ogre::CompositorNodeDef::mStartEnabled
protectedinherited

Definition at line 93 of file OgreCompositorNodeDef.h.

CompositorTargetDefVec Ogre::CompositorNodeDef::mTargetPasses
protectedinherited

Definition at line 91 of file OgreCompositorNodeDef.h.


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