Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene. More...
#include <OgreInstancedGeometry.h>
Classes | |
class | BatchInstance |
The details of a topological BatchInstance which is the highest level of partitioning for this class. More... | |
class | GeometryBucket |
A GeometryBucket is a the lowest level bucket where geometry with the same vertex & index format is stored. More... | |
class | InstancedObject |
class | LODBucket |
A LODBucket is a collection of smaller buckets with the same LOD. More... | |
class | MaterialBucket |
A MaterialBucket is a collection of smaller buckets with the same Material (and implicitly the same LOD). More... | |
class | OptimisedSubMeshGeometry |
Struct holding geometry optimised per SubMesh / lod level, ready for copying to instances. More... | |
struct | QueuedGeometry |
Structure recording a queued geometry for low level builds. More... | |
struct | QueuedSubMesh |
Structure recording a queued submesh for the build. More... | |
struct | SubMeshLodGeometryLink |
Saved link between SubMesh at a LOD and vertex/index data May point to original or optimised geometry. More... | |
Public Types | |
typedef MapIterator < BatchInstanceMap > | BatchInstanceIterator |
Iterator for iterating over contained BatchInstances. More... | |
typedef map< uint32, BatchInstance * >::type | BatchInstanceMap |
Indexed BatchInstance map based on packed x/y/z BatchInstance index, 10 bits for each axis. More... | |
typedef list < OptimisedSubMeshGeometry * > ::type | OptimisedSubMeshGeometryList |
typedef vector< QueuedGeometry * > ::type | QueuedGeometryList |
typedef vector< QueuedSubMesh * > ::type | QueuedSubMeshList |
typedef vector< String >::type | QueuedSubMeshOriginList |
typedef vector < RenderOperation * >::type | RenderOperationVector |
Simple vectors where are stored all the renderoperations of the Batch. More... | |
typedef map< SubMesh *, SubMeshLodGeometryLinkList * > ::type | SubMeshGeometryLookup |
typedef vector < SubMeshLodGeometryLink > ::type | SubMeshLodGeometryLinkList |
Public Member Functions | |
InstancedGeometry (SceneManager *owner, const String &name) | |
Constructor; do not use directly (. More... | |
virtual | ~InstancedGeometry () |
Destructor. More... | |
void | addBatchInstance (void) |
Add a new batch instance. More... | |
virtual void | addEntity (Entity *ent, const Vector3 &position, const Quaternion &orientation=Quaternion::IDENTITY, const Vector3 &scale=Vector3::UNIT_SCALE) |
Adds an Entity to the static geometry. More... | |
virtual void | addSceneNode (const SceneNode *node) |
Adds all the Entity objects attached to a SceneNode and all it's children to the static geometry. More... | |
virtual void | build (void) |
Build the geometry. More... | |
virtual void | destroy (void) |
Destroys all the built geometry state (reverse of build). More... | |
virtual void | dump (const String &filename) const |
Dump the contents of this InstancedGeometry to a file for diagnostic purposes. More... | |
AnimationStateSet * | getBaseAnimationState (void) |
SkeletonPtr | getBaseSkeleton (void) |
SkeletonInstance * | getBaseSkeletonInstance (void) |
virtual const Vector3 & | getBatchInstanceDimensions (void) const |
Gets the size of a single batch of geometry. More... | |
BatchInstanceIterator | getBatchInstanceIterator (void) |
Get an iterator over the BatchInstances in this geometry. More... | |
virtual bool | getCastShadows (void) |
Will the geometry from this object cast shadows? More... | |
const String & | getName (void) const |
Get the name of this object. More... | |
unsigned int | getObjectCount (void) |
virtual const Vector3 & | getOrigin (void) const |
Gets the origin of this geometry. More... | |
virtual bool | getProvideWorldInverses (void) const |
virtual Real | getRenderingDistance (void) const |
Gets the distance at which batches are no longer rendered. More... | |
RenderOperationVector & | getRenderOperationVector () |
get the mRenderOps vector. More... | |
virtual uint8 | getRenderQueueGroup (void) const |
Gets the queue group for this entity, see setRenderQueueGroup for full details. More... | |
virtual Real | getSquaredRenderingDistance (void) const |
Gets the squared distance at which batches are no longer rendered. More... | |
virtual bool | isVisible (void) const |
Are the batches visible? 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) |
virtual void | reset (void) |
Clears any of the entities / nodes added to this geometry and destroys anything which has already been built. More... | |
virtual void | setBatchInstanceDimensions (const Vector3 &size) |
Sets the size of a single BatchInstance of geometry. More... | |
virtual void | setCastShadows (bool castShadows) |
Sets whether this geometry should cast shadows. More... | |
virtual void | setOrigin (const Vector3 &origin) |
Sets the origin of the geometry. More... | |
virtual void | setProvideWorldInverses (bool flag) |
virtual void | setRenderingDistance (Real dist) |
Sets the distance at which batches are no longer rendered. More... | |
virtual void | setRenderQueueGroup (uint8 queueID) |
Sets the render queue group this object will be rendered through. More... | |
virtual void | setVisible (bool visible) |
Hides or shows all the batches. More... | |
void | visitRenderables (Renderable::Visitor *visitor, bool debugRenderables=false) |
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject will add to the render queue when asked, if any. More... | |
Protected Types | |
typedef map< size_t, size_t >::type | IndexRemap |
Protected Member Functions | |
template<typename T > | |
void | buildIndexRemap (T *pBuffer, size_t numIndexes, IndexRemap &remap) |
Method for figuring out which vertices are used by an index buffer and calculating a remap lookup for a vertex buffer just containing those vertices. More... | |
virtual AxisAlignedBox | calculateBounds (VertexData *vertexData, const Vector3 &position, const Quaternion &orientation, const Vector3 &scale) |
Calculate world bounds from a set of vertex data. More... | |
SubMeshLodGeometryLinkList * | determineGeometry (SubMesh *sm) |
Look up or calculate the geometry data to use for this SubMesh. More... | |
virtual BatchInstance * | getBatchInstance (const AxisAlignedBox &bounds, bool autoCreate) |
Virtual method for getting a BatchInstance most suitable for the passed in bounds. More... | |
virtual BatchInstance * | getBatchInstance (const Vector3 &point, bool autoCreate) |
Get the BatchInstance within which a point lies. More... | |
virtual BatchInstance * | getBatchInstance (ushort x, ushort y, ushort z, bool autoCreate) |
Get the BatchInstance using indexes. More... | |
virtual BatchInstance * | getBatchInstance (uint32 index) |
Get the BatchInstance using a packed index, returns null if it doesn't exist. More... | |
virtual AxisAlignedBox | getBatchInstanceBounds (ushort x, ushort y, ushort z) |
Get the bounds of an indexed BatchInstance. More... | |
virtual Vector3 | getBatchInstanceCentre (ushort x, ushort y, ushort z) |
Get the centre of an indexed BatchInstance. More... | |
virtual void | getBatchInstanceIndexes (const Vector3 &point, ushort &x, ushort &y, ushort &z) |
Get the BatchInstance indexes for a point. More... | |
virtual BatchInstance * | getInstancedGeometryInstance (void) |
get the first BatchInstance or create on if it does not exists. More... | |
virtual Real | getVolumeIntersection (const AxisAlignedBox &box, ushort x, ushort y, ushort z) |
Get the volume intersection for an indexed BatchInstance with some bounds. More... | |
virtual uint32 | packIndex (ushort x, ushort y, ushort z) |
Pack 3 indexes into a single index value. More... | |
template<typename T > | |
void | remapIndexes (T *src, T *dst, const IndexRemap &remap, size_t numIndexes) |
Method for altering indexes based on a remap. More... | |
void | splitGeometry (VertexData *vd, IndexData *id, SubMeshLodGeometryLink *targetGeomLink) |
Split some shared geometry into dedicated geometry. More... | |
Protected Attributes | |
AnimationStateSet * | mAnimationState |
This is the main animation state. More... | |
SkeletonPtr | mBaseSkeleton |
this is just a pointer to the base skeleton that will be used for each animated object in the batches This pointer has a value only during the creation of the InstancedGeometry More... | |
Vector3 | mBatchInstanceDimensions |
BatchInstanceMap | mBatchInstanceMap |
Map of BatchInstances. More... | |
bool | mBuilt |
bool | mCastShadows |
Vector3 | mHalfBatchInstanceDimensions |
BatchInstance * | mInstancedGeometryInstance |
String | mName |
unsigned int | mObjectCount |
number of objects in the batch More... | |
OptimisedSubMeshGeometryList | mOptimisedSubMeshGeometryList |
List of geometry which has been optimised for SubMesh use This is the primary storage used for cleaning up later. More... | |
Vector3 | mOrigin |
SceneManager * | mOwner |
bool | mProvideWorldInverses |
Flags to indicate whether the World Transform Inverse matrices are passed to the shaders. More... | |
QueuedSubMeshList | mQueuedSubMeshes |
RenderOperationVector | mRenderOps |
This vector stores all the renderOperation used in the batch. More... | |
uint8 | mRenderQueueID |
The render queue to use when rendering this object. More... | |
bool | mRenderQueueIDSet |
Flags whether the RenderQueue's default should be used. More... | |
SkeletonInstance * | mSkeletonInstance |
Real | mSquaredUpperDistance |
SubMeshGeometryLookup | mSubMeshGeometryLookup |
Cached links from SubMeshes to (potentially optimised) geometry This is not used for deletion since the lookup may reference original vertex data. More... | |
Real | mUpperDistance |
bool | mVisible |
Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene.
Definition at line 104 of file OgreInstancedGeometry.h.
Iterator for iterating over contained BatchInstances.
Definition at line 828 of file OgreInstancedGeometry.h.
typedef map<uint32, BatchInstance*>::type Ogre::InstancedGeometry::BatchInstanceMap |
Indexed BatchInstance map based on packed x/y/z BatchInstance index, 10 bits for each axis.
Definition at line 524 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 618 of file OgreInstancedGeometry.h.
Definition at line 131 of file OgreInstancedGeometry.h.
typedef vector<QueuedGeometry*>::type Ogre::InstancedGeometry::QueuedGeometryList |
Definition at line 166 of file OgreInstancedGeometry.h.
typedef vector<QueuedSubMesh*>::type Ogre::InstancedGeometry::QueuedSubMeshList |
Definition at line 155 of file OgreInstancedGeometry.h.
typedef vector<String>::type Ogre::InstancedGeometry::QueuedSubMeshOriginList |
Definition at line 156 of file OgreInstancedGeometry.h.
typedef vector<RenderOperation*>::type Ogre::InstancedGeometry::RenderOperationVector |
Simple vectors where are stored all the renderoperations of the Batch.
This vector is used when we want to delete the batch, in order to delete only one time each render operation.
Definition at line 530 of file OgreInstancedGeometry.h.
typedef map<SubMesh*, SubMeshLodGeometryLinkList*>::type Ogre::InstancedGeometry::SubMeshGeometryLookup |
Definition at line 140 of file OgreInstancedGeometry.h.
Definition at line 139 of file OgreInstancedGeometry.h.
Ogre::InstancedGeometry::InstancedGeometry | ( | SceneManager * | owner, |
const String & | name | ||
) |
Constructor; do not use directly (.
|
virtual |
Destructor.
void Ogre::InstancedGeometry::addBatchInstance | ( | void | ) |
Add a new batch instance.
|
virtual |
Adds an Entity to the static geometry.
|
virtual |
Adds all the Entity objects attached to a SceneNode and all it's children to the static geometry.
node | Pointer to the node to use to provide a set of Entity templates |
|
virtual |
Build the geometry.
|
inlineprotected |
Method for figuring out which vertices are used by an index buffer and calculating a remap lookup for a vertex buffer just containing those vertices.
Definition at line 624 of file OgreInstancedGeometry.h.
|
protectedvirtual |
Calculate world bounds from a set of vertex data.
|
virtual |
Destroys all the built geometry state (reverse of build).
|
protected |
Look up or calculate the geometry data to use for this SubMesh.
|
virtual |
Dump the contents of this InstancedGeometry to a file for diagnostic purposes.
|
inline |
Definition at line 855 of file OgreInstancedGeometry.h.
|
inline |
Definition at line 850 of file OgreInstancedGeometry.h.
|
inline |
Definition at line 845 of file OgreInstancedGeometry.h.
|
protectedvirtual |
Virtual method for getting a BatchInstance most suitable for the passed in bounds.
Can be overridden by subclasses.
|
protectedvirtual |
Get the BatchInstance within which a point lies.
|
protectedvirtual |
Get the BatchInstance using indexes.
|
protectedvirtual |
Get the BatchInstance using a packed index, returns null if it doesn't exist.
|
protectedvirtual |
Get the bounds of an indexed BatchInstance.
|
protectedvirtual |
Get the centre of an indexed BatchInstance.
|
inlinevirtual |
Gets the size of a single batch of geometry.
Definition at line 796 of file OgreInstancedGeometry.h.
|
protectedvirtual |
Get the BatchInstance indexes for a point.
BatchInstanceIterator Ogre::InstancedGeometry::getBatchInstanceIterator | ( | void | ) |
Get an iterator over the BatchInstances in this geometry.
|
inlinevirtual |
Will the geometry from this object cast shadows?
Definition at line 779 of file OgreInstancedGeometry.h.
|
protectedvirtual |
get the first BatchInstance or create on if it does not exists.
|
inline |
Get the name of this object.
Definition at line 656 of file OgreInstancedGeometry.h.
|
inline |
Definition at line 860 of file OgreInstancedGeometry.h.
|
inlinevirtual |
Gets the origin of this geometry.
Definition at line 810 of file OgreInstancedGeometry.h.
|
inlinevirtual |
Definition at line 875 of file OgreInstancedGeometry.h.
|
inlinevirtual |
Gets the distance at which batches are no longer rendered.
Definition at line 748 of file OgreInstancedGeometry.h.
|
inline |
get the mRenderOps vector.
Definition at line 832 of file OgreInstancedGeometry.h.
|
virtual |
Gets the queue group for this entity, see setRenderQueueGroup for full details.
|
inlinevirtual |
Gets the squared distance at which batches are no longer rendered.
Definition at line 751 of file OgreInstancedGeometry.h.
|
protectedvirtual |
Get the volume intersection for an indexed BatchInstance with some bounds.
|
inlinevirtual |
Are the batches visible?
Definition at line 758 of file OgreInstancedGeometry.h.
|
inlineinherited |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
operator new, with debug line info
Definition at line 67 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
array operator new, with debug line info
Definition at line 85 of file OgreMemoryAllocatedObject.h.
|
inlineinherited |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
Pack 3 indexes into a single index value.
|
inlineprotected |
Method for altering indexes based on a remap.
Definition at line 637 of file OgreInstancedGeometry.h.
|
virtual |
Clears any of the entities / nodes added to this geometry and destroys anything which has already been built.
|
inlinevirtual |
Sets the size of a single BatchInstance of geometry.
size | Vector3 expressing the 3D size of each BatchInstance. |
Definition at line 791 of file OgreInstancedGeometry.h.
|
virtual |
Sets whether this geometry should cast shadows.
|
inlinevirtual |
Sets the origin of the geometry.
size | Vector3 expressing the 3D origin of the geometry. |
Definition at line 808 of file OgreInstancedGeometry.h.
|
virtual |
|
inlinevirtual |
Sets the distance at which batches are no longer rendered.
dist | Distance beyond which the batches will not be rendered (the default is 0, which means batches are always rendered). |
Definition at line 742 of file OgreInstancedGeometry.h.
|
virtual |
Sets the render queue group this object will be rendered through.
queueID | Enumerated value of the queue group to use. |
|
virtual |
Hides or shows all the batches.
|
protected |
Split some shared geometry into dedicated geometry.
void Ogre::InstancedGeometry::visitRenderables | ( | Renderable::Visitor * | visitor, |
bool | debugRenderables = false |
||
) |
Method to allow a caller to abstractly iterate over the Renderable instances that this MovableObject will add to the render queue when asked, if any.
visitor | Pointer to a class implementing the Renderable::Visitor interface which will be called back for each Renderable which will be queued. Bear in mind that the state of the Renderable instances may not be finalised depending on when you call this. |
debugRenderables | If false, only regular renderables will be visited (those for normal display). If true, debug renderables will be included too. |
|
protected |
This is the main animation state.
All "objects" in the batch will use an instance of this animation state
Definition at line 561 of file OgreInstancedGeometry.h.
|
protected |
this is just a pointer to the base skeleton that will be used for each animated object in the batches This pointer has a value only during the creation of the InstancedGeometry
Definition at line 556 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 539 of file OgreInstancedGeometry.h.
|
protected |
Map of BatchInstances.
Definition at line 573 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 535 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 538 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 540 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 552 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 534 of file OgreInstancedGeometry.h.
|
protected |
number of objects in the batch
Definition at line 550 of file OgreInstancedGeometry.h.
|
protected |
List of geometry which has been optimised for SubMesh use This is the primary storage used for cleaning up later.
Definition at line 564 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 541 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 533 of file OgreInstancedGeometry.h.
|
protected |
Flags to indicate whether the World Transform Inverse matrices are passed to the shaders.
Definition at line 544 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 551 of file OgreInstancedGeometry.h.
|
protected |
This vector stores all the renderOperation used in the batch.
See the type definition for more details.
Definition at line 577 of file OgreInstancedGeometry.h.
|
protected |
The render queue to use when rendering this object.
Definition at line 546 of file OgreInstancedGeometry.h.
|
protected |
Flags whether the RenderQueue's default should be used.
Definition at line 548 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 557 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 537 of file OgreInstancedGeometry.h.
|
protected |
Cached links from SubMeshes to (potentially optimised) geometry This is not used for deletion since the lookup may reference original vertex data.
Definition at line 570 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 536 of file OgreInstancedGeometry.h.
|
protected |
Definition at line 542 of file OgreInstancedGeometry.h.