Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 14, 2008, 3:42:49 AM (17 years ago)
Author:
landauf
Message:

merged core2 back to trunk
there might be some errors, wasn't able to test it yet due to some strange g++ and linker behaviour.

Location:
code/trunk/src/orxonox/objects
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/objects/Ambient.cc

    r1039 r1052  
    4242#include "GraphicsEngine.h"
    4343#include "core/XMLPort.h"
     44#include "core/ConsoleCommand.h"
    4445
    4546namespace orxonox
    4647{
     48    ConsoleCommand(Ambient, setAmbientLightTest, AccessLevel::Offline, false).setDefaultValues(ColourValue(1, 1, 1, 1));
     49
    4750    CreateFactory(Ambient);
     51
     52    Ambient* Ambient::instance_s;
    4853
    4954    Ambient::Ambient()
    5055    {
    5156        RegisterObject(Ambient);
     57        Ambient::instance_s = this;
    5258    }
    5359
     
    8490        @return The XML-element
    8591    */
    86     void Ambient::XMLPort(Element& xmlelement, bool loading)
     92    void Ambient::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    8793    {
    88         BaseObject::XMLPort(xmlelement, loading);
     94        BaseObject::XMLPort(xmlelement, mode);
    8995
    90         XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, loading);
     96        XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);
    9197    }
    9298}
  • code/trunk/src/orxonox/objects/Ambient.h

    r1040 r1052  
    4343
    4444            void loadParams(TiXmlElement* xmlElem);
    45             virtual void XMLPort(Element& xmlelement, bool loading);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4646            void setAmbientLight(const ColourValue& colour);
    4747
     48            static void setAmbientLightTest(const ColourValue& colour)
     49                { Ambient::instance_s->setAmbientLight(colour); }
     50
    4851        private:
    49 
     52            static Ambient* instance_s;
    5053
    5154    };
  • code/trunk/src/orxonox/objects/Explosion.cc

    r1039 r1052  
    3434
    3535#include "core/CoreIncludes.h"
     36#include "core/Executor.h"
     37
    3638#include "util/Math.h"
    3739#include "GraphicsEngine.h"
     
    5153        if (owner)
    5254        {
    53             this->destroyTimer_.setTimer(this->lifetime_, false, this, &Explosion::destroyObject);
     55            this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Explosion::destroyObject)));
    5456
    5557            Vector3 position = owner->getNode()->getWorldPosition();
  • code/trunk/src/orxonox/objects/Model.cc

    r1039 r1052  
    6868        @return The XML-element
    6969    */
    70     void Model::XMLPort(Element& xmlelement, bool loading)
     70    void Model::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7171    {
    72         WorldEntity::XMLPort(xmlelement, loading);
     72        WorldEntity::XMLPort(xmlelement, mode);
    7373
    74         XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, loading);
     74        XMLPortParamLoadOnly(Model, "mesh", setMesh, xmlelement, mode);
    7575
    7676        create();
     
    8484    bool Model::create(){
    8585      WorldEntity::create();
    86       if(meshSrc_.compare("")!=0){
     86      if ((this->meshSrc_ != "") && (this->meshSrc_.size() > 0))
     87      {
    8788        this->mesh_.setMesh(meshSrc_);
    8889        this->attachObject(this->mesh_.getEntity());
  • code/trunk/src/orxonox/objects/Model.h

    r1039 r1052  
    4343            virtual ~Model();
    4444            virtual void loadParams(TiXmlElement* xmlElem);
    45             virtual void XMLPort(Element& xmlelement, bool loading);
     45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4646            void setMesh(const std::string& meshname);
    4747            bool create();
  • code/trunk/src/orxonox/objects/Projectile.cc

    r1039 r1052  
    2929#include "Projectile.h"
    3030
    31 #include "../core/CoreIncludes.h"
     31#include "core/CoreIncludes.h"
     32#include "core/Executor.h"
     33#include "core/ConfigValueIncludes.h"
     34
    3235#include "SpaceShip.h"
    3336#include "Explosion.h"
     
    5962        }
    6063
    61         this->destroyTimer_.setTimer(this->lifetime_, false, this, &Projectile::destroyObject);
     64        this->destroyTimer_.setTimer(this->lifetime_, false, this, createExecutor(createFunctor(&Projectile::destroyObject)));
    6265    }
    6366
     
    7073        SetConfigValue(lifetime_, 10.0).description("The time in seconds a projectile stays alive");
    7174        SetConfigValue(speed_, 2000.0).description("The speed of a projectile in units per second");
     75
     76        this->setVelocity(Vector3(1, 0, 0) * this->speed_);
    7277    }
    7378
  • code/trunk/src/orxonox/objects/Skybox.cc

    r1039 r1052  
    7676        @return The XML-element
    7777    */
    78     void Skybox::XMLPort(Element& xmlelement, bool loading)
     78    void Skybox::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    7979    {
    80         BaseObject::XMLPort(xmlelement, loading);
     80        BaseObject::XMLPort(xmlelement, mode);
    8181
    82         XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, loading);
     82        XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, mode);
    8383    }
    8484}
  • code/trunk/src/orxonox/objects/Skybox.h

    r1039 r1052  
    1515
    1616            void loadParams(TiXmlElement* xmlElem);
    17             virtual void XMLPort(Element& xmlelement, bool loading);
     17            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    1818            void setSkybox(const std::string& skyboxname);
    1919
  • code/trunk/src/orxonox/objects/SpaceShip.cc

    r1039 r1052  
    4141#include "util/Math.h"
    4242#include "core/CoreIncludes.h"
     43#include "core/ConfigValueIncludes.h"
    4344#include "core/Debug.h"
    4445#include "GraphicsEngine.h"
     
    4748#include "Projectile.h"
    4849#include "core/XMLPort.h"
     50#include "core/ConsoleCommand.h"
    4951
    5052namespace orxonox
    5153{
     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
    5259    CreateFactory(SpaceShip);
     60
     61    SpaceShip* SpaceShip::instance_s;
    5362
    5463    SpaceShip::SpaceShip()
     
    5665        RegisterObject(SpaceShip);
    5766        this->registerAllVariables();
     67
     68        SpaceShip::instance_s = this;
    5869
    5970        this->setConfigValues();
     
    309320        @return The XML-element
    310321    */
    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);
    323334    }
    324335
  • code/trunk/src/orxonox/objects/SpaceShip.h

    r1039 r1052  
    4949            void setConfigValues();
    5050            virtual void loadParams(TiXmlElement* xmlElem);
    51             virtual void XMLPort(Element& xmlelement, bool loading);
     51            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5252            virtual void tick(float dt);
    5353
     
    6161            void setRotDamp(float value);
    6262
     63            static void setMaxSpeedTest(float value)
     64                { SpaceShip::instance_s->setMaxSpeed(value); }
     65
    6366            bool mouseMoved(const OIS::MouseEvent &e);
    6467            bool mousePressed(const OIS::MouseEvent &e, OIS::MouseButtonID id);
     
    6770
    6871        private:
     72            static SpaceShip* instance_s;
     73
    6974            Vector3 testvector_;
    7075            bool bInvertYAxis_;
  • code/trunk/src/orxonox/objects/WorldEntity.cc

    r1039 r1052  
    176176        @return The XML-element
    177177    */
    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);
    190190    }
    191191
     
    219219    }
    220220
    221     const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index)
     221    const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index) const
    222222    {
    223223        if (index < this->attachedWorldEntities_.size())
  • code/trunk/src/orxonox/objects/WorldEntity.h

    r1039 r1052  
    5151            virtual void tick(float dt);
    5252            virtual void loadParams(TiXmlElement* xmlElem);
    53             virtual void XMLPort(Element& xmlelement, bool loading);
     53            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    5454            inline bool create(){ return true; }
    5555
    5656            void attachWorldEntity(WorldEntity* entity);
    57             const WorldEntity* getAttachedWorldEntity(unsigned int index);
     57            const WorldEntity* getAttachedWorldEntity(unsigned int index) const;
    5858
    5959            inline Ogre::SceneNode* getNode()
Note: See TracChangeset for help on using the changeset viewer.