Show
Ignore:
Timestamp:
10/21/06 13:50:48 (2 years ago)
Author:
dirk
Message:

Added Tri and occed tri stats
added NVPerfKitSDK demo stats in testOcclusionCulling.cpp. These should become core stats later…

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGRenderPartition.cpp

    r285 r342  
    6464#include "OSGOcclusionCullingTreeBuilder.h" 
    6565 
     66#include "OSGGeoStatsAttachment.h" 
     67 
    6668OSG_USING_NAMESPACE 
    6769 
     
    174176    _oStatistics             (      ), 
    175177    _uiNumMatrixChanges      (     0), 
     178    _uiNumTriangles          (     0), 
    176179    _visibilityStack         (      ), 
    177180 
     
    283286    } 
    284287 
     288    _uiNumTriangles = 0; 
    285289/* 
    286290    static FrustumVolume empty; 
     
    385389         
    386390        _uiNumMatrixChanges = 0; 
    387  
     391  
    388392        while(mapIt != mapEnd) 
    389393        { 
     
    447451    if(_eMode == SimpleCallback) 
    448452        return; 
     453         
    449454    RenderTraversalAction *rt = dynamic_cast<RenderTraversalAction *>(_oDrawEnv.getRTAction()); 
    450455 
     456    NodePtr actNode = rt->getActNode(); 
     457     
     458    // Add Stats 
     459    GeoStatsAttachmentPtr st; 
     460    st = GeoStatsAttachment::get(actNode); 
     461    if(st == NullFC) 
     462    { 
     463        GeoStatsAttachment::addTo(actNode); 
     464         
     465        st = GeoStatsAttachment::get(actNode); 
     466    } 
     467 
     468    st->validate(); 
     469 
     470    _oStatistics.getElem(RenderTraversalAction::statNTriangles)-> 
     471        add(st->getTriangles()); 
     472    _uiNumTriangles += st->getTriangles(); 
     473 
     474     
     475     
    451476    if(_bSortTrans == true && pState->isTransparent() == true) 
    452477    { 
     
    475500        Pnt3f         objPos; 
    476501         
    477         _oDrawEnv.getRTAction()->getActNode()->getVolume().getCenter(objPos); 
     502        actNode->getVolume().getCenter(objPos); 
    478503         
    479504        _currMatrix.second.mult(objPos); 
    480505         
    481         pNewElem->setNode       (&*_oDrawEnv.getRTAction()->getActNode()); 
     506        pNewElem->setNode       (&*actNode); 
    482507        pNewElem->setFunctor    ( func      ); 
    483508        pNewElem->setMatrixStore(_currMatrix); 
     
    528553 
    529554        DynamicVolume     objVol; 
    530         objVol = _oDrawEnv.getRTAction()->getActNode()->getVolume(); 
     555        objVol = actNode->getVolume(); 
    531556        Pnt3r min,max; 
    532557        objVol.getBounds(min,max); 
     
    554579 
    555580        pNewElem->setVol        ( objVol ); 
    556         pNewElem->setNode       (&*_oDrawEnv.getRTAction()->getActNode()); 
     581        pNewElem->setNode       (&*actNode); 
    557582 
    558583        pNewElem->setFunctor    ( func      ); 
     
    599624        StateOverride  *pOverride = NULL; 
    600625 
    601         pNewElem->setNode       (&*_oDrawEnv.getRTAction()->getActNode()); 
     626        pNewElem->setNode       (&*actNode); 
    602627        pNewElem->setFunctor    (func        ); 
    603628        pNewElem->setMatrixStore(_currMatrix ); 
     
    665690        return true; 
    666691       
    667     _oStatistics.getElem(statCullTestedNodes)->inc(); 
     692    _oStatistics.getElem(statCullTestedNodes)->inc();  
     693    _oDrawEnv.getRTAction()->getStatistics()->getElem(statCullTestedNodes)->inc(); 
    668694     
    669695    DynamicVolume vol; 
     
    682708     
    683709    _oStatistics.getElem(statCulledNodes)->inc(); 
     710    _oDrawEnv.getRTAction()->getStatistics()->getElem(statCulledNodes)->inc(); 
    684711 
    685712// fprintf(stderr,"%p: node 0x%p invis\n", Thread::getCurrent(), node); 
     
    722749 
    723750    _oStatistics.getElem(statCullTestedNodes)->inc(); 
     751    _oDrawEnv.getRTAction()->getStatistics()->getElem(statCullTestedNodes)->inc(); 
    724752 
    725753    if(intersect(frustum, vol, inplanes) == false) 
     
    730758 
    731759        _oStatistics.getElem(statCulledNodes)->inc(); 
     760        _oDrawEnv.getRTAction()->getStatistics()->getElem(statCulledNodes)->inc(); 
    732761 
    733762//        fprintf(stderr,"node 0x%p invis %0xp\n", &(*pNode), this);