本文整理汇总了C++中ogre::SceneManager::destroyEntity方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneManager::destroyEntity方法的具体用法?C++ SceneManager::destroyEntity怎么用?C++ SceneManager::destroyEntity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneManager
的用法示例。
在下文中一共展示了SceneManager::destroyEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveMesh
void EC_Mesh::RemoveMesh()
{
OgreWorldPtr world = world_.lock();
if (entity_)
{
emit MeshAboutToBeDestroyed();
RemoveAllAttachments();
DetachEntity();
Ogre::SceneManager* sceneMgr = world->OgreSceneManager();
sceneMgr->destroyEntity(entity_);
entity_ = 0;
}
if (!cloned_mesh_name_.empty())
{
try
{
Ogre::MeshManager::getSingleton().remove(cloned_mesh_name_);
}
catch(Ogre::Exception& e)
{
LogWarning("EC_Mesh::RemoveMesh: Could not remove cloned mesh:" + std::string(e.what()));
}
cloned_mesh_name_ = std::string();
}
}
示例2:
GameplayScreen::~GameplayScreen()
{
//Destroy our game objects
delete mWhacker;
for(unsigned int i=0; i<mDragons.size(); i++)
{
delete mDragons[i];
}
//Destroy all entities created
Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager");
mSceneManager->destroyEntity("Stage");
//Remove the stage mesh
mStageNode->removeAndDestroyAllChildren();
mStageNode->getParentSceneNode()->removeAndDestroyChild(mStageNode->getName());
//Destroy our score overlay
//To do this, we must traverse all elements contained within
//the overlay and remove them one at a time.
Ogre::OverlayManager* overlayMgr = Ogre::OverlayManager::getSingletonPtr();
Ogre::Overlay::Overlay2DElementsIterator iter = mOverlay->get2DElementsIterator();
for(;iter.hasMoreElements();)
{
Ogre::OverlayContainer * childContainer = iter.getNext();
Ogre::OverlayContainer::ChildIterator contIter = childContainer->getChildIterator();
for(;contIter.hasMoreElements();)
{
Ogre::OverlayElement* curElement = contIter.getNext();
overlayMgr->destroyOverlayElement(curElement->getName());
}
overlayMgr->destroyOverlayElement(childContainer->getName());
}
overlayMgr->destroy(mOverlay->getName());
}
示例3: doDisable
void Obstacle::doDisable()
{
Ogre::SceneManager* sm = OgreGraphicsManager::getSingleton().getSceneManager();
_node->detachObject(_entity);
sm->destroySceneNode(_node);
sm->destroyEntity(_entity);
}
示例4: loadMesh
//-------------------------------------------------------------------------------------------
void MagickWidget::loadMesh(Ogre::MeshPtr pMesh)
{
QString directory(OgitorsRoot::getSingletonPtr()->GetProjectOptions()->ProjectDir.c_str());
if(directory.isEmpty())
directory = "./";
QDir(directory).mkpath("entitycache");
Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().createManual( "MeshMagickTex",
Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_2D,
512, 512, 0, Ogre::PF_R8G8B8A8 , Ogre::TU_RENDERTARGET );
Ogre::RenderTexture *rttTex = texture->getBuffer()->getRenderTarget();
Ogre::SceneManager *mSceneMgr = Ogre::Root::getSingletonPtr()->createSceneManager("OctreeSceneManager", "MeshMagickTexMgr");
Ogre::Light *dirl = mSceneMgr->createLight("DisplayLight");
dirl->setDirection(-1,-1,-1);
dirl->setDiffuseColour(1,1,1);
dirl->setType(Ogre::Light::LT_DIRECTIONAL);
Ogre::Camera* RTTCam = mSceneMgr->createCamera("MeshMagickCam");
RTTCam->setNearClipDistance(0.01F);
RTTCam->setFarClipDistance(0);
RTTCam->setAspectRatio(1);
RTTCam->setFOVy(Ogre::Degree(90));
RTTCam->setPosition(0,0,1);
RTTCam->lookAt(0,0,0);
Ogre::Viewport *v = rttTex->addViewport( RTTCam );
v->setClearEveryFrame( true );
v->setBackgroundColour(Ogre::ColourValue(0,0,0));
Ogre::Entity *mEntity;
mEntity = mSceneMgr->createEntity("scbDisplay", pMesh->getName());
mSceneMgr->getRootSceneNode()->attachObject(mEntity);
Ogre::Vector3 vSize = mEntity->getBoundingBox().getHalfSize();
Ogre::Vector3 vCenter = mEntity->getBoundingBox().getCenter();
vSize += Ogre::Vector3(vSize.z, vSize.z, vSize.z);
float maxsize = std::max(std::max(vSize.x,vSize.y),vSize.z);
vSize = Ogre::Vector3(0, 0, maxsize * 1.15f) + vCenter;
RTTCam->setPosition(vSize.x,vSize.y,vSize.z);
RTTCam->lookAt(vCenter.x,vCenter.y,vCenter.z);
rttTex->update();
Ogre::String imagefile = OgitorsUtils::QualifyPath(directory.toStdString() + "/entitycache/meshmagick.png");
rttTex->writeContentsToFile(imagefile);
mEntity->detachFromParent();
mSceneMgr->destroyEntity(mEntity);
rttTex->removeAllViewports();
Ogre::Root::getSingletonPtr()->destroySceneManager(mSceneMgr);
mDisplayWidget->setImage(QString(imagefile.c_str()));
}
示例5:
Dragon::~Dragon()
{
//We only remove OGRE objects that were created in the Dragon class.
//The CollidableObject base class will take care of the rest
Ogre::SceneManager* mSceneManager = Ogre::Root::getSingletonPtr()->getSceneManager("ApplicationSceneManager");
mSceneManager->destroyEntity(mEntity->getName());
mSceneManager->destroyParticleSystem(mParticleSystem->getName());
mSceneNode->removeAndDestroyChild(mParticleNode->getName());
}
示例6: _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();
}
示例7: unloadEntity
void OgreEntityRenderer::unloadEntity()
{
Ogre::SceneNode* node = mTexture->getRenderContext()->getSceneNode();
node->detachAllObjects();
if (mEntity) {
Ogre::SceneManager* scenemgr = mTexture->getRenderContext()->getSceneManager();
scenemgr->destroyEntity(mEntity);
mEntity = nullptr;
}
}
示例8: destroyInvisibleVisual
//-------------------------------------------------------------------
void Vob::destroyInvisibleVisual()
{
if(mInvisibleEntity)
{
SceneNode* sceneNode = mInvisibleEntity->getParentSceneNode();
Ogre::SceneManager* sceneManager = sceneNode->getCreator();
sceneNode->detachObject(mInvisibleEntity);
sceneManager->destroyEntity(mInvisibleEntity);
mInvisibleEntity = nullptr;
}
}
示例9:
AreaEffect::~AreaEffect()
{
delete Ghost;
delete GraphicsSettings;
delete PhysicsSettings;
Ogre::SceneManager* OgreManager = Entresol::GetSingletonPtr()->GetSceneManager()->GetGraphicsWorldPointer();
if(GraphicsObject)
OgreManager->destroyEntity(GraphicsObject);
OgreManager->destroySceneNode(GraphicsNode);
}
示例10: removeEntities
void NpcAnimation::removeEntities(NifOgre::EntityList &entities)
{
assert(&entities != &mEntityList);
Ogre::SceneManager *sceneMgr = mInsert->getCreator();
for(size_t i = 0;i < entities.mEntities.size();i++)
{
entities.mEntities[i]->detachFromParent();
sceneMgr->destroyEntity(entities.mEntities[i]);
}
entities.mEntities.clear();
entities.mSkelBase = NULL;
}
示例11: destroyEntity
//-----------------------------------------------------------------------
void SceneDecoratorExtern::destroyEntity(void)
{
if (mEntity)
{
Ogre::SceneManager* sceneManager = mParentTechnique->getParentSystem()->getSceneManager();
if (sceneManager)
{
sceneManager->destroyEntity(mEntityName);
mEntity = 0;
mEntityName = "";
}
}
}
示例12: RemoveWaterPlane
void EC_WaterPlane::RemoveWaterPlane()
{
// Remove waterplane
if (world_.expired() || !entity_)
return;
DetachEntity();
Ogre::SceneManager* sceneMgr = world_.lock()->GetSceneManager();
sceneMgr->destroyEntity(entity_);
entity_ = 0;
Ogre::MeshManager::getSingleton().remove(Name().toStdString().c_str());
}
示例13:
EC_Clone::~EC_Clone()
{
// OgreRendering module might be already deleted. If so, the cloned entity is also already deleted.
// In this case, just set pointer to 0.
if (!renderer_.expired())
{
Ogre::SceneManager *sceneMgr = renderer_.lock()->GetSceneManager();
if (entityClone_)
sceneMgr->destroyEntity(entityClone_);
}
else
{
entityClone_ = 0;
sceneNode_ = 0;
}
}
示例14:
CollisionModel3D *EditorFrameHandler::GetCollisionModel(const char *modelname)
{
CollisionModel3D *hashres=NULL, *CollisionModel = NULL;
bool bres = CollisionModels.Find(modelname, &hashres);
if (!bres)
{
CollisionModel = newCollisionModel3D(false);
size_t vertex_count,index_count;
Ogre::Vector3* vertices;
unsigned long* indices;
Ogre::SceneManager *SceneMgr = CommonDeclarations::GetSceneManager();
Ogre::Entity *entity = SceneMgr->createEntity("tmpcollis", modelname);
Collidable::getMeshInformation(entity->getMesh().getPointer(),vertex_count,vertices,index_count,indices,Ogre::Vector3(0,0,0),Ogre::Quaternion::IDENTITY,Ogre::Vector3(1,1,1));
SceneMgr->destroyEntity(entity);
size_t index;
int numTris = (int)index_count / 3;
CollisionModel->setTriangleNumber(numTris);
for (unsigned i=0;i<index_count;i+=3)
{
index = indices[i];
CollisionModel->addTriangle(vertices[indices[i+0]].x,vertices[indices[i+0]].y,vertices[indices[i+0]].z,
vertices[indices[i+1]].x,vertices[indices[i+1]].y,vertices[indices[i+1]].z,
vertices[indices[i+2]].x,vertices[indices[i+2]].y,vertices[indices[i+2]].z);
}
CollisionModel->finalize();
delete[] vertices;
delete[] indices;
CollisionModels.Insert(modelname,CollisionModel);
} else
{
CollisionModel = hashres;
}
return CollisionModel;
}
示例15: RemoveAttachmentMesh
void EC_Mesh::RemoveAttachmentMesh(uint index)
{
OgreWorldPtr world = world_.lock();
if (!entity_)
return;
if (index >= attachment_entities_.size())
return;
Ogre::SceneManager* sceneMgr = world->OgreSceneManager();
if (attachment_entities_[index] && attachment_nodes_[index])
{
// See if attached to a tagpoint or an ordinary node
Ogre::TagPoint* tag = dynamic_cast<Ogre::TagPoint*>(attachment_nodes_[index]);
if (tag)
{
entity_->detachObjectFromBone(attachment_entities_[index]);
}
else
{
Ogre::SceneNode* scenenode = dynamic_cast<Ogre::SceneNode*>(attachment_nodes_[index]);
if (scenenode)
{
scenenode->detachObject(attachment_entities_[index]);
sceneMgr->destroySceneNode(scenenode);
}
}
attachment_nodes_[index] = 0;
}
if (attachment_entities_[index])
{
if (attachment_entities_[index]->sharesSkeletonInstance())
attachment_entities_[index]->stopSharingSkeletonInstance();
sceneMgr->destroyEntity(attachment_entities_[index]);
attachment_entities_[index] = 0;
}
}