Changeset 32 for trunk/VUT/OcclusionCullingSceneManager/include
- Timestamp:
- 03/29/05 08:21:37 (20 years ago)
- Location:
- trunk/VUT/OcclusionCullingSceneManager/include
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/OcclusionCullingSceneManager/include/OgreOcclusionCullingSceneManager.h
r30 r32 4 4 #include "OgreSceneNode.h" 5 5 #include "OgreSceneManager.h" 6 #include "OgreOcclusionCullingSceneTraverser.h" 6 7 #include "OgrePrerequisites.h" 7 8 #include "OgreSolidHalfBoundingBox.h" … … 11 12 12 13 namespace 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 33 15 /** 34 16 Class which implements a scene mangager which uses occlusion queries for culling occluded objects … … 38 20 public: 39 21 OcclusionCullingSceneManager(); 40 ~OcclusionCullingSceneManager();22 //~OcclusionCullingSceneManager(); 41 23 42 enum {RENDER_CULL_FRUSTUM, RENDER_STOP_AND_WAIT, RENDER_COHERENT, NUM_RENDERMODES};43 44 24 /** Overriden from SceneManager. Renders the scene with the specified algorithm 45 25 /** … … 69 49 70 50 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 124 53 }; 125 54
Note: See TracChangeset
for help on using the changeset viewer.