Ogre::InstancedGeometry Class Reference
Core » Scene

Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene. More...

`#include <OgreInstancedGeometry.h>`

Inheritance diagram for Ogre::InstancedGeometry:
[legend]

## 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 render operations 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

## Detailed Description

Pre-transforms and batches up meshes for efficient use as instanced geometry in a scene.

Remarks
  Shader instancing allows to save both memory and draw calls. While StaticGeometry stores 500 times the same object in a batch to display 500 objects, this shader instancing implementation stores only 80 times the object, and then re-uses the vertex data with different shader parameter. Although you save memory, you make more draw call. However, you still make less draw calls than if you were rendering each object independently. Plus, you can move the batched objects independently of one another which you cannot do with StaticGeometry.

  Therefore it is important when you are rendering a lot of geometry to batch things up into as few rendering calls as possible. This class allows you to build a batched object from a series of entities in order to benefit from this behaviour. Batching has implications of it's own though:
  - Batched geometry cannot be subdivided; that means that the whole group will be displayed, or none of it will. This obivously has culling issues.
  - A single material must apply for each batch. In fact this class allows you to use multiple materials, but you should be aware that internally this means that there is one batch per material. Therefore you won't gain as much benefit from the batching if you use many different materials; try to keep the number down.

  The bounding box information is computed with object position only. It doesn't take account of the object orientation.

  The LOD settings of both the Mesh and the Materials used in constructing this instanced geometry will be respected. This means that if you use meshes/materials which have LOD, batches in the distance will have a lower polygon count or material detail to those in the foreground. Since each mesh might have different LOD distances, during build the furthest distance at each LOD level from all meshes in that BatchInstance is used. This means all the LOD levels change at the same time, but at the furthest distance of any of them (so quality is not degraded). Be aware that using Mesh LOD in this class will further increase the memory required. Only generated LOD is supported for meshes.

  There are 2 ways you can add geometry to this class; you can add Entity objects directly with predetermined positions, scales and orientations, or you can add an entire SceneNode and it's subtree, including all the objects attached to it. Once you've added everything you need to, you have to call build() the fix the geometry in place.

  You should not construct instances of this class directly; instead, call SceneManager::createInstancedGeometry, which gives the SceneManager the option of providing you with a specialised version of this class if it wishes, and also handles the memory management for you like other classes.

Note
  Warning: this class only works with indexed triangle lists at the moment, do not pass it triangle strips, fans or lines / points, or unindexed geometry.

Definition at line 105 of file OgreInstancedGeometry.h.

## Member Typedef Documentation

## BatchInstanceIterator

typedef MapIterator<BatchInstanceMap> Ogre::InstancedGeometry::BatchInstanceIterator

Iterator for iterating over contained BatchInstances.

Definition at line 836 of file OgreInstancedGeometry.h.

## BatchInstanceMap

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 532 of file OgreInstancedGeometry.h.

## IndexRemap

typedef map<size_t, size_t>::type Ogre::InstancedGeometry::IndexRemap

protected

Definition at line 626 of file OgreInstancedGeometry.h.

## OptimisedSubMeshGeometryList

typedef list<OptimisedSubMeshGeometry*>::type Ogre::InstancedGeometry::OptimisedSubMeshGeometryList

Definition at line 132 of file OgreInstancedGeometry.h.

## QueuedGeometryList

typedef vector<QueuedGeometry*>::type Ogre::InstancedGeometry::QueuedGeometryList

Definition at line 167 of file OgreInstancedGeometry.h.

## QueuedSubMeshList

typedef vector<QueuedSubMesh*>::type Ogre::InstancedGeometry::QueuedSubMeshList

Definition at line 156 of file OgreInstancedGeometry.h.

## QueuedSubMeshOriginList

typedef vector<String>::type Ogre::InstancedGeometry::QueuedSubMeshOriginList

Definition at line 157 of file OgreInstancedGeometry.h.

## RenderOperationVector

typedef vector<RenderOperation*>::type Ogre::InstancedGeometry::RenderOperationVector

Simple vectors where are stored all the render operations 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 538 of file OgreInstancedGeometry.h.

## SubMeshGeometryLookup

typedef map<SubMesh*, SubMeshLodGeometryLinkList*>::type Ogre::InstancedGeometry::SubMeshGeometryLookup

