Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 16, 2008, 6:01:13 PM (16 years ago)
Author:
landauf
Message:

Merged objecthierarchy2 into presentation branch

Couln't merge 2 lines in Gamestate.cc and a whole block of code in GSDedicated.cc (it seems like oli implemented in both branches something like a network-tick-limiter but with different approaches)

Not yet tested in network mode and with bots
The SpaceShips movement is also not yet fully adopted to the new physics (see Engine class)

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  
    33  Mesh.cc
    44  ParticleInterface.cc
     5  Shader.cc
    56  TextureGenerator.cc
    67  Timer.cc
  • code/branches/presentation/src/orxonox/tools/ParticleInterface.cc

    r2459 r2485  
    5252    ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel)
    5353    {
    54         RegisterRootObject(ParticleInterface);
     54        RegisterObject(ParticleInterface);
    5555
    5656        assert(scenemanager);
     
    6262        this->bVisible_ = true;
    6363        this->bAllowedByLOD_ = true;
     64        this->speedFactor_ = 1.0f;
    6465
    6566        if (Core::showsGraphics())
     
    6869            {
    6970                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);
    7272            }
    7373            catch (...)
     
    200200    void ParticleInterface::setSpeedFactor(float factor)
    201201    {
    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_);
    217210    }
    218211
  • code/branches/presentation/src/orxonox/tools/ParticleInterface.h

    r2459 r2485  
    3737#include "core/OrxonoxClass.h"
    3838#include "util/Math.h"
     39#include "gamestates/GSRoot.h"
    3940
    4041#define getAllEmitters() \
     
    4546namespace orxonox
    4647{
    47     class _OrxonoxExport ParticleInterface : public OrxonoxClass
     48    class _OrxonoxExport ParticleInterface : public TimeFactorListener
    4849    {
    4950        public:
     
    6667            unsigned int getNumAffectors() const;
    6768
    68             float getSpeedFactor() const;
     69            inline float getSpeedFactor() const
     70                { return this->speedFactor_; }
    6971            void setSpeedFactor(float factor);
    7072            bool getKeepParticlesInLocalSpace() const;
     
    8789                { return ParticleInterface::currentParticleInterface_s; }
    8890
     91        protected:
     92            virtual void changedTimeFactor(float factor_new, float factor_old);
     93
    8994        private:
    9095            void updateVisibility();
     
    98103            bool                      bAllowedByLOD_;
    99104            unsigned int              detaillevel_;     //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high)
     105            float                     speedFactor_;
    100106            Ogre::SceneManager*       scenemanager_;
    101107    };
  • code/branches/presentation/src/orxonox/tools/Timer.cc

    r2087 r2485  
    9696        this->time_ = 0;
    9797
    98         RegisterRootObject(TimerBase);
     98        RegisterObject(TimerBase);
    9999    }
    100100
     
    137137        {
    138138            // 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());
    140140
    141141            if (this->time_ <= 0)
  • code/branches/presentation/src/orxonox/tools/Timer.h

    r2171 r2485  
    6363#include "OrxonoxPrereqs.h"
    6464#include "core/OrxonoxClass.h"
     65#include "gamestates/GSRoot.h"
    6566
    6667namespace orxonox
     
    7273
    7374    //! TimerBase is the parent of the Timer class.
    74     class _OrxonoxExport TimerBase : public OrxonoxClass
     75    class _OrxonoxExport TimerBase : public TimeFactorListener
    7576    {
    7677        public:
Note: See TracChangeset for help on using the changeset viewer.