Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2008, 2:44:48 AM (16 years ago)
Author:
landauf
Message:

added two more graphical classes, ParticleEmitter and ParticleSpawner

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc

    r2063 r2065  
    3030#include "BlinkingBillboard.h"
    3131
     32#include "core/Core.h"
    3233#include "core/CoreIncludes.h"
    3334#include "core/XMLPort.h"
     35#include "util/Math.h"
    3436
    3537namespace orxonox
     
    4446        this->frequency_ = 1.0f;
    4547        this->phase_ = 0;
     48        this->bQuadratic_ = false;
    4649        this->time_ = 0;
    4750
     
    6063        XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f);
    6164        XMLPortParam(BlinkingBillboard, "phase",     setPhase,     getPhase,     xmlelement, mode).defaultValues(Degree(0));
     65        XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic,  xmlelement, mode).defaultValues(false);
    6266    }
    6367
    6468    void BlinkingBillboard::registerVariables()
    6569    {
    66         REGISTERDATA(this->amplitude_, network::direction::toclient);
    67         REGISTERDATA(this->frequency_, network::direction::toclient);
    68         REGISTERDATA(this->phase_,     network::direction::toclient);
     70//        REGISTERDATA(this->amplitude_, network::direction::toclient);
     71//        REGISTERDATA(this->frequency_, network::direction::toclient);
     72//        REGISTERDATA(this->phase_,     network::direction::toclient);
    6973    }
    7074
    7175    void BlinkingBillboard::tick(float dt)
    7276    {
    73         this->time_ += dt;
    74         this->setScale(this->amplitude_ * sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_));
     77        if (Core::isMaster())
     78        {
     79            this->time_ += dt;
     80            if (this->bQuadratic_)
     81                this->setScale(this->amplitude_ * square(sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_)));
     82            else
     83                this->setScale(this->amplitude_ * sin((6.2831853 * this->time_ + this->phase_.valueRadians()) * this->frequency_));
     84        }
    7585    }
    7686}
Note: See TracChangeset for help on using the changeset viewer.