Definition at line 141 of file OgreInstancedGeometry.h.

## SubMeshLodGeometryLinkList

typedef vector<SubMeshLodGeometryLink>::type Ogre::InstancedGeometry::SubMeshLodGeometryLinkList

Definition at line 140 of file OgreInstancedGeometry.h.

## Constructor & Destructor Documentation

## InstancedGeometry()

Ogre::InstancedGeometry::InstancedGeometry | ( | SceneManager * | owner,
|  | const String & | name
| ) |  |

Constructor; do not use directly (.

See also
  SceneManager::createInstancedGeometry)

## ~InstancedGeometry()

virtual Ogre::InstancedGeometry::~InstancedGeometry | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

## addBatchInstance()

void Ogre::InstancedGeometry::addBatchInstance | ( | void |  | ) |

Add a new batch instance.

Remarks
  This method add a new instance of the whole batch, by creating a new BatchInstance, containing new LOD buckets, material buckets and geometry buckets. The new geometry buckets will use the same buffers as the base bucket.

Note
  no note

## addEntity()

virtual void Ogre::InstancedGeometry::addEntity | ( | Entity * | ent,
|  | const Vector3 & | position,
|  | const Quaternion & | orientation = `Quaternion::IDENTITY`,
|  | const Vector3 & | scale = `Vector3::UNIT_SCALE`
| ) |  |

virtual

Adds an Entity to the static geometry.

Remarks
  This method takes an existing Entity and adds its details to the list of elements to include when building. Note that the Entity itself is not copied or referenced in this method; an Entity is passed simply so that you can change the materials of attached SubEntity objects if you want. You can add the same Entity instance multiple times with different material settings completely safely, and destroy the Entity before destroying this InstancedGeometry if you like. The Entity passed in is simply used as a definition.

Note
  Must be called before 'build'.
  All added entities must use the same LOD strategy.

Parameters

  ent | The Entity to use as a definition (the Mesh and Materials referenced will be recorded for the build call).
  position | The world position at which to add this Entity
  orientation | The world orientation at which to add this Entity
  scale | The scale at which to add this entity

## addSceneNode()

virtual void Ogre::InstancedGeometry::addSceneNode | ( | const SceneNode * | node | ) |

virtual

Adds all the Entity objects attached to a SceneNode and all it's children to the static geometry.

Remarks
  This method performs just like addEntity, except it adds all the entities attached to an entire sub-tree to the geometry. The position / orientation / scale parameters are taken from the node structure instead of being specified manually.

Note
  The SceneNode you pass in will not be automatically detached from it's parent, so if you have this node already attached to the scene graph, you will need to remove it if you wish to avoid the overhead of rendering both the original objects and their new static versions! We don't do this for you incase you are preparing this in advance and so don't want the originals detached yet.
  Must be called before 'build'.
  All added entities must use the same LOD strategy.

Parameters

  node | Pointer to the node to use to provide a set of Entity templates

## build()

virtual void Ogre::InstancedGeometry::build | ( | void |  | ) |

virtual

Build the geometry.

Remarks
  Based on all the entities which have been added, and the batching options which have been set, this method constructs the batched geometry structures required. The batches are added to the scene and will be rendered unless you specifically hide them.

Note
  Once you have called this method, you can no longer add any more entities.

## buildIndexRemap()

template<typename T >

void Ogre::InstancedGeometry::buildIndexRemap | ( | T * | pBuffer,
|  | size_t | numIndexes,
|  | IndexRemap & | remap
| ) |  |

protected

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 632 of file OgreInstancedGeometry.h.

## calculateBounds()

virtual AxisAlignedBox Ogre::InstancedGeometry::calculateBounds | ( | VertexData * | vertexData,
|  | const Vector3 & | position,
|  | const Quaternion & | orientation,
|  | const Vector3 & | scale
| ) |  |

protected virtual

Calculate world bounds from a set of vertex data.

## destroy()

virtual void Ogre::InstancedGeometry::destroy | ( | void |  | ) |

virtual

Destroys all the built geometry state (reverse of build).

Remarks
  You can call build() again after this and it will pick up all the same entities / nodes you queued last time.

## determineGeometry()

SubMeshLodGeometryLinkList* Ogre::InstancedGeometry::determineGeometry | ( | SubMesh * | sm | ) |

