Ignore:
Timestamp:
01/11/09 02:43:59 (15 years ago)
Author:
mattausch
Message:

worked on bvh constructor

File:
1 edited

Legend:

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

    r3262 r3265  
    4040 
    4141int BvhConstructor::SortTriangles(BvhLeaf *leaf,  
    42                                                                   int axis,  
    43                                                                   float position) 
     42                                           int axis,  
     43                                           float position 
     44                                           ) 
    4445{ 
    4546        int i = leaf->mFirst; 
     
    4849    while (1) 
    4950        { 
    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; 
    5356 
    5457                // sorting finished 
     
    8184        if (TerminationCriteriaMet(leaf)) 
    8285        { 
    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; 
    8488                return leaf; 
    8589        } 
     
    101105        { 
    102106                // no split could be achieved => just halve number of objects 
    103                 split = (leaf->mLast - leaf->mFirst) / 2; 
     107                split = (leaf->mLast + leaf->mFirst) / 2; 
    104108                cerr << "no reduction " << leaf->CountPrimitives() << " " << leaf->mFirst << " " << leaf->mLast << endl; 
    105109        } 
Note: See TracChangeset for help on using the changeset viewer.