Changeset 259 for trunk/VUT


Ignore:
Timestamp:
09/06/05 18:18:47 (19 years ago)
Author:
mattausch
Message:

refined measurements

Location:
trunk/VUT
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibility/src/CoherentHierarchicalCullingManager.cpp

    r254 r259  
    2525        unsigned int visiblePixels = 0; 
    2626        bool isAvailable = false; 
    27         Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling"); 
     27        //Ogre::LogManager::getSingleton().logMessage("Coherent Hierarchical Culling"); 
    2828 
    2929        //-- PART 1: process finished occlusion queries 
  • trunk/VUT/GtpVisibility/src/FrustumCullingManager.cpp

    r254 r259  
    77void FrustumCullingManager::RenderScene() 
    88{ 
    9         Ogre::LogManager::getSingleton().logMessage("Frustum Culling"); 
     9        //Ogre::LogManager::getSingleton().logMessage("Frustum Culling"); 
    1010        while (!mHierarchyInterface->GetQueue()->empty()) 
    1111        { 
     
    2727                } 
    2828                else 
    29                 {                
     29                { 
    3030                        mHierarchyInterface->SetNodeVisible(node, true); 
    3131                        mHierarchyInterface->TraverseNode(node); 
  • trunk/VUT/GtpVisibility/src/StopAndWaitCullingManager.cpp

    r254 r259  
    77void StopAndWaitCullingManager::RenderScene() 
    88{ 
    9         Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling"); 
     9        //Ogre::LogManager::getSingleton().logMessage("Stop and Wait Culling"); 
    1010        while (!mHierarchyInterface->GetQueue()->empty()) 
    1111        { 
  • trunk/VUT/Ogre/src/OgreVisibilityOctreeSceneManager.cpp

    r254 r259  
    436436        if (key == "NumHierarchyNodes") 
    437437        { 
    438                 * static_cast<unsigned int *>(val) = (unsigned int)mNumOctreeNodes; 
     438                * static_cast<unsigned int *>(val) = (unsigned int)mNumOctants; 
    439439                return true; 
    440440        } 
     
    473473          << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 
    474474          << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << "\n" 
    475           << "Hierarchy nodes: " << mNumOctreeNodes << ", "  
     475          << "Hierarchy nodes: " << mNumOctants << ", "  
    476476          << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 
    477477          << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " 
  • trunk/VUT/Ogre/src/OgreVisibilityTerrainSceneManager.cpp

    r254 r259  
    239239void VisibilityTerrainSceneManager::_renderVisibleObjects() 
    240240{ 
     241 
    241242        InitDepthPass();          // create material for depth pass 
    242243        InitItemBufferPass(); // create material for item buffer pass 
     
    282283 
    283284                TerrainSceneManager::_renderVisibleObjects(); 
    284                  
    285285 
    286286#ifdef GTP_VISIBILITY_MODIFIED_OGRE 
     
    293293                addSpecialCaseRenderQueue(RENDER_QUEUE_SKIES_LATE); 
    294294                addSpecialCaseRenderQueue(RENDER_QUEUE_OVERLAY); 
     295         
     296                // exclude this queues from hierarchical rendering 
    295297                setSpecialCaseRenderQueueMode(SceneManager::SCRQM_EXCLUDE); 
    296  
    297298 
    298299                // set all necessary parameters for  
     
    333334                // used for depth pass, transparents, overlay  
    334335                clearSpecialCaseRenderQueues(); 
     336 
    335337                TerrainSceneManager::_renderVisibleObjects(); 
    336338        } 
    337339                 
    338         // set the new render level index  
     340        // HACK: set the new render level index, important to avoid cracks 
     341        // in terrain caused by LOD 
    339342        TerrainRenderable::NextRenderLevelIndex(); 
    340343         
     
    345348        OGRE_DELETE(mRenderQueue); // HACK: should be cleared before... 
    346349        //WriteLog(); // write out stats 
     350 
    347351} 
    348352 
     
    438442        if (key == "NumHierarchyNodes") 
    439443        { 
    440                 * static_cast<unsigned int *>(val) = (unsigned int)mNumOctreeNodes; 
     444                * static_cast<unsigned int *>(val) = (unsigned int)mNumOctants; 
    441445                return true; 
    442446        } 
     
    477481          << "Use optimization: " << StringConverter::toString(mHierarchyInterface->GetTestGeometryForVisibleLeaves()) << ", " 
    478482          << "Algorithm type: " << mVisibilityManager->GetCullingManagerType() << ", " 
    479           << "Hierarchy nodes: " << mNumOctreeNodes << ", "  
     483          << "Hierarchy nodes: " << mNumOctants << ", "  
    480484          << "Traversed nodes: " << mHierarchyInterface->GetNumTraversedNodes() << ", " 
    481485          << "Rendered nodes: " << mHierarchyInterface->GetNumRenderedNodes() << ", " 
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.cpp

    r254 r259  
    190190         
    191191        // reset statistics 
    192         resetStats(); 
     192        mWalkthroughStats.Reset(); 
    193193}  
    194194//----------------------------------------------------------------------- 
     
    403403                /// set the current camera data to loaded frame information  
    404404                setCurrentFrameInfo(evt.timeSinceLastFrame); 
    405                 // HACK to produce demo 
    406                 addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame); 
     405                // HACK for demo 
     406                //addFrameInfo(mSavedFrameInfo, mCamNode, evt.timeSinceLastFrame); 
    407407                break; 
    408408        case WALKTHROUGH: 
     
    701701                mSavedFrameInfo.clear(); 
    702702 
    703                 float avgFps = (float)mAvgFps / (float)mFrameCount; 
    704  
    705                 //-- write out stats for recorded walkthrough 
    706703                std::stringstream d; 
    707                 d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 
    708                   //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 
    709                   << "avg. FPS: " << avgFps << "\n" 
    710                   << "best FPS: " << mWindow->getBestFPS() << "\n" 
    711                   << "worst FPS: " << mWindow->getWorstFPS() << "\n" 
    712                   << "best frame time: " <<     mWindow->getBestFrameTime() << "\n" 
    713                   << "worst frame time: " << mWindow->getWorstFrameTime(); 
     704                mWalkthroughStats.Print(d, msAlgorithmCaptions[mCurrentAlgorithm]); 
    714705                 
    715706                LogManager::getSingleton().logMessage(d.str()); 
     
    739730                        // reset, because we measure fps stats during walkthrough (warning: average fps broken) 
    740731                        mWindow->resetStatistics(); 
    741                         resetStats(); 
     732                        mWalkthroughStats.Reset(); 
    742733 
    743734                        //-- initialise frame data 
     
    827818        mAlgorithmInfo->setCaption(": " + msAlgorithmCaptions[mCurrentAlgorithm]); 
    828819        mSceneMgr->setOption("Algorithm", &mCurrentAlgorithm); 
    829 } 
    830 //----------------------------------------------------------------------- 
    831 void TerrainFrameListener::resetStats() 
    832 { 
    833         mAvgFps = 0; 
    834         mFrameCount = 0; 
    835820} 
    836821//----------------------------------------------------------------------- 
     
    848833        int currentFps = mWindow->getStatistics().lastFPS; 
    849834         
     835        // HACK for demo: use precomputed FPS 
    850836        if (mUseDemoFps) 
    851837                currentFps = mDemoFps; 
     
    863849#endif 
    864850         
     851        unsigned int nodeInfo[3]; 
     852    mSceneMgr->getOption("NumRenderedNodes", nodeInfo); 
     853        mSceneMgr->getOption("NumQueryCulledNodes", nodeInfo+1); 
     854        mSceneMgr->getOption("NumFrustumCulledNodes", nodeInfo+2); 
     855 
     856 
     857        mWalkthroughStats.UpdateFrame(currentFps, mWindow->getBestFPS(), mWindow->getWorstFPS(), 
     858                                                                  (int)mWindow->getTriangleCount(), nodeInfo[0], nodeInfo[1], nodeInfo[2]); 
     859 
    865860        // HACK: compute average fps ourselfs, because ogre avg. fps is wrong 
    866861        // TODO: update only once per second 
    867         mAvgFps += currentFps; 
    868         float avgFps = (float)mAvgFps / (float)(mFrameCount++); 
    869     
     862        float avgFps = (float)mWalkthroughStats.mAccFps / (float)(mWalkthroughStats.mFrameCount); 
     863         
     864 
    870865        // update stats when necessary 
    871866    try  
     
    895890                OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris"); 
    896891        guiTris->setCaption(trisString + StringConverter::toString(stats.triangleCount)); 
     892                 
     893                //LogManager::getSingleton().logMessage(StringConverter::toString(stats.triangleCount)); 
    897894 
    898895                OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText"); 
    899896                guiDbg->setCaption(mWindow->getDebugText()); 
     897 
    900898 
    901899                //-- culling stats 
  • trunk/VUT/work/TestCullingTerrain/TerrainFrameListener.h

    r254 r259  
    1919using namespace Ogre; 
    2020 
    21  
     21/** Struct storing walktrough statistics 
     22*/ 
     23struct WalkthroughStats 
     24{ 
     25public: 
     26 
     27        unsigned long mAccFps; 
     28        unsigned long mBestFps; 
     29        unsigned long mWorstFps; 
     30        unsigned long mAccTris; 
     31        unsigned long mAccQueryCulledNodes; 
     32        unsigned long mAccFrustumCulledNodes; 
     33        unsigned long mFrameCount; 
     34        unsigned long mAccRenderedNodes; 
     35         
     36        WalkthroughStats():  
     37        mAccFps(0), mBestFps(0), mWorstFps(0), mAccTris(0), 
     38        mAccQueryCulledNodes(0), mAccFrustumCulledNodes(0), 
     39        mFrameCount(0), mAccRenderedNodes(0) 
     40        {} 
     41 
     42        void Reset() 
     43        { 
     44                mAccFps = mBestFps = mWorstFps = mAccTris = mAccQueryCulledNodes = mAccFrustumCulledNodes = mFrameCount = mAccRenderedNodes = 0; 
     45        } 
     46 
     47        void UpdateFrame(int currentFps, int bestFps, int worstFps, int renderedTris, int renderedNodes, int queryCulledNodes, int frustumCulledNodes) 
     48        { 
     49                mAccFps += currentFps; 
     50                mBestFps = bestFps; 
     51                mWorstFps = worstFps; 
     52 
     53                // accumulated #triangles (M) 
     54                mAccTris += renderedTris / 1000; 
     55                mAccRenderedNodes += renderedNodes; 
     56                mAccQueryCulledNodes += queryCulledNodes; 
     57                mAccFrustumCulledNodes += frustumCulledNodes; 
     58         
     59                ++ mFrameCount; 
     60        } 
     61 
     62        void Print(std::ostream &d, const std::string &algorithmName) const 
     63        { 
     64                // compuate average fps and triangle count 
     65                float avgFps = (float)mAccFps / (float)mFrameCount; 
     66                float avgTris = (float)mAccTris / (float)mFrameCount; 
     67                float avgFrustumCulledNodes = 0; 
     68                float avgRenderedNodes = 0; 
     69                float avgQueryCulledNodes = 0; 
     70                 
     71                if (mFrameCount != 0) 
     72                { 
     73                        avgFrustumCulledNodes = (float)mAccFrustumCulledNodes / (float)mFrameCount; 
     74                        avgQueryCulledNodes  = (float)mAccQueryCulledNodes / (float)mFrameCount; 
     75                        avgRenderedNodes = (float)mAccRenderedNodes / (float) mFrameCount; 
     76                } 
     77 
     78                //-- write out stats for recorded walkthrough 
     79                d << "Algorithm: " << algorithmName << "\n" 
     80                        << "avg. FPS: " << avgFps << "\n" 
     81                        << "best FPS: " << mBestFps << "\n" 
     82                        << "worst FPS: " << mWorstFps << "\n" 
     83                        << "avg. #triangles: " << avgTris << " M\n" 
     84                        << "#frames: " << mFrameCount << "\n" 
     85                        << "avg. #query culled nodes: " << avgFrustumCulledNodes << "\n" 
     86                        << "avg. #frustum culled nodes: " << avgQueryCulledNodes << "\n" 
     87                        << "avg. #rendered nodes: " << avgRenderedNodes << "\n"; 
     88        } 
     89 
     90}; 
    2291 
    2392/** Frame listener specialised for terrains. 
     
    39108 
    40109   ~TerrainFrameListener(); 
    41  
    42110 
    43111   bool frameStarted(const FrameEvent& evt); 
     
    184252        void initVisStatsOverlay(); 
    185253        void initQueryOverlay(); 
    186  
    187         void resetStats(); 
    188254         
    189255        SceneManager *mSceneMgr;           // A pointer to the scene manager 
     
    206272        /// the newly created object 
    207273        SceneNode *mCurrentObject;     
    208 /// HACK 
    209 float mDemoFps; 
    210 bool mUseDemoFps; 
     274 
     275        WalkthroughStats mWalkthroughStats; 
     276 
     277        /// HACK for demo 
     278        float mDemoFps; 
     279        bool mUseDemoFps; 
     280 
    211281        OverlayElement *mAlgorithmInfo; 
    212282        OverlayElement *mThresholdInfo; 
     
    301371        bool mShiftPressed; 
    302372        bool mShowQueryStats; 
    303  
    304         unsigned long mAvgFps; 
    305         unsigned long mFrameCount; 
    306  
     373         
    307374        //bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn; 
    308375        PlatformQueryManager *mQueryManager; 
  • trunk/VUT/work/iv/IVFrameListener.cpp

    r254 r259  
    7878mDelayedTraversedNodes(0.0), 
    7979mApplication(app), 
    80 mMoveSpeed(15) 
     80mMoveSpeed(15), 
     81mAccumulatedTris(0), 
     82mAccumulatedFps(0) 
    8183{ 
    8284        mRaySceneQuery = mSceneMgr->createRayQuery( 
     
    420422                writeFrames(); 
    421423                 
    422                 float avgFps = (float)mAvgFps / (float)mFrameCount; 
     424                float avgFps = (float)mAccumulatedFps / (float)mFrameCount; 
     425                float avgTris = (float)mAccumulatedTris / (float)mFrameCount; 
    423426 
    424427                //-- write out stats for recorded walkthrough 
    425428                std::stringstream d; 
     429         
    426430                d << "Algorithm: " << msAlgorithmCaptions[mCurrentAlgorithm] << "\n" 
    427431                  //<< "avg. FPS: " << mWindow->getAverageFPS() << "\n" 
     
    430434                  << "worst FPS: " << mWindow->getWorstFPS() << "\n" 
    431435                  << "best frame time: " <<     mWindow->getBestFrameTime() << "\n" 
    432                   << "worst frame time: " << mWindow->getWorstFrameTime(); 
    433                  
     436                  << "worst frame time: " << mWindow->getWorstFrameTime() << "\n" 
     437                  << "avg. #triangles: " << avgTris << " M\n" 
     438                  << "#frames: " << mFrameCount < "\n"; 
     439 
    434440                LogManager::getSingleton().logMessage(d.str()); 
    435441        } 
     
    515521{ 
    516522        mCurrentAlgorithm = (mCurrentAlgorithm + 1) %  
    517                 (GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS - 1); 
     523                GtpVisibility::VisibilityEnvironment::NUM_CULLING_MANAGERS; 
    518524        setAlgorithm(mCurrentAlgorithm); 
    519525} 
     
    527533void IVFrameListener::resetStats() 
    528534{ 
    529         mAvgFps = 0; 
     535        mAccumulatedFps = 0; 
     536        mAccumulatedTris = 0; 
    530537        mFrameCount = 0; 
    531538} 
     
    544551        // HACK: compute average fps ourselfs, because ogre avg. fps is wrong 
    545552        // TODO: update only once per second 
    546         mAvgFps += mWindow->getStatistics().lastFPS; 
     553        mAccumulatedFps += mWindow->getStatistics().lastFPS; 
    547554        ++ mFrameCount; 
    548555         
    549         float avgFps = (float)mAvgFps / (float)mFrameCount; 
     556        float avgFps = (float)mAccumulatedFps / (float)mFrameCount; 
    550557     
    551558        // update stats when necessary 
  • trunk/VUT/work/iv/IVFrameListener.h

    r254 r259  
    237237        bool mShowQueryStats; 
    238238 
    239         unsigned long mAvgFps; 
     239        unsigned long mAccumulatedFps; 
     240        unsigned long mAccumulatedTris; 
    240241        unsigned long mFrameCount; 
    241242 
  • trunk/VUT/work/iv/TestCullingIVApplication.cpp

    r193 r259  
    9292        mSceneMgr->setOption("NodeVizScale", &scale); 
    9393        // HACK: change this to relative path 
    94         String path = "D:/gametools/trunk/VUT/Ogre/resources/"; 
     94        String path = "D:/svn/gtp/trunk/VUT/Ogre/resources/"; 
    9595                 
    9696        SceneNode *node1 = mSceneMgr->getRootSceneNode()->createChildSceneNode("Node1"); 
Note: See TracChangeset for help on using the changeset viewer.