Changeset 4597 in orxonox.OLD for orxonox/trunk/src/util
- Timestamp:
- Jun 11, 2005, 12:55:48 AM (20 years ago)
- Location:
- orxonox/trunk/src/util
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/util/animation/animation.cc
r3988 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 22 22 /** 23 23 \brief creates a new Animation 24 24 25 25 This also adds the Animation automatically to the AnimationPlayer's list 26 26 */ 27 27 Animation::Animation(void) 28 { 28 { 29 this->setClassID(CL_ANIMATION, "Animation"); 30 29 31 // initialize a beginning KeyFrame, that will be deleted afterwards 30 32 this->keyFrameCount = 0; … … 43 45 /** 44 46 \brief destructs the Animation 45 47 46 48 this also takes the animation out of the AnimationPlayer's list (if it is there) 47 49 */ … … 54 56 \brief tells the AnimationPlayer, that we do not wish to handle this animation 55 57 automatically. 56 58 57 59 This means that it will not be ticked, and not be deleted with the AnimationPlayer 58 60 */ -
orxonox/trunk/src/util/animation/animation.h
r4485 r4597 1 /*! 1 /*! 2 2 \file animation.h 3 3 A Subclass for all animations in orxonox … … 31 31 deprecated QUADRATIC 32 32 */ 33 typedef enum ANIM_FUNCTION {ANIM_CONSTANT, 34 ANIM_LINEAR, 35 ANIM_SINE, 36 ANIM_COSINE, 37 ANIM_EXP, 38 ANIM_NEG_EXP, 39 ANIM_QUADRATIC, 40 ANIM_RANDOM, 41 ANIM_NULL}; 33 typedef enum ANIM_FUNCTION 34 { 35 ANIM_CONSTANT, 36 ANIM_LINEAR, 37 ANIM_SINE, 38 ANIM_COSINE, 39 ANIM_EXP, 40 ANIM_NEG_EXP, 41 ANIM_QUADRATIC, 42 ANIM_RANDOM, 43 ANIM_NULL 44 }; 45 42 46 #define ANIM_DEFAULT_FUNCTION ANIM_LINEAR //!< A default function to choose from the above set 43 47 … … 49 53 ANIM_INF_DELETE deletes the animation. !! THIS IS DANGEROUS !! only do this with non-class variables 50 54 */ 51 typedef enum ANIM_INFINITY {ANIM_INF_CONSTANT, 52 ANIM_INF_REPLAY, 53 ANIM_INF_REWIND, 54 ANIM_INF_DELETE};//, ANIM_INF_LINEAR, ANIM_INF_PINGPONG; 55 typedef enum ANIM_INFINITY 56 { 57 ANIM_INF_CONSTANT, 58 ANIM_INF_REPLAY, 59 ANIM_INF_REWIND, 60 ANIM_INF_DELETE 61 }; //, ANIM_INF_LINEAR, ANIM_INF_PINGPONG}; 55 62 56 63 //! A Superclass for describing an animation (all animations will be derived from this one) 57 64 /** implement in subclasses: 58 * 65 * 59 66 * De-/Constructor 60 67 * Animation Functions … … 65 72 * virtual rewind, to go to the first Keyframe. (other functions will call this one) 66 73 */ 67 class Animation 74 class Animation : public BaseObject 68 75 { 69 76 public: -
orxonox/trunk/src/util/animation/animation3d.cc
r4485 r4597 51 51 /** 52 52 \brief standard deconstructor 53 53 54 54 deletes all the Keyframes 55 55 */ … … 89 89 */ 90 90 void Animation3D::addKeyFrame(Vector position, Quaternion direction, float duration, 91 91 ANIM_FUNCTION animFuncMov, ANIM_FUNCTION animFuncRot) 92 92 { 93 93 // some small check … … 101 101 102 102 KeyFrame3D* tmpKeyFrame; 103 103 104 104 // when adding the first frame 105 105 if (this->keyFrameCount == 0) … … 114 114 // when adding the second frame 115 115 if (this->currentKeyFrame == this->nextKeyFrame) 116 116 this->nextKeyFrame = tmpKeyFrame; 117 117 this->keyFrameList->add(tmpKeyFrame); 118 118 } … … 136 136 { 137 137 if (this->bRunning) 138 { 138 { 139 139 this->localTime += dt; 140 140 if (localTime >= this->currentKeyFrame->duration) 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 } 141 { 142 if (likely(this->keyFramesToPlay != 0)) 143 { 144 if (unlikely(this->keyFramesToPlay > 0)) 145 --this->keyFramesToPlay; 146 // switching to the next Key-Frame 147 this->localTime -= this->currentKeyFrame->duration; 148 this->currentKeyFrame = this->nextKeyFrame; 149 // checking, if we should still Play the animation 150 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 151 this->handleInfinity(); 152 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 153 this->setAnimFuncMov(this->currentKeyFrame->animFuncMov); 154 this->setAnimFuncRot(this->currentKeyFrame->animFuncRot); 155 } 156 else 157 this->pause(); 158 } 159 159 /* now animate it */ 160 160 (this->*animFuncMov)(this->localTime); … … 257 257 else 258 258 v = (this->nextKeyFrame->position - this->currentKeyFrame->position) * (2.0 + sin( M_PI * (- timePassed /this->currentKeyFrame->duration)) )/ 2.0; 259 259 260 260 this->object->shiftCoor(v - this->currentKeyFrame->lastPosition); 261 261 this->currentKeyFrame->lastPosition = v; … … 279 279 /* 280 280 this->object->setRelCoor( this->nextKeyFrame->position - 281 282 281 (this->nextKeyFrame->position - this->currentKeyFrame->position) * 282 (1.0 + cos( M_PI * timePassed / this->currentKeyFrame->duration))/2.0); 283 283 */ 284 284 } … … 309 309 /* 310 310 this->object->setRelCoor( this->currentKeyFrame->position + 311 (this->nextKeyFrame->position - this->currentKeyFrame->position) * 312 311 (this->nextKeyFrame->position - this->currentKeyFrame->position) * 312 (1.0 - expf(- timePassed * expFactorMov)) ); 313 313 */ 314 314 } … … 334 334 { 335 335 /* 336 this->object->setRelCoor(this->currentKeyFrame->position + 337 336 this->object->setRelCoor(this->currentKeyFrame->position + 337 (this->nextKeyFrame->position - this->currentKeyFrame->position) * (float)rand()/(float)RAND_MAX); 338 338 this->object->setRelDir(this->currentKeyFrame->direction + 339 339 (this->nextKeyFrame->direction - this->currentKeyFrame->direction)* (float)rand()/(float)RAND_MAX); 340 340 */ 341 341 } … … 401 401 void Animation3D::rLinear(float timePassed) const 402 402 { 403 this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction, 404 this->currentKeyFrame->direction, 405 403 this->object->setRelDir(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 this->currentKeyFrame->direction, 424 422 this->object->setRelDir(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 this->currentKeyFrame->direction, 439 437 this->object->setRelDir(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 this->currentKeyFrame->direction, 462 460 this->object->setRelDir(quatSlerp( this->nextKeyFrame->direction, 461 this->currentKeyFrame->direction, 462 scale) ); 463 463 } 464 464 -
orxonox/trunk/src/util/animation/animation3d.h
r4485 r4597 1 /*! 1 /*! 2 2 \file animation3d.h 3 3 */ … … 33 33 Animation3D(PNode* object); 34 34 virtual ~Animation3D(void); 35 35 36 36 virtual void rewind(void); 37 37 … … 40 40 41 41 virtual void tick(float dt); 42 42 43 43 private: 44 44 // animation functions -
orxonox/trunk/src/util/animation/animation_player.cc
r4485 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 26 26 \brief standard constructor 27 27 */ 28 AnimationPlayer::AnimationPlayer () 28 AnimationPlayer::AnimationPlayer () 29 29 { 30 this->setClassID(CL_ANIMATION_PLAYER, "AnimationPlayer"); 30 this->setClassID(CL_ANIMATION_PLAYER, "AnimationPlayer"); 31 this->setName("AnimationPlayer"); 31 32 32 33 33 this->animationList = new tList<Animation>(); 34 this->play(); 34 35 } 35 36 … … 43 44 44 45 !! DANGER !! when unloading the AnimationPlayer no other Function 45 should reference any Animations, from the animationList because it 46 automatically deletes them. 46 should reference any Animations, from the animationList because it 47 automatically deletes them. 47 48 This usually happens when unloading a World. 48 49 */ 49 AnimationPlayer::~AnimationPlayer () 50 AnimationPlayer::~AnimationPlayer () 50 51 { 51 52 // deleting the Animation List AND all the elements of the List … … 61 62 62 63 when adding a Animation the Animation will too be deleted when 63 the AnimationPlayer gets deleted. Consider not adding it, or 64 the AnimationPlayer gets deleted. Consider not adding it, or 64 65 unadding it with animation->notHandled(); 65 66 */ … … 80 81 /** 81 82 \brief empties the list AND deletes all the Animations 82 */ 83 */ 83 84 void AnimationPlayer::flush(void) 84 85 { … … 99 100 100 101 /** 101 \brief Ticks all the animations in animationList 102 \brief Ticks all the animations in animationList 102 103 \param timePassed the time passed since the last tick. 103 104 */ … … 110 111 Animation* anim = animIt->nextElement(); 111 112 while( anim != NULL) 112 113 114 115 116 117 118 119 120 113 { 114 anim->tick(timePassed); 115 if(unlikely(anim->ifDelete())) 116 { 117 this->animationList->remove(anim); 118 delete anim; 119 } 120 anim = animIt->nextElement(); 121 } 121 122 delete animIt; 122 123 } … … 150 151 { 151 152 if(anim->getBaseObject() == baseObject) 152 153 154 155 153 { 154 delete animIt; 155 return anim; 156 } 156 157 anim = animIt->nextElement(); 157 158 } -
orxonox/trunk/src/util/animation/animation_player.h
r4485 r4597 1 /*! 1 /*! 2 2 \file animation_player.h 3 3 */ … … 15 15 <b>AnimationPlayer usage:</b> \n 16 16 17 <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is 17 <b>Initialisation</b>: AnimationPlayer::getInstance() does the trick this is 18 18 usually done when initializing a world \n 19 19 <b>Adding Animations</b>: create an Animation the following Way: … … 21 21 \li set some parameters: also see the specific classes for more info 22 22 \n 23 if you do not want a specific Animation to be handled by the AnimationPlayer, you have to 23 if you do not want a specific Animation to be handled by the AnimationPlayer, you have to 24 24 unload it explicitely with animation->doNotHandle(); 25 25 \n -
orxonox/trunk/src/util/animation/t_animation.h
r3982 r4597 14 14 */ 15 15 16 /*! 16 /*! 17 17 \file t_animation.h 18 18 */ … … 80 80 */ 81 81 template<class T> 82 tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 82 tAnimation<T>::tAnimation (T* object, void (T::*funcToAnim)(float)) 83 83 { 84 84 // create a new List … … 100 100 /** 101 101 \brief standard deconstructor 102 102 103 103 deletes all the Keyframes 104 104 */ 105 105 template<class T> 106 tAnimation<T>::~tAnimation () 106 tAnimation<T>::~tAnimation () 107 107 { 108 108 // delete all the KeyFrames … … 158 158 159 159 KeyFrameF* tmpKeyFrame; 160 160 161 161 // when adding the first frame 162 162 if (this->keyFrameCount == 0) … … 170 170 // when adding the second frame 171 171 if (this->currentKeyFrame == this->nextKeyFrame) 172 172 this->nextKeyFrame = tmpKeyFrame; 173 173 this->keyFrameList->add(tmpKeyFrame); 174 174 } … … 191 191 this->localTime += dt; 192 192 if (localTime >= this->currentKeyFrame->duration) 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 this->setAnimFunc(this->currentKeyFrame->animFunc); 209 210 211 212 213 193 { 194 if (likely(this->keyFramesToPlay != 0)) 195 { 196 if (unlikely(this->keyFramesToPlay > 0)) 197 --this->keyFramesToPlay; 198 // switching to the next Key-Frame 199 this->localTime -= this->currentKeyFrame->duration; 200 201 this->currentKeyFrame = this->nextKeyFrame; 202 // checking, if we should still Play the animation 203 if (this->currentKeyFrame == this->keyFrameList->lastElement()) 204 this->handleInfinity(); 205 this->nextKeyFrame = this->keyFrameList->nextElement(this->currentKeyFrame); 206 207 printf("%p from:%f to:%f\n", this->currentKeyFrame,this->currentKeyFrame->value, this->nextKeyFrame->value); 208 this->setAnimFunc(this->currentKeyFrame->animFunc); 209 } 210 else 211 this->pause(); 212 } 213 214 214 (this->object->*(funcToAnim))((this->*animFunc)(this->localTime)); 215 215 } … … 243 243 case ANIM_NEG_EXP: 244 244 { 245 246 247 245 this->animFunc = &tAnimation<T>::negExp; 246 expFactor = - 1.0 / this->currentKeyFrame->duration * logf(DELTA_X); 247 break; 248 248 } 249 249 case ANIM_QUADRATIC: … … 273 273 */ 274 274 template<class T> 275 float tAnimation<T>::linear(float timePassed) const 275 float tAnimation<T>::linear(float timePassed) const 276 276 { 277 277 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) … … 287 287 { 288 288 if (timePassed * 2.0 < this->currentKeyFrame->duration) 289 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 289 return this->currentKeyFrame->value + (this->nextKeyFrame->value - this->currentKeyFrame->value) 290 290 * sin( M_PI * timePassed / this->currentKeyFrame->duration)/2; 291 else 291 else 292 292 return this->nextKeyFrame->value - (this->nextKeyFrame->value - this->currentKeyFrame->value) 293 293 * sin( M_PI * (1.0 - timePassed / this->currentKeyFrame->duration))/2; … … 350 350 float tAnimation<T>::random(float timePassed) const 351 351 { 352 return this->currentKeyFrame->value + 352 return this->currentKeyFrame->value + 353 353 (this->nextKeyFrame->value - this->currentKeyFrame->value) * 354 354 (float)rand()/(float)RAND_MAX; -
orxonox/trunk/src/util/garbage_collector.cc
r4592 r4597 36 36 { 37 37 this->setClassID(CL_GARBAGE_COLLECTOR, "GarbageCollector"); 38 this->setName("GarbageCollector"); 39 38 40 this->time = 0; 39 41 this->delay = 1.5f; /* clean up all 5.0 seconds */ -
orxonox/trunk/src/util/loading/factory.cc
r4492 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 21 21 22 22 /* -------------------------------------------------- 23 * 23 * Factory 24 24 * -------------------------------------------------- 25 25 */ … … 27 27 /** 28 28 \brief constructor 29 29 30 30 set everything to zero and define factoryName 31 31 */ 32 32 Factory::Factory (const char* factoryName) 33 33 { 34 this->setClassID(CL_FACTORY, "Factory"); 35 this->setName(factoryName); 36 34 37 this->factoryName = NULL; 35 38 this->setFactoryName(factoryName); 36 39 next = NULL; 37 40 38 41 initialize(); 39 42 } … … 41 44 /** 42 45 \brief destructor 43 46 44 47 clear the Q 45 48 */ -
orxonox/trunk/src/util/loading/factory.h
r4492 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 14 14 */ 15 15 16 /*! 16 /*! 17 17 \file factory.h 18 18 \brief A loadable object handler … … 27 27 #include "tinyxml.h" 28 28 #include "load_param.h" 29 #include "base_object.h" 29 30 #include "debug.h" 30 31 31 /** 32 /** 32 33 Creates a factory to a Loadable Class. 33 34 this should be used at the beginning of all the Classes that should be loadable (in the cc-file) 35 \todo make factoryName a BaseObject-parameter. (else it would be redundant) 34 36 */ 35 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##Factory = new tFactory<CLASS_NAME>(#CLASS_NAME) 37 #define CREATE_FACTORY(CLASS_NAME) tFactory<CLASS_NAME>* global_##CLASS_NAME##Factory = new tFactory<CLASS_NAME>(#CLASS_NAME) 36 38 37 39 //! The Factory is a loadable object handler 38 class Factory {40 class Factory : public BaseObject { 39 41 40 42 public: 41 43 Factory (const char* factoryName = NULL); 42 44 ~Factory (); 43 45 44 46 45 47 virtual BaseObject* fabricate(const TiXmlElement* root); … … 53 55 /** \returns the next factory */ 54 56 Factory* getNext(void) const { return this->next; }; 55 57 56 58 protected: 57 59 char* factoryName; //!< the name of the factory … … 69 71 tFactory(const char* factoryName); 70 72 virtual ~tFactory(); 71 73 72 74 private: 73 75 BaseObject* fabricate(const TiXmlElement* root); … … 83 85 PRINTF(5)("fileName: %s loadable\n", this->factoryName); 84 86 } 85 87 86 88 87 89 template<class T> … … 90 92 91 93 template<class T> 92 BaseObject* tFactory<T>::fabricate(const TiXmlElement* root) 93 { 94 BaseObject* tFactory<T>::fabricate(const TiXmlElement* root) 95 { 94 96 if(!strcmp(root->Value(), getFactoryName())) 95 97 return new T ( root); 96 else if( getNext() != NULL) 98 else if( getNext() != NULL) 97 99 return getNext()->fabricate( root); 98 else 100 else 99 101 return NULL; 100 102 } -
orxonox/trunk/src/util/loading/game_loader.cc
r4511 r4597 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 39 39 \brief simple constructor 40 40 */ 41 GameLoader::GameLoader () 42 { 41 GameLoader::GameLoader () 42 { 43 this->setClassID(CL_GAME_LOADER, "GameLoader"); 44 this->setName("GameLoader"); 43 45 first = NULL; 44 46 } … … 110 112 switch(campaignID) 111 113 { 112 /* 113 114 115 116 114 /* 115 Debug Level 0: Debug level used to test the base frame work. 116 As you can see, all storyentity data is allocated before game 117 start. the storyentity will load themselfs shortly before start 118 through the StoryEntity::init() funtion. 117 119 */ 118 120 case DEBUG_CAMPAIGN_0: 119 121 { 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 122 Campaign* debugCampaign = new Campaign(); 123 124 World* world0 = new World(DEBUG_WORLD_0); 125 world0->setNextStoryID(WORLD_ID_1); 126 debugCampaign->addEntity(world0, WORLD_ID_0); 127 128 World* world1 = new World(DEBUG_WORLD_1); 129 world1->setNextStoryID(WORLD_ID_2); 130 debugCampaign->addEntity(world1, WORLD_ID_1); 131 132 World* world2 = new World(DEBUG_WORLD_2); 133 world2->setNextStoryID(WORLD_ID_GAMEEND); 134 debugCampaign->addEntity(world2, WORLD_ID_2); 135 136 this->currentCampaign = debugCampaign; 137 break; 136 138 } 137 139 } … … 139 141 140 142 141 /** 143 /** 142 144 \brief starts the current entity 143 \returns error code if this action has caused a error 145 \returns error code if this action has caused a error 144 146 */ 145 147 ErrorMessage GameLoader::start() … … 150 152 151 153 152 /** 154 /** 153 155 \brief stops the current entity 154 156 \returns error code if this action has caused a error … … 168 170 169 171 170 /** 172 /** 171 173 \brief pause the current entity 172 174 \returns error code if this action has caused a error … … 182 184 183 185 184 /** 186 /** 185 187 \brief resumes a pause 186 188 \returns error code if this action has caused a error … … 218 220 can load everything it needs into memory then. 219 221 */ 220 222 221 223 if( fileName == NULL) 222 224 { … … 224 226 return NULL; 225 227 } 226 228 227 229 TiXmlDocument* XMLDoc = new TiXmlDocument( fileName); 228 230 // load the campaign document … … 234 236 return NULL; 235 237 } 236 238 237 239 // check basic validity 238 240 TiXmlElement* root = XMLDoc->RootElement(); 239 241 assert( root != NULL); 240 242 241 243 if( strcmp( root->Value(), "Campaign")) 242 244 { … … 246 248 return NULL; 247 249 } 248 250 249 251 // construct campaign 250 252 Campaign* c = new Campaign( root); 251 253 252 254 // free the XML data 253 255 delete XMLDoc; … … 258 260 259 261 /** 260 \brief handle keyboard commands 262 \brief handle keyboard commands 261 263 \param event the event to handle 262 264 */ … … 265 267 if( event.type == KeyMapper::PEV_NEXT_WORLD) 266 268 { 267 if( likely(event.bPressed)) 268 269 270 269 if( likely(event.bPressed)) 270 { 271 this->nextLevel(); 272 } 271 273 } 272 274 else if( event.type == KeyMapper::PEV_PREVIOUS_WORLD) 273 275 { 274 276 if( likely(event.bPressed)) 275 276 277 277 { 278 this->previousLevel(); 279 } 278 280 } 279 281 else if( event.type == KeyMapper::PEV_PAUSE) 280 282 { 281 283 if( likely(event.bPressed)) 282 283 284 285 286 287 284 { 285 if(this->isPaused) 286 this->resume(); 287 else 288 this->pause(); 289 } 288 290 } 289 291 else if( event.type == KeyMapper::PEV_QUIT) … … 322 324 void GameLoader::registerFactory( Factory* factory) 323 325 { 324 325 326 327 328 329 326 assert( factory != NULL); 327 328 PRINTF(4)("Registered factory for '%s'\n", factory->getFactoryName()); 329 330 if( first == NULL) first = factory; 331 else first->registerFactory( factory); 330 332 } 331 333 … … 338 340 { 339 341 assert( element != NULL); 340 342 341 343 if( first == NULL) 342 344 { … … 344 346 return NULL; 345 347 } 346 348 347 349 if( element->Value() != NULL) 348 350 { 349 351 PRINTF(4)("Attempting fabrication of a '%s'\n", element->Value()); 350 352 BaseObject* b = first->fabricate( element); 351 if( b == NULL) 352 353 else 354 353 if( b == NULL) 354 PRINTF(2)("Failed to fabricate a '%s'\n", element->Value()); 355 else 356 PRINTF(4)("Successfully fabricated a '%s'\n", element->Value()); 355 357 return b; 356 358 } 357 359 358 360 PRINTF(2)("Fabricate failed, TiXmlElement did not contain a value\n"); 359 361 360 362 return NULL; 361 363 } -
orxonox/trunk/src/util/loading/load_param.cc
r4501 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 30 30 */ 31 31 BaseLoadParam::BaseLoadParam(const TiXmlElement* root, BaseObject* object, const char* paramName, 32 int paramCount, bool multi, ...) 33 { 32 int paramCount, bool multi, ...) 33 { 34 this->setClassID(CL_LOAD_PARAM, "LoadParam"); 34 35 this->loadString = NULL; 35 36 … … 39 40 { 40 41 if (likely(!multi)) 41 42 this->loadString = grabParameter(root, paramName); 42 43 else 43 44 45 46 47 48 49 50 44 { 45 if (!strcmp(root->Value(), paramName)) 46 { 47 const TiXmlNode* val = root->FirstChild(); 48 if( val->ToText()) 49 this->loadString = val->Value(); 50 } 51 } 51 52 } 52 53 … … 64 65 va_start (types, multi); 65 66 for(int i = 0; i < paramCount; i++) 66 67 68 69 70 67 { 68 const char* tmpTypeName = va_arg (types, const char*); 69 this->paramDesc->types[i] = new char[strlen(tmpTypeName)+1]; 70 strcpy(this->paramDesc->types[i], tmpTypeName); 71 } 71 72 va_end(types); 72 73 … … 131 132 { 132 133 if (i > 0) 133 134 PRINT(3)(","); 134 135 PRINT(3)("%s", this->types[i]); 135 136 } … … 194 195 { 195 196 if (!strcmp(enumClassDesc->className, className)) 196 197 198 199 197 { 198 delete iterator; 199 return enumClassDesc; 200 } 200 201 enumClassDesc = iterator->nextElement(); 201 202 } … … 216 217 { 217 218 if (!strcmp(enumParamDesc->paramName, paramName)) 218 219 220 221 219 { 220 delete iterator; 221 return enumParamDesc; 222 } 222 223 enumParamDesc = iterator->nextElement(); 223 224 } … … 243 244 LoadParamDescription* enumParamDesc = paramIT->nextElement(); 244 245 while (enumParamDesc) 245 246 247 248 246 { 247 enumParamDesc->print(); 248 enumParamDesc = paramIT->nextElement(); 249 } 249 250 delete paramIT; 250 251 … … 267 268 const TiXmlElement* element; 268 269 const TiXmlNode* node; 269 270 270 271 if (root == NULL) 271 272 return NULL; 272 273 assert( parameterName != NULL); 273 274 274 275 element = root->FirstChildElement( parameterName); 275 276 if( element == NULL) return NULL; 276 277 277 278 node = element->FirstChild(); 278 279 while( node != NULL) -
orxonox/trunk/src/util/loading/load_param.h
r4592 r4597 22 22 #define _LOAD_PARAM_H 23 23 24 #include "base_object.h" 24 25 #include "factory.h" 25 26 #include "debug.h" … … 228 229 229 230 //! abstract Base class for a Loadable parameter 230 class BaseLoadParam 231 class BaseLoadParam : public BaseObject 231 232 { 232 233 public: -
orxonox/trunk/src/util/object_manager.cc
r4592 r4597 29 29 { 30 30 this->setClassID(CL_OBJECT_MANAGER, "ObjectManager"); 31 this->setName("ObjectManager"); 31 32 32 33 this->managedObjectList = new tList<BaseObject>*[CL_NUMBER]; -
orxonox/trunk/src/util/resource_manager.cc
r4534 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 47 47 \brief standard constructor 48 48 */ 49 ResourceManager::ResourceManager () 50 { 51 this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager"); 52 this->dataDir = NULL; 53 this->setDataDir("./"); 54 this->imageDirs = new tList<char>(); 55 this->resourceList = new tList<Resource>(); 49 ResourceManager::ResourceManager () 50 { 51 this->setClassID(CL_RESOURCE_MANAGER, "ResourceManager"); 52 this->setName("ResourceManager"); 53 54 this->dataDir = NULL; 55 this->setDataDir("./"); 56 this->imageDirs = new tList<char>(); 57 this->resourceList = new tList<Resource>(); 56 58 } 57 59 … … 62 64 \brief standard destructor 63 65 */ 64 ResourceManager::~ResourceManager (void) 66 ResourceManager::~ResourceManager (void) 65 67 { 66 68 // deleting the Resources-List … … 106 108 107 109 /** 108 \brief checks for the DataDirectory, by looking if 110 \brief checks for the DataDirectory, by looking if 109 111 \param fileInside is inisde?? 110 112 */ … … 117 119 return false; 118 120 } 119 121 120 122 char* testFile = new char[strlen(this->dataDir)+strlen(fileInside)+1]; 121 123 sprintf(testFile, "%s%s", this->dataDir, fileInside); … … 141 143 char* tmpDir = tmpImageDirs->nextElement(); 142 144 while(tmpDir) 143 144 145 146 147 148 149 150 151 145 { 146 if (!strcmp(tmpDir, imageDir)) 147 { 148 PRINTF(4)("Path %s already loaded\n", imageDir); 149 delete tmpImageDirs; 150 return true; 151 } 152 tmpDir = tmpImageDirs->nextElement(); 153 } 152 154 delete tmpImageDirs; 153 155 … … 185 187 else if (!strcmp(fileName, "cube") || 186 188 !strcmp(fileName, "sphere") || 187 189 !strcmp(fileName, "plane") || 188 190 !strcmp(fileName, "cylinder") || 189 191 !strcmp(fileName, "cone")) … … 203 205 #endif /* NO_TEXT */ 204 206 #ifndef NO_TEXTURES 205 else 207 else 206 208 tmpType = IMAGE; 207 209 #endif /* NO_TEXTURES */ … … 221 223 */ 222 224 void* ResourceManager::load(const char* fileName, ResourceType type, ResourcePriority prio, 223 225 void* param1, void* param2, void* param3) 224 226 { 225 227 // searching if the resource was loaded before. … … 230 232 tmpResource->count++; 231 233 if(tmpResource->prio < prio) 232 234 tmpResource->prio = prio; 233 235 } 234 236 else … … 248 250 // Checking for the type of resource \see ResourceType 249 251 switch(type) 250 252 { 251 253 #ifndef NO_MODEL 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 254 case OBJ: 255 if (param1) 256 tmpResource->modelSize = *(float*)param1; 257 else 258 tmpResource->modelSize = 1.0; 259 260 if(ResourceManager::isFile(fullName)) 261 tmpResource->pointer = new OBJModel(fullName, tmpResource->modelSize); 262 else 263 { 264 PRINTF(2)("Sorry, %s does not exist. Loading a cube-Model instead\n", fullName); 265 tmpResource->pointer = ResourceManager::load("cube", PRIM, prio, &tmpResource->modelSize); 266 } 267 break; 268 case PRIM: 269 if (param1) 270 tmpResource->modelSize = *(float*)param1; 271 else 272 tmpResource->modelSize = 1.0; 273 274 if (!strcmp(tmpResource->name, "cube")) 275 tmpResource->pointer = new PrimitiveModel(PRIM_CUBE, tmpResource->modelSize); 276 else if (!strcmp(tmpResource->name, "sphere")) 277 tmpResource->pointer = new PrimitiveModel(PRIM_SPHERE, tmpResource->modelSize); 278 else if (!strcmp(tmpResource->name, "plane")) 279 tmpResource->pointer = new PrimitiveModel(PRIM_PLANE, tmpResource->modelSize); 280 else if (!strcmp(tmpResource->name, "cylinder")) 281 tmpResource->pointer = new PrimitiveModel(PRIM_CYLINDER, tmpResource->modelSize); 282 else if (!strcmp(tmpResource->name, "cone")) 283 tmpResource->pointer = new PrimitiveModel(PRIM_CONE, tmpResource->modelSize); 284 break; 285 case MD2: 286 if(ResourceManager::isFile(fullName)) 287 { 288 if (param1) 289 { 290 tmpResource->skinFileName = new char[strlen((const char*)param1)+1]; 291 strcpy(tmpResource->skinFileName, (const char*) param1); 292 } 293 else 294 tmpResource->skinFileName = NULL; 295 tmpResource->pointer = new MD2Data(fullName, tmpResource->skinFileName); 296 } 297 break; 296 298 #endif /* NO_MODEL */ 297 299 #ifndef NO_TEXT 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 300 case TTF: 301 if (param1) 302 tmpResource->ttfSize = *(int*)param1; 303 else 304 tmpResource->ttfSize = FONT_DEFAULT_SIZE; 305 if (param2) 306 { 307 Vector* tmpVec = (Vector*)param2; 308 tmpResource->ttfColorR = (int)tmpVec->x; 309 tmpResource->ttfColorG = (int)tmpVec->y; 310 tmpResource->ttfColorB = (int)tmpVec->z; 311 } 312 else 313 { 314 tmpResource->ttfColorR = FONT_DEFAULT_COLOR_R; 315 tmpResource->ttfColorG = FONT_DEFAULT_COLOR_G; 316 tmpResource->ttfColorB = FONT_DEFAULT_COLOR_B; 317 } 318 319 if(isFile(fullName)) 320 tmpResource->pointer = new Font(fullName, 321 tmpResource->ttfSize, 322 tmpResource->ttfColorR, 323 tmpResource->ttfColorG, 324 tmpResource->ttfColorB); 325 else 326 PRINTF(2)("Sorry, %s does not exist. Not loading Font\n", fullName); 327 break; 326 328 #endif /* NO_TEXT */ 327 329 #ifndef NO_AUDIO 328 329 330 331 330 case WAV: 331 if(isFile(fullName)) 332 tmpResource->pointer = new SoundBuffer(fullName); 333 break; 332 334 #endif /* NO_AUDIO */ 333 335 #ifndef NO_TEXTURES 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 336 case IMAGE: 337 if(isFile(fullName)) 338 { 339 PRINTF(4)("Image %s resides to %s\n", fileName, fullName); 340 tmpResource->pointer = new Texture(fullName); 341 } 342 else 343 { 344 tIterator<char>* iterator = imageDirs->getIterator(); 345 tmpDir = iterator->nextElement(); 346 //tmpDir = imageDirs->enumerate(); 347 while(tmpDir) 348 { 349 char* imgName = new char[strlen(tmpDir)+strlen(fileName)+1]; 350 sprintf(imgName, "%s%s", tmpDir, fileName); 351 if(isFile(imgName)) 352 { 353 PRINTF(4)("Image %s resides to %s\n", fileName, imgName); 354 tmpResource->pointer = new Texture(imgName); 355 delete []imgName; 356 break; 357 } 358 delete []imgName; 359 tmpDir = iterator->nextElement(); 360 } 361 delete iterator; 362 } 363 if(!tmpResource) 364 PRINTF(2)("!!Image %s not Found!!\n", fileName); 365 break; 364 366 #endif /* NO_TEXTURES */ 365 366 367 368 369 367 default: 368 tmpResource->pointer = NULL; 369 PRINTF(1)("No type found for %s.\n !!This should not happen unless the Type is not supported yet.!!\n", tmpResource->name); 370 break; 371 } 370 372 if (tmpResource->pointer) 371 373 this->resourceList->add(tmpResource); 372 374 delete []fullName; 373 375 } 374 376 if (tmpResource->pointer) 375 377 return tmpResource->pointer; 376 else 378 else 377 379 { 378 380 PRINTF(2)("Resource %s could not be loaded\n", fileName); … … 413 415 { 414 416 if (resource->count <= 0) 415 416 417 418 417 { 418 // deleting the Resource 419 switch(resource->type) 420 { 419 421 #ifndef NO_MODEL 420 421 422 423 424 425 426 422 case OBJ: 423 case PRIM: 424 delete (Model*)resource->pointer; 425 break; 426 case MD2: 427 delete (MD2Data*)resource->pointer; 428 break; 427 429 #endif /* NO_MODEL */ 428 430 #ifndef NO_AUDIO 429 430 431 431 case WAV: 432 delete (SoundBuffer*)resource->pointer; 433 break; 432 434 #endif /* NO_AUDIO */ 433 435 #ifndef NO_TEXT 434 435 436 436 case TTF: 437 delete (Font*)resource->pointer; 438 break; 437 439 #endif /* NO_TEXT */ 438 440 #ifndef NO_TEXTURES 439 440 441 441 case IMAGE: 442 delete (Texture*)resource->pointer; 443 break; 442 444 #endif /* NO_TEXTURES */ 443 444 445 446 447 448 449 450 451 452 445 default: 446 PRINTF(1)("NOT YET IMPLEMENTED !!FIX FIX!!\n"); 447 return false; 448 break; 449 } 450 // deleting the List Entry: 451 PRINTF(4)("Resource %s safely removed.\n", resource->name); 452 delete []resource->name; 453 this->resourceList->remove(resource); 454 } 453 455 else 454 456 PRINTF(4)("Resource %s not removed, because there are still %d References to it.\n", resource->name, resource->count); 455 457 } 456 458 else … … 471 473 { 472 474 if (enumRes->prio <= prio) 473 474 475 476 477 475 if (enumRes->count == 0) 476 unload(enumRes, prio); 477 else 478 PRINTF(2)("unable to unload %s because there are still %d references to it\n", 479 enumRes->name, enumRes->count); 478 480 //enumRes = resourceList->nextElement(); 479 481 enumRes = iterator->nextElement(); … … 492 494 */ 493 495 Resource* ResourceManager::locateResourceByInfo(const char* fileName, ResourceType type, 494 496 void* param1, void* param2, void* param3) 495 497 { 496 498 // Resource* enumRes = resourceList->enumerate(); … … 500 502 { 501 503 if (enumRes->type == type && !strcmp(fileName, enumRes->name)) 502 503 504 505 506 507 504 { 505 bool match = false; 506 bool subMatch = false; 507 508 switch (type) 509 { 508 510 #ifndef NO_MODEL 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 511 case PRIM: 512 case OBJ: 513 if (!param1) 514 { 515 if (enumRes->modelSize == 1.0) 516 match = true; 517 } 518 else if (enumRes->modelSize == *(float*)param1) 519 match = true; 520 break; 521 case MD2: 522 if (!param1) 523 { 524 if (enumRes->skinFileName == NULL) 525 match = true; 526 } 527 else if (!strcmp(enumRes->skinFileName, (const char*) param1)) 528 match = true; 529 break; 528 530 #endif /* NO_MODEL */ 529 531 #ifndef NO_TEXT 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 532 case TTF: 533 if (!param1) 534 { 535 if (enumRes->ttfSize == FONT_DEFAULT_SIZE) 536 subMatch = true; 537 } 538 else if (enumRes->modelSize =- *(int*)param1) 539 subMatch = true; 540 if(subMatch) 541 { 542 Vector* tmpVec = (Vector*)param2; 543 if (!param2) 544 { 545 if(enumRes->ttfColorR == FONT_DEFAULT_COLOR_R && 546 enumRes->ttfColorG == FONT_DEFAULT_COLOR_G && 547 enumRes->ttfColorB == FONT_DEFAULT_COLOR_B ) 548 match = true; 549 } 550 else if (enumRes->ttfColorR == (int)tmpVec->x && 551 enumRes->ttfColorG == (int)tmpVec->y && 552 enumRes->ttfColorB == (int)tmpVec->z ) 553 match = true; 554 } 555 break; 554 556 #endif /* NO_TEXT */ 555 556 557 558 559 560 561 562 563 564 557 default: 558 match = true; 559 break; 560 } 561 if (match) 562 { 563 delete iterator; 564 return enumRes; 565 } 566 } 565 567 enumRes = iterator->nextElement(); 566 568 } … … 582 584 { 583 585 if (pointer == enumRes->pointer) 584 585 586 587 586 { 587 delete iterator; 588 return enumRes; 589 } 588 590 enumRes = iterator->nextElement(); 589 591 } … … 622 624 if (status.st_mode & (S_IFDIR 623 625 #ifndef __WIN32__ 624 626 | S_IFLNK 625 627 #endif 626 627 628 629 630 628 )) 629 { 630 delete tmpDirName; 631 return true; 632 } 631 633 else 632 633 634 635 634 { 635 delete tmpDirName; 636 return false; 637 } 636 638 } 637 639 else … … 653 655 if (!stat(tmpFileName, &status)) 654 656 { 655 if (status.st_mode & (S_IFREG 657 if (status.st_mode & (S_IFREG 656 658 #ifndef __WIN32__ 657 659 | S_IFLNK 658 660 #endif 659 660 661 662 663 661 )) 662 { 663 delete tmpFileName; 664 return true; 665 } 664 666 else 665 666 667 668 669 } 670 else 667 { 668 delete tmpFileName; 669 return false; 670 } 671 } 672 else 671 673 { 672 674 delete tmpFileName; … … 691 693 } 692 694 fclose(stream); 693 694 delete tmpName; 695 696 delete tmpName; 695 697 } 696 698 … … 708 710 } 709 711 710 /** 712 /** 711 713 \param name the Name of the file to check 712 714 \returns The name of the file, including the HomeDir … … 737 739 } 738 740 739 /** 741 /** 740 742 \param fileName the Name of the File to check 741 743 \returns The full name of the file, including the DataDir, and NULL if the file does not exist … … 748 750 749 751 char* retName = new char[strlen(ResourceManager::getInstance()->getDataDir()) 750 752 + strlen(fileName) + 1]; 751 753 sprintf(retName, "%s%s", ResourceManager::getInstance()->getDataDir(), fileName); 752 754 if (ResourceManager::isFile(retName) || ResourceManager::isDir(retName)) … … 790 792 PRINT(0)("Name: %s; References: %d; Type:", enumRes->name, enumRes->count); 791 793 switch (enumRes->type) 792 793 794 795 796 797 798 799 800 801 802 803 804 805 794 { 795 case OBJ: 796 PRINT(0)("ObjectModel\n"); 797 break; 798 case PRIM: 799 PRINT(0)("PrimitiveModel\n"); 800 break; 801 case IMAGE: 802 PRINT(0)("ImageFile (Texture)\n"); 803 break; 804 default: 805 PRINT(0)("SoundFile\n"); 806 break; 807 } 806 808 PRINT(0)("gets deleted at "); 807 809 switch(enumRes->prio) 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 810 { 811 default: 812 case RP_NO: 813 PRINT(0)("first posibility (0)\n"); 814 break; 815 case RP_LEVEL: 816 PRINT(0)("the end of the Level (1)\n"); 817 break; 818 case RP_CAMPAIGN: 819 PRINT(0)("the end of the campaign (2)\n"); 820 break; 821 case RP_GAME: 822 PRINT(0)("when leaving the game (3)\n"); 823 break; 824 } 823 825 enumRes = iterator->nextElement(); 824 826 } -
orxonox/trunk/src/util/resource_manager.h
r4534 r4597 1 /*! 1 /*! 2 2 \file resource_manager.h 3 3 \brief The Resource Manager checks if a file/resource is loaded. 4 4 5 If a file/resource was already loaded the resourceManager will 5 If a file/resource was already loaded the resourceManager will 6 6 return a void pointer to the desired resource. 7 7 Otherwise it will instruct the coresponding resource-loader to load, … … 9 9 10 10 it is possible to compile the resource Manager without some modules by 11 just adding the compile flag -D.... 11 just adding the compile flag -D.... 12 12 (NO_MODEL) 13 13 (NO_AUDIO) … … 23 23 #include "stdlibincl.h" 24 24 25 // FORWARD DEFINITION 25 // FORWARD DEFINITION 26 26 template<class T> class tList; 27 27 28 28 //! An eumerator for different fileTypes the resourceManager supports 29 typedef enum ResourceType { 29 typedef enum ResourceType 30 { 30 31 #ifndef NO_MODEL 31 32 OBJ, //!< loading .obj file … … 46 47 }; 47 48 48 //! An enumerator for different UNLOAD-types. 49 //! An enumerator for different UNLOAD-types. 49 50 /** 50 51 RP_NO: will be unloaded on request … … 53 54 RP_GAME: will be unloaded at the end of the whole Game (when closing orxonox) 54 55 */ 55 typedef enum ResourcePriority { RP_NO = 0, 56 RP_LEVEL = 1, 57 RP_CAMPAIGN = 2, 58 RP_GAME = 4 }; 56 typedef enum ResourcePriority 57 { 58 RP_NO = 0, 59 RP_LEVEL = 1, 60 RP_CAMPAIGN = 2, 61 RP_GAME = 4 62 }; 59 63 60 64 //! A Struct that keeps track about A resource its name its Type, and so on … … 63 67 void* pointer; //!< Pointer to the Resource. 64 68 int count; //!< How many times this Resource has been loaded. 65 69 66 70 char* name; //!< Name of the Resource. 67 71 ResourceType type; //!< ResourceType of this Resource. … … 84 88 //! The ResourceManager is a class, that decides if a file/resource should be loaded 85 89 /** 86 If a file/resource was already loaded the resourceManager will 90 If a file/resource was already loaded the resourceManager will 87 91 return a void pointer to the desired resource. 88 92 Otherwise it will instruct the corresponding resource-loader to load, … … 91 95 It does it by looking, if a desired file has already been loaded. 92 96 */ 93 class ResourceManager : public BaseObject 97 class ResourceManager : public BaseObject 94 98 { 95 99 public: … … 105 109 bool addImageDir(const char* imageDir); 106 110 void* load(const char* fileName, ResourcePriority prio = RP_NO, 107 111 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 108 112 void* load(const char* fileName, ResourceType type, ResourcePriority prio = RP_NO, 109 113 void* param1 = NULL, void* param2 = NULL, void* param3 = NULL); 110 114 bool unload(void* pointer, ResourcePriority prio = RP_NO); 111 115 bool unload(Resource* resource, ResourcePriority = RP_NO); 112 116 bool unloadAllByPriority(ResourcePriority prio); 113 117 114 118 void debug(void); 115 119 116 120 117 121 // utility functions of this class … … 127 131 128 132 Resource* locateResourceByInfo(const char* fileName, ResourceType type, void* param1, void* param2, void* param3); 129 Resource* locateResourceByPointer(const void* pointer); 133 Resource* locateResourceByPointer(const void* pointer); 130 134 131 135 private: -
orxonox/trunk/src/util/state.cc
r4485 r4597 1 /* 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 … … 28 28 \brief standard constructor 29 29 */ 30 State::State () 30 State::State () 31 31 { 32 this->setClassName ("State"); 32 this->setClassID(CL_STATE, "State"); 33 this->setName("State"); 33 34 34 35 this->camera = NULL; … … 44 45 \brief standard deconstructor 45 46 */ 46 State::~State () 47 State::~State () 47 48 { 48 49 State::singletonRef = NULL; -
orxonox/trunk/src/util/state.h
r4485 r4597 1 /*! 1 /*! 2 2 \file state.h 3 3 \brief Definition of the States-singleton Class -
orxonox/trunk/src/util/track/pilot_node.cc
r4456 r4597 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 28 28 \brief standard constructor 29 29 */ 30 PilotNode::PilotNode () 30 PilotNode::PilotNode () 31 31 { 32 32 this->setClassID(CL_PILOT_PARENT, "PilotNode"); 33 this->setName("PilotNode"); 33 34 34 35 travelSpeed = 30.0; … … 40 41 \brief standard deconstructor 41 42 */ 42 PilotNode::~PilotNode () 43 PilotNode::~PilotNode () 43 44 { 44 45 45 46 } 46 47 47 /** 48 /** 48 49 \brief ticks the node 49 \param time the time about whitch to tick 50 \param time the time about whitch to tick \ 50 51 */ 51 52 void PilotNode::tick(float time) … … 73 74 direction = q.apply(direction); 74 75 75 76 76 77 77 78 Vector orthDirection(0,0,1); 78 79 orthDirection = q.apply(orthDirection); 79 80 80 81 if( this->bUp) 81 82 accel = accel+(direction*acceleration); … … 83 84 accel = accel -(direction*acceleration); 84 85 if( this->bLeft) 85 accel = accel - (orthDirection*acceleration); 86 accel = accel - (orthDirection*acceleration); 86 87 if( this->bRight) 87 88 accel = accel + (orthDirection*acceleration); 88 89 89 90 Vector move = accel * time; 90 91 this->shiftCoor (move); 91 92 92 93 Quaternion q1(-M_PI/4 * this->roll/40000.0, Vector(0,0,1)); 93 94 Quaternion q2(-M_PI/4 * this->pitch/30000.0, Vector(0,1,0)); -
orxonox/trunk/src/util/track/pilot_node.h
r4456 r4597 1 /*! 1 /*! 2 2 \file pilot_node.h 3 3 \brief Definition of a PilotNode -
orxonox/trunk/src/util/track/track_manager.cc
r4584 r4597 40 40 TrackElement::TrackElement(void) 41 41 { 42 this->setClassID(CL_TRACK_ELEMENT, "TrackElement"); 43 42 44 this->isFresh = true; 43 45 this->isHotPoint = false; … … 358 360 { 359 361 this->setClassID(CL_TRACK_MANAGER, "TrackManager"); 362 this->setName("TrackManager"); 360 363 361 364 TrackManager::singletonRef = this; // do this because otherwise the TrackNode cannot get The instance of the TrackManager -
orxonox/trunk/src/util/track/track_node.cc
r4489 r4597 1 1 2 2 3 /* 3 /* 4 4 orxonox - the future of 3D-vertical-scrollers 5 5 … … 28 28 \brief standard constructor 29 29 */ 30 TrackNode::TrackNode () 30 TrackNode::TrackNode () 31 31 { 32 32 this->setClassID(CL_TRACK_NODE, "TrackNode"); 33 this->setName("TrackNode"); /* absolete but still used... */33 this->setName("TrackNode"); 34 34 35 35 NullParent::getInstance()->addChild(this); … … 38 38 } 39 39 40 41 40 /** 42 41 \brief standard deconstructor 43 42 */ 44 TrackNode::~TrackNode () 43 TrackNode::~TrackNode () 45 44 { 46 45
Note: See TracChangeset
for help on using the changeset viewer.