- Timestamp:
- 01/11/09 02:43:59 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhConstructor.cpp
r3262 r3265 40 40 41 41 int BvhConstructor::SortTriangles(BvhLeaf *leaf, 42 int axis, 43 float position) 42 int axis, 43 float position 44 ) 44 45 { 45 46 int i = leaf->mFirst; … … 48 49 while (1) 49 50 { 50 while (mEntities[i]->GetWorldCenter()[axis] < position) ++ i; 51 //while ((j > 0) && (position < mGeometry[j]->GetWorldCenter()[axis])) -- j; 52 while (position < mEntities[j]->GetWorldCenter()[axis]) -- j; 51 //while (mEntities[i]->GetWorldCenter()[axis] < position) ++ i; 52 //while (position < mEntities[j]->GetWorldCenter()[axis]) -- j; 53 54 while ((i < leaf->mLast) && (mEntities[i]->GetWorldCenter()[axis] < position)) ++ i; 55 while ((j > leaf->mFirst) && (position < mEntities[j]->GetWorldCenter()[axis])) -- j; 53 56 54 57 // sorting finished … … 81 84 if (TerminationCriteriaMet(leaf)) 82 85 { 83 cout << "leaf constructed:" << leaf->mBox << " " << leaf->mFirst << " " << leaf->mLast << endl; 86 if (leaf->CountPrimitives() <= 0) 87 cout << "leaf constructed:" << leaf->mBox << " " << leaf->mFirst << " " << leaf->mLast << endl; 84 88 return leaf; 85 89 } … … 101 105 { 102 106 // no split could be achieved => just halve number of objects 103 split = (leaf->mLast -leaf->mFirst) / 2;107 split = (leaf->mLast + leaf->mFirst) / 2; 104 108 cerr << "no reduction " << leaf->CountPrimitives() << " " << leaf->mFirst << " " << leaf->mLast << endl; 105 109 }
Note: See TracChangeset
for help on using the changeset viewer.