- Timestamp:
- Apr 7, 2005, 10:13:42 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/defs/debug.h
r3750 r3752 59 59 #define DEBUG_MODULE_ORXONOX 0 60 60 #define DEBUG_MODULE_WORLD 0 61 #define DEBUG_MODULE_PNODE 361 #define DEBUG_MODULE_PNODE 1 62 62 #define DEBUG_MODULE_WORLD_ENTITY 0 63 63 #define DEBUG_MODULE_COMMAND_NODE 0 … … 65 65 #define DEBUG_MODULE_LOAD 0 66 66 67 #define DEBUG_MODULE_IMPORTER 267 #define DEBUG_MODULE_IMPORTER 1 68 68 #define DEBUG_MODULE_TRACK_MANAGER 0 69 69 #define DEBUG_MODULE_GARBAGE_COLLECTOR 0 70 70 #define DEBUG_MODULE_LIGHT 0 71 #define DEBUG_MODULE_PLAYER 371 #define DEBUG_MODULE_PLAYER 1 72 72 #define DEBUG_MODULE_MATH 0 73 73 -
orxonox/trunk/src/simple_animation.cc
r3744 r3752 73 73 delete iterator; 74 74 delete this->frames; 75 singletonRef = NULL; 75 76 } 76 77 … … 118 119 void SimpleAnimation::selectObject(WorldEntity* entity) 119 120 { 120 printf("SimpleAnimation::selectObject() - selecing active object\n");121 121 Animation* anim = getAnimationFromWorldEntity(entity); 122 122 if( anim == NULL) 123 123 { 124 printf("SimpleAnimation::selectObject() - object not found, creating one\n");125 124 anim = new Animation; 126 125 anim->object = entity; … … 128 127 anim->tmpVect = new Vector(); 129 128 anim->frames = new tList<KeyFrame>(); 129 anim->animMode = LOOP; 130 130 bRunning = false; 131 131 deltaT = 0.0; 132 132 this->animators->add(anim); 133 133 } 134 else135 printf("SimpleAnimation::selectObject() - animation already existent, using it\n");136 134 this->workingAnimator = anim; 137 printf("SimpleAnimation::selectObject() - selection completed\n");138 135 } 139 136 … … 203 200 } 204 201 202 203 void SimpleAnimation::setAnimationMode(animationMode mode) 204 { 205 if( !this->bDescriptive || this->workingAnimator == NULL) 206 { 207 PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n"); 208 return; 209 } 210 this->workingAnimator->animMode = mode; 211 } 205 212 206 213 /** … … 323 330 anim->lastFrame = anim->currentFrame; 324 331 anim->currentFrame = anim->frames->nextElement(anim->currentFrame); 332 if( anim->currentFrame == anim->frames->firstElement() && anim->animMode == SINGLE) 333 { 334 anim->bRunning = false; 335 return; 336 } 325 337 anim->movMode = anim->currentFrame->mode; 326 338 if( anim->movMode == NEG_EXP) … … 335 347 { 336 348 case LINEAR: 337 338 349 *anim->tmpVect = *anim->currentFrame->position - *anim->lastFrame->position; 339 350 *anim->tmpVect = *anim->tmpVect * anim->localTime / anim->currentFrame->time; -
orxonox/trunk/src/simple_animation.h
r3750 r3752 67 67 public: 68 68 static SimpleAnimation* getInstance(); 69 virtual ~SimpleAnimation(); 69 70 70 71 void animatorBegin(); … … 74 75 void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode); 75 76 void addKeyFrame(KeyFrame* frame); 77 void setAnimationMode(animationMode mode); 76 78 void reset(); 77 79 … … 87 89 private: 88 90 SimpleAnimation(); 89 virtual ~SimpleAnimation();90 91 91 92 static SimpleAnimation* singletonRef; -
orxonox/trunk/src/story_entities/world.cc
r3750 r3752 158 158 delete this->trackManager; 159 159 160 delete this->simpleAnimation; 160 161 //delete garbagecollecor 161 162 //delete animator … … 448 449 this->spawn(baseNode); 449 450 450 WorldEntity* secondNode = new Satellite(Vector(0,0,1), 1.0);451 WorldEntity* secondNode = new Satellite(Vector(0,0,1), 2.0); 451 452 baseNode->addChild(secondNode); 452 secondNode->setRelCoor(new Vector(0.0, 3.0, 0.0));453 secondNode->setRelCoor(new Vector(0.0, 0.0, 3.0)); 453 454 this->spawn(secondNode); 454 455 455 456 456 WorldEntity* thirdNode = new Satellite(Vector(0,0,1), 2.0);457 WorldEntity* thirdNode = new Satellite(Vector(0,0,1), 1.0); 457 458 secondNode->addChild(thirdNode); 458 459 thirdNode->setRelCoor(new Vector(2.0, 0.0, 0.0)); … … 460 461 461 462 463 464 462 465 463 466 WorldEntity* b = new Environment(); … … 499 502 500 503 504 501 505 this->simpleAnimation->animatorBegin(); 502 506 this->simpleAnimation->selectObject(b); 507 this->simpleAnimation->setAnimationMode(SINGLE); 503 508 this->simpleAnimation->addKeyFrame(f1); 504 509 this->simpleAnimation->addKeyFrame(f2); -
orxonox/trunk/src/world_entities/player.cc
r3750 r3752 53 53 acceleration = 10.0; 54 54 //weapons: 55 Weapon* wp = new TestGun(this, new Vector(- 1.1, 0.0, 2.6), new Quaternion());55 Weapon* wp = new TestGun(this, new Vector(-2.6, 0.1, 3.0), new Quaternion()); 56 56 this->weapons->add(wp); 57 57 this->activeWeapon = wp; -
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 -
orxonox/trunk/src/world_entities/test_gun.h
r3631 r3752 29 29 class Vector; 30 30 class Quaternion; 31 class SimpleAnimation; 31 32 32 33 … … 50 51 virtual void draw(void); 51 52 53 private: 54 SimpleAnimation* animator; 55 WorldEntity* dummy; 56 52 57 }; 53 58 -
orxonox/trunk/src/world_entities/weapon.cc
r3685 r3752 37 37 : WorldEntity() 38 38 { 39 parent->addChild(this, PNODE_ ROTATE_AND_MOVE);39 parent->addChild(this, PNODE_ALL); 40 40 this->setRelCoor(coordinate); 41 41 this->setRelDir(direction);
Note: See TracChangeset
for help on using the changeset viewer.