Changeset 658 for GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
- Timestamp:
- 02/21/06 09:51:03 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.