- Timestamp:
- Apr 18, 2005, 11:59:13 PM (20 years ago)
- Location:
- orxonox/trunk/src/world_entities
- Files:
-
- 3 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); -
orxonox/trunk/src/world_entities/test_gun.h
r3881 r3886 54 54 Animation3D* animation; 55 55 Vector* projOffset; 56 WorldEntity* dummy1;57 56 int leftRight; // this will become an enum 58 57 -
orxonox/trunk/src/world_entities/weapon.h
r3881 r3886 38 38 class Projectile; 39 39 class Weapon; 40 class Animation3D; 40 41 41 42 typedef enum { … … 66 67 #define W_CONFIG2 2 67 68 #define W_CONFIG3 3 69 70 //! a weapon can be left or right sided 71 #define W_LEFT 0 72 #define W_RIGHT 1 68 73 69 74 //! this is a weapon Configuration: it has up to 8 slots … … 155 160 protected: 156 161 tList<WorldEntity>* worldEntities; 157 float localTime; 158 float idleTime; 159 float slowDownFactor; 162 float localTime; //<! this is the local time. important for shooting attributes like frequency 163 float idleTime; //<! the time a weapon needs before it can shoot again. eg. shooting frequency or actication/deactivateion delay 164 float slowDownFactor; //<! if the shooting frequency is a linear function of time... 165 166 PNode* objectComponent1; //<! the gun is made of multiple parts, these PNodes represent their location and orientation 167 PNode* objectComponent2; 168 PNode* objectComponent3; 169 170 Animation3D* animation1; 171 Animation3D* animation2; 172 Animation3D* animation3; 173 174 Vector* projectileOffset; 175 int leftRight; // this will become an enum 160 176 161 177 private: 162 bool enabled; 163 Projectile* projectile; 178 bool enabled; //<! states if the weapon is enabled or not 179 Projectile* projectile; //<! the projectile used for this weapon 164 180 //WeaponSound sound; 165 181 };
Note: See TracChangeset
for help on using the changeset viewer.