Changeset 2406 for code/branches/objecthierarchy2/src/orxonox/tools
- Timestamp:
- Dec 11, 2008, 3:06:33 AM (16 years ago)
- Location:
- code/branches/objecthierarchy2/src/orxonox/tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy2/src/orxonox/tools/ParticleInterface.cc
r2171 r2406 52 52 ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel) 53 53 { 54 Register RootObject(ParticleInterface);54 RegisterObject(ParticleInterface); 55 55 56 56 assert(scenemanager); … … 69 69 { 70 70 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 71 this->particleSystem_->setSpeedFactor(1.0f); 72 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 71 this->setSpeedFactor(1.0f); 73 72 } 74 73 catch (...) … … 224 223 void ParticleInterface::setSpeedFactor(float factor) 225 224 { 226 if (this->particleSystem_) 227 { 228 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 229 this->particleSystem_->setSpeedFactor(1.0f * factor); 230 } 231 } 232 float ParticleInterface::getSpeedFactor() const 233 { 234 if (this->particleSystem_) 235 { 236 // return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 237 return (this->particleSystem_->getSpeedFactor() / 1.0f); 238 } 239 else 240 return 1.0f; 225 this->speedFactor_ = factor; 226 227 if (this->particleSystem_) 228 this->particleSystem_->setSpeedFactor(factor * this->getTimeFactor()); 229 } 230 void ParticleInterface::changedTimeFactor(float factor_new, float factor_old) 231 { 232 this->setSpeedFactor(this->speedFactor_); 241 233 } 242 234 -
code/branches/objecthierarchy2/src/orxonox/tools/ParticleInterface.h
r2087 r2406 37 37 #include "core/OrxonoxClass.h" 38 38 #include "util/Math.h" 39 #include "gamestates/GSRoot.h" 39 40 40 41 #define getAllEmitters() \ … … 45 46 namespace orxonox 46 47 { 47 class _OrxonoxExport ParticleInterface : public OrxonoxClass48 class _OrxonoxExport ParticleInterface : public TimeFactorListener 48 49 { 49 50 public: … … 69 70 unsigned int getNumAffectors() const; 70 71 71 float getSpeedFactor() const; 72 inline float getSpeedFactor() const 73 { return this->speedFactor_; } 72 74 void setSpeedFactor(float factor); 73 75 bool getKeepParticlesInLocalSpace() const; … … 90 92 { return ParticleInterface::currentParticleInterface_s; } 91 93 94 protected: 95 virtual void changedTimeFactor(float factor_new, float factor_old); 96 92 97 private: 93 98 void updateVisibility(); … … 102 107 bool bAllowedByLOD_; 103 108 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 109 float speedFactor_; 104 110 Ogre::SceneManager* scenemanager_; 105 111 }; -
code/branches/objecthierarchy2/src/orxonox/tools/Timer.cc
r2087 r2406 96 96 this->time_ = 0; 97 97 98 Register RootObject(TimerBase);98 RegisterObject(TimerBase); 99 99 } 100 100 … … 137 137 { 138 138 // If active: Decrease the timer by the duration of the last frame 139 this->time_ -= time.getDeltaTimeMicroseconds();139 this->time_ -= (long long)(time.getDeltaTimeMicroseconds() * this->getTimeFactor()); 140 140 141 141 if (this->time_ <= 0) -
code/branches/objecthierarchy2/src/orxonox/tools/Timer.h
r2171 r2406 63 63 #include "OrxonoxPrereqs.h" 64 64 #include "core/OrxonoxClass.h" 65 #include "gamestates/GSRoot.h" 65 66 66 67 namespace orxonox … … 72 73 73 74 //! TimerBase is the parent of the Timer class. 74 class _OrxonoxExport TimerBase : public OrxonoxClass75 class _OrxonoxExport TimerBase : public TimeFactorListener 75 76 { 76 77 public:
Note: See TracChangeset
for help on using the changeset viewer.