Changeset 147 for trunk/VUT/GtpVisibility
- Timestamp:
- 06/22/05 18:35:55 (20 years ago)
- Location:
- trunk/VUT/GtpVisibility
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h
r146 r147 25 25 26 26 protected: 27 /** Decides wether occlusion query should be issued depending on some27 /** Decides if node is considered to be visible depeding on the 28 28 assumed visibility factor. 29 @returns if occlusion query should be issued29 @returns if node is considered to be visible 30 30 */ 31 bool Decide QueryTest(HierarchyNode *node) const;31 bool DecideVisible(HierarchyNode *node) const; 32 32 33 33 unsigned int mAssumedVisibility; … … 35 35 mAssumedVisibility. 36 36 */ 37 unsignedint mThreshold;37 int mThreshold; 38 38 }; 39 39 -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r146 r147 1 1 #include "CoherentHierarchicalCullingManager.h" 2 //#include <OgreLogManager.h>2 #include <OgreLogManager.h> 3 3 4 4 namespace GtpVisibility { … … 55 55 if (!mHierarchyInterface->CheckFrustumVisible(node, intersects)) 56 56 { 57 mNumFrustumCulledNodes ++;57 ++ mNumFrustumCulledNodes; 58 58 59 if (mVisualizeCulledNodes)59 if (mVisualizeCulledNodes) 60 60 { 61 61 mHierarchyInterface->VisualizeCulledNode(node, FRUSTUM_CULLED); … … 79 79 bool wasVisible = mHierarchyInterface->IsNodeVisible(node) && 80 80 (mHierarchyInterface->LastVisited(node) == mHierarchyInterface->GetFrameId() - 1); 81 81 // if visibility is assumed to be true in this frame 82 bool assumeVisible = wasVisible && (mAssumedVisibility > 0) && DecideVisible(node); 83 82 84 // identify nodes that we cannot skip queries for 83 85 // geometry not only in leaves => test for renderable geometry 84 86 bool issueQuery = !wasVisible || 85 (mHierarchyInterface->HasGeometry(node) && 86 (!mAssumedVisibility || DecideQueryTest(node))); 87 88 // reset node's visibility classification 89 mHierarchyInterface->SetNodeVisible(node, false); 87 (mHierarchyInterface->HasGeometry(node) && !assumeVisible); 88 89 // reset node's visibility classification 90 mHierarchyInterface->SetNodeVisible(node, !issueQuery && assumeVisible); 90 91 91 92 // update node's visited flag … … 95 96 if (issueQuery) 96 97 { 97 mNumQueriesIssued ++;98 ++ mNumQueriesIssued; 98 99 99 100 queryQueue.push(QueryPair(node, mHierarchyInterface-> 100 101 IssueOcclusionQuery(node, wasVisible))); 101 102 } 102 103 103 104 // always traverse a node if it was visible 104 105 if (wasVisible) … … 117 118 mThreshold = 0; 118 119 119 if (mAssumedVisibility )120 if (mAssumedVisibility > 0) 120 121 { 121 mThreshold = RAND_MAX / mAssumedVisibility;122 mThreshold = RAND_MAX - RAND_MAX / mAssumedVisibility; 122 123 } 124 //std::stringstream d; d << "*** setting assumed vis: " << mAssumedVisibility; Ogre::LogManager::getSingleton().logMessage(d.str()); 123 125 } 124 126 //----------------------------------------------------------------------- 125 bool CoherentHierarchicalCullingManager::Decide QueryTest(HierarchyNode *node) const127 bool CoherentHierarchicalCullingManager::DecideVisible(HierarchyNode *node) const 126 128 { 129 /*bool result = rand() < mThreshold; 130 std::stringstream d; d << "Assumed vis: " << mAssumedVisibility << ", result: " << result; 131 Ogre::LogManager::getSingleton().logMessage(d.str()); return result;*/ 132 127 133 return rand() < mThreshold; 128 134 } -
trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp
r139 r147 17 17 18 18 if (!mHierarchyInterface->CheckFrustumVisible(node)) 19 { //if (mHierarchyInterface->mIsShadowPass)20 mNumFrustumCulledNodes ++;19 { 20 ++ mNumFrustumCulledNodes; 21 21 22 22 if (mVisualizeCulledNodes) -
trunk/VUT/GtpVisibility/src/VisibilityManager.cpp
r146 r147 13 13 mQueryManager(new DummyQueryManager(NULL)), 14 14 mPreprocessingManager(new DummyPreprocessingManager(NULL)), 15 mVisibilityEnvironment(visEnvironment) 15 mVisibilityEnvironment(visEnvironment), 16 mAssumedVisibility(0) 16 17 { 17 18 SetCullingManager(VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING);
Note: See TracChangeset
for help on using the changeset viewer.