Changeset 2292 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Timestamp:
- 03/26/07 18:49:17 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreOctreeHierarchyInterface.cpp
r2287 r2292 1 1 #include "OgreOctreeHierarchyInterface.h" 2 //#include "OgreVisibilityOctreeSceneManager.h"3 2 #include <OgreOctree.h> 4 3 #include <OgreLogManager.h> … … 70 69 int z = i & 1; 71 70 72 //std::stringstream d; d << x << " " << y << " " << z;73 //Ogre::LogManager::getSingleton().logMessage(d.str());74 75 71 if ((child = octree->mChildren[x][y][z]) != NULL) 76 72 { … … 78 74 } 79 75 } 80 81 //std::stringstream str; str << "nodes: " << nodes.size();82 //Ogre::LogManager::getSingleton().logMessage(str.str());83 76 84 77 if (nodes.empty()) … … 87 80 int r = (int)(((float)rand() / RAND_MAX) * ((float)nodes.size() - 0.5f)); 88 81 89 //std::stringstream str2;90 //str2 << "rand: " << r;91 //Ogre::LogManager::getSingleton().logMessage(str2.str());92 93 82 return GetRandomLeaf(nodes[r]); 94 // assume that at least one child is not NULL ...95 /*while (!child)96 {97 int mask = (int) (rand() * 8.0f);98 child = octree->mChildren[(mask & 4) / 4][(mask & 2) / 2][mask & 1];99 }100 101 return GetRandomLeaf(child);*/102 }103 //-----------------------------------------------------------------------104 void OctreeHierarchyInterface::TraverseNode2(GtpVisibility::HierarchyNode *node)105 {106 ++ mNumTraversedNodes;107 108 Octree *octree = static_cast<Octree *>(node);109 110 // if we come across some renderable geometry => render it111 //if (!octree->mNodes.empty())112 //{113 RenderNodeRecursive(node);114 //}115 116 /*117 // render everything from here118 if (octree->isOctreeFullyVisible())119 {120 RenderNodeRecursive(node);121 return;122 }123 124 RenderNode(node);125 }126 127 // if not all subtrees are empty128 if (!IsLeaf(node))129 {130 Octree *nextChild;131 132 if ((nextChild = octree->mChildren[0][0][0]) != NULL)133 mDistanceQueue->push(nextChild);134 if ((nextChild = octree->mChildren[0][0][1]) != NULL)135 mDistanceQueue->push(nextChild);136 if ((nextChild = octree->mChildren[0][1][0]) != NULL)137 mDistanceQueue->push(nextChild);138 if ((nextChild = octree->mChildren[0][1][1]) != NULL)139 mDistanceQueue->push(nextChild);140 if ((nextChild = octree->mChildren[1][0][0]) != NULL)141 mDistanceQueue->push(nextChild);142 if ((nextChild = octree->mChildren[1][0][1]) != NULL)143 mDistanceQueue->push(nextChild);144 if ((nextChild = octree->mChildren[1][1][0]) != NULL)145 mDistanceQueue->push(nextChild);146 if ((nextChild = octree->mChildren[1][1][1]) != NULL)147 mDistanceQueue->push(nextChild);148 }149 */150 83 } 151 84 //----------------------------------------------------------------------- … … 168 101 const Vector3 bmax = static_cast<Octree *>(node)->mBox.getMaximum(); 169 102 170 const Vector3 pos = (bmax - bmin) * 0.5 + bmin; 171 172 /* std::stringstream d; 173 d << "a: " << (mCameraPosition - pos).squaredLength() 174 << " b: " << (mCullCamera->getDerivedPosition() - pos).squaredLength(); 175 LogManager::getSingleton().logMessage(d.str());*/ 103 const Vector3 pos = (bmax - bmin) * 0.5f + bmin; 104 176 105 return (mCameraPosition - pos).squaredLength(); 177 106 } … … 206 135 } 207 136 //----------------------------------------------------------------------- 208 void OctreeHierarchyInterface::DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const137 /*void OctreeHierarchyInterface::PullUpFullVisibility(GtpVisibility::HierarchyNode *node) const 209 138 { 210 Octree *octant = static_cast<Octree *>(node); 211 212 // leaf node: terminate recursion 213 if (IsLeaf(node)) 214 { 215 octant->setOctreeFullyVisible(octant->isOctreeVisible()); 216 217 return; 218 } 219 220 octant->setOctreeFullyVisible(true); 221 222 Octree *nextChild; 223 139 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 140 Octree *octant = static_cast<Octree *>(node); 141 224 142 for (int i = 0; i < 8; ++ i) 225 143 { … … 228 146 int z = i & 1; 229 147 230 148 if ((nextChild = octant->mChildren[x][y][z]) != NULL) 231 149 { 232 150 DetermineFullVisibility(nextChild); … … 236 154 } 237 155 } 156 157 while (octant && !octant->isOctreeVisible()) 158 { 159 octant->setOctreeVisible(true); 160 octant = octant->getParent(); 161 } 162 #endif 163 }*/ 164 //----------------------------------------------------------------------- 165 void OctreeHierarchyInterface::DetermineFullVisibility(GtpVisibility::HierarchyNode *node) const 166 { 167 Octree *octant = static_cast<Octree *>(node); 168 169 // leaf node: terminate recursion 170 if (IsLeaf(node)) 171 { 172 octant->setOctreeFullyVisible(octant->isOctreeVisible()); 173 return; 174 } 175 176 octant->setOctreeFullyVisible(true); 177 178 Octree *nextChild; 179 180 for (int i = 0; i < 8; ++ i) 181 { 182 int x = (i & 4) / 4; 183 int y = (i & 2) / 2; 184 int z = i & 1; 185 186 if ((nextChild = octant->mChildren[x][y][z]) != NULL) 187 { 188 DetermineFullVisibility(nextChild); 189 // this leaf is not fully visible => break 190 if (!nextChild->isOctreeFullyVisible()) 191 octant->setOctreeFullyVisible(false); 192 } 193 } 238 194 } 239 195 //----------------------------------------------------------------------- … … 264 220 Octree *octant = static_cast<Octree *>(node); 265 221 266 if ( 1)//octant->lastRendered() != mFrameId)222 if (octant->lastRendered() != mFrameId) 267 223 { 268 224 octant->setLastRendered(mFrameId); … … 351 307 } 352 308 } 309 //----------------------------------------------------------------------- 310 void OctreeHierarchyInterface::CollectLeaves(GtpVisibility::HierarchyNode *root, 311 GtpVisibility::HierarchyNodeContainer &nodes) 312 { 313 std::stack<GtpVisibility::HierarchyNode *> tStack; 314 tStack.push(root); 315 316 Octree *child; 317 318 while (!tStack.empty()) 319 { 320 GtpVisibility::HierarchyNode *node = tStack.top(); 321 tStack.pop(); 322 323 if (IsLeaf(node)) 324 { 325 nodes.push_back(node); 326 } 327 else 328 { 329 Octree *octree = static_cast<Octree *>(node); 330 331 for (int i = 0; i < 8; ++ i) 332 { 333 int x = (i & 4) / 4; 334 int y = (i & 2) / 2; 335 int z = i & 1; 336 337 if ((child = octree->mChildren[x][y][z]) != NULL) 338 { 339 tStack.push(child); 340 } 341 } 342 } 343 } 344 } 353 345 354 346 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/Plugin_VisibilitySceneManager.vcproj
r2280 r2292 322 322 AdditionalLibraryDirectories=""$(OGRE_PATH)\PlugIns\OctreeSceneManager\bin\Release";"$(OGRE_PATH)\OgreMain\lib\Release";"$(OGRE_PATH)\Samples\Common\CEGUIRenderer\lib";..\..\GtpVisibility\lib\Release;..\..\lib\Release;..\lib\Release;"$(OGRE_PATH)\Dependencies\lib\Release";..\..\..\Preprocessing\lib\Release;..\..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\Preprocessing\src\GL;"$(CG_LIB_PATH)";..\..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\Lib\Vis\Preprocessing\MultiLevelRayTracing\RTWorld\Release;..\..\..\..\..\Lib\Vis\Preprocessing\MultiLevelRayTracing\RTScene\Release;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\IVReader\lib\Release;..\..\..\..\..\Lib\Vis\OnlineCullingCHC\ObjReader\lib\Release" 323 323 ModuleDefinitionFile="..\misc\OgreVisibilitySceneManager.def" 324 GenerateDebugInformation=" FALSE"324 GenerateDebugInformation="TRUE" 325 325 SubSystem="2" 326 326 OptimizeReferences="2"
Note: See TracChangeset
for help on using the changeset viewer.