本文整理汇总了C++中root::MovableObjectFactoryIterator::hasMoreElements方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObjectFactoryIterator::hasMoreElements方法的具体用法?C++ MovableObjectFactoryIterator::hasMoreElements怎么用?C++ MovableObjectFactoryIterator::hasMoreElements使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类root::MovableObjectFactoryIterator
的用法示例。
在下文中一共展示了MovableObjectFactoryIterator::hasMoreElements方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: execute
//---------------------------------------------------------------------
void DefaultPlaneBoundedVolumeListSceneQuery::execute(SceneQueryListener* listener)
{
// Iterate over all movable types
Root::MovableObjectFactoryIterator factIt =
Root::getSingleton().getMovableObjectFactoryIterator();
while(factIt.hasMoreElements())
{
SceneManager::MovableObjectIterator objItA =
mParentSceneMgr->getMovableObjectIterator(
factIt.getNext()->getType());
while (objItA.hasMoreElements())
{
MovableObject* a = objItA.getNext();
// skip whole group if type doesn't match
if (!(a->getTypeFlags() & mQueryTypeMask))
break;
PlaneBoundedVolumeList::iterator pi, piend;
piend = mVolumes.end();
for (pi = mVolumes.begin(); pi != piend; ++pi)
{
PlaneBoundedVolume& vol = *pi;
// Do AABB / plane volume test
if ((a->getQueryFlags() & mQueryMask) &&
a->isInScene() &&
vol.intersects(a->getWorldBoundingBox()))
{
if (!listener->queryResult(a)) return;
break;
}
}
}
}
}
示例2: execute
//---------------------------------------------------------------------
void OctreeIntersectionSceneQuery::execute(IntersectionSceneQueryListener* listener)
{
typedef std::pair<MovableObject *, MovableObject *> MovablePair;
typedef std::set
< std::pair<MovableObject *, MovableObject *> > MovableSet;
MovableSet set;
// Iterate over all movable types
Root::MovableObjectFactoryIterator factIt =
Root::getSingleton().getMovableObjectFactoryIterator();
while(factIt.hasMoreElements())
{
SceneManager::MovableObjectIterator it =
mParentSceneMgr->getMovableObjectIterator(
factIt.getNext()->getType());
while( it.hasMoreElements() )
{
MovableObject * e = it.getNext();
std::list< SceneNode * > list;
//find the nodes that intersect the AAB
static_cast<OctreeSceneManager*>( mParentSceneMgr ) -> findNodesIn( e->getWorldBoundingBox(), list, 0 );
//grab all moveables from the node that intersect...
std::list< SceneNode * >::iterator nit = list.begin();
while( nit != list.end() )
{
SceneNode::ObjectIterator oit = (*nit) -> getAttachedObjectIterator();
while( oit.hasMoreElements() )
{
MovableObject * m = oit.getNext();
if( m != e &&
set.find( MovablePair(e,m)) == set.end() &&
set.find( MovablePair(m,e)) == set.end() &&
(m->getQueryFlags() & mQueryMask) &&
(m->getTypeFlags() & mQueryTypeMask) &&
m->isInScene() &&
e->getWorldBoundingBox().intersects( m->getWorldBoundingBox() ) )
{
listener -> queryResult( e, m );
// deal with attached objects, since they are not directly attached to nodes
if (m->getMovableType() == "Entity")
{
Entity* e2 = static_cast<Entity*>(m);
Entity::ChildObjectListIterator childIt = e2->getAttachedObjectIterator();
while(childIt.hasMoreElements())
{
MovableObject* c = childIt.getNext();
if (c->getQueryFlags() & mQueryMask &&
e->getWorldBoundingBox().intersects( c->getWorldBoundingBox() ))
{
listener->queryResult(e, c);
}
}
}
}
set.insert( MovablePair(e,m) );
}
++nit;
}
}
}
}