Changeset 2756 for GTP/trunk/App/Demos/Vis/CHC_revisited/Camera.cpp
- Timestamp:
- 06/13/08 18:06:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/Camera.cpp
r2755 r2756 29 29 mDirection.Normalize(); 30 30 31 Vector3 side = CrossProd(Vector3(0, 1,0), mDirection);32 mUp = Normalize(CrossProd(side, mDirection));33 mRight = Normalize(CrossProd(mDirection, mUp));31 Vector3 side = CrossProd(Vector3(0, 1, 0), mDirection); 32 mUp = -Normalize(CrossProd(side, mDirection)); 33 mRight = -Normalize(CrossProd(mDirection, mUp)); 34 34 35 35 float k = tan(mFovy/2); … … 55 55 void Camera::LookInBox(const AxisAlignedBox3 &box) 56 56 { 57 mDirection = Vector3(0, 0,1);57 mDirection = Vector3(0, 0, 1); 58 58 mPosition = box.Center(); 59 mPosition.y += 50; 59 60 60 61 Precompute(); … … 64 65 void Camera::LookAtBox(const AxisAlignedBox3 &box) 65 66 { 66 mDirection = box.M ax() - box.Min();67 mPosition = box.M in() - mDirection;67 mDirection = box.Min() - box.Max(); 68 mPosition = box.Max() - mDirection; 68 69 69 70 Precompute(); … … 152 153 153 154 155 void Camera::SetupCameraView() 156 { 157 glLoadIdentity(); 158 gluLookAt(mPosition.x, mPosition.y, mPosition.z, 159 mPosition.x + mDirection.x, mPosition.y + mDirection.y, mPosition.z + mDirection.z, 160 mUp.x, mUp.y, mUp.z); 161 162 //std::cout << "dir: " << mDirection << " pos: " << mPosition << " up: " << mUp << std::endl; 154 163 } 155 164 165 166 } 167
Note: See TracChangeset
for help on using the changeset viewer.