Changeset 2281 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 03/22/07 18:51:14 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r2280 r2281 58 58 Octree *octree = static_cast<Octree *>(root); 59 59 60 int mask = (int) (rand() * 8.0f);61 62 60 // random decision 63 61 Octree *child = NULL; 64 62 65 while (!child) 63 std::vector<Octree *> nodes; 64 65 //LogManager::getSingleton().logMessage("***"); 66 for (int i = 0; i < 8; ++ i) 67 { 68 int x = (i & 4) / 4; 69 int y = (i & 2) / 2; 70 int z = i & 1; 71 72 if ((child = octree->mChildren[x][y][z]) != NULL) 73 { 74 nodes.push_back(child); 75 } 76 } 77 78 if (nodes.empty()) 79 return NULL; 80 81 int r = (int) (rand() * (float)nodes.size()); 82 83 return GetRandomLeaf(nodes[r]); 84 // assume that at least one child is not NULL ... 85 /*while (!child) 86 { 87 int mask = (int) (rand() * 8.0f); 66 88 child = octree->mChildren[(mask & 4) / 4][(mask & 2) / 2][mask & 1]; 67 68 return GetRandomLeaf(child); 89 } 90 91 return GetRandomLeaf(child);*/ 69 92 } 70 93 //-----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.