Ignore:
Timestamp:
06/13/08 18:06:32 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/CHC_revisited/Camera.cpp

    r2755 r2756  
    2929        mDirection.Normalize(); 
    3030 
    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)); 
    3434 
    3535        float k = tan(mFovy/2); 
     
    5555void Camera::LookInBox(const AxisAlignedBox3 &box) 
    5656{ 
    57         mDirection = Vector3(0,0,1); 
     57        mDirection = Vector3(0, 0, 1); 
    5858        mPosition = box.Center(); 
     59        mPosition.y += 50; 
    5960 
    6061        Precompute(); 
     
    6465void Camera::LookAtBox(const AxisAlignedBox3 &box) 
    6566{ 
    66         mDirection = box.Max() - box.Min(); 
    67         mPosition = box.Min() - mDirection; 
     67        mDirection = box.Min() - box.Max(); 
     68        mPosition = box.Max() - mDirection; 
    6869 
    6970        Precompute(); 
     
    152153 
    153154 
     155void 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; 
    154163} 
    155164 
     165 
     166} 
     167 
Note: See TracChangeset for help on using the changeset viewer.