Changeset 1563 for code/trunk/src/orxonox/tools/ParticleInterface.cc
- Timestamp:
- Jun 7, 2008, 11:40:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/tools/ParticleInterface.cc
r1555 r1563 40 40 #include "GraphicsEngine.h" 41 41 #include "Orxonox.h" 42 #include "core/CoreIncludes.h" 42 43 #include "util/Convert.h" 43 44 … … 47 48 ParticleInterface* ParticleInterface::currentParticleInterface_s = 0; 48 49 49 ParticleInterface::ParticleInterface(const std::string& templateName )50 ParticleInterface::ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel) 50 51 { 52 RegisterRootObject(ParticleInterface); 53 51 54 this->sceneNode_ = 0; 55 this->bEnabled_ = true; 56 this->detaillevel_ = (unsigned int)detaillevel; 52 57 this->particleSystem_ = GraphicsEngine::getSingleton().getSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 53 58 this->particleSystem_->setSpeedFactor(Orxonox::getSingleton()->getTimeFactor()); 59 60 if (GraphicsEngine::getSingleton().getDetailLevelParticle() < (unsigned int)this->detaillevel_) 61 { 62 this->bVisible_ = false; 63 this->updateVisibility(); 64 } 65 else 66 { 67 this->bVisible_ = true; 68 } 54 69 } 55 70 … … 134 149 void ParticleInterface::setEnabled(bool enable) 135 150 { 151 this->bEnabled_ = enable; 152 this->updateVisibility(); 153 } 154 155 void ParticleInterface::detailLevelChanged(unsigned int newlevel) 156 { 157 if (newlevel >= (unsigned int)this->detaillevel_) 158 this->bVisible_ = true; 159 else 160 this->bVisible_ = false; 161 162 this->updateVisibility(); 163 } 164 165 void ParticleInterface::updateVisibility() 166 { 136 167 for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++) 137 this->particleSystem_->getEmitter(i)->setEnabled( enable);168 this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bVisible_); 138 169 } 139 170 … … 144 175 float ParticleInterface::getSpeedFactor() const 145 176 { 146 return this->particleSystem_->getSpeedFactor();177 return (this->particleSystem_->getSpeedFactor() / Orxonox::getSingleton()->getTimeFactor()); 147 178 } 148 179
Note: See TracChangeset
for help on using the changeset viewer.