Changeset 86 for trunk/VUT/GtpVisibility
- Timestamp:
- 05/06/05 01:39:32 (20 years ago)
- Location:
- trunk/VUT/GtpVisibility
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/HierarchyInterface.h
r85 r86 36 36 @returns occlusion query for this node 37 37 */ 38 virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node) = 0; 38 virtual OcclusionQuery *IssueOcclusionQuery(HierarchyNode *node, 39 const bool wasVisible = false) = 0; 39 40 /** Sets the root of the scene hierarchy. 40 41 @param root the hierarchy root … … 105 106 */ 106 107 unsigned int GetNumRenderedNodes(); 108 /** Optimization when issuing occlusion test: test is done with actual geometry 109 rather than the bounding box 110 @param useOptimization if the optimization should be used 111 */ 112 void SetUseOptimization(bool useOptimization); 107 113 108 114 protected: 109 115 116 bool mUseOptimization; 110 117 unsigned int mFrameId; 111 118 -
trunk/VUT/GtpVisibility/include/OcclusionQuery.h
r59 r86 9 9 { 10 10 public: 11 // OcclusionQuery();12 11 virtual ~OcclusionQuery() {}; 13 12 /** Returns the result of an occlusion query in terms of visible pixels. 14 @returns number of visible pixels 13 @param queryResult the number of visible pixels if the result was available 14 @param waitForResult if we should wait for the result until available 15 @returns if the result was already available 15 16 */ 16 virtual unsigned int GetQueryResult() const = 0; 17 /** Returns true if the result of the query is available, false otherwise. 18 @returns if result is available 19 */ 20 virtual bool ResultAvailable() const = 0; 17 virtual bool GetQueryResult(unsigned int &queryResult, 18 const bool waitForResult) const = 0; 21 19 /** Begins occlusion query. 22 20 @remark the query counts the number of visible pixels between it's begin and end -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r85 r86 1 1 #include "CoherentHierarchicalCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { … … 8 8 { 9 9 mNumFrustumCulledNodes = mNumQueryCulledNodes = 0; 10 //OutputDebugString("Coherent Culling\n");10 // OutputDebugString("Coherent Culling\n"); 11 11 12 12 QueryQueue queryQueue; 13 13 unsigned int visiblePixels = 0; 14 bool isAvailable = false; 15 14 16 //-- PART 1: process finished occlusion queries 15 17 while (!mHierarchyInterface->GetQueue()->empty() || !queryQueue.empty()) 16 18 { 17 19 while (!queryQueue.empty() && 18 (queryQueue.front().second->ResultAvailable() || mHierarchyInterface->GetQueue()->empty())) 20 queryQueue.front().second->GetQueryResult(visiblePixels, 21 mHierarchyInterface->GetQueue()->empty())) 19 22 { 20 23 HierarchyNode *node = queryQueue.front().first; 21 22 // wait until result available 23 unsigned int visiblePixels = queryQueue.front().second->GetQueryResult(); 24 24 25 25 queryQueue.pop(); 26 26 … … 67 67 68 68 // identify nodes that we cannot skip queries for 69 bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || mHierarchyInterface->IsLeaf(node); 69 bool mustQuery = !wasVisible || mHierarchyInterface->HasGeometry(node) || 70 mHierarchyInterface->IsLeaf(node); 70 71 71 72 // reset node's visibility classification … … 78 79 if (mustQuery) 79 80 { 80 queryQueue.push(QueryPair(node, mHierarchyInterface->IssueOcclusionQuery(node))); 81 queryQueue.push(QueryPair(node, 82 mHierarchyInterface->IssueOcclusionQuery(node, wasVisible))); 81 83 } 82 84 -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r85 r86 1 1 #include "FrustumCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { -
trunk/VUT/GtpVisibility/src/HierarchyInterface.cpp
r85 r86 8 8 HierarchyInterface::HierarchyInterface(): 9 9 mFrameId(0), mNumTraversedNodes(0), mNumRenderedNodes(0), 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0) 10 mSceneRoot(0), mPreviousNode(0), mCurrentTestIdx(0), mUseOptimization(true) 11 11 { 12 12 mDistanceQueue = new DistanceQueue(GreaterDistance<HierarchyNode *>(this)); … … 64 64 return mNumRenderedNodes; 65 65 } 66 67 void HierarchyInterface::SetUseOptimization(bool useOptimization) 68 { 69 mUseOptimization = useOptimization; 70 } 71 66 72 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp
r85 r86 1 1 #include "StopAndWaitCullingManager.h" 2 //#include <windows.h>2 #include <windows.h> 3 3 4 4 namespace GtpVisibility { … … 35 35 } 36 36 37 unsigned int visiblePixels = 0; 38 39 mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult(visiblePixels, true); 40 37 41 // node visible 38 if (mHierarchyInterface->IssueOcclusionQuery(node)->GetQueryResult() > 39 mVisibilityThreshold) 42 if (visiblePixels > mVisibilityThreshold) 40 43 { 41 44 mHierarchyInterface->TraverseNode(node);
Note: See TracChangeset
for help on using the changeset viewer.