- Timestamp:
- Feb 14, 2009, 10:17:35 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2171 r2662 33 33 34 34 #include "OrxonoxStableHeaders.h" 35 #include "ParticleEmitter.h" 35 36 36 #include "ParticleEmitter.h"37 #include <OgreParticleSystem.h> 37 38 38 39 #include "tools/ParticleInterface.h" … … 46 47 CreateFactory(ParticleEmitter); 47 48 48 ParticleEmitter::ParticleEmitter(BaseObject* creator) : PositionableEntity(creator)49 ParticleEmitter::ParticleEmitter(BaseObject* creator) : StaticEntity(creator) 49 50 { 50 51 RegisterObject(ParticleEmitter); 51 52 52 if ( !this->getScene() || !this->getScene()->getSceneManager())53 ThrowException(AbortLoading, "Can't create Camera, no scene or no scene manager given.");53 if (Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager())) 54 ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given."); 54 55 55 56 this->particles_ = 0; … … 62 63 { 63 64 if (this->isInitialized() && this->particles_) 65 { 66 this->detachOgreObject(this->particles_->getParticleSystem()); 64 67 delete this->particles_; 68 } 65 69 } 66 70 … … 75 79 void ParticleEmitter::registerVariables() 76 80 { 77 REGISTERSTRING(this->source_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged));78 REGISTERDATA (this->LOD_, direction::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged));81 registerVariable(this->source_, variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::sourceChanged)); 82 registerVariable((int&)(this->LOD_), variableDirection::toclient, new NetworkCallback<ParticleEmitter>(this, &ParticleEmitter::LODchanged)); 79 83 } 80 84 … … 98 102 { 99 103 if (this->particles_) 104 { 100 105 delete this->particles_; 106 this->particles_ = 0; 107 } 101 108 102 if ( this->getScene() && this->getScene()->getSceneManager())109 if (Core::showsGraphics() && this->getScene() && this->getScene()->getSceneManager()) 103 110 { 104 111 try 105 112 { 106 113 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), this->source_, this->LOD_); 107 this-> particles_->addToSceneNode(this->getNode());114 this->attachOgreObject(this->particles_->getParticleSystem()); 108 115 this->particles_->setVisible(this->isVisible()); 109 116 this->particles_->setEnabled(this->isActive()); … … 115 122 } 116 123 } 117 else118 this->particles_ = 0;119 124 } 120 125
Note: See TracChangeset
for help on using the changeset viewer.