Ignore:
Timestamp:
09/10/08 17:35:26 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp

    r2925 r2928  
    111111        // the diffuse color buffer 
    112112        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); 
    115116        mShadowCam->SetOrtho(true); 
    116117} 
     
    204205                                                                                 ) 
    205206{ 
     207        //return IdentityMatrix(); 
     208 
    206209        AxisAlignedBox3 bounds_ls = GetExtremalPoints(lightSpace, body); 
    207         //return IdentityMatrix(); 
    208210 
    209211        /////////////// 
     
    212214 
    213215        //const float n = 1e6f; 
    214         const float n = ComputeN(bounds_ls); 
     216        //const float n = 1e1f; 
     217        const float n = ComputeN(bounds_ls) * 100; 
    215218 
    216219        cout << "n: " << n << endl; 
     
    228231 
    229232        // the new projection center 
    230         Vector3 projCenter = startPt + Vector3::UNIT_Z() * n * 1000; 
     233        Vector3 projCenter = startPt + Vector3::UNIT_Z() * n; 
    231234 
    232235        cout <<"start: " << startPt << " " << projCenter << " " << Distance(lightSpace * mCamera->GetPosition(), startPt) << endl; 
     
    245248         
    246249 
    247         //////// 
     250        ////////// 
    248251        //-- now apply these values to construct the perspective lispsm matrix 
    249252 
     
    518521        //mCamera->GetModelViewMatrix(camView); 
    519522 
    520         pos -= dir * Magnitude(mSceneBox.Diagonal() * 0.1f); 
     523        pos -= dir * Magnitude(mSceneBox.Diagonal() * 0.5f); 
    521524        mShadowCam->SetPosition(pos); 
    522525 
     
    530533        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    531534 
     535        //glEnable(GL_LIGHTING); 
     536        //glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    532537        glDisable(GL_LIGHTING); 
    533538        glDisable(GL_TEXTURE_2D); 
     
    597602 
    598603        glPopAttrib(); 
     604 
     605         
     606        glEnable(GL_LIGHTING); 
     607        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     608 
    599609#if 0 
    600610        float *data = new float[mSize * mSize]; 
     
    617627 
    618628  
    619 unsigned int ShadowMap::GetShadowTexture() const 
     629unsigned int ShadowMap::GetDepthTexture() const 
    620630{ 
    621631        return mFbo->GetDepthTex(); 
    622632} 
    623633 
    624  
     634unsigned int ShadowMap::GetShadowColorTexture() const 
     635{ 
     636        return mFbo->GetColorBuffer(0)->GetTexture(); 
     637         
     638} 
    625639 
    626640} // namespace 
Note: See TracChangeset for help on using the changeset viewer.