Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3013 in orxonox.OLD


Ignore:
Timestamp:
Nov 27, 2004, 12:45:12 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/bezierTrack: Location→r ,→w to →pos →dir. (otherwise noone gets the sense of them again.)

Location:
orxonox/branches/bezierTrack/src
Files:
9 edited

Legend:

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

    r2636 r3013  
    4242  t = 0.0;
    4343
    44   actual_place.r.x = 0.0;
    45   actual_place.r.y = 10.0;
    46   actual_place.r.z = -5.0;
     44  actual_place.pos.x = 0.0;
     45  actual_place.pos.y = 10.0;
     46  actual_place.pos.z = -5.0;
    4747}
    4848
     
    144144
    145145            Vector ursp(0.0, 0.0, 0.0);
    146             desired_place.r = /*plFocus.r -*/ ursp - res->apply(r);
    147 
    148             printf("desired place is: %f, %f, %f\n", desired_place.r.x, desired_place.r.y, desired_place.r.z);
     146            desired_place.pos = /*plFocus.r -*/ ursp - res->apply(r);
     147
     148            printf("desired place is: %f, %f, %f\n", desired_place.pos.x, desired_place.pos.y, desired_place.pos.z);
    149149            //plLastBPlace = *bound->get_placement();
    150150          }
     
    159159            bound->get_lookat(&lcBound);
    160160            Vector vDirection(0.0, 0.0, 1.0);
    161             vDirection = plBound->w.apply(vDirection);
    162             desired_place.r = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0);
     161            vDirection = plBound->rot.apply(vDirection);
     162            desired_place.pos = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0);
    163163          }
    164164        break;
     
    172172            Vector vDirection(0.0, 0.0, 1.0);
    173173            Vector eclipticOffset(0.0, 0.0, 5.0);
    174             vDirection = plBound->w.apply(vDirection);
    175             desired_place.r = plBound->r - vDirection*10 + eclipticOffset;
     174            vDirection = plBound->rot.apply(vDirection);
     175            desired_place.pos = plBound->pos - vDirection*10 + eclipticOffset;
    176176          }
    177177        break;
     
    187187      else
    188188        {
    189           desired_place.r = Vector (0,0,0);
    190           desired_place.w = Quaternion ();
     189          desired_place.pos = Vector (0,0,0);
     190          desired_place.rot = Quaternion ();
    191191        }
    192192      break;
     
    235235  // rotation
    236236  float matrix[4][4];
    237   actual_place.w.conjugate().matrix (matrix);
     237  actual_place.rot.conjugate().matrix (matrix);
    238238  /* orientation and */
    239239  glMultMatrixf ((float*)matrix);
    240240  /*  translation */
    241   glTranslatef (-actual_place.r.x, -actual_place.r.y,- actual_place.r.z);
     241  glTranslatef (-actual_place.pos.x, -actual_place.pos.y,- actual_place.pos.z);
    242242  //Placement *plBound = bound->get_placement();
    243243
  • orxonox/branches/bezierTrack/src/collision.cc

    r2190 r3013  
    180180  bool r = false;
    181181  int ia, ib;
    182   Vector mra = pa->r + pa->w.apply(ta->m);
    183   Vector mrb = pb->r + pb->w.apply(tb->m);
     182  Vector mra = pa->pos + pa->rot.apply(ta->m);
     183  Vector mrb = pb->pos + pb->rot.apply(tb->m);
    184184  CC_Tree* use_a, *use_b;
    185185 
     
    333333  bool r = false;
    334334  int i;
    335   Vector mr = p->r + p->w.apply (t->m);
     335  Vector mr = p->pos + p->rot.apply (t->m);
    336336  CC_Tree* use_t;
    337337  Vector* ips;
  • orxonox/branches/bezierTrack/src/coordinates.h

    r2551 r3013  
    3030typedef struct
    3131{
    32   Vector r;              //!< Absolute x/y/z coordinates
    33   Quaternion w;          //!< Absolute orientation
     32  Vector pos;              //!< Absolute x/y/z coordinates
     33  Quaternion rot;          //!< Absolute orientation
    3434} Placement;
    3535
  • orxonox/branches/bezierTrack/src/environment.cc

    r2816 r3013  
    7373  float matrix[4][4];
    7474 
    75   glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
    76   get_placement()->w.matrix (matrix);
     75  glTranslatef(get_placement()->pos.x,get_placement()->pos.y,get_placement()->pos.z);
     76  get_placement()->rot.matrix (matrix);
    7777  glMultMatrixf ((float*)matrix);
    7878
  • orxonox/branches/bezierTrack/src/orxonox.cc

    r2817 r3013  
    100100  // initialize SDL
    101101  printf("> Initializing SDL\n");
    102   if( SDL_Init (SDL_INIT_EVERYTHING) == -1)
     102  if( SDL_Init (SDL_INIT_VIDEO) == -1)
    103103    {
    104104      printf ("Could not SDL_Init(): %s\n", SDL_GetError());
  • orxonox/branches/bezierTrack/src/player.cc

    r2969 r3013  
    103103  float matrix[4][4];
    104104 
    105   glTranslatef(get_placement()->r.x,get_placement()->r.y,get_placement()->r.z);
    106   get_placement()->w.matrix (matrix);
     105  glTranslatef(get_placement()->pos.x,get_placement()->pos.y,get_placement()->pos.z);
     106  get_placement()->rot.matrix (matrix);
    107107  glMultMatrixf ((float*)matrix);
    108108 
    109109  glMatrixMode (GL_MODELVIEW);
    110   glRotatef (-90, 0,1,0);
     110  glRotatef (-90, 0, 1, 0);
    111111  obj->draw();
    112112  //  glCallList (objectList);
     
    134134  /* calculate the direction in which the craft is heading  */
    135135  Vector direction(0.0, 0.0, 1.0);
    136   direction = pos->w.apply(direction);
     136  direction = pos->rot.apply(direction);
    137137  Vector orthDirection(0.0, 0.0, 1.0);
    138138  orthDirection = orthDirection.cross(direction);
  • orxonox/branches/bezierTrack/src/track.cc

    r3010 r3013  
    4848}
    4949
    50 void Track::addPoint (Vector& point)
     50void Track::addPoint (Vector point)
    5151{
    5252  curve.addNode(point);
     
    5656
    5757
    58 void Track::addHotPoint (Vector& hotPoint)
     58void Track::addHotPoint (Vector hotPoint)
    5959{
    6060
     
    7474void Track::map_camera (Location* lookat, Placement* camplc)
    7575{
    76   t+=.001;
     76  t+=.0001;
    7777  if (t> 1) t =0;
    7878  //  Line trace(*offset, *end - *offset);
     
    8181  //  float r = (lookat->dist)*PI / l;
    8282  // camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    83   camplc->r = curve.calcPos(t) + (curve.calcDir(t)* ((lookat->dist-10)/t)) + Vector(0,0,5.0);
     83  camplc->pos = curve.calcPos(t) + (curve.calcDir(t)* ((lookat->dist-10.0)/t)) + Vector(-10,0,0);
    8484                                 
    8585  Vector w(0.0,0.0,0.0);
    8686  //  w=Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r));
    87   w = Vector(0,0,0) - (((curve.calcPos(t)) + ((curve.calcDir(t)) * ((lookat->dist) / t)) - camplc->r));
    88 
     87  w = Vector(0,0,0) - (((curve.calcPos(t)) + ((curve.calcDir(t)) * ((lookat->dist) / t)) - camplc->pos));
    8988  //Vector up(0.0,sin(r),cos(r)); // corrupt...
    9089  Vector up(0.0, 0.0, 1.0);
    9190
    92   camplc->w = Quaternion(w, up);
     91  camplc->rot = Quaternion(w, up);
    9392
    9493  //printf("\n------\nup vector: [%f, %f, %f]\n", up.x, up.y, up.z);
     
    128127        Quaternion dir(curve.calcDir(t), Vector(0,0,1));
    129128
    130         plc->r = curve.calcPos(t) + (curve.calcDir(t) * ((loc->dist) / t)) + /*dir.apply*/(loc->pos);
    131         plc->w = dir * loc->rot;
     129        plc->pos = curve.calcPos(t) + (curve.calcDir(t) * ((loc->dist) / t)) + /*dir.apply*/(loc->pos);
     130        plc->rot = dir * loc->rot;
    132131       
    133132        return false;
  • orxonox/branches/bezierTrack/src/track.h

    r3010 r3013  
    3535  virtual void init();
    3636
    37   void addPoint (Vector& point);
    38   void addHotPoint (Vector& hotPoint);
     37  void addPoint (Vector point);
     38  void addHotPoint (Vector hotPoint);
    3939 
    4040  virtual void post_enter (WorldEntity* entity);        // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
  • orxonox/branches/bezierTrack/src/world.cc

    r3010 r3013  
    100100            // create some path nodes
    101101            this->pathnodes = new Vector[6];
    102             this->pathnodes[0] = Vector(0, 0, 0);
    103             this->pathnodes[1] = Vector(10, 5, 0);
    104             this->pathnodes[2] = Vector(20, 0, 0);
    105             this->pathnodes[3] = Vector(10, 3, 0);
    106             this->pathnodes[4] = Vector(50, 0, 0);
    107             this->pathnodes[5] = Vector(100, 0, 0);
    108            
    109             // create the tracks
    110             this->tracklen = 5;
     102           
     103            this->tracklen = 6;
    111104            this->track = new Track();
    112             for( int i = 0; i < this->tracklen; i++)
    113               {
    114                 //              this->track[i] = Track( i, (i+1)%this->tracklen, &this->pathnodes[i], &this->pathnodes[(i+1)%this->tracklen]);
    115                 track->addPoint(this->pathnodes[i]);
    116               }
     105
     106            track->addPoint (Vector(0, 0, 0));
     107            track->addPoint (Vector(10, 5, 0));
     108            track->addPoint (Vector(20, 0, 0));
     109            track->addPoint (Vector(10, 3, 0));
     110            track->addPoint (Vector(50, 0, 0));
     111            track->addPoint (Vector(0, 0, 0));
     112           
    117113           
    118114            // create a player
     
    130126
    131127            Placement* plc = new Placement;
    132             plc->r = Vector(100, 10, 10);
    133             plc->w = Quaternion();
     128            plc->pos = Vector(100, 10, 10);
     129            plc->rot = Quaternion();
    134130            WorldEntity* env = new Environment();
    135131            this->spawn(env, plc);
     
    647643  if( plc == NULL)
    648644    {
    649       zeroPlc.r = Vector();
    650       zeroPlc.w = Quaternion();
     645      zeroPlc.pos = Vector();
     646      zeroPlc.rot = Quaternion();
    651647      plc = &zeroPlc;
    652648    }
Note: See TracChangeset for help on using the changeset viewer.