Changeset 2963 for GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter
- Timestamp:
- 09/22/08 10:10:01 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
r2961 r2963 41 41 int index = (int)strtol(str, NULL, 10) - 1; 42 42 43 str = strtok_s(substrings[i], "/", &next_token); 43 int tIndex = index; 44 int nIndex = index; 45 46 /*str = strtok_s(substrings[i], "/", &next_token); 44 47 int tIndex = (int)strtol(str, NULL, 10) - 1; 45 48 46 49 str = strtok_s(substrings[i], "/", &next_token); 47 50 int nIndex = (int)strtol(str, NULL, 10) - 1; 48 51 */ 49 52 // store indices 50 53 if (index >= 0) … … 70 73 faceVertices.push_back(vertices[indices[idx2]]); 71 74 faceVertices.push_back(vertices[indices[idx3]]); 72 75 76 Vector3 dummy(1, 0, 0); 77 faceNormals.push_back(dummy); 78 faceNormals.push_back(dummy); 79 faceNormals.push_back(dummy); 80 81 /* 82 const Vector3 v2 = mVertices[2] - mVertices[1]; 83 Normalize(CrossProd(v2, v1)); 84 73 85 faceNormals.push_back(normals[nIndices[idx1]]); 74 86 faceNormals.push_back(normals[nIndices[idx2]]); … … 78 90 faceTexcoords.push_back(texcoords[tIndices[idx2]]); 79 91 faceTexcoords.push_back(texcoords[tIndices[idx3]]); 92 */ 80 93 } 81 94 } … … 129 142 geom->mNormals[i].z = faceNormals[i].y; 130 143 131 geom->mTexcoords[i].first = faceTexcoords[i].first; 132 geom->mTexcoords[i].second = faceTexcoords[i].second; 144 if (i <= geom->mTexcoordCount) 145 { 146 geom->mTexcoords[i].first = faceTexcoords[i].first; 147 geom->mTexcoords[i].second = faceTexcoords[i].second; 148 } 133 149 } 134 150 … … 228 244 faceVertices, faceNormals, faceTexcoords); 229 245 246 if (((line % 100) == 99) && 247 !faceVertices.empty()) 248 { 249 ++ mNumShapes; 250 251 LoadShape(faceVertices, faceNormals, faceTexcoords); 252 253 faceVertices.clear(); 254 faceNormals.clear(); 255 faceTexcoords.clear(); 256 } 257 230 258 break; 231 259 } // end face … … 286 314 //-- texture 287 315 288 //int texId = -1;289 int texId = 0;316 int texId = -1; 317 //int texId = 0; 290 318 str.write(reinterpret_cast<char *>(&texId), sizeof(int)); 291 319 … … 330 358 //-- write textures 331 359 332 int textureCount = 1;333 //int textureCount = 0;360 //int textureCount = 1; 361 int textureCount = 0; 334 362 335 363 ofile.write(reinterpret_cast<char *>(&textureCount), sizeof(int)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
r2961 r2963 21 21 } 22 22 */ 23 if (!converter.Convert(model_path + "toyplane.obj", model_path + "toyplane.dem"))24 cerr << "conversion failed" << endl;23 //if (!converter.Convert(model_path + "toyplane.obj", model_path + "toyplane.dem")) 24 // cerr << "conversion failed" << endl; 25 25 26 26 //if (!converter.Convert(model_path + "sky.obj", model_path + "sky.dem")) 27 27 // cerr << "conversion failed" << endl; 28 29 if (!converter.Convert(model_path + "city_full.obj", model_path + "city_full.dem")) 30 cerr << "conversion failed" << endl; 28 31 29 32 cout << "conversion successful" << endl;
Note: See TracChangeset
for help on using the changeset viewer.