Changeset 3035
- Timestamp:
- 10/16/08 22:23:24 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3034 r3035 324 324 325 325 sCgSsaoProgram->AddParameter("colors", i ++); 326 sCgSsaoProgram->AddParameter(" colors", i ++);326 sCgSsaoProgram->AddParameter("normals", i ++); 327 327 sCgSsaoProgram->AddParameter("oldTex", i ++); 328 328 sCgSsaoProgram->AddParameter("noise", i ++); 329 329 sCgSsaoProgram->AddParameter("eyePos", i ++); 330 330 sCgSsaoProgram->AddParameter("temporalCoherence", i ++); 331 sCgSsaoProgram->AddParameter("modelViewProj", i ++);332 sCgSsaoProgram->AddParameter("oldModelViewProj", i ++);333 331 sCgSsaoProgram->AddParameter("samples", i ++); 334 332 sCgSsaoProgram->AddParameter("bl", i ++); … … 336 334 sCgSsaoProgram->AddParameter("tl", i ++); 337 335 sCgSsaoProgram->AddParameter("tr", i ++); 336 sCgSsaoProgram->AddParameter("modelViewProj", i ++); 337 sCgSsaoProgram->AddParameter("oldModelViewProj", i ++); 338 338 339 339 i = 0; 340 340 341 341 sCgGiProgram->AddParameter("colors", i ++); 342 sCgGiProgram->AddParameter(" colors", i ++);342 sCgGiProgram->AddParameter("normals", i ++); 343 343 sCgGiProgram->AddParameter("noise", i ++); 344 344 sCgGiProgram->AddParameter("oldSsaoTex", i ++); … … 351 351 sCgGiProgram->AddParameter("tl", i ++); 352 352 sCgGiProgram->AddParameter("tr", i ++); 353 sCgGiProgram->AddParameter("oldModelViewProj", i ++); 354 sCgGiProgram->AddParameter("modelViewProj", i ++); 353 355 354 356 sCgAntiAliasingProgram->AddParameter("colors", 0); … … 359 361 sCgDeferredProgram->AddParameter("lightDir", 2); 360 362 363 sCgLogLumProgram->AddParameter("colors", 0); 364 365 sCgToneProgram->AddParameter("colors", 0); 366 sCgToneProgram->AddParameter("imageKey", 1); 367 sCgToneProgram->AddParameter("whiteLum", 2); 368 sCgToneProgram->AddParameter("middleGrey", 3); 369 370 sCgDownSampleProgram->AddParameter("colors", 0); 371 sCgDownSampleProgram->AddParameter("downSampleOffs", 1); 372 373 sCgDeferredShadowProgram->AddParameter("colors", 0); 374 sCgDeferredShadowProgram->AddParameter("normals", 1); 375 sCgDeferredShadowProgram->AddParameter("shadowMap", 2); 376 sCgDeferredShadowProgram->AddParameter("noise", 3); 377 sCgDeferredShadowProgram->AddParameter("shadowMatrix", 4); 378 sCgDeferredShadowProgram->AddParameter("sampleWidth", 5); 379 sCgDeferredShadowProgram->AddParameter("lightDir", 6); 380 sCgDeferredShadowProgram->AddParameter("eyePos", 7); 381 sCgDeferredShadowProgram->AddParameter("samples", 8); 382 sCgDeferredShadowProgram->AddParameter("weights", 9); 383 361 384 362 385 float filterWeights[NUM_PCF_TABS]; … … 369 392 } 370 393 371 sCgDeferredShadowProgram->SetArray2f( "samples", (float *)pcfSamples, NUM_PCF_TABS);372 sCgDeferredShadowProgram->SetArray1f( "weights", (float *)filterWeights, NUM_PCF_TABS);394 sCgDeferredShadowProgram->SetArray2f(8, (float *)pcfSamples, NUM_PCF_TABS); 395 sCgDeferredShadowProgram->SetArray1f(9, (float *)filterWeights, NUM_PCF_TABS); 373 396 374 397 PrintGLerror("init"); … … 501 524 502 525 sCgSsaoProgram->SetValue1f(5, (mUseTemporalCoherence && !mRegenerateSamples) ? tempCohFactor : 0); 503 sCgSsaoProgram->SetMatrix(6, projViewMatrix); 504 sCgSsaoProgram->SetMatrix(7, oldProjViewMatrix); 505 526 506 527 if (mUseTemporalCoherence || mRegenerateSamples) 507 528 { … … 512 533 // needs longer to converge 513 534 GenerateSamples(mSamplingMethod); 514 sCgSsaoProgram->SetArray2f( 8, (float *)samples2, NUM_SAMPLES);535 sCgSsaoProgram->SetArray2f(6, (float *)samples2, NUM_SAMPLES); 515 536 } 516 537 … … 518 539 ComputeViewVectors(tl, tr, bl, br); 519 540 520 sCgSsaoProgram->SetValue3f(9, bl.x, bl.y, bl.z); 521 sCgSsaoProgram->SetValue3f(10, br.x, br.y, br.z); 522 sCgSsaoProgram->SetValue3f(11, tl.x, tl.y, tl.z); 523 sCgSsaoProgram->SetValue3f(12, tr.x, tr.y, tr.z); 541 sCgSsaoProgram->SetValue3f(7, bl.x, bl.y, bl.z); 542 sCgSsaoProgram->SetValue3f(8, br.x, br.y, br.z); 543 sCgSsaoProgram->SetValue3f(9, tl.x, tl.y, tl.z); 544 sCgSsaoProgram->SetValue3f(10, tr.x, tr.y, tr.z); 545 546 sCgSsaoProgram->SetMatrix(11, projViewMatrix); 547 sCgSsaoProgram->SetMatrix(12, oldProjViewMatrix); 548 524 549 525 550 DrawQuad(sCgSsaoProgram); … … 620 645 const Matrix4x4 &oldProjViewMatrix) 621 646 { 622 sCgGiProgram->SetMatrix("oldModelViewProj", oldProjViewMatrix);623 sCgGiProgram->SetMatrix("modelViewProj", projViewMatrix);624 625 647 #if 0 626 648 GLuint colorsTex = fbo->GetColorBuffer(colorBufferIdx)->GetTexture(); … … 677 699 sCgGiProgram->SetValue3f(11, tr.x, tr.y, tr.z); 678 700 701 sCgGiProgram->SetMatrix(12, oldProjViewMatrix); 702 sCgGiProgram->SetMatrix(13, projViewMatrix); 703 704 679 705 DrawQuad(sCgGiProgram); 680 706 … … 774 800 glDrawBuffers(1, mrt + colorBufferIdx); 775 801 776 777 sCgDeferredShadowProgram->SetTexture("colors", colorsTex); 778 sCgDeferredShadowProgram->SetTexture("normals", normalsTex); 779 sCgDeferredShadowProgram->SetTexture("shadowMap", shadowTex); 780 sCgDeferredShadowProgram->SetTexture("noise", noiseTex); 781 782 sCgDeferredShadowProgram->SetMatrix("shadowMatrix", shadowMatrix); 783 784 sCgDeferredShadowProgram->SetValue1f("sampleWidth", 2.0f / shadowMap->GetSize()); 802 sCgDeferredShadowProgram->SetTexture(0, colorsTex); 803 sCgDeferredShadowProgram->SetTexture(1, normalsTex); 804 sCgDeferredShadowProgram->SetTexture(2, shadowTex); 805 sCgDeferredShadowProgram->SetTexture(3, noiseTex); 806 807 sCgDeferredShadowProgram->SetMatrix(4, shadowMatrix); 808 809 sCgDeferredShadowProgram->SetValue1f(5, 2.0f / shadowMap->GetSize()); 785 810 786 811 const Vector3 lightDir = -light->GetDirection(); 787 sCgDeferredShadowProgram->SetValue3f( "lightDir", lightDir.x, lightDir.y, lightDir.z);812 sCgDeferredShadowProgram->SetValue3f(6, lightDir.x, lightDir.y, lightDir.z); 788 813 789 814 const Vector3 pos = mCamera->GetPosition(); 790 sCgDeferredShadowProgram->SetValue3f( "eyePos", pos.x, pos.y, pos.z);815 sCgDeferredShadowProgram->SetValue3f(7, pos.x, pos.y, pos.z); 791 816 792 817 DrawQuad(sCgDeferredShadowProgram); … … 846 871 glDrawBuffers(1, mrt + colorBufferIdx); 847 872 848 sCgLogLumProgram->SetTexture( "colors", colorsTex);873 sCgLogLumProgram->SetTexture(0, colorsTex); 849 874 DrawQuad(sCgLogLumProgram); 850 875 … … 897 922 glViewport(0, 0, downSampleFbo->GetWidth(), downSampleFbo->GetHeight()); 898 923 899 sCgDownSampleProgram->SetTexture( "colors", colorsTex);924 sCgDownSampleProgram->SetTexture(0, colorsTex); 900 925 901 926 float downSampleOffsets[NUM_DOWNSAMPLES * 2]; 902 927 ComputeSampleOffsets(downSampleOffsets, fbo->GetWidth(), fbo->GetHeight()); 903 928 904 sCgDownSampleProgram->SetArray2f( "downSampleOffs", (float *)downSampleOffsets, NUM_DOWNSAMPLES);929 sCgDownSampleProgram->SetArray2f(1, (float *)downSampleOffsets, NUM_DOWNSAMPLES); 905 930 906 931 mDownSampleFbo->Bind(); … … 928 953 glDrawBuffers(1, mrt + colorBufferIdx); 929 954 930 sCgToneProgram->SetTexture( "colors", colorsTex);931 sCgToneProgram->SetValue1f( "imageKey", imageKey);932 sCgToneProgram->SetValue1f( "whiteLum", whiteLum);933 sCgToneProgram->SetValue1f( "middleGrey", middleGrey);955 sCgToneProgram->SetTexture(0, colorsTex); 956 sCgToneProgram->SetValue1f(1, imageKey); 957 sCgToneProgram->SetValue1f(2, whiteLum); 958 sCgToneProgram->SetValue1f(3, middleGrey); 934 959 935 960 DrawQuad(sCgToneProgram);
Note: See TracChangeset
for help on using the changeset viewer.