- Timestamp:
- 01/15/07 13:58:15 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp
r1978 r1979 76 76 static void LoadTriangles(char *str, 77 77 const VertexContainer &vertices, 78 vector<Triangle3> &triangles) 78 vector<Triangle3> &triangles, 79 const int line) 79 80 { 80 81 char *pch = strtok(str + 1, " "); … … 82 83 VertexIndexContainer indices; 83 84 84 int i = 0;85 85 while (pch != NULL) 86 86 { 87 87 const int index = (int)strtol(pch, NULL, 10) - 1; 88 ++ i; 89 88 90 89 // store vertex in hash table 91 90 //hashTable[index] = vertices[index]; 92 91 indices.push_back(index); 93 92 93 //if (line == 451703) 94 // cout << index + 1 << " "; 95 94 96 pch = strtok(NULL, " "); 95 97 … … 101 103 102 104 triangles.push_back(Triangle3(vertices[indices[0]], 103 vertices[indices[index_2]], 104 vertices[indices[index_3]])); 105 vertices[indices[index_2]], 106 vertices[indices[index_3]])); 105 107 } 106 108 } 109 //if (line == 451703) 110 // cout << "t: " << triangles.size() << endl; 107 111 } 108 112 … … 221 225 FaceContainer faces; 222 226 223 char str[100]; 227 int line = 0; 228 229 char str[1000]; 224 230 int meshGrouping; 225 231 Environment::GetSingleton()->GetIntValue("ObjParser.meshGrouping", meshGrouping); … … 227 233 int nMaxFaces = meshGrouping; 228 234 229 while (fgets(str, 80, file) != NULL)230 { 235 while (fgets(str, 1000, file) != NULL) 236 {++ line; 231 237 switch (str[0]) 232 238 { … … 264 270 vector<Triangle3> triangles; 265 271 266 LoadTriangles(str, vertices, triangles );272 LoadTriangles(str, vertices, triangles, line); 267 273 268 274 vector<Triangle3>::const_iterator tit, tit_end = triangles.end(); … … 270 276 for (tit = triangles.begin(); tit != tit_end; ++ tit) 271 277 { 272 //if (!TriangleValid(*tit)) continue;273 278 if (0 && !TriangleValid(*tit)) continue; 279 274 280 TriangleIntersectable *obj = new TriangleIntersectable(*tit); 275 281 root->mGeometry.push_back(obj); 276 282 } 277 283 } … … 282 288 } 283 289 } 284 290 //cout << "\n** " << root->mGeometry.size() << " " << " lines: " << line << endl; 285 291 if (loadMeshes) 286 292 {
Note: See TracChangeset
for help on using the changeset viewer.