Changeset 1312


Ignore:
Timestamp:
09/01/06 13:48:15 (18 years ago)
Author:
szydlowski
Message:

per-frame-stats with internal rendering - use depth pass issue unresolved

Location:
GTP/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTree.cpp

    r1304 r1312  
    623623                mSceneMgr->setOption("RenderMethod", &mOptions.mRenderMethod); 
    624624                mSceneMgr->setOption("EnhancedVisibility", &mOptions.mEnhancedVisibility); 
    625                 mSceneMgr->setOption("DeleteRenderQueue", &mOptions.mDelRenderQueue); 
    626                 // fix 
    627                 bool depthpass = false; 
    628                 mSceneMgr->setOption("UseDepthPass", &depthpass); 
    629625        } 
    630626        // set algorithm when scene manager is OCM - numbering is different though 
     
    633629                int alg = CONV_KDT_TO_OCM_ALG(mOptions.mRenderMethod); 
    634630                mSceneMgr->setOption("Algorithm", &alg); 
    635                 mSceneMgr->setOption("DeleteRenderQueue", &mOptions.mDelRenderQueue); 
    636         } 
     631        } 
     632        bool vizcullnodes = true; 
     633        mSceneMgr->setOption("VisualizeCulledNodes", &vizcullnodes); 
     634        mSceneMgr->setOption("DeleteRenderQueue", &mOptions.mDelRenderQueue); 
     635 
     636        // fix 
     637        //bool depthpass = true; 
     638        //mSceneMgr->setOption("UseDepthPass", &depthpass); 
    637639 
    638640        // create ray query for ground intersection 
  • GTP/trunk/App/Demos/Vis/KdTreeDemo/OGRE/src/TestKdTreeAppListener.cpp

    r1304 r1312  
    432432{ 
    433433        // viewcells apply only for scenes loaded from geometry 
    434         if (mOptions.mSceneType != ST_GEOMETRY) 
     434        if (mOptions.mSceneType != ST_GEOMETRY ||  
     435                mOptions.myApp->getViewCellsFileName().empty()) 
    435436                return; 
    436437 
     
    445446                // call once to load view cell loading overlay 
    446447                mWindow->update(); 
    447                 mViewCellsLoaded = mSceneMgr->setOption("LoadViewCells", mOptions.myApp->getViewCellsFileName().c_str()); 
     448                mViewCellsLoaded = mSceneMgr->setOption("LoadViewCells",  
     449                        mOptions.myApp->getViewCellsFileName().c_str()); 
    448450 
    449451                if (!mViewCellsLoaded) 
     
    746748        { 
    747749                toggleRenderMethod(); 
     750                mTimeUntilNextToggle = 0.5; 
     751        } 
     752 
     753        if (mInputDevice->isKeyDown(KC_V) && mTimeUntilNextToggle <= 0) 
     754        { 
     755                toggleEnhancedVisibility(); 
    748756                mTimeUntilNextToggle = 0.5; 
    749757        } 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTree.h

    r1296 r1312  
    483483                typedef std::set<LeafPtr> LeafSet; 
    484484 
    485                 typedef struct Stats_ 
     485                struct TreeStats 
    486486                { 
    487487                        unsigned int mNumNodes; 
     
    494494                                mNumLeaves = 0; 
    495495                                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                }; 
    498512 
    499513                enum RenderMethod 
     
    571585 
    572586                // 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(); } 
    576591                void setBuildMethod(BuildMethod bm) { mBuildMethod = bm; } 
    577592        protected: 
     
    627642                Log * mBuildLog; 
    628643 
    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; 
    631649 
    632650                /** Visualization flags **/ 
     
    638656                bool mShowNodes; 
    639657 
    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 
    641661                KdTreeCamera::NodeVisibility (KdTreeCamera::*getVisibility)(const AxisAlignedBox& box) const; 
    642662 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/include/OgreKdTreeCamera.h

    r1250 r1312  
    2828        }; 
    2929 
    30         //typedef NodeVisibility (KdTreeCamera::*VisFunction)(const AxisAlignedBox& box) const; 
    31  
    3230        // default constructor 
    3331        KdTreeCamera(const String& name, SceneManager *sm); 
    3432        // default destructor 
    3533        ~KdTreeCamera(); 
    36  
    37         // chage vis mode 
    38         void setEnhancedVisMode(bool enhanced); 
    39         // query vis mode 
    40         bool getEnhancedVisMode(void); 
    41  
    42         // function pointer to the actual getvis function 
    43         // allows choosing between regular vis (NONE/PART, same es isVisible) 
    44         // and enhaced vis (NONE/PART/FULL) for early traversal abort 
    45         //NodeVisibility (KdTreeCamera::*getVisibility)(const AxisAlignedBox& box) const; 
    46         //VisFunction getVisibility; 
    47         //NodeVisibility getVisibility(const AxisAlignedBox& box ) const; 
    4834 
    4935        // regular visibility, like isVisible 
     
    5238        NodeVisibility getVisibilityEnhanced(const AxisAlignedBox& box) const; 
    5339 
    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; 
    6042}; 
    6143 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTree.cpp

    r1296 r1312  
    877877        unsigned long t1, t2, t3, t4; 
    878878 
    879         mStats.clear(); 
     879        mTreeStats.clear(); 
    880880         
    881881        // data we want to collect 
     
    890890        t3 = timer->getMicroseconds(); // DEBUG 
    891891 
    892         mStats.mNumSceneNodes = nObjects; 
     892        mTreeStats.mNumSceneNodes = nObjects; 
    893893 
    894894        assert(! aabb.isNull() && "Teh stubid worldAABB iz NULL ... waht now?"); 
     
    924924        mBuildLog->logMessage("Total time: " + StringConverter::toString(t4 - t1) + "µs"); 
    925925        mBuildLog->logMessage("Tree Depth: " + StringConverter::toString(mMaxDepth)); 
    926         mBuildLog->logMessage("Number of Objects: " + StringConverter::toString(mStats.mNumSceneNodes)); 
    927         mBuildLog->logMessage("Number of Leaves: " + StringConverter::toString(mStats.mNumLeaves)); 
    928         mBuildLog->logMessage("Number of Nodes: " + StringConverter::toString(mStats.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)); 
    929929        mBuildLog->logMessage("Total cost: " + StringConverter::toString(calcCost())); 
    930930        mBuildLog->logMessage("################################"); 
     
    10441044                } 
    10451045                // update stats 
    1046                 ++ mStats.mNumNodes; 
    1047                 ++ mStats.mNumLeaves; 
     1046                ++ mTreeStats.mNumNodes; 
     1047                ++ mTreeStats.mNumLeaves; 
    10481048                // update bounding box 
    10491049                leaf->_updateBounds(false); 
     
    11281128 
    11291129                // update stats 
    1130                 ++ mStats.mNumNodes; 
     1130                ++ mTreeStats.mNumNodes; 
    11311131 
    11321132                // update bounding box 
     
    11961196                                topNode = leaf; 
    11971197                        // update stats 
    1198                         ++ mStats.mNumNodes; 
    1199                         ++ mStats.mNumLeaves; 
     1198                        ++ mTreeStats.mNumNodes; 
     1199                        ++ mTreeStats.mNumLeaves; 
    12001200                } 
    12011201 
     
    13101310 
    13111311                        // update stats 
    1312                         ++ mStats.mNumNodes; 
     1312                        ++ mTreeStats.mNumNodes; 
    13131313                } 
    13141314 
     
    13991399        bool showBoxes, KdTree::NodeList& visibleNodes) 
    14001400{ 
    1401         // debug 
    1402         //cam->mNumVisQueries = 0; 
     1401        mFrameStats.clear(); 
     1402        cam->mNumVisQueries = 0; 
    14031403 
    14041404        if (mKdRoot) 
     
    14061406                        cam, queue, onlyShadowCasters, showBoxes, visibleNodes); 
    14071407 
    1408         //mBuildLog->logMessage("Frame # " + StringConverter::toString(Root::getSingleton().getCurrentFrameNumber()) + 
    1409         //      " ," + StringConverter::toString(cam->mNumVisQueries) + " vis queries"); 
     1408        mFrameStats.mTraversedNodes = cam->mNumVisQueries; 
    14101409} 
    14111410 
     
    14201419        if (fullVis ||  
    14211420                ((vis = (cam->*getVisibility)(node->mAABB)) != KdTreeCamera::KDNV_NONE)) 
    1422                 //((vis = (cam->*getVisibility)(node->mAABB)) != KdTreeCamera::KDNV_NONE)) 
    14231421        { 
    14241422                visibleNodes.push_back(node); 
    14251423 
    14261424                bool v = (fullVis || vis == KdTreeCamera::KDNV_FULL); 
     1425 
    14271426                node->queueVisibleObjects(currentFrame, cam, queue, onlyShadowCasters, showBoxes, v); 
     1427 
     1428                if (v || node->isLeaf()) 
     1429                        ++ mFrameStats.mRenderedNodes; 
    14281430 
    14291431                if (!v) 
     
    14371439                                cam, queue, onlyShadowCasters, showBoxes, visibleNodes, v); 
    14381440                } 
     1441        } 
     1442        else 
     1443        { 
     1444                ++ mFrameStats.mFrustumCulledNodes; 
    14391445        } 
    14401446} 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeCamera.cpp

    r1250 r1312  
    1414 
    1515KdTreeCamera::KdTreeCamera(const String& name, SceneManager *sm): 
    16 Camera(name, sm),  
    17 mEnhancedVisMode(true) 
     16Camera(name, sm) 
    1817{ 
    19         //getVisibility = getVisibilityEnhanced; 
     18 
    2019} 
    2120 
     
    2524} 
    2625 
    27 void KdTreeCamera::setEnhancedVisMode(bool enhanced) 
    28 { 
    29         mEnhancedVisMode = enhanced; 
    30 } 
    31  
    32 bool KdTreeCamera::getEnhancedVisMode() 
    33 { 
    34         return mEnhancedVisMode; 
    35 } 
    36  
    3726//----------------------------------------------------------------------- 
    3827// enhanced vis calculation - borrowed from OctreeCamera - indicate when entire box inside the frustum 
    3928KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilityEnhanced(const AxisAlignedBox& box) const 
    4029{ 
    41         //++ mNumVisQueries; 
     30        ++ mNumVisQueries; 
     31         
    4232        // Null boxes always invisible 
    4333        if ( box.isNull() ) 
     
    9888KdTreeCamera::NodeVisibility KdTreeCamera::getVisibilitySimple(const AxisAlignedBox& box) const 
    9989{ 
    100         //++ mNumVisQueries; 
     90        ++ mNumVisQueries; 
    10191 
    10292        // dummy 
     
    112102} 
    113103 
    114 //KdTreeCamera::NodeVisibility KdTreeCamera::getVisibility(const AxisAlignedBox& box) const 
    115 //{ 
    116 //      // dummy 
    117 //      FrustumPlane* culledBy = 0; 
    118 //      if (mCullFrustum) 
    119 //      { 
    120 //              return mCullFrustum->isVisible(box, culledBy) ? KDNV_PART : KDNV_NONE; 
    121 //      } 
    122 //      else 
    123 //      { 
    124 //              return Frustum::isVisible(box, culledBy) ? KDNV_PART : KDNV_NONE; 
    125 //      } 
    126 //} 
    127104} // namespace Ogre 
  • GTP/trunk/Lib/Vis/OnlineCullingCHC/OGRE/src/OgreKdTreeSceneManager.cpp

    r1304 r1312  
    4444mLeavePassesInQueue(0), 
    4545mDelayRenderTransparents(true), 
    46 mUseDepthPass(true), 
     46mUseDepthPass(false), 
    4747mIsDepthPassPhase(false), 
    4848mUseItemBuffer(false), 
     
    462462        } 
    463463        // 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        } 
    464486        else if (strKey == "NumHierarchyNodes") 
    465487        { 
    466488                unsigned int numnodes = 0; 
    467489                if (mKdTree) 
    468                         numnodes = mKdTree->getStats().mNumNodes; 
     490                        numnodes = mKdTree->getTreeStats().mNumNodes; 
    469491 
    470492                * static_cast<unsigned int *>(pDestValue) = (unsigned int)numnodes; 
    471493                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 
    472529        } 
    473530        else if (strKey == "VisibilityManager") 
     
    13571414                << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 
    13581415                << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 
    1359                 << "Hierarchy nodes: " << (mKdTree ? mKdTree->getStats().mNumNodes : 0) << ", "  
     1416                << "Hierarchy nodes: " << (mKdTree ? mKdTree->getTreeStats().mNumNodes : 0) << ", "  
    13601417                << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 
    13611418                << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " 
Note: See TracChangeset for help on using the changeset viewer.