Changeset 2962


Ignore:
Timestamp:
09/22/08 00:20:14 (16 years ago)
Author:
mattausch
Message:

started to work on dynamic objects

File:
1 edited

Legend:

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

    r2800 r2962  
    6262 
    6363        Bvh *bvh = new Bvh(entities); 
    64         bvh->mRoot = LoadNextNode(stream, NULL); 
     64 
     65        BvhNode *root = LoadNextNode(stream, NULL); 
     66 
     67#if 0 
     68 
     69        bvh->mRoot = root; 
     70 
     71#else 
     72        // copy root and set new one for dynamic objects 
     73        BvhInterior *newRoot = new BvhInterior(NULL); 
     74         
     75        newRoot->mBox = root->mBox; 
     76        newRoot->mFirst = root->mFirst; 
     77        newRoot->mLast = root->mLast; 
     78 
     79        // create 'dynamic' leaf which basicly is a container 
     80        // for all dynamic objects 
     81        BvhLeaf *dynamicLeaf = new BvhLeaf(newRoot); 
     82        dynamicLeaf->mBox = root->mBox; 
     83 
     84        newRoot->mFront = root; 
     85        root->mParent = newRoot; 
     86 
     87        newRoot->mBack = dynamicLeaf; 
     88 
     89        bvh->mRoot = newRoot; 
     90#endif 
    6591 
    6692        tQueue.push(bvh->mRoot); 
     
    92118        } 
    93119 
    94         cout << "... finished loading " << bvh->mNumNodes << " nodes, updating boxes" << endl; 
     120        cout << "... finished loading " << bvh->mNumNodes << " scene box: " << bvh->mBox << endl; 
    95121 
    96122        bvh->mBox = bvh->mRoot->GetBox(); 
    97123 
    98         cout << "scene box: " << bvh->mBox << endl; 
    99  
     124         
    100125        /////////// 
    101126        //-- post process nodes 
     
    111136        // specify bounds for occlusion tests 
    112137        bvh->RecomputeBounds(); 
     138 
    113139        // compute and print stats 
    114140        bvh->ComputeBvhStats(); 
Note: See TracChangeset for help on using the changeset viewer.