Ignore:
Timestamp:
01/09/09 02:16:38 (15 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/PvsCollectionRenderer.cpp

    r3258 r3259  
    2323void PvsCollectionRenderer::Traverse() 
    2424{ 
     25        mPIS.clear(); 
     26 
    2527        //////////// 
    2628        //-- part1: do frustum culling + pvs 
     
    4951        } 
    5052 
     53        int pisSize = (int)mPIS.size(); 
     54 
     55 
    5156        //////////// 
    5257        //-- part2: test the potentially invisible nodes 
     
    5762 
    5863        OcclusionQuery *query = mQueryHandler.RequestQuery(); 
    59          
     64        query->Reset(); 
     65 
    6066        int querySize = 50; 
    6167 
     
    8793        probablyVisibleNodes.clear(); 
    8894         
    89          
     95        int qsize = (int)queries.size(); 
     96        int fqueries = 0; 
     97 
    9098        // get query results: collect probably visible nodes 
    9199        while (!queries.empty()) 
     
    98106                if (visiblePixels > 0) 
    99107                { 
     108                        ++ fqueries; 
     109 
    100110                        BvhNodeContainer::const_iterator bit, bit_end = q->GetNodes().end(); 
    101111 
     
    109119        } 
    110120 
     121        //cout << "probably visible: " << fqueries << " of " << qsize << " (" << (int)probablyVisibleNodes.size() << " of " << pisSize << " nodes)" << endl; 
     122 
     123 
    111124 
    112125        ////////////// 
    113126        //-- part4: test probably visible nodes individually, update pvs of current view cell 
    114127 
    115         return; 
    116         //if (!mViewCell) return; 
     128        if (!mViewCell) return; 
    117129         
    118130        // query all nodes individually 
     
    122134        { 
    123135                BvhNode *n = *bit; 
    124                 queries.push(IssueOcclusionQuery(n)); 
     136 
     137                // node intersects near plane =>  
     138                // add immediately because testing the bb could fail 
     139                if (mBvh->IntersectsNearPlane(n)) 
     140                { 
     141                        mViewCell->mPvs.AddEntry(mBvh, n); 
     142                } 
     143                else 
     144                { 
     145                        queries.push(IssueOcclusionQuery(n)); 
     146                } 
    125147        } 
    126148 
     
    132154         
    133155                const int visiblePixels = q->GetQueryResult(); 
    134  
     156                 
    135157                if (visiblePixels > 0) 
    136158                { 
    137                         // add node to pvs 
    138                         int geometrySize; 
    139                         SceneEntity **entities; 
    140                         entities = mBvh->GetGeometry(q->GetFrontNode(), geometrySize); 
    141  
    142                         for (int i = 0; i < geometrySize; ++ i) 
    143                         { 
    144                                 mViewCell->mPvs.AddEntry(entities[i]); 
    145                         } 
     159                        mViewCell->mPvs.AddEntry(mBvh, q->GetFrontNode()); 
    146160                } 
    147161        } 
Note: See TracChangeset for help on using the changeset viewer.