当前位置: 首页>>代码示例>>C++>>正文


C++ MovableObject::getQueryFlags方法代码示例

本文整理汇总了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;
    }
开发者ID:terakuran,项目名称:ogre,代码行数:54,代码来源:OgrePCZSceneQuery.cpp

示例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;
        }
    }
}
开发者ID:proton,项目名称:ireon,代码行数:28,代码来源:OgrePagingLandScapeOctreePlaneBoundedVolumeListSceneQuery.cpp

示例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;
					}
				}
			}
		}
	}
开发者ID:jjiezheng,项目名称:pap_full,代码行数:35,代码来源:OgreDefaultSceneQueries.cpp

示例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;
    }
}
开发者ID:proton,项目名称:ireon,代码行数:28,代码来源:OgrePagingLandScapeOctreeRaySceneQuery.cpp

示例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;
    }

}
开发者ID:terakuran,项目名称:ogre,代码行数:43,代码来源:OgreOctreeSceneQuery.cpp

示例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;

    } 
开发者ID:airgames,项目名称:vuforia-gamekit-integration,代码行数:86,代码来源:OgreBspSceneManager.cpp


注:本文中的MovableObject::getQueryFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。