protected

Look up or calculate the geometry data to use for this SubMesh.

## dump()

virtual void Ogre::InstancedGeometry::dump | ( | const String & | filename | ) | const

virtual

Dump the contents of this InstancedGeometry to a file for diagnostic purposes.

## getBaseAnimationState()

AnimationStateSet* Ogre::InstancedGeometry::getBaseAnimationState | ( | void |  | ) |

Remarks
  Return the animation state that will be cloned each time an InstancedObject is made

Definition at line 863 of file OgreInstancedGeometry.h.

## getBaseSkeleton()

SkeletonPtr Ogre::InstancedGeometry::getBaseSkeleton | ( | void |  | ) |

Remarks
  Return the skeleton that is shared by all instanced objects.

Definition at line 858 of file OgreInstancedGeometry.h.

## getBaseSkeletonInstance()

SkeletonInstance* Ogre::InstancedGeometry::getBaseSkeletonInstance | ( | void |  | ) |

Remarks
  Return the skeletonInstance that will be used

Definition at line 853 of file OgreInstancedGeometry.h.

## getBatchInstance() [1/4]

virtual BatchInstance* Ogre::InstancedGeometry::getBatchInstance | ( | const AxisAlignedBox & | bounds,
|  | bool | autoCreate
| ) |  |

protected virtual

Virtual method for getting a BatchInstance most suitable for the passed in bounds.

Can be overridden by subclasses.

## getBatchInstance() [2/4]

virtual BatchInstance* Ogre::InstancedGeometry::getBatchInstance | ( | const Vector3 & | point,
|  | bool | autoCreate
| ) |  |

protected virtual

Get the BatchInstance within which a point lies.

## getBatchInstance() [3/4]

virtual BatchInstance* Ogre::InstancedGeometry::getBatchInstance | ( | ushort | x,
|  | ushort | y,
|  | ushort | z,
|  | bool | autoCreate
| ) |  |

protected virtual

Get the BatchInstance using indexes.

## getBatchInstance() [4/4]

virtual BatchInstance* Ogre::InstancedGeometry::getBatchInstance | ( | uint32 | index | ) |

protected virtual

Get the BatchInstance using a packed index, returns null if it doesn't exist.

## getBatchInstanceBounds()

virtual AxisAlignedBox Ogre::InstancedGeometry::getBatchInstanceBounds | ( | ushort | x,
|  | ushort | y,
|  | ushort | z
| ) |  |

protected virtual

Get the bounds of an indexed BatchInstance.

## getBatchInstanceCentre()

virtual Vector3 Ogre::InstancedGeometry::getBatchInstanceCentre | ( | ushort | x,
|  | ushort | y,
|  | ushort | z
| ) |  |

protected virtual

Get the centre of an indexed BatchInstance.

## getBatchInstanceDimensions()

virtual const Vector3& Ogre::InstancedGeometry::getBatchInstanceDimensions | ( | void |  | ) | const

virtual

Gets the size of a single batch of geometry.

Definition at line 804 of file OgreInstancedGeometry.h.

## getBatchInstanceIndexes()

virtual void Ogre::InstancedGeometry::getBatchInstanceIndexes | ( | const Vector3 & | point,
|  | ushort & | x,
|  | ushort & | y,
|  | ushort & | z
| ) |  |

protected virtual

Get the BatchInstance indexes for a point.

## getBatchInstanceIterator()

BatchInstanceIterator Ogre::InstancedGeometry::getBatchInstanceIterator | ( | void |  | ) |

Get an iterator over the BatchInstances in this geometry.

## getCastShadows()

virtual bool Ogre::InstancedGeometry::getCastShadows | ( | void |  | ) |

virtual

Will the geometry from this object cast shadows?

Definition at line 787 of file OgreInstancedGeometry.h.

## getInstancedGeometryInstance()

virtual BatchInstance* Ogre::InstancedGeometry::getInstancedGeometryInstance | ( | void |  | ) |

protected virtual

get the first BatchInstance or create on if it does not exists.

## getName()

const String& Ogre::InstancedGeometry::getName | ( | void |  | ) | const

Get the name of this object.

Definition at line 664 of file OgreInstancedGeometry.h.

References Ogre::Quaternion::IDENTITY, and Ogre::Vector3::UNIT_SCALE.

