本文整理汇总了C++中ogre::SceneNode::detachObject方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::detachObject方法的具体用法?C++ SceneNode::detachObject怎么用?C++ SceneNode::detachObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::detachObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void Replicator::update(float value)
{
//logFile << getFrequentcyRange() << " :\t " << value << "\n";
Ogre::Vector3 currentScale = getScale();
this->setThreshold(0.7*this->getThreshold() + 0.4*value);
float result = value / this->getThreshold();
int numOfChildrenToGenerate = result > 1.0 ? (result - value) * 2 : 0;
//logFile << value / this->getThreashold() << "\t" << (result - value) * 10 << "\t" << numOfChildrenToGenerate << "\n";
for ( int i = 0; i < numOfChildrenToGenerate; i++ ) {
createChildren(numOfChildrenToGenerate);
}
for(std::vector<Ogre::Entity*>::size_type i = 0; i < children.size(); ) {
Ogre::SceneNode* childNode = children[i]->getParentSceneNode();
Ogre::Real res = childNode->getScale().length();
if ( res < 0.1 ) {
children[i]->setVisible(false);
childNode->setVisible(false);
childNode->detachObject(children[i]->getName());
_sceneManager->destroyEntity(children[i]->getName());
// entity is now destroyed, don't try to use the pointer anymore!
// optionally destroy node
_sceneManager->destroySceneNode(childNode->getName());
children.erase( children.begin() + i );
} else {
Ogre::Vector3 currScale = childNode->getScale();
childNode->setScale(Ogre::Vector3(currScale.x - currScale.x/3, currScale.y - currScale.y/3, currScale.z - currScale.z/3));
i++;
}
}
}
示例2: _DestroyFakeNode
void CFakeObjectEntityManager::_DestroyFakeNode(FakeObject& obj)
{
//销毁摄像机
CEngineInterface::GetMe()->GetFairySystem()->getSceneManager()->destroyCamera(obj.pCamera);
//销毁ViewPort
if(!obj.ptrRenderTexture.isNull() && obj.ptrRenderTexture->getBuffer()->getRenderTarget())
{
obj.ptrRenderTexture->getBuffer()->getRenderTarget()->removeAllViewports();
}
//销毁RenderTexture
obj.ptrRenderTexture.setNull();
Ogre::TextureManager::getSingleton().remove(
Ogre::String(obj.strName) + "_RenderTexture");
//销毁Rectangle2D
if (obj.pRectange)
{
Ogre::SceneNode* parentNode = obj.pRectange->getParentSceneNode();
if (parentNode)
{
parentNode->detachObject(obj.pRectange);
// 摧毁Rectangle2D所挂接的scene node
if (parentNode->getParentSceneNode())
parentNode->getParentSceneNode()->removeAndDestroyChild(parentNode->getName());
}
delete obj.pRectange;
obj.pRectange = NULL;
}
}
示例3: DetachLight
void EC_OgreLight::DetachLight()
{
if ((placeable_) && (attached_))
{
EC_OgrePlaceable* placeable = checked_static_cast<EC_OgrePlaceable*>(placeable_.get());
Ogre::SceneNode* node = placeable->GetSceneNode();
node->detachObject(light_);
attached_ = false;
}
}
示例4: DetachEntity
void EC_OgreCustomObject::DetachEntity()
{
if ((placeable_) && (attached_) && (entity_))
{
EC_Placeable* placeable = checked_static_cast<EC_Placeable*>(placeable_.get());
Ogre::SceneNode* node = placeable->GetSceneNode();
node->detachObject(entity_);
attached_ = false;
}
}
示例5: DetachCamera
void EC_OgreCamera::DetachCamera()
{
if ((!attached_) || (!camera_) || (!placeable_))
return;
EC_OgrePlaceable* placeable = checked_static_cast<EC_OgrePlaceable*>(placeable_.get());
Ogre::SceneNode* node = placeable->GetSceneNode();
node->detachObject(camera_);
attached_ = false;
}
示例6: _destroyBillboardSet
//---------------------------------------------------------------------
void BillboardSetElement::_destroyBillboardSet(void)
{
if (mBillboardSet)
{
Ogre::SceneNode* parent = mBillboardSet->getParentSceneNode();
assert(parent);
Ogre::SceneManager* creator = parent->getCreator();
assert(creator);
parent->detachObject(mBillboardSet->getName());
creator->destroyBillboardSet(mBillboardSet);
}
}
示例7: destroyProjectile
void ProjectileManager::destroyProjectile(Projectile* projectile){
Ogre::SceneNode* snParticle = projectile->particleSn;
Ogre::ParticleSystem* particleSys = static_cast<Ogre::ParticleSystem*>(snParticle->getAttachedObject(0));
// Detach the entity from the scene node
snParticle->detachObject(particleSys);
// Delete the entity and the scene node
mSceneMgr->destroyParticleSystem(particleSys);
mSceneMgr->destroySceneNode(snParticle);
delete projectile;
}
示例8: destroyExplosion
void ProjectileManager::destroyExplosion(Explosion* explosion){
Ogre::SceneNode* snParticle = explosion->snExplosion;
Ogre::ParticleSystem* particleSys = static_cast<Ogre::ParticleSystem*>(snParticle->getAttachedObject(0));
// Detach the entity from the scene node
snParticle->detachObject(particleSys);
// Delete the entity and the scene node
mSceneMgr->destroyParticleSystem(particleSys);
mSceneMgr->destroySceneNode(snParticle);
delete explosion;
}
示例9: _destroySkeletonEntity
void VLogicModel::_destroySkeletonEntity()
{
if (mSkeletonEntity)
{
Ogre::SceneNode *node = mSkeletonEntity->getParentSceneNode();
if (node && node == mSkeletonEntity->getParentNode())
{
node->detachObject(mSkeletonEntity);
}
VLogicModelManager::instance()._destroySkeletalEntity(mSkeletonEntity);
mSkeletonEntity = VNULL;
}
}
示例10: RemoveAttachmentMesh
void EC_Mesh::RemoveAttachmentMesh(uint index)
{
if (renderer_.expired())
return;
RendererPtr renderer = renderer_.lock();
if (!entity_)
return;
if (index >= attachment_entities_.size())
return;
Ogre::SceneManager* scene_mgr = renderer->GetSceneManager();
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]);
scene_mgr->destroySceneNode(scenenode);
}
}
attachment_nodes_[index] = 0;
}
if (attachment_entities_[index])
{
if (attachment_entities_[index]->sharesSkeletonInstance())
attachment_entities_[index]->stopSharingSkeletonInstance();
scene_mgr->destroyEntity(attachment_entities_[index]);
attachment_entities_[index] = 0;
}
}
示例11: setVisible
void RenderComponentBillboardSet::setVisible(bool visible)
{
Ogre::SceneNode * pSceneNode;
pSceneNode=getParent()->getPositionalComponent()->getSceneNode();
if(visible)
{
if(!mBillboardSet->isAttached())
{
pSceneNode->attachObject(mBillboardSet);
}
}
else
{
if(mBillboardSet->isAttached() && mBillboardSet->getParentSceneNode()->getName().compare(pSceneNode->getName())==0)
{
pSceneNode->detachObject(mBillboardSet->getName());
}
}
}
示例12: modifyMesh
//-----------------------------------------------------------------------
void MeshParticleVisualData::modifyMesh(const String &meshName)
{
// destroy old entity
assert(mEntity);
Ogre::SceneNode* parent = mEntity->getParentSceneNode();
assert(parent);
Ogre::SceneManager* creator = parent->getCreator();
assert(creator);
parent->detachObject(mEntity->getName());
creator->destroyMovableObject(mEntity);
mEntity = NULL;
// create new entity
mEntity = creator->createEntity( mSceneNode->getName(), meshName );
assert (mEntity);
mSceneNode->attachObject(mEntity);
}
示例13:
void
OgreCameraSystem::update(int) {
for (EntityId entityId : m_impl->m_entities.removedEntities()) {
Ogre::Camera* camera = m_impl->m_cameras[entityId];
if (camera) {
Ogre::SceneNode* sceneNode = camera->getParentSceneNode();
sceneNode->detachObject(camera);
m_impl->m_sceneManager->destroyCamera(camera);
}
m_impl->m_cameras.erase(entityId);
}
for (auto& value : m_impl->m_entities.addedEntities()) {
EntityId entityId = value.first;
OgreSceneNodeComponent* sceneNodeComponent = std::get<0>(value.second);
OgreCameraComponent* cameraComponent = std::get<1>(value.second);
Ogre::Camera* camera = m_impl->m_sceneManager->createCamera(
cameraComponent->name()
);
camera->setAutoAspectRatio(true);
cameraComponent->m_camera = camera;
m_impl->m_cameras[entityId] = camera;
sceneNodeComponent->m_sceneNode->attachObject(camera);
}
m_impl->m_entities.clearChanges();
for (auto& value : m_impl->m_entities) {
OgreCameraComponent* cameraComponent = std::get<1>(value.second);
auto& properties = cameraComponent->m_properties;
if (properties.hasChanges()) {
Ogre::Camera* camera = cameraComponent->m_camera;
// Update camera
camera->setPolygonMode(properties.polygonMode);
camera->setFOVy(properties.fovY);
camera->setNearClipDistance(properties.nearClipDistance);
camera->setFarClipDistance(properties.farClipDistance);
// Untouch
properties.untouch();
}
}
}
示例14:
//!
//! Removes the OGRE entity containing the mesh geometry from the scene and
//! destroys it along with the OGRE scene node.
//!
void Model2SceneNode::destroyEntity ()
{
if (m_entity) {
// delete entity container
if (m_entityContainer) {
delete m_entityContainer;
m_entityContainer = 0;
}
// remove the entity from the scene node it is attached to
Ogre::SceneNode *parentSceneNode = m_entity->getParentSceneNode();
if (parentSceneNode)
parentSceneNode->detachObject(m_entity);
// destroy the entity through its scene manager
Ogre::SceneManager *sceneManager = OgreManager::getSceneManager();
if (sceneManager) {
sceneManager->destroyEntity(m_entity);
m_entity = 0;
}
}
}
示例15: setShowDebugContactPoints
// -------------------------------------------------------------------------
void CollisionsWorld::setShowDebugContactPoints(bool show)
{
if (show && !mShowDebugContactPoints)
{
assert (mDebugContactPoints == 0);
mDebugContactPoints = new DebugLines();
getSceneManager()->getRootSceneNode ()->createChildSceneNode ("DebugContactPoints")->attachObject (mDebugContactPoints);
mShowDebugContactPoints = true;
return;
}
if (!show && mShowDebugContactPoints)
{
assert (mDebugContactPoints != 0);
Ogre::SceneNode * n = (Ogre::SceneNode *)getSceneManager()->getRootSceneNode ()->getChild ("DebugContactPoints");
n->detachObject (mDebugContactPoints);
n->getParentSceneNode()->removeAndDestroyChild("DebugContactPoints");
delete mDebugContactPoints;
mDebugContactPoints = 0;
mShowDebugContactPoints = false;
return;
}
}