OgreSharedRuns Class Reference

Class of SharedRuns used in an OGRE environment. More...

Inheritance diagram for OgreSharedRuns:

SharedRuns List of all members.

Public Member Functions

 OgreSharedRuns ()
 Constructor.
std::map< RenderingRunType,
RenderingRun * > & 
getSharedRuns ()
 Retrieves the contaied RenderingRuns with their type information.
void setBoundingSphere (Sphere &sphere)
 Sets the bounding sphere of the node.
void setBoundingBox (AxisAlignedBox &box)
 Sets the axis-aligned bounding box of the node.
Sphere & getBoundingSphere ()
 Returns the bounding sphere of the node.
AxisAlignedBox & getBoundingBox ()
 Returns the axis-aligned bounding box of the node.
Sphere & getRootBoundingSphere ()
 Returns the bounding sphere of the root parent node.
Sphere & getRootBoundingSphere (RenderingRunType runType)
 Retrieves the bounding sphere of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.
AxisAlignedBox & getRootBoundingBox ()
 Returns the axis-aligned bounding box of the root parent node.
AxisAlignedBox & getRootBoundingBox (RenderingRunType runType)
 Retrieves the axis-aligned bounding box of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.
const Vector3 & getRootPosition ()
 Returns the world space center position of the root parent node.
const Vector3 & getRootPosition (RenderingRunType runType)
 Retrieves the world space center position of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.
bool hasOwnRun (RenderingRunType runType)
 Checks if this node has a resource with the given type.
void addRenderablesToQueue (RenderQueue *rq)
 Adds all the Renderables connected to this node to a given RenderQueue.
void notifyCamera (Camera *cam)
 Calls notifyCamera() to all the Renderables connected to this node.
void findSharedRootsForType (RenderingRunType runType, std::vector< OgreSharedRuns * > &roots)
 Finds all the topmost nodes which have resources of the given type.
RenderingRungetRun (RenderingRunType runType)
void addRun (RenderingRunType runType, RenderingRun *run)
void updateRun (RenderingRunType runType, unsigned long frameNum)
void updateBounds ()
 Updates the boundary of this SharedRuns (and also it's parent).
void validate ()
 Validate this SharedRuns (and also all childs).
void destroy ()
 Destroys the node (and all parents recursively).

Static Public Member Functions

static bool canJoin (SharedRuns *r1, SharedRuns *r2)
 Checks if two SharedRuns node can be joined.
static bool haveCommonRuns (SharedRuns *r1, SharedRuns *r2)
 Checks if two SharedRuns have common resources so that they can be joined.

Protected Member Functions

void gatherRuns ()
 Collects RenderingRuns references from the child nodes, used when joining.
void fireRunChanges ()
 Sends runChanged events for each RenderingRun type, used after join and split.
SharedRunscreateInstance ()
 Creates a new SharedRuns instance. All derivatives should implement this.
void hideRenderables ()
 Hides all the connected renderables, only used if this is a leaf.
void restoreRenderableVisibility ()
 Restires visibility of all the connected renderables, only used if this is a leaf.
void setRenderablesVisible (bool visible)
 Set visibility of connected renderables, only used if this is a leaf.

Protected Attributes

std::map< RenderingRunType,
RenderingRun * > 
sharedRuns
 map of contained RenderingRuns
std::map< OgreRenderable *,
bool > 
renderables
 map of connected renderablis with visibility information
Sphere boundingSphere
 the bounding sphere of all the objects connected to this node.
AxisAlignedBox boundingBox
 the axis aligned bounding box of all the objects connected to this node.

Detailed Description

Class of SharedRuns used in an OGRE environment.


Member Function Documentation

void OgreSharedRuns::addRenderablesToQueue RenderQueue *  rq  ) 
 

Adds all the Renderables connected to this node to a given RenderQueue.

The function is called recoursively for all child nodes.

Parameters:
pointer to the RenderQueue to add the Renderables to

void OgreSharedRuns::addRun RenderingRunType  runType,
RenderingRun run
[virtual]
 

&brief Adds a RenderingRun instance to the shared resources.

Parameters:
runType enum, type of the RenderingRun to add
run pointer to the RenderingRun instance to add

Implements SharedRuns.

bool OgreSharedRuns::canJoin SharedRuns r1,
SharedRuns r2
[static]
 

Checks if two SharedRuns node can be joined.

Parameters:
r1 pointer to one of the SharedRuns instance
r2 pointer to the other SharedRuns instance

SharedRuns * OgreSharedRuns::createInstance  )  [protected, virtual]
 

Creates a new SharedRuns instance. All derivatives should implement this.

Returns:
a new SharedRuns instance

Implements SharedRuns.

void OgreSharedRuns::findSharedRootsForType RenderingRunType  runType,
std::vector< OgreSharedRuns * > &  roots
 

Finds all the topmost nodes which have resources of the given type.