## getObjectCount()

unsigned int Ogre::InstancedGeometry::getObjectCount | ( | void |  | ) |

Remarks
  return the total number of object that are in all the batches

Definition at line 868 of file OgreInstancedGeometry.h.

## getOrigin()

virtual const Vector3& Ogre::InstancedGeometry::getOrigin | ( | void |  | ) | const

virtual

Gets the origin of this geometry.

Definition at line 818 of file OgreInstancedGeometry.h.

## getProvideWorldInverses()

virtual bool Ogre::InstancedGeometry::getProvideWorldInverses | ( | void |  | ) | const

virtual

Remarks
  Returns the toggle state indicating whether the World Transform INVERSE matrices would be passed to the shaders.

Definition at line 883 of file OgreInstancedGeometry.h.

## getRenderingDistance()

virtual Real Ogre::InstancedGeometry::getRenderingDistance | ( | void |  | ) | const

virtual

Gets the distance at which batches are no longer rendered.

Definition at line 756 of file OgreInstancedGeometry.h.

## getRenderOperationVector()

RenderOperationVector& Ogre::InstancedGeometry::getRenderOperationVector | ( |  | ) |

get the mRenderOps vector.

Definition at line 840 of file OgreInstancedGeometry.h.

## getRenderQueueGroup()

virtual uint8 Ogre::InstancedGeometry::getRenderQueueGroup | ( | void |  | ) | const

virtual

Gets the queue group for this entity, see setRenderQueueGroup for full details.

## getSquaredRenderingDistance()

virtual Real Ogre::InstancedGeometry::getSquaredRenderingDistance | ( | void |  | ) | const

virtual

Gets the squared distance at which batches are no longer rendered.

Definition at line 759 of file OgreInstancedGeometry.h.

## getVolumeIntersection()

virtual Real Ogre::InstancedGeometry::getVolumeIntersection | ( | const AxisAlignedBox & | box,
|  | ushort | x,
|  | ushort | y,
|  | ushort | z
| ) |  |

protected virtual

Get the volume intersection for an indexed BatchInstance with some bounds.

## isVisible()

virtual bool Ogre::InstancedGeometry::isVisible | ( | void |  | ) | const

virtual

Are the batches visible?

Definition at line 766 of file OgreInstancedGeometry.h.

## operator delete() [1/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) |

inherited

Definition at line 96 of file OgreMemoryAllocatedObject.h.

## operator delete() [2/3]

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr,
|  | void * |
| ) |  |

inherited

Definition at line 102 of file OgreMemoryAllocatedObject.h.

## operator delete() [3/3]

template<class Alloc >

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

inherited

Definition at line 108 of file OgreMemoryAllocatedObject.h.

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

template<class Alloc >

void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) |

inherited

Definition at line 113 of file OgreMemoryAllocatedObject.h.

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

template<class Alloc >

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

inherited

Definition at line 119 of file OgreMemoryAllocatedObject.h.

## operator new() [1/3]

template<class Alloc >

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

inherited

operator new, with debug line info

Definition at line 68 of file OgreMemoryAllocatedObject.h.

## operator new() [2/3]

template<class Alloc >

void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) |

inherited

Definition at line 73 of file OgreMemoryAllocatedObject.h.

## operator new() [3/3]

template<class Alloc >

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

inherited

placement operator new

Definition at line 79 of file OgreMemoryAllocatedObject.h.

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

template<class Alloc >

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

inherited

array operator new, with debug line info

Definition at line 86 of file OgreMemoryAllocatedObject.h.

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

template<class Alloc >

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

inherited

Definition at line 91 of file OgreMemoryAllocatedObject.h.

## packIndex()

virtual uint32 Ogre::InstancedGeometry::packIndex | ( | ushort | x,
|  | ushort | y,
|  | ushort | z
| ) |  |

protected virtual

Pack 3 indexes into a single index value.

## remapIndexes()

template<typename T >

void Ogre::InstancedGeometry::remapIndexes | ( | T * | src,
|  | T * | dst,
|  | const IndexRemap & | remap,
|  | size_t | numIndexes
| ) |  |

protected

Method for altering indexes based on a remap.

Definition at line 645 of file OgreInstancedGeometry.h.

## reset()

