Changeset 2259 for GTP/trunk/Lib/Vis/OnlineCullingCHC
- Timestamp:
- 03/18/07 01:27:51 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreBvHierarchyInterface.h
r2258 r2259 97 97 void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 98 98 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 99 GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 99 100 }; 100 101 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeHierarchyInterface.h
r2258 r2259 96 96 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 97 97 98 void TraverseNode2(GtpVisibility::HierarchyNode *node) ;98 void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 99 99 100 HierarchyNode *GetRandomLeaf() { return NULL;}100 GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 101 101 102 102 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 103 103 104 }; 104 105 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreOctreeHierarchyInterface.h
r2258 r2259 55 55 void TraverseNode2(GtpVisibility::HierarchyNode *node); 56 56 57 HierarchyNode *GetRandomLeaf();57 GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *node); 58 58 59 59 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const; 60 60 61 void RenderNodeRecursive(GtpVisibility::HierarchyNode *node); 62 63 61 64 protected: 65 62 66 /** Returns pointer to the bounding box of the node. 63 67 @param node current hierarchy node -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreSceneNodeHierarchyInterface.h
r2258 r2259 48 48 void DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const {} 49 49 void TraverseNode2(GtpVisibility::HierarchyNode *node) {} 50 HierarchyNode *GetRandomLeaf() { return NULL;}50 GtpVisibility::HierarchyNode *GetRandomLeaf(GtpVisibility::HierarchyNode *root) { return NULL;} 51 51 bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const { return false;} 52 52 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r2258 r2259 51 51 } 52 52 //----------------------------------------------------------------------- 53 HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf()53 GtpVisibility::HierarchyNode *OctreeHierarchyInterface::GetRandomLeaf(GtpVisibility::HierarchyNode *root) 54 54 { 55 return NULL; 56 } 57 //----------------------------------------------------------------------- 58 bool OctreeHierarchyInterface::GIsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 59 { 60 return static_cast<Octree *>(node)->isOctreeFullyVisible(); 55 if (IsLeaf(root)) 56 return root; 57 58 Octree *octree = static_cast<Octree *>(root); 59 60 int mask = (int) (rand() * 8); 61 62 // random decision 63 Octree *child = octree->mChildren[mask & 1][mask & 2][mask & 3]; 64 65 return GetRandomLeaf(child); 61 66 } 62 67 //----------------------------------------------------------------------- … … 214 219 } 215 220 //----------------------------------------------------------------------- 221 void OctreeHierarchyInterface::RenderNodeRecursive(GtpVisibility::HierarchyNode *node) 222 { 223 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 224 Octree *octant = static_cast<Octree *>(node); 225 226 if (octant->lastRendered() != mFrameId) 227 { 228 octant->setLastRendered(mFrameId); 229 OctreeSceneManager *ocm = 230 static_cast<OctreeSceneManager *>(mSceneManager); 231 232 ocm->_renderOctantRecursive(mCamera, 233 octant, 234 mOnlyShadowCasters, 235 mLeavePassesInQueue); 236 237 mVisibleNodes.push_back(node); 238 } 239 #endif 240 } 241 //----------------------------------------------------------------------- 216 242 bool OctreeHierarchyInterface::IsNodeVisible(GtpVisibility::HierarchyNode *node) const 217 243 { … … 223 249 } 224 250 //----------------------------------------------------------------------- 251 bool OctreeHierarchyInterface::IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const 252 { 253 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 254 return static_cast<Octree *>(node)->isOctreeFullyVisible(); 255 #else 256 return true; 257 #endif 258 } 259 //----------------------------------------------------------------------- 225 260 unsigned int OctreeHierarchyInterface::LastVisited(GtpVisibility::HierarchyNode *node) const 226 261 { -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/HierarchyInterface.h
r2258 r2259 163 163 virtual void TraverseNode2(GtpVisibility::HierarchyNode *node) = 0; 164 164 165 virtual HierarchyNode *GetRandomLeaf( ) = 0;166 virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const ;165 virtual HierarchyNode *GetRandomLeaf(HierarchyNode *root) = 0; 166 virtual bool IsNodeFullyVisible(GtpVisibility::HierarchyNode *node) const = 0; 167 167 168 168 protected: -
GTP/trunk/Lib/Vis/OnlineCullingCHC/include/RandomUpdateCullingManager.h
r2258 r2259 30 30 31 31 protected: 32 32 33 /** Decides if node is considered to be visible depeding on the 33 34 assumed visibility factor. … … 35 36 */ 36 37 bool DecideVisible(HierarchyNode *node) const; 37 38 38 39 39 /** Skip query for this node. … … 45 45 unsigned int mAssumedVisibility; 46 46 47 /** Threshold for rand function to return positive result with respect to48 mAssumedVisibility.47 /** Threshold for rand function to return positive result 48 with respect to mAssumedVisibility. 49 49 */ 50 50 int mThreshold; 51 52 int mRandomCandidates; 51 53 }; 52 54 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/src/RandomUpdateCullingManager.cpp
r2258 r2259 10 10 // initialise random generator in case we use assumed visibility 11 11 srand(time(NULL)); 12 13 mRandomCandidates = 1; 12 14 } 13 15 //----------------------------------------------------------------------- … … 18 20 // initialise random generator in case we use assumed visibility 19 21 srand(time(NULL)); 22 23 mRandomCandidates = 1; 20 24 } 21 25 //----------------------------------------------------------------------- … … 45 49 // in case geometry is in interior node: 46 50 // ensure that we only traverse once 47 if (!mHierarchyInterface->IsNodeVisible(node)) 51 if (!mHierarchyInterface->IsNodeVisible(node) && 52 !mHierarchyInterface->IsNodeFullyVisible(node)) 48 53 { 49 54 mHierarchyInterface->TraverseNode(node); … … 105 110 { 106 111 // node fully visible => test only random leaves 107 /*for (int i = 0; i < mRandomCandidates; ++ i)112 for (int i = 0; i < mRandomCandidates; ++ i) 108 113 { 109 114 HierarchyNode *randomLeaf = mHierarchyInterface->GetRandomLeaf(node); … … 116 121 117 122 queryQueue.push(QueryPair(node, 118 mHierarchyInterface->IssueNodeOcclusionQuery(node, wasVisible))); 119 }*/ 123 mHierarchyInterface->IssueNodeOcclusionQuery(node))); 124 125 mHierarchyInterface->TraverseNode2(node); 126 } 120 127 121 128 continue; … … 151 158 } 152 159 } 160 161 // update the fully visible classifications 162 mHierarchyInterface->DetermineFullVisibility(mHierarchyInterface->GetHierarchyRoot()); 153 163 } 154 164 //-----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.