- Timestamp:
- 01/11/09 13:34:37 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.cpp
r3265 r3267 40 40 41 41 int BvhConstructor::SortTriangles(BvhLeaf *leaf, 42 43 44 42 int axis, 43 float position 44 ) 45 45 { 46 46 int i = leaf->mFirst; … … 69 69 70 70 71 void BvhConstructor::UpdateBoundingBoxes(BvhNode *node) 72 { 73 if (node->IsLeaf()) 74 { 75 int numEntities = node->CountPrimitives(); 76 SceneEntity **entities = mEntities + node->mFirst; 77 78 node->mBox = SceneEntity::ComputeBoundingBox(entities, numEntities); 79 //cout << "box: " << node->mBox << endl; 80 } 81 else 82 { 83 BvhNode *f = static_cast<BvhInterior *>(node)->GetFront(); 84 BvhNode *b = static_cast<BvhInterior *>(node)->GetBack(); 85 86 UpdateBoundingBoxes(f); 87 UpdateBoundingBoxes(b); 88 89 node->mBox = f->mBox; 90 node->mBox.Include(b->mBox); 91 } 92 } 93 94 71 95 int BvhConstructor::SortTrianglesSpatialMedian(BvhLeaf *leaf, 72 96 int axis) … … 84 108 if (TerminationCriteriaMet(leaf)) 85 109 { 86 if (leaf->CountPrimitives() <= 0)87 110 //if (leaf->CountPrimitives() <= 0) 111 //cout << "leaf constructed:" << leaf->mBox << " " << leaf->mFirst << " " << leaf->mLast << endl; 88 112 return leaf; 89 113 } … … 157 181 { 158 182 BvhNode *root; 159 160 183 mNumNodes = 1; 161 184 … … 168 191 l->mArea = l->mBox.SurfaceArea(); 169 192 170 cout << "constructing bvh "<< endl;193 cout << "constructing bvh from " << l->mFirst << " to " << l->mLast << endl; 171 194 172 195 root = SubdivideLeaf(l, 0); 173 196 197 UpdateBoundingBoxes(root); 198 174 199 numNodes = mNumNodes; 175 200
Note: See TracChangeset
for help on using the changeset viewer.