本文整理汇总了C++中ogre::scenenode::ObjectIterator::hasMoreElements方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectIterator::hasMoreElements方法的具体用法?C++ ObjectIterator::hasMoreElements怎么用?C++ ObjectIterator::hasMoreElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ogre::scenenode::ObjectIterator
的用法示例。
在下文中一共展示了ObjectIterator::hasMoreElements方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetLight
Ogre::Light* LuaScriptUtilities::GetLight(
lua_State* const luaVM, const int stackIndex)
{
Ogre::SceneNode* const node = GetSceneNode(luaVM, stackIndex);
if (node)
{
Ogre::SceneNode::ObjectIterator it = node->getAttachedObjectIterator();
while (it.hasMoreElements())
{
const Ogre::String movableType =
it.current()->second->getMovableType();
if (movableType == Ogre::LightFactory::FACTORY_TYPE_NAME)
{
return static_cast<Ogre::Light*>(it.current()->second);
}
it.getNext();
}
}
return NULL;
}
示例2: _setSkydomeActive
//-----------------------------------------------------------------------------------------
bool CSceneManagerEditor::_setSkydomeActive(OgitorsPropertyBase* property, const bool& value)
{
if(value && mSkyBoxActive->get())
mSkyBoxActive->set(false);
if(value && mSkyDomeMaterial->get() == "")
{
mSystem->DisplayMessageDialog(OTR("You must first define a SkyDome Material!"), DLGTYPE_OK);
return false;
}
if(mHandle)
{
try
{
mHandle->setSkyDome(value ,mSkyDomeMaterial->get());
if(value)
{
Ogre::SceneNode *node = mHandle->getSkyDomeNode();
Ogre::SceneNode::ObjectIterator it = node->getAttachedObjectIterator();
while(it.hasMoreElements())
{
Ogre::MovableObject *object = it.getNext();
object->setVisibilityFlags(0x7F000000);
}
}
}
catch(...)
{
mSystem->DisplayMessageDialog(OTR("The Material supplied is not compatible with Sky Dome!"), DLGTYPE_OK);
return false;
}
}
return true;
}
示例3: UpdateSubNodes
void OLMeshTracker::UpdateSubNodes(Ogre::Node* regionNode, Ogre::Node* node, bool recurse, Ogre::MeshPtr meshP) {
if (recurse && node->numChildren() > 0) {
// if node has more children nodes, visit them recursivily
Ogre::SceneNode::ChildNodeIterator nodeChildIterator = node->getChildIterator();
while (nodeChildIterator.hasMoreElements()) {
Ogre::Node* nodeChild = nodeChildIterator.getNext();
// 'false' causes it to not visit sub-children which are included in parent and pos relative to parent
UpdateSubNodes(regionNode, nodeChild, true, meshP);
}
}
// children taken care of... check for attached objects to this node
Ogre::SceneNode* snode = (Ogre::SceneNode*)node;
Ogre::SceneNode::ObjectIterator snodeObjectIterator = snode->getAttachedObjectIterator();
while (snodeObjectIterator.hasMoreElements()) {
Ogre::MovableObject* snodeObject = snodeObjectIterator.getNext();
if (snodeObject->getMovableType() == "Entity") {
Ogre::Entity* snodeEntity = (Ogre::Entity*)snodeObject;
Ogre::MeshPtr entityMesh = snodeEntity->getMesh();
if (entityMesh == meshP) {
snode->needUpdate(true);
// LG::Log("OLMeshTracker::UpdateSubNodes: setting node update for %s", snode->getName().c_str());
}
}
}
return;
}
示例4: ValidPlacement
bool CombatSetupWnd::ValidPlacement(Ship* ship, const Ogre::Vector3& point) const {
bool retval = false;
std::size_t i = GroupIndexOfShip(m_setup_groups, ship);
if (i != m_setup_groups.size()) {
const CombatSetupGroup& group = m_setup_groups[i];
retval = !group.m_allow;
for (std::size_t j = 0; j < group.m_regions.size(); ++j) {
double point_d[2] = { point.x, point.y };
if (PointInRegion(point_d, group.m_regions[j])) {
retval = !retval;
break;
}
}
}
if (retval) {
// verify that this placement is not too near to other ships
for (std::map<int, Ogre::SceneNode*>::const_iterator it = m_placed_nodes.begin();
it != m_placed_nodes.end();
++it) {
Ship* this_ship = *Ogre::any_cast<Ship*>(&it->second->getUserAny());
if (this_ship == ship)
continue;
Ogre::SceneNode::ObjectIterator iterator = it->second->getAttachedObjectIterator();
assert(iterator.hasMoreElements());
const Ogre::Sphere& sphere =
boost::polymorphic_downcast<Ogre::Entity*>(iterator.getNext())->getWorldBoundingSphere();
if (sphere.intersects(point)) {
retval = false;
break;
}
}
}
return retval;
}
示例5: NodeMaterial
//=============================================================================
// NodeMaterialOrig
//=============================================================================
NodeMaterialOrig::NodeMaterialOrig( Ogre::SceneNode* sceneNode )
: NodeMaterial(),
_sceneNode( sceneNode )
{
for( Ogre::SceneNode::ObjectIterator it = sceneNode->getAttachedObjectIterator() ;
it.hasMoreElements() ;
it.moveNext() )
{
Ogre::MovableObject * currentMO = it.peekNextValue() ;
if ( currentMO->getMovableType() == Ogre::EntityFactory::FACTORY_TYPE_NAME )
{
//OMTRACEID( "DEBUG", "Create entity " << currentMO->getName() ) ;
_entities[ it.peekNextKey() ] = new EntityMaterialOrig( static_cast< Ogre::Entity *> ( currentMO ) ) ;
}
}
for( Ogre::Node::ChildNodeIterator it = sceneNode->getChildIterator() ;
it.hasMoreElements() ;
it.moveNext() )
{
Ogre::SceneNode* childSceneNode = static_cast< Ogre::SceneNode* >( it.peekNextValue() ) ;
//OMTRACEID( "DEBUG", "Create ChildSceneNode " << childSceneNode->getName() ) ;
NodeMaterialOrig* child = new NodeMaterialOrig( childSceneNode ) ;
_childs.push_back( child ) ;
}
}
示例6: MergeBounds
void MergeBounds(Ogre::SceneNode* node, Ogre::SceneNode* rootNode,
const Ogre::Matrix4& parentTransform, Ogre::AxisAlignedBox& aabb)
{
// Get this nodes current transform
Ogre::Matrix4 currentTransform = parentTransform;
if (node != rootNode)
{
Ogre::Matrix4 localTransform(node->getOrientation());
localTransform.setTrans(node->getPosition());
currentTransform = currentTransform * localTransform;
}
// Merge this nodes objects
Ogre::SceneNode::ObjectIterator object = node->getAttachedObjectIterator();
while (object.hasMoreElements())
{
Ogre::AxisAlignedBox localAABB = object.getNext()->getBoundingBox();
localAABB.transform(currentTransform);
aabb.merge(localAABB);
}
// Iterate through all children and call this function on them
Ogre::SceneNode::ChildNodeIterator child = node->getChildIterator();
while (child.hasMoreElements())
{
MergeBounds(static_cast<Ogre::SceneNode*>(child.getNext()), rootNode, currentTransform, aabb);
}
}
示例7: extractAnimations
/** @brief get all the crusaders animations and stick em in the vector for easier reference
*/
void Animation::extractAnimations(Ogre::SceneNode* a_scene_node)
{
// get animation states from all entities
for (size_t i = 0; i < num_of_animations; ++i) {
Ogre::SceneNode::ObjectIterator it = a_scene_node->getAttachedObjectIterator();
while (it.hasMoreElements()) {
// get the mesh attached to the scene node
Ogre::Entity* anim_entity = static_cast<Ogre::Entity*>(it.getNext());
// safeguard for ommited anims
if (NULL != anim_entity->getAllAnimationStates()) {
// stick the animation state in the array later indexed by animation type enum
Animations[i].push_back(anim_entity->getAnimationState(animation_names[i]));
// reset the animation
Animations[i].back()->setTimePosition(0);
if (i == CurrentAnim) {
Animations[i].back()->setEnabled(true);
}
}
}
}
// recurse into child scene nodes
Ogre::SceneNode::ChildNodeIterator it2 = a_scene_node->getChildIterator();
while (it2.hasMoreElements()) {
extractAnimations(static_cast<Ogre::SceneNode*>(it2.getNext()));
}
}
示例8: findFirstObject
//!
//! Returns the first movable object of the given type name contained in
//! the given scene node.
//!
//! \param sceneNode The scene node to find the first object in.
//! \param typeName The name of the type of objects to look for.
//! \return The first movable object of the given type name contained in the given scene node.
//!
Ogre::MovableObject * OgreTools::findFirstObject ( Ogre::SceneNode *sceneNode, const QString &typeName )
{
// make sure the given scene node is valid
if (!sceneNode) {
Log::error("The given scene node is invalid.", "OgreTools::findFirstObject");
return 0;
}
// iterate over the list of attached objects
Ogre::SceneNode::ObjectIterator objectIterator = sceneNode->getAttachedObjectIterator();
while (objectIterator.hasMoreElements()) {
Ogre::MovableObject *movableObject = objectIterator.getNext();
if (movableObject && QString::compare(movableObject->getMovableType().c_str(), typeName) == 0)
return movableObject;
}
// iterate over the list of child nodes
Ogre::SceneNode::ChildNodeIterator childIter = sceneNode->getChildIterator();
while( childIter.hasMoreElements() ) {
Ogre::SceneNode *childSceneNode = (Ogre::SceneNode *) childIter.getNext();
return findFirstObject(childSceneNode, typeName);
}
return 0;
}
示例9: changeState
void CObject::changeState(EEntityStateTypes eState) {
switch (m_uiType) {
case OBJECT_GREEN_BUSH:
case OBJECT_LIGHT_STONE:
if (eState == EST_LIFTED) {
btRigidBody *pRB = btRigidBody::upcast(this->getCollisionObject());
ASSERT(pRB);
m_pMap->getPhysicsManager()->getWorld()->removeCollisionObject(pRB);
m_pMap->getPhysicsManager()->getWorld()->addRigidBody(pRB, COL_DAMAGE_P, MASK_DAMAGE_P_COLLIDES_WITH);
// Entities now cast shadows
Ogre::SceneNode::ObjectIterator itObject = this->getSceneNode()->getAttachedObjectIterator();
while (itObject.hasMoreElements()) {
Ogre::MovableObject* pObject = static_cast<Ogre::MovableObject*>(itObject.getNext());
pObject->setCastShadows(true);
}
}
else if (eState == EST_THROWN) {
btRigidBody *pRB = btRigidBody::upcast(this->getCollisionObject());
ASSERT(pRB);
pRB->setLinearFactor(btVector3(1, 1, 1));
pRB->setAngularFactor(0);
pRB->activate();
}
break;
}
CWorldEntity::changeState(eState);
}
示例10: World
CDebugDraw::CDebugDraw( Ogre::SceneManager* Scene, btDynamicsWorld* World )
: World( World ), IsActive( true )
{
// generate a unit sphere
std::size_t CircleSubdivs = 12;
UnitCircle.reserve( CircleSubdivs+1 );
for ( std::size_t i = 0; i < CircleSubdivs; ++i )
{
float Angle = (M_PI * 2.f * i) / CircleSubdivs;
UnitCircle.push_back( Ogre::Vector2( std::cos( Angle ), std::sin( Angle ) ) );
}
UnitCircle.push_back( UnitCircle.front() );
// setup rendering properties
DebugLineDrawer = new CDynamicLineDrawer();
if ( !Scene->hasSceneNode("DebugDrawer") )
DebugDrawerNode = Scene->getRootSceneNode()->createChildSceneNode("DebugDrawer");
else
{
DebugDrawerNode = Scene->getSceneNode("DebugDrawer");
Ogre::SceneNode::ObjectIterator Iter = DebugDrawerNode->getAttachedObjectIterator();
while( Iter.hasMoreElements() )
Scene->destroyEntity( dynamic_cast<Ogre::Entity*>( Iter.getNext() ) );
}
DebugDrawerNode->attachObject( DebugLineDrawer );
DebugLineDrawer->setMaterial("DebugLines");
World->setDebugDrawer( this );
}
示例11: setAnchor
void CameraMan::setAnchor(Ogre::SceneNode* anchor, Ogre::Vector3 offset,
bool hideAnchor)
{
// Clear previous anchor
if (mAnchor)
{
// Show all objects in anchor node
Ogre::SceneNode::ObjectIterator it =
mAnchor->getParentSceneNode()->getAttachedObjectIterator();
while (it.hasMoreElements())
{
it.getNext()->setVisible(true);
}
Ogre::Vector3 position = mCamera->getRealPosition();
Ogre::Quaternion orientation = mCamera->getRealOrientation();
mAnchor->detachObject(mCamera);
mAnchor->getParentSceneNode()->removeAndDestroyChild("CameraManAnchor");
mAnchor = NULL;
mCamera->setPosition(position);
mCamera->setOrientation(orientation);
}
if (anchor)
{
// Hide all objects in anchor node
Ogre::SceneNode::ObjectIterator it =
anchor->getAttachedObjectIterator();
if (hideAnchor)
{
while (it.hasMoreElements())
{
it.getNext()->setVisible(false);
}
}
// Create anchor
mAnchor = anchor->createChildSceneNode("CameraManAnchor");
// if(mCamera->getParentSceneNode())
// mCamera->getParentSceneNode()->detachObject(mCamera);
mAnchor->attachObject(mCamera);
mAnchor->setInheritOrientation(false);
mCamera->setPosition(offset);
}
}
示例12: setCastShadows
void Actor::setCastShadows(bool hasShadows)
{
assert(mNode);
Ogre::SceneNode::ObjectIterator it = mNode->getAttachedObjectIterator();
while(it.hasMoreElements())
{
Ogre::MovableObject* obj = static_cast<Ogre::MovableObject*>(it.getNext());
obj->setCastShadows(hasShadows);
}
}
示例13: deleteEntity
void MiniMapManager::deleteEntity(Ogre::SceneNode* node)
{
Ogre::SceneNode::ObjectIterator itObject = node->getAttachedObjectIterator();
while ( itObject.hasMoreElements() )
{
Ogre::MovableObject* pObject = static_cast<Ogre::MovableObject*>(itObject.getNext());
node->getCreator()->destroyMovableObject( pObject );
}
node->removeAndDestroyAllChildren();
mSceneMgr->destroySceneNode(node);
}
示例14: deepCopySceneNode
//!
//! Creates a deep copy of the given scene node.
//!
//! \param sceneNode The scene node to copy.
//! \param sceneNodeCopy The scene node to add the copied objects to (will be created if 0).
//! \param namePrefix The prefix to use for names of copied objects.
//! \param sceneManager The scene manager to use for creating the object.
//!
void OgreTools::deepCopySceneNode ( Ogre::SceneNode *sceneNode, Ogre::SceneNode *&sceneNodeCopy, const QString &namePrefix, Ogre::SceneManager *sceneManager /* = 0 */ )
{
// make sure the given scene node is valid
if (!sceneNode) {
Log::error("The given scene node is invalid.", "OgreTools::deepCopySceneNode");
return;
}
// make sure a valid scene manager is available
if (!sceneManager)
sceneManager = sceneNode->getCreator();
if (!sceneManager) {
Log::error("No valid scene manager available.", "OgreTools::deepCopySceneNode");
return;
}
// create the target scene node if it doesn't exist yet
if (!sceneNodeCopy) {
QString sceneNodeCopyName = QString("%1_%2Copy").arg(namePrefix).arg(sceneNode->getName().c_str());
sceneNodeCopy = copySceneNode(sceneNode, sceneNodeCopyName, sceneManager);
if (!sceneNodeCopy) {
Log::error("The scene node could not be copied.", "OgreTools::deepCopySceneNode");
return;
}
}
// iterate over the list of attached objects
Ogre::SceneNode::ObjectIterator objectIterator = sceneNode->getAttachedObjectIterator();
while (objectIterator.hasMoreElements()) {
Ogre::MovableObject *movableObject = objectIterator.getNext();
if (movableObject) {
QString entityCopyName = QString("%1_%2Copy").arg(namePrefix).arg(movableObject->getName().c_str());
Ogre::MovableObject *movableObjectCopy = cloneMovableObject(movableObject, entityCopyName, sceneManager);
if (movableObjectCopy)
sceneNodeCopy->attachObject(movableObjectCopy);
}
}
// iterate over the list of child nodes
Ogre::SceneNode::ChildNodeIterator childNodeIterator = sceneNode->getChildIterator();
while (childNodeIterator.hasMoreElements() ) {
Ogre::SceneNode *childSceneNode = (Ogre::SceneNode *) childNodeIterator.getNext();
QString childSceneNodeCopyName = QString("%1_%2Copy").arg(namePrefix).arg(childSceneNode->getName().c_str());
Ogre::SceneNode *childSceneNodeCopy = copySceneNode(childSceneNode, childSceneNodeCopyName, sceneManager);
if (childSceneNodeCopy) {
sceneNodeCopy->addChild(childSceneNodeCopy);
deepCopySceneNode(childSceneNode, childSceneNodeCopy, namePrefix, sceneManager);
}
}
}
示例15: isVisible
bool Actor::isVisible() const
{
assert(mNode);
Ogre::SceneNode::ObjectIterator it = mNode->getAttachedObjectIterator();
while(it.hasMoreElements())
{
Ogre::MovableObject* obj = static_cast<Ogre::MovableObject*>(it.getNext());
if(!obj->isVisible())
{
return false;
}
}
return true;
}