Changeset 2065 for code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc
- Timestamp:
- Oct 30, 2008, 2:44:48 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/objects/worldentities/BlinkingBillboard.cc
r2063 r2065 30 30 #include "BlinkingBillboard.h" 31 31 32 #include "core/Core.h" 32 33 #include "core/CoreIncludes.h" 33 34 #include "core/XMLPort.h" 35 #include "util/Math.h" 34 36 35 37 namespace orxonox … … 44 46 this->frequency_ = 1.0f; 45 47 this->phase_ = 0; 48 this->bQuadratic_ = false; 46 49 this->time_ = 0; 47 50 … … 60 63 XMLPortParam(BlinkingBillboard, "frequency", setFrequency, getFrequency, xmlelement, mode).defaultValues(1.0f); 61 64 XMLPortParam(BlinkingBillboard, "phase", setPhase, getPhase, xmlelement, mode).defaultValues(Degree(0)); 65 XMLPortParam(BlinkingBillboard, "quadratic", setQuadratic, isQuadratic, xmlelement, mode).defaultValues(false); 62 66 } 63 67 64 68 void BlinkingBillboard::registerVariables() 65 69 { 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); 69 73 } 70 74 71 75 void BlinkingBillboard::tick(float dt) 72 76 { 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 } 75 85 } 76 86 }
Note: See TracChangeset
for help on using the changeset viewer.