Changeset 3013 in orxonox.OLD for orxonox/branches/bezierTrack
- Timestamp:
- Nov 27, 2004, 12:45:12 PM (20 years ago)
- Location:
- orxonox/branches/bezierTrack/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/bezierTrack/src/camera.cc
r2636 r3013 42 42 t = 0.0; 43 43 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; 47 47 } 48 48 … … 144 144 145 145 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); 149 149 //plLastBPlace = *bound->get_placement(); 150 150 } … … 159 159 bound->get_lookat(&lcBound); 160 160 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); 163 163 } 164 164 break; … … 172 172 Vector vDirection(0.0, 0.0, 1.0); 173 173 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; 176 176 } 177 177 break; … … 187 187 else 188 188 { 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 (); 191 191 } 192 192 break; … … 235 235 // rotation 236 236 float matrix[4][4]; 237 actual_place. w.conjugate().matrix (matrix);237 actual_place.rot.conjugate().matrix (matrix); 238 238 /* orientation and */ 239 239 glMultMatrixf ((float*)matrix); 240 240 /* 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); 242 242 //Placement *plBound = bound->get_placement(); 243 243 -
orxonox/branches/bezierTrack/src/collision.cc
r2190 r3013 180 180 bool r = false; 181 181 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); 184 184 CC_Tree* use_a, *use_b; 185 185 … … 333 333 bool r = false; 334 334 int i; 335 Vector mr = p-> r + p->w.apply (t->m);335 Vector mr = p->pos + p->rot.apply (t->m); 336 336 CC_Tree* use_t; 337 337 Vector* ips; -
orxonox/branches/bezierTrack/src/coordinates.h
r2551 r3013 30 30 typedef struct 31 31 { 32 Vector r; //!< Absolute x/y/z coordinates33 Quaternion w; //!< Absolute orientation32 Vector pos; //!< Absolute x/y/z coordinates 33 Quaternion rot; //!< Absolute orientation 34 34 } Placement; 35 35 -
orxonox/branches/bezierTrack/src/environment.cc
r2816 r3013 73 73 float matrix[4][4]; 74 74 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); 77 77 glMultMatrixf ((float*)matrix); 78 78 -
orxonox/branches/bezierTrack/src/orxonox.cc
r2817 r3013 100 100 // initialize SDL 101 101 printf("> Initializing SDL\n"); 102 if( SDL_Init (SDL_INIT_ EVERYTHING) == -1)102 if( SDL_Init (SDL_INIT_VIDEO) == -1) 103 103 { 104 104 printf ("Could not SDL_Init(): %s\n", SDL_GetError()); -
orxonox/branches/bezierTrack/src/player.cc
r2969 r3013 103 103 float matrix[4][4]; 104 104 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); 107 107 glMultMatrixf ((float*)matrix); 108 108 109 109 glMatrixMode (GL_MODELVIEW); 110 glRotatef (-90, 0, 1,0);110 glRotatef (-90, 0, 1, 0); 111 111 obj->draw(); 112 112 // glCallList (objectList); … … 134 134 /* calculate the direction in which the craft is heading */ 135 135 Vector direction(0.0, 0.0, 1.0); 136 direction = pos-> w.apply(direction);136 direction = pos->rot.apply(direction); 137 137 Vector orthDirection(0.0, 0.0, 1.0); 138 138 orthDirection = orthDirection.cross(direction); -
orxonox/branches/bezierTrack/src/track.cc
r3010 r3013 48 48 } 49 49 50 void Track::addPoint (Vector &point)50 void Track::addPoint (Vector point) 51 51 { 52 52 curve.addNode(point); … … 56 56 57 57 58 void Track::addHotPoint (Vector &hotPoint)58 void Track::addHotPoint (Vector hotPoint) 59 59 { 60 60 … … 74 74 void Track::map_camera (Location* lookat, Placement* camplc) 75 75 { 76 t+=.00 1;76 t+=.0001; 77 77 if (t> 1) t =0; 78 78 // Line trace(*offset, *end - *offset); … … 81 81 // float r = (lookat->dist)*PI / l; 82 82 // 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); 84 84 85 85 Vector w(0.0,0.0,0.0); 86 86 // 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)); 89 88 //Vector up(0.0,sin(r),cos(r)); // corrupt... 90 89 Vector up(0.0, 0.0, 1.0); 91 90 92 camplc-> w= Quaternion(w, up);91 camplc->rot = Quaternion(w, up); 93 92 94 93 //printf("\n------\nup vector: [%f, %f, %f]\n", up.x, up.y, up.z); … … 128 127 Quaternion dir(curve.calcDir(t), Vector(0,0,1)); 129 128 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; 132 131 133 132 return false; -
orxonox/branches/bezierTrack/src/track.h
r3010 r3013 35 35 virtual void init(); 36 36 37 void addPoint (Vector &point);38 void addHotPoint (Vector &hotPoint);37 void addPoint (Vector point); 38 void addHotPoint (Vector hotPoint); 39 39 40 40 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 100 100 // create some path nodes 101 101 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; 111 104 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 117 113 118 114 // create a player … … 130 126 131 127 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(); 134 130 WorldEntity* env = new Environment(); 135 131 this->spawn(env, plc); … … 647 643 if( plc == NULL) 648 644 { 649 zeroPlc. r= Vector();650 zeroPlc. w= Quaternion();645 zeroPlc.pos = Vector(); 646 zeroPlc.rot = Quaternion(); 651 647 plc = &zeroPlc; 652 648 }
Note: See TracChangeset
for help on using the changeset viewer.