Changeset 1563
- Timestamp:
- Jun 7, 2008, 11:40:50 PM (16 years ago)
- Location:
- code/trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/CommandEvaluation.cc
r1543 r1563 78 78 if (this->bEvaluatedParams_ && this->function_) 79 79 { 80 COUT( 4) << "CE_execute (evaluation): " << this->function_->getName() << " " << this->param_[0] << " " << this->param_[1] << " " << this->param_[2] << " " << this->param_[3] << " " << this->param_[4] << std::endl;80 COUT(5) << "CE_execute (evaluation): " << this->function_->getName() << " " << this->param_[0] << " " << this->param_[1] << " " << this->param_[2] << " " << this->param_[3] << " " << this->param_[4] << std::endl; 81 81 (*this->function_)(this->param_[0], this->param_[1], this->param_[2], this->param_[3], this->param_[4]); 82 82 return true; -
code/trunk/src/orxonox/GraphicsEngine.cc
r1538 r1563 53 53 54 54 #include "console/InGameConsole.h" 55 #include "tools/ParticleInterface.h" 55 56 #include "Settings.h" 56 57 … … 76 77 { 77 78 RegisterObject(GraphicsEngine); 79 80 this->detailLevelParticle_ = 0; 78 81 79 82 this->setConfigValues(); … … 91 94 SetConfigValue(ogreLogLevelNormal_ , 4).description("Corresponding orxonox debug level for ogre Normal"); 92 95 SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical"); 96 97 unsigned int old = this->detailLevelParticle_; 98 SetConfigValue(detailLevelParticle_, 2).description("O: off, 1: low, 2: normal, 3: high"); 99 100 if (this->detailLevelParticle_ != old) 101 for (Iterator<ParticleInterface> it = ObjectList<ParticleInterface>::begin(); it; ++it) 102 it->detailLevelChanged(this->detailLevelParticle_); 93 103 } 94 104 -
code/trunk/src/orxonox/GraphicsEngine.h
r1535 r1563 80 80 void windowClosed (Ogre::RenderWindow* rw); 81 81 82 inline unsigned int getDetailLevelParticle() const 83 { return this->detailLevelParticle_; } 84 82 85 static GraphicsEngine& getSingleton(); 83 86 static GraphicsEngine* getSingletonPtr() { return &getSingleton(); } … … 94 97 bool, const std::string&); 95 98 96 Ogre::Root* root_; //!< Ogre's root 97 Ogre::SceneManager* scene_; //!< scene manager of the game 98 Ogre::RenderWindow* renderWindow_; //!< the current render window 99 std::string resourceFile_; //!< resources file name 100 std::string ogreConfigFile_; //!< ogre config file name 101 std::string ogrePluginsFile_; //!< ogre plugins file name 102 std::string ogreLogFile_; //!< log file name for Ogre log messages 103 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 104 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 105 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 99 Ogre::Root* root_; //!< Ogre's root 100 Ogre::SceneManager* scene_; //!< scene manager of the game 101 Ogre::RenderWindow* renderWindow_; //!< the current render window 102 std::string resourceFile_; //!< resources file name 103 std::string ogreConfigFile_; //!< ogre config file name 104 std::string ogrePluginsFile_; //!< ogre plugins file name 105 std::string ogreLogFile_; //!< log file name for Ogre log messages 106 int ogreLogLevelTrivial_; //!< Corresponding Orxonx debug level for LL_TRIVIAL 107 int ogreLogLevelNormal_; //!< Corresponding Orxonx debug level for LL_NORMAL 108 int ogreLogLevelCritical_; //!< Corresponding Orxonx debug level for LL_CRITICAL 109 unsigned int detailLevelParticle_; //!< Detail level of particle effects (0: off, 1: low, 2: normal, 3: high) 106 110 }; 107 111 } -
code/trunk/src/orxonox/Orxonox.cc
r1556 r1563 71 71 #include "hud/HUD.h" 72 72 #include "objects/Tickable.h" 73 #include "tools/ParticleInterface.h" 73 74 74 75 #include "GraphicsEngine.h" … … 162 163 163 164 /** 165 @brief Changes the speed of Orxonox 166 */ 167 void Orxonox::setTimeFactor(float factor) 168 { 169 float change = factor / Orxonox::getSingleton()->getTimeFactor(); 170 Orxonox::getSingleton()->timefactor_ = factor; 171 172 for (Iterator<ParticleInterface> it = ObjectList<ParticleInterface>::begin(); it; ++it) 173 it->setSpeedFactor(it->getSpeedFactor() * change); 174 } 175 176 /** 164 177 * initialization of Orxonox object 165 178 * @param argc argument counter … … 379 392 Level* startlevel = new Level("levels/sample.oxw"); 380 393 Loader::open(startlevel); 381 394 382 395 return true; 383 396 } … … 421 434 //Ogre::SceneManager* mSceneMgr = GraphicsEngine::getSingleton().getSceneManager(); 422 435 //Ogre::Viewport* mViewport = mSceneMgr->getCurrentViewport(); 423 436 424 437 //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "Bloom"); 425 438 //Ogre::CompositorManager::getSingleton().addCompositor(mViewport, "MotionBlur"); -
code/trunk/src/orxonox/Orxonox.h
r1535 r1563 67 67 static void destroySingleton(); 68 68 69 static inline void slomo(float factor) { Orxonox:: getSingleton()->timefactor_ = factor; }70 static inline void setTimeFactor(float factor = 1.0) { Orxonox::getSingleton()->timefactor_ = factor; }69 static inline void slomo(float factor) { Orxonox::setTimeFactor(factor); } 70 static void setTimeFactor(float factor = 1.0); 71 71 static inline float getTimeFactor() { return Orxonox::getSingleton()->timefactor_; } 72 72 static inline void exit() { Orxonox::getSingleton()->abortRequest(); } -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r1558 r1563 60 60 //----------------------------------------------------------------------- 61 61 62 namespace orxonox { 62 namespace orxonox 63 { 64 namespace LODParticle 65 { 66 enum LOD 67 { 68 off = 0, 69 low = 1, 70 normal = 2, 71 high = 3 72 }; 73 } 74 63 75 class GraphicsEngine; 64 76 class Orxonox; -
code/trunk/src/orxonox/hud/RadarObject.cc
r1562 r1563 65 65 { 66 66 unsigned int RadarObject::count_s = 0; 67 unsigned int RadarObject::materialcount_s = 0; 67 68 std::map<std::string, std::map<ColourValue, std::string> > RadarObject::materials_s; 68 69 … … 99 100 if (it == colourmap.end()) 100 101 { 101 materialname = "radarmaterial" + getConvertedValue<unsigned int, std::string>(RadarObject:: count_s);102 materialname = "radarmaterial" + getConvertedValue<unsigned int, std::string>(RadarObject::materialcount_s++); 102 103 Ogre::MaterialPtr material = (Ogre::MaterialPtr)Ogre::MaterialManager::getSingleton().create(materialname, "General"); 104 material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA); 103 105 Ogre::TextureUnitState* textureunitstate = material->getTechnique(0)->getPass(0)->createTextureUnitState(); 104 106 textureunitstate->setTextureName(texturename); -
code/trunk/src/orxonox/hud/RadarObject.h
r1562 r1563 64 64 private: 65 65 static std::map<std::string, std::map<ColourValue, std::string> > materials_s; 66 unsigned static int count_s; 66 static unsigned int count_s; 67 static unsigned int materialcount_s; 67 68 Ogre::SceneNode* node_; // node of object 68 69 ColourValue colour_; -
code/trunk/src/orxonox/objects/ParticleProjectile.cc
r1560 r1563 43 43 if (this->owner_) 44 44 { 45 this->particles_ = new ParticleInterface("Orxonox/shot2" );45 this->particles_ = new ParticleInterface("Orxonox/shot2", LODParticle::normal); 46 46 this->particles_->addToSceneNode(this->getNode()); 47 47 this->particles_->getAllEmitters()->setDirection(-this->owner_->getInitialDir()); -
code/trunk/src/orxonox/objects/ParticleSpawner.cc
r1559 r1563 43 43 } 44 44 45 ParticleSpawner::ParticleSpawner(const std::string& templateName, float lifetime, float delay, const Vector3& direction)45 ParticleSpawner::ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float delay, const Vector3& direction) 46 46 { 47 47 RegisterObject(ParticleSpawner); … … 50 50 executor->setDefaultValues(lifetime); 51 51 this->timer_.setTimer(delay, false, this, executor); 52 this->particle_ = new ParticleInterface(templateName );52 this->particle_ = new ParticleInterface(templateName, detaillevel); 53 53 this->particle_->addToSceneNode(this->getNode()); 54 54 this->particle_->setEnabled(false); -
code/trunk/src/orxonox/objects/ParticleSpawner.h
r1552 r1563 33 33 34 34 #include "WorldEntity.h" 35 #include " ../tools/Timer.h"35 #include "tools/Timer.h" 36 36 37 37 namespace orxonox … … 41 41 public: 42 42 ParticleSpawner(); 43 ParticleSpawner(const std::string& templateName, float lifetime, float delay = 0, const Vector3& direction = Vector3::ZERO);43 ParticleSpawner(const std::string& templateName, LODParticle::LOD detaillevel, float lifetime, float delay = 0, const Vector3& direction = Vector3::ZERO); 44 44 virtual ~ParticleSpawner(); 45 45 inline ParticleInterface* getParticleInterface() const -
code/trunk/src/orxonox/objects/Projectile.cc
r1558 r1563 97 97 if (it->isA(Class(SpaceShipAI))) 98 98 ((SpaceShipAI*)(*it))->damage(this->damage_); 99 ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, 2.0);99 ParticleSpawner* explosion = new ParticleSpawner(this->explosionTemplateName_, LODParticle::low, 2.0); 100 100 explosion->setPosition(this->getPosition()); 101 101 explosion->create(); 102 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, 6.0, 0.0);102 ParticleSpawner* smoke = new ParticleSpawner(this->smokeTemplateName_, LODParticle::normal, 6.0, 0.0); 103 103 smoke->setPosition(this->getPosition()); 104 104 smoke->getParticleInterface()->setSpeedFactor(3.0); -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1562 r1563 187 187 { 188 188 // START CREATING THRUSTER 189 this->tt1_ = new ParticleInterface("Orxonox/thruster1" );189 this->tt1_ = new ParticleInterface("Orxonox/thruster1", LODParticle::low); 190 190 this->tt1_->createNewEmitter(); 191 191 this->tt1_->getAllEmitters()->setDirection(-this->getInitialDir()); … … 199 199 tt1_->addToSceneNode(node2a); 200 200 201 this->tt2_ = new ParticleInterface("Orxonox/thruster2" );201 this->tt2_ = new ParticleInterface("Orxonox/thruster2", LODParticle::normal); 202 202 this->tt2_->createNewEmitter(); 203 203 this->tt2_->getAllEmitters()->setDirection(Vector3(-1, 0, 0)); -
code/trunk/src/orxonox/objects/SpaceShipAI.cc
r1562 r1563 102 102 newenemy->XMLPort(xmlelement, XMLPort::LoadObject); 103 103 104 ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", 2.0, 0.0, newenemy->getOrth());104 ParticleSpawner* spawneffect = new ParticleSpawner("Orxonox/fairytwirl", LODParticle::normal, 2.0, 0.0, newenemy->getOrth()); 105 105 spawneffect->setPosition(newenemy->getPosition() - newenemy->getOrth() * 50); 106 106 spawneffect->create(); … … 182 182 void SpaceShipAI::kill() 183 183 { 184 ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", 3.0); 185 explosion->setPosition(this->getPosition()); 186 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 187 explosion->setScale(4); 188 explosion->create(); 189 190 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", 3.0); 184 ParticleSpawner* explosion = new ParticleSpawner("Orxonox/BigExplosion1part1", LODParticle::low, 3.0); 185 explosion->setPosition(this->getPosition()); 186 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 187 explosion->setScale(4); 188 explosion->create(); 189 190 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::normal, 3.0); 191 explosion->setPosition(this->getPosition()); 192 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 193 explosion->setScale(4); 194 explosion->create(); 195 explosion = new ParticleSpawner("Orxonox/BigExplosion1part2", LODParticle::high, 3.0); 191 196 explosion->setPosition(this->getPosition()); 192 197 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); … … 196 201 Vector3 ringdirection = Vector3(rnd(), rnd(), rnd()); 197 202 ringdirection.normalise(); 198 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", 3.0, 0.5, ringdirection); 203 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::normal, 3.0, 0.5, ringdirection); 204 explosion->setPosition(this->getPosition()); 205 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); 206 explosion->setScale(4); 207 explosion->create(); 208 explosion = new ParticleSpawner("Orxonox/BigExplosion1part3", LODParticle::high, 3.0, 0.5, ringdirection); 199 209 explosion->setPosition(this->getPosition()); 200 210 explosion->getParticleInterface()->setKeepParticlesInLocalSpace(true); -
code/trunk/src/orxonox/tools/ParticleInterface.cc
r1555 r1563 40 40 #include "GraphicsEngine.h" 41 41 #include "Orxonox.h" 42 #include "core/CoreIncludes.h" 42 43 #include "util/Convert.h" 43 44 … … 47 48 ParticleInterface* ParticleInterface::currentParticleInterface_s = 0; 48 49 49 ParticleInterface::ParticleInterface(const std::string& templateName )50 ParticleInterface::ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel) 50 51 { 52 RegisterRootObject(ParticleInterface); 53 51 54 this->sceneNode_ = 0; 55 this->bEnabled_ = true; 56 this->detaillevel_ = (unsigned int)detaillevel; 52 57 this->particleSystem_ = GraphicsEngine::getSingleton().getSceneManager()->createParticleSystem("particles" + getConvertedValue<unsigned int, std::string>(ParticleInterface::counter_s++), templateName); 53 58 this->particleSystem_->setSpeedFactor(Orxonox::getSingleton()->getTimeFactor()); 59 60 if (GraphicsEngine::getSingleton().getDetailLevelParticle() < (unsigned int)this->detaillevel_) 61 { 62 this->bVisible_ = false; 63 this->updateVisibility(); 64 } 65 else 66 { 67 this->bVisible_ = true; 68 } 54 69 } 55 70 … … 134 149 void ParticleInterface::setEnabled(bool enable) 135 150 { 151 this->bEnabled_ = enable; 152 this->updateVisibility(); 153 } 154 155 void ParticleInterface::detailLevelChanged(unsigned int newlevel) 156 { 157 if (newlevel >= (unsigned int)this->detaillevel_) 158 this->bVisible_ = true; 159 else 160 this->bVisible_ = false; 161 162 this->updateVisibility(); 163 } 164 165 void ParticleInterface::updateVisibility() 166 { 136 167 for (unsigned int i = 0; i < this->particleSystem_->getNumEmitters(); i++) 137 this->particleSystem_->getEmitter(i)->setEnabled( enable);168 this->particleSystem_->getEmitter(i)->setEnabled(this->bEnabled_ && this->bVisible_); 138 169 } 139 170 … … 144 175 float ParticleInterface::getSpeedFactor() const 145 176 { 146 return this->particleSystem_->getSpeedFactor();177 return (this->particleSystem_->getSpeedFactor() / Orxonox::getSingleton()->getTimeFactor()); 147 178 } 148 179 -
code/trunk/src/orxonox/tools/ParticleInterface.h
r1553 r1563 35 35 #include <OgreParticleEmitter.h> 36 36 37 #include "core/OrxonoxClass.h" 37 38 #include "util/Math.h" 38 39 … … 44 45 namespace orxonox 45 46 { 46 class _OrxonoxExport ParticleInterface 47 class _OrxonoxExport ParticleInterface : public OrxonoxClass 47 48 { 48 49 public: 49 ParticleInterface(const std::string& templateName );50 ParticleInterface(const std::string& templateName, LODParticle::LOD detaillevel); 50 51 ~ParticleInterface(); 51 52 … … 74 75 75 76 void setEnabled(bool enable); 77 void detailLevelChanged(unsigned int newlevel); 76 78 77 79 inline void storeThisAsCurrentParticleInterface() … … 81 83 82 84 private: 85 void updateVisibility(); 86 83 87 static ParticleInterface* currentParticleInterface_s; 84 88 static unsigned int counter_s; 85 89 Ogre::SceneNode* sceneNode_; 86 90 Ogre::ParticleSystem* particleSystem_; 91 bool bVisible_; 92 bool bEnabled_; 93 unsigned int detaillevel_; //!< Detail level of this particle effect (0: off, 1: low, 2: normal, 3: high) 87 94 }; 88 95 }
Note: See TracChangeset
for help on using the changeset viewer.