Changeset 1755 for code/trunk/src/orxonox/tools
- Timestamp:
- Sep 10, 2008, 1:37:36 AM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/gui (added) merged: 1636,1638,1640-1647,1649-1654,1656,1659-1665,1670,1672-1674,1686,1688-1692,1694-1697,1704 /code/branches/input (added) merged: 1629-1630
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/tools/BillboardSet.cc
r1602 r1755 50 50 std::ostringstream name; 51 51 name << (BillboardSet::billboardSetCounter_s++); 52 this->billboardSet_ = GraphicsEngine::get Singleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count);52 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 53 53 this->billboardSet_->createBillboard(Vector3::ZERO); 54 54 this->billboardSet_->setMaterialName(file); … … 59 59 std::ostringstream name; 60 60 name << (BillboardSet::billboardSetCounter_s++); 61 this->billboardSet_ = GraphicsEngine::get Singleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count);61 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 62 62 this->billboardSet_->createBillboard(Vector3::ZERO, colour); 63 63 this->billboardSet_->setMaterialName(file); … … 68 68 std::ostringstream name; 69 69 name << (BillboardSet::billboardSetCounter_s++); 70 this->billboardSet_ = GraphicsEngine::get Singleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count);70 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 71 71 this->billboardSet_->createBillboard(position); 72 72 this->billboardSet_->setMaterialName(file); … … 77 77 std::ostringstream name; 78 78 name << (BillboardSet::billboardSetCounter_s++); 79 this->billboardSet_ = GraphicsEngine::get Singleton().getSceneManager()->createBillboardSet("Billboard" + name.str(), count);79 this->billboardSet_ = GraphicsEngine::getInstance().getLevelSceneManager()->createBillboardSet("Billboard" + name.str(), count); 80 80 this->billboardSet_->createBillboard(position, colour); 81 81 this->billboardSet_->setMaterialName(file); … … 85 85 { 86 86 if (this->billboardSet_) 87 GraphicsEngine::get Singleton().getSceneManager()->destroyBillboardSet(this->billboardSet_);87 GraphicsEngine::getInstance().getLevelSceneManager()->destroyBillboardSet(this->billboardSet_); 88 88 } 89 89 } -
code/trunk/src/orxonox/tools/Light.cc
r1505 r1755 49 49 std::ostringstream name; 50 50 name << (Light::lightCounter_s++); 51 this->light_ = GraphicsEngine::get Singleton().getSceneManager()->createLight("Light" + name.str());51 this->light_ = GraphicsEngine::getInstance().getLevelSceneManager()->createLight("Light" + name.str()); 52 52 this->light_->setType(type); 53 53 this->light_->setDiffuseColour(diffuse); … … 58 58 { 59 59 if (this->light_) 60 GraphicsEngine::get Singleton().getSceneManager()->destroyLight(this->light_);60 GraphicsEngine::getInstance().getLevelSceneManager()->destroyLight(this->light_); 61 61 } 62 62 } -
code/trunk/src/orxonox/tools/Mesh.cc
r1505 r1755 31 31 32 32 #include <sstream> 33 34 33 #include <OgreSceneManager.h> 35 36 34 #include "GraphicsEngine.h" 35 #include "Settings.h" 37 36 38 37 namespace orxonox … … 49 48 std::ostringstream name; 50 49 name << (Mesh::meshCounter_s++); 51 this->entity_ = GraphicsEngine::getSingleton().getSceneManager()->createEntity("Mesh" + name.str(), file); 50 if (Settings::showsGraphics()) 51 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file); 52 52 } 53 53 54 54 Mesh::~Mesh() 55 55 { 56 if (this->entity_ )57 GraphicsEngine::get Singleton().getSceneManager()->destroyEntity(this->entity_);56 if (this->entity_ && Settings::showsGraphics()) 57 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 58 58 } 59 59 } -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r1563 r1755 39 39 40 40 #include "GraphicsEngine.h" 41 #include "Orxonox.h"42 41 #include "core/CoreIncludes.h" 43 42 #include "util/Convert.h" … … 55 54 this->bEnabled_ = true; 56 55 this->detaillevel_ = (unsigned int)detaillevel; 57 this->particleSystem_ = GraphicsEngine::getSingleton().getSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 58 this->particleSystem_->setSpeedFactor(Orxonox::getSingleton()->getTimeFactor()); 56 this->particleSystem_ = GraphicsEngine::getInstance().getLevelSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 57 //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 58 this->particleSystem_->setSpeedFactor(1.0f); 59 59 60 if (GraphicsEngine::get Singleton().getDetailLevelParticle() < (unsigned int)this->detaillevel_)60 if (GraphicsEngine::getInstance().getDetailLevelParticle() < (unsigned int)this->detaillevel_) 61 61 { 62 62 this->bVisible_ = false; … … 72 72 { 73 73 this->particleSystem_->removeAllEmitters(); 74 GraphicsEngine::get Singleton().getSceneManager()->destroyParticleSystem(particleSystem_);74 GraphicsEngine::getInstance().getLevelSceneManager()->destroyParticleSystem(particleSystem_); 75 75 } 76 76 … … 171 171 void ParticleInterface::setSpeedFactor(float factor) 172 172 { 173 this->particleSystem_->setSpeedFactor(Orxonox::getSingleton()->getTimeFactor() * factor); 173 //this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 174 this->particleSystem_->setSpeedFactor(1.0f * factor); 174 175 } 175 176 float ParticleInterface::getSpeedFactor() const 176 177 { 177 return (this->particleSystem_->getSpeedFactor() / Orxonox::getSingleton()->getTimeFactor()); 178 //return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 179 return (this->particleSystem_->getSpeedFactor() / 1.0f); 178 180 } 179 181 -
code/trunk/src/orxonox/tools/Timer.cc
r1552 r1755 36 36 #include "core/ConsoleCommand.h" 37 37 #include "core/CommandExecutor.h" 38 #include "core/Clock.h" 38 39 39 40 namespace orxonox … … 125 126 @brief Updates the timer before the frames are rendered. 126 127 */ 127 void TimerBase::tick( float dt)128 void TimerBase::tick(const Clock& time) 128 129 { 129 130 if (this->bActive_) 130 131 { 131 132 // If active: Decrease the timer by the duration of the last frame 132 this->time_ -= dt;133 this->time_ -= time.getDeltaTimeMicroseconds(); 133 134 134 135 if (this->time_ <= 0) -
code/trunk/src/orxonox/tools/Timer.h
r1608 r1755 62 62 63 63 #include "OrxonoxPrereqs.h" 64 #include " objects/Tickable.h"64 #include "core/OrxonoxClass.h" 65 65 66 66 namespace orxonox … … 72 72 73 73 //! TimerBase is the parent of the Timer class. 74 class _OrxonoxExport TimerBase : public Tickable74 class _OrxonoxExport TimerBase : public OrxonoxClass 75 75 { 76 76 public: … … 97 97 /** @brief Returns the remaining time until the Timer calls the function. @return The remaining time */ 98 98 inline float getRemainingTime() const 99 { return this->time_; }99 { return (float)this->time_ / 1000000.0f; } 100 100 /** @brief Gives the Timer some extra time. @param time The amount of extra time in seconds */ 101 101 inline void addTime(float time) 102 { this->time_ += time; }102 { if (time > 0.0f) this->time_ += (long long)(time * 1000000.0f); } 103 103 /** @brief Decreases the remaining time of the Timer. @param time The amount of time to remove */ 104 104 inline void removeTime(float time) 105 { this->time_ -= time; }105 { if (time > 0.0f) this->time_ -= (long long)(time * 1000000.0f); } 106 106 /** @brief Sets the interval of the Timer. @param interval The interval */ 107 107 inline void setInterval(float interval) 108 { this->interval_ = interval; }108 { this->interval_ = (long long)(interval * 1000000.0f); } 109 109 /** @brief Sets bLoop to a given value. @param bLoop True = loop */ 110 110 inline void setLoop(bool bLoop) 111 111 { this->bLoop_ = bLoop; } 112 112 113 void tick( float dt);113 void tick(const Clock& time); 114 114 115 115 protected: … … 118 118 Executor* executor_; //!< The executor of the function that should be called when the time expires 119 119 120 float interval_; //!< The time-interval inseconds120 long long interval_; //!< The time-interval in micro seconds 121 121 bool bLoop_; //!< If true, the function gets called every 'interval' seconds 122 122 bool bActive_; //!< If true, the Timer ticks and calls the function if the time's up 123 123 124 float time_;//!< Internal variable, counting the time till the next function-call124 long long time_; //!< Internal variable, counting the time till the next function-call 125 125 }; 126 126 … … 155 155 this->deleteExecutor(); 156 156 157 this-> interval_ = interval;157 this->setInterval(interval); 158 158 this->bLoop_ = bLoop; 159 159 executor->setObject(object); … … 161 161 this->bActive_ = true; 162 162 163 this->time_ = interval;163 this->time_ = this->interval_; 164 164 } 165 165 }; … … 193 193 this->deleteExecutor(); 194 194 195 this-> interval_ = interval;195 this->setInterval(interval); 196 196 this->bLoop_ = bLoop; 197 197 this->executor_ = (Executor*)executor; 198 198 this->bActive_ = true; 199 199 200 this->time_ = interval;200 this->time_ = this->interval_; 201 201 } 202 202 }; -
code/trunk/src/orxonox/tools/WindowEventListener.h
r1625 r1755 45 45 virtual ~WindowEventListener() { } 46 46 47 48 47 /** Window has moved position */ 48 virtual void windowMoved() { } 49 49 50 51 50 /** Window has resized */ 51 virtual void windowResized(int newWidth, int newHeight) { } 52 52 53 54 53 /** Window has lost/gained focus */ 54 virtual void windowFocusChanged() { } 55 55 }; 56 56 }
Note: See TracChangeset
for help on using the changeset viewer.