- Timestamp:
- 09/10/08 17:35:26 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r2925 r2928 111 111 // the diffuse color buffer 112 112 mFbo->AddColorBuffer(ColorBufferObject::BUFFER_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false); 113 114 mShadowCam = new Camera(mSceneBox.Size().x * 0.5f, mSceneBox.Size().y * 0.5f); 113 //mFbo->AddColorBuffer(ColorBufferObject::BUFFER_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, false); 114 115 mShadowCam = new Camera(mSize, mSize);//mSceneBox.Size().x * 0.5f, mSceneBox.Size().y * 0.5f); 115 116 mShadowCam->SetOrtho(true); 116 117 } … … 204 205 ) 205 206 { 207 //return IdentityMatrix(); 208 206 209 AxisAlignedBox3 bounds_ls = GetExtremalPoints(lightSpace, body); 207 //return IdentityMatrix();208 210 209 211 /////////////// … … 212 214 213 215 //const float n = 1e6f; 214 const float n = ComputeN(bounds_ls); 216 //const float n = 1e1f; 217 const float n = ComputeN(bounds_ls) * 100; 215 218 216 219 cout << "n: " << n << endl; … … 228 231 229 232 // the new projection center 230 Vector3 projCenter = startPt + Vector3::UNIT_Z() * n * 1000;233 Vector3 projCenter = startPt + Vector3::UNIT_Z() * n; 231 234 232 235 cout <<"start: " << startPt << " " << projCenter << " " << Distance(lightSpace * mCamera->GetPosition(), startPt) << endl; … … 245 248 246 249 247 //////// 250 ////////// 248 251 //-- now apply these values to construct the perspective lispsm matrix 249 252 … … 518 521 //mCamera->GetModelViewMatrix(camView); 519 522 520 pos -= dir * Magnitude(mSceneBox.Diagonal() * 0. 1f);523 pos -= dir * Magnitude(mSceneBox.Diagonal() * 0.5f); 521 524 mShadowCam->SetPosition(pos); 522 525 … … 530 533 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 531 534 535 //glEnable(GL_LIGHTING); 536 //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 532 537 glDisable(GL_LIGHTING); 533 538 glDisable(GL_TEXTURE_2D); … … 597 602 598 603 glPopAttrib(); 604 605 606 glEnable(GL_LIGHTING); 607 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 608 599 609 #if 0 600 610 float *data = new float[mSize * mSize]; … … 617 627 618 628 619 unsigned int ShadowMap::Get ShadowTexture() const629 unsigned int ShadowMap::GetDepthTexture() const 620 630 { 621 631 return mFbo->GetDepthTex(); 622 632 } 623 633 624 634 unsigned int ShadowMap::GetShadowColorTexture() const 635 { 636 return mFbo->GetColorBuffer(0)->GetTexture(); 637 638 } 625 639 626 640 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.