Changeset 2258 for GTP/trunk/Lib/Vis/OnlineCullingCHC
- Timestamp:
- 03/18/07 00:26:49 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h
r1320 r2258 61 61 @param visible the visible flag 62 62 */ 63 virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const; 63 virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, 64 const bool visible) const; 64 65 /** Returns true if node has the visible flag set. See set 65 66 */ … … 69 70 @param frameId the current frame id 70 71 */ 71 virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const; 72 virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, 73 const unsigned int frameId) const; 72 74 /** Returns frame id when this node was last visited by the traverser. See set 73 75 */ … … 80 82 */ 81 83 virtual void VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 82 GtpVisibility::CullingType type) const;84 GtpVisibility::CullingType type) const; 83 85 84 86 … … 89 91 */ 90 92 virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 91 GtpVisibility::GeometryVector *geometryList,92 bool includeChildren);93 GtpVisibility::GeometryVector *geometryList, 94 bool includeChildren); 93 95 94 96 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 97 void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 98 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 95 99 }; 96 100 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeHierarchyInterface.h
r1170 r2258 61 61 @param visible the visible flag 62 62 */ 63 virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, const bool visible) const; 63 virtual void SetNodeVisible(GtpVisibility::HierarchyNode *node, 64 const bool visible) const; 64 65 /** Returns true if node has the visible flag set. See set 65 66 */ … … 69 70 @param frameId the current frame id 70 71 */ 71 virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, const unsigned int frameId) const; 72 virtual void SetLastVisited(GtpVisibility::HierarchyNode *node, 73 const unsigned int frameId) const; 72 74 /** Returns frame id when this node was last visited by the traverser. See set 73 75 */ … … 80 82 */ 81 83 virtual void VisualizeCulledNode(GtpVisibility::HierarchyNode *node, 82 GtpVisibility::CullingType type) const;84 GtpVisibility::CullingType type) const; 83 85 84 86 … … 89 91 */ 90 92 virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 91 GtpVisibility::GeometryVector *geometryList,92 bool includeChildren);93 GtpVisibility::GeometryVector *geometryList, 94 bool includeChildren); 93 95 96 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 94 97 98 void TraverseNode2(GtpVisibility::HierarchyNode *node); 99 100 HierarchyNode *GetRandomLeaf() { return NULL;} 101 102 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 95 103 }; 96 104 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOctreeHierarchyInterface.h
r370 r2258 51 51 bool includeChildren); 52 52 53 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const; 54 55 void TraverseNode2(GtpVisibility::HierarchyNode *node); 56 57 HierarchyNode *GetRandomLeaf(); 58 59 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 60 53 61 protected: 54 62 /** Returns pointer to the bounding box of the node. -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreSceneNodeHierarchyInterface.h
r370 r2258 46 46 bool includeChildren); 47 47 48 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 49 void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 50 HierarchyNode *GetRandomLeaf() { return NULL;} 51 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 52 48 53 }; 49 54 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreBvHierarchyInterface.cpp
r2066 r2258 49 49 } 50 50 51 51 52 void BvHierarchyInterface::RenderNode(GtpVisibility::HierarchyNode *node) 52 53 { … … 62 63 } 63 64 } 65 64 66 65 67 void BvHierarchyInterface::PullUpVisibility(GtpVisibility::HierarchyNode *node) const -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOcclusionCullingSceneManager.cpp
r2255 r2258 12 12 #include <OgreIteratorWrappers.h> 13 13 #include <OgreHeightmapTerrainPageSource.h> 14 #include "VspBspTree.h" 15 #include "Containers.h" 14 //#include "Containers.h" 16 15 #include "ViewCellsManager.h" 17 16 #include <OgreConfigFile.h> 18 17 #include "OgreTypeConverter.h" 19 18 #include "OgreMeshInstance.h" 20 #include "common.h"19 //#include "common.h" 21 20 #include "OgreBoundingBoxConverter.h" 22 21 #include <OgreManualObject.h> … … 775 774 bool onlyShadowCasters) 776 775 { 777 // clear render queue778 // fully reset it after some frames779 const bool flushQueue =780 mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0);781 getRenderQueue()->clear(flushQueue);782 783 ++ mCurrentFrame;784 785 776 if (mShowVisualization) 786 777 { … … 790 781 PrepareVisualization(cam); 791 782 792 783 // lists only used for visualization 793 784 mVisible.clear(); 794 785 mBoxes.clear(); … … 797 788 } 798 789 799 800 mVisible.clear();801 mBoxes.clear();802 803 790 /////////// 804 791 //-- set visibility according to pvs of current view cell … … 820 807 else if (mUseDepthPass) 821 808 { 809 mVisible.clear(); 810 mBoxes.clear(); 811 812 // clear render queue before depth pass 813 getRenderQueue()->clear(); 814 822 815 // render scene once in order to fill depth buffer 823 816 RenderHierarchicalCulling(); 824 817 } 825 826 // only shadow casters will be rendered in shadow texture pass827 //if (0) mHierarchyInterface->SetOnlyShadowCasters(onlyShadowCasters);828 818 } 829 819 //----------------------------------------------------------------------- … … 838 828 } 839 829 840 //const bool flushQueue = mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 841 //++ mCurrentFrame; 830 // clear render queue 831 // fully reset it after some frames 832 const bool flushQueue = 833 mDeleteQueueAfterRendering && ((mCurrentFrame % mFlushRate) == 0); 834 835 ++ mCurrentFrame; 842 836 843 837 // create material for item buffer pass … … 956 950 957 951 // remove rest from queue 958 #if 0959 952 getRenderQueue()->clear(flushQueue); 960 #endif 953 961 954 962 955 if (0) WriteLog(); // write out stats -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r2066 r2258 9 9 10 10 //----------------------------------------------------------------------- 11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, RenderSystem *rsys): 11 OctreeHierarchyInterface::OctreeHierarchyInterface(OctreeSceneManager *sm, 12 RenderSystem *rsys): 12 13 SceneNodeHierarchyInterface(sm, rsys) 13 { 14 } 14 {} 15 15 //----------------------------------------------------------------------- 16 16 void OctreeHierarchyInterface::TraverseNode(GtpVisibility::HierarchyNode *node) … … 27 27 28 28 29 // if not all subtrees are empty 30 if (!IsLeaf(node)) 31 { 32 Octree *nextChild; 33 34 if ((nextChild = octree->mChildren[0][0][0]) != NULL) 35 mDistanceQueue->push(nextChild); 36 if ((nextChild = octree->mChildren[0][0][1]) != NULL) 37 mDistanceQueue->push(nextChild); 38 if ((nextChild = octree->mChildren[0][1][0]) != NULL) 39 mDistanceQueue->push(nextChild); 40 if ((nextChild = octree->mChildren[0][1][1]) != NULL) 41 mDistanceQueue->push(nextChild); 42 if ((nextChild = octree->mChildren[1][0][0]) != NULL) 43 mDistanceQueue->push(nextChild); 44 if ((nextChild = octree->mChildren[1][0][1]) != NULL) 45 mDistanceQueue->push(nextChild); 46 if ((nextChild = octree->mChildren[1][1][0]) != NULL) 47 mDistanceQueue->push(nextChild); 48 if ((nextChild = octree->mChildren[1][1][1]) != NULL) 49 mDistanceQueue->push(nextChild); 50 } 51 } 52 //----------------------------------------------------------------------- 53 HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf() 54 { 55 return NULL; 56 } 57 //----------------------------------------------------------------------- 58 bool OctreeHierarchyInterface::GIsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 59 { 60 return static_cast<Octree *>(node)->isOctreeFullyVisible(); 61 } 62 //----------------------------------------------------------------------- 63 void OctreeHierarchyInterface::TraverseNode2(GtpVisibility::HierarchyNode *node) 64 { 65 ++ mNumTraversedNodes; 66 67 Octree *octree = static_cast<Octree *>(node); 68 69 // if we come across some renderable geometry => render it 70 if (!octree->mNodes.empty()) 71 { 72 // render everything from here 73 if (octree->isOctreeFullyVisible()) 74 { 75 RenderNodeRecursive(node); 76 return; 77 } 78 79 RenderNode(node); 80 } 81 29 82 // if not all subtrees are empty 30 83 if (!IsLeaf(node)) … … 107 160 } 108 161 //----------------------------------------------------------------------- 162 void OctreeHierarchyInterface::DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const 163 { 164 Octree *octant = static_cast<Octree *>(node); 165 166 // leaf node: terminate recursion 167 if (IsLeaf(node)) 168 { 169 octant->setOctreeFullyVisible(octant->isOctreeVisible()); 170 return; 171 } 172 173 octant->setOctreeFullyVisible(false); 174 175 Octree *nextChild; 176 177 for (int i = 0; i < 8; ++ i) 178 { 179 int x = i & 4; 180 int y = i & 2; 181 int z = i & 1; 182 183 if ((nextChild = octant->mChildren[x][y][z]) != NULL) 184 { 185 DetermineFullVisibility(nextChild); 186 if (!nextChild->isOctreeFullyVisible()) 187 return; 188 } 189 } 190 191 // all children fully visible => pull up 192 octant->setOctreeFullyVisible(true); 193 } 194 //----------------------------------------------------------------------- 109 195 void OctreeHierarchyInterface::RenderNode(GtpVisibility::HierarchyNode *node) 110 196 { … … 118 204 static_cast<OctreeSceneManager *>(mSceneManager); 119 205 120 ocm->_renderOctant(mCamera, octant, mOnlyShadowCasters, mLeavePassesInQueue); 206 ocm->_renderOctant(mCamera, 207 octant, 208 mOnlyShadowCasters, 209 mLeavePassesInQueue); 121 210 122 211 mVisibleNodes.push_back(node); 123 212 } 124 #endif 125 213 #endif 126 214 } 127 215 //----------------------------------------------------------------------- … … 189 277 } 190 278 279 191 280 } // namespace Ogre -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h
r925 r2258 84 84 @param intersects returns true if the current node intersects the near plane 85 85 */ 86 virtual bool CheckFrustumVisible(HierarchyNode *node, bool &intersects) = 0; 86 virtual bool CheckFrustumVisible(HierarchyNode *node, 87 bool &intersects) = 0; 87 88 /** Checks if the node is visible from the current view frustum. 88 89 @param node the current node … … 102 103 @param visible the visible flag 103 104 */ 104 virtual void SetNodeVisible(HierarchyNode *node, const bool visible) const = 0; 105 virtual void SetNodeVisible(HierarchyNode *node, 106 const bool visible) const = 0; 105 107 /** Returns true if node has the visible flag set. See set 106 108 */ … … 143 145 */ 144 146 virtual void GetNodeGeometryList(GtpVisibility::HierarchyNode *node, 145 GeometryVector *geometryList,146 bool includeChildren) = 0;147 GeometryVector *geometryList, 148 bool includeChildren) = 0; 147 149 148 150 … … 156 158 void TestGeometryForVisibleLeaves(bool testGeometry); 157 159 160 161 virtual void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const = 0; 162 163 virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) = 0; 164 165 virtual HierarchyNode *GetRandomLeaf() = 0; 166 virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 158 167 159 168 protected: -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/CoherentHierarchicalCullingManager.cpp
r2184 r2258 12 12 } 13 13 //----------------------------------------------------------------------- 14 CoherentHierarchicalCullingManager::CoherentHierarchicalCullingManager( const unsigned int15 14 CoherentHierarchicalCullingManager::CoherentHierarchicalCullingManager( 15 const unsigned int assumedVisibility) 16 16 { 17 17 SetAssumedVisibility(assumedVisibility); … … 67 67 if (!mHierarchyInterface->GetQueue()->empty()) 68 68 { 69 //Ogre::LogManager::getSingleton().logMessage("traversal");70 69 HierarchyNode *node = mHierarchyInterface->GetQueue()->top(); 71 70 mHierarchyInterface->GetQueue()->pop(); … … 96 95 DecideVisible(node) && mHierarchyInterface->HasGeometry(node); 97 96 98 //if (mHierarchyInterface->LastVisited(node) >= mHierarchyInterface->GetFrameId())99 // Ogre::LogManager::getSingleton().logMessage("error");100 101 97 if (skipQuery) 102 98 { … … 115 111 // update node's visited flag 116 112 mHierarchyInterface->SetLastVisited(node, mHierarchyInterface->GetFrameId()); 117 //Ogre::LogManager::getSingleton().logMessage("here999");113 118 114 // skip testing previously visible nodes without geometry 119 115 if (issueQuery) -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/GtpVisibility.vcproj
r2183 r2258 315 315 </File> 316 316 <File 317 RelativePath=".\RandomUpdateCullingManager.cpp"> 318 </File> 319 <File 317 320 RelativePath="..\src\StopAndWaitCullingManager.cpp"> 318 321 </File> … … 360 363 <File 361 364 RelativePath="..\include\QueryManager.h"> 365 </File> 366 <File 367 RelativePath="..\include\RandomUpdateCullingManager.h"> 362 368 </File> 363 369 <File
Note: See TracChangeset
for help on using the changeset viewer.