- Timestamp:
- 08/25/08 20:20:42 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/DeferredShader.cpp
r2865 r2866 42 42 mFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 43 43 // the diffuse color buffer 44 mFbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);44 mFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false); 45 45 } 46 46 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.cpp
r2862 r2866 168 168 glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); 169 169 170 glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, w, h, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL);170 glTexImage2D(GL_TEXTURE_2D, 0, depthFormat, mWidth, mHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, NULL); 171 171 172 172 glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_TEXTURE_2D, mDepthTexId, 0); … … 178 178 179 179 180 int FrameBufferObject::AddColorBuffer(ColorBufferObject::FORMAT col, 180 int FrameBufferObject::AddColorBuffer(int w, int h, 181 ColorBufferObject::FORMAT col, 181 182 ColorBufferObject::WRAP_TYPE wrapType, 182 183 ColorBufferObject::FILTER_TYPE filterType, … … 190 191 int idx = (int)mColorBuffers.size(); 191 192 ColorBufferObject *colorBuf = 192 new ColorBufferObject( mWidth, mHeight, col, wrapType, filterType, useMipMap, useMultiSampling, idx);193 new ColorBufferObject(w, h, col, wrapType, filterType, useMipMap, useMultiSampling, idx); 193 194 194 195 mColorBuffers.push_back(colorBuf); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/FrameBufferObject.h
r2862 r2866 51 51 Returns the index that allows to retrieve the color buffer object. 52 52 */ 53 int AddColorBuffer(ColorBufferObject::FORMAT col, 53 int AddColorBuffer(int w, int h, 54 ColorBufferObject::FORMAT col, 54 55 ColorBufferObject::WRAP_TYPE wrapType, 55 56 ColorBufferObject::FILTER_TYPE filterType, -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/SsaoShader.cpp
r2865 r2866 78 78 mNewFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 79 79 // the diffuse color buffer 80 mNewFbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);80 mNewFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false); 81 81 82 82 mOldFbo = new FrameBufferObject(w, h, FrameBufferObject::DEPTH_NONE); 83 83 // the diffuse color buffer 84 mOldFbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);84 mOldFbo->AddColorBuffer(w, h, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false); 85 85 86 86 … … 284 284 285 285 286 /*void SsaoShader::DisplayTexture()287 {288 glEnable(GL_TEXTURE_2D);289 290 glBindTexture(GL_TEXTURE_2D, mNewFbo->GetColorBuffer(0)->GetTexture());291 292 glDisable(GL_LIGHTING);293 294 glMatrixMode(GL_PROJECTION);295 glPushMatrix();296 glLoadIdentity();297 298 glMatrixMode(GL_MODELVIEW);299 glPushMatrix();300 glLoadIdentity();301 302 const float offs = 0.5f;303 glOrtho(-offs, offs, -offs, offs, 0, 1);304 305 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);306 307 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);308 glBegin(GL_QUADS);309 310 glTexCoord2f(0, 0); glVertex3f(-offs, -offs, -0.5f);311 glTexCoord2f(1, 0); glVertex3f( offs, -offs, -0.5f);312 glTexCoord2f(1, 1); glVertex3f( offs, offs, -0.5f);313 glTexCoord2f(0, 1); glVertex3f(-offs, offs, -0.5f);314 315 glEnd();316 317 glEnable(GL_LIGHTING);318 glDisable(GL_TEXTURE_2D);319 320 glMatrixMode(GL_PROJECTION);321 glPopMatrix();322 323 glMatrixMode(GL_MODELVIEW);324 glPopMatrix();325 326 PrintGLerror("ssao second pass");327 }*/328 329 330 286 void SsaoShader::ComputeViewVectors(Vector3 &tl, Vector3 &tr, Vector3 &bl, Vector3 &br) 331 287 { … … 364 320 for (int i = 0; i < mWidth * mHeight * 3; i += 3) 365 321 { 366 // create random samples o ver sphere322 // create random samples on a circle 367 323 const float rx = RandomValue(0, 1); 368 324 const float theta = 2.0f * acos(sqrt(1.0f - rx)); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r2865 r2866 108 108 static int texWidth = 1024; 109 109 static int texHeight = 768; 110 111 //static int texWidth = 512; 112 //static int texHeight = 384; 113 110 114 //static int texWidth = 2048; 111 115 //static int texHeight = 2048; … … 530 534 531 535 // the diffuse color buffer 532 fbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false);536 fbo->AddColorBuffer(texWidth, texHeight, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false, false); 533 537 // the positions buffer 534 fbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);538 fbo->AddColorBuffer(512, 512, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false); 535 539 // the normals buffer 536 540 //fbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false); 537 fbo->AddColorBuffer( ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false);541 fbo->AddColorBuffer(texWidth, texHeight, ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST, false, false); 538 542 539 543 PrintGLerror("fbo"); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/antialiasing.cg
r2865 r2866 31 31 32 32 nd -= e_barrier.x; 33 nd = step(0 , nd);33 nd = step(0.0f, nd); 34 34 35 35 float ne = saturate(dot(nd, e_weights.x)); … … 64 64 65 65 dd = abs(2.0f * dc - dd) - e_barrier.y; 66 dd = step(dd, 0); 66 dd = step(dd, 0.0f); 67 67 68 float de = saturate(dot(dd, e_weights.y)); 68 69 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/deferred.cg
r2865 r2866 104 104 (SAMPLE_INTENSITY * DISTANCE_SCALE) / (DISTANCE_SCALE + length_to_sample * length_to_sample); 105 105 106 // if surface normal perpenticular to view dir, the samples count less => compensate for this 106 // if surface normal perpenticular to view dir, some samples probably count less 107 // => compensate for this 107 108 float view_correction = 1.0f + VIEW_CORRECTION_SCALE * (1.0f - dot(currentViewDir, currentNormal)); 108 109 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg
r2865 r2866 75 75 pixel pix; 76 76 77 // save color in first render target 77 78 pix.col = (ambient + diffuse) * tex2D(tex, IN.texCoord.xy); 79 // save world position in second rt 78 80 pix.pos = IN.worldPos * maxDepth; 81 // save normal in third rt 79 82 pix.norm.xyz = IN.normal * 0.5f + 0.5f; 80 83 81 84 // hack: squeeze some information about ambient into the texture 82 85 pix.norm.w = ambient.x; 83 // hack: store projection coordinate for scaling ssao86 // store projection coordinates with positions (used for ssao) 84 87 pix.pos.w = IN.projPos.w; 85 88
Note: See TracChangeset
for help on using the changeset viewer.