This is the main starting point for the new instancing system. More...
#include <OgreInstanceManager.h>
Classes | |
struct | BatchSettings |
Public Types | |
enum | InstancingTechnique { ShaderBased, TextureVTF, HWInstancingBasic, HWInstancingVTF, InstancingTechniquesCount } |
enum | BatchSettingId { CAST_SHADOWS = 0, SHOW_BOUNDINGBOX, NUM_SETTINGS } |
Values to be used in setSetting() & BatchSettings::setting. More... | |
typedef ConstMapIterator < InstanceBatchMap > | InstanceBatchMapIterator |
typedef ConstVectorIterator < InstanceBatchVec > | InstanceBatchIterator |
Public Member Functions | |
InstanceManager (const String &customName, SceneManager *sceneManager, const String &meshName, const String &groupName, InstancingTechnique instancingTechnique, uint16 instancingFlags, size_t instancesPerBatch, unsigned short subMeshIdx, bool useBoneMatrixLookup=false) | |
virtual | ~InstanceManager () |
const String & | getName () const |
void | setInstancesPerBatch (size_t instancesPerBatch) |
Raises an exception if trying to change it after creating the first InstancedEntity. | |
void | setMaxLookupTableInstances (size_t maxLookupTableInstances) |
Sets the size of the lookup table for techniques supporting bone lookup table. | |
size_t | getMaxOrBestNumInstancesPerBatch (String materialName, size_t suggestedSize, uint16 flags) |
Calculates the maximum (or the best amount, depending on flags) of instances per batch given the suggested size for the technique this manager was created for. | |
InstancedEntity * | createInstancedEntity (const String &materialName) |
void | cleanupEmptyBatches (void) |
This function can be useful to improve CPU speed after having too many instances created, which where now removed, thus freeing many batches with zero used Instanced Entities However the batches aren't automatically removed from memory until the InstanceManager is destroyed, or this function is called. | |
void | defragmentBatches (bool optimizeCulling) |
After creating many entities (which turns in many batches) and then removing entities that are in the middle of these batches, there might be many batches with many free entities. | |
void | setSetting (BatchSettingId id, bool value, const String &materialName=StringUtil::BLANK) |
Applies a setting for all batches using the same material_ existing ones and those that will be created in the future. | |
bool | getSetting (BatchSettingId id, const String &materialName) const |
If settings for the given material didn't exist, default value is returned. | |
bool | hasSettings (const String &materialName) const |
Returns true if settings were already created for the given material name. | |
void | setBatchesAsStaticAndUpdate (bool bStatic) |
void | _addDirtyBatch (InstanceBatch *dirtyBatch) |
Called by an InstanceBatch when it requests their bounds to be updated for proper culling. | |
void | _updateDirtyBatches (void) |
Called by SceneManager when we told it we have at least one dirty batch. | |
InstanceBatchMapIterator | getInstanceBatchMapIterator (void) const |
Get non-updateable iterator over instance batches per material. | |
InstanceBatchIterator | getInstanceBatchIterator (const String &materialName) const |
Get non-updateable iterator over instance batches for given material. | |
void * | operator new (size_t sz, const char *file, int line, const char *func) |
operator new, with debug line info | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *ptr) |
placement operator new | |
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
array operator new, with debug line info | |
void * | operator new[] (size_t sz) |
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 *) |
Private Types | |
typedef vector< InstanceBatch * > ::type | InstanceBatchVec |
typedef map< String, InstanceBatchVec >::type | InstanceBatchMap |
typedef map< String, BatchSettings >::type | BatchSettingsMap |
Private Member Functions | |
InstanceBatch * | getFreeBatch (const String &materialName) |
Finds a batch with at least one free instanced entity we can use. | |
InstanceBatch * | buildNewBatch (const String &materialName, bool firstTime) |
Called when batches are fully exhausted (can't return more instances) so a new batch is created. | |
void | defragmentBatches (bool optimizeCull, vector< InstancedEntity * >::type &entities, InstanceBatchVec &fragmentedBatches) |
void | applySettingToBatches (BatchSettingId id, bool value, const InstanceBatchVec &container) |
Private Attributes | |
const String | mName |
MeshPtr | mMeshReference |
InstanceBatchMap | mInstanceBatches |
size_t | mIdCount |
InstanceBatchVec | mDirtyBatches |
RenderOperation | mSharedRenderOperation |
size_t | mInstancesPerBatch |
InstancingTechnique | mInstancingTechnique |
uint16 | mInstancingFlags |
unsigned short | mSubMeshIdx |
BatchSettingsMap | mBatchSettings |
SceneManager * | mSceneManager |
size_t | mMaxLookupTableInstances |
This is the main starting point for the new instancing system.
Each InstanceManager can control one technique and one mesh, but it can manage multiple materials at the same time.
Definition at line 62 of file OgreInstanceManager.h.
Definition at line 65 of file OgreInstanceManager.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, | |
const char * | , | |||
int | , | |||
const char * | ||||
) | [inherited] |
Definition at line 107 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr, | |
void * | ||||
) | [inherited] |
Definition at line 101 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete | ( | void * | ptr | ) | [inherited] |
Definition at line 95 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr, | |
const char * | , | |||
int | , | |||
const char * | ||||
) | [inherited] |
Definition at line 118 of file OgreMemoryAllocatedObject.h.
void Ogre::AllocatedObject< Alloc >::operator delete[] | ( | void * | ptr | ) | [inherited] |
Definition at line 112 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz, | |
void * | ptr | |||
) | [inherited] |
placement operator new
Definition at line 78 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new | ( | size_t | sz | ) | [inherited] |
Definition at line 72 of file OgreMemoryAllocatedObject.h.
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 67 of file OgreMemoryAllocatedObject.h.
void* Ogre::AllocatedObject< Alloc >::operator new[] | ( | size_t | sz | ) | [inherited] |
Definition at line 90 of file OgreMemoryAllocatedObject.h.
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 85 of file OgreMemoryAllocatedObject.h.
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Fri May 25 23:37:56 2012