Changeset 1558
- Timestamp:
- Jun 7, 2008, 2:06:41 AM (17 years ago)
- Location:
- code/trunk/src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/core/BaseObject.cc
r1505 r1558 46 46 */ 47 47 BaseObject::BaseObject() : 48 bActive_(true), 49 bVisible_(true), 50 level_(0), 51 namespace_(0) 48 bInitialized_(false), 49 bActive_(true), 50 bVisible_(true), 51 level_(0), 52 namespace_(0) 52 53 { 53 54 RegisterRootObject(BaseObject); 55 56 this->bInitialized_ = true; 54 57 } 55 58 -
code/trunk/src/core/BaseObject.h
r1505 r1558 47 47 class _CoreExport BaseObject : virtual public OrxonoxClass 48 48 { 49 friend class WorldEntity; 50 49 51 public: 50 52 BaseObject(); … … 52 54 virtual void loadParams(TiXmlElement* xmlElem); 53 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 56 57 /** @brief Returns if the object was initialized (passed the object registration). @return True was the object is initialized */ 58 inline bool isInitialized() const { return this->bInitialized_; } 54 59 55 60 /** @brief Sets the name of the object. @param name The name */ … … 63 68 inline void setActivity(bool bActive) { this->bActive_ = bActive; this->changedActivity(); } 64 69 /** @brief Returns the state of the objects activity. @return The state of the activity */ 65 inline constbool isActive() const { return this->bActive_; }70 inline bool isActive() const { return this->bActive_; } 66 71 /** @brief This function gets called if the activity of the object changes. */ 67 72 virtual void changedActivity() {} … … 70 75 inline void setVisibility(bool bVisible) { this->bVisible_ = bVisible; this->changedVisibility(); } 71 76 /** @brief Returns the state of the objects visibility. @return The state of the visibility */ 72 inline constbool isVisible() const { return this->bVisible_; }77 inline bool isVisible() const { return this->bVisible_; } 73 78 /** @brief This function gets called if the visibility of the object changes. */ 74 79 virtual void changedVisibility() {} … … 90 95 private: 91 96 std::string name_; //!< The name of the object 97 bool bInitialized_; //!< True if the object was initialized (passed the object registration) 92 98 bool bActive_; //!< True = the object is active 93 99 bool bVisible_; //!< True = the object is visible -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r1552 r1558 66 66 // objects 67 67 class Ambient; 68 class Backlight; 68 69 class Camera; 69 70 class Fighter; -
code/trunk/src/orxonox/objects/BillboardProjectile.cc
r1552 r1558 60 60 this->billboard_.getBillboardSet()->getBillboard(0)->setColour(colour); 61 61 } 62 63 void BillboardProjectile::changedVisibility() 64 { 65 Projectile::changedVisibility(); 66 this->billboard_.setVisible(this->isVisible()); 67 } 62 68 } -
code/trunk/src/orxonox/objects/BillboardProjectile.h
r1552 r1558 43 43 BillboardProjectile(SpaceShip* owner = 0); 44 44 virtual ~BillboardProjectile(); 45 45 46 virtual void setColour(const ColourValue& colour); 47 virtual void changedVisibility(); 46 48 47 49 private: -
code/trunk/src/orxonox/objects/Model.cc
r1552 r1558 96 96 registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING); 97 97 } 98 99 void Model::changedVisibility() 100 { 101 WorldEntity::changedVisibility(); 102 this->mesh_.setVisible(this->isVisible()); 103 } 98 104 } -
code/trunk/src/orxonox/objects/Model.h
r1505 r1558 44 44 virtual ~Model(); 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 virtual void changedVisibility(); 46 47 void setMesh(const std::string& meshname); 47 48 virtual bool create(); -
code/trunk/src/orxonox/objects/ParticleProjectile.cc
r1552 r1558 55 55 delete this->particles_; 56 56 } 57 58 void ParticleProjectile::changedVisibility() 59 { 60 BillboardProjectile::changedVisibility(); 61 this->particles_->setEnabled(this->isVisible()); 62 } 57 63 } -
code/trunk/src/orxonox/objects/ParticleProjectile.h
r1553 r1558 43 43 ParticleProjectile(SpaceShip* owner = 0); 44 44 virtual ~ParticleProjectile(); 45 virtual void changedVisibility(); 45 46 46 47 private: -
code/trunk/src/orxonox/objects/Projectile.cc
r1554 r1558 82 82 WorldEntity::tick(dt); 83 83 84 if (!this->isActive()) 85 return; 86 84 87 float radius; 85 88 for (Iterator<Model> it = ObjectList<Model>::start(); it; ++it) -
code/trunk/src/orxonox/objects/RotatingProjectile.cc
r1552 r1558 73 73 void RotatingProjectile::tick(float dt) 74 74 { 75 this->time_ += dt; 75 if (this->isActive()) 76 { 77 this->time_ += dt; 76 78 77 this->rotatingNode1_->setPosition(0, 50 * sin(this->time_ * 20), 50 * cos(this->time_ * 20)); 78 this->rotatingNode2_->setPosition(0, -50 * sin(this->time_ * 20), -50 * cos(this->time_ * 20)); 79 this->rotatingNode1_->setPosition(0, 50 * sin(this->time_ * 20), 50 * cos(this->time_ * 20)); 80 this->rotatingNode2_->setPosition(0, -50 * sin(this->time_ * 20), -50 * cos(this->time_ * 20)); 81 } 79 82 80 83 Projectile::tick(dt); 81 84 } 85 86 void RotatingProjectile::changedVisibility() 87 { 88 BillboardProjectile::changedVisibility(); 89 this->rotatingBillboard1_.setVisible(this->isVisible()); 90 this->rotatingBillboard2_.setVisible(this->isVisible()); 91 } 82 92 } -
code/trunk/src/orxonox/objects/RotatingProjectile.h
r1552 r1558 15 15 void setConfigValues(); 16 16 virtual void tick(float dt); 17 virtual void changedVisibility(); 17 18 18 19 private: -
code/trunk/src/orxonox/objects/Skybox.cc
r1505 r1558 54 54 } 55 55 56 void Skybox:: loadParams(TiXmlElement* xmlElem)56 void Skybox::setSkybox(const std::string& skyboxname) 57 57 { 58 if (xmlElem->Attribute("src")) 59 { 60 skyboxSrc_ = xmlElem->Attribute("src"); 61 this->create(); 58 GraphicsEngine::getSingleton().getSceneManager()->setSkyBox(true, skyboxname); 59 } 62 60 63 COUT(4) << "Loader: Set skybox: "<< skyboxSrc_ << std::endl << std::endl; 64 } 65 } 61 void Skybox::setSkyboxSrc(const std::string& src) 62 { 63 this->skyboxSrc_ = src; 64 } 66 65 67 void Skybox::setSkybox(const std::string& skyboxname)68 {69 GraphicsEngine::getSingleton().getSceneManager()->setSkyBox(true, skyboxname);70 }71 72 void Skybox::setSkyboxSrc(const std::string& src){73 skyboxSrc_ = src;74 }75 76 66 /** 77 67 @brief XML loading and saving. … … 87 77 create(); 88 78 } 89 90 bool Skybox::create(){ 91 this->setSkybox(skyboxSrc_); 92 return Synchronisable::create(); 79 80 bool Skybox::create() 81 { 82 this->setSkybox(this->skyboxSrc_); 83 return Synchronisable::create(); 93 84 } 94 95 void Skybox::registerAllVariables(){ 96 registerVar(&skyboxSrc_, skyboxSrc_.length()+1 ,network::STRING); 85 86 void Skybox::registerAllVariables() 87 { 88 registerVar(&skyboxSrc_, skyboxSrc_.length()+1 ,network::STRING); 97 89 } 98 90 91 void Skybox::changedVisibility() 92 { 93 BaseObject::changedVisibility(); 94 GraphicsEngine::getSingleton().getSceneManager()->setSkyBox(this->isVisible(), this->skyboxSrc_); 95 } 99 96 } -
code/trunk/src/orxonox/objects/Skybox.h
r1505 r1558 43 43 virtual ~Skybox(); 44 44 45 void loadParams(TiXmlElement* xmlElem);46 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 virtual void changedVisibility(); 47 47 void setSkybox(const std::string& skyboxname); 48 48 49 49 virtual bool create(); 50 50 void registerAllVariables(); -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1553 r1558 251 251 } 252 252 253 void SpaceShip::changedVisibility() 254 { 255 Model::changedVisibility(); 256 257 this->tt1_->setEnabled(this->isVisible()); 258 this->tt2_->setEnabled(this->isVisible()); 259 this->redBillboard_.setVisible(this->isVisible()); 260 this->greenBillboard_.setVisible(this->isVisible()); 261 this->crosshairNear_.setVisible(this->isVisible()); 262 this->crosshairFar_.setVisible(this->isVisible()); 263 } 264 265 void SpaceShip::changedActivity() 266 { 267 Model::changedActivity(); 268 269 this->tt1_->setEnabled(this->isVisible()); 270 this->tt2_->setEnabled(this->isVisible()); 271 this->redBillboard_.setVisible(this->isVisible()); 272 this->greenBillboard_.setVisible(this->isVisible()); 273 this->crosshairNear_.setVisible(this->isVisible()); 274 this->crosshairFar_.setVisible(this->isVisible()); 275 } 276 253 277 void SpaceShip::setCamera(const std::string& camera) 254 278 { … … 347 371 void SpaceShip::tick(float dt) 348 372 { 373 if (!this->isActive()) 374 return; 375 349 376 currentDir_ = getOrientation()*initialDir_; 350 377 currentOrth_ = getOrientation()*initialOrth_; -
code/trunk/src/orxonox/objects/SpaceShip.h
r1552 r1558 53 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 54 virtual void tick(float dt); 55 virtual void changedVisibility(); 56 virtual void changedActivity(); 55 57 56 58 void setCamera(const std::string& camera = ""); -
code/trunk/src/orxonox/objects/SpaceShipAI.cc
r1553 r1558 208 208 void SpaceShipAI::tick(float dt) 209 209 { 210 if (!this->isActive()) 211 return; 212 210 213 if (this->target_) 211 214 this->aimAtTarget(); -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1552 r1558 80 80 void WorldEntity::tick(float dt) 81 81 { 82 if (!this->bStatic_ )82 if (!this->bStatic_ && this->isActive()) 83 83 { 84 84 // COUT(4) << "acceleration: " << this->acceleration_ << " velocity: " << this->velocity_ << std::endl; … … 132 132 void WorldEntity::registerAllVariables() 133 133 { 134 // register inheritec variables from BaseObject 135 registerVar( (void*) &(this->bActive_), sizeof(this->bActive_), network::DATA, 0x3); 136 registerVar( (void*) &(this->bVisible_), sizeof(this->bVisible_), network::DATA, 0x3); 134 137 // register coordinates 135 138 registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA, 0x3); -
code/trunk/src/orxonox/tools/BillboardSet.h
r1505 r1558 33 33 34 34 #include <string> 35 #include <OgreBillboardSet.h> 35 36 36 #include <OgreBillboardSet.h>37 37 #include "util/Math.h" 38 38 … … 52 52 { return this->billboardSet_->getName(); } 53 53 54 inline void setVisible(bool visible) 55 { this->billboardSet_->setVisible(visible); } 56 inline bool getVisible() const 57 { return this->billboardSet_->getVisible(); } 58 54 59 private: 55 60 static unsigned int billboardSetCounter_s; -
code/trunk/src/orxonox/tools/Mesh.h
r1505 r1558 51 51 { return this->entity_->getName(); } 52 52 53 inline void setVisible(bool visible) 54 { this->entity_->setVisible(visible); } 55 inline bool getVisible() const 56 { return this->entity_->getVisible(); } 57 53 58 private: 54 59 static unsigned int meshCounter_s;
Note: See TracChangeset
for help on using the changeset viewer.