Ignore:
Timestamp:
09/12/08 13:20:42 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

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

    r2933 r2934  
    2323static Polyhedron *polyhedron = NULL; 
    2424static Polyhedron *lightPoly = NULL; 
    25 static Matrix4x4 dummy = IdentityMatrix(); 
     25static Vector3 dummyPt; 
    2626 
    2727 
     
    185185        DrawPoly(polyhedron, Vector3(0, 1, 0)); 
    186186 
    187         Vector3 pt = Vector3::ZERO(); 
    188  
    189         pt = dummy * pt; 
    190  
    191187        glPointSize(10.0f); 
    192188 
    193189        glBegin(GL_POINTS); 
    194         glVertex3f(pt.x, pt.y, pt.z); 
     190        glVertex3f(dummyPt.x, dummyPt.y, dummyPt.z); 
    195191        glEnd(); 
    196192} 
     
    223219        //-- first find the free parameter values n, and P (the projection center), and the projection depth 
    224220 
    225         const float n = 1e3f; 
    226         //const float n = 1e6f; 
     221        //const float n = 1e1f; 
     222        const float n = 1e6f; 
    227223        //const float n = ComputeN(bounds_ls) * 100; 
    228224 
     
    244240 
    245241        cout <<"start: " << startPt << " " << projCenter << " " << Distance(lightSpace * mCamera->GetPosition(), startPt) << endl; 
     242dummyPt = -projCenter; 
    246243 
    247244        //construct a translation that moves to the projection center 
     
    408405 
    409406        transform2LispSM.x[0][0] =  1.0f; 
    410         transform2LispSM.x[1][2] = -1.0f; // y => -z 
     407        transform2LispSM.x[1][2] =  -1.0f; // y => -z 
    411408        transform2LispSM.x[2][1] =  1.0f; // z => y 
    412409        transform2LispSM.x[3][3] =  1.0f; 
     
    424421        //calculate a frame matrix that uses the projViewDir[lightspace] as up vector 
    425422        //look(from position, into the direction of the projected direction, with unchanged up-vector) 
    426         const Matrix4x4 frame = MyLookAt(Vector3::ZERO(), projViewDir, Vector3::UNIT_Y()); 
     423        const Matrix4x4 frame = MyLookAt2(Vector3::ZERO(), -projViewDir, Vector3::UNIT_Y()); 
    427424        //const Matrix4x4 frame = MyLookAt(Vector3::ZERO(), projViewDir, Vector3::UNIT_Z()); 
    428425 
     
    442439        transformToGL.x[0][0] =  1.0f; 
    443440        transformToGL.x[1][2] =  1.0f; // z => y 
    444         transformToGL.x[2][1] = -1.0f; // y => -z 
     441        transformToGL.x[2][1] =  -1.0f; // y => -z 
    445442        transformToGL.x[3][3] =  1.0f; 
    446443 
     
    564561 
    565562        Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir); 
    566         Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, -upVec); 
    567         //Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, mCamera->GetDirection()); 
     563        Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec); 
    568564 
    569565        mShadowCam->mViewOrientation = lightView; 
     
    603599 
    604600        mLightProjView = lightView * lightProj; 
    605 glEnable(GL_CULL_FACE); 
     601; 
    606602        cout << "here3" << endl; 
    607603        DEL_PTR(lightPoly); 
     
    676672 
    677673        Vector3 upVec = CalcUpVec(mCamera->GetDirection(), dir); 
    678         Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), -dir, -upVec); 
    679         //Matrix4x4 lightView = Invert(_lightView); 
    680         //Matrix4x4 lightView = MyLookAt(mShadowCam->GetPosition(), dir, mCamera->GetDirection()); 
     674        Matrix4x4 lightView = MyLookAt2(mShadowCam->GetPosition(), -dir, upVec); 
    681675 
    682676        mShadowCam->mViewOrientation = lightView; 
     
    702696        mLightProjView = lightView * lightProj; 
    703697 
    704         dummy = mLightProjView; 
     698        //dummy = mLightProjView; 
    705699 
    706700        DEL_PTR(lightPoly); 
     
    711705        glLoadIdentity(); 
    712706 
    713         glDisable(GL_CULL_FACE); 
     707        //glDisable(GL_CULL_FACE); 
    714708 
    715709        mShadowCam->SetupCameraView(); 
Note: See TracChangeset for help on using the changeset viewer.