This function is called for the root node, and will be called recoursively downwards in the tree for all childs. If a node with with the given resource is found, the node can be added and it's childs don't need to be checked anymore.

From a given group of objects (root node) a new set of groups will be created (they will be the members of the given vector). Each new group will be a subtree of the original tree. They will form groups that contain the maximum number of objects that can be joined by the the given resource type.

Parameters:
runType the type of RenderingRun to look for
roots reference to the collection to add the new groups to

AxisAlignedBox& OgreSharedRuns::getBoundingBox  )  [inline]
 

Returns the axis-aligned bounding box of the node.

Returns:
a reference to the bounding box

Sphere& OgreSharedRuns::getBoundingSphere  )  [inline]
 

Returns the bounding sphere of the node.

Returns:
a reference to the bounding sphere

AxisAlignedBox& OgreSharedRuns::getRootBoundingBox RenderingRunType  runType  )  [inline]
 

Retrieves the axis-aligned bounding box of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.

Parameters:
runType the RenderingRun type
Returns:
a reference to the bounding box

AxisAlignedBox& OgreSharedRuns::getRootBoundingBox  )  [inline]
 

Returns the axis-aligned bounding box of the root parent node.

Returns:
a reference to the bounding box

Sphere& OgreSharedRuns::getRootBoundingSphere RenderingRunType  runType  )  [inline]
 

Retrieves the bounding sphere of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.

Parameters:
runType the RenderingRun type
Returns:
a reference to the bounding sphere

Sphere& OgreSharedRuns::getRootBoundingSphere  )  [inline]
 

Returns the bounding sphere of the root parent node.

Returns:
a reference to the bounding sphere

const Vector3& OgreSharedRuns::getRootPosition RenderingRunType  runType  )  [inline]
 

Retrieves the world space center position of the topmost parent node of this SharedRuns node, which have a specified RenderingRun type.

Parameters:
runType the RenderingRun type
Returns:
a reference to the center position

const Vector3& OgreSharedRuns::getRootPosition  )  [inline]
 

Returns the world space center position of the root parent node.

Returns:
a reference to the center position

RenderingRun * OgreSharedRuns::getRun RenderingRunType  runType  )  [virtual]
 

&brief Retrieves a shared resource.

Parameters:
runType enum, type of the RenderingRun to be retrieved
Returns:
pointer to the RenderingRun of type "runType", null if this type does not exists

Implements SharedRuns.

std::map<RenderingRunType, RenderingRun*>& OgreSharedRuns::getSharedRuns  )  [inline]
 

Retrieves the contaied RenderingRuns with their type information.

Returns:
map of renderables

bool OgreSharedRuns::hasOwnRun RenderingRunType  runType  )  [virtual]
 

Checks if this node has a resource with the given type.

Only this node none of the child nodes are checked.

Parameters:
the type of the RenderingRun to look for

Implements SharedRuns.

bool OgreSharedRuns::haveCommonRuns SharedRuns r1,
SharedRuns r2
[static]
 

Checks if two SharedRuns have common resources so that they can be joined.

Parameters:
r1 pointer to one of the SharedRuns instance
r2 pointer to the other SharedRuns instance

void OgreSharedRuns::notifyCamera Camera *  cam  ) 
 

Calls notifyCamera() to all the Renderables connected to this node.

The function is called recoursively for all child nodes.

Parameters:
pointer to the Camera instance to call notifyCamera() with

void OgreSharedRuns::setBoundingBox AxisAlignedBox &  box  )  [inline]
 

Sets the axis-aligned bounding box of the node.

Parameters:
box bounding box

void OgreSharedRuns::setBoundingSphere Sphere &  sphere  )  [inline]
 

Sets the bounding sphere of the node.

Parameters:
sphere bounding sphere

void OgreSharedRuns::setRenderablesVisible bool  visible  )  [inline, protected, virtual]
 

Set visibility of connected renderables, only used if this is a leaf.

Parameters:
visible visibility

Implements SharedRuns.

void OgreSharedRuns::updateRun RenderingRunType  runType,
unsigned long  frameNum
[virtual]
 

&brief Updates a shared RenderingRun.

Parameters:
runType enum, type of the RenderingRun to update
frameNum current framenumber

Implements SharedRuns.

void OgreSharedRuns::validate  )  [virtual]
 

Validate this SharedRuns (and also all childs).

Validation meens that all the SharedRuns that are joined will be examined if the sharing is still valid. If it finds out that two SharedRuns can't be joined anymore (eg.: they moved far from each other), their parent will be split and destroyed (all parent of this node also should be deleted recursively).

Implements SharedRuns.


Member Data Documentation

std::map<OgreRenderable*, bool> OgreSharedRuns::renderables [protected]
 

map of connected renderablis with visibility information

Used to show or hide the renderables connected to a leaf OgreSharedRuns node.


The documentation for this class was generated from the following files:
Generated on Thu Apr 27 17:29:42 2006 for GameTools Illumination Module by  doxygen 1.4.6-NO