Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2112 in orxonox.OLD for orxonox/branches/chris/src/camera.cc


Ignore:
Timestamp:
Jul 12, 2004, 10:28:25 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: Implemented quaternion class… but something is still f up… the camera keeps pointing into the wrong direction… matrix rotation calculation seems not to be my strenght…

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/camera.cc

    r2100 r2112  
    3030{
    3131        bound = NULL;
    32         desired_place.r = Vector (0,0,0);
    33         desired_place.w = Rotation (0,0,0);
    34         actual_place.r = Vector (0,0,0);
    35         actual_place.w = Rotation (0,0,0);
    3632}
    3733
     
    5349{
    5450        update_desired_place ();
     51        jump (NULL);
    5552}
    5653
     
    7370                {
    7471                        desired_place.r = Vector (0,0,0);
    75                         desired_place.w = Rotation (0,0,0);
     72                        desired_place.w = Quaternion ();
    7673                }
    7774}
     
    8683{
    8784        glMatrixMode (GL_PROJECTION);
     85  glLoadIdentity ();
    8886                // view
    8987                // TO DO: implement options for frustum generation
    90         glFrustum( -1.0,1.0,-1.0,1.0,1.5,20.0);
     88        glFrustum( -1.0,1.0,-1.0,1.0,1.5,250.0);
     89        glRotatef(h,1,0,0);
     90        glRotatef(h/2,0,1,0);
     91        glRotatef(h/4,0,0,1);
     92        h += 3;
     93//      glRotatef(90,0,0,1);
    9194        // rotation
    92   float matrix[16];
    93   actual_place.w.glmatrix (matrix);
    94   glLoadMatrixf (matrix);
     95  float matrix[4][4];
     96  actual_place.w.conjugate().matrix (matrix);
     97  glMultMatrixf ((float*)matrix);
    9598        // translation
    96   glTranslatef (actual_place.r.x, actual_place.r.y, actual_place.r.z);
     99  glTranslatef (-actual_place.r.x, -actual_place.r.y,- actual_place.r.z);
    97100 
    98101  glMatrixMode (GL_MODELVIEW);
    99102  glLoadIdentity ();
     103 
     104  printf("Camera@%f/%f/%f\n",actual_place.r.x,actual_place.r.y,actual_place.r.z);
     105  Vector unique(1,0,0);
     106  Vector test = actual_place.w.apply (unique);
     107  printf("Camera&%f/%f/%f\n", test.x, test.y, test.z);
    100108}
    101109
Note: See TracChangeset for help on using the changeset viewer.