- Timestamp:
- Aug 13, 2005, 7:19:51 PM (19 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/coord/p_node.cc
r4997 r4998 327 327 } 328 328 329 330 329 /** 331 330 * sets the absolute direction (0,0,1) … … 543 542 if (unlikely(this->toDirection != NULL)) 544 543 { 545 Quaternion rotQuat = (*this->toDirection / this->getRelDir()) *dt*bias; 546 rotQuat.debug(); 547 // if (likely(rotQuat.len() >= .001)) 544 Quaternion rotQuat = Quaternion(.1, Vector(0,1,0));// (*this->toDirection / this->relDirection); 545 // printf("1: "); 546 // this->relDirection.debug(); 547 // printf("2: "); 548 // this->toDirection->debug(); 549 // printf("3: "); 550 // rotQuat.debug(); 551 552 if (true)//likely(rotQuat.len() >= .001)) 548 553 { 549 554 this->shiftDir(rotQuat); 550 555 } 551 /*else556 else 552 557 { 553 558 delete this->toCoordinate; 554 559 this->toCoordinate = NULL; 555 560 PRINTF(5)("SmoothMove of %s finished\n", this->getName()); 556 } */561 } 557 562 } 558 563 … … 664 669 glMatrixMode(GL_MODELVIEW); 665 670 glPushMatrix(); 666 float matrix[4][4];667 671 668 672 /* translate */ … … 671 675 this->getAbsCoor ().z); 672 676 /* rotate */ 673 this->getAbsDir ().matrix (matrix); 674 glMultMatrixf((float*)matrix); 677 // this->getAbsDir ().matrix (matrix); 678 // glMultMatrixf((float*)matrix); 679 680 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 681 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 675 682 { 676 683 glBegin(GL_LINE_STRIP); -
orxonox/trunk/src/lib/math/vector.cc
r4997 r4998 197 197 * @returns the Result of the smooth move 198 198 */ 199 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t)199 Quaternion Quaternion::quatSlerp(const Quaternion& from, const Quaternion& to, float t) 200 200 { 201 201 float tol[4]; … … 306 306 void Quaternion::debug() 307 307 { 308 PRINT(0)("Quaternion Debug Information\n");309 308 PRINT(0)("real a=%f; imag: x=%f y=%f z=%f\n", w, v.x, v.y, v.z); 310 309 } -
orxonox/trunk/src/lib/math/vector.h
r4997 r4998 150 150 inline Quaternion operator= (const Quaternion& q) {this->v = q.v; this->w = q.w; return *this;} 151 151 /** conjugates this Quaternion @returns the conjugate */ 152 inline Quaternion conjugate () const { Quaternion r(*this); r.v = Vector() - r.v; return r; };152 inline Quaternion conjugate () const { return Quaternion(Vector(-v.x, -v.y, -v.z), this->w); }; 153 153 /** @returns the norm of The Quaternion */ 154 154 inline float norm () const { return w*w + v.x*v.x + v.y*v.y + v.z*v.z; }; … … 158 158 inline Vector apply (const Vector& v) const { return (*this * Quaternion(v, 0) * conjugate()).v; }; 159 159 void matrix (float m[4][4]) const; 160 /** @returns the normalized Quaternion (|this|) */ 161 inline Quaternion getNormalized() const { float n = this->norm(); return Quaternion(this->v/n, this->w/n); }; 162 /** normalizes the current Quaternion */ 163 inline void normalize() { float n = this->norm(); this->v /= n; this->w/=n; }; 164 165 /** @returns the rotational axis of this Quaternion */ 166 inline Vector getSpacialAxis() const { return this->v / sin(acos(w));/*sqrt(v.x*v.x + v.y*v.y + v.z+v.z);*/ }; 167 /** @returns the rotational angle of this Quaternion around getSpacialAxis() !! IN DEGREE !! */ 168 inline float getSpacialAxisAngle() const { return 360 / M_PI * acos(this->w); }; 169 170 static Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t); 160 171 161 172 void debug(); 173 162 174 163 175 public: … … 167 179 }; 168 180 169 Quaternion quatSlerp(const Quaternion& from, const Quaternion& to, float t);170 181 171 182 -
orxonox/trunk/src/util/animation/animation3d.cc
r4836 r4998 401 401 void Animation3D::rLinear(float timePassed) const 402 402 { 403 this->object->setRelDir( quatSlerp( this->nextKeyFrame->direction,404 405 403 this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction, 404 this->currentKeyFrame->direction, 405 timePassed/this->currentKeyFrame->duration) ); 406 406 } 407 407 … … 420 420 scale = 1.0 - sin( M_PI * timePassed / this->currentKeyFrame->duration); 421 421 422 this->object->setRelDir( quatSlerp( this->nextKeyFrame->direction,423 424 422 this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction, 423 this->currentKeyFrame->direction, 424 scale) ); 425 425 } 426 426 … … 435 435 { 436 436 float scale = cos(M_PI * timePassed / this->currentKeyFrame->duration); 437 this->object->setRelDir( quatSlerp( this->nextKeyFrame->direction,438 439 437 this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction, 438 this->currentKeyFrame->direction, 439 scale) ); 440 440 } 441 441 … … 458 458 { 459 459 float scale = (1.0 - expf(- timePassed * expFactorRot)); 460 this->object->setRelDir( quatSlerp( this->nextKeyFrame->direction,461 462 460 this->object->setRelDir(Quaternion::quatSlerp( this->nextKeyFrame->direction, 461 this->currentKeyFrame->direction, 462 scale) ); 463 463 } 464 464 -
orxonox/trunk/src/world_entities/camera.cc
r4997 r4998 142 142 case VIEW_FRONT: 143 143 this->toFovy = 120.0; 144 this->softReparent("Player"); 145 this->target->softReparent("Player"); 146 this->setRelCoorSoft(4, 0, 0); 147 this->target->setRelCoorSoft(10,0,0); 144 // this->softReparent("Player"); 145 // this->target->softReparent("Player"); 146 // this->setRelCoorSoft(4, 0, 0); 147 // this->target->setRelCoorSoft(10,0,0); 148 this->target->setRelDirSoft(Quaternion(M_PI/4.0, Vector(0,1,0))); 148 149 break; 149 150 case VIEW_LEFT: -
orxonox/trunk/src/world_entities/player.cc
r4997 r4998 222 222 glMatrixMode(GL_MODELVIEW); 223 223 glPushMatrix(); 224 float matrix[4][4];225 226 224 /* translate */ 227 225 glTranslatef (this->getAbsCoor ().x, … … 229 227 this->getAbsCoor ().z); 230 228 /* rotate */ 231 this->getAbsDir ().matrix (matrix); 232 glMultMatrixf((float*)matrix); 233 229 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 230 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 234 231 this->model->draw(); 235 232 glPopMatrix(); -
orxonox/trunk/src/world_entities/skybox.cc
r4836 r4998 167 167 this->size = size; 168 168 } 169 170 /**171 * draws the SkyBox172 */173 void SkyBox::draw()174 {175 glPushMatrix();176 glMatrixMode(GL_MODELVIEW);177 Vector r = this->getAbsCoor();178 glTranslatef(r.x, r.y, r.z);179 180 this->model->draw();181 182 glPopMatrix();183 }184 185 169 186 170 /** -
orxonox/trunk/src/world_entities/skybox.h
r4836 r4998 34 34 35 35 void setSize(float size); 36 /** \briefassumes jpg as input-format */36 /** assumes jpg as input-format */ 37 37 void setTexture(const char* name) { setTextureAndType (name, "jpg"); }; 38 38 … … 40 40 void setTextures(const char* top, const char* bottom, const char* left, 41 41 const char* right, const char* front, const char* back); 42 43 virtual void draw();44 42 45 43 private: -
orxonox/trunk/src/world_entities/terrain.cc
r4924 r4998 106 106 glMatrixMode(GL_MODELVIEW); 107 107 glPushMatrix(); 108 float matrix[4][4];109 108 110 109 /* translate */ … … 113 112 this->getAbsCoor ().z); 114 113 /* rotate */ 115 this->getAbsDir ().matrix (matrix);116 gl MultMatrixf((float*)matrix);114 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 115 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 117 116 118 117 if (this->objectList) -
orxonox/trunk/src/world_entities/world_entity.cc
r4885 r4998 179 179 glMatrixMode(GL_MODELVIEW); 180 180 glPushMatrix(); 181 float matrix[4][4];182 183 181 /* translate */ 184 182 glTranslatef (this->getAbsCoor ().x, … … 186 184 this->getAbsCoor ().z); 187 185 /* rotate */ 188 this->getAbsDir ().matrix (matrix);189 gl MultMatrixf((float*)matrix);186 Vector tmpRot = this->getAbsDir().getSpacialAxis(); 187 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 190 188 191 189 if (this->obbTree)
Note: See TracChangeset
for help on using the changeset viewer.