Changeset 285

Show
Ignore:
Timestamp:
10/12/06 17:57:02 (2 years ago)
Author:
dshipton
Message:

Tweeking Heuristics of whether to test or draw.

Files:

Legend:

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

    r282 r285  
    7676UInt32 OcclusionCullingTreeBuilder::_funcEndQueryARB= Window::invalidFunctionID; 
    7777 
     78StatElemDesc<StatIntElem> OcclusionCullingTreeBuilder::statNOccNodes( 
     79    "OC-Nodes",  
     80    "total number of nodes tested for occlusion"); 
     81 
    7882StatElemDesc<StatIntElem> OcclusionCullingTreeBuilder::statNOccTests( 
    7983    "OC-Tests",  
     
    8286    "OC-Invisible",  
    8387    "number of nodes found invisible through occlusion"); 
     88 
     89StatElemDesc<StatRealElem> OcclusionCullingTreeBuilder::statNOccSuccessTestPer( 
     90    "OC-Sucess",  
     91    "percentage of successful tests for occlusion"); 
    8492 
    8593// Some typedefs to clean up OpenGL extension handling 
     
    215223    testNode(_pRoot, denv, part, screen_covered_percentage); 
    216224     
     225    StatCollector *sc = _rt->getStatistics(); 
     226    sc->getElem(statNOccNodes    )->add(uNumNodes); 
    217227    uNumNodes=0; 
    218228    _uiActiveMatrix = 0; 
     
    220230    leaveTesting(denv, part); 
    221231         
     232//RESULTS / RE-DRAW    
    222233    drawTestResults(_pRoot, denv, part); 
    223 //RESULTS / RE-DRAW    
    224234 
    225235    //std::cout << "Calc Pixels" << std::endl; 
     
    227237 
    228238  
    229     StatCollector *sc = _rt->getStatistics(); 
    230     sc->getElem(statNOccTests    )->set(_currSample); 
    231     sc->getElem(statNOccInvisible)->set(uNumNodes); 
    232      
    233     //std::cout << std::endl; 
     239    sc->getElem(statNOccTests    )->add(_currSample); 
     240    sc->getElem(statNOccInvisible)->add(uNumNodes); 
     241    Real32 percentage = (Real32)sc->getElem(statNOccInvisible)->get() / (Real32)sc->getElem(statNOccTests)->get(); 
     242    sc->getElem(statNOccSuccessTestPer)->set(percentage); 
     243 
     244     
    234245    //std::cout << "Real pixels " << std::endl; 
    235246    //std::cout << " Next" << std::endl; 
     247    //std::cout << std::endl; 
    236248 
    237249   // screen_covered_percentage = 1.0; 
     
    324336        { 
    325337            //renderNode 
    326             drawNode(pNode, denv, part); 
     338            //drawNode(pNode, denv, part); 
    327339        } 
    328340        else 
  • branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGOcclusionCullingTreeBuilder.h

    r280 r285  
    188188    static UInt32 _funcEndQueryARB; 
    189189 
     190    static StatElemDesc<StatIntElem> statNOccNodes; 
    190191    static StatElemDesc<StatIntElem> statNOccTests; 
    191192    static StatElemDesc<StatIntElem> statNOccInvisible; 
     193    static StatElemDesc<StatRealElem> statNOccSuccessTestPer; 
    192194 
    193195    GLuint* _testSamples; 
     
    196198    bool    _inTesting;  //!< Whether in testing mode or not 
    197199     
    198     static const int _nBuckets = 1000;     //!< number of buckets for approximate sorting 
     200    static const int _nBuckets = 2000;     //!< number of buckets for approximate sorting 
    199201    std::vector<RenderTreeNode*> _buckets; //!< buckets for approximate sorting 
    200202 
  • branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGRenderPartition.cpp

    r280 r285  
    447447    if(_eMode == SimpleCallback) 
    448448        return; 
    449  
    450449    RenderTraversalAction *rt = dynamic_cast<RenderTraversalAction *>(_oDrawEnv.getRTAction()); 
    451450 
     
    532531        Pnt3r min,max; 
    533532        objVol.getBounds(min,max); 
    534         _currMatrix.second.mult(min); 
    535         _currMatrix.second.mult(max); 
    536         objPos = min; 
    537         if(min[2] < max[2]) 
    538         { 
    539             objPos[2] = max[2]; 
     533        Pnt3r p[8]; 
     534        p[0].setValues(min[0],min[1],min[2]); 
     535        p[1].setValues(max[0],min[1],min[2]); 
     536        p[2].setValues(min[0],max[1],min[2]); 
     537        p[3].setValues(min[0],min[1],max[2]); 
     538        p[4].setValues(max[0],max[1],min[2]); 
     539        p[5].setValues(max[0],min[1],max[2]); 
     540        p[6].setValues(min[0],max[1],max[2]); 
     541        p[7].setValues(max[0],max[1],max[2]); 
     542        for(UInt32 i = 0; i<8;i++) 
     543        { 
     544            _currMatrix.second.mult(p[i]); 
     545        } 
     546        objPos = p[0]; 
     547        for(UInt32 i = 1; i<8; i++) 
     548        { 
     549            if(p[0][2] < objPos[2]) 
     550                objPos[2] = p[0][2]; 
    540551        } 
    541552         
     
    556567            pNewElem->setStateOverride(_sStateOverrides.top()); 
    557568        } 
    558  
    559569        mapIt->second->add(_oDrawEnv, 
    560570                           this,