Changeset 158 for trunk/VUT/GtpVisibility
- Timestamp:
- 07/06/05 11:04:25 (20 years ago)
- Location:
- trunk/VUT/GtpVisibility
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r155 r158 14 14 typedef std::pair<HierarchyNode *, OcclusionQuery *> QueryPair; 15 15 typedef std::queue<QueryPair> QueryQueue; 16 typedef std::stack<HierarchyNode *> TraversalStack; 16 17 17 18 18 /** Class which implements a hierarchy interface for a scene hierarchy. … … 33 33 @param node the hierarchy node 34 34 */ 35 virtual void Traverse AndRenderNode(HierarchyNode *node) = 0;35 virtual void TraverseNode(HierarchyNode *node) = 0; 36 36 /** Renders current hierarchy node. 37 37 @param node current hierarchy node to be rendered … … 56 56 */ 57 57 HierarchyNode *GetHierarchyRoot() const; 58 /** Sets the scene root and initialises this hierarchy interface for a traversal. 59 @param frontToBack 60 if traversal is initialised for front-to-back rendering or 61 simple traversal of the nodes. 58 /** Sets the scene root and initialises this hierarchy interface for a traversal. 62 59 @remark also resets the statistics evaluated in the last traversal 63 60 */ 64 void InitTraversal( bool frontToBack = true);61 void InitTraversal(); 65 62 /** Returns current frame id. 66 63 @returns frame id … … 152 149 virtual void RenderGeometry(GtpVisibility::Mesh *geom) = 0; 153 150 154 /** Sets node id to specified value. 155 */ 156 virtual void SetNodeId(HierarchyNode *node, int id) = 0; 157 /** Returns id of given node. 158 */ 159 virtual int GetNodeId(HierarchyNode *node) = 0; 160 151 161 152 /** This is an optimization when issuing the occlusion test. 162 153 The test is done with actual geometry rather than the bounding 163 box of leave nodes previously marked as visible 154 box of leave nodes previously marked as visible. 155 164 156 @param testGeometry if this optimization should be used 165 157 @remark this option is only useful for the coherent hierarchical culling algorithm … … 167 159 void TestGeometryForVisibleLeaves(bool testGeometry); 168 160 169 /** 170 Traverses hierarchy and returns next node. 171 @returns next node in hierarchy. 172 */ 173 virtual HierarchyNode *GetNextNode() = 0; 161 174 162 175 163 protected: 176 164 /// chc optimization for testing geometry of leaves instead of bounding box 177 165 bool mTestGeometryForVisibleLeaves; 178 166 /// the current frame number 179 167 unsigned int mFrameId; 180 168 /// points to the last occlusion query in the query list 181 169 int mCurrentTestIdx; 182 170 183 171 /// number of traversed nodes 184 172 unsigned int mNumTraversedNodes; 185 /// the distance queue used for rendering of nodes in front to back order. 173 174 /// The queue is useful for rendering hierarchy nodes in front to back order. 186 175 DistanceQueue *mDistanceQueue; 187 /// internal structure for traversal188 TraversalStack *mTraversalStack;189 176 190 177 /// the root of the hierarchy 191 178 HierarchyNode *mHierarchyRoot; 192 179 193 // buffer for a node pointer180 /// buffer for a node pointer 194 181 HierarchyNode *mSavedNode; 195 182 /// list of rendered hierarchy nodes (e.g., useful for exact visibility queries) 196 183 std::vector<HierarchyNode *> mRenderedNodes; 197 184 }; -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r155 r158 40 40 { 41 41 mHierarchyInterface->PullUpVisibility(node); 42 mHierarchyInterface->Traverse AndRenderNode(node);42 mHierarchyInterface->TraverseNode(node); 43 43 } 44 44 else … … 111 111 if (wasVisible) 112 112 { 113 mHierarchyInterface->Traverse AndRenderNode(node);113 mHierarchyInterface->TraverseNode(node); 114 114 } 115 115 } … … 145 145 146 146 mHierarchyInterface->PullUpVisibility(node); 147 mHierarchyInterface->Traverse AndRenderNode(node);147 mHierarchyInterface->TraverseNode(node); 148 148 } 149 149 -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r155 r158 28 28 { 29 29 mHierarchyInterface->SetNodeVisible(node, true); 30 mHierarchyInterface->Traverse AndRenderNode(node);30 mHierarchyInterface->TraverseNode(node); 31 31 } 32 32 } -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r155 r158 11 11 { 12 12 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); 13 mTraversalStack = new std::stack<HierarchyNode *>;14 13 } 15 14 //----------------------------------------------------------------------- … … 17 16 { 18 17 delete mDistanceQueue; 19 delete mTraversalStack;20 18 } 21 19 //----------------------------------------------------------------------- … … 25 23 } 26 24 //----------------------------------------------------------------------- 27 void HierarchyInterface::InitTraversal( bool frontToBack)25 void HierarchyInterface::InitTraversal() 28 26 { 29 27 // initialise for front-to-back rendering 30 if (frontToBack)31 {32 ++ mFrameId;33 mCurrentTestIdx = 0;34 mNumTraversedNodes = 0;35 mRenderedNodes.clear();36 28 37 mDistanceQueue->push(mHierarchyRoot);38 }39 else 40 { // initialise for simple node traversal41 mTraversalStack->push(mHierarchyRoot); 42 }29 ++ mFrameId; 30 mCurrentTestIdx = 0; 31 mNumTraversedNodes = 0; 32 mRenderedNodes.clear(); 33 34 mDistanceQueue->push(mHierarchyRoot); 43 35 } 44 36 //----------------------------------------------------------------------- -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r155 r158 31 31 { 32 32 mHierarchyInterface->SetNodeVisible(node, true); 33 mHierarchyInterface->Traverse AndRenderNode(node);33 mHierarchyInterface->TraverseNode(node); 34 34 } 35 35 else … … 45 45 if (visiblePixels > mVisibilityThreshold) 46 46 { 47 mHierarchyInterface->Traverse AndRenderNode(node);47 mHierarchyInterface->TraverseNode(node); 48 48 } 49 49 else
Note: See TracChangeset
for help on using the changeset viewer.