Changeset 262 for trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
- Timestamp:
- 09/09/05 15:03:48 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r261 r262 7 7 #include "Environment.h" 8 8 9 Preprocessor::Preprocessor(): 10 mKdTree(NULL), 11 mBspTree(NULL) 12 { 13 } 9 14 10 15 Preprocessor::~Preprocessor() 11 16 { 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); 20 18 DEL_PTR(mBspTree); 19 DEL_PTR(mKdTree); 21 20 } 22 21 … … 25 24 { 26 25 X3dParser *parser = new X3dParser; 27 28 delete parser;29 26 30 27 bool result = parser->ParseFile(filename, mViewCells); … … 32 29 if (result) 33 30 { 34 Exporter *exporter = Exporter::GetExporter( filename);31 Exporter *exporter = Exporter::GetExporter("viewcells.x3d"); 35 32 36 33 if (exporter) 34 { 37 35 exporter->ExportViewCells(&mViewCells); 38 36 delete exporter; 37 } 38 39 Debug << "Generating view cells" << endl; 39 40 GenerateViewCells(); 41 Debug << "Generated view cells" << endl; 40 42 } 43 44 DEL_PTR(parser); 45 46 41 47 return result; 42 48 } … … 91 97 Preprocessor::BuildBspTree() 92 98 { 93 ObjectContainer objects; 94 mSceneGraph->CollectObjects(&objects); 95 99 DEL_PTR(mBspTree); 96 100 mBspTree = new BspTree(); 97 101 … … 116 120 } 117 121 122 ObjectContainer objects; 123 RayContainer rays; 124 118 125 switch (constructionMethod) 119 126 { 120 127 case BspTree::VIEWCELLS: 128 Debug << "Construction method: view cells\n"; 129 121 130 // 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 123 152 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); 133 154 break; 134 155 default: 156 Debug << "Error: Method not available\n"; 135 157 break; 136 158 }
Note: See TracChangeset
for help on using the changeset viewer.