- Timestamp:
- 02/25/09 15:51:45 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredRenderer.cpp
r3326 r3327 165 165 } 166 166 } 167 } 168 169 170 static float *GrabTexture(GLuint tex, int w, int h) 171 { 172 glBindTexture(GL_TEXTURE_2D, tex); 173 174 float *data = new float[w * h * 3]; 175 176 glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_FLOAT, data); 177 178 glBindTexture(GL_TEXTURE_2D, 0); 179 glDisable(GL_TEXTURE_2D); 180 181 return data; 167 182 } 168 183 … … 772 787 tempSamples[i] = samples2[ns]; 773 788 currentSample = samples2[ns]; 789 774 790 checked[ns] = true; 775 791 } … … 838 854 } 839 855 856 840 857 //if (mSortSamples) { SortSamples(); } 841 858 //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_SAMPLES); 842 859 //sCgSsaoProgram->SetArray2f(i, (float *)samples2, NUM_PRECOMPUTED_SAMPLES); 843 sCgSsaoProgram->SetTexture(i, sampleTex2D); 844 } 845 860 } 861 862 sCgSsaoProgram->SetTexture(i, sampleTex2D); 863 864 static int dummycount = 0; 865 866 if (0)//dummycount ++ % 1000 == 0) 867 { 868 float *data = GrabTexture(sampleTex2D, NUM_PRECOMPUTED_SAMPLES, 1); 869 cout << "********************************" << endl; 870 for (int i = 0; i < NUM_PRECOMPUTED_SAMPLES; ++ i) 871 cout << data[i] << " "; 872 cout << endl; 873 delete [] data; 874 } 875 846 876 ++ i; 847 877 … … 870 900 sCgSsaoProgram->SetValue1f(i ++, mSampleIntensity * mKernelRadius); 871 901 872 873 902 DrawQuad(sCgSsaoProgram); 874 875 903 glPopAttrib(); 876 904 … … 905 933 // read the second buffer, write to the first buffer 906 934 if (!displayFrame) 935 { 907 936 FlipFbos(fbo); 937 } 908 938 else 939 { 909 940 // end of the pipeline => just draw image to screen 910 941 FrameBufferObject::Release(); 942 } 911 943 912 944 // the neighbouring texels -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SceneQuery.cpp
r3219 r3327 105 105 106 106 SceneQuery::SceneQuery(const AxisAlignedBox3 &sceneBox, 107 RenderTraverser *renderer, RenderState *state): 108 mSceneBox(sceneBox), mDepth(NULL), mRenderState(state) 107 RenderTraverser *renderer, 108 RenderState *state): 109 mSceneBox(sceneBox), 110 mDepth(NULL), 111 mRenderState(state) 109 112 { 110 113 Prepare(renderer); … … 118 121 119 122 const float d = mDepth[px + py * texHeight]; 120 121 123 static float depth = d; 122 124 … … 147 149 148 150 FrameBufferObject *fbo = new FrameBufferObject(texWidth, texHeight, FrameBufferObject::DEPTH_32, true); 151 149 152 fbo->AddColorBuffer(ColorBufferObject::RGBA_UBYTE, 150 153 ColorBufferObject::WRAP_CLAMP_TO_EDGE, … … 177 180 orthoCam->SetupViewProjection(); 178 181 179 //glOrtho(xlen, -xlen, ylen, -ylen, 0.0f, mSceneBox.Size().z);180 182 glMatrixMode(GL_MODELVIEW); 181 //orthoCam->SetupCameraView();182 183 183 184 mDepth = new float[texHeight * texWidth]; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaderenv.h
r3326 r3327 5 5 //////////// 6 6 //-- ssao + gi parameters 7 #define NUM_PRECOMPUTED_SAMPLES 40967 #define NUM_PRECOMPUTED_SAMPLES 100 8 8 //#define NUM_SAMPLES 8 9 9 //#define NUM_SAMPLES 16 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/combineSsaoSep.cg
r3326 r3327 249 249 } 250 250 251 //OUT.illum_col.xyz = float3(col.w * 5e-3f, 0, 0); 252 OUT.illum_col.xyz = ao.xyz; 251 //OUT.illum_col.xyz = float3(ao.w * 5e-3f, 0, 0); 252 //OUT.illum_col.xyz = float3(ao.y * 1e-2f, 0, 0); 253 //OUT.illum_col.xyz = ao.xyz; 253 254 254 255 OUT.illum_col.w = col.w; -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/ssao.cg
r3326 r3327 179 179 sampler2D colors, 180 180 sampler2D noiseTex, 181 //float2 samples[NUM_PRECOMPUTED_SAMPLES], 181 182 sampler2D samples, 182 183 float3 normal, … … 204 205 205 206 const float2 ssaoOffset = tex2Dlod(samples, float4((0.5f + i + idx) / NUM_PRECOMPUTED_SAMPLES, 0.5f, .0f, .0f)).xy; 206 207 //const float2 ssaoOffset = samples[i]; 207 208 208 209 //////////////////// … … 455 456 uniform sampler2D noiseTex, 456 457 uniform sampler2D samples, 458 //uniform float2 samples[NUM_PRECOMPUTED_SAMPLES], 457 459 uniform sampler2D oldTex, 458 460 uniform float4x4 modelViewProj, … … 511 513 512 514 const float oldSsao = temporalVals.x; 513 float oldWeight = temporalVals.y;514 float oldIdx =temporalVals.z;515 const float oldWeight = temporalVals.y; 516 const float oldIdx = 0;//temporalVals.z; 515 517 516 518 float3 ao; … … 520 522 { 521 523 if (0) 524 { 522 525 ao = ssao(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, isMovingObject); 526 } 523 527 else 528 { 524 529 ao = ssao2(IN, colors, noiseTex, samples, normal, eyeSpacePos.xyz, scaleFactor, 525 530 bl, br, tl, tr, normalize(viewDir), oldWeight, sampleIntensity, 526 531 isMovingObject, normals, oldIdx); 532 } 527 533 } 528 534 else … … 574 580 OUT.illum_col.w = eyeSpaceDepth; 575 581 582 //if (OUT.illum_col.z > 1000) OUT.illum_col.z = 0; 583 576 584 // this value can be used to check if this pixel belongs to a moving object 577 585 OUT.col.x = SqrLen(diffVec); 578 586 //OUT.illum_col.z = SqrLen(diffVec); 579 587 580 OUT.illum_col.xyz = normal.xyz;588 //OUT.illum_col.xyz = normal.xyz; 581 589 return OUT; 582 590 }
Note: See TracChangeset
for help on using the changeset viewer.