Changeset 2485 for code/branches/presentation/src/orxonox/tools
- Timestamp:
- Dec 16, 2008, 6:01:13 PM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
-
code/branches/presentation/src/orxonox/tools/CMakeLists.txt
r2131 r2485 3 3 Mesh.cc 4 4 ParticleInterface.cc 5 Shader.cc 5 6 TextureGenerator.cc 6 7 Timer.cc -
code/branches/presentation/src/orxonox/tools/ParticleInterface.cc
r2459 r2485 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); … … 62 62 this->bVisible_ = true; 63 63 this->bAllowedByLOD_ = true; 64 this->speedFactor_ = 1.0f; 64 65 65 66 if (Core::showsGraphics()) … … 68 69 { 69 70 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 70 this->particleSystem_->setSpeedFactor(1.0f); 71 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 71 this->setSpeedFactor(1.0f); 72 72 } 73 73 catch (...) … … 200 200 void ParticleInterface::setSpeedFactor(float factor) 201 201 { 202 if (this->particleSystem_) 203 { 204 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 205 this->particleSystem_->setSpeedFactor(1.0f * factor); 206 } 207 } 208 float ParticleInterface::getSpeedFactor() const 209 { 210 if (this->particleSystem_) 211 { 212 // return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 213 return (this->particleSystem_->getSpeedFactor() / 1.0f); 214 } 215 else 216 return 1.0f; 202 this->speedFactor_ = factor; 203 204 if (this->particleSystem_) 205 this->particleSystem_->setSpeedFactor(factor * this->getTimeFactor()); 206 } 207 void ParticleInterface::changedTimeFactor(float factor_new, float factor_old) 208 { 209 this->setSpeedFactor(this->speedFactor_); 217 210 } 218 211 -
code/branches/presentation/src/orxonox/tools/ParticleInterface.h
r2459 r2485 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: … … 66 67 unsigned int getNumAffectors() const; 67 68 68 float getSpeedFactor() const; 69 inline float getSpeedFactor() const 70 { return this->speedFactor_; } 69 71 void setSpeedFactor(float factor); 70 72 bool getKeepParticlesInLocalSpace() const; … … 87 89 { return ParticleInterface::currentParticleInterface_s; } 88 90 91 protected: 92 virtual void changedTimeFactor(float factor_new, float factor_old); 93 89 94 private: 90 95 void updateVisibility(); … … 98 103 bool bAllowedByLOD_; 99 104 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 105 float speedFactor_; 100 106 Ogre::SceneManager* scenemanager_; 101 107 }; -
code/branches/presentation/src/orxonox/tools/Timer.cc
r2087 r2485 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/presentation/src/orxonox/tools/Timer.h
r2171 r2485 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.