Changeset 1312 for GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Timestamp:
- 09/01/06 13:48:15 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h
r1296 r1312 483 483 typedef std::set<LeafPtr> LeafSet; 484 484 485 typedef struct Stats_485 struct TreeStats 486 486 { 487 487 unsigned int mNumNodes; … … 494 494 mNumLeaves = 0; 495 495 mNumSceneNodes = 0; 496 }; 497 } Stats; 496 } 497 }; 498 499 struct FrameStats 500 { 501 unsigned int mTraversedNodes; 502 unsigned int mRenderedNodes; 503 unsigned int mFrustumCulledNodes; 504 505 void clear(void) 506 { 507 mTraversedNodes = 0; 508 mRenderedNodes = 0; 509 mFrustumCulledNodes = 0; 510 } 511 }; 498 512 499 513 enum RenderMethod … … 571 585 572 586 // self-explanatory ... 573 int getMaxDepth(void) { return mMaxDepth; }; 574 const Stats& getStats(void) const { return mStats; }; 575 AxisAlignedBox getBox(void) { if (mKdRoot) return mKdRoot->mAABB; else return AxisAlignedBox(); }; 587 int getMaxDepth(void) { return mMaxDepth; } 588 const TreeStats& getTreeStats(void) const { return mTreeStats; } 589 const FrameStats& getFramesStats(void) const { return mFrameStats; } 590 AxisAlignedBox getBox(void) { if (mKdRoot) return mKdRoot->mAABB; else return AxisAlignedBox(); } 576 591 void setBuildMethod(BuildMethod bm) { mBuildMethod = bm; } 577 592 protected: … … 627 642 Log * mBuildLog; 628 643 629 // statistical information 630 Stats mStats; 644 // statistical information on the tree 645 TreeStats mTreeStats; 646 647 // statistical info on a single rendered frame 648 FrameStats mFrameStats; 631 649 632 650 /** Visualization flags **/ … … 638 656 bool mShowNodes; 639 657 640 // pointer zur getVisibility function (simple oder enhanced) 658 // function pointer to the getVisibility function 659 // allows choosing between regular vis (NONE/PART, same es isVisible) 660 // and enhaced vis (NONE/PART/FULL) for early traversal abort 641 661 KdTreeCamera::NodeVisibility (KdTreeCamera::*getVisibility)(const AxisAlignedBox& box) const; 642 662 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h
r1250 r1312 28 28 }; 29 29 30 //typedef NodeVisibility (KdTreeCamera::*VisFunction)(const AxisAlignedBox& box) const;31 32 30 // default constructor 33 31 KdTreeCamera(const String& name, SceneManager *sm); 34 32 // default destructor 35 33 ~KdTreeCamera(); 36 37 // chage vis mode38 void setEnhancedVisMode(bool enhanced);39 // query vis mode40 bool getEnhancedVisMode(void);41 42 // function pointer to the actual getvis function43 // allows choosing between regular vis (NONE/PART, same es isVisible)44 // and enhaced vis (NONE/PART/FULL) for early traversal abort45 //NodeVisibility (KdTreeCamera::*getVisibility)(const AxisAlignedBox& box) const;46 //VisFunction getVisibility;47 //NodeVisibility getVisibility(const AxisAlignedBox& box ) const;48 34 49 35 // regular visibility, like isVisible … … 52 38 NodeVisibility getVisibilityEnhanced(const AxisAlignedBox& box) const; 53 39 54 // DEBUG 55 //mutable unsigned int mNumVisQueries; 56 protected: 57 58 // flag indicating current vis mode, default is on (true) 59 bool mEnhancedVisMode; 40 // statistical info 41 mutable unsigned int mNumVisQueries; 60 42 }; 61 43 -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp
r1296 r1312 877 877 unsigned long t1, t2, t3, t4; 878 878 879 m Stats.clear();879 mTreeStats.clear(); 880 880 881 881 // data we want to collect … … 890 890 t3 = timer->getMicroseconds(); // DEBUG 891 891 892 m Stats.mNumSceneNodes = nObjects;892 mTreeStats.mNumSceneNodes = nObjects; 893 893 894 894 assert(! aabb.isNull() && "Teh stubid worldAABB iz NULL ... waht now?"); … … 924 924 mBuildLog->logMessage("Total time: " + StringConverter::toString(t4 - t1) + "µs"); 925 925 mBuildLog->logMessage("Tree Depth: " + StringConverter::toString(mMaxDepth)); 926 mBuildLog->logMessage("Number of Objects: " + StringConverter::toString(m Stats.mNumSceneNodes));927 mBuildLog->logMessage("Number of Leaves: " + StringConverter::toString(m Stats.mNumLeaves));928 mBuildLog->logMessage("Number of Nodes: " + StringConverter::toString(m Stats.mNumNodes));926 mBuildLog->logMessage("Number of Objects: " + StringConverter::toString(mTreeStats.mNumSceneNodes)); 927 mBuildLog->logMessage("Number of Leaves: " + StringConverter::toString(mTreeStats.mNumLeaves)); 928 mBuildLog->logMessage("Number of Nodes: " + StringConverter::toString(mTreeStats.mNumNodes)); 929 929 mBuildLog->logMessage("Total cost: " + StringConverter::toString(calcCost())); 930 930 mBuildLog->logMessage("################################"); … … 1044 1044 } 1045 1045 // update stats 1046 ++ m Stats.mNumNodes;1047 ++ m Stats.mNumLeaves;1046 ++ mTreeStats.mNumNodes; 1047 ++ mTreeStats.mNumLeaves; 1048 1048 // update bounding box 1049 1049 leaf->_updateBounds(false); … … 1128 1128 1129 1129 // update stats 1130 ++ m Stats.mNumNodes;1130 ++ mTreeStats.mNumNodes; 1131 1131 1132 1132 // update bounding box … … 1196 1196 topNode = leaf; 1197 1197 // update stats 1198 ++ m Stats.mNumNodes;1199 ++ m Stats.mNumLeaves;1198 ++ mTreeStats.mNumNodes; 1199 ++ mTreeStats.mNumLeaves; 1200 1200 } 1201 1201 … … 1310 1310 1311 1311 // update stats 1312 ++ m Stats.mNumNodes;1312 ++ mTreeStats.mNumNodes; 1313 1313 } 1314 1314 … … 1399 1399 bool showBoxes, KdTree::NodeList& visibleNodes) 1400 1400 { 1401 // debug1402 //cam->mNumVisQueries = 0;1401 mFrameStats.clear(); 1402 cam->mNumVisQueries = 0; 1403 1403 1404 1404 if (mKdRoot) … … 1406 1406 cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 1407 1407 1408 //mBuildLog->logMessage("Frame # " + StringConverter::toString(Root::getSingleton().getCurrentFrameNumber()) + 1409 // " ," + StringConverter::toString(cam->mNumVisQueries) + " vis queries"); 1408 mFrameStats.mTraversedNodes = cam->mNumVisQueries; 1410 1409 } 1411 1410 … … 1420 1419 if (fullVis || 1421 1420 ((vis = (cam->*getVisibility)(node->mAABB)) != KdTreeCamera::KDNV_NONE)) 1422 //((vis = (cam->*getVisibility)(node->mAABB)) != KdTreeCamera::KDNV_NONE))1423 1421 { 1424 1422 visibleNodes.push_back(node); 1425 1423 1426 1424 bool v = (fullVis || vis == KdTreeCamera::KDNV_FULL); 1425 1427 1426 node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, v); 1427 1428 if (v || node->isLeaf()) 1429 ++ mFrameStats.mRenderedNodes; 1428 1430 1429 1431 if (!v) … … 1437 1439 cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 1438 1440 } 1441 } 1442 else 1443 { 1444 ++ mFrameStats.mFrustumCulledNodes; 1439 1445 } 1440 1446 } -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp
r1250 r1312 14 14 15 15 KdTreeCamera::KdTreeCamera(const String& name, SceneManager *sm): 16 Camera(name, sm), 17 mEnhancedVisMode(true) 16 Camera(name, sm) 18 17 { 19 //getVisibility = getVisibilityEnhanced; 18 20 19 } 21 20 … … 25 24 } 26 25 27 void KdTreeCamera::setEnhancedVisMode(bool enhanced)28 {29 mEnhancedVisMode = enhanced;30 }31 32 bool KdTreeCamera::getEnhancedVisMode()33 {34 return mEnhancedVisMode;35 }36 37 26 //----------------------------------------------------------------------- 38 27 // enhanced vis calculation - borrowed from OctreeCamera - indicate when entire box inside the frustum 39 28 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilityEnhanced(const AxisAlignedBox& box) const 40 29 { 41 //++ mNumVisQueries; 30 ++ mNumVisQueries; 31 42 32 // Null boxes always invisible 43 33 if ( box.isNull() ) … … 98 88 KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilitySimple(const AxisAlignedBox& box) const 99 89 { 100 //++ mNumVisQueries;90 ++ mNumVisQueries; 101 91 102 92 // dummy … … 112 102 } 113 103 114 //KdTreeCamera::NodeVisibility KdTreeCamera::getVisibility(const AxisAlignedBox& box) const115 //{116 // // dummy117 // FrustumPlane* culledBy = 0;118 // if (mCullFrustum)119 // {120 // return mCullFrustum->isVisible(box, culledBy) ? KDNV_PART : KDNV_NONE;121 // }122 // else123 // {124 // return Frustum::isVisible(box, culledBy) ? KDNV_PART : KDNV_NONE;125 // }126 //}127 104 } // namespace Ogre -
GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp
r1304 r1312 44 44 mLeavePassesInQueue(0), 45 45 mDelayRenderTransparents(true), 46 mUseDepthPass( true),46 mUseDepthPass(false), 47 47 mIsDepthPassPhase(false), 48 48 mUseItemBuffer(false), … … 462 462 } 463 463 // vis options 464 else if (strKey == "NumFrustumCulledNodes") 465 { 466 if (mRenderMethod == KdTree::KDRM_INTERNAL) 467 { 468 unsigned int numnodes = 0; 469 if (mKdTree) 470 numnodes = mKdTree->getFramesStats().mFrustumCulledNodes; 471 472 * static_cast<unsigned int *>(pDestValue) = (unsigned int)numnodes; 473 return true; 474 } 475 // otherwise let fall through to VisibilityOptionsManager 476 } 477 else if (strKey == "NumQueryCulledNodes") 478 { 479 if (mRenderMethod == KdTree::KDRM_INTERNAL) 480 { 481 * static_cast<unsigned int *>(pDestValue) = 0; 482 return true; 483 } 484 // otherwise let fall through to VisibilityOptionsManager 485 } 464 486 else if (strKey == "NumHierarchyNodes") 465 487 { 466 488 unsigned int numnodes = 0; 467 489 if (mKdTree) 468 numnodes = mKdTree->get Stats().mNumNodes;490 numnodes = mKdTree->getTreeStats().mNumNodes; 469 491 470 492 * static_cast<unsigned int *>(pDestValue) = (unsigned int)numnodes; 471 493 return true; 494 } 495 else if (strKey == "NumRenderedNodes") 496 { 497 if (mRenderMethod == KdTree::KDRM_INTERNAL) 498 { 499 unsigned int numnodes = 0; 500 if (mKdTree) 501 numnodes = mKdTree->getFramesStats().mRenderedNodes; 502 503 * static_cast<unsigned int *>(pDestValue) = (unsigned int)numnodes; 504 return true; 505 } 506 // otherwise let fall through to VisibilityOptionsManager 507 } 508 else if (strKey == "NumQueriesIssued") 509 { 510 if (mRenderMethod == KdTree::KDRM_INTERNAL) 511 { 512 * static_cast<unsigned int *>(pDestValue) = 0; 513 return true; 514 } 515 // otherwise let fall through to VisibilityOptionsManager 516 } 517 else if (strKey == "NumTraversedNodes") 518 { 519 if (mRenderMethod == KdTree::KDRM_INTERNAL) 520 { 521 unsigned int numnodes = 0; 522 if (mKdTree) 523 numnodes = mKdTree->getFramesStats().mTraversedNodes; 524 525 * static_cast<unsigned int *>(pDestValue) = (unsigned int)numnodes; 526 return true; 527 } 528 // otherwise let fall through to VisibilityOptionsManager 472 529 } 473 530 else if (strKey == "VisibilityManager") … … 1357 1414 << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 1358 1415 << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 1359 << "Hierarchy nodes: " << (mKdTree ? mKdTree->get Stats().mNumNodes : 0) << ", "1416 << "Hierarchy nodes: " << (mKdTree ? mKdTree->getTreeStats().mNumNodes : 0) << ", " 1360 1417 << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 1361 1418 << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", "
Note: See TracChangeset
for help on using the changeset viewer.