Ignore:
Timestamp:
03/29/05 08:21:37 (19 years ago)
Author:
gametools
Message:
 
Location:
trunk/VUT/OcclusionCullingSceneManager/include
Files:
2 added
1 edited

Legend:

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

    r30 r32  
    44#include "OgreSceneNode.h" 
    55#include "OgreSceneManager.h" 
     6#include "OgreOcclusionCullingSceneTraverser.h" 
    67#include "OgrePrerequisites.h" 
    78#include "OgreSolidHalfBoundingBox.h" 
     
    1112 
    1213namespace Ogre { 
    13         /** 
    14                 This class implements the compare operator for the priority queue. 
    15                 a lower distance has a higher value in the queue 
    16         */ 
    17         template <typename T> class myless 
    18         { 
    19         public: 
    20                 myless(Camera *cam) { mCamera = cam; } 
    21                 //bool operator() (HierarchyNode *v1, HierarchyNode *v2) const 
    22                 bool operator() (T v1, T v2) const 
    23                 { 
    24                         return v1->getSquaredViewDepth(mCamera) > v2->getSquaredViewDepth(mCamera); 
    25                 } 
    26         private: 
    27                 Camera *mCamera; 
    28         }; 
    29  
    30         typedef pair<SceneNode *, HardwareOcclusionQuery *> query_pair; 
    31         typedef priority_queue<SceneNode *, vector<SceneNode *>, myless<vector<SceneNode *>::value_type> > PriorityQueue; 
    32         typedef queue<query_pair> QueryQueue; 
     14         
    3315        /** 
    3416                Class which implements a scene mangager which uses occlusion queries for culling occluded objects 
     
    3820        public: 
    3921                OcclusionCullingSceneManager(); 
    40                 ~OcclusionCullingSceneManager(); 
     22                //~OcclusionCullingSceneManager(); 
    4123         
    42                 enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES}; 
    43                  
    4424                /** Overriden from SceneManager. Renders the scene with the specified algorithm 
    4525                /** 
     
    6949 
    7050        protected: 
    71                 enum {MODE_QUERY, MODE_RENDER}; 
    72  
    73                 bool isLeaf(SceneNode *node); 
    74                 unsigned int countSceneNodes(SceneNode *node); 
    75                 void renderZPass(); 
    76                 void traverseNode(SceneNode *node); 
    77                 /** Renders current node */ 
    78                 void render(SceneNode *node); 
    79                 /** Sets rendering mode, e.g. query mode or render mode*/ 
    80                 void setRenderingMode(int mode); 
    81                  
    82                 /** Renders the scene with view frustum culling only. */ 
    83                 void renderCullFrustum(); 
    84                 /** Renders the scene with the hierarchical stop and wait algorithm. */ 
    85                 void renderStopAndWait(); 
    86                 /** Renders the scene with the coherent hierarchical algorithm and the query queye. */ 
    87                 void renderCoherentWithQueue(); 
    88                 /** Issue a occlusion query for this node. */ 
    89                 HardwareOcclusionQuery *issueOcclusionQuery(SceneNode *node, bool wasVisible); 
    90                 /** Pulls up the visibility from the child nodes. */ 
    91                 void pullUpVisibility(SceneNode *node); 
    92                 /** delete all previously defined occlusion queries */ 
    93                 void deleteQueries(); 
    94                 /** Renders bounding box of specified node. 
    95                 @param the node which bounding box is to be rendered 
    96                 */ 
    97                 void renderBoundingBox(SceneNode *node); 
    98                 /** Returns one half of the bounding box. 
    99                 @param the half of the bouding box 
    100                 */ 
    101                 SolidHalfBoundingBox *getSolidHalfBoundingBox(int half); 
    102                  
    103  
    104                 // we use a priority queue rather than a renderstack 
    105                 PriorityQueue *mDistanceQueue;  
    106                  
    107                         std::vector<HardwareOcclusionQuery *> mOcclusionQueries; 
    108                 // two halfes of a aabb 
    109                 SolidHalfBoundingBox *mHalfBoundingBox[2];       
    110                 int mCurrentAlgorithm; 
    111  
    112                 unsigned int mFrameId; 
    113                 unsigned int mVisibilityThreshold; 
    114                  
    115                 int mCurrentTestIdx; 
    116                 int mQueryMode; 
    117  
    118                 //--- statistics 
    119                 unsigned int mNumSceneNodes; 
    120                 unsigned int mNumTraversedNodes; 
    121                 unsigned int mNumQueryCulledNodes; 
    122                 unsigned int mNumFrustumCulledNodes; 
    123                 unsigned int mNumRenderedGeometry; 
     51                OcclusionCullingSceneTraverser mSceneTraverser; 
     52         
    12453        }; 
    12554 
Note: See TracChangeset for help on using the changeset viewer.