virtual void Ogre::InstancedGeometry::reset | ( | void |  | ) |

virtual

Clears any of the entities / nodes added to this geometry and destroys anything which has already been built.

## setBatchInstanceDimensions()

virtual void Ogre::InstancedGeometry::setBatchInstanceDimensions | ( | const Vector3 & | size | ) |

virtual

Sets the size of a single BatchInstance of geometry.

Remarks
  This method allows you to configure the physical world size of each BatchInstance, so you can balance culling against batch size. Entities will be fitted within the batch they most closely fit, and the eventual bounds of each batch may well be slightly larger than this if they overlap a little. The default is Vector3(1000, 1000, 1000).

Note
  Must be called before 'build'.

Parameters

  size | Vector3 expressing the 3D size of each BatchInstance.

Definition at line 799 of file OgreInstancedGeometry.h.

## setCastShadows()

virtual void Ogre::InstancedGeometry::setCastShadows | ( | bool | castShadows | ) |

virtual

Sets whether this geometry should cast shadows.

Remarks
  No matter what the settings on the original entities, the InstancedGeometry class defaults to not casting shadows. This is because, being static, unless you have moving lights you'd be better to use precalculated shadows of some sort. However, if you need them, you can enable them using this method. If the SceneManager is set up to use stencil shadows, edge lists will be copied from the underlying meshes on build. It is essential that all meshes support stencil shadows in this case.

Note
  If you intend to use stencil shadows, you must set this to true before calling 'build' as well as making sure you set the scene's shadow type (that should always be the first thing you do anyway). You can turn shadows off temporarily but they can never be turned on if they were not at the time of the build.

## setOrigin()

virtual void Ogre::InstancedGeometry::setOrigin | ( | const Vector3 & | origin | ) |

virtual

Sets the origin of the geometry.

Remarks
  This method allows you to configure the world centre of the geometry, thus the place which all BatchInstances surround. You probably don't need to mess with this unless you have a seriously large world, since the default set up can handle an area 1024 * mBatchInstanceDimensions, and the sparseness of population is no issue when it comes to rendering. The default is Vector3(0,0,0).

Note
  Must be called before 'build'.

Parameters

  origin | Vector3 expressing the 3D origin of the geometry.

Definition at line 816 of file OgreInstancedGeometry.h.

## setProvideWorldInverses()

virtual void Ogre::InstancedGeometry::setProvideWorldInverses | ( | bool | flag | ) |

virtual

Remarks
  Allows World Transform Inverse matrices to be passed as shader constants along with the world transform matrix list. Reduces the number of usable geometries in an instance to 40 instead of 80. The inverse matrices are interleaved with the world matrices at n+1.

## setRenderingDistance()

virtual void Ogre::InstancedGeometry::setRenderingDistance | ( | Real | dist | ) |

virtual

Sets the distance at which batches are no longer rendered.

Remarks
  This lets you turn off batches at a given distance. This can be useful for things like detail meshes (grass, foliage etc) and could be combined with a shader which fades the geometry out beforehand to lessen the effect.

Parameters

  dist | Distance beyond which the batches will not be rendered (the default is 0, which means batches are always rendered).

Definition at line 750 of file OgreInstancedGeometry.h.

## setRenderQueueGroup()

virtual void Ogre::InstancedGeometry::setRenderQueueGroup | ( | uint8 | queueID | ) |

virtual

Sets the render queue group this object will be rendered through.

Remarks
  Render queues are grouped to allow you to more tightly control the ordering of rendered objects. If you do not call this method, all objects default to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for most objects. You may want to alter this if you want to perform more complex rendering.

  See RenderQueue for more details.

Parameters

  queueID | Enumerated value of the queue group to use.

## setVisible()

virtual void Ogre::InstancedGeometry::setVisible | ( | bool | visible | ) |

virtual

Hides or shows all the batches.

## splitGeometry()

void Ogre::InstancedGeometry::splitGeometry | ( | VertexData * | vd,
|  | IndexData * | id,
|  | SubMeshLodGeometryLink * | targetGeomLink
| ) |  |

protected

Split some shared geometry into dedicated geometry.

## visitRenderables()

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.

Parameters

  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.

## Member Data Documentation

## mAnimationState

AnimationStateSet* Ogre::InstancedGeometry::mAnimationState

protected

This is the main animation state.

