Changeset 3371 for GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter
- Timestamp:
- 05/19/09 12:02:26 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter.cpp
r3360 r3371 168 168 geom->mMaterial = mat; 169 169 170 static int count = 0; 171 if (count ++ < 10) 170 172 cout << "creating new geometry with " << numElements << " vertices" << endl; 171 173 … … 204 206 205 207 206 bool ObjConverter::Convert(const string &filename, const std::string &outputFilename) 208 bool ObjConverter::Convert(const string &filename, 209 const std::string &outputFilename) 207 210 { 208 211 mNumShapes = 0; … … 358 361 str.write(reinterpret_cast<char *>(geom->mTexcoords), sizeof(float) * texCoordCount * 2); 359 362 360 361 ///////362 //-- texture363 /*364 #ifdef USE_TEXTURE365 int texId = 0;366 #else367 int texId = -1;368 #endif369 370 str.write(reinterpret_cast<char *>(&texId), sizeof(int));371 372 bool alphaTestEnabled = false;373 //bool cullFaceEnabled = false;374 bool cullFaceEnabled = true;375 376 str.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool));377 str.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool));378 379 // material380 bool hasMaterial = true;381 //bool hasMaterial = false;382 str.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool));383 384 if (hasMaterial)385 {386 SimpleVec ambient, diffuse, spec, emm;387 388 ambient.x = ambient.y = ambient.z = 0.2f;389 //diffuse.x = diffuse.y = diffuse.z = 1.0f;390 diffuse.x = 0.7f; diffuse.y = 0.5f; diffuse.z = 0.2f;391 spec.x = spec.y = spec.z = .0f;392 emm = spec;393 394 // only write rgb part of the material395 str.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec));396 str.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec));397 str.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec));398 str.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec));399 }400 */401 363 } 402 364 … … 407 369 ogzstream ofile(filename.c_str()); 408 370 409 if (!ofile.is_open()) 410 return false; 371 if (!ofile.is_open()) return false; 411 372 412 373 … … 448 409 { 449 410 WriteGeometry(ofile, *it); 450 } 451 452 int texId = 0; 453 ofile.write(reinterpret_cast<char *>(&texId), sizeof(int)); 454 455 bool alphaTestEnabled = false; 456 //bool cullFaceEnabled = false; 457 bool cullFaceEnabled = true; 458 459 ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 460 ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 461 462 // material 463 bool hasMaterial = true; 464 ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 465 466 SimpleVec ambient, diffuse, spec, emm; 467 468 ambient.x = ambient.y = ambient.z = 0.2f; 469 diffuse.x = diffuse.y = diffuse.z = 1.0f; 470 spec.x = spec.y = spec.z = .0f; 471 emm = spec; 472 473 // only write rgb part of the material 474 ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 475 ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 476 ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 477 ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 478 411 412 int texId = 0; 413 ofile.write(reinterpret_cast<char *>(&texId), sizeof(int)); 414 415 bool alphaTestEnabled = false; 416 //bool cullFaceEnabled = false; 417 bool cullFaceEnabled = true; 418 419 ofile.write(reinterpret_cast<char *>(&alphaTestEnabled), sizeof(bool)); 420 ofile.write(reinterpret_cast<char *>(&cullFaceEnabled), sizeof(bool)); 421 422 // material 423 bool hasMaterial = true; 424 ofile.write(reinterpret_cast<char *>(&hasMaterial), sizeof(bool)); 425 426 if (hasMaterial) 427 { 428 SimpleVec ambient, diffuse, spec, emm; 429 430 ambient.x = ambient.y = ambient.z = .2f; 431 diffuse.x = diffuse.y = diffuse.z = 1.0f; 432 spec.x = spec.y = spec.z = .0f; 433 emm = spec; 434 435 // only write rgb part of the material 436 ofile.write(reinterpret_cast<char *>(&ambient), sizeof(SimpleVec)); 437 ofile.write(reinterpret_cast<char *>(&diffuse), sizeof(SimpleVec)); 438 ofile.write(reinterpret_cast<char *>(&spec), sizeof(SimpleVec)); 439 ofile.write(reinterpret_cast<char *>(&emm), sizeof(SimpleVec)); 440 } 441 } 479 442 480 443 int entityCount = 1; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/ObjConverter2.cpp
r3360 r3371 129 129 for (int j = 0; j < 3; ++ j) 130 130 { 131 //if (tIndices[idx[j]] >= (int)texcoords.size())132 //cerr << "error: texcoord indices exceed array size " << texcoords.size() << " " << tIndices[idx[j]] << endl;133 131 const int tidx = min((int)texcoords.size() - 1, tIndices[idx[j]]); 134 135 132 faceTexcoords.push_back(texcoords[tidx]); 136 133 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/Converter/main.cpp
r3361 r3371 1 //#include "ObjConverter.h"2 #include "PlyConverter.h"1 #include "ObjConverter.h" 2 //#include "PlyConverter.h" 3 3 #include <iostream> 4 4 #include <time.h> … … 12 12 13 13 //ObjConverter2 converter; 14 //ObjConverter converter;15 PlyConverter converter;14 ObjConverter converter; 15 //PlyConverter converter; 16 16 17 17 cout << "converting obj to dem format" << endl; … … 60 60 61 61 cout << "conversion successful" << endl; 62 cout << "press any key" << std::cin.get();62 //cout << "press any key" << std::cin.get(); 63 63 64 64 return 0;
Note: See TracChangeset
for help on using the changeset viewer.