MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / destroyAllMovableObjectsByType

Method destroyAllMovableObjectsByType

OgreMain/src/OgreSceneManager.cpp:4111–4149  ·  view source on GitHub ↗

---------------------------------------------------------------------

Source from the content-addressed store, hash-verified

4109 }
4110 //---------------------------------------------------------------------
4111 void SceneManager::destroyAllMovableObjectsByType( const String &typeName )
4112 {
4113 // Nasty hack to make generalised Camera functions work without breaking add-on SMs
4114 if( typeName == "Camera" )
4115 {
4116 destroyAllCameras();
4117 return;
4118 }
4119 MovableObjectCollection *objectMap = getMovableObjectCollection( typeName );
4120 MovableObjectFactory *factory = Root::getSingleton().getMovableObjectFactory( typeName );
4121
4122 {
4123 OGRE_LOCK_MUTEX( objectMap->mutex );
4124 MovableObjectVec::iterator itor = objectMap->movableObjects.begin();
4125 MovableObjectVec::iterator endt = objectMap->movableObjects.end();
4126 while( itor != endt )
4127 {
4128 if( ( *itor )->_getManager() == this )
4129 {
4130 // Only destroy our own
4131 MovableObject *mo = *itor;
4132 itor = efficientVectorRemove( objectMap->movableObjects, itor );
4133 endt = objectMap->movableObjects.end();
4134 factory->destroyInstance( mo );
4135
4136 // The node that was at the end got swapped and has now a different index
4137 if( itor != endt )
4138 {
4139 ( *itor )->mGlobalIndex =
4140 static_cast<size_t>( itor - objectMap->movableObjects.begin() );
4141 }
4142 }
4143 else
4144 {
4145 ++itor;
4146 }
4147 }
4148 }
4149 }
4150 //---------------------------------------------------------------------
4151 void SceneManager::destroyAllMovableObjects()
4152 {

Callers

nothing calls this directly

Calls 5

efficientVectorRemoveFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
destroyInstanceMethod · 0.45

Tested by

no test coverage detected