Changeset 263 for trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
- Timestamp:
- 09/12/05 02:07:02 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/GtpVisibilityPreprocessor/src/Preprocessor.cpp
r262 r263 23 23 Preprocessor::LoadViewCells(const string filename) 24 24 { 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); 48 26 } 49 27 … … 51 29 Preprocessor::GenerateViewCells() 52 30 { 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; 54 42 } 55 43 … … 94 82 } 95 83 84 96 85 bool 97 86 Preprocessor::BuildBspTree() … … 100 89 mBspTree = new BspTree(); 101 90 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 else117 {118 cerr << "Wrong bsp construction method " << constructionMethodStr << endl;119 exit(1);120 }121 122 91 ObjectContainer objects; 123 92 RayContainer rays; 124 93 125 switch ( constructionMethod)94 switch (BspTree::sConstructionMethod) 126 95 { 127 case BspTree::VIEW CELLS:96 case BspTree::VIEW_CELLS: 128 97 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 138 99 mBspTree->Construct(mViewCells); 139 100 break; … … 142 103 143 104 CLEAR_CONTAINER(mViewCells); // we generate new view cells 105 144 106 mSceneGraph->CollectObjects(&objects); 145 146 107 mBspTree->Construct(objects, &mViewCells); 147 108 break; … … 149 110 Debug << "Construction method: rays\n"; 150 111 151 CLEAR_CONTAINER(mViewCells); // we generate new view cells 152 112 CLEAR_CONTAINER(mViewCells); // we generate new view cells 153 113 mBspTree->Construct(rays, &mViewCells); 154 114 break;
Note: See TracChangeset
for help on using the changeset viewer.