Changeset 2258 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Timestamp:
- 03/18/07 00:26:49 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.