- Timestamp:
- 09/12/08 13:20:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShadowMapping.cpp
r2933 r2934 23 23 static Polyhedron *polyhedron = NULL; 24 24 static Polyhedron *lightPoly = NULL; 25 static Matrix4x4 dummy = IdentityMatrix();25 static Vector3 dummyPt; 26 26 27 27 … … 185 185 DrawPoly(polyhedron, Vector3(0, 1, 0)); 186 186 187 Vector3 pt = Vector3::ZERO();188 189 pt = dummy * pt;190 191 187 glPointSize(10.0f); 192 188 193 189 glBegin(GL_POINTS); 194 glVertex3f( pt.x, pt.y, pt.z);190 glVertex3f(dummyPt.x, dummyPt.y, dummyPt.z); 195 191 glEnd(); 196 192 } … … 223 219 //-- first find the free parameter values n, and P (the projection center), and the projection depth 224 220 225 const float n = 1e3f;226 //const float n = 1e6f;221 //const float n = 1e1f; 222 const float n = 1e6f; 227 223 //const float n = ComputeN(bounds_ls) * 100; 228 224 … … 244 240 245 241 cout <<"start: " << startPt << " " << projCenter << " " << Distance(lightSpace * mCamera->GetPosition(), startPt) << endl; 242 dummyPt = -projCenter; 246 243 247 244 //construct a translation that moves to the projection center … … 408 405 409 406 transform2LispSM.x[0][0] = 1.0f; 410 transform2LispSM.x[1][2] = -1.0f; // y => -z407 transform2LispSM.x[1][2] = -1.0f; // y => -z 411 408 transform2LispSM.x[2][1] = 1.0f; // z => y 412 409 transform2LispSM.x[3][3] = 1.0f; … … 424 421 //calculate a frame matrix that uses the projViewDir[lightspace] as up vector 425 422 //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()); 427 424 //const Matrix4x4 frame = MyLookAt(Vector3::ZERO(), projViewDir, Vector3::UNIT_Z()); 428 425 … … 442 439 transformToGL.x[0][0] = 1.0f; 443 440 transformToGL.x[1][2] = 1.0f; // z => y 444 transformToGL.x[2][1] = -1.0f; // y => -z441 transformToGL.x[2][1] = -1.0f; // y => -z 445 442 transformToGL.x[3][3] = 1.0f; 446 443 … … 564 561 565 562 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); 568 564 569 565 mShadowCam->mViewOrientation = lightView; … … 603 599 604 600 mLightProjView = lightView * lightProj; 605 glEnable(GL_CULL_FACE);601 ; 606 602 cout << "here3" << endl; 607 603 DEL_PTR(lightPoly); … … 676 672 677 673 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); 681 675 682 676 mShadowCam->mViewOrientation = lightView; … … 702 696 mLightProjView = lightView * lightProj; 703 697 704 dummy = mLightProjView;698 //dummy = mLightProjView; 705 699 706 700 DEL_PTR(lightPoly); … … 711 705 glLoadIdentity(); 712 706 713 glDisable(GL_CULL_FACE);707 //glDisable(GL_CULL_FACE); 714 708 715 709 mShadowCam->SetupCameraView();
Note: See TracChangeset
for help on using the changeset viewer.