Changeset 273

Show
Ignore:
Timestamp:
10/11/06 10:38:05 (2 years ago)
Author:
dshipton
Message:

Sort on closest face instead of just center of BB.

Files:

Legend:

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

    r272 r273  
    130130        return; 
    131131    } 
    132      
     132 
     133//SETUP 
    133134    _uiActiveMatrix = 0; 
    134135    Real32 screen_covered_percentage = 0.f; 
     
    141142     
    142143    //glGenQueriesARB(uNumNodes, queries); 
    143     std::cout << "Calculated Pixels" << std::endl; 
     144    //std::cout << "Calculated Pixels" << std::endl; 
     145 
     146//DRAW / TEST / RE-DRAW ON BUFFER FULL 
    144147    drawNode(_pRoot, denv, part, screen_covered_percentage, current_node, queries); 
     148//RESULTS / RE-DRAW    
     149 
    145150    //std::cout << "Calc Pixels" << std::endl; 
    146151 
     
    152157    sc->getElem(statNOccInvisible)->set(0); // Just create it 
    153158     
    154     std::cout << std::endl; 
    155     std::cout << "Real pixels " << std::endl; 
     159    //std::cout << std::endl; 
     160    //std::cout << "Real pixels " << std::endl; 
    156161    for(UInt32 i = 1; i<uNumNodes; i++) 
    157162    { 
     
    180185        getquiv(queries[i], GL_QUERY_RESULT_ARB, &sampleCount); 
    181186        //glGetQueryObjectuivARB(queries[i], GL_QUERY_RESULT_ARB, &sampleCount); 
    182         std::cout << i << ":" << sampleCount << " "; 
     187        //std::cout << i << ":" << sampleCount << " "; 
    183188         
    184189        if(sampleCount == 0) 
    185190            sc->getElem(statNOccInvisible)->inc(); 
    186191    } 
    187     std::cout << std::endl; 
     192    //std::cout << std::endl; 
    188193 
    189194   // screen_covered_percentage = 1.0; 
     
    196201    while (pNode != NULL) 
    197202    { 
     203    //MATRIX SETUP 
    198204        Viewport* vp = denv.getViewport(); 
    199205        Int32 pix_width = vp->getPixelWidth(); 
     
    225231            // inverted. This corrects this behavior. 
    226232 
     233// DRAW SPECIFIC 
    227234            if(part->_bCorrectTwoSidedLighting) 
    228235            { 
     
    293300        pix = (max[0] - min[0]) * (max[1] - min[1]) * ((pix_width/2.0f)*(pix_height/2.0f)); 
    294301         
    295         std::cout << cur_node << ":" << pix << " "; 
    296  //       std::cout << max - min << std::endl; 
    297  
    298          
     302        //std::cout << cur_node << ":" << pix << " "; 
     303        //std::cout << pNode->getScalar() << std::endl; 
     304 
     305//STATE ACTIVATION         
    299306        State         *pNewState         = pNode->getState(); 
    300307        StateOverride *pNewStateOverride = pNode->getStateOverride(); 
     
    302309        denv.activateState(pNewState, pNewStateOverride); 
    303310 
     311//DRAW DRAW DRAW 
    304312        Window* win = denv.getWindow(); 
    305313         
     
    307315        if(pNode->hasFunctor() == true) 
    308316        { 
    309             std::cout << " D "; 
    310317            BeginQueryT beginq = (BeginQueryT) win->getFunction(_funcBeginQueryARB); 
    311318            beginq(GL_SAMPLES_PASSED_ARB, queries[cur_node]); 
    312             if(1) 
     319            if(0 == 1) 
    313320            { 
    314321               //glPushMatrix(); 
     
    356363               //glPopMatrix(); 
    357364            } 
    358             else 
     365            else if ( 9 == 9 ) 
    359366            { 
    360367                drawVolume(volume); 
     
    370377 
    371378 
     379//DRAW CHILDREN OR GO TO TOP AND DO IT AGAIN 
    372380        if(pNode->getFirstChild() != NULL) 
    373381        { 
     
    434442        } 
    435443    } 
     444    //std::cout << "Added : " << uNumNodes << std::endl; 
    436445     
    437446} 
  • branches/Dirk_RenderTraversalWork/Source/System/Action/RenderTraversal/OSGRenderPartition.cpp

    r271 r273  
    519519        Pnt3f         objPos; 
    520520         
    521         _oDrawEnv.getRTAction()->getActNode()->getVolume().getCenter(objPos); 
    522          
    523         _currMatrix.second.mult(objPos); 
     521        //_oDrawEnv.getRTAction()->getActNode()->getVolume().getCenter(objPos); 
     522         
     523        //_currMatrix.second.mult(objPos); 
    524524 
    525525        DynamicVolume     objVol; 
    526526        objVol = _oDrawEnv.getRTAction()->getActNode()->getVolume(); 
    527         //objVol.transform(_currMatrix.second); 
     527        Pnt3r min,max; 
     528        objVol.getBounds(min,max); 
     529        _currMatrix.second.mult(min); 
     530        _currMatrix.second.mult(max); 
     531        objPos = min; 
     532        if(min[2] < max[2]) 
     533        { 
     534            objPos[2] = max[2]; 
     535        } 
     536         
     537        //std::cout << objPos[2] << std::endl; 
     538 
    528539        pNewElem->setVol        ( objVol ); 
    529540