本文整理汇总了C++中ogre::scenenode::ObjectIterator::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectIterator::getNext方法的具体用法?C++ ObjectIterator::getNext怎么用?C++ ObjectIterator::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::scenenode::ObjectIterator
的用法示例。
在下文中一共展示了ObjectIterator::getNext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: SceneNodeExplore
void CSaveSceneView::SceneNodeExplore(Ogre::SceneNode *SceneNode)
{
Ogre::Entity *Entity = NULL;
Ogre::Camera *Camera = NULL;
Ogre::Light *Light = NULL;
Ogre::ParticleSystem *ParticleSystem = NULL;
Ogre::ManualObject *ManualObject = NULL;
Ogre::BillboardSet *BillboardSet = NULL;
xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "SceneNode");
Ogre::String SceneNodeName = SceneNode->getName();
xmlTextWriterWriteAttribute(m_XmlWriter,
BAD_CAST "SceneNodeName",
BAD_CAST SceneNodeName.c_str());
Ogre::SceneNode::ObjectIterator obji = SceneNode->getAttachedObjectIterator();
while (obji.hasMoreElements())
{
Ogre::MovableObject* mobj = obji.getNext();
Ogre::String Type = mobj->getMovableType();
if (Type == "Entity")
{
Entity = (Ogre::Entity *)(mobj);
Ogre::String EntityName = Entity->getName();
xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "Entity");
xmlTextWriterWriteAttribute(m_XmlWriter,
BAD_CAST "EntityName",
BAD_CAST EntityName.c_str());
Ogre::MeshPtr Mesh = Entity->getMesh();
Ogre::String MeshName = Mesh->getName();
xmlTextWriterWriteAttribute(m_XmlWriter,
BAD_CAST "MeshName",
BAD_CAST MeshName.c_str());
xmlTextWriterEndElement(m_XmlWriter);
}
if (Type == "Camera")
{
Camera = (Ogre::Camera *)(mobj);
Ogre::String CameraName = Camera->getName();
xmlTextWriterStartElement(m_XmlWriter, BAD_CAST "Camera");
xmlTextWriterWriteAttribute(m_XmlWriter,
BAD_CAST "CameraName",
BAD_CAST CameraName.c_str());
Ogre::Vector3 CameraPosition = Camera->getPosition();
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "XPosition",
"%f",CameraPosition.x);
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "YPosition",
"%f",CameraPosition.y);
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "ZPosition",
"%f",CameraPosition.z);
Ogre::Vector3 CameraDirection = Camera->getDirection();
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "XDirection",
"%f",CameraDirection.x);
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "YDirection",
"%f",CameraDirection.y);
xmlTextWriterWriteFormatAttribute(m_XmlWriter,
BAD_CAST "ZDirection",
"%f",CameraDirection.z);
xmlTextWriterEndElement(m_XmlWriter);
}
if (Type == "Light")
{
Light = (Ogre::Light *)(mobj);
}
if (Type == "ParticleSystem")
{
ParticleSystem = (Ogre::ParticleSystem *)(mobj);
}
if (Type == "ManualObject")
{
ManualObject = (Ogre::ManualObject *)(mobj);
}
if (Type == "BillboardSet")
{
BillboardSet = (Ogre::BillboardSet *)(mobj);
}
}
//.........这里部分代码省略.........
开发者ID:southerlies,项目名称:OGRE-3D-1.7-Application-Development-Cookbook-Code,代码行数:101,代码来源:SaveSceneView.cpp