Changeset 3371 for GTP/trunk/App/Demos/Vis/FriendlyCulling
- Timestamp:
- 05/19/09 12:02:26 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 9 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; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3370 r3371 845 845 846 846 //if (mRegenerateSamples) 847 if (1)//mUseTemporalCoherence || mRegenerateSamples) 847 if (//mUseTemporalCoherence || 848 mRegenerateSamples) 848 849 { 849 850 mRegenerateSamples = false; … … 860 861 else 861 862 { 862 //UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES);863 UpdateSampleTex(samples2, NUM_PRECOMPUTED_SAMPLES); 863 864 } 864 865 … … 867 868 //if (mSortSamples) { SortSamples(); } 868 869 sCgSsaoProgram->SetArray2f(i, (float *)samples2 + dummy, NUM_SAMPLES); 869 870 cout << "d " << dummy << " ";871 870 872 871 dummy = (dummy + NUM_SAMPLES) % NUM_PRECOMPUTED_SAMPLES; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3364 r3371 356 356 str.read(reinterpret_cast<char *>(vertices), sizeof(Vector3) * vertexCount); 357 357 358 //cout << "vertexCount: " << vertexCount << endl; 359 358 360 normals = new Vector3[vertexCount]; 359 361 str.read(reinterpret_cast<char *>(normals), sizeof(Vector3) * vertexCount); 360 362 363 361 364 Vector3 *tangents; 362 365 … … 374 377 str.read(reinterpret_cast<char *>(&texCoordCount), sizeof(int)); 375 378 379 //cout << "texCoordCount: " << texCoordCount << endl; 376 380 377 381 if (texCoordCount) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SampleGenerator.cpp
r3370 r3371 181 181 for (int i = 0; i < mNumSamples; ++ i) 182 182 { 183 x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1);184 //mHalton->GetNext(x);183 //x[0] = RandomValue(0, 1); x[1] = RandomValue(0, 1); 184 mHalton->GetNext(x); 185 185 186 186 const float a = 2.0f * M_PI * x[0]; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3369 r3371 669 669 #if 1 670 670 671 //LoadModel("hbuddha.dem", dynamicObjects);671 LoadModel("hbuddha.dem", dynamicObjects); 672 672 //LoadModel("horse.dem", dynamicObjects); 673 LoadModel("happy2.dem", dynamicObjects);673 //LoadModel("happy2.dem", dynamicObjects); 674 674 //LoadModel("torus.dem", dynamicObjects); 675 675 //LoadModel("venusm.dem", dynamicObjects); … … 835 835 // another color buffer 836 836 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST); 837 837 838 838 839 for (int i = 0; i < 4; ++ i) -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3370 r3371 8 8 //#define NUM_PRECOMPUTED_SAMPLES 8124 9 9 #define NUM_PRECOMPUTED_SAMPLES 4096 10 #define NUM_PRECOMPUTED_SAMPLES 6410 //#define NUM_PRECOMPUTED_SAMPLES 1024 11 11 12 12 //#define NUM_SAMPLES 16 13 //#define NUM_SAMPLES 24 13 #define NUM_SAMPLES 16 14 14 //#define NUM_SAMPLES 32 15 #define NUM_SAMPLES 6415 //#define NUM_SAMPLES 64 16 16 17 #define MIN_SAMPLES 6417 #define MIN_SAMPLES 16 18 18 //#define MIN_SAMPLES 48 19 19 … … 66 66 #define NUM_DOF_TABS 16 67 67 68 #define USE_GTX68 //#define USE_GTX 69 69 70 70 #define SSAO_FILTER_RADIUS 5 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3370 r3371 487 487 float2 offset; 488 488 489 //const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy;490 const float2 ssaoOffset = dummySamples[i];489 const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + oldIdx) / NUM_PRECOMPUTED_SAMPLES, .5f, .0f, .0f)).xy; 490 //const float2 ssaoOffset = dummySamples[i]; 491 491 492 492 //////////////////// … … 494 494 //-- (affects performance for some reason!) 495 495 496 if ( 0)//!USE_OPTIMIZATION ||496 if (1)//!USE_OPTIMIZATION || 497 497 //(convergence < SSAO_CONVERGENCE_THRESHOLD)) 498 498 { … … 685 685 float3 ao; 686 686 //$$temp matt 687 oldIdx = dummyIdx;687 //oldIdx = dummyIdx; 688 688 689 689 // cull background note: this should be done with the stencil buffer … … 758 758 //-- blend ao between old and new samples (and avoid division by zero) 759 759 760 OUT.illum_col.x = ao.x ;//* newWeight + oldSsao * oldWeight;761 //OUT.illum_col.x /= (newWeight + oldWeight);760 OUT.illum_col.x = ao.x * newWeight + oldSsao * oldWeight; 761 OUT.illum_col.x /= (newWeight + oldWeight); 762 762 763 763 OUT.illum_col.y = combinedWeight;
Note: See TracChangeset
for help on using the changeset viewer.