Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 7, 2008, 11:40:50 PM (16 years ago)
Author:
landauf
Message:
  • added configurable detaillevel for particle effects to [GraphicsEngine]
  • thrusters work properly with changing gamespeed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/tools/ParticleInterface.cc

    r1555 r1563  
    4040#include "GraphicsEngine.h"
    4141#include "Orxonox.h"
     42#include "core/CoreIncludes.h"
    4243#include "util/Convert.h"
    4344
     
    4748  ParticleInterface* ParticleInterface::currentParticleInterface_s = 0;
    4849
    49   ParticleInterface::ParticleInterface(const std::string& templateName)
     50  ParticleInterface::ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel)
    5051  {
     52    RegisterRootObject(ParticleInterface);
     53
    5154    this->sceneNode_ = 0;
     55    this->bEnabled_ = true;
     56    this->detaillevel_ = (unsigned int)detaillevel;
    5257    this->particleSystem_ = GraphicsEngine::getSingleton().getSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName);
    5358    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    }
    5469  }
    5570
     
    134149  void ParticleInterface::setEnabled(bool enable)
    135150  {
     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  {
    136167    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_);
    138169  }
    139170
     
    144175  float ParticleInterface::getSpeedFactor() const
    145176  {
    146     return this->particleSystem_->getSpeedFactor();
     177    return (this->particleSystem_->getSpeedFactor() / Orxonox::getSingleton()->getTimeFactor());
    147178  }
    148179
Note: See TracChangeset for help on using the changeset viewer.