- Timestamp:
- 10/20/06 13:21:15 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/vsposp_typical.sh
r1654 r1658 13 13 #SCENE=vsposp_typical 14 14 #SCENE=soda5_vsposp 15 SCENE=soda_vsposp 16 #SCENE=vsposp_vienna 15 #SCENE=soda_vsposp 16 #SCENE=vienna_vsposp 17 SCENE=vsposp_citymodel 17 18 #SCENE=soda5 18 19 #SCENE=cube … … 62 63 echo "$SCENE $METHOD" 63 64 64 $PROGRAM $ENVIRONMENT \65 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \66 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \67 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \68 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \69 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \70 -hierarchy_construction_type=2 \71 -hierarchy_construction_recompute_split_on_repair=true65 # $PROGRAM $ENVIRONMENT \ 66 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 67 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 68 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 69 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 70 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 71 # -hierarchy_construction_type=2 \ 72 # -hierarchy_construction_recompute_split_on_repair=true 72 73 73 74 sh movefiles.sh $LOG_PREFIX-$METHOD … … 80 81 echo "$SCENE $METHOD" 81 82 82 $PROGRAM $ENVIRONMENT \83 -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \84 -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \85 -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \86 -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \87 -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \88 -hierarchy_construction_type=0 \89 -bvh_term_max_leaves=$NODES83 # $PROGRAM $ENVIRONMENT \ 84 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 85 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 86 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 87 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 88 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 89 # -hierarchy_construction_type=0 \ 90 # -bvh_term_max_leaves=$NODES 90 91 91 92 sh movefiles.sh $LOG_PREFIX-$METHOD … … 94 95 95 96 NODES=10000 97 98 METHOD=sequential-$NODES 99 echo "$SCENE $METHOD" 100 101 # $PROGRAM $ENVIRONMENT \ 102 # -view_cells_evaluation_stats_prefix=$LOG_PREFIX-$METHOD \ 103 # -view_cells_merge_stats=$LOG_PREFIX-$METHOD-mergeStats.log \ 104 # -vsp_subdivision_stats=$LOG_PREFIX-$METHOD-vsp-subdivisionStats.log \ 105 # -bvh_subdivision_stats=$LOG_PREFIX-$METHOD-bvh-subdivisionStats.log \ 106 # -hierarchy_subdivision_stats=$LOG_PREFIX-$METHOD-hierarchy-subdivisionStats.log \ 107 # -hierarchy_construction_type=0 \ 108 # -bvh_term_max_leaves=$NODES 109 110 sh movefiles.sh $LOG_PREFIX-$METHOD 111 112 113 ############################################################################ 114 115 NODES=30000 96 116 97 117 METHOD=sequential-$NODES -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1655 r1658 226 226 bool Preprocessor::LoadBinaryObj(const string filename, 227 227 SceneGraphNode *root, 228 const bool loadMeshes,229 228 vector<FaceParentInfo> *parents) 230 229 { 231 ifstream samplesIn(fileName, ios::binary); 230 //ifstream samplesIn(filename, ios::binary); 231 igzstream samplesIn(filename.c_str()); 232 232 233 if (!samplesIn.is_open()) 233 234 return false; 234 235 235 236 cout << "binary obj dump available, loading " << filename.c_str() << endl; 236 237 // table associating indices with vectors 237 238 map<int, Vector3> hashTable; 239 238 240 // table for vertices 239 241 VertexContainer vertices; 240 242 FaceContainer faces; 241 243 242 char str[100];243 int meshGrouping;244 Environment::GetSingleton()->GetIntValue("ObjParser.meshGrouping", meshGrouping);245 246 int nMaxFaces = meshGrouping;247 248 244 while (1) 249 245 { … … 271 267 272 268 return true; 269 } 270 271 272 bool Preprocessor::ExportBinaryObj(const string filename, SceneGraphNode *root) 273 { 274 //ifstream samplesIn(filename, ios::binary); 275 ogzstream samplesOut(filename.c_str()); 276 if (!samplesOut.is_open()) 277 return false; 278 279 ObjectContainer::const_iterator oit, oit_end = root->mGeometry.end(); 280 281 for (oit = root->mGeometry.begin(); oit != oit_end; ++ oit) 282 { 283 Intersectable *obj = *oit; 284 285 if (obj->Type() == Intersectable::TRIANGLE_INTERSECTABLE) 286 { 287 Triangle3 tri = dynamic_cast<TriangleIntersectable *>(obj)->GetItem(); 288 289 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 0), sizeof(Vector3)); 290 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 1), sizeof(Vector3)); 291 samplesOut.write(reinterpret_cast<char *>(tri.mVertices + 2), sizeof(Vector3)); 292 } 293 else 294 { 295 cout << "not implemented intersectable type " << obj->Type() << endl; 296 } 297 } 298 299 return true; 300 } 301 302 static string ReplaceSuffix(string filename, string a, string b) 303 { 304 string result = filename; 305 306 int pos = (int)filename.rfind(a, (int)filename.size() - 1); 307 if (pos == filename.size() - a.size()) { 308 result.replace(pos, a.size(), b); 309 } 310 return result; 273 311 } 274 312 … … 295 333 &mFaceParents : NULL; 296 334 297 if (files == 1) {298 335 if (files == 1) 336 { 299 337 if (strstr(filename.c_str(), ".x3d")) 300 338 { 301 339 parser = new X3dParser; 302 }303 else304 {305 if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb"))306 {307 parser = new PlyParser;308 }309 else if (strstr(filename.c_str(), ".obj"))310 {311 // hack: load binary dump312 string binFile = ReplaceSuffix(filename, ".obj", ".bin");313 340 314 const bool loaded = 315 LoadBinaryObj(binFile, mSceneGraph->GetRoot(), mLoadMeshes, fi); 316 317 if (loaded) 318 return true; 319 320 parser = new ObjParser; 321 } 322 else 323 { 324 parser = new UnigraphicsParser; 325 } 326 } 327 328 cout << filename << endl; 329 330 result = parser->ParseFile(filename, 341 result = parser->ParseFile(filename, 342 mSceneGraph->GetRoot(), 343 mLoadMeshes, 344 fi); 345 delete parser; 346 } 347 else if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb")) 348 { 349 parser = new PlyParser; 350 351 result = parser->ParseFile(filename, 352 mSceneGraph->GetRoot(), 353 mLoadMeshes, 354 fi); 355 delete parser; 356 } 357 else if (strstr(filename.c_str(), ".obj")) 358 { 359 // hack: load binary dump 360 string binFile = ReplaceSuffix(filename, ".obj", ".bin"); 361 362 if (!mLoadMeshes) 363 { 364 result = LoadBinaryObj(binFile, mSceneGraph->GetRoot(), fi); 365 } 366 367 if (!result) 368 { 369 cout << "no binary dump available or loading full meshes, parsing file" << endl; 370 parser = new ObjParser; 371 372 result = parser->ParseFile(filename, 331 373 mSceneGraph->GetRoot(), 332 374 mLoadMeshes, 333 375 fi); 334 335 // only works for triangles 336 ExportBinaryObj(binFile): 337 338 delete parser; 339 376 377 // only works for triangles 378 if (!mLoadMeshes) 379 { 380 cout << "exporting binary obj to " << binFile << "... " << endl; 381 ExportBinaryObj(binFile, mSceneGraph->GetRoot()); 382 cout << "finished" << endl; 383 } 384 385 delete parser; 386 } 387 else if (1) 388 { 389 ExportBinaryObj("../data/test.bin", mSceneGraph->GetRoot()); 390 //Exporter *exporter = Exporter::GetExporter("dummy.wrl"); 391 //exporter->ExportGeometry(mSceneGraph->GetRoot()->mGeometry); 392 } 393 } 394 else 395 { 396 parser = new UnigraphicsParser; 397 result = parser->ParseFile(filename, 398 mSceneGraph->GetRoot(), 399 mLoadMeshes, 400 fi); 401 delete parser; 402 } 403 404 cout << filename << endl; 340 405 } 341 else { 406 else 407 { 342 408 vector<string>::const_iterator fit, fit_end = filenames.end(); 343 409 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r1613 r1658 208 208 protected: 209 209 210 bool LoadBinaryObj(const string filename, 211 SceneGraphNode *root, 212 vector<FaceParentInfo> *parents); 213 214 bool ExportBinaryObj(const string filename, SceneGraphNode *root); 215 216 210 217 void SetupRay(Ray &ray, const Vector3 &point, const Vector3 &direction) const; 211 218 212 // matt: previously was a signal213 219 void EvalPvsStat(); 214 220 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1640 r1658 46 46 // DLL function signature 47 47 typedef GlRendererWidget *(*importFunction)(Preprocessor *); 48 49 48 50 49 … … 142 141 else if (strstr(strippedFilename.c_str(), ".obj")) 143 142 { 144 kdFilename += ReplaceSuffix(strippedFilename, ". dat", suffix);143 kdFilename += ReplaceSuffix(strippedFilename, ".obj", suffix); 145 144 } 146 145 else
Note: See TracChangeset
for help on using the changeset viewer.