Changeset 3069 for GTP/trunk


Ignore:
Timestamp:
10/24/08 17:04:15 (16 years ago)
Author:
mattausch
Message:

completely changing dynamic stuff

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

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

    r3068 r3069  
    12691269void Bvh::UpdateDynamicBranch() 
    12701270{ 
     1271        // the bvh has two main branches 
     1272        // a static branch (the old root), and adynamic branch  
     1273        // we create a 'dynamic' leaf which basically is a container 
     1274        // for all dynamic objects underneath 
     1275 
     1276        // the bounding boxes of the dynamic tree must be updated 
     1277        // once each frame in order to be able to incorporate 
     1278        // the movements of the objects within 
     1279 
    12711280        // delete old branch 
    1272         if (!mDynamicRoot->IsLeaf()) 
    1273         { 
    1274                 cout << "deleting old branch" << endl; 
    1275  
    1276                 DEL_PTR(mDynamicRoot); 
    1277  
    1278                 mDynamicRoot = new BvhLeaf(mRoot); 
    1279                 mDynamicRoot->mBox = mRoot->mBox; 
    1280  
    1281                 mDynamicRoot->mFirst = 0; 
    1282                 mDynamicRoot->mLast = 0; 
    1283                 mDynamicRoot->mArea = mDynamicRoot->mBox.SurfaceArea(); 
    1284         } 
    1285  
     1281        cout << "deleting old branch" << endl; 
     1282 
     1283        DEL_PTR(mDynamicRoot); 
     1284 
     1285        mDynamicRoot = new BvhLeaf(mRoot); 
     1286        mDynamicRoot->mBox = mRoot->mBox; 
     1287 
     1288        mDynamicRoot->mFirst = 0; 
     1289        mDynamicRoot->mLast = (int)mDynamicEntities.size() - 1; 
     1290        mDynamicRoot->mArea = mDynamicRoot->mBox.SurfaceArea(); 
     1291         
    12861292        cout << "updating dynamic branch" << endl; 
    12871293 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp

    r3068 r3069  
    7777 
    7878        bvh->mRoot = root; 
    79  
    80 #if 0 
    81  
    8279        //bvh->mRoot = bvh->mStaticRoot; 
    8380        bvh->mNumNodes = 1; 
    84  
    85 #else 
    86         // we are setting a new root node  
    87         // and adds one level of indirection to the bvh  
    88         // It allows us to use dynamic objects 
    89  
    90         // the new bvh has two main branches 
    91         // a static branch (the old root), and adynamic branch  
    92         // we create a 'dynamic' leaf which basically is a container 
    93         // for all dynamic objects underneath 
    94  
    95         // the bounding boxes of the dynamic tree must be updated 
    96         // once each frame in order to be able to incorporate 
    97         // the movements of the objects within 
    98  
    99         // create new root 
    100         /*BvhInterior *newRoot = new BvhInterior(NULL); 
    101         bvh->mRoot = newRoot; 
    102  
    103         // the separation is a purely logical one 
    104         // the bounding boxes of the child nodes are  
    105         // identical to those of the root node 
    106  
    107         newRoot->mBox = bvh->mStaticRoot->mBox; 
    108         newRoot->mArea = newRoot->mBox.SurfaceArea(); 
    109  
    110         newRoot->mFirst = bvh->mStaticRoot->mFirst; 
    111         newRoot->mLast = bvh->mStaticRoot->mLast; 
    112  
    113         // add static root on left subtree 
    114         newRoot->mFront = bvh->mStaticRoot; 
    115         bvh->mStaticRoot->mParent = newRoot; 
    116         */ 
    117         // create and add dynamic root 
    118         BvhLeaf *dynamicRoot = new BvhLeaf(NULL); 
    119          
    120         dynamicRoot->mFirst = 0; 
    121         dynamicRoot->mLast = 0; 
    122  
    123         //dynamicRoot->mBox = bvh->mStaticRoot->mBox; 
    124         dynamicRoot->mBox = bvh->mRoot->mBox; 
    125         dynamicRoot->mArea = dynamicRoot->mBox.SurfaceArea(); 
    126  
    127         bvh->mDynamicRoot = dynamicRoot; 
    128         //newRoot->mBack = dynamicRoot; 
    129  
    130         bvh->mNumNodes = 1; 
    131 #endif 
    13281 
    13382        tQueue.push(bvh->mRoot); 
Note: See TracChangeset for help on using the changeset viewer.