Show
Ignore:
Timestamp:
10/31/06 15:07:34 (2 years ago)
Author:
dshipton
Message:

Can set a minimum triangle count before a test query is issued.
within testOcclusionCulling this knob is T/t (increase/decrease)

Files:

Legend:

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

    r363 r371  
    259259    if(_rt->getOcclusionCullingQueryBufferSize() != _numTestSamples || !_isOccSetup) 
    260260    { 
    261 #if 0 
    262         if( _testSamples ) 
    263         { 
    264             std::cout << "deleting" << std::endl; 
    265             delete [] _testSamples; 
    266             // Should probably delete queries too.... 
    267         } 
    268 #endif 
    269261        _numTestSamples = _rt->getOcclusionCullingQueryBufferSize(); 
    270262        //std::cout << "Buf size: " << _numTestSamples << std::endl; 
     
    317309    _visPixelThreshold = _rt->getOcclusionCullingVisibilityThreshold(); 
    318310    _coveredProbThreshold = _rt->getOcclusionCullingCoveredThreshold(); 
     311    _minTriangleCount = _rt->getOcclusionCullingMinimumTriangleCount(); 
    319312    _inTesting = false; 
    320313     
     
    421414        min[0] = osgClamp(-1.f, min[0], 1.f); 
    422415        min[1] = osgClamp(-1.f, min[1], 1.f); 
    423         //std::cout << min << std::endl; 
    424         //std::cout << max << std::endl; 
    425         //v.transform(worldToCam); 
    426          
    427         //Real32 pix = (max[0] - min[0]) * (max[1] - min[1]) * ((pix_width/2.0f)*(pix_height/2.0f)); 
    428         //Real32 cbb = pix / (pix_width * pix_height); 
    429416         
    430417        // cbb is the percent of the screen real estate this would cover 
     
    435422 
    436423//Make decision 
    437  
    438424         
    439425        if(pNode->hasFunctor() == false) //Nothing to do 
     
    461447                if(pcov > _coveredProbThreshold || cbb < 0.001) // If within threshold or reall small 
    462448                { 
     449                    //Get triangles 
     450                    GeoStatsAttachmentPtr st = 
     451                            GeoStatsAttachment::get(pNode->getNode()); 
     452                    st->validate(); 
     453                    UInt32 triangles = st->getTriangles(); 
     454 
    463455                    if(cbb * _vpWidth * _vpHeight < _minFeatureSize) //small feature culling 
    464456                    {                 
    465457                        StatCollector *sc = _rt->getStatistics(); 
    466                         GeoStatsAttachmentPtr st = 
    467                                 GeoStatsAttachment::get(pNode->getNode()); 
    468                         st->validate(); 
    469458                        _rt->getStatistics()->getElem(statNOccTriangles)-> 
    470                                 add(st->getTriangles()); 
     459                                add(triangles); 
    471460                        if(_rt->getOcclusionCullingDebug() && pNode->getNode()) 
    472461                        { 
     
    478467                        pNode->setIsRendered(true); 
    479468                    } 
    480                     else if(_testPendingNodes.size() == _numTestSamples - 1) // Make sure we have room to draw a test 
     469                    else if( triangles <= _minTriangleCount ) 
     470                    { 
     471                        drawNode(pNode, denv, part); 
     472                    } 
     473                    else if((_testPendingNodes.size() == _numTestSamples - 1)) // Make sure we have room to draw a test 
    481474                    { 
    482475                        drawTestResults(denv, part);