Ignore:
Timestamp:
09/12/05 02:07:02 (19 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp

    r262 r263  
    2323Preprocessor::LoadViewCells(const string filename) 
    2424{ 
    25         X3dParser *parser = new X3dParser; 
    26  
    27         bool result = parser->ParseFile(filename, mViewCells); 
    28  
    29         if (result) 
    30         { 
    31                 Exporter *exporter = Exporter::GetExporter("viewcells.x3d"); 
    32  
    33                 if (exporter)  
    34                 { 
    35                         exporter->ExportViewCells(&mViewCells); 
    36                         delete exporter; 
    37                 } 
    38  
    39                 Debug << "Generating view cells" << endl; 
    40                 GenerateViewCells(); 
    41                 Debug << "Generated view cells" << endl; 
    42         } 
    43  
    44         DEL_PTR(parser); 
    45          
    46  
    47         return result; 
     25        return X3dParser().ParseFile(filename, mViewCells); 
    4826} 
    4927 
     
    5129Preprocessor::GenerateViewCells() 
    5230{ 
    53         return BuildBspTree(); 
     31        // TODO 
     32        // HACK: derive view cells from the scene objects 
     33        ObjectContainer objects; 
     34 
     35        int maxViewCells = 0; 
     36        environment->GetIntValue("BspTree.maxViewCells", maxViewCells); 
     37 
     38        mSceneGraph->CollectObjects(&objects); 
     39        ViewCell::DeriveViewCells(objects, mViewCells, maxViewCells); 
     40 
     41        return true; 
    5442} 
    5543 
     
    9482} 
    9583 
     84 
    9685bool 
    9786Preprocessor::BuildBspTree() 
     
    10089        mBspTree = new BspTree(); 
    10190 
    102         char constructionMethodStr[64]; 
    103         int maxViewCells = 0; 
    104  
    105         environment->GetIntValue("BspTree.maxViewCells", maxViewCells); 
    106         environment->GetStringValue("BspTree.constructionMethod", constructionMethodStr); 
    107  
    108         int constructionMethod = BspTree::VIEWCELLS; 
    109          
    110         if (strcmp(constructionMethodStr, "viewCells") == 0) 
    111                 constructionMethod = BspTree::VIEWCELLS; 
    112         else if (strcmp(constructionMethodStr, "sceneGeometry") == 0) 
    113                 constructionMethod = BspTree::SCENE_GEOMETRY; 
    114         else if (strcmp(constructionMethodStr, "rays") == 0) 
    115                 constructionMethod = BspTree::RAYS; 
    116         else  
    117         { 
    118                 cerr << "Wrong bsp construction method " << constructionMethodStr << endl; 
    119                 exit(1); 
    120     } 
    121  
    12291        ObjectContainer objects; 
    12392        RayContainer rays; 
    12493 
    125         switch (constructionMethod) 
     94        switch (BspTree::sConstructionMethod) 
    12695        { 
    127         case BspTree::VIEWCELLS: 
     96        case BspTree::VIEW_CELLS: 
    12897                Debug << "Construction method: view cells\n"; 
    129  
    130                 // derive view cells from the scene objects 
    131                 if (mViewCells.empty())          
    132                 { 
    133                         Debug << "View cells empty => generating new ones\n"; Debug.flush(); 
    134                         mSceneGraph->CollectObjects(&objects); 
    135                         ViewCell::DeriveViewCells(objects, mViewCells, maxViewCells); 
    136                 } 
    137  
     98                 
    13899                mBspTree->Construct(mViewCells); 
    139100                break; 
     
    142103 
    143104        CLEAR_CONTAINER(mViewCells); // we generate new view cells 
     105 
    144106                mSceneGraph->CollectObjects(&objects); 
    145  
    146107                mBspTree->Construct(objects, &mViewCells); 
    147108                break; 
     
    149110                Debug << "Construction method: rays\n"; 
    150111 
    151                 CLEAR_CONTAINER(mViewCells); // we generate new view cells 
    152                  
     112                CLEAR_CONTAINER(mViewCells); // we generate new view cells       
    153113                mBspTree->Construct(rays, &mViewCells); 
    154114                break; 
Note: See TracChangeset for help on using the changeset viewer.