Ignore:
Timestamp:
04/06/05 18:36:40 (19 years ago)
Author:
mattausch
Message:
 
Location:
trunk/VUT/OcclusionCullingSceneManager/include
Files:
2 edited

Legend:

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

    r39 r40  
    1010 
    1111#include "OgrePrerequisites.h" 
    12 #include "OgreOcclusionCullingSceneTraverser.h" 
     12#include "OgreOcclusionCullingTerrainSceneTraverser.h" 
    1313//#include "OgreSolidHalfBoundingBox.h" 
    1414 
     
    1616 
    1717namespace Ogre { 
    18         template <typename T> class octreeless 
    19         { 
    20         public: 
    21                 myless(Camera *cam) { mCamera = cam; } 
    22                 //bool operator() (HierarchyNode *v1, HierarchyNode *v2) const 
    23                 bool operator() (T v1, T v2) const 
    24                 { 
    25                         v1->getCullBounds(&mAabb); 
    26                         return mAabb->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera); 
    27                 } 
    28  
    29         private: 
    30                 Camera *mCamera; 
    31                 AxisAlignedBox mAabb; 
    32         }; 
    33  
    3418        /** 
    3519                Class which implements a scene mangager which uses occlusion queries for culling occluded objects 
     
    4125                ~OcclusionCullingTerrainSceneManager(); 
    4226         
    43                 //void _renderVisibleObjects(void); 
    44                 //void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); 
    45                  
    46                 //void _updateSceneGraph(Camera* cam); 
     27                void _renderVisibleObjects(void); 
     28                void _findVisibleObjects(Camera* cam, bool onlyShadowCasters); 
     29                void _updateSceneGraph(Camera* cam); 
    4730 
    4831                /** Sets the given option for the SceneManager 
     
    6245                bool getOptionKeys( StringVector &refKeys ); 
    6346 
     47                /** Renders one octant of an octree, i.e., renders current octant 
     48                        node and does not traverse deeper into the tree. 
     49                        @remark Note that OctreeNode instances are NOT part of the octree  
     50                        hierarchy, instead one octant of an Octree contains many OctreeNode instances. 
     51                        @param octree the octree to be rendered 
     52                        @param cam current camera 
     53                */ 
     54                void _renderOctant(Camera* cam, Octree *octree); 
     55 
    6456        protected: 
    65                 OcclusionCullingSceneTraverser *mOcclusionCullingSceneTraverser; 
     57                //OcclusionCullingTerrainSceneTraverser *mOcclusionCullingTerrainSceneTraverser; 
     58                OcclusionCullingSceneTraverser *mOcclusionCullingTerrainSceneTraverser; 
    6659        }; 
    6760 
  • 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.