Ignore:
Timestamp:
09/09/05 15:03:48 (19 years ago)
Author:
mattausch
Message:

debugged bsp

File:
1 edited

Legend:

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

    r261 r262  
    77#include "Environment.h" 
    88 
     9Preprocessor::Preprocessor(): 
     10mKdTree(NULL), 
     11mBspTree(NULL) 
     12{ 
     13} 
    914 
    1015Preprocessor::~Preprocessor() 
    1116{ 
    12   // delete view cells 
    13   while (!mViewCells.empty()) 
    14   { 
    15           DEL_PTR(mViewCells.back()); 
    16           mViewCells.pop_back(); 
    17   } 
    18  
    19   // delete psp tree 
     17  CLEAR_CONTAINER(mViewCells); 
    2018  DEL_PTR(mBspTree); 
     19  DEL_PTR(mKdTree); 
    2120} 
    2221 
     
    2524{ 
    2625        X3dParser *parser = new X3dParser; 
    27  
    28         delete parser; 
    2926 
    3027        bool result = parser->ParseFile(filename, mViewCells); 
     
    3229        if (result) 
    3330        { 
    34                 Exporter *exporter = Exporter::GetExporter(filename); 
     31                Exporter *exporter = Exporter::GetExporter("viewcells.x3d"); 
    3532 
    3633                if (exporter)  
     34                { 
    3735                        exporter->ExportViewCells(&mViewCells); 
    38  
     36                        delete exporter; 
     37                } 
     38 
     39                Debug << "Generating view cells" << endl; 
    3940                GenerateViewCells(); 
     41                Debug << "Generated view cells" << endl; 
    4042        } 
     43 
     44        DEL_PTR(parser); 
     45         
     46 
    4147        return result; 
    4248} 
     
    9197Preprocessor::BuildBspTree() 
    9298{ 
    93         ObjectContainer objects; 
    94         mSceneGraph->CollectObjects(&objects); 
    95  
     99        DEL_PTR(mBspTree); 
    96100        mBspTree = new BspTree(); 
    97101 
     
    116120    } 
    117121 
     122        ObjectContainer objects; 
     123        RayContainer rays; 
     124 
    118125        switch (constructionMethod) 
    119126        { 
    120127        case BspTree::VIEWCELLS: 
     128                Debug << "Construction method: view cells\n"; 
     129 
    121130                // derive view cells from the scene objects 
    122                 //ViewCell::DeriveViewCells(objects, mViewCells, maxViewCells); 
     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 
     138                mBspTree->Construct(mViewCells); 
     139                break; 
     140        case BspTree::SCENE_GEOMETRY: 
     141                Debug << "Construction method: geometry\n"; 
     142 
     143        CLEAR_CONTAINER(mViewCells); // we generate new view cells 
     144                mSceneGraph->CollectObjects(&objects); 
     145 
     146                mBspTree->Construct(objects, &mViewCells); 
     147                break; 
     148        case BspTree::RAYS: 
     149                Debug << "Construction method: rays\n"; 
     150 
     151                CLEAR_CONTAINER(mViewCells); // we generate new view cells 
    123152                 
    124                 mBspTree->Construct(mViewCells); 
    125                 break; 
    126         case BspTree::SCENE_GEOMETRY: 
    127                 CLEAR_CONTAINER(mViewCells); 
    128                 mBspTree->Construct(objects, &mViewCells); 
    129                 break; 
    130         case BspTree::RAYS: 
    131                 CLEAR_CONTAINER(mViewCells); 
    132                 mBspTree->Construct(objects, &mViewCells); 
     153                mBspTree->Construct(rays, &mViewCells); 
    133154                break; 
    134155        default: 
     156                Debug << "Error: Method not available\n"; 
    135157                break; 
    136158        } 
Note: See TracChangeset for help on using the changeset viewer.