Ignore:
Timestamp:
01/11/09 13:34:37 (15 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r3266 r3267  
    504504        if (mDynamicGeometrySize) 
    505505        { 
    506                 UpdateDynamicBranch(mDynamicRoot); 
     506                UpdateBoundingBoxes(mDynamicRoot); 
    507507                UpdateDynamicBounds(state); 
    508508        } 
     
    874874        cout << "created tighter bounds for " << p << " percent of the nodes" << endl; 
    875875 
    876         // recreate indices used for indirect mode rendering 
     876        // recreate indices used for indirect rendering mode 
    877877        if (mIndices) CreateIndices(); 
    878878} 
     
    956956        int numVirtualLeaves = 0; 
    957957        int numGeometry = 0; 
    958 cout<<"here3 computing stats"<<endl; 
     958 
    959959        while (!nodeStack.empty())  
    960960        { 
     
    962962                nodeStack.pop(); 
    963963 
    964                 cout << "x"; 
    965                 if (node->IsLeaf() && !node->IsVirtualLeaf()) 
    966                         cerr << "here34"<<endl; 
    967  
    968964                if (node->IsVirtualLeaf())  
    969965                { 
     
    971967                        numGeometry += node->CountPrimitives(); 
    972968 
    973                         cout << " l " << numGeometry; 
    974969                        BvhLeaf *leaf = static_cast<BvhLeaf *>(node); 
    975970 
     
    980975                else  
    981976                { 
    982                         cout << "i"; 
    983  
    984977                        bvhStats.mInteriorSA += node->mBox.SurfaceArea(); 
    985978                        bvhStats.mInteriorVol += node->mBox.GetVolume(); 
     
    10901083        // assign new virtual leaves based on specified #triangles per leaf 
    10911084        std::stack<BvhNode *> nodeStack; 
    1092         nodeStack.push(mRoot); 
    1093  
    1094         cout << "here9" << endl; 
     1085        nodeStack.push(mStaticRoot); 
     1086        nodeStack.push(mDynamicRoot); 
     1087 
    10951088        while (!nodeStack.empty())  
    10961089        { 
    1097                 cout <<"u"<< endl; 
    10981090                BvhNode *node = nodeStack.top(); 
    10991091                nodeStack.pop(); 
     
    11161108                                (CountTriangles(node) <= numTriangles)) 
    11171109                        { 
    1118                                 cout << " l " << CountTriangles(node) << " " << node->mIsMaxDepthForVirtualLeaf << endl; 
     1110                                //cout << " l " << CountTriangles(node) << " " << node->mIsMaxDepthForVirtualLeaf << endl; 
    11191111                                node->mIsVirtualLeaf = true; 
    11201112                        } 
     
    11451137 
    11461138        std::stack<BvhNode *> nodeStack; 
    1147         nodeStack.push(mRoot); 
    1148  
    1149         cout << "here7 computing depth" << endl; 
     1139 
     1140        nodeStack.push(mStaticRoot); 
     1141        nodeStack.push(mDynamicRoot); 
     1142 
    11501143        while (!nodeStack.empty())  
    11511144        { 
    11521145                BvhNode *node = nodeStack.top(); 
    11531146                nodeStack.pop(); 
    1154 cout << "z"; 
     1147 
    11551148                if (node->IsLeaf())  
    11561149                { 
     
    11661159                        if ((f->mFirst == b->mFirst) && (f->mLast == b->mLast)) 
    11671160                        { 
    1168                                 cout << "f: " << f->mFirst << " " << f->mLast << endl; 
    11691161                                // point reached where beyond there would be no further reduction  
    11701162                                // as both subtrees contain the same objects => stop here 
     
    11801172                } 
    11811173        } 
    1182         cout << "here7" << endl; 
    11831174} 
    11841175 
     
    12051196 
    12061197        BvhStats staticBvhStats; 
    1207         ComputeBvhStats(mRoot, staticBvhStats); 
     1198        ComputeBvhStats(mStaticRoot, staticBvhStats); 
    12081199        cout << "\n============ Static BVH statistics =============" << endl; 
    12091200 
     
    14041395 
    14051396 
    1406 void Bvh::UpdateDynamicBranch(BvhNode *node) 
     1397void Bvh::UpdateBoundingBoxes(BvhNode *node) 
    14071398{ 
    14081399        if (node->IsLeaf()) 
     
    14191410                BvhNode *b = static_cast<BvhInterior *>(node)->GetBack(); 
    14201411 
    1421                 UpdateDynamicBranch(f); 
    1422                 UpdateDynamicBranch(b); 
     1412                UpdateBoundingBoxes(f); 
     1413                UpdateBoundingBoxes(b); 
    14231414 
    14241415                node->mBox = f->mBox; 
     
    14521443} 
    14531444 
    1454 } 
     1445 
     1446 
     1447 
     1448} 
Note: See TracChangeset for help on using the changeset viewer.