本文整理汇总了C++中ogre::SceneNode::getParentSceneNode方法的典型用法代码示例。如果您正苦于以下问题:C++ SceneNode::getParentSceneNode方法的具体用法?C++ SceneNode::getParentSceneNode怎么用?C++ SceneNode::getParentSceneNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::SceneNode
的用法示例。
在下文中一共展示了SceneNode::getParentSceneNode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mouseSelect
void OgreWidget::mouseSelect(QPoint const & pos, bool multiple)
{
/*
Apercu de ce que pourrait donner d'une selection par volume.
Ogre::Real x = pos.x() / (float)width();
Ogre::Real y = pos.y() / (float)height();
Ogre::Ray ray = m_camera->getCamera()->getCameraToViewportRay(x, y);
Ogre::RaySceneQuery * query = m_sceneManager->createRayQuery(ray);
Ogre::RaySceneQueryResult & queryResult = query->execute();
Ogre::RaySceneQueryResult::iterator queryResultIterator = queryResult.begin();
Ogre::PlaneBoundedVolume volume = m_camera->getCameraToViewportBoxVolume();
Ogre::PlaneBoundedVolumeListSceneQuery * query = m_sceneManager->createPlaneBoundedVolumeQuery(volume);
Ogre::SceneQueryResult & queryResult = query->execute();*/
Ogre::Entity * selectedEntity = m_selectionBuffer->OnSelectionClick(pos.x(), pos.y());
if (selectedEntity)
{
Ogre::SceneNode * node = selectedEntity->getParentSceneNode();
while (node->getParentSceneNode() != m_sceneManager->getRootSceneNode())
node = node->getParentSceneNode();
selectItem(Ogre::any_cast<InstItem *>(node->getUserObjectBindings().getUserAny()), multiple);
}
else
unselectItem();
}
示例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:
void
RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &cur)
{
Ogre::SceneNode *child =
mRendering.getScene()->getSceneNode(old.getRefData().getHandle());
Ogre::SceneNode *parent = child->getParentSceneNode();
parent->removeChild(child);
if (old.getClass().isActor()) {
mActors->updateObjectCell(old, cur);
} else {
mObjects->updateObjectCell(old, cur);
}
}
示例4:
void OGRE3DPointRenderable::removeSceneNode(const Ogre::String& name)
{
if (mRenderSystem->getSceneManager()->hasSceneNode(name) == false)
return;
Ogre::SceneNode* node = mRenderSystem->getSceneManager()->getSceneNode(name);
Ogre::SceneNode* pnode = node->getParentSceneNode();
if (pnode == 0)
return;
if (pnode == mNode)
pnode->removeChild(node);
}
示例5: destroyBox
void SelectionHandler::destroyBox(const std::pair<CollObjectHandle, uint64_t>& handles)
{
M_HandleToBox::iterator it = boxes_.find(handles);
if (it != boxes_.end())
{
Ogre::SceneNode* node = it->second.first;
Ogre::WireBoundingBox* box = it->second.second;
node->detachAllObjects();
node->getParentSceneNode()->removeAndDestroyChild(node->getName());
delete box;
boxes_.erase(it);
}
}
示例6: 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;
}
}
示例7: 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;
}
}
示例8: update
void LightningManager::update(const Ogre::Real& timeSinceLastFrame)
{
if (!mCreated)
{
return;
}
if (mEnabled)
{
mRemainingTime -= timeSinceLastFrame;
if (mRemainingTime <= 0)
{
mRemainingTime = Ogre::Math::RangeRandom(0, 2*mAverageLightningApparitionTime);
// Select a random camera to place the lightning
if (!mVClouds->_getCamerasData().empty())
{
Ogre::Camera* c = mVClouds->_getCamerasData().at(mVClouds->_getCamerasData().size()*0.999).camera;
Ogre::Real prob = Ogre::Math::RangeRandom(0,1);
// Cloud-to-ground
if (prob < 0.5)
{
addLightning(
// Ray position
Ogre::Vector3(c->getDerivedPosition().x + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5), mVClouds->getGeometrySettings().Height.x + 0.2*mVClouds->getGeometrySettings().Height.y, c->getDerivedPosition().z + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5)),
// Ray direction
Ogre::Vector3(0,-1,0),
// Ray length
mVClouds->getGeometrySettings().Height.x + 0.1*mVClouds->getGeometrySettings().Height.y);
}
// Cloud-to-cloud
else if (prob < 0.7)
{
addLightning(
// Ray position
Ogre::Vector3(c->getDerivedPosition().x + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5), mVClouds->getGeometrySettings().Height.x + 0.2*mVClouds->getGeometrySettings().Height.y, c->getDerivedPosition().z + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5)),
// Ray direction
Ogre::Vector3(Ogre::Math::RangeRandom(-1,1),Ogre::Math::RangeRandom(-0.1,0.1),Ogre::Math::RangeRandom(-1,1)).normalisedCopy(),
// Ray length
Ogre::Math::RangeRandom(0.5,1.5f)*0.2*mVClouds->getGeometrySettings().Height.y);
}
// Cloud-to-ground + cloud-to-cloud
else
{
addLightning(
// Ray position
Ogre::Vector3(c->getDerivedPosition().x + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5), mVClouds->getGeometrySettings().Height.x + 0.2*mVClouds->getGeometrySettings().Height.y, c->getDerivedPosition().z + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5)),
// Ray direction
Ogre::Vector3(0,-1,0),
// Ray length
mVClouds->getGeometrySettings().Height.x + 0.1*mVClouds->getGeometrySettings().Height.y);
addLightning(
// Ray position
Ogre::Vector3(c->getDerivedPosition().x + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5), mVClouds->getGeometrySettings().Height.x + 0.2*mVClouds->getGeometrySettings().Height.y, c->getDerivedPosition().z + Ogre::Math::RangeRandom(-c->getFarClipDistance()*0.5,c->getFarClipDistance()*0.5)/Ogre::Math::RangeRandom(1,5)),
// Ray direction
Ogre::Vector3(Ogre::Math::RangeRandom(-1,1),Ogre::Math::RangeRandom(-0.1,0.1),Ogre::Math::RangeRandom(-1,1)).normalisedCopy(),
// Ray length
Ogre::Math::RangeRandom(0.5,1.5f)*0.2*mVClouds->getGeometrySettings().Height.y);
}
updateMaterial();
}
}
}
for(std::vector<Lightning*>::iterator it = mLightnings.begin(); it != mLightnings.end();)
{
if ((*it)->isFinished())
{
Ogre::SceneNode* sn = (*it)->getSceneNode();
delete (*it);
it = mLightnings.erase(it);
// Remove the associated scene node
for(std::vector<Ogre::SceneNode*>::iterator it2 = mSceneNodes.begin(); it2 != mSceneNodes.end(); it2++)
{
if ((*it2) == sn)
{
sn->getParentSceneNode()->removeAndDestroyChild(sn);
mSceneNodes.erase(it2);
break;
}
}
}
else
{
(*it)->update(timeSinceLastFrame);
it++;
}
}
}