Ignore:
Timestamp:
04/06/05 18:36:40 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingTerrainSceneTraverser.h

    r39 r40  
    88 
    99namespace Ogre { 
    10 void Octree::_getCullBounds( AxisAlignedBox *b ) 
     10        /** 
     11                This class implements the compare operator for the priority queue 
     12                especially for octree hierarchies using getCullBounds for bounding 
     13                box computation. A lower distance has a higher value in the queue. 
     14        */ 
     15        template <typename T> class octreeless  
     16        { 
     17        public: 
     18                octreeless(Camera *cam) { mCamera = cam; } 
     19                 
     20                bool operator() (T v1, T v2) const 
     21                { 
     22                        AxisAlignedBox box1, box2; 
     23                        v1->_getCullBounds(&box1); 
     24                        v2->_getCullBounds(&box2); 
     25 
     26                        return getSquaredViewDepth(mCamera, &box1) > getSquaredViewDepth(mCamera, &box2); 
     27                } 
     28 
     29        private: 
     30                Real getSquaredViewDepth(const Ogre::Camera* cam, const Ogre::AxisAlignedBox* box) const 
     31                { 
     32                        Vector3 mid  = ((box->getMinimum() - box->getMaximum()) * 0.5) + box->getMinimum(); 
     33                        return (cam->getDerivedPosition() - mid).squaredLength();                                                                    
     34                } 
     35 
     36                Camera *mCamera; 
     37                //AxisAlignedBox mBox1, mBox2; 
     38                //Ogre::Vector3 min, max, mid, dist; 
     39        }; 
     40 
    1141        typedef pair<Octree *, HardwareOcclusionQuery *> OctreeQueryPair; 
    12         typedef priority_queue<Octree *, vector<Octree *>, myless<vector<Octree *>::value_type> > OctreePriorityQueue; 
     42        typedef priority_queue<Octree *, vector<Octree *>, octreeless<vector<Octree *>::value_type> > OctreePriorityQueue; 
    1343        //typedef queue<QueryPair> QueryQueue; 
    1444 
    15         class OcclusionCullingTerrainSceneTraverser: OcclusionCullingSceneTraverser 
     45        class OcclusionCullingTerrainSceneTraverser: public OcclusionCullingSceneTraverser 
    1646        { 
     47        public: 
     48                OcclusionCullingTerrainSceneTraverser(SceneManager *sm, RenderSystem *rsys); 
    1749                void renderScene( Camera *cam, Octree *root ); 
     50                 
     51        protected: 
     52                /** Renders the scene with view frustum culling only. */ 
    1853                void renderCullFrustum( Camera *cam ); 
    19                 void pullUpVisibility( Octree *node ); 
    20                 void traverseNode( Camera *cam, Octree *node ); 
     54                /** Renders the scene with the hierarchical stop and wait algorithm. */ 
     55                void renderStopAndWait( Camera *cam ); 
     56                /** Renders the scene with the coherent hierarchical algorithm and the query queye. */ 
     57                void renderCoherentWithQueue( Camera *cam ); 
     58                /** Issue a occlusion query for this node. */ 
     59                 
     60                void pullUpVisibility( Octree *octree ); 
     61                void traverseOctree( Camera *cam, Octree *octree ); 
     62                void renderOctree( Camera *cam, Octree *octree ); 
    2163 
    22         protected: 
    2364                OctreePriorityQueue *mDistanceQueue; 
    2465        }; 
Note: See TracChangeset for help on using the changeset viewer.