- Timestamp:
- 10/21/08 03:55:43 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r3021 r3052 76 76 BvhNode *root = LoadNextNode(stream, NULL); 77 77 78 #if 178 #if 0 79 79 80 80 bvh->mRoot = root; 81 81 82 82 #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 84 95 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 86 107 newRoot->mBox = root->mBox; 108 dynamicLeaf->mBox = root->mBox; 109 110 newRoot->mArea = newRoot->mBox.SurfaceArea(); 111 dynamicLeaf->mArea = dynamicLeaf->mBox.SurfaceArea(); 112 87 113 newRoot->mFirst = root->mFirst; 88 114 newRoot->mLast = root->mLast; 89 115 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; 101 118 #endif 102 119 103 tQueue.push( bvh->mRoot);120 tQueue.push(root); 104 121 bvh->mNumNodes = 1; 105 122
Note: See TracChangeset
for help on using the changeset viewer.