Changeset 3282 for GTP


Ignore:
Timestamp:
01/16/09 17:32:00 (15 years ago)
Author:
mattausch
Message:

probably found export error

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling
Files:
9 edited

Legend:

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

    r3277 r3282  
    230230        mGeometry.clear(); 
    231231 
     232        if (!LoadSolutionTest(bvhInputFilename)) 
    232233        //if (!LoadSolution(bvhInputFilename)) 
    233         if (!LoadSolution(bvhInputFilename)) 
    234234        { 
    235235                cerr << "could not read solution file" << endl; 
     
    648648BvhNode *VisibilitySolutionConverter::LoadNode(FILE *fr, int depth) 
    649649{ 
    650         //cout<<"here4"<<endl; 
    651650        ++ mNumNodes; 
    652651         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/VisibilitySolutionConverter/VisibilitySolutionConverter.h

    r3277 r3282  
    110110        bool LoadSolution(const std::string &filename); 
    111111 
    112  
    113112        BvhNode *LoadNode(FILE *fr, int depth); 
    114113 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/default.env

    r3281 r3282  
    99#filename=vienna_full_hp 
    1010#bvhname=vienna_full_hp 
    11 filename=tryvienna 
    12 bvhname=tryvienna 
     11filename=tryvienna2 
     12bvhname=tryvienna2 
    1313#filename=mypompeii 
    1414#bvhname=mypompeii 
    1515#filename=pompeii/pompeii_full 
    1616#filename=pompeii/pompeii_part 
    17 filename=city 
    18 bvhname=city 
     17#filename=city 
     18#bvhname=city 
    1919useLODs=1 
    2020# shadow map size 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Bvh.h

    r3274 r3282  
    8888        */ 
    8989        inline float GetDistance() const; 
     90        /** Returns id of the first scene entity in the node. 
     91        */ 
     92        inline int GetFirstEntity() const; 
     93        /** Returns id of the last scene entity in the node. 
     94        */ 
     95        inline int GetLastEntity() const; 
    9096 
    9197 
     
    505511        void RenderBoundsForViz(BvhNode *node, RenderState *state, bool useTightBounds); 
    506512 
    507  
     513         
    508514protected: 
    509515 
     
    527533        */ 
    528534        void Init(); 
     535 
    529536 
    530537        ///////////// 
     
    844851 
    845852 
     853inline int BvhNode::GetFirstEntity() const 
     854{ 
     855        return mFirst; 
     856} 
     857 
     858 
     859inline int BvhNode::GetLastEntity() const 
     860{ 
     861        return mLast; 
     862} 
     863 
     864 
    846865inline BvhNode *BvhInterior::GetBack() 
    847866{ 
     
    856875 
    857876 
     877 
     878////////////////////////////// 
     879 
     880         
    858881inline int Bvh::GetNumNodes() const 
    859882{ 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhExporter.cpp

    r3279 r3282  
    5959                BvhInterior *interior = static_cast<BvhInterior *>(node); 
    6060 
    61                 ConstructTriangleRangeMap(bvh, interior->GetFront(), first, m); 
     61                ConstructTriangleRangeMap(bvh, interior->GetBack(), first, m); 
    6262                int newFirst = m + 1; 
    63                 ConstructTriangleRangeMap(bvh, interior->GetBack(), newFirst, last); 
     63                ConstructTriangleRangeMap(bvh, interior->GetFront(), newFirst, last); 
    6464 
    6565                mTriangleRangeMap[node] = pair<int, int>(first, last); 
     
    6969                //first = currentIdx; 
    7070                last = first + bvh->CountTriangles(node) - 1; 
     71                //cout << "x " << node->GetFirstEntity() << " " << node->GetLastEntity() << " " << first << " " << last << endl; 
    7172                //currentIdx = last; 
    72  
    7373                mTriangleRangeMap[node] = pair<int, int>(first, last); 
    7474        } 
     
    109109                 BvhNode *node = *it; 
    110110 
    111                  int f = mTriangleRangeMap[node].first; 
    112                  int l = mTriangleRangeMap[node].second; 
     111                 const int f = mTriangleRangeMap[node].first; 
     112                 const int l = mTriangleRangeMap[node].second; 
    113113 
    114114                 for (int i = f; i <= l; ++ i) 
    115                  { 
    116115                         triangles.push_back(i); 
    117                  } 
    118116         } 
    119117 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/BvhLoader.cpp

    r3269 r3282  
    140140        Bvh *bvh = new Bvh(staticEntities, dynamicEntities, maxDepthForTestingChildren); 
    141141 
    142         BvhConstructor bvhConstructor(bvh->mGeometry,  
    143                                           0, 
     142        BvhConstructor bvhConstructor(bvh->mGeometry, 0, 
    144143                                                                  (int)bvh->mStaticGeometrySize - 1); 
    145144 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/Geometry.cpp

    r3276 r3282  
    4040        if (delData) 
    4141        { 
    42                 DEL_ARRAY_PTR(mVertices); 
     42                //DEL_ARRAY_PTR(mVertices); 
    4343                DEL_ARRAY_PTR(mNormals); 
    4444                DEL_ARRAY_PTR(mTexCoords); 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp

    r3281 r3282  
    22#include "ViewCellsTree.h" 
    33#include "Bvh.h" 
     4#include "SceneEntity.h" 
    45#include <stack> 
    56 
     
    120121        nodes.push_back(n); 
    121122 
    122         if (!n->IsVirtualLeaf()) 
     123        if (!n->IsLeaf() && !n->IsVirtualLeaf()) 
    123124        { 
    124125                BvhInterior *interior = static_cast<BvhInterior *>(n); 
     
    157158        ofstream outstream("test.log"); 
    158159 
     160        BvhNode *f = ((BvhInterior *)bvh->GetStaticRoot())->GetFront(); 
     161        BvhNode *b = ((BvhInterior *)bvh->GetStaticRoot())->GetBack(); 
     162 
     163        outstream << "front: " << f->GetFirstEntity() << " " << f->GetLastEntity() << endl; 
     164        outstream << "back: " << b->GetFirstEntity() << " " << b->GetLastEntity() << endl; 
     165 
    159166        for (size_t i = 0; i < nodes.size(); ++ i) 
    160167        { 
    161                 if (nodes[i]->GetId() >= nodes.size()) 
    162                         cout << "id " << nodes[i]->GetId() << endl; 
    163  
    164                 outstream << "id " << nodes[i]->GetId() << endl; 
    165         } 
    166                  
    167         cout << "nodes: " << nodes.size() << endl; 
    168  
    169  
     168                BvhNode *n = nodes[i]; 
     169                //if (nodes[i]->GetId() >= nodes.size()) cout << "id " << nodes[i]->GetId() << endl; 
     170                if (n->IsVirtualLeaf()) 
     171                { 
     172                        int geometrySize; 
     173                        AxisAlignedBox3 box; 
     174                        SceneEntity **ent = bvh->GetGeometry(n, geometrySize); 
     175                        box = SceneEntity::ComputeBoundingBox(ent, geometrySize); 
     176 
     177                        outstream << n->GetFirstEntity() << " " << n->GetLastEntity() << " " << n->GetBox() << " " << box << endl; 
     178                         
     179                } 
     180        } 
     181                 
    170182        outstream.close(); 
    171183         
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3279 r3282  
    603603        //LoadModel("sibenik.dem", dynamicObjects); 
    604604 
    605         if (1) LoadPompeiiFloor(); 
     605        if (0) LoadPompeiiFloor(); 
    606606 
    607607#if 0 
     
    672672 
    673673 
    674         //ObjExporter().Export(model_path + "mypompeii.obj", bvh); 
    675         //BvhExporter().Export(model_path + "mypompeii.bv", bvh); 
     674        //ObjExporter().Export(model_path + "mytest.obj", bvh); 
     675        //BvhExporter().Export(model_path + "mytest.bv", bvh); 
    676676 
    677677 
Note: See TracChangeset for help on using the changeset viewer.