Changeset 3886 in orxonox.OLD for orxonox/trunk/src/world_entities/test_gun.cc
- Timestamp:
- Apr 18, 2005, 11:59:13 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/test_gun.cc
r3881 r3886 53 53 54 54 55 this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 56 this->animation = new Animation3D(dummy1); 57 58 parent->addChild(this->dummy1, PNODE_ALL); 59 60 this->animation->setInfinity(ANIM_INF_CONSTANT); 55 //this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon 56 this->objectComponent1 = new PNode(); 57 this->animation1 = new Animation3D(this->objectComponent1); 58 59 parent->addChild(this->objectComponent1, PNODE_ALL); 60 61 this->animation1->setInfinity(ANIM_INF_CONSTANT); 61 62 // ANIM_LINEAR was ANIM_NEG_EXP 62 if( this->leftRight == 0)63 if( this->leftRight == W_LEFT) 63 64 { 64 this->animation ->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);65 this->animation ->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);66 this->animation ->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);65 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 66 this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR); 67 this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR); 67 68 } 68 else if( this->leftRight == 1)69 else if( this->leftRight == W_RIGHT) 69 70 { 70 this->animation ->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);71 this->animation ->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);72 this->animation ->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);71 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 72 this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR); 73 this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR); 73 74 } 74 /*75 if( this->leftRight == 0)76 {77 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.0, ANIM_NEG_EXP);78 this->animation->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.1, ANIM_NEG_EXP);79 this->animation->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.5, ANIM_NEG_EXP);80 }81 else if( this->leftRight == 1)82 {83 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.0, ANIM_NEG_EXP);84 this->animation->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.1, ANIM_NEG_EXP);85 this->animation->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.5, ANIM_NEG_EXP);86 }87 */88 75 } 89 76 … … 143 130 this->localTime = 0; 144 131 145 this->animation ->replay();132 this->animation1->replay(); 146 133 } 147 134 … … 190 177 void TestGun::draw () 191 178 { 192 193 /* draw gun body 1 */ 179 /* draw gun body */ 194 180 glMatrixMode(GL_MODELVIEW); 195 181 glPushMatrix(); 196 182 float matrix[4][4]; 197 198 if( this->leftRight == 0) 199 { 200 glTranslatef (this->getAbsCoor ().x, 201 this->getAbsCoor ().y, 202 this->getAbsCoor ().z); 203 204 this->getAbsDir ().matrix (matrix); 205 glMultMatrixf((float*)matrix); 206 this->model->draw(1); 207 } 208 else if( this->leftRight == 1) 209 { 210 glTranslatef (this->getAbsCoor ().x, 211 this->getAbsCoor ().y, 212 this->getAbsCoor ().z); 213 214 this->getAbsDir ().matrix (matrix); 215 glMultMatrixf((float*)matrix); 216 glScalef(1.0, 1.0, -1.0); 217 this->model->draw(1); 218 } 219 183 glTranslatef (this->getAbsCoor ().x, 184 this->getAbsCoor ().y, 185 this->getAbsCoor ().z); 186 this->getAbsDir ().matrix (matrix); 187 glMultMatrixf((float*)matrix); 188 if( this->leftRight == W_RIGHT) 189 glScalef(1.0, 1.0, -1.0); 190 this->model->draw(1); 220 191 glPopMatrix(); 221 192 222 223 /* draw gun coil 1 */ 193 /* draw objectComponent1: gun coil - animated stuff */ 224 194 glMatrixMode(GL_MODELVIEW); 225 195 glPushMatrix(); 226 227 glTranslatef (this->dummy1->getAbsCoor ().x, 228 this->dummy1->getAbsCoor ().y, 229 this->dummy1->getAbsCoor ().z); 230 231 this->dummy1->getAbsDir ().matrix (matrix); 196 glTranslatef (this->objectComponent1->getAbsCoor ().x, 197 this->objectComponent1->getAbsCoor ().y, 198 this->objectComponent1->getAbsCoor ().z); 199 this->objectComponent1->getAbsDir ().matrix (matrix); 232 200 glMultMatrixf((float*)matrix); 233 201 this->model->draw(0);
Note: See TracChangeset
for help on using the changeset viewer.