Changeset 1404 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 09/18/06 02:23:47 (18 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells
r1277 r1404 1 1 #!/bin/sh 2 2 3 PROGRAM=../bin/release/Preprocessor.exe 4 #PROGRAM=../bin/Debug/Preprocessor.exe 3 5 4 6 … … 29 31 -vsp_bsp_subdivision_stats=$LOG_PREFIX-$METHOD-subdivisionStats.log \ 30 32 -view_cells_post_process_merge=false \ 31 -view_cells_active= 400 \33 -view_cells_active=1000 \ 32 34 -view_cells_filename=$LOG_PREFIX-visibility.xml.zip \ 33 35 -view_cells_export_pvs=true \ -
GTP/trunk/Lib/Vis/Preprocessing/scripts/generate_viewcells.env
r1277 r1404 9 9 # filename ../data/vienna/vienna-simple.x3d 10 10 # filename ../data/vienna/vienna-buildings.x3d 11 filename ../data/vienna/city1500_flat_1.x3d 12 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna-roads.x3d;../data/vienna/vienna-roofs.x3d 11 # filename ../data/vienna/city1500_flat_1.x3d 12 # filename ../data/vienna/vienna-roads.x3d 13 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roads.x3d;../data/vienna/vienna-roofs.x3d 13 14 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 14 15 filename ../data/vienna/city1500_flat_1.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d … … 29 30 # type rss 30 31 detectEmptyViewSpace true 31 load PolygonsAsMeshes false32 loadMeshes true 32 33 applyVisibilityFilter true 33 34 applyVisibilitySpatialFilter true -
GTP/trunk/Lib/Vis/Preprocessing/scripts/vienna.env
r1052 r1404 8 8 # filename vienna.x3d 9 9 # filename ../data/vienna/vienna-simple.x3d 10 #filename ../data/vienna/vienna-buildings.x3d11 filename ../data/vienna/city1500_flat_1.x3d10 filename ../data/vienna/vienna-buildings.x3d 11 # filename ../data/vienna/city1500_flat_1.x3d 12 12 # filename ../data/vienna/vienna-buildings.x3d;../data/vienna-roads.x3d;../data/vienna/vienna-roofs.x3d 13 filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d13 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 14 14 #filename ../data/vienna/city1500_flat_1.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d 15 15 #filename ../data/vienna/vienna-buildings.x3d;../data/vienna/vienna-roofs.x3d;../data/vienna/vienna-roads.x3d;../data/vienna/vienna-plane.x3d … … 29 29 # type rss 30 30 detectEmptyViewSpace true 31 load PolygonsAsMeshes false31 loadMeshes false 32 32 } 33 33 -
GTP/trunk/Lib/Vis/Preprocessing/src/BoostPreprocessorThread.cpp
r1199 r1404 75 75 void BoostPreprocessorThread::RunThread() 76 76 { 77 mThread->join(); 77 Main(); 78 //mThread->join(); 78 79 } 79 80 -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r1379 r1404 1616 1616 } 1617 1617 1618 /* 1619 Mesh *BvHierarchy::MergeLeafToMesh() 1620 void BvHierarchy::MergeLeavesToMeshes() 1621 { 1622 vector<BvhLeaf *> leaves; 1623 CollectLeaves(leaves); 1624 1625 vector<BvhLeaf *>::const_iterator lit, lit_end = leaves.end(); 1626 1627 for (lit = leaves.begin(); lit != lit_end; ++ lit) 1628 { 1629 Mesh *mesh = MergeLeafToMesh(*lit); 1630 } 1631 }*/ 1632 1618 1633 1619 1634 SubdivisionCandidate *BvHierarchy::PrepareConstruction(const VssRayContainer &sampleRays, … … 1621 1636 { 1622 1637 /////////////////////////////////////////////////////////////// 1623 // note matt: we assume that we have objects sorted by their id 1638 //-- note matt: we assume that we have objects sorted by their id => 1639 //-- we don't have to sort them here and an binary search 1640 //-- for identifying if a object is in a leaf. 1624 1641 1625 1642 mBvhStats.Reset(); -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
r1344 r1404 146 146 { 147 147 SetFilled(); 148 ExportGeometry(leaf->mObjects );148 ExportGeometry(leaf->mObjects, true); 149 149 } 150 150 } … … 221 221 222 222 223 224 } 223 void Exporter::ExportGeometry(const ObjectContainer &objects, 224 const bool exportSingleMesh) 225 { 226 ObjectContainer::const_iterator oit, oit_end = objects.end(); 227 228 if (!exportSingleMesh) 229 { 230 for (oit = objects.begin(); oit != oit_end; ++ oit) 231 { 232 if (0) SetForcedMaterial(RandomMaterial()); 233 ExportIntersectable(*oit); 234 } 235 236 return; 237 } 238 239 //-- all objects exported as one mesh 240 //-- hack: currently it works only for triangles 241 PolygonContainer polys; 242 243 for (oit = objects.begin(); oit != oit_end; ++ oit) 244 { 245 Intersectable *obj = *oit; 246 switch (obj->Type()) 247 { 248 case Intersectable::TRIANGLE_INTERSECTABLE: 249 { 250 TriangleIntersectable *ti = dynamic_cast<TriangleIntersectable *>(obj); 251 polys.push_back(new Polygon3(ti->GetItem())); 252 break; 253 } 254 default: 255 cout << "merging of object type " << obj->Type() << " not implemented yet" << endl; 256 break; 257 } 258 } 259 260 Mesh dummyMesh; 261 PolygonContainer::const_iterator pit, pit_end = polys.end(); 262 263 for (pit = polys.begin(); pit != pit_end; ++ pit) 264 { 265 Polygon3 *poly = (*pit); 266 IncludePolyInMesh(*poly, dummyMesh); 267 } 268 269 ExportMesh(&dummyMesh); 270 CLEAR_CONTAINER(polys); 271 } 272 273 274 275 } -
GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.h
r1344 r1404 123 123 124 124 virtual void 125 ExportGeometry(const ObjectContainer &objects ) = 0;125 ExportGeometry(const ObjectContainer &objects, const bool exportSingleMesh = false); 126 126 127 127 virtual void -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.cpp
r1344 r1404 52 52 53 53 mMaterial = parentMesh->mMaterial; 54 } 55 56 57 Polygon3::Polygon3(const Triangle3 &tri): 58 mMaterial(NULL), 59 mParent(NULL), 60 mPiercingRays(0), 61 mPlane(NULL) 62 { 63 mVertices.reserve(3); 64 65 mVertices.push_back(tri.mVertices[0]); 66 mVertices.push_back(tri.mVertices[1]); 67 mVertices.push_back(tri.mVertices[2]); 54 68 } 55 69 -
GTP/trunk/Lib/Vis/Preprocessing/src/Polygon3.h
r1328 r1404 37 37 */ 38 38 Polygon3(MeshInstance *parent); 39 /** A Triangle is converted to a polygon. 40 */ 41 Polygon3(const Triangle3 &tri); 39 42 40 43 ~Polygon3() {DEL_PTR(mPlane);} -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r1381 r1404 233 233 Parser *parser; 234 234 vector<string> filenames; 235 int files = SplitFilenames(filename, filenames);235 const int files = SplitFilenames(filename, filenames); 236 236 cout << "number of input files: " << files << endl; 237 237 bool result = false; … … 239 239 // root for different files 240 240 mSceneGraph->SetRoot(new SceneGraphNode()); 241 242 // intel ray caster can only trace triangles 243 vector<FaceParentInfo> *fi = (mRayCastMethod == Preprocessor::INTEL_RAYCASTER) ? 244 &mFaceParents : NULL; 241 245 242 246 if (files == 1) { … … 253 257 254 258 cout << filename << endl; 255 256 if (mRayCastMethod == Preprocessor::INTEL_RAYCASTER) 257 { 258 result = parser->ParseFile( 259 260 result = parser->ParseFile( 259 261 filename, 260 262 mSceneGraph->GetRoot(), 261 263 mLoadMeshes, 262 &mFaceParents); 263 } 264 else 265 { 266 result = parser->ParseFile(filename, mSceneGraph->GetRoot(), mLoadMeshes); 267 } 268 264 fi); 265 269 266 delete parser; 270 267 271 } else { 272 273 for (int i= 0; i < filenames.size(); i++) { 274 if (strstr(filenames[i].c_str(), ".x3d")) 275 parser = new X3dParser; 276 else 277 parser = new UnigraphicsParser; 278 279 SceneGraphNode *node = new SceneGraphNode(); 280 bool success; 281 282 if (mRayCastMethod == Preprocessor::INTEL_RAYCASTER) 283 { 284 success = parser->ParseFile( 285 filename, 286 node, 287 mLoadMeshes, 288 &mFaceParents); 289 } 290 else 291 { 292 success = parser->ParseFile(filename, node, mLoadMeshes); 293 } 294 295 if (success) 296 { 297 mSceneGraph->GetRoot()->mChildren.push_back(node); 298 result = true; // at least one file parsed 299 } 300 301 delete parser; 268 } 269 else { 270 vector<string>::const_iterator fit, fit_end = filenames.end(); 271 272 for (fit = filenames.begin(); fit != fit_end; ++ fit) 273 { 274 const string filename = *fit; 275 276 cout << "parsing file " << filename.c_str() << endl; 277 if (strstr(filename.c_str(), ".x3d")) 278 parser = new X3dParser; 279 else 280 parser = new UnigraphicsParser; 281 282 SceneGraphNode *node = new SceneGraphNode(); 283 const bool success = parser->ParseFile( 284 filename, 285 node, 286 mLoadMeshes, 287 fi); 288 289 if (success) 290 { 291 mSceneGraph->GetRoot()->mChildren.push_back(node); 292 result = true; // at least one file parsed 293 } 294 295 delete parser; 302 296 } 303 297 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r1381 r1404 2625 2625 } 2626 2626 2627 /////////////////////////////////////// 2627 2628 //-- post processing of bsp view cells 2628 2629 … … 3755 3756 } 3756 3757 3757 if ( 0)3758 if (1) 3758 3759 { 3759 3760 mColorCode = 1; // export merged view cells using pvs coding … … 5127 5128 if (mExportGeometry) 5128 5129 { 5129 exporter->ExportGeometry(objects );5130 exporter->ExportGeometry(objects, true); 5130 5131 } 5131 5132 -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r1344 r1404 1108 1108 1109 1109 1110 void VrmlExporter::ExportGeometry(const ObjectContainer &objects)1111 {1112 ObjectContainer::const_iterator oit, oit_end = objects.end();1113 1114 if (1)1115 {1116 // export using native or random material1117 for (oit = objects.begin(); oit != oit_end; ++ oit)1118 {1119 if (0)1120 {1121 mUseForcedMaterial = true;1122 SetForcedMaterial(RandomMaterial());1123 }1124 ExportIntersectable(*oit);1125 }1126 return;1127 }1128 1129 ///////////////////////////////////1130 // method 2 (hacky)1131 // all object exported as one mesh1132 PolygonContainer polys;1133 1134 for (oit = objects.begin(); oit != oit_end; ++ oit)1135 {1136 MeshInstance *mi = dynamic_cast<MeshInstance *>(*oit);1137 polys.push_back(new Polygon3(mi->GetMesh()->mVertices));1138 }1139 1140 Mesh dummyMesh;1141 PolygonContainer::const_iterator pit, pit_end = polys.end();1142 1143 for (pit = polys.begin(); pit != pit_end; ++ pit)1144 {1145 Polygon3 *poly = (*pit);1146 IncludePolyInMesh(*poly, dummyMesh);1147 }1148 1149 ExportMesh(&dummyMesh);1150 1151 CLEAR_CONTAINER(polys);1152 }1153 1154 1155 1156 1110 bool VrmlExporter::ExportRssTree2(const RssTree &tree, 1157 1111 const Vector3 direction) -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.h
r1344 r1404 89 89 ExportViewCell(ViewCell *viewCell); 90 90 91 virtual void92 ExportGeometry(const ObjectContainer &objects);93 94 91 bool 95 92 ExportRays(const RayContainer &rays, -
GTP/trunk/Lib/Vis/Preprocessing/src/VssPreprocessor.cpp
r1328 r1404 466 466 mSceneGraph->CollectObjects(&mObjects); 467 467 468 //-- load view cells from file or reconstruct them469 468 if (!mLoadViewCells) 470 469 { 470 //-- generate new view cells or reconstruct them 471 //-- for construction the manager uses it's own set of samples 471 472 mViewCellsManager->SetViewSpaceBox(vbox); 472 // construct view cells using it's own set of samples473 473 mViewCellsManager->Construct(this); 474 474 475 // -- severalvisualizations and statistics475 // output visualizations and statistics 476 476 Debug << "view cells construction finished: " << endl; 477 477 mViewCellsManager->PrintStatistics(Debug); 478 478 } 479 #if 1 // test successful view cells loading by exporting them again479 #if 1 480 480 else 481 481 { 482 VssRayContainer dummies; 482 //-- load view cells from file 483 //-- test successful view cells loading by exporting them again 484 VssRayContainer dummies; 483 485 mViewCellsManager->Visualize(mObjects, dummies); 484 486 mViewCellsManager->ExportViewCells("test.xml.zip", mViewCellsManager->GetExportPvs(), mObjects); 485 487 } 486 488 #endif 489 487 490 VssTree *vssTree = NULL; 488 489 long initialTime = GetTime(); 491 const long initialTime = GetTime(); 490 492 491 493 if (mLoadInitialSamples) -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r1344 r1404 1047 1047 1048 1048 1049 void X3dExporter::ExportGeometry(const ObjectContainer &objects)1050 {1051 ObjectContainer::const_iterator oit, oit_end = objects.end();1052 1053 if (1)1054 {1055 for (oit = objects.begin(); oit != oit_end; ++ oit)1056 {1057 if (0)1058 SetForcedMaterial(RandomMaterial());1059 1060 ExportIntersectable(*oit);1061 }1062 1063 return;1064 }1065 1066 // hack: all object exported as one mesh1067 PolygonContainer polys;1068 1069 for (oit = objects.begin(); oit != oit_end; ++ oit)1070 {1071 polys.push_back(new Polygon3(dynamic_cast<MeshInstance *>(*oit)->GetMesh()->mVertices));1072 }1073 1074 Mesh dummyMesh;1075 PolygonContainer::const_iterator pit, pit_end = polys.end();1076 1077 for (pit = polys.begin(); pit != pit_end; ++ pit)1078 {1079 Polygon3 *poly = (*pit);1080 IncludePolyInMesh(*poly, dummyMesh);1081 }1082 1083 ExportMesh(&dummyMesh);1084 1085 CLEAR_CONTAINER(polys);1086 }1087 1088 1089 1049 bool 1090 1050 X3dExporter::ExportRssTree2(const RssTree &tree, -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.h
r1344 r1404 86 86 ExportViewCell(ViewCell *viewCell); 87 87 88 virtual void89 ExportGeometry(const ObjectContainer &objects);90 91 88 bool 92 89 ExportRays(const RayContainer &rays, -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
r1379 r1404 250 250 for (tit = triangles.begin(); tit != tit_end; ++ tit) 251 251 { 252 cout << "triangle: " << *tit << endl;252 //cout << "triangle: " << *tit << endl; 253 253 TriangleIntersectable *ti = new TriangleIntersectable(*tit); 254 254 mCurrentNode->mGeometry.push_back(ti); … … 292 292 mCurrentNode->mGeometry.push_back(mi); 293 293 294 if (mCurrentMaterial )294 if (mCurrentMaterial && !mCurrentMesh->mMaterial) 295 295 { 296 296 // HACK: add the material to the mesh directly if no material yet 297 if (!mCurrentMesh->mMaterial) 298 mCurrentMesh->mMaterial = mCurrentMaterial; 297 mCurrentMesh->mMaterial = mCurrentMaterial; 299 298 } 300 299 } -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r1387 r1404 2 2 //#define USE_QT 0 3 3 #endif 4 4 //#define USE_QT 0 5 5 #define USE_THREADS 1 6 6 … … 180 180 preprocessor->KdTreeStatistics(cout); 181 181 182 /*preprocessor->mKdTree->ExportBinTree("kd.bin.gz");183 MeshManager::GetSingleton()->ExportEntries("meshes.bin");184 185 KdTree *kdTree2 = new KdTree;186 187 cout << "loading kd tree ... ";188 long startTime = GetTime();189 kdTree2->LoadBinTree("kd.bin.gz", preprocessor->mObjects);190 191 cout << "finished in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl;192 193 Exporter *exporter = Exporter::GetExporter("testkd.x3d");194 MeshManager::GetSingleton()->ExportEntries("meshes.bin");195 196 if (exporter)197 {198 exporter->SetWireframe();199 exporter->ExportKdTree(*kdTree2, true);200 201 delete exporter;202 }203 204 DEL_PTR(kdTree2);205 */206 182 // parse view cells related options 207 183 preprocessor->PrepareViewCells(); … … 256 232 257 233 rendererWidget->Show(); 258 guiSupported = true; 259 260 234 guiSupported = true; 261 235 } 262 236 263 qApp->exec(); 264 237 qApp->exec(); 265 238 #endif 266 239 }
Note: See TracChangeset
for help on using the changeset viewer.