All "objects" in the batch will use an instance of this animation state

Definition at line 569 of file OgreInstancedGeometry.h.

## mBaseSkeleton

SkeletonPtr Ogre::InstancedGeometry::mBaseSkeleton

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 564 of file OgreInstancedGeometry.h.

## mBatchInstanceDimensions

Vector3 Ogre::InstancedGeometry::mBatchInstanceDimensions

protected

Definition at line 547 of file OgreInstancedGeometry.h.

## mBatchInstanceMap

BatchInstanceMap Ogre::InstancedGeometry::mBatchInstanceMap

protected

Map of BatchInstances.

Definition at line 581 of file OgreInstancedGeometry.h.

## mBuilt

bool Ogre::InstancedGeometry::mBuilt

protected

Definition at line 543 of file OgreInstancedGeometry.h.

## mCastShadows

bool Ogre::InstancedGeometry::mCastShadows

protected

Definition at line 546 of file OgreInstancedGeometry.h.

## mHalfBatchInstanceDimensions

Vector3 Ogre::InstancedGeometry::mHalfBatchInstanceDimensions

protected

Definition at line 548 of file OgreInstancedGeometry.h.

## mInstancedGeometryInstance

BatchInstance* Ogre::InstancedGeometry::mInstancedGeometryInstance

protected

Definition at line 560 of file OgreInstancedGeometry.h.

## mName

String Ogre::InstancedGeometry::mName

protected

Definition at line 542 of file OgreInstancedGeometry.h.

## mObjectCount

unsigned int Ogre::InstancedGeometry::mObjectCount

protected

number of objects in the batch

Definition at line 558 of file OgreInstancedGeometry.h.

## mOptimisedSubMeshGeometryList

OptimisedSubMeshGeometryList Ogre::InstancedGeometry::mOptimisedSubMeshGeometryList

protected

List of geometry which has been optimised for SubMesh use This is the primary storage used for cleaning up later.

Definition at line 572 of file OgreInstancedGeometry.h.

## mOrigin

Vector3 Ogre::InstancedGeometry::mOrigin

protected

Definition at line 549 of file OgreInstancedGeometry.h.

## mOwner

SceneManager* Ogre::InstancedGeometry::mOwner

protected

Definition at line 541 of file OgreInstancedGeometry.h.

## mProvideWorldInverses

bool Ogre::InstancedGeometry::mProvideWorldInverses

protected

Flags to indicate whether the World Transform Inverse matrices are passed to the shaders.

Definition at line 552 of file OgreInstancedGeometry.h.

## mQueuedSubMeshes

QueuedSubMeshList Ogre::InstancedGeometry::mQueuedSubMeshes

protected

Definition at line 559 of file OgreInstancedGeometry.h.

## mRenderOps

RenderOperationVector Ogre::InstancedGeometry::mRenderOps

protected

This vector stores all the renderOperation used in the batch.

See the type definition for more details.

Definition at line 585 of file OgreInstancedGeometry.h.

## mRenderQueueID

uint8 Ogre::InstancedGeometry::mRenderQueueID

protected

The render queue to use when rendering this object.

Definition at line 554 of file OgreInstancedGeometry.h.

## mRenderQueueIDSet

bool Ogre::InstancedGeometry::mRenderQueueIDSet

protected

Flags whether the RenderQueue's default should be used.

Definition at line 556 of file OgreInstancedGeometry.h.

## mSkeletonInstance

SkeletonInstance* Ogre::InstancedGeometry::mSkeletonInstance

protected

Definition at line 565 of file OgreInstancedGeometry.h.

## mSquaredUpperDistance

Real Ogre::InstancedGeometry::mSquaredUpperDistance

protected

Definition at line 545 of file OgreInstancedGeometry.h.

## mSubMeshGeometryLookup

SubMeshGeometryLookup Ogre::InstancedGeometry::mSubMeshGeometryLookup

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 578 of file OgreInstancedGeometry.h.

## mUpperDistance

Real Ogre::InstancedGeometry::mUpperDistance

protected

Definition at line 544 of file OgreInstancedGeometry.h.

## mVisible

bool Ogre::InstancedGeometry::mVisible

protected

Definition at line 550 of file OgreInstancedGeometry.h.

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

- OgreInstancedGeometry.h

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.