Changeset 1592 for code/branches/core3/src/orxonox/objects
- Timestamp:
- Jun 12, 2008, 4:32:10 AM (16 years ago)
- Location:
- code/branches/core3/src/orxonox/objects
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/orxonox/objects/Ambient.cc
r1586 r1592 64 64 } 65 65 66 bool Ambient::create(){ 67 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_); 68 return Synchronisable::create(); 66 bool Ambient::create() 67 { 68 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_); 69 return Synchronisable::create(); 69 70 } 70 71 71 void Ambient::registerAllVariables() {72 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);73 72 void Ambient::registerAllVariables() 73 { 74 registerVar(&ambientLight_, sizeof(ColourValue), network::DATA); 74 75 } 75 76 76 void Ambient:: loadParams(TiXmlElement* xmlElem)77 void Ambient::setAmbientLight(const ColourValue& colour) 77 78 { 78 if (xmlElem->Attribute("colourvalue")) 79 { 80 SubString colourvalues(xmlElem->Attribute("colourvalue"), ','); 81 82 float r, g, b; 83 convertValue<std::string, float>(&r, colourvalues[0]); 84 convertValue<std::string, float>(&g, colourvalues[1]); 85 convertValue<std::string, float>(&b, colourvalues[2]); 86 87 this->setAmbientLight(ColourValue(r, g, b)); 88 89 COUT(4) << "Loader: Set ambient light: "<<r<<" " << g << " " << b << std::endl << std::endl; 90 } 91 } 92 93 void Ambient::setAmbientLight(const ColourValue& colour) 94 { 95 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour); 96 ambientLight_=colour; 97 } 79 GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour); 80 ambientLight_=colour; 81 } 98 82 99 83 /** … … 107 91 BaseObject::XMLPort(xmlelement, mode); 108 92 109 XMLPortParam LoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);93 XMLPortParam(Ambient, "colourvalue", setAmbientLight, getAmbienetLight, xmlelement, mode); 110 94 create(); 111 95 } -
code/branches/core3/src/orxonox/objects/Ambient.h
r1505 r1592 44 44 virtual ~Ambient(); 45 45 46 void loadParams(TiXmlElement* xmlElem);47 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 void setAmbientLight(const ColourValue& colour);49 47 virtual bool create(); 50 48 void registerAllVariables(); 49 50 void setAmbientLight(const ColourValue& colour); 51 inline const ColourValue& getAmbienetLight() const 52 { return this->ambientLight_; } 51 53 52 54 static void setAmbientLightTest(const ColourValue& colour) -
code/branches/core3/src/orxonox/objects/Model.cc
r1559 r1592 68 68 WorldEntity::XMLPort(xmlelement, mode); 69 69 70 XMLPortParam LoadOnly(Model, "mesh", setMesh, xmlelement, mode);70 XMLPortParam(Model, "mesh", setMesh, getMesh, xmlelement, mode); 71 71 72 72 Model::create(); 73 }74 75 void Model::setMesh(const std::string& meshname)76 {77 this->meshSrc_ = meshname;78 73 } 79 74 -
code/branches/core3/src/orxonox/objects/Model.h
r1558 r1592 45 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 46 virtual void changedVisibility(); 47 void setMesh(const std::string& meshname); 47 inline void setMesh(const std::string& meshname) 48 { this->meshSrc_ = meshname; } 49 inline const std::string& getMesh() const 50 { return this->meshSrc_; } 48 51 virtual bool create(); 49 52 -
code/branches/core3/src/orxonox/objects/NPC.cc
r1591 r1592 46 46 NPC::~NPC() 47 47 { 48 }49 50 void NPC::loadParams(TiXmlElement* xmlElem)51 {52 Model::loadParams(xmlElem);53 48 } 54 49 -
code/branches/core3/src/orxonox/objects/NPC.h
r1505 r1592 48 48 NPC(); 49 49 virtual ~NPC(); 50 virtual void loadParams(TiXmlElement* xmlElem);51 50 void tick(float dt); 52 51 void update(); -
code/branches/core3/src/orxonox/objects/Projectile.cc
r1591 r1592 92 92 if ((*it) != this->owner_) 93 93 { 94 radius = it->getScale ().x * 3.0;94 radius = it->getScale3D().x * 3.0; 95 95 96 96 if (this->getPosition().squaredDistance(it->getPosition()) <= (radius*radius)) -
code/branches/core3/src/orxonox/objects/Skybox.cc
r1586 r1592 59 59 } 60 60 61 void Skybox::setSkyboxSrc(const std::string& src)62 {63 this->skyboxSrc_ = src;64 }65 66 61 /** 67 62 @brief XML loading and saving. … … 74 69 BaseObject::XMLPort(xmlelement, mode); 75 70 76 XMLPortParam LoadOnly(Skybox, "src", setSkyboxSrc, xmlelement, mode);71 XMLPortParam(Skybox, "src", setSkyboxSrc, getSkyboxSrc, xmlelement, mode); 77 72 create(); 78 73 } -
code/branches/core3/src/orxonox/objects/Skybox.h
r1558 r1592 49 49 virtual bool create(); 50 50 void registerAllVariables(); 51 void setSkyboxSrc(const std::string &src); 51 52 inline void setSkyboxSrc(const std::string &src) 53 { this->skyboxSrc_ = src; } 54 inline const std::string& getSkyboxSrc() const 55 { return this->skyboxSrc_; } 52 56 53 57 private: -
code/branches/core3/src/orxonox/objects/SpaceShip.cc
r1591 r1592 347 347 Model::XMLPort(xmlelement, mode); 348 348 349 XMLPortParam LoadOnly(SpaceShip, "camera", setCamera, xmlelement, mode);350 XMLPortParam LoadOnly(SpaceShip, "maxSpeed", setMaxSpeed, xmlelement, mode);351 XMLPortParam LoadOnly(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, xmlelement, mode);352 XMLPortParam LoadOnly(SpaceShip, "maxRotation", setMaxRotation, xmlelement, mode);353 XMLPortParam LoadOnly(SpaceShip, "transAcc", setTransAcc, xmlelement, mode);354 XMLPortParam LoadOnly(SpaceShip, "rotAcc", setRotAcc, xmlelement, mode);355 XMLPortParam LoadOnly(SpaceShip, "transDamp", setTransDamp, xmlelement, mode);356 XMLPortParam LoadOnly(SpaceShip, "rotDamp", setRotDamp, xmlelement, mode);349 XMLPortParam(SpaceShip, "camera", setCamera, getCamera, xmlelement, mode); 350 XMLPortParam(SpaceShip, "maxSpeed", setMaxSpeed, getMaxSpeed, xmlelement, mode); 351 XMLPortParam(SpaceShip, "maxSideAndBackSpeed", setMaxSideAndBackSpeed, getMaxSideAndBackSpeed, xmlelement, mode); 352 XMLPortParam(SpaceShip, "maxRotation", setMaxRotation, getMaxRotation, xmlelement, mode); 353 XMLPortParam(SpaceShip, "transAcc", setTransAcc, getTransAcc, xmlelement, mode); 354 XMLPortParam(SpaceShip, "rotAcc", setRotAcc, getRotAcc, xmlelement, mode); 355 XMLPortParam(SpaceShip, "transDamp", setTransDamp, getTransDamp, xmlelement, mode); 356 XMLPortParam(SpaceShip, "rotDamp", setRotDamp, getRotDamp, xmlelement, mode); 357 357 358 358 SpaceShip::create(); -
code/branches/core3/src/orxonox/objects/WorldEntity.cc
r1559 r1592 95 95 } 96 96 97 void WorldEntity::loadParams(TiXmlElement* xmlElem)98 {99 100 BaseObject::loadParams(xmlElem);101 create();102 }103 104 105 97 void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll) 106 98 { … … 120 112 BaseObject::XMLPort(xmlelement, mode); 121 113 122 XMLPortParam (WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, mode);123 XMLPortParamLoadOnly(WorldEntity, "direction", setDirection Loader, xmlelement, mode);114 XMLPortParamExternTemplate(Ogre::Node, this->node_, "position", setPosition, getPosition, xmlelement, mode, Ogre::Node, const Vector3&); 115 XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionSimple, xmlelement, mode); 124 116 XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, mode); 125 XMLPortParam(WorldEntity, "scale", set TotalScale, getScale, xmlelement, mode);126 XMLPortParam (WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, mode);117 XMLPortParam(WorldEntity, "scale", setScale, getScale, xmlelement, mode); 118 XMLPortParamTemplate(WorldEntity, "rotationAxis", setRotationAxis, getRotationAxis, xmlelement, mode, WorldEntity, const Vector3&); 127 119 XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, mode); 128 120 … … 157 149 registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA, 0x3); 158 150 // register scale of node 159 registerVar( (void*) &(this->getScale ().x), sizeof(this->getScale().x), network::DATA, 0x3);160 registerVar( (void*) &(this->getScale ().y), sizeof(this->getScale().y), network::DATA, 0x3);161 registerVar( (void*) &(this->getScale ().z), sizeof(this->getScale().z), network::DATA, 0x3);151 registerVar( (void*) &(this->getScale3D().x), sizeof(this->getScale3D().x), network::DATA, 0x3); 152 registerVar( (void*) &(this->getScale3D().y), sizeof(this->getScale3D().y), network::DATA, 0x3); 153 registerVar( (void*) &(this->getScale3D().z), sizeof(this->getScale3D().z), network::DATA, 0x3); 162 154 //register staticity 163 155 registerVar( (void*) &(this->bStatic_), sizeof(this->bStatic_), network::DATA, 0x3); -
code/branches/core3/src/orxonox/objects/WorldEntity.h
r1535 r1592 51 51 52 52 virtual void tick(float dt); 53 virtual void loadParams(TiXmlElement* xmlElem);54 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 55 54 virtual inline bool create(){ return Synchronisable::create(); } … … 66 65 inline void setPosition(const Vector3& pos) 67 66 { this->node_->setPosition(pos); } 68 inline void setPositionLoader1(const Vector3& pos)69 { this->node_->setPosition(pos); }70 inline void setPositionLoader2(Real x, Real y, Real z)71 { this->node_->setPosition(x, y, z); }72 67 inline void setPosition(Real x, Real y, Real z) 73 68 { this->node_->setPosition(x, y, z); } … … 105 100 inline void rotate(const Vector3 &axis, const Radian &angle, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL) 106 101 { this->node_->rotate(axis, angle, relativeTo); } 107 inline void setDirection Loader(Real x, Real y, Real z)102 inline void setDirectionSimple(Real x, Real y, Real z) 108 103 { this->setDirection(x, y, z); } 109 104 inline void setDirection(Real x, Real y, Real z, Ogre::Node::TransformSpace relativeTo=Ogre::Node::TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) … … 114 109 { this->node_->lookAt(targetPoint, relativeTo, localDirectionVector); } 115 110 116 inline void setScale (const Vector3 &scale)111 inline void setScale3D(const Vector3 &scale) 117 112 { this->node_->setScale(scale); } 118 inline void setScale (Real x, Real y, Real z)113 inline void setScale3D(Real x, Real y, Real z) 119 114 { this->node_->setScale(x, y, z); } 120 inline void setScale(Real scale) 115 inline const Vector3& getScale3D(void) const 116 { return this->node_->getScale(); } 117 inline void setScale(float scale) 121 118 { this->node_->setScale(scale, scale, scale); } 122 inline void setTotalScale(Real scale) 123 { this->node_->setScale(scale, scale, scale); } 124 inline const Vector3& getScale(void) const 125 { return this->node_->getScale(); } 126 inline void scale(const Vector3 &scale) 119 inline float getScale() const 120 { Vector3 scale = this->getScale3D(); return (scale.x == scale.y && scale.x == scale.z) ? scale.x : 1; } 121 inline void scale3D(const Vector3 &scale) 127 122 { this->node_->scale(scale); } 128 inline void scale (Real x, Real y, Real z)123 inline void scale3D(Real x, Real y, Real z) 129 124 { this->node_->scale(x, y, z); } 130 125 inline void scale(Real scale) … … 154 149 { return this->acceleration_; } 155 150 156 inline void setRotationAxisLoader(const Vector3& axis)157 { this->rotationAxis_ = axis; rotationAxis_.normalise(); }158 151 inline void setRotationAxis(const Vector3& axis) 159 { this->rotationAxis_ = axis; rotationAxis_.normalise(); }152 { this->rotationAxis_ = axis; this->rotationAxis_.normalise(); } 160 153 inline void setRotationAxis(Real x, Real y, Real z) 161 154 { this->rotationAxis_.x = x; this->rotationAxis_.y = y; this->rotationAxis_.z = z; rotationAxis_.normalise(); }
Note: See TracChangeset
for help on using the changeset viewer.