Ignore:
Timestamp:
01/11/09 01:18:50 (15 years ago)
Author:
mattausch
Message:

working on pompeii loading. fixed bug in obj conversion

File:
1 edited

Legend:

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

    r3259 r3262  
    146146} 
    147147 
     148BvhInterior::BvhInterior(BvhNode *parent): 
     149mBack(NULL), mFront(NULL), BvhNode(parent) 
     150{} 
     151 
     152 
     153bool BvhInterior::IsLeaf() const 
     154{ 
     155        return false;  
     156} 
     157 
     158 
     159 
     160BvhLeaf::BvhLeaf(BvhNode *parent): BvhNode(parent) 
     161{} 
     162 
     163 
     164bool BvhLeaf::IsLeaf() const 
     165{ 
     166        return true;  
     167} 
     168 
     169 
    148170 
    149171/**********************************************************/ 
    150172/*                class Bvh implementation                */ 
    151173/**********************************************************/ 
    152  
    153  
    154  
    155 inline AxisAlignedBox3 ComputeBoundingBox(SceneEntity **entities, int numEntities) 
    156 { 
    157         AxisAlignedBox3 box; 
    158          
    159         if (!numEntities) 
    160         {       // no box=> just initialize 
    161                 box.Initialize(); 
    162         } 
    163         else 
    164         { 
    165                 box = entities[0]->GetWorldBoundingBox(); 
    166  
    167                 for (int i = 1; i < numEntities; ++ i) 
    168                 { 
    169                         box.Include(entities[i]->GetWorldBoundingBox()); 
    170                 } 
    171         } 
    172  
    173         return box; 
    174 } 
    175174 
    176175 
     
    14401439        leaf->mParent = parent; 
    14411440         
    1442         front->mBox = ComputeBoundingBox(mGeometry + front->mFirst, front->CountPrimitives()); 
    1443         leaf->mBox = ComputeBoundingBox(mGeometry + leaf->mFirst, leaf->CountPrimitives()); 
     1441        front->mBox = SceneEntity::ComputeBoundingBox(mGeometry + front->mFirst, front->CountPrimitives()); 
     1442        leaf->mBox = SceneEntity::ComputeBoundingBox(mGeometry + leaf->mFirst, leaf->CountPrimitives()); 
    14441443 
    14451444        // recursively continue subdivision 
     
    14681467                SceneEntity **entities = GetGeometry(node, numEntities); 
    14691468 
    1470                 node->mBox = ComputeBoundingBox(entities, numEntities); 
     1469                node->mBox = SceneEntity::ComputeBoundingBox(entities, numEntities); 
    14711470                //cout << "box: " << node->mBox << endl; 
    14721471        } 
     
    14881487{ 
    14891488        // the bvh has two main branches 
    1490         // a static branch (the old root), and adynamic branch  
     1489        // a static branch (the old root), and a dynamic branch  
    14911490        // we create a 'dynamic' leaf which basically is a container 
    14921491        // for all dynamic objects underneath 
     
    15011500        mDynamicRoot = l; 
    15021501 
    1503         l->mBox = ComputeBoundingBox(mGeometry + mStaticGeometrySize, (int)mDynamicGeometrySize); 
     1502        l->mBox = SceneEntity::ComputeBoundingBox(mGeometry + mStaticGeometrySize,  
     1503                                                      (int)mDynamicGeometrySize); 
    15041504 
    15051505        l->mFirst = (int)mStaticGeometrySize; 
     
    15101510 
    15111511        if (mDynamicGeometrySize) 
     1512        { 
    15121513                mDynamicRoot = SubdivideLeaf(l, 0); 
     1514        } 
    15131515} 
    15141516 
Note: See TracChangeset for help on using the changeset viewer.