本文整理汇总了C++中ogre::SceneNode::removeAndDestroyChild方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::removeAndDestroyChild方法的具体用法?C++ SceneNode::removeAndDestroyChild怎么用?C++ SceneNode::removeAndDestroyChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::removeAndDestroyChild方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _destroyAll
//-----------------------------------------------------------------------
void EntityRenderer::_destroyAll(void)
{
if (!mParentTechnique)
return;
// Delete the visual data
vector<EntityRendererVisualData*>::const_iterator it;
vector<EntityRendererVisualData*>::const_iterator itEnd = mAllVisualData.end();
for (it = mAllVisualData.begin(); it != itEnd; ++it)
{
PU_DELETE_T(*it, EntityRendererVisualData, MEMCATEGORY_SCENE_OBJECTS);
}
mAllVisualData.clear();
mVisualData.clear();
// V1.5: Destroy the created ChildSceneNodes (which leads to detaching the Entities)
if (mParentTechnique->getParentSystem())
{
Ogre::SceneNode* parentNode = mParentTechnique->getParentSystem()->getParentSceneNode();
if (parentNode)
{
String sceneNodeName;
std::stringstream ss;
unsigned short numChilds = parentNode->numChildren();
for (unsigned short i = 0; i < numChilds; ++i)
{
Ogre::Node* node = parentNode->getChild(i);
if (node)
{
Ogre::String name = node->getName();
if (name.find("ParticleUniverse") != Ogre::String::npos)
{
parentNode->removeAndDestroyChild(i);
}
}
}
}
} // V1.5
// Destroy the Entities. Do it like this, because it must be assured that the entity still exists
// and has not already been destroyed.
Ogre::SceneManager* sceneManager = mParentTechnique->getParentSystem()->getSceneManager();
for (size_t i = 0; i < mQuota; i++)
{
if (sceneManager->hasEntity(mEntityName + StringConverter::toString(i)))
{
sceneManager->destroyEntity(mEntityName + StringConverter::toString(i));
}
}
mEntities.clear();
// Reset the visual data in the pool
mParentTechnique->initVisualDataInPool();
}
示例2: destroyDebugPlane
void StereoManager::destroyDebugPlane(void)
{
if(debug_plane_)
{
Ogre::SceneNode *parent = static_cast<Ogre::SceneNode*>(debug_plane_node_->getParent());
parent->removeAndDestroyChild("Stereo/DebugPlaneNode");
debug_plane_node_ = NULL;
sceneMngr_->destroyEntity("Stereo/DebugPlane");
debug_plane_ = NULL;
Ogre::MeshManager::getSingleton().remove("Stereo/Plane");
}
}
示例3: destroyDebugPlane
void StereoManager::destroyDebugPlane(void)
{
if(mDebugPlane)
{
Ogre::SceneNode *parent = static_cast<Ogre::SceneNode*>(mDebugPlaneNode->getParent());
parent->removeAndDestroyChild("Stereo/DebugPlaneNode");
mDebugPlaneNode = NULL;
mSceneMgr->destroyEntity("Stereo/DebugPlane");
mDebugPlane = NULL;
Ogre::MeshManager::getSingleton().remove("Stereo/Plane");
}
}
示例4: RemoveObstacle
void MapManager::RemoveObstacle(MapArea* area, Objects* input)
{
char areaString[30];
sprintf(areaString, "map_area_%d", area->getIndex());
//get the area node from map node.
Ogre::SceneNode* areaNode = (Ogre::SceneNode*)mMapNode->getChild(Ogre::String(areaString));
char cubeString[30];
sprintf(cubeString, "cube_%d", input->index);
Ogre::SceneNode* objectNode = (Ogre::SceneNode*)areaNode->getChild(Ogre::String(cubeString));
objectNode->detachAllObjects();
mSceneMgr->destroyEntity(Ogre::String(cubeString));
//remove the object node from areanode
areaNode->removeAndDestroyChild(Ogre::String(cubeString));
input->mLoaded = false;
//we also need to remove rigid body
std::vector<OgreBulletDynamics::RigidBody*>::iterator rigidBodyIterator;
for(rigidBodyIterator = mRigidBodyList.begin(); rigidBodyIterator != mRigidBodyList.end(); rigidBodyIterator++)
{
//is this the rigid body for this cube?
if((*rigidBodyIterator)->getName().compare("BoxRigid" + Ogre::StringConverter::toString(input->index)))
{
//yes!
//get out of this loop
break;
}
}
//remove it from the physic manager
PhysicManager::getSingletonPtr()->removeRigidBody((*rigidBodyIterator), BODIES_NONE);
//remove from the list
mRigidBodyList.erase(rigidBodyIterator);
mNumEntitiesInstanced--;
}
示例5: _notifyStop
//-----------------------------------------------------------------------
void SceneDecoratorExtern::_notifyStop (void)
{
if (mSubnode && mParentTechnique->getParentSystem())
{
Ogre::SceneNode* sceneNode = mParentTechnique->getParentSystem()->getParentSceneNode();
Ogre::SceneNode::ChildNodeIterator it = sceneNode->getChildIterator();
unsigned int i = 0;
while (it.hasMoreElements())
{
Ogre::SceneNode* child = static_cast<Ogre::SceneNode*>(it.getNext());
if (child == mSubnode)
{
mSubnode->detachAllObjects();
sceneNode->removeAndDestroyChild(i);
mSubnode = 0;
}
++i;
}
destroyEntity();
}
}
示例6: detachFromNode
//-----------------------------------------------------------------------
Ogre::SceneNode* OrthoCameraGizmo::detachFromNode(void)
{
Ogre::SceneNode* parent = 0;
if (mOrthoCameraNodeBox)
{
parent = mOrthoCameraNodeBox->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeBox->getName());
mOrthoCameraNodeBox = 0;
}
if (mOrthoCameraNodeX)
{
parent = mOrthoCameraNodeX->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeX->getName());
mOrthoCameraNodeX = 0;
}
if (mOrthoCameraNodeMinX)
{
parent = mOrthoCameraNodeMinX->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeMinX->getName());
mOrthoCameraNodeMinX = 0;
}
if (mOrthoCameraNodeY)
{
parent = mOrthoCameraNodeY->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeY->getName());
mOrthoCameraNodeY = 0;
}
if (mOrthoCameraNodeZ)
{
parent = mOrthoCameraNodeZ->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeZ->getName());
mOrthoCameraNodeZ = 0;
}
if (mOrthoCameraNodeMinZ)
{
parent = mOrthoCameraNodeMinZ->getParentSceneNode();
parent->removeAndDestroyChild(mOrthoCameraNodeMinZ->getName());
mOrthoCameraNodeMinZ = 0;
}
return parent;
}
示例7: UpdateLoadedList
//update that checks the loaded list for adding or removing objects inside
void MapManager::UpdateLoadedList(std::vector<MapArea*> *input)
{
//run through our current list
//see if there is anything in the list to be updated
std::vector<MapArea*>::iterator loadedIterator;
for(loadedIterator = input->begin(); loadedIterator != input->end(); loadedIterator++)
{
//No matter if the area is fully inside or not, let's check if the area is now outside of the HOLDRADIUS
if(!IsAreaInsideLoadRadius((*loadedIterator)))
{
if(!IsAreaInsideHoldRadius((*loadedIterator)))
{
//now, time to remove the area node
//std::cout << "REMOVING AREA NODE!\n";
char areaString[30];
sprintf(areaString, "map_area_%d", (*loadedIterator)->getIndex());
//get the area node from map node.
Ogre::SceneNode* areaNode = (Ogre::SceneNode*)mMapNode->getChild(Ogre::String(areaString));
//delete ground node
char groundString[30];
sprintf(groundString, "map_area_ground_%d", (*loadedIterator)->getIndex());
Ogre::SceneNode* groundNode = (Ogre::SceneNode*)areaNode->getChild(Ogre::String(groundString));
groundNode->removeAndDestroyAllChildren();
groundNode->detachAllObjects();
areaNode->removeAndDestroyChild(groundString);
areaNode->removeAndDestroyAllChildren();
areaNode->detachAllObjects();
mMapNode->removeAndDestroyChild(areaString);
//set the map area to be unloaded
(*loadedIterator)->setLoaded(false);
//remove it from the list
input->erase(loadedIterator);
return;
}
}
//since this area is not fully inside, lets check if this object is currently inside the scene
std::vector<Objects*>::iterator obstacleIterator;
for(obstacleIterator = (*loadedIterator)->_mObstacleList.begin(); obstacleIterator!=(*loadedIterator)->_mObstacleList.end(); obstacleIterator++)
{
//is this object in the load radius?
if(IsObjectInsideRadius((*obstacleIterator), LOADRADIUS))
{
//yes
//is this object already loaded in the game?
if((*obstacleIterator)->mLoaded)
{
//yes
//skip
continue;
}
else
{
//no
//add it into the game
AddObstacle((*loadedIterator), (*obstacleIterator));
}
}
//is this object out of hold radius?
else if(!IsObjectInsideRadius((*obstacleIterator), HOLDRADIUS))
{
//no
//is this object already loaded in the game?
if((*obstacleIterator)->mLoaded)
{
//yes
//remove it
RemoveObstacle((*loadedIterator),(*obstacleIterator));
}
else
{
//no
//skip
continue;
}
}
}
std::vector<Objects*>::iterator enemyIterator;
for(enemyIterator = (*loadedIterator)->_mEnemySpawnPointList.begin(); enemyIterator!=(*loadedIterator)->_mEnemySpawnPointList.end(); enemyIterator++)
{
//is this object inside the load radius?
if(IsObjectInsideRadius((*enemyIterator), ENEMY_LOADRADIUS))
{
//yes
//is this enemy spawn point already loaded?
if(!(*enemyIterator)->mLoaded)
{
//no
//add enemy
//.........这里部分代码省略.........