本文整理汇总了C++中ogre::SceneNode::removeAndDestroyAllChildren方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::removeAndDestroyAllChildren方法的具体用法?C++ SceneNode::removeAndDestroyAllChildren怎么用?C++ SceneNode::removeAndDestroyAllChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::removeAndDestroyAllChildren方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeCell
void Objects::removeCell(MWWorld::Ptr::CellStore* store)
{
if(mCellSceneNodes.find(store) != mCellSceneNodes.end())
{
Ogre::SceneNode* base = mCellSceneNodes[store];
for (int i=0; i<base->numChildren(); ++i)
clearSceneNode (static_cast<Ogre::SceneNode *> (base->getChild (i)));
base->removeAndDestroyAllChildren();
mCellSceneNodes.erase(store);
mRenderer.getScene()->destroySceneNode(base);
base = 0;
}
if(mStaticGeometry.find(store) != mStaticGeometry.end())
{
Ogre::StaticGeometry* sg = mStaticGeometry[store];
mStaticGeometry.erase(store);
mRenderer.getScene()->destroyStaticGeometry (sg);
sg = 0;
}
if(mStaticGeometrySmall.find(store) != mStaticGeometrySmall.end())
{
Ogre::StaticGeometry* sg = mStaticGeometrySmall[store];
mStaticGeometrySmall.erase(store);
mRenderer.getScene()->destroyStaticGeometry (sg);
sg = 0;
}
if(mBounds.find(store) != mBounds.end())
mBounds.erase(store);
}
示例2: allocateTexts
void FootstepDisplay::allocateTexts(size_t num) {
if (num > texts_.size()) {
// need to allocate
for (size_t i = texts_.size(); i < num; i++) {
// create nodes
Ogre::SceneNode* node = scene_node_->createChildSceneNode();
rviz::MovableText* text
= new rviz::MovableText("not initialized", "Arial", 0.05);
text->setVisible(false);
text->setTextAlignment(rviz::MovableText::H_CENTER,
rviz::MovableText::V_ABOVE);
node->attachObject(text);
texts_.push_back(text);
text_nodes_.push_back(node);
}
}
else if (num < texts_.size()) {
for (int i = texts_.size() - 1; i >= (int)num; i--) {
Ogre::SceneNode* node = text_nodes_[i];
node->detachAllObjects();
node->removeAndDestroyAllChildren();
scene_manager_->destroySceneNode(node);
}
text_nodes_.resize(num);
texts_.resize(num);
}
}
示例3:
SnapToMovement::~SnapToMovement()
{
for (std::vector<Ogre::SceneNode*>::iterator I = mDebugNodes.begin(); I != mDebugNodes.end(); ++I) {
Ogre::SceneNode* node = *I;
node->removeAndDestroyAllChildren();
mSceneManager.destroySceneNode(node);
}
}
示例4: deleteObject
void InteriorCellRender::deleteObject (const std::string& handle)
{
if (!handle.empty())
{
Ogre::SceneNode *node = scene.getMgr()->getSceneNode (handle);
node->removeAndDestroyAllChildren();
scene.getMgr()->destroySceneNode (node);
}
}
示例5: removeNode
void GraphicsImpl::removeNode(int ID)
{
Ogre::SceneNode* node = nodes[ID];
if (node->getParent() != NULL) {
node->getParent()->removeChild(node);
}
node->removeAndDestroyAllChildren();
delete node;
nodes.erase(ID);
}
示例6: deleteChunk
void ChunkManager::deleteChunk(int chunk_x, int chunk_y, int chunk_z) {
if (!hasChunkAtChunkCoords(chunk_x, chunk_y, chunk_z)) {
// Don't do anything if we don't have a chunk there.
return;
}
//TODO: serialize the chunk before deletion
Chunk* chunk = mChunks[chunk_x][chunk_y][chunk_z];
mGame->getDynamicsWorld()->removeRigidBody(chunk->mRigidBody);
Ogre::SceneNode* sceneNode = chunk->mSceneNode;
sceneNode->removeAndDestroyAllChildren();
mGame->destroySceneNode(sceneNode);
delete chunk;
}
示例7:
FootstepDisplay::~FootstepDisplay()
{
delete alpha_property_;
delete width_property_;
delete height_property_;
delete depth_property_;
delete show_name_property_;
delete use_group_coloring_property_;
delete line_;
// remove all the nodes
for (size_t i = 0; i < text_nodes_.size(); i++) {
Ogre::SceneNode* node = text_nodes_[i];
node->removeAndDestroyAllChildren();
node->detachAllObjects();
scene_manager_->destroySceneNode(node);
}
}
示例8: removeCell
void Actors::removeCell(MWWorld::Ptr::CellStore* store){
if(mCellSceneNodes.find(store) != mCellSceneNodes.end())
{
Ogre::SceneNode* base = mCellSceneNodes[store];
base->removeAndDestroyAllChildren();
mCellSceneNodes.erase(store);
mRend.getScene()->destroySceneNode(base);
base = 0;
}
for(std::map<MWWorld::Ptr, Animation*>::iterator iter = mAllActors.begin(); iter != mAllActors.end(); )
{
if(iter->first.getCell() == store){
delete iter->second;
mAllActors.erase(iter++);
}
else
++iter;
}
}
示例9: printf
TowerTemporal::~TowerTemporal(void)
{
printf("~TowerTemporal\n");
if (mpShotGraphics)
{
// Remove from scene node
Ogre::SceneNode* node = mpShotGraphics->getParentSceneNode();
if (node)
{
node->removeAndDestroyAllChildren();
node->getParentSceneNode()->removeChild(node);
mpsSceneMgr->destroySceneNode(node);
node = NULL;
}
// Destroy shot graphics
mpsSceneMgr->destroyManualObject(mpShotGraphics);
mpShotGraphics = NULL;
}
}
示例10: removeCell
void Actors::removeCell(MWWorld::Ptr::CellStore* store)
{
for(PtrAnimationMap::iterator iter = mAllActors.begin();iter != mAllActors.end();)
{
if(iter->first.getCell() == store)
{
delete iter->second;
mAllActors.erase(iter++);
}
else
++iter;
}
CellSceneNodeMap::iterator celliter = mCellSceneNodes.find(store);
if(celliter != mCellSceneNodes.end())
{
Ogre::SceneNode *base = celliter->second;
base->removeAndDestroyAllChildren();
mRend.getScene()->destroySceneNode(base);
mCellSceneNodes.erase(celliter);
}
}
示例11: 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
//.........这里部分代码省略.........
示例12: WinMain
//.........这里部分代码省略.........
// This is often use to change the general feeling of a whole scene.
Ogre::ColourValue lAmbientColour(0.1f, 0.7f, 0.3f, 0.3f);
lFirstPass->setAmbient(lAmbientColour);
// specular colour, is the colour of the 'little light reflection'
// that you can see on some object. For example, my bald head skin
// reflect the sun. This make a 'round of specular lighting'.
// Set this to black if you don't want to see it.
Ogre::ColourValue lSpecularColour(0.2f, 1.0f, 0.6f, 0.6f);
lFirstPass->setSpecular(lSpecularColour);
// Shininess is the 'inverse of specular color splattering' coefficient.
// If this is big (e.g : 64) you get a very tiny dot with a quite strong color (on round surface).
// If this is 0, you get a simple color layer (the dot has become very wide).
Ogre::Real lShininess = 34.0f;
lFirstPass->setShininess(lShininess);
}
//end material tests
//System Creator
std::string systemDefinition[10] = {"15000,0,0,false,false,false,700000,0", "300,0,0,false,false,barren,2500,1",
"300,x,y,false,co2,barren,6000,2", "300,x,y,h2o,n2/o2,gaia,6300,3", "300,x,y,false,co2,mars,3400,4",
"300,x,y,false,h2/he,gasgiant,71000,5", "300,x,y,false,h2/he,gasgiant,60000,6", "300,x,y,false,h2/he,gasgiant,25001,7",
"300,x,y,false,h2/he,gasgiant,25000,8", "300,x,y,false,n-ice,ice,1100,9"};
StarSystem sol = StarSystem::StarSystem(sceneMgr, systemDefinition);
//Star Creator
/*
{
int x = 0;
int y = 0;
int kelvin = 15000;
CelestialBody newstar = CelestialBody::CelestialBody(kelvin, 100, systemNode, sceneMgr, x, y);
}
// Spectrum testing and multi star generation.
int time = 200;
int x = -500;
int y = 500;
for ( int count = 1; count <= time; count++){
int kelvin = count * (40000/time);
Star newstar = Star::Star(kelvin, 100, systemNode, sceneMgr, x, y);
x += 20;
if (count % 10 == 0) {
y -= 20;
x = -500;
}
}
*/
// I move the SceneNode back 15 so that it is visible to the camera.
float PositionOffset = 0.0;
float distance = -2000.0;
systemNode->translate(0, PositionOffset, distance);
camera->lookAt(Ogre::Vector3(0,0,distance));
while (sim->getCurrentState() != SHUTDOWN) {
sol.rotateOrbits();
handler->capture();
ogre->renderOneFrame();
// run the message pump (uncomment for Eihort)
Ogre::WindowEventUtilities::messagePump();
}
{
window->removeAllViewports();
}
{
sceneMgr->destroyAllCameras();
sceneMgr->destroyAllManualObjects();
sceneMgr->destroyAllEntities();
sceneMgr->destroyAllLights();
systemNode->removeAndDestroyAllChildren();
}
{
Ogre::ResourceGroupManager& lRgMgr = Ogre::ResourceGroupManager::getSingleton();
lRgMgr.destroyResourceGroup(lNameOfResourceGroup);
}
// clean up after ourselves
delete pDlg;
delete handler;
delete sim;
delete ogre;
return 0;
}
示例13: frameStarted
/*
* Runs on each frame starts
*/
bool MyFrameListener::frameStarted(const Ogre::FrameEvent& evt) {
_mouse->capture();
MyGUI::InputManager::getInstance().injectMouseMove(_mouse->getMouseState().X.abs,
_mouse->getMouseState().Y.abs,
_mouse->getMouseState().Z.abs);
bool leftMouseclick = false;
bool releaseMouseclick= false;
int mousex = _mouse->getMouseState().X.abs;
int mousey = _mouse->getMouseState().Y.abs;
if ( _mouse->getMouseState().buttonDown(OIS::MB_Left) == true &&
this->_btnIzqPulsado == false){
MyGUI::InputManager::getInstance().injectMousePress(_mouse->getMouseState().X.abs,
_mouse->getMouseState().Y.abs,
MyGUI::MouseButton::Left);
this->_btnIzqPulsado = true;
leftMouseclick = true;
}
if (_mouse->getMouseState().buttonDown(OIS::MB_Left) == false &&
this->_btnIzqPulsado==true ){
this->_btnIzqPulsado =false;
releaseMouseclick = true;
MyGUI::InputManager::getInstance().injectMouseRelease(_mouse->getMouseState().X.abs,
_mouse->getMouseState().Y.abs,
MyGUI::MouseButton::Left);
}
if (_mode == GAME_FINISHED){
if (leftMouseclick){
Ogre::SceneNode *popup = Ogre::Root::getSingleton().
getSceneManager("mainSM")->getSceneNode("popup");
popup->removeAndDestroyAllChildren();
Ogre::Root::getSingleton().getSceneManager("mainSM")->destroySceneNode("popup");
_mode = MODE_STARTED;
if (_points > 0){
_gui->add_record(_user,_points);
_points = 0;
}
_gui->createScene();
_gui->enable();
}
}
if (_mode == MODE_PLACE_SHIP) {
if (leftMouseclick){
this->selectShip();
} else if (releaseMouseclick) {
if (this->_idSelectedShip >= 0) {
this->setSelectedShipGameCoords();
//Check if all ships are placed to start playing
if (this->playerBoard->areAllShipsPlaced() == true) {
_turn = PLAYER_TURN;
_mode = MODE_SHOOT;
this->paintShootingBoard();
}
}
this->_idSelectedShip = -1;
}
/*
* If there is a ship selected, translate drag and drop
*/
if (this->_idSelectedShip >= 0) {
const Ogre::Vector3 &position = this->getMouse3DPoint();
this->playerBoard->getShip(this->_idSelectedShip)
->setShipPosition(position);
}
if ( _mouse->getMouseState().buttonDown(OIS::MB_Right) == true
&& this->_btnDchoPulsado == false) {
this->_btnDchoPulsado = true;
if (this->_idSelectedShip >= 0) {
this->playerBoard->getShip(this->_idSelectedShip)
->rotateShip();
}
}
if (!_mouse->getMouseState().buttonDown(OIS::MB_Right)) {
this->_btnDchoPulsado = false;
}
}
else if (_mode == MODE_SHOOT){
manageShootMode();
}
_keyboard->capture();
_keyboard->setEventCallback(_guiHandler);
//.........这里部分代码省略.........
示例14: frameRenderingQueued
bool TutorialApplication::frameRenderingQueued(const Ogre::FrameEvent& evt) {
if (BaseApplication::frameRenderingQueued(evt)) {
PhysicsManager::reference()->Update(evt.timeSinceLastFrame);
//player->Translate( player->entity()->getParentSceneNode()->getOrientation() * mDirection * evt.timeSinceLastFrame);
player->Move( camera->actual_orientation() * mDirection * (1.0/50.0) );
if (mJoyStick) {
/* For some reason, OIS reports one of my gamepad's axes as a 'slider'(at least in windows)...
Also, joystick event are called only when axis/slider value changes, and since they aren't
continuous, you can stick a axis to one side continuosly but the event will only be called once,
so we need to do this here.
Finally, aparently after moving from the initial state of value 0 the axis rest at [-]256 and not at 0...
*/
OIS::JoyStickState joy = mJoyStick->getJoyStickState();
double yaw = 0;
if ( Ogre::Math::Abs(CAMERA_YAW_VALUE) > 256)
yaw = -150 * evt.timeSinceLastFrame * CAMERA_YAW_VALUE / OIS::JoyStick::MAX_AXIS;
double pitch = 0;
if ( Ogre::Math::Abs(CAMERA_PITCH_VALUE) > 256)
pitch = -150 * evt.timeSinceLastFrame * CAMERA_PITCH_VALUE / OIS::JoyStick::MAX_AXIS;
camera->Rotate(yaw, pitch);
//player->Rotate(pitch*100, yaw*100, 0);
if (joy.mPOV[0].direction == OIS::Pov::North)
camera->SetDistance( camera->GetDistance() - evt.timeSinceLastFrame*2);
else if (joy.mPOV[0].direction == OIS::Pov::South)
camera->SetDistance( camera->GetDistance() + evt.timeSinceLastFrame*2);
}
for (auto& pair: projectiles_) {
Projectile& proj = pair.second;
proj.lifetime -= evt.timeSinceLastFrame;
if (proj.lifetime < 0) {
//objects_.remove(proj.owner);
if (std::find(projs_to_remove_.begin(), projs_to_remove_.end(), pair.first) == projs_to_remove_.end() )
projs_to_remove_.push_back(pair.first);
//delete proj.owner;
}
}
for (auto& name : projs_to_remove_) {
Projectile& proj = projectiles_[name];
objects_.remove(proj.owner);
delete proj.owner;
projectiles_.erase(name);
}
projs_to_remove_.clear();
for (auto& pair: enemies_) {
Enemy& ene = pair.second;
if (ene.owner->entity()->getVisible()) {
ene.timeElapsed += evt.timeSinceLastFrame;
if (ene.timeElapsed > ene.cooldown) {
ene.timeElapsed = 0.0;
evilShot(ene.owner, Ogre::Math::UnitRandom()*70);
}
}
else if (ene.particles != nullptr) {
if (! ene.particles->getEmitter(0)->getEnabled()) {
if (std::find(enemies_to_remove_.begin(), enemies_to_remove_.end(), ene.owner->entity_name()) == enemies_to_remove_.end() )
enemies_to_remove_.push_back(ene.owner->entity_name());
}
}
}
for (auto& name : enemies_to_remove_) {
Enemy& ene = enemies_[name];
objects_.remove(ene.owner);
delete ene.owner;
if (ene.particles != nullptr) {
Ogre::SceneNode* node = ene.particles->getParentSceneNode();
node->removeAndDestroyAllChildren();
mSceneMgr->destroySceneNode(node);
mSceneMgr->destroyParticleSystem(ene.particles);
}
enemies_.erase(name);
}
enemies_to_remove_.clear();
return true;
}
return false;
}