- Timestamp:
- 02/21/06 09:51:03 (19 years ago)
- Location:
- GTP/trunk/Lib/Vis
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/default.env
r656 r658 13 13 #;../data/vienna/vienna-plane.x3d 14 14 # filename ../data/vienna/viewcells-25-sel.x3d 15 #filename ../data/atlanta/atlanta2.x3d15 filename ../data/atlanta/atlanta2.x3d 16 16 # filename ../data/soda/soda.dat 17 filename ../data/soda/soda5.dat17 # filename ../data/soda/soda5.dat 18 18 } 19 19 … … 26 26 # type rss 27 27 detectEmptyViewSpace true 28 loadPolygonsAsMeshes true 28 29 } 29 30 -
GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
r655 r658 1530 1530 "false"); 1531 1531 1532 RegisterOption("Preprocessor.loadPolygonsAsMeshes", 1533 optBool, 1534 "loadPolygonsAsMeshes=", 1535 "false"); 1536 1532 1537 RegisterOption("Preprocessor.pvsRenderErrorSamples", 1533 1538 optInt, -
GTP/trunk/Lib/Vis/Preprocessing/src/Parser.h
r508 r658 14 14 Parser() {} 15 15 16 virtual bool ParseFile(const string filename, SceneGraphNode **root) {return false;}; 16 virtual bool ParseFile(const string filename, 17 SceneGraphNode **root, 18 const bool loadPolygonsAsMeshes = false) {return false;}; 17 19 18 20 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
r656 r658 28 28 29 29 environment->GetBoolValue("Preprocessor.useGlDebugger", mUseGlDebugger); 30 environment->GetBoolValue("Preprocessor.loadPolygonsAsMeshes", mLoadPolygonsAsMeshes); 30 31 environment->GetBoolValue("Preprocessor.quitOnFinish", mQuitOnFinish); 31 32 … … 89 90 90 91 cout<<filename<<endl; 91 result = parser->ParseFile(filename, &mSceneGraph->mRoot );92 result = parser->ParseFile(filename, &mSceneGraph->mRoot, mLoadPolygonsAsMeshes); 92 93 93 94 delete parser; … … 123 124 mSceneGraph->CollectObjects(&mObjects); 124 125 mSceneGraph->mRoot->UpdateBox(); 126 127 Exporter *exporter = Exporter::GetExporter("testload.x3d"); 128 129 if (exporter) 130 { 131 exporter->ExportGeometry(mObjects); 132 delete exporter; 133 } 134 125 135 } 126 136 -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
r599 r658 158 158 159 159 bool mQuitOnFinish; 160 bool mLoadPolygonsAsMeshes; 161 160 162 protected: 161 163 -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.cpp
r340 r658 26 26 bool 27 27 UnigraphicsParser::ParseFile(const string filename, 28 SceneGraphNode **proot) 28 SceneGraphNode **proot, 29 const bool loadPolygonsAsMeshese) 29 30 { 30 31 -
GTP/trunk/Lib/Vis/Preprocessing/src/UnigraphicsParser.h
r162 r658 15 15 UnigraphicsParser(): Parser() {} 16 16 17 virtual bool ParseFile(const string filename, SceneGraphNode **root );17 virtual bool ParseFile(const string filename, SceneGraphNode **root, const bool loadPolygonsAsMeshes = false); 18 18 19 19 }; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r651 r658 1051 1051 if (exporter) 1052 1052 { 1053 1054 1053 if (0 && mExportRays) 1055 1054 exporter->ExportRays(rays, RgbColor(1, 1, 1)); 1056 1057 1055 1058 1056 if (mExportGeometry) -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
r657 r658 90 90 X3dParseHandlers::EndShape() 91 91 { 92 if (mCurrentMesh->mFaces.size()) { 93 mCurrentMesh->Preprocess(); 94 // make an instance of this mesh 95 MeshInstance *mi = new MeshInstance(mCurrentMesh); 96 mCurrentNode->mGeometry.push_back(mi); 97 // set the object id to a unique value 98 //mi->SetId(mCurrentObjectId ++); 99 } else { 100 cout<<"X"; 101 delete mCurrentMesh; 102 } 103 mCurrentMesh = NULL; 104 } 105 92 if (mLoadPolygonsAsMeshes) 93 { 94 vector<VertexIndexContainer>::const_iterator it, it_end = mCurrentVertexIndices.end(); 95 96 for (it = mCurrentVertexIndices.begin(); it != it_end; ++ it) 97 { 98 // only one face per mesh 99 Mesh *mesh = new Mesh(); 100 101 // add vertices 102 for (int i = 0; i < (int)(*it).size(); ++ i) 103 { 104 mesh->mVertices.push_back(mCurrentVertices[(*it)[i]]); 105 106 } 107 108 mesh->mFaces.push_back(new Face(0,1,2)); 109 mesh->Preprocess(); 110 // make an instance of this mesh 111 MeshInstance *mi = new MeshInstance(mesh); 112 mCurrentNode->mGeometry.push_back(mi); 113 114 } 115 116 delete mCurrentMesh; 117 mCurrentVertices.clear(); 118 mCurrentVertexIndices.clear(); 119 } 120 else 121 { 122 123 if (mCurrentMesh->mFaces.size()) 124 { 125 mCurrentMesh->Preprocess(); 126 // make an instance of this mesh 127 MeshInstance *mi = new MeshInstance(mCurrentMesh); 128 mCurrentNode->mGeometry.push_back(mi); 129 // set the object id to a unique value 130 //mi->SetId(mCurrentObjectId ++); 131 } 132 else 133 { 134 cout<<"X"; 135 delete mCurrentMesh; 136 } 137 mCurrentMesh = NULL; 138 } 139 } 106 140 void 107 141 X3dParseHandlers::StartIndexedFaceSet( … … 126 160 Face *face = new Face(vertices); 127 161 128 mCurrentMesh->mFaces.push_back(face); 129 130 // every polygon is a mesh => store in mesh instance and create new mesh 131 if (mLoadPolygonsAsMeshes) 132 { 133 mCurrentMesh->Preprocess(); 134 135 // make an instance of this mesh 136 MeshInstance *mi = new MeshInstance(mCurrentMesh); 137 mCurrentNode->mGeometry.push_back(mi); 138 139 mCurrentMesh = new Mesh(); 140 } 141 162 if (!mLoadPolygonsAsMeshes) 163 { 164 mCurrentMesh->mFaces.push_back(face); 165 } 166 else 167 // every polygon is a mesh 168 { 169 mCurrentVertexIndices.push_back(vertices); 170 } 142 171 } 172 143 173 vertices.clear(); 144 174 if (ptr == endptr) … … 223 253 vertices.push_back(v); 224 254 } 225 mCurrentMesh->mVertices = vertices; 255 if (mLoadPolygonsAsMeshes) 256 { 257 mCurrentVertices = vertices; 258 } 259 else 260 { 261 mCurrentMesh->mVertices = vertices; 262 } 226 263 } 227 264 } … … 243 280 if (element == "Shape") { 244 281 cout<<"+"; 245 282 mCurrentMesh = new Mesh; 246 283 } 247 284 -
GTP/trunk/Lib/Vis/Preprocessing/src/X3dParserXerces.h
r657 r658 63 63 SceneGraphNode *mCurrentNode; 64 64 Mesh *mCurrentMesh; 65 vector<VertexIndexContainer> mCurrentVertexIndices; 66 VertexContainer mCurrentVertices; 67 65 68 Material *mCurrentMaterial; 66 69 bool mLoadPolygonsAsMeshes; … … 159 162 160 163 VertexIndexContainer mCurrentVertexIndices; 161 164 162 165 // Handlers for X3D 163 166 void
Note: See TracChangeset
for help on using the changeset viewer.