- Timestamp:
- 10/24/08 17:04:15 (16 years ago)
- 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 1269 1269 void Bvh::UpdateDynamicBranch() 1270 1270 { 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 1271 1280 // 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 1286 1292 cout << "updating dynamic branch" << endl; 1287 1293 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp
r3068 r3069 77 77 78 78 bvh->mRoot = root; 79 80 #if 081 82 79 //bvh->mRoot = bvh->mStaticRoot; 83 80 bvh->mNumNodes = 1; 84 85 #else86 // we are setting a new root node87 // and adds one level of indirection to the bvh88 // It allows us to use dynamic objects89 90 // the new bvh has two main branches91 // a static branch (the old root), and adynamic branch92 // we create a 'dynamic' leaf which basically is a container93 // for all dynamic objects underneath94 95 // the bounding boxes of the dynamic tree must be updated96 // once each frame in order to be able to incorporate97 // the movements of the objects within98 99 // create new root100 /*BvhInterior *newRoot = new BvhInterior(NULL);101 bvh->mRoot = newRoot;102 103 // the separation is a purely logical one104 // the bounding boxes of the child nodes are105 // identical to those of the root node106 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 subtree114 newRoot->mFront = bvh->mStaticRoot;115 bvh->mStaticRoot->mParent = newRoot;116 */117 // create and add dynamic root118 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 #endif132 81 133 82 tQueue.push(bvh->mRoot);
Note: See TracChangeset
for help on using the changeset viewer.