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

Method destroySceneNode

OgreMain/src/OgreSceneManager.cpp:895–944  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

893 }
894 //-----------------------------------------------------------------------
895 void SceneManager::destroySceneNode( SceneNode *sn )
896 {
897 if( sn->mGlobalIndex >= mSceneNodes.size() ||
898 sn != *( mSceneNodes.begin() + static_cast<ptrdiff_t>( sn->mGlobalIndex ) ) )
899 {
900 OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR,
901 "SceneNode ID: " + StringConverter::toString( sn->getId() ) + ", named '" +
902 sn->getName() +
903 "' had it's mGlobalIndex out of date!!! (or the SceneNode wasn't "
904 "created with this SceneManager)",
905 "SceneManager::destroySceneNode" );
906 }
907
908 {
909 // For any scene nodes which are tracking this node
910 // (or if this node is a tracker), remove its entry.
911 AutoTrackingSceneNodeVec::iterator itor = mAutoTrackingSceneNodes.begin();
912 AutoTrackingSceneNodeVec::iterator endt = mAutoTrackingSceneNodes.end();
913
914 while( itor != endt )
915 {
916 if( itor->source == sn || itor->target == sn )
917 {
918 itor = efficientVectorRemove( mAutoTrackingSceneNodes, itor );
919 endt = mAutoTrackingSceneNodes.end();
920 }
921 else
922 {
923 ++itor;
924 }
925 }
926 }
927
928 SceneNodeList::iterator itor = mSceneNodes.begin() + static_cast<ptrdiff_t>( sn->mGlobalIndex );
929
930 // detach from parent (don't do this in destructor since bulk destruction
931 // behaves differently)
932 Node *parentNode = sn->getParent();
933 if( parentNode )
934 {
935 parentNode->removeChild( sn );
936 }
937 itor = efficientVectorRemove( mSceneNodes, itor );
938 OGRE_DELETE sn;
939 sn = 0;
940
941 // The node that was at the end got swapped and has now a different index
942 if( itor != mSceneNodes.end() )
943 ( *itor )->mGlobalIndex = static_cast<size_t>( itor - mSceneNodes.begin() );
944 }
945 //-----------------------------------------------------------------------
946 SceneNode *SceneManager::getRootSceneNode( SceneMemoryMgrTypes sceneType )
947 {

Callers 5

~PageMethod · 0.80
importSceneMethod · 0.80
removeAndDestroyChildMethod · 0.80
~CompositorShadowNodeMethod · 0.80

Calls 9

efficientVectorRemoveFunction · 0.85
getIdMethod · 0.80
toStringFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45
getNameMethod · 0.45
endMethod · 0.45
getParentMethod · 0.45
removeChildMethod · 0.45

Tested by

no test coverage detected