Changeset 3752 in orxonox.OLD for orxonox/trunk/src/world_entities/test_gun.cc
- Timestamp:
- Apr 7, 2005, 10:13:42 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world_entities/test_gun.cc
r3751 r3752 30 30 #include "vector.h" 31 31 #include "list.h" 32 #include "simple_animation.h" 32 33 33 34 using namespace std; … … 42 43 : Weapon (parent, coordinate, direction) 43 44 { 44 //this->model = (Model*)ResourceManager::getInstance()->load("models/weapon_packet.obj", OBJ, RP_CAMPAIGN);45 this->model = (Model*)ResourceManager::getInstance()->load("models/test_gun.obj", OBJ, RP_CAMPAIGN); 45 46 this->idleTime = 0.2f; 47 48 this->animator = SimpleAnimation::getInstance(); 49 this->dummy = new WorldEntity(); /* a world entity that is not drawed: use this for the weapon */ 50 parent->addChild(this->dummy, PNODE_ALL); 51 //this->dummy->setRelCoor(new Vector(-2.6, 0.1, 3.0)); 52 53 this->animator->animatorBegin(); 54 this->animator->selectObject(this->dummy); 55 this->animator->setAnimationMode(SINGLE); 56 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.0, NEG_EXP); 57 this->animator->addKeyFrame(new Vector(-3.0, 0.1, 3.0), new Quaternion(), 0.1, NEG_EXP); 58 this->animator->addKeyFrame(new Vector(-2.6, 0.1, 3.0), new Quaternion(), 0.5, NEG_EXP); 59 this->animator->animatorEnd(); 60 46 61 } 47 62 … … 100 115 this->worldEntities->add(pj); 101 116 this->localTime = 0; 117 118 this->animator->animatorBegin(); 119 this->animator->selectObject(this->dummy); 120 this->animator->start(); 121 this->animator->animatorEnd(); 102 122 } 103 123 … … 131 151 { 132 152 this->localTime += time; 133 //this->debug();134 //printf("TEST_GUN: this speed is: %f\n", this->getSpeed());135 153 } 136 154 … … 148 166 void TestGun::draw () 149 167 { 168 150 169 glMatrixMode(GL_MODELVIEW); 151 170 glPushMatrix(); 152 171 float matrix[4][4]; 153 172 154 /* translate */173 155 174 glTranslatef (this->getAbsCoor ().x, 156 175 this->getAbsCoor ().y, 157 176 this->getAbsCoor ().z); 158 /* rotate */177 159 178 this->getAbsDir ().matrix (matrix); 160 179 glMultMatrixf((float*)matrix); 180 this->model->draw(1); 181 glPopMatrix(); 161 182 162 //this->model->draw(2); 183 184 glMatrixMode(GL_MODELVIEW); 185 glPushMatrix(); 186 187 glTranslatef (this->dummy->getAbsCoor ().x, 188 this->dummy->getAbsCoor ().y, 189 this->dummy->getAbsCoor ().z); 190 191 this->dummy->getAbsDir ().matrix (matrix); 192 glMultMatrixf((float*)matrix); 193 this->model->draw(0); 163 194 glPopMatrix(); 195 164 196 } 165 197
Note: See TracChangeset
for help on using the changeset viewer.