Changeset 2601 for GTP/trunk/Lib/Vis
- Timestamp:
- 01/16/08 17:18:02 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_arena.sh
r2596 r2601 6 6 #TARGET=debug 7 7 TARGET=release 8 PROGRAM=../bin/$TARGET/Preprocessor.exe 8 COMMAND="../bin/$TARGET/Preprocessor.exe -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000" 9 9 10 10 echo "starting $TARGET version" … … 21 21 22 22 23 $ PROGRAM$ENVIRONMENT \23 $COMMAND $ENVIRONMENT \ 24 24 -scene_filename=$SCENE \ 25 25 -preprocessor=gvs \ … … 28 28 -gvs_samples_per_pass=50000 \ 29 29 -gvs_initial_samples=16 \ 30 -gvs_max_viewcells= 10 \30 -gvs_max_viewcells=200 \ 31 31 -gvs_min_contribution=50 \ 32 32 -gvs_per_viewcell=true \ -
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vienna.sh
r2596 r2601 7 7 TARGET=release 8 8 PROGRAM=../bin/$TARGET/Preprocessor.exe 9 10 COMMAND="../bin/$TARGET/Preprocessor.exe -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000" 11 9 12 10 13 echo "starting $TARGET version" … … 22 25 23 26 24 $ PROGRAM$ENVIRONMENT \27 $COMMAND $ENVIRONMENT \ 25 28 -scene_filename=$SCENE \ 26 29 -preprocessor=gvs \ … … 29 32 -gvs_samples_per_pass=50000 \ 30 33 -gvs_initial_samples=16 \ 31 -gvs_max_viewcells=10 \34 -gvs_max_viewcells=100 \ 32 35 -gvs_min_contribution=50 \ 33 36 -gvs_per_viewcell=true \ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2600 r2601 84 84 mCurrentFrame(-1) 85 85 { 86 mSceneGraph->CollectObjects( &mObjects);86 mSceneGraph->CollectObjects(mObjects); 87 87 88 88 #if 1 … … 400 400 OcclusionQuery::GenQueries(mOcclusionQueries, 10); 401 401 402 CreateVertexArrays(static_cast<SceneGraphLeaf *>(mSceneGraph->GetRoot())); 402 SceneGraphInterior *interior = mSceneGraph->GetRoot(); 403 404 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 405 406 for (; ni != interior->mChildren.end(); ni++) 407 { 408 CreateVertexArrays(static_cast<SceneGraphLeaf *>(*ni)); 409 } 403 410 } 404 411 … … 1736 1743 glNormalPointer(GL_FLOAT, 0, (char *)NULL + offset * sizeof(Vector3)); 1737 1744 1738 glBufferDataARB(GL_ARRAY_BUFFER_ARB, leaf->m Objects.size() * 6 * sizeof(Vector3), mData, GL_STATIC_DRAW_ARB);1745 glBufferDataARB(GL_ARRAY_BUFFER_ARB, leaf->mGeometry.size() * 6 * sizeof(Vector3), mData, GL_STATIC_DRAW_ARB); 1739 1746 glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); 1740 1747 -
GTP/trunk/Lib/Vis/Preprocessing/src/GvsPreprocessor.cpp
r2598 r2601 343 343 hitTriangle = static_cast<TriangleIntersectable *>(tObj)->GetItem(); 344 344 else 345 cout << "border sampling: " << tObj->Type() << " not yet implemented" << endl; 345 cout << "border sampling: " << Intersectable::GetTypeName(tObj) << " not yet implemented" << endl; 346 347 //cout << "type: " << Intersectable::GetTypeName(tObj) << endl; 346 348 347 349 VertexContainer enlargedTriangle; … … 912 914 // exchange triangle pvs with objects 913 915 //UpdatePvs(mCurrentViewCell); 914 GetObjectPvs(objectPvs); 916 GetObjectPvs(objectPvs); 917 918 // add pvs 919 ObjectContainer::const_iterator it, it_end = objectPvs.end(); 920 921 for (it = objectPvs.begin(); it != it_end; ++ it) 922 { 923 mCurrentViewCell->GetPvs().AddSampleDirty(*it, 1.0f); 924 } 915 925 916 926 cout << "triangle pvs of " << (int)mTrianglePvs.size() 917 927 << " was converted to object pvs of " << (int)objectPvs.size() << endl; 928 918 929 919 930 //////// -
GTP/trunk/Lib/Vis/Preprocessing/src/MutualVisibility.cpp
r2176 r2601 521 521 522 522 exporter->SetWireframe(); 523 // 523 // exporter->ExportScene(mSceneGraph->GetRoot()); 524 524 525 525 exporter->ExportBox(mSource); … … 682 682 683 683 MutualVisibilitySampler::MutualVisibilitySampler(SceneGraph *sceneGraph, 684 685 686 687 688 { 689 690 691 692 693 694 695 } 696 684 KdTree *kdTree, 685 const AxisAlignedBox3 &source, 686 const AxisAlignedBox3 &target, 687 const float solidAngleThreshold) 688 { 689 mSceneGraph = sceneGraph; 690 mKdTree = kdTree; 691 mSource = source; 692 mTarget = target; 693 mUseBoxes = true; 694 mSolidAngleThreshold = solidAngleThreshold; 695 } 696 697 697 698 698 int 699 699 ComputeBoxVisibility(SceneGraph *sceneGraph, 700 701 702 703 704 { 705 700 KdTree *kdTree, 701 const AxisAlignedBox3 &source, 702 const AxisAlignedBox3 &target, 703 const float solidAngleThreshold) 704 { 705 MutualVisibilitySampler 706 706 sampler(sceneGraph, kdTree, source, target, solidAngleThreshold); 707 707 708 709 int visibility = sampler.ComputeVisibility(); 710 711 return visibility; 712 713 } 714 715 } 708 int visibility = sampler.ComputeVisibility(); 709 710 return visibility; 711 712 } 713 714 } -
GTP/trunk/Lib/Vis/Preprocessing/src/ObjExporter.cpp
r2176 r2601 26 26 ObjExporter::ExportSceneNode(SceneGraphNode *node) 27 27 { 28 SceneGraphNodeContainer::iterator ni = node->mChildren.begin(); 29 for (; ni != node->mChildren.end(); ni++) 30 ExportSceneNode(*ni); 31 32 33 ObjectContainer::const_iterator mi = node->mGeometry.begin(); 34 for (; mi != node->mGeometry.end(); mi++) { 35 // export the transform... 36 ExportIntersectable(*mi); 37 } 38 28 if (!node->IsLeaf()) 29 { 30 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 31 32 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 33 34 for (; ni != interior->mChildren.end(); ni++) 35 ExportSceneNode(*ni); 36 } 37 else 38 { 39 40 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); 41 42 ObjectContainer::const_iterator mi = leaf->mGeometry.begin(); 43 44 for (; mi != leaf->mGeometry.end(); mi++) 45 { // export the transform ... 46 ExportIntersectable(*mi); 47 } 48 } 39 49 } 40 41 50 42 51 void -
GTP/trunk/Lib/Vis/Preprocessing/src/PlyParser.cpp
r2600 r2601 167 167 ply_close (ply); 168 168 169 SceneGraph Node*currentNode = root;169 SceneGraphLeaf *currentNode = root; 170 170 171 171 cerr<<"Baking faces into meshes"<<endl; … … 217 217 meshProxy.mFaces.push_back(new Face(vc)); 218 218 } 219 219 220 220 if (meshProxy.mFaces.size()) { 221 221 222 223 meshProxy.IndexVertices();224 225 226 227 228 229 230 231 232 233 mesh->AssignRandomMaterial();234 235 236 237 238 222 if (indexVertices) 223 meshProxy.IndexVertices(); 224 225 Mesh *mesh = new Mesh((int)meshProxy.mVertices.size(), 226 (int)meshProxy.mFaces.size()); 227 228 mesh->mVertices = meshProxy.mVertices; 229 230 mesh->mFaces = meshProxy.mFaces; 231 232 if (useRandomMaterial) 233 mesh->AssignRandomMaterial(); 234 235 mesh->Preprocess(); 236 // make an instance of this mesh 237 MeshInstance *mi = new MeshInstance(mesh); 238 currentNode->mGeometry.push_back(mi); 239 239 } 240 240 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r2600 r2601 240 240 241 241 242 bool Preprocessor::ExportBinaryObj(const string &filename, SceneGraph Node*root)242 bool Preprocessor::ExportBinaryObj(const string &filename, SceneGraphLeaf *root) 243 243 { 244 244 ogzstream samplesOut(filename.c_str()); … … 406 406 407 407 // root for different files 408 mSceneGraph->SetRoot(new SceneGraph Node());408 mSceneGraph->SetRoot(new SceneGraphInterior()); 409 409 410 410 // intel ray caster can only trace triangles … … 421 421 if (files == 1) 422 422 { 423 SceneGraphLeaf *leaf = new SceneGraphLeaf(); 424 423 425 if (strstr(filename.c_str(), ".x3d")) 424 426 { 425 427 parser = new X3dParser; 426 428 427 429 result = parser->ParseFile(filename, 428 mSceneGraph->GetRoot(), 430 leaf, 431 mLoadMeshes, 432 fi); 433 delete parser; 434 } 435 else if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb")) 436 { 437 parser = new PlyParser; 438 439 result = parser->ParseFile(filename, 440 leaf, 429 441 mLoadMeshes, 430 442 fi); 431 443 delete parser; 432 444 } 433 else if (strstr(filename.c_str(), ".ply") || strstr(filename.c_str(), ".plb"))434 {435 parser = new PlyParser;436 437 result = parser->ParseFile(filename,438 mSceneGraph->GetRoot(),439 mLoadMeshes,440 fi);441 delete parser;442 }443 445 else if (strstr(filename.c_str(), ".obj")) 444 446 { … … 450 452 if (!mLoadMeshes) 451 453 { 452 result = LoadBinaryObj(bnFile, mSceneGraph->GetRoot(), fi);454 result = LoadBinaryObj(bnFile, leaf, fi); 453 455 } 454 456 … … 459 461 parser = new ObjParser; 460 462 461 result = parser->ParseFile(filename, mSceneGraph->GetRoot(), mLoadMeshes, fi);462 463 cout << "loaded " << (int) mSceneGraph->GetRoot()->mGeometry.size() << " entities" << endl;463 result = parser->ParseFile(filename, leaf, mLoadMeshes, fi); 464 465 cout << "loaded " << (int)leaf->mGeometry.size() << " entities" << endl; 464 466 465 467 // only works for triangles … … 468 470 cout << "exporting binary obj to " << bnFile << "... " << endl; 469 471 470 ExportBinaryObj(bnFile, mSceneGraph->GetRoot());472 ExportBinaryObj(bnFile, leaf); 471 473 472 474 cout << "finished" << endl; … … 479 481 { 480 482 parser = new UnigraphicsParser; 481 result = parser->ParseFile(filename, mSceneGraph->GetRoot(), mLoadMeshes, fi);483 result = parser->ParseFile(filename, leaf, mLoadMeshes, fi); 482 484 delete parser; 485 } 486 487 if (result) 488 { 489 mSceneGraph->GetRoot()->mChildren.push_back(leaf); 483 490 } 484 491 … … 499 506 parser = new UnigraphicsParser; 500 507 501 SceneGraphNode *node = new SceneGraphNode(); 508 SceneGraphLeaf *node = new SceneGraphLeaf(); 509 502 510 const bool success = 503 511 parser->ParseFile(filename, node, mLoadMeshes, fi); … … 526 534 527 535 mObjects.reserve(intersectables); 528 mSceneGraph->CollectObjects( &mObjects);536 mSceneGraph->CollectObjects(mObjects); 529 537 530 538 mSceneGraph->AssignObjectIds(); … … 584 592 KdLeaf *root = (KdLeaf *)mKdTree->GetRoot(); 585 593 586 mSceneGraph->CollectObjects( &root->mObjects);594 mSceneGraph->CollectObjects(root->mObjects); 587 595 588 596 const long startTime = GetTime(); … … 1618 1626 { 1619 1627 // bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), &mFaceParents); 1620 bool success = LoadBinaryObj(filename, mSceneGraph->GetRoot(), NULL); 1621 1622 return success; 1623 } 1624 1625 } 1628 SceneGraphLeaf *leaf = new SceneGraphLeaf(); 1629 if (LoadBinaryObj(filename, leaf, NULL)) 1630 { 1631 mSceneGraph->GetRoot()->mChildren.push_back(leaf); 1632 return true; 1633 } 1634 1635 return false; 1636 } 1637 1638 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2593 r2601 1008 1008 // cout<<i<<":"<<costFunction[i]<<" "; 1009 1009 // update cost function to an absolute value based on the total geometry count 1010 costFunction[i] *=mSceneGraph->GetRoot()->mGeometry.size();1010 costFunction[i] *= mSceneGraph->GetSize(); 1011 1011 if (costFunction[i] > maxCost) 1012 1012 maxCost = costFunction[i]; … … 1334 1334 { 1335 1335 mUseFalseColors = true; 1336 1337 1336 //glPushAttrib(GL_CURRENT_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT); 1338 1337 … … 1341 1340 //glDisable(GL_CULL_FACE); 1342 1341 1343 double eq[4];1344 eq[0] = mSceneCutPlane.mNormal.x;1345 eq[1] = mSceneCutPlane.mNormal.y;1346 eq[2] = mSceneCutPlane.mNormal.z;1347 eq[3] = mSceneCutPlane.mD;1348 1349 1342 if (mCutViewCells) 1350 1343 { 1344 double eq[4]; 1345 eq[0] = mSceneCutPlane.mNormal.x; 1346 eq[1] = mSceneCutPlane.mNormal.y; 1347 eq[2] = mSceneCutPlane.mNormal.z; 1348 eq[3] = mSceneCutPlane.mD; 1349 1351 1350 glClipPlane(GL_CLIP_PLANE0, eq); 1352 1351 glEnable(GL_CLIP_PLANE0); … … 1362 1361 int i; 1363 1362 1364 if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost) 1363 // normal rendering 1364 if (!mShowPvsSizes && !mShowPiercingRays && !mShowWeightedRays && !mShowWeightedCost && !mShowComparison) 1365 1365 { 1366 1366 for (i = 0; i < viewcells.size(); ++ i) … … 1383 1383 } 1384 1384 } 1385 else 1385 else // using specialised colors 1386 1386 { 1387 1387 // transparency -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.cpp
r2600 r2601 66 66 67 67 68 SceneGraph Node*SceneGraph::GetRoot()68 SceneGraphInterior *SceneGraph::GetRoot() 69 69 { 70 70 return mRoot; … … 72 72 73 73 74 void SceneGraph::SetRoot(SceneGraph Leaf*root)74 void SceneGraph::SetRoot(SceneGraphInterior *root) 75 75 { 76 76 mRoot = root; … … 80 80 int SceneGraph::CollectObjects(ObjectContainer &instances) 81 81 { 82 instances ->clear();82 instances.clear(); 83 83 int number = 0; 84 84 … … 93 93 if (node->IsLeaf()) 94 94 { 95 SceneGraphLeaf *leaf = static_cast<SceneGraph NodeLeaf *>(node);95 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); 96 96 97 97 ObjectContainer::const_iterator mi = leaf->mGeometry.begin(); … … 99 99 for (; mi != leaf->mGeometry.end(); mi++) 100 100 { 101 instances ->push_back(*mi);102 } 103 } 104 else 105 { 106 SceneGraphInterior *interior = static_cast<SceneGraph NodeInterior *>(node);101 instances.push_back(*mi); 102 } 103 } 104 else 105 { 106 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 107 107 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 108 108 … … 133 133 nodeStack.pop(); 134 134 135 if (node->IsLeaf )135 if (node->IsLeaf()) 136 136 { 137 137 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); … … 146 146 { 147 147 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 148 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 149 for (; ni != node->mChildren.end(); ni ++) 148 149 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 150 151 for (; ni != interior->mChildren.end(); ni ++) 150 152 { 151 153 nodeStack.push(*ni); … … 166 168 faces = 0; 167 169 intersectables = 0; 168 while (!nodeStack.empty()) { 169 SceneGraphNode *node = nodeStack.top(); 170 nodeStack.pop(); 171 172 ObjectContainer::const_iterator mi = node->mGeometry.begin(); 173 for (; mi != node->mGeometry.end(); mi++) { 174 intersectables++; 175 faces += (*mi)->NumberOfFaces(); 176 } 177 178 SceneGraphNodeContainer::iterator ni = node->mChildren.begin(); 179 for (; ni != node->mChildren.end(); ni++) { 180 nodeStack.push(*ni); 181 } 182 } 183 184 } 185 186 187 void SceneGraphInterior::UpdateBox() 170 171 while (!nodeStack.empty()) 172 { 173 SceneGraphNode *node = nodeStack.top(); 174 nodeStack.pop(); 175 176 if (node->IsLeaf()) 177 { 178 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); 179 180 ObjectContainer::const_iterator mi = leaf->mGeometry.begin(); 181 for (; mi != leaf->mGeometry.end(); mi++) 182 { 183 intersectables++; 184 faces += (*mi)->NumberOfFaces(); 185 } 186 } 187 else 188 { 189 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 190 191 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 192 for (; ni != interior->mChildren.end(); ni++) 193 { 194 nodeStack.push(*ni); 195 } 196 } 197 } 198 } 199 200 201 void SceneGraphLeaf::UpdateBox() 188 202 { 189 203 AxisAlignedBox3 box; … … 198 212 199 213 200 void SceneGraph Leaf::UpdateBox()214 void SceneGraphInterior::UpdateBox() 201 215 { 202 216 AxisAlignedBox3 box; … … 229 243 230 244 231 } 245 int SceneGraph::GetSize() const 246 { 247 stack<SceneGraphNode *> nodeStack; 248 249 nodeStack.push(mRoot); 250 int size = 0; 251 252 while (!nodeStack.empty()) 253 { 254 SceneGraphNode *node = nodeStack.top(); 255 nodeStack.pop(); 256 257 if (node->IsLeaf()) 258 { 259 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); 260 261 size += leaf->mGeometry.size(); 262 } 263 else 264 { 265 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 266 267 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 268 for (; ni != interior->mChildren.end(); ni++) 269 { 270 nodeStack.push(*ni); 271 } 272 } 273 } 274 275 return size; 276 } 277 278 } -
GTP/trunk/Lib/Vis/Preprocessing/src/SceneGraph.h
r2600 r2601 39 39 //protected: 40 40 41 NodeContainer mChildren;41 SceneGraphNodeContainer mChildren; 42 42 }; 43 43 … … 54 54 //protected: 55 55 56 MeshContainer mGeometry; 56 //MeshContainer mGeometry; 57 ObjectContainer mGeometry; 57 58 }; 58 59 … … 69 70 bool Export(const std::string filename); 70 71 71 int CollectObjects(ObjectContainer *instances);72 int CollectObjects(ObjectContainer &instances); 72 73 73 74 int AssignObjectIds(); … … 85 86 void LoadScene(const std::string filename); 86 87 87 SceneGraph Node*GetRoot();88 SceneGraphInterior *GetRoot(); 88 89 89 void SetRoot(SceneGraphNode *sgNnode); 90 //void SetRoot(SceneGraphNode *sgNnode); 91 void SetRoot(SceneGraphInterior *sgNnode); 90 92 93 void AddChild(SceneGraphNode *node); 94 95 int GetSize() const; 91 96 92 97 protected: 93 98 94 SceneGraph Node*mRoot;99 SceneGraphInterior *mRoot; 95 100 }; 96 101 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2600 r2601 1688 1688 // create temporary scene graph for loading the view cells geometry 1689 1689 // note: delete the meshes as they are created two times for transformed mesh instances. 1690 SceneGraph Node*root = new SceneGraphLeaf();1690 SceneGraphLeaf *root = new SceneGraphLeaf(); 1691 1691 const bool success = parser.ParseFile(filename, root, true); 1692 1692 -
GTP/trunk/Lib/Vis/Preprocessing/src/VrmlExporter.cpp
r2176 r2601 162 162 stream << "Group {" << endl; 163 163 164 SceneGraphNodeContainer::iterator ni = node->mChildren.begin(); 165 166 for (; ni != node->mChildren.end(); ni++) 167 { 168 ExportSceneNode(*ni); 169 } 170 ObjectContainer::const_iterator mi = node->mGeometry.begin(); 171 172 for (; mi != node->mGeometry.end(); mi++) 173 { 174 // export the transform... 175 ExportIntersectable(*mi); 176 } 177 164 if (!node->IsLeaf()) 165 { 166 SceneGraphInterior *interior = static_cast<SceneGraphInterior *>(node); 167 168 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 169 170 for (; ni != interior->mChildren.end(); ni++) 171 { 172 ExportSceneNode(*ni); 173 } 174 } 175 else 176 { 177 SceneGraphLeaf *leaf = static_cast<SceneGraphLeaf *>(node); 178 179 ObjectContainer::const_iterator mi = leaf->mGeometry.begin(); 180 181 for (; mi != leaf->mGeometry.end(); mi++) 182 { 183 // export the transform... 184 ExportIntersectable(*mi); 185 } 186 } 187 178 188 stream<<"</Group>"<<endl; 179 189 } -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dExporter.cpp
r2600 r2601 195 195 196 196 SceneGraphNodeContainer::iterator ni = interior->mChildren.begin(); 197 for (; ni != interior->mChildren.end(); ni++)197 for (; ni != interior->mChildren.end(); ++ ni) 198 198 ExportSceneNode(*ni); 199 199 }
Note: See TracChangeset
for help on using the changeset viewer.