本文整理汇总了C++中scenenode::ObjectIterator::hasMoreElements方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectIterator::hasMoreElements方法的具体用法?C++ ObjectIterator::hasMoreElements怎么用?C++ ObjectIterator::hasMoreElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scenenode::ObjectIterator
的用法示例。
在下文中一共展示了ObjectIterator::hasMoreElements方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroyAllAttachedMovableObjects
void ExteriorCellRender::destroyAllAttachedMovableObjects(Ogre::SceneNode* i_pSceneNode)
{
if ( !i_pSceneNode )
{
assert( false );
return;
}
// Destroy all the attached objects
SceneNode::ObjectIterator itObject = i_pSceneNode->getAttachedObjectIterator();
while ( itObject.hasMoreElements() )
{
MovableObject* pObject = static_cast<MovableObject*>(itObject.getNext());
i_pSceneNode->getCreator()->destroyMovableObject( pObject );
}
// Recurse to child SceneNodes
SceneNode::ChildNodeIterator itChild = i_pSceneNode->getChildIterator();
while ( itChild.hasMoreElements() )
{
SceneNode* pChildNode = static_cast<SceneNode*>(itChild.getNext());
destroyAllAttachedMovableObjects( pChildNode );
}
}
示例2: execute
//---------------------------------------------------------------------
void PagingLandScapeOctreePlaneBoundedVolumeListSceneQuery::execute( SceneQueryListener* listener )
{
PlaneBoundedVolumeList::iterator pi, piend;
piend = mVolumes.end( );
for ( pi = mVolumes.begin( ); pi != piend; ++pi )
{
std::list < SceneNode* > list;
//find the nodes that intersect the AAB
static_cast< PagingLandScapeOctreeSceneManager* >( mParentSceneMgr )->findNodesIn( *pi, list, 0 );
//grab all moveables from the node that intersect...
std::list < SceneNode* >::iterator it = list.begin( );
while ( it != list.end( ) )
{
SceneNode::ObjectIterator oit = ( *it )->getAttachedObjectIterator( );
while ( oit.hasMoreElements( ) )
{
MovableObject* m = oit.getNext( );
if ( ( m->getQueryFlags( ) & mQueryMask ) && m->isInScene( ) && ( *pi ).intersects( m->getWorldBoundingBox( ) ) )
{
listener->queryResult( m );
}
}
++it;
}
}
}
示例3: execute
//---------------------------------------------------------------------
void PagingLandScapeOctreeRaySceneQuery::execute( RaySceneQueryListener* listener )
{
std::list < SceneNode* > list;
//find the nodes that intersect the AAB
static_cast< PagingLandScapeOctreeSceneManager* >( mParentSceneMgr )->findNodesIn( mRay, list, 0 );
//grab all movables from the node that intersect...
std::list < SceneNode* >::iterator it = list.begin( );
while ( it != list.end( ) )
{
SceneNode::ObjectIterator oit = ( *it )->getAttachedObjectIterator( );
while ( oit.hasMoreElements( ) )
{
MovableObject* m = oit.getNext( );
if ( ( m->getQueryFlags( ) & mQueryMask ) && m->isInScene( ) )
{
std::pair< bool, Real > result = mRay.intersects( m->getWorldBoundingBox( ) );
if ( result.first )
{
listener->queryResult( m, result.second );
}
}
}
++it;
}
}
示例4: destroyAttachedObjects
void Debugging::destroyAttachedObjects(SceneNode *node)
{
SceneNode::ObjectIterator objIt = node->getAttachedObjectIterator();
while (objIt.hasMoreElements())
{
MovableObject *mesh = static_cast<MovableObject *>(objIt.getNext());
mSceneMgr->destroyMovableObject(mesh);
}
}
示例5: execute
//---------------------------------------------------------------------
void PCZPlaneBoundedVolumeListSceneQuery::execute(SceneQueryListener* listener)
{
std::set<SceneNode*> checkedSceneNodes;
PlaneBoundedVolumeList::iterator pi, piend;
piend = mVolumes.end();
for (pi = mVolumes.begin(); pi != piend; ++pi)
{
PCZSceneNodeList list;
//find the nodes that intersect the Plane bounded Volume
static_cast<PCZSceneManager*>( mParentSceneMgr ) -> findNodesIn( *pi, list, mStartZone, (PCZSceneNode*)mExcludeNode );
//grab all moveables from the node that intersect...
PCZSceneNodeList::iterator it, itend;
itend = list.end();
for (it = list.begin(); it != itend; ++it)
{
// avoid double-check same scene node
if (!checkedSceneNodes.insert(*it).second)
continue;
SceneNode::ObjectIterator oit = (*it) -> getAttachedObjectIterator();
while( oit.hasMoreElements() )
{
MovableObject * m = oit.getNext();
if( (m->getQueryFlags() & mQueryMask) &&
(m->getTypeFlags() & mQueryTypeMask) &&
m->isInScene() &&
(*pi).intersects( m->getWorldBoundingBox() ) )
{
listener -> queryResult( m );
// deal with attached objects, since they are not directly attached to nodes
if (m->getMovableType() == "Entity")
{
Entity* e = static_cast<Entity*>(m);
Entity::ChildObjectListIterator childIt = e->getAttachedObjectIterator();
while(childIt.hasMoreElements())
{
MovableObject* c = childIt.getNext();
if (c->getQueryFlags() & mQueryMask &&
(*pi).intersects( c->getWorldBoundingBox()))
{
listener->queryResult(c);
}
}
}
}
}
}
}//for
// reset startzone and exclude node
mStartZone = 0;
mExcludeNode = 0;
}
示例6:
//---------------------------------------------------------------------
Page::~Page()
{
WorkQueue* wq = Root::getSingleton().getWorkQueue();
wq->removeRequestHandler(mWorkQueueChannel, this);
wq->removeResponseHandler(mWorkQueueChannel, this);
destroyAllContentCollections();
if (mDebugNode)
{
// destroy while we have the chance
SceneNode::ObjectIterator it = mDebugNode->getAttachedObjectIterator();
while(it.hasMoreElements())
mParent->getSceneManager()->destroyMovableObject(it.getNext());
mDebugNode->removeAndDestroyAllChildren();
mParent->getSceneManager()->destroySceneNode(mDebugNode);
mDebugNode = 0;
}
}
示例7: execute
/** Finds any entities that intersect the AAB for the query. */
void OctreeAxisAlignedBoxSceneQuery::execute(SceneQueryListener* listener)
{
std::list< SceneNode * > _list;
//find the nodes that intersect the AAB
static_cast<OctreeSceneManager*>( mParentSceneMgr ) -> findNodesIn( mAABB, _list, 0 );
//grab all moveables from the node that intersect...
std::list< SceneNode * >::iterator it = _list.begin();
while( it != _list.end() )
{
SceneNode::ObjectIterator oit = (*it) -> getAttachedObjectIterator();
while( oit.hasMoreElements() )
{
MovableObject * m = oit.getNext();
if( (m->getQueryFlags() & mQueryMask) &&
(m->getTypeFlags() & mQueryTypeMask) &&
m->isInScene() &&
mAABB.intersects( m->getWorldBoundingBox() ) )
{
listener -> queryResult( m );
// deal with attached objects, since they are not directly attached to nodes
if (m->getMovableType() == "Entity")
{
Entity* e = static_cast<Entity*>(m);
Entity::ChildObjectListIterator childIt = e->getAttachedObjectIterator();
while(childIt.hasMoreElements())
{
MovableObject* c = childIt.getNext();
if (c->getQueryFlags() & mQueryMask)
{
listener->queryResult(c);
}
}
}
}
}
++it;
}
}
示例8: animate
bool KingMovementAnimation::animate(const Real& timeSinceLastFrame)
{
Real distanceMoved = MOVEMENT_SPEED * timeSinceLastFrame;
Vector3 path = mDestination - mAnimatedNode->getPosition();
path.y = 0;
Real verticalVelocity = (path.length() - mHalfTotalDistance) * mFlyingAltitude;
if (path.length() > distanceMoved || mParticleNode)
{
switch (mPhase)
{
case 1:
if (verticalVelocity <= 0)
{
mPhase = 2;
}
break;
case 2:
if (mAttackDuration >= 0)
{
if (!mParticleNode)
{
createBlasts();
mAnimationManager->addAnimation(
AnimationFactory::createDyingAnimation(
mTargetPiece, mSceneMgr, 2, 3));
mAnimationManager->addAnimation(
AnimationFactory::createBleedingAnimation(
mTargetPiece, mSceneMgr, 0.2, 2.5));
mAnimationManager->addAnimation(
AnimationFactory::createBleedingAnimation(
mTargetPiece, mSceneMgr, 0.2, 2, "Effects/Smoke"));
}
distanceMoved = 0;
mAttackDuration -= timeSinceLastFrame;
}
else
{
mPhase = 3;
if (mParticleNode)
{
SceneNode::ObjectIterator itr = mParticleNode->getAttachedObjectIterator();
while (itr.hasMoreElements())
{
MovableObject* object = itr.getNext();
mSceneMgr->destroyMovableObject(object);
}
mAnimatedNode->removeAndDestroyChild(mParticleNode->getName());
mParticleNode = 0;
}
}
break;
}
if (distanceMoved > 0)
{
mAnimatedNode->translate(Vector3(0, verticalVelocity * timeSinceLastFrame, 0));
Vector3 realPath = path;
// Normalising the vector so the speed remains constant.
path.normalise();
mAnimatedNode->translate(path * distanceMoved);
mAnimatedNode->resetOrientation();
Vector3 src = Vector3::UNIT_Z;
mAnimatedNode->rotate(src.getRotationTo(path));
if (mTargetPiece)
{
Real pitch = realPath.length() * 45 / mHalfTotalDistance;
if (mPhase == 1)
{
pitch = 90 - pitch;
}
mAnimatedNode->pitch(Degree(pitch));
}
mAnimatedNode->yaw(Degree(realPath.length() * 360 / mHalfTotalDistance));
}
return true; // Animation still running.
}
mAnimatedNode->setPosition(mDestination);
mAnimatedNode->setOrientation(mAnimatedNode->getInitialOrientation());
return false; // Animation finished.
}