Ignore:
Timestamp:
01/07/09 15:12:29 (15 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
5 edited

Legend:

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

    r3256 r3257  
    3838 
    3939 
    40 bool ViewCellsTree::LoadFromFile(const std::string &filename) 
     40bool ViewCellsTree::LoadFromFile(const std::string &filename, float scaleFactor) 
    4141{ 
    4242        cout << "Loading view cells from file '" + filename + "'"; 
     
    5050        } 
    5151 
    52         bool result = _LoadFromFile(fr); 
     52        bool result = _LoadFromFile(fr, scaleFactor); 
    5353 
    5454        cout << "finished loading view cells. " << endl; 
     
    5959 
    6060 
    61 bool ViewCellsTree::_LoadFromFile(FILE *fr) 
     61bool ViewCellsTree::_LoadFromFile(FILE *fr, float scaleFactor) 
    6262{ 
    6363        int buffer[256];  
     
    8181        fread(&box, sizeof(AxisAlignedBox3), 1, fr); 
    8282 
    83         box.Scale(mScaleFactor); 
     83        box.Scale(scaleFactor); 
    8484 
    8585        Vector3 v1(box.Min().x, -box.Min().z, box.Min().y); 
     
    124124                        fread(&mypos, sizeof(float), 1, fr); 
    125125 
    126                         mypos *= mScaleFactor; 
     126                        mypos *= scaleFactor; 
    127127 
    128128                        // changed coordinate system must be considered also here 
     
    145145        } 
    146146 
    147         cout << "\nloaded " << numViewCells << " view cells" << " " << axes[0] << " " << axes[1] << " " << axes[2] << endl; 
    148147        return true; 
    149148} 
    150149 
    151150 
    152 void ViewCellsTree::SetScaleFactor(float scale) 
    153 { 
    154         mScaleFactor = scale; 
    155 } 
    156  
    157151 
    158152} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ViewCellsTree.h

    r3256 r3257  
    8383 
    8484        ViewCell *GetViewCell(const Vector3 &point) const; 
    85  
    86         bool LoadFromFile(const std::string &filename); 
     85         
    8786        /** Hack: Sometimes the scene has to be scaled, then also 
    8887                the view cells must be scaled accordingly. 
    8988        */ 
    90         void SetScaleFactor(float scale); 
    91  
     89        bool LoadFromFile(const std::string &filename, float scaleFactor = 1.0f); 
     90         
    9291 
    9392protected: 
    9493 
    95         bool _LoadFromFile(FILE *file); 
     94        bool _LoadFromFile(FILE *file, float scaleFactor); 
    9695 
    9796 
     
    101100        AxisAlignedBox3 mBox; 
    102101        ViewCellsTreeNode *mRoot; 
    103         float mScaleFactor; 
    104102}; 
    105103 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.cpp

    r3245 r3257  
    1616 
    1717ViewCellsTree *VisibilitySolutionLoader::Load(const std::string &filename, 
    18                                                                                           Bvh *bvh) 
     18                                                                                          Bvh *bvh, 
     19                                                                                          float viewCellsScaleFactor) 
    1920{ 
    2021        FILE *fr = fopen(filename.c_str(), "rb"); 
     
    3839        ViewCellsTree *viewCellsTree = new ViewCellsTree(); 
    3940 
    40         bool ok = viewCellsTree->_LoadFromFile(fr); 
     41        bool ok = viewCellsTree->_LoadFromFile(fr, viewCellsScaleFactor); 
    4142 
    4243        cout << "finished loading view cells" << endl; 
     
    226227        } 
    227228 
    228         cout << "#of viewcells = " << id << " " << axes[0] << " " << axes[1] << " " << axes[2] << endl; 
    229 } 
    230  
    231  
    232 } 
     229        cout << "loaded " << id << " view cells" << endl; 
     230} 
     231 
     232 
     233} 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/VisibilitySolutionLoader.h

    r3243 r3257  
    2323        VisibilitySolutionLoader(): mNumNodes(0) {}; 
    2424 
    25         ViewCellsTree *Load(const std::string &filename, Bvh *bvh); 
     25        ViewCellsTree *Load(const std::string &filename, Bvh *bvh, float viewCellsScaleFactor = 1.0f); 
    2626 
    2727 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp

    r3256 r3257  
    11961196                if (!viewCellsTree)     LoadVisibilitySolution(); 
    11971197 
    1198                 if (viewCellsTree) 
    1199                 { 
    1200                         viewCellsTree->SetScaleFactor(viewCellsScaleFactor); 
    1201                         LoadPvs(); 
    1202                 } 
     1198                if (viewCellsTree) LoadPvs(); 
    12031199        } 
    12041200 
     
    26112607        VisibilitySolutionLoader visLoader; 
    26122608 
    2613         viewCellsTree = visLoader.Load(vis_filename, bvh); 
     2609        viewCellsTree = visLoader.Load(vis_filename, bvh, viewCellsScaleFactor); 
    26142610 
    26152611        if (!viewCellsTree) 
Note: See TracChangeset for help on using the changeset viewer.