Changeset 2662 for code/trunk/src/orxonox/tools
- Timestamp:
- Feb 14, 2009, 10:17:35 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 11 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/tools/BillboardSet.cc
r2171 r2662 34 34 35 35 #include <OgreSceneManager.h> 36 #include <OgreBillboardSet.h> 36 37 #include <OgreBillboard.h> 37 38 -
code/trunk/src/orxonox/tools/BillboardSet.h
r2087 r2662 33 33 34 34 #include <string> 35 #include <Ogre BillboardSet.h>35 #include <OgrePrerequisites.h> 36 36 37 37 #include "util/Math.h" … … 52 52 inline Ogre::BillboardSet* getBillboardSet() 53 53 { return this->billboardSet_; } 54 inline Ogre::SceneManager* getSceneManager() 55 { return this->scenemanager_; } 54 56 55 57 const std::string& getName() const; -
code/trunk/src/orxonox/tools/CMakeLists.txt
r2131 r2662 3 3 Mesh.cc 4 4 ParticleInterface.cc 5 Shader.cc 5 6 TextureGenerator.cc 6 7 Timer.cc -
code/trunk/src/orxonox/tools/Mesh.cc
r2171 r2662 31 31 32 32 #include <sstream> 33 #include <OgreEntity.h> 33 34 #include <OgreSceneManager.h> 34 35 #include <cassert> -
code/trunk/src/orxonox/tools/Mesh.h
r2087 r2662 33 33 34 34 #include <string> 35 #include <Ogre Entity.h>35 #include <OgrePrerequisites.h> 36 36 37 37 namespace orxonox -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r2171 r2662 52 52 ParticleInterface::ParticleInterface(Ogre::SceneManager* scenemanager, const std::string& templateName, LODParticle::LOD detaillevel) 53 53 { 54 Register RootObject(ParticleInterface);54 RegisterObject(ParticleInterface); 55 55 56 56 assert(scenemanager); 57 57 58 58 this->scenemanager_ = scenemanager; 59 this->sceneNode_ = 0;60 59 this->particleSystem_ = 0; 61 60 … … 63 62 this->bVisible_ = true; 64 63 this->bAllowedByLOD_ = true; 64 this->speedFactor_ = 1.0f; 65 65 66 66 if (Core::showsGraphics()) … … 69 69 { 70 70 this->particleSystem_ = this->scenemanager_->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 71 this->particleSystem_->setSpeedFactor(1.0f); 72 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor()); 71 this->setSpeedFactor(1.0f); 73 72 } 74 73 catch (...) … … 87 86 { 88 87 this->particleSystem_->removeAllEmitters(); 89 this->detachFromSceneNode();90 88 this->scenemanager_->destroyParticleSystem(this->particleSystem_); 91 }92 }93 94 void ParticleInterface::addToSceneNode(Ogre::SceneNode* sceneNode)95 {96 if (this->sceneNode_)97 this->detachFromSceneNode();98 99 if (this->particleSystem_)100 {101 this->sceneNode_ = sceneNode;102 this->sceneNode_->attachObject(this->particleSystem_);103 }104 }105 106 void ParticleInterface::detachFromSceneNode()107 {108 if (this->sceneNode_)109 {110 if (this->particleSystem_)111 this->sceneNode_->detachObject(this->particleSystem_);112 this->sceneNode_ = 0;113 89 } 114 90 } … … 224 200 void ParticleInterface::setSpeedFactor(float factor) 225 201 { 226 if (this->particleSystem_) 227 { 228 // this->particleSystem_->setSpeedFactor(Orxonox::getInstance().getTimeFactor() * factor); 229 this->particleSystem_->setSpeedFactor(1.0f * factor); 230 } 231 } 232 float ParticleInterface::getSpeedFactor() const 233 { 234 if (this->particleSystem_) 235 { 236 // return (this->particleSystem_->getSpeedFactor() / Orxonox::getInstance().getTimeFactor()); 237 return (this->particleSystem_->getSpeedFactor() / 1.0f); 238 } 239 else 240 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_); 241 210 } 242 211 -
code/trunk/src/orxonox/tools/ParticleInterface.h
r2087 r2662 33 33 34 34 #include <string> 35 #include <OgreP articleEmitter.h>35 #include <OgrePrerequisites.h> 36 36 37 37 #include "core/OrxonoxClass.h" 38 38 #include "util/Math.h" 39 #include "gamestates/GSRoot.h" 39 40 40 41 #define getAllEmitters() \ … … 45 46 namespace orxonox 46 47 { 47 class _OrxonoxExport ParticleInterface : public OrxonoxClass48 class _OrxonoxExport ParticleInterface : public TimeFactorListener 48 49 { 49 50 public: … … 53 54 inline Ogre::ParticleSystem* getParticleSystem() const 54 55 { return this->particleSystem_; } 55 56 void addToSceneNode(Ogre::SceneNode* sceneNode);57 void detachFromSceneNode();58 56 59 57 Ogre::ParticleEmitter* createNewEmitter(); … … 69 67 unsigned int getNumAffectors() const; 70 68 71 float getSpeedFactor() const; 69 inline float getSpeedFactor() const 70 { return this->speedFactor_; } 72 71 void setSpeedFactor(float factor); 73 72 bool getKeepParticlesInLocalSpace() const; … … 90 89 { return ParticleInterface::currentParticleInterface_s; } 91 90 91 protected: 92 virtual void changedTimeFactor(float factor_new, float factor_old); 93 92 94 private: 93 95 void updateVisibility(); … … 96 98 static unsigned int counter_s; 97 99 98 Ogre::SceneNode* sceneNode_;99 100 Ogre::ParticleSystem* particleSystem_; 100 101 bool bVisible_; … … 102 103 bool bAllowedByLOD_; 103 104 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 105 float speedFactor_; 104 106 Ogre::SceneManager* scenemanager_; 105 107 }; -
code/trunk/src/orxonox/tools/Timer.cc
r2087 r2662 96 96 this->time_ = 0; 97 97 98 Register RootObject(TimerBase);98 RegisterObject(TimerBase); 99 99 } 100 100 … … 137 137 { 138 138 // 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()); 140 140 141 141 if (this->time_ <= 0) -
code/trunk/src/orxonox/tools/Timer.h
r2171 r2662 62 62 63 63 #include "OrxonoxPrereqs.h" 64 #include "core/Executor.h" 64 65 #include "core/OrxonoxClass.h" 66 #include "gamestates/GSRoot.h" 65 67 66 68 namespace orxonox … … 72 74 73 75 //! TimerBase is the parent of the Timer class. 74 class _OrxonoxExport TimerBase : public OrxonoxClass76 class _OrxonoxExport TimerBase : public TimeFactorListener 75 77 { 76 78 public: … … 159 161 this->bLoop_ = bLoop; 160 162 executor->setObject(object); 161 this->executor_ = (Executor*)executor;163 this->executor_ = static_cast<Executor*>(executor); 162 164 this->bActive_ = true; 163 165 … … 197 199 this->setInterval(interval); 198 200 this->bLoop_ = bLoop; 199 this->executor_ = (Executor*)executor;201 this->executor_ = executor; 200 202 this->bActive_ = true; 201 203 -
code/trunk/src/orxonox/tools/WindowEventListener.h
r1755 r2662 41 41 class _OrxonoxExport WindowEventListener : virtual public OrxonoxClass 42 42 { 43 public:44 WindowEventListener();45 virtual ~WindowEventListener() { }43 public: 44 WindowEventListener(); 45 virtual ~WindowEventListener() { } 46 46 47 47 /** Window has moved position */
Note: See TracChangeset
for help on using the changeset viewer.