本文整理汇总了C++中ogre::MovableObject::_getManager方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::_getManager方法的具体用法?C++ MovableObject::_getManager怎么用?C++ MovableObject::_getManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::MovableObject
的用法示例。
在下文中一共展示了MovableObject::_getManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
//------------------------------------------------------------
/*static*/ void SceneFactoryInterface::destroySceneNodeAndObjects(Ogre::SceneNode *&osn)
{
if( osn == 0 )return;
unsigned short objectCount = osn->numAttachedObjects();
for( unsigned short i = 0; i < objectCount; ++i )
{
Ogre::MovableObject* obj = osn->detachObject(i);
obj->_getManager()->destroyMovableObject(obj);
}
Ogre::Node::ChildNodeIterator iter = osn->getChildIterator();
while( iter.hasMoreElements() )
{
Ogre::SceneNode* node = static_cast< Ogre::SceneNode* >( iter.getNext() );
destroySceneNodeAndObjects(node);
}
osn->removeAndDestroyAllChildren();
osn->getCreator()->destroySceneNode(osn);
osn = 0;
}
示例2: deepDeleteSceneNode
//!
//! Deletes a whole scene node tree (including attached objects).
//!
//! \param sceneNode The scene node containing the tree to delete.
//! \param sceneManager The scene manager to use for destroying the scene node.
//! \param deleteRoot Flag to control whether to delete the given scene node.
//!
void OgreTools::deepDeleteSceneNode ( Ogre::SceneNode *sceneNode, Ogre::SceneManager *sceneManager /* = 0 */, bool deleteRoot /* = false */ )
{
// make sure the given scene node is valid
if (!sceneNode) {
Log::error("The given scene node is invalid.", "OgreTools::deepDeleteSceneNode");
return;
}
// make sure a valid scene manager is available
if (!sceneManager)
sceneManager = sceneNode->getCreator();
if (!sceneManager) {
Log::error("No valid scene manager available.", "OgreTools::deepDeleteSceneNode");
return;
}
// iterate over the list of attached objects
Ogre::SceneNode::ObjectIterator objectIterator = sceneNode->getAttachedObjectIterator();
while (objectIterator.hasMoreElements()) {
Ogre::MovableObject *movableObject = objectIterator.getNext();
sceneNode->detachObject(movableObject);
Ogre::SceneManager *movableSceneManager = movableObject->_getManager();
if (!movableSceneManager) {
Log::error("The Ogre scene manager could not be obtained.", "OgreTools::deepDeleteSceneNode");
return;
}
Ogre::Any customData = movableObject->getUserAny();
if (!customData.isEmpty()) {
OgreContainer *ogreContainer = Ogre::any_cast<OgreContainer *>(customData);
if (ogreContainer) {
delete ogreContainer;
ogreContainer = 0;
}
}
movableSceneManager->destroyMovableObject(movableObject);
}
// iterate over the list of child nodes
Ogre::SceneNode::ChildNodeIterator childNodeIterator = sceneNode->getChildIterator();
while (childNodeIterator.hasMoreElements()) {
Ogre::SceneNode *childSceneNode = dynamic_cast<Ogre::SceneNode *>(childNodeIterator.getNext());
if (childSceneNode) {
Ogre::Any customData = childSceneNode->getUserAny();
if (!customData.isEmpty()) {
OgreContainer *ogreContainer = Ogre::any_cast<OgreContainer *>(customData);
if (ogreContainer) {
delete ogreContainer;
ogreContainer = 0;
} else {
CameraInfo *cameraInfo = Ogre::any_cast<CameraInfo *>(customData);
if (cameraInfo) {
delete cameraInfo;
cameraInfo = 0;
}
}
}
deepDeleteSceneNode(childSceneNode, sceneManager);
}
}
// destroy all child nodes of the given scene node
sceneNode->removeAndDestroyAllChildren();
// check if the given scene node should be destroyed as well
if (deleteRoot) {
Ogre::Any customData = sceneNode->getUserAny();
if (!customData.isEmpty()) {
OgreContainer *ogreContainer = Ogre::any_cast<OgreContainer *>(customData);
if (ogreContainer) {
delete ogreContainer;
ogreContainer = 0;
} else {
CameraInfo *cameraInfo = Ogre::any_cast<CameraInfo *>(customData);
if (cameraInfo) {
delete cameraInfo;
cameraInfo = 0;
}
}
}
sceneManager->destroySceneNode(sceneNode);
}
}