Ignore:
Timestamp:
10/21/08 03:55:43 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r3021 r3052  
    7676        BvhNode *root = LoadNextNode(stream, NULL); 
    7777 
    78 #if 1 
     78#if 0 
    7979 
    8080        bvh->mRoot = root; 
    8181 
    8282#else 
    83         // copy root and set new one for dynamic objects 
     83        // we are setting a new root node 
     84        // which adds one level of indirection to the bvh but  
     85        // allows us to use dynamic objects 
     86        // the new bvh has two main branches 
     87        // one is the static branch (the old root), 
     88        // one is the dynamic branch  
     89        // we create a 'dynamic' leaf which basically is a container 
     90        // for all dynamic objects underneath 
     91        // the bounding boxes of the dynamic tree must be updated 
     92        // once each frame in order to be able to incorporate 
     93        // the movements of the objects within 
     94 
    8495        BvhInterior *newRoot = new BvhInterior(NULL); 
    85          
     96        bvh->mRoot = newRoot; 
     97 
     98        BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot); 
     99 
     100        newRoot->mFront = root; 
     101        newRoot->mBack = dynamicLeaf; 
     102        root->mParent = newRoot; 
     103 
     104        // the separation is a purely logical one 
     105        // the bounding boxes of the child nodes is the 
     106        // same as for the root node 
    86107        newRoot->mBox = root->mBox; 
     108        dynamicLeaf->mBox = root->mBox; 
     109 
     110        newRoot->mArea = newRoot->mBox.SurfaceArea(); 
     111        dynamicLeaf->mArea = dynamicLeaf->mBox.SurfaceArea(); 
     112 
    87113        newRoot->mFirst = root->mFirst; 
    88114        newRoot->mLast = root->mLast; 
    89115 
    90         // create 'dynamic' leaf which basically is a container 
    91         // for all dynamic objects 
    92         BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot); 
    93         dynamicLeaf->mBox = root->mBox; 
    94  
    95         newRoot->mFront = root; 
    96         root->mParent = newRoot; 
    97  
    98         newRoot->mBack = dynamicLeaf; 
    99  
    100         bvh->mRoot = newRoot; 
     116        dynamicLeaf->mFirst = 0; 
     117        dynamicLeaf->mLast = 0; 
    101118#endif 
    102119 
    103         tQueue.push(bvh->mRoot); 
     120        tQueue.push(root); 
    104121        bvh->mNumNodes = 1; 
    105122 
Note: See TracChangeset for help on using the changeset viewer.