本文整理汇总了C++中MovableObject::getQueryFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ MovableObject::getQueryFlags方法的具体用法?C++ MovableObject::getQueryFlags怎么用?C++ MovableObject::getQueryFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovableObject
的用法示例。
在下文中一共展示了MovableObject::getQueryFlags方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例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 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;
}
}
}
}
}
示例4: 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;
}
}
示例5: 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;
}
}
示例6: processLeaf
//-----------------------------------------------------------------------
bool BspRaySceneQuery::processLeaf(const BspNode* leaf, const Ray& tracingRay,
RaySceneQueryListener* listener, Real maxDistance, Real traceDistance)
{
const BspNode::IntersectingObjectSet& objects = leaf->getObjects();
BspNode::IntersectingObjectSet::const_iterator i, iend;
iend = objects.end();
//Check ray against objects
for(i = objects.begin(); i != iend; ++i)
{
// cast away constness, constness of node is nothing to do with objects
MovableObject* obj = const_cast<MovableObject*>(*i);
// Skip this object if not enabled
if(!(obj->getQueryFlags() & mQueryMask) ||
!((obj->getTypeFlags() & mQueryTypeMask)))
continue;
// check we haven't reported this one already
// (objects can be intersecting more than one node)
if (mObjsThisQuery.find(obj) != mObjsThisQuery.end())
continue;
//Test object as bounding box
std::pair<bool, Real> result =
tracingRay.intersects(obj->getWorldBoundingBox());
// if the result came back positive and intersection point is inside
// the node, fire the event handler
if(result.first && result.second <= maxDistance)
{
if (!listener->queryResult(obj, result.second + traceDistance))
return false;
}
}
// Check ray against brushes
if (mQueryTypeMask & SceneManager::WORLD_GEOMETRY_TYPE_MASK)
{
const BspNode::NodeBrushList& brushList = leaf->getSolidBrushes();
BspNode::NodeBrushList::const_iterator bi, biend;
biend = brushList.end();
bool intersectedBrush = false;
for (bi = brushList.begin(); bi != biend; ++bi)
{
BspNode::Brush* brush = *bi;
std::pair<bool, Real> result = Math::intersects(tracingRay, brush->planes, true);
// if the result came back positive and intersection point is inside
// the node, check if this brush is closer
if(result.first && result.second <= maxDistance)
{
intersectedBrush = true;
if(mWorldFragmentType == SceneQuery::WFT_SINGLE_INTERSECTION)
{
// We're interested in a single intersection
// Have to create these
SceneQuery::WorldFragment* wf = OGRE_ALLOC_T(SceneQuery::WorldFragment, 1, MEMCATEGORY_SCENE_CONTROL);
wf->fragmentType = SceneQuery::WFT_SINGLE_INTERSECTION;
wf->singleIntersection = tracingRay.getPoint(result.second);
// save this so we can clean up later
mSingleIntersections.push_back(wf);
if (!listener->queryResult(wf, result.second + traceDistance))
return false;
}
else if (mWorldFragmentType == SceneQuery::WFT_PLANE_BOUNDED_REGION)
{
// We want the whole bounded volume
assert((*bi)->fragment.fragmentType == SceneQuery::WFT_PLANE_BOUNDED_REGION);
if (!listener->queryResult(const_cast<WorldFragment*>(&(brush->fragment)),
result.second + traceDistance))
return false;
}
}
}
if (intersectedBrush)
{
return false; // stop here
}
}
return true;
}