Changeset 146
- Timestamp:
- 06/22/05 11:04:20 (20 years ago)
- Location:
- trunk/VUT
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibility/include/CoherentHierarchicalCullingManager.h
r142 r146 16 16 CoherentHierarchicalCullingManager(); 17 17 void RenderScene(); 18 /** Sets assumed visibility which is a decition variable19 wether an occlusion query should be issued or not.20 @param assumedVisibility indicates that same visibility should be assumed21 for approximately assumedVisibility frames.22 if 0, no assumedVisibility will be tested.18 /** Sets assumed visibility which is a an estimation for e 19 how many frames the visibility is considered to be valied 20 @param assumedVisibility indicates for how many frames the 21 same visibility is be assumed. 22 if 0, the visibility is tested deterministically for each frame. 23 23 */ 24 void SetAssumedVisibility(int assumedVisibility); 24 void SetAssumedVisibility(unsigned int assumedVisibility); 25 25 26 protected: 26 27 /** Decides wether occlusion query should be issued depending on some … … 29 30 */ 30 31 bool DecideQueryTest(HierarchyNode *node) const; 31 int mAssumedVisibility; 32 33 unsigned int mAssumedVisibility; 34 /** Threshold for rand function to return positive result with respect to 35 mAssumedVisibility. 36 */ 37 unsigned int mThreshold; 32 38 }; 33 39 -
trunk/VUT/GtpVisibility/include/VisibilityManager.h
r130 r146 55 55 */ 56 56 void SetUseChcOptimization(bool useOptimization); 57 /** Indicates for how long a frame is considered to be visible. 58 @param assumedVisibility estimation for how long visibility is assumed to be valid. 59 */ 60 void SetAssumedVisibility(unsigned int assumedVisibility); 57 61 /** Sets pointer to a query manager. 58 62 */ … … 71 75 72 76 unsigned int mVisibilityThreshold; 73 77 unsigned int mAssumedVisibility; 74 78 }; 75 79 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp
r142 r146 6 6 //----------------------------------------------------------------------- 7 7 CoherentHierarchicalCullingManager:: CoherentHierarchicalCullingManager(): 8 mAssumedVisibility(0) 8 mAssumedVisibility(0), mThreshold(0) 9 9 { 10 10 // initialise random generator because of assumed visibility … … 111 111 } 112 112 //----------------------------------------------------------------------- 113 void CoherentHierarchicalCullingManager::SetAssumedVisibility( int assumedVisibility)113 void CoherentHierarchicalCullingManager::SetAssumedVisibility(unsigned int assumedVisibility) 114 114 { 115 115 mAssumedVisibility = assumedVisibility; 116 117 mThreshold = 0; 118 119 if (mAssumedVisibility) 120 { 121 mThreshold = RAND_MAX / mAssumedVisibility; 122 } 116 123 } 117 124 //----------------------------------------------------------------------- 118 125 bool CoherentHierarchicalCullingManager::DecideQueryTest(HierarchyNode *node) const 119 126 { 120 bool result = false; 121 rand(); 122 return result; 127 return rand() < mThreshold; 123 128 } 124 129 } // namespace GtpVisibility -
trunk/VUT/GtpVisibility/src/VisibilityManager.cpp
r130 r146 46 46 case VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING: 47 47 mCullingManager = new CoherentHierarchicalCullingManager(); 48 dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)-> 49 SetAssumedVisibility(mAssumedVisibility); 48 50 break; 49 51 … … 93 95 return mQueryManager; 94 96 } 97 void VisibilityManager::SetAssumedVisibility(unsigned int assumedVisibility) 98 { 99 mAssumedVisibility = assumedVisibility; 100 101 if (VisibilityManager::GetCullingManagerType() == 102 VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING) 103 { 104 dynamic_cast<CoherentHierarchicalCullingManager *>(mCullingManager)-> 105 SetAssumedVisibility(mAssumedVisibility); 106 } 107 } 95 108 } // namespace GtpVisibility -
trunk/VUT/Ogre/resources/VisibilityDemo.overlay
r135 r146 23 23 top 5 24 24 width 400 25 height 7525 height 90 26 26 material Core/StatsBlockCenter 27 27 border_size 1 1 1 1 … … 101 101 caption : 102 102 } 103 103 element TextArea(Example/Visibility/AssumedVisibility): Example/Visibility/Templates/BasicText 104 { 105 left 5 106 top 65 107 width 90 108 height 30 109 caption [A] Assumed Visibility 110 } 111 112 element TextArea(Example/Visibility/AssumedVisibilityInfo): Example/Visibility/Templates/BasicText 113 { 114 left 155 115 top 65 116 width 90 117 height 30 118 caption : 119 } 104 120 } 105 121 -
trunk/VUT/Ogre/src/OgreVisibilityOptionsManager.cpp
r100 r146 22 22 { 23 23 mVisibilityManager->SetVisibilityCullingThreshold(*static_cast<const int *>(val)); 24 return true; 25 } 26 if (key == "AssumedVisibility") 27 { 28 mVisibilityManager->SetAssumedVisibility(*static_cast<const int *>(val)); 24 29 return true; 25 30 } -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp
r145 r146 54 54 mTerrainContentGenerator(sceneGenerator), 55 55 mVisibilityThreshold(0), 56 mAssumedVisibility(0), 56 57 mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::COHERENT_HIERARCHICAL_CULLING), 57 58 //mCurrentAlgorithm(GtpVisibility::VisibilityEnvironment::FRUSTUM_CULLING), … … 109 110 mAlgorithmInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AlgorithmInfo"); 110 111 mThresholdInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ThresholdInfo"); 111 112 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo"); 113 mUseDepthPassInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseDepthPassInfo"); 114 mAssumedVisibilityInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/AssumedVisibilityInfo"); 115 112 116 mFrustumCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/FrustumCulledNodesInfo"); 113 117 mQueryCulledNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueryCulledNodesInfo"); … … 116 120 mRenderedNodesInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/RenderedNodesInfo"); 117 121 mObjectsInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/ObjectsInfo"); 118 mUseOptimizationInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseOptimizationInfo");119 mUseDepthPassInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/UseDepthPassInfo");120 122 mQueriesIssuedInfo = OverlayManager::getSingleton().getOverlayElement("Example/Visibility/QueriesIssuedInfo"); 121 123 … … 131 133 mUseDepthPassInfo->setCaption(": false"); 132 134 mQueriesIssuedInfo->setCaption(": 0"); 135 mAssumedVisibilityInfo->setCaption(": 0"); 133 136 134 137 … … 596 599 } 597 600 //----------------------------------------------------------------------- 601 void TerrainFrameListener::changeAssumedVisibility(int incr) 602 { 603 mAssumedVisibility += incr; 604 if(mAssumedVisibility < 0) mAssumedVisibility = 0; 605 606 char str[100]; sprintf(str,": %d", mAssumedVisibility); 607 608 mSceneMgr->setOption("AssumedVisibility", &mAssumedVisibility); 609 mAssumedVisibilityInfo->setCaption(str); 610 } 611 //----------------------------------------------------------------------- 598 612 void TerrainFrameListener::zoomVizCamera(int zoom) 599 613 { … … 869 883 break; 870 884 885 case KC_8: 886 changeAssumedVisibility(-1); 887 break; 888 case KC_9: 889 changeAssumedVisibility(1); 890 break; 871 891 case KC_LSHIFT: 872 892 mShiftPressed = true; -
trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h
r144 r146 107 107 void nextAppState(); 108 108 void changeThreshold(int incr); 109 109 void changeAssumedVisibility(int incr); 110 110 void toggleUseOptimization(); 111 111 void toggleShowOctree(); … … 136 136 int mCurrentAlgorithm; 137 137 int mVisibilityThreshold; 138 int mAssumedVisibility; 138 139 // the current frame number 139 140 int mCurrentFrame; … … 149 150 OverlayElement *mAlgorithmInfo; 150 151 OverlayElement *mThresholdInfo; 152 OverlayElement *mAssumedVisibilityInfo; 151 153 OverlayElement *mFrustumCulledNodesInfo; 152 154 OverlayElement *mQueryCulledNodesInfo;
Note: See TracChangeset
for help on using the changeset viewer.