Changeset 1052 for code/trunk/src/orxonox/objects
- Timestamp:
- Apr 14, 2008, 3:42:49 AM (17 years ago)
- Location:
- code/trunk/src/orxonox/objects
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/Ambient.cc
r1039 r1052 42 42 #include "GraphicsEngine.h" 43 43 #include "core/XMLPort.h" 44 #include "core/ConsoleCommand.h" 44 45 45 46 namespace orxonox 46 47 { 48 ConsoleCommand(Ambient, setAmbientLightTest, AccessLevel::Offline, false).setDefaultValues(ColourValue(1, 1, 1, 1)); 49 47 50 CreateFactory(Ambient); 51 52 Ambient* Ambient::instance_s; 48 53 49 54 Ambient::Ambient() 50 55 { 51 56 RegisterObject(Ambient); 57 Ambient::instance_s = this; 52 58 } 53 59 … … 84 90 @return The XML-element 85 91 */ 86 void Ambient::XMLPort(Element& xmlelement, bool loading)92 void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode) 87 93 { 88 BaseObject::XMLPort(xmlelement, loading);94 BaseObject::XMLPort(xmlelement, mode); 89 95 90 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, loading);96 XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode); 91 97 } 92 98 } -
code/trunk/src/orxonox/objects/Ambient.h
r1040 r1052 43 43 44 44 void loadParams(TiXmlElement* xmlElem); 45 virtual void XMLPort(Element& xmlelement, bool loading);45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 void setAmbientLight(const ColourValue& colour); 47 47 48 static void setAmbientLightTest(const ColourValue& colour) 49 { Ambient::instance_s->setAmbientLight(colour); } 50 48 51 private: 49 52 static Ambient* instance_s; 50 53 51 54 }; -
code/trunk/src/orxonox/objects/Explosion.cc
r1039 r1052 34 34 35 35 #include "core/CoreIncludes.h" 36 #include "core/Executor.h" 37 36 38 #include "util/Math.h" 37 39 #include "GraphicsEngine.h" … … 51 53 if (owner) 52 54 { 53 this->destroyTimer_.setTimer(this->lifetime_, false, this, &Explosion::destroyObject);55 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Explosion::destroyObject))); 54 56 55 57 Vector3 position = owner->getNode()->getWorldPosition(); -
code/trunk/src/orxonox/objects/Model.cc
r1039 r1052 68 68 @return The XML-element 69 69 */ 70 void Model::XMLPort(Element& xmlelement, bool loading)70 void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode) 71 71 { 72 WorldEntity::XMLPort(xmlelement, loading);72 WorldEntity::XMLPort(xmlelement, mode); 73 73 74 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, loading);74 XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, mode); 75 75 76 76 create(); … … 84 84 bool Model::create(){ 85 85 WorldEntity::create(); 86 if(meshSrc_.compare("")!=0){ 86 if ((this->meshSrc_ != "") && (this->meshSrc_.size() > 0)) 87 { 87 88 this->mesh_.setMesh(meshSrc_); 88 89 this->attachObject(this->mesh_.getEntity()); -
code/trunk/src/orxonox/objects/Model.h
r1039 r1052 43 43 virtual ~Model(); 44 44 virtual void loadParams(TiXmlElement* xmlElem); 45 virtual void XMLPort(Element& xmlelement, bool loading);45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 void setMesh(const std::string& meshname); 47 47 bool create(); -
code/trunk/src/orxonox/objects/Projectile.cc
r1039 r1052 29 29 #include "Projectile.h" 30 30 31 #include "../core/CoreIncludes.h" 31 #include "core/CoreIncludes.h" 32 #include "core/Executor.h" 33 #include "core/ConfigValueIncludes.h" 34 32 35 #include "SpaceShip.h" 33 36 #include "Explosion.h" … … 59 62 } 60 63 61 this->destroyTimer_.setTimer(this->lifetime_, false, this, &Projectile::destroyObject);64 this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject))); 62 65 } 63 66 … … 70 73 SetConfigValue(lifetime_, 10.0).description("The time in seconds a projectile stays alive"); 71 74 SetConfigValue(speed_, 2000.0).description("The speed of a projectile in units per second"); 75 76 this->setVelocity(Vector3(1, 0, 0) * this->speed_); 72 77 } 73 78 -
code/trunk/src/orxonox/objects/Skybox.cc
r1039 r1052 76 76 @return The XML-element 77 77 */ 78 void Skybox::XMLPort(Element& xmlelement, bool loading)78 void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode) 79 79 { 80 BaseObject::XMLPort(xmlelement, loading);80 BaseObject::XMLPort(xmlelement, mode); 81 81 82 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, loading);82 XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, mode); 83 83 } 84 84 } -
code/trunk/src/orxonox/objects/Skybox.h
r1039 r1052 15 15 16 16 void loadParams(TiXmlElement* xmlElem); 17 virtual void XMLPort(Element& xmlelement, bool loading);17 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 18 18 void setSkybox(const std::string& skyboxname); 19 19 -
code/trunk/src/orxonox/objects/SpaceShip.cc
r1039 r1052 41 41 #include "util/Math.h" 42 42 #include "core/CoreIncludes.h" 43 #include "core/ConfigValueIncludes.h" 43 44 #include "core/Debug.h" 44 45 #include "GraphicsEngine.h" … … 47 48 #include "Projectile.h" 48 49 #include "core/XMLPort.h" 50 #include "core/ConsoleCommand.h" 49 51 50 52 namespace orxonox 51 53 { 54 ConsoleCommand(SpaceShip, setMaxSpeedTest, AccessLevel::Debug, false); 55 ConsoleCommandGeneric(test1, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxSpeed", AccessLevel::Debug), false); 56 ConsoleCommandGeneric(test2, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setMaxBlubber", AccessLevel::Debug), false); 57 ConsoleCommandGeneric(test3, SpaceShip, createExecutor(createFunctor(&SpaceShip::setMaxSpeedTest), "setRofl", AccessLevel::Debug), false); 58 52 59 CreateFactory(SpaceShip); 60 61 SpaceShip* SpaceShip::instance_s; 53 62 54 63 SpaceShip::SpaceShip() … … 56 65 RegisterObject(SpaceShip); 57 66 this->registerAllVariables(); 67 68 SpaceShip::instance_s = this; 58 69 59 70 this->setConfigValues(); … … 309 320 @return The XML-element 310 321 */ 311 void SpaceShip::XMLPort(Element& xmlelement, bool loading)312 { 313 Model::XMLPort(xmlelement, loading);314 315 XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, loading);316 XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, loading);317 XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, loading);318 XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, loading);319 XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, loading);320 XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, loading);321 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, loading);322 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, loading);322 void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) 323 { 324 Model::XMLPort(xmlelement, mode); 325 326 XMLPortParamLoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode); 327 XMLPortParamLoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode); 328 XMLPortParamLoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode); 329 XMLPortParamLoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode); 330 XMLPortParamLoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode); 331 XMLPortParamLoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode); 332 XMLPortParamLoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode); 333 XMLPortParamLoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode); 323 334 } 324 335 -
code/trunk/src/orxonox/objects/SpaceShip.h
r1039 r1052 49 49 void setConfigValues(); 50 50 virtual void loadParams(TiXmlElement* xmlElem); 51 virtual void XMLPort(Element& xmlelement, bool loading);51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 52 52 virtual void tick(float dt); 53 53 … … 61 61 void setRotDamp(float value); 62 62 63 static void setMaxSpeedTest(float value) 64 { SpaceShip::instance_s->setMaxSpeed(value); } 65 63 66 bool mouseMoved(const OIS::MouseEvent &e); 64 67 bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id); … … 67 70 68 71 private: 72 static SpaceShip* instance_s; 73 69 74 Vector3 testvector_; 70 75 bool bInvertYAxis_; -
code/trunk/src/orxonox/objects/WorldEntity.cc
r1039 r1052 176 176 @return The XML-element 177 177 */ 178 void WorldEntity::XMLPort(Element& xmlelement, bool loading)179 { 180 BaseObject::XMLPort(xmlelement, loading);181 182 XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, loading);183 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, loading);184 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, loading);185 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading);186 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, loading);187 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading);188 189 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading);178 void WorldEntity::XMLPort(Element& xmlelement, XMLPort::Mode mode) 179 { 180 BaseObject::XMLPort(xmlelement, mode); 181 182 XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, mode); 183 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, mode); 184 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, mode); 185 XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, mode); 186 XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, mode); 187 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode); 188 189 XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true); 190 190 } 191 191 … … 219 219 } 220 220 221 const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index) 221 const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index) const 222 222 { 223 223 if (index < this->attachedWorldEntities_.size()) -
code/trunk/src/orxonox/objects/WorldEntity.h
r1039 r1052 51 51 virtual void tick(float dt); 52 52 virtual void loadParams(TiXmlElement* xmlElem); 53 virtual void XMLPort(Element& xmlelement, bool loading);53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 54 inline bool create(){ return true; } 55 55 56 56 void attachWorldEntity(WorldEntity* entity); 57 const WorldEntity* getAttachedWorldEntity(unsigned int index) ;57 const WorldEntity* getAttachedWorldEntity(unsigned int index) const; 58 58 59 59 inline Ogre::SceneNode* getNode()
Note: See TracChangeset
for help on using the changeset viewer.