Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1174


Ignore:
Timestamp:
Apr 24, 2008, 3:43:59 PM (16 years ago)
Author:
scheusso
Message:

made objects synchronisable

Location:
code/branches/network3/src/orxonox/objects
Files:
8 edited

Legend:

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

    r1064 r1174  
    5757        RegisterObject(Ambient);
    5858        Ambient::instance_s = this;
     59        registerAllVariables();
    5960    }
    6061
     
    6364    }
    6465
     66    bool Ambient::create(){
     67      GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(ambientLight_);
     68      return true;
     69    }
     70   
     71    void Ambient::registerAllVariables(){
     72      registerVar(&ambientLight_, sizeof(ColourValue), network::DATA);
     73     
     74    }
     75   
    6576    void Ambient::loadParams(TiXmlElement* xmlElem)
    6677    {
     
    8394   {
    8495        GraphicsEngine::getSingleton().getSceneManager()->setAmbientLight(colour);
     96      ambientLight_=colour;     
    8597   }
    8698
     
    96108
    97109        XMLPortParamLoadOnly(Ambient, "colourvalue", setAmbientLight, xmlelement, mode);
     110        create();
    98111    }
    99112}
  • code/branches/network3/src/orxonox/objects/Ambient.h

    r1056 r1174  
    3434#include "util/Math.h"
    3535#include "core/BaseObject.h"
     36#include "network/Synchronisable.h"
    3637
    3738namespace orxonox
    3839{
    39     class _OrxonoxExport Ambient : public BaseObject
     40    class _OrxonoxExport Ambient : public BaseObject, network::Synchronisable
    4041    {
    4142        public:
     
    4647            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4748            void setAmbientLight(const ColourValue& colour);
     49            bool create();
     50            void registerAllVariables();
    4851
    4952            static void setAmbientLightTest(const ColourValue& colour)
     
    5255        private:
    5356            static Ambient* instance_s;
     57            ColourValue ambientLight_;
    5458
    5559    };
  • code/branches/network3/src/orxonox/objects/Model.cc

    r1064 r1174  
    8282
    8383    bool Model::create(){
    84       WorldEntity::create();
     84      if(!WorldEntity::create())
     85        return false;
    8586      if ((this->meshSrc_ != "") && (this->meshSrc_.size() > 0))
    8687      {
    8788        this->mesh_.setMesh(meshSrc_);
    8889        this->attachObject(this->mesh_.getEntity());
    89         COUT(4) << "Loader: Created model" << std::endl;
     90        COUT(4) << "Loader (Model.cc): Created model" << std::endl;
    9091      }
    9192      return true;
     
    9394
    9495    void Model::registerAllVariables(){
    95       WorldEntity::registerAllVariables();
     96//       WorldEntity::registerAllVariables();
     97      COUT(5) << "Model.cc:registering new meshsrc with size: " << meshSrc_.length()+1 << " this: " << this << std::endl;
    9698      registerVar(&meshSrc_, meshSrc_.length() + 1, network::STRING);
    9799    }
  • code/branches/network3/src/orxonox/objects/NPC.cc

    r1056 r1174  
    4040    RegisterObject(NPC);
    4141    movable_ = true;
     42    registerAllVariables();
    4243  }
    4344
     
    5960    this->translate(location);
    6061    movable_ = movable;
     62  }
     63 
     64  void NPC::registerAllVariables(){
     65    Model::registerAllVariables();
     66    registerVar(&movable_, sizeof(movable_), network::DATA);
     67  }
     68 
     69  bool NPC::create(){
     70    Model::create();
     71    return true;
    6172  }
    6273
  • code/branches/network3/src/orxonox/objects/NPC.h

    r1056 r1174  
    5252      void update();
    5353      void setValues(Vector3 location, Vector3 speed, Vector3 acceleration, bool movable);
     54      void registerAllVariables();
     55      bool create();
    5456
    5557    private:
  • code/branches/network3/src/orxonox/objects/Skybox.cc

    r1064 r1174  
    4747    {
    4848        RegisterObject(Skybox);
     49        registerAllVariables();
    4950    }
    5051
     
    5758        if (xmlElem->Attribute("src"))
    5859        {
    59                 std::string skyboxSrc = xmlElem->Attribute("src");
    60                 this->setSkybox(skyboxSrc);
     60                skyboxSrc_ = xmlElem->Attribute("src");
     61        this->create();
    6162
    62                 COUT(4) << "Loader: Set skybox: "<< skyboxSrc << std::endl << std::endl;
     63                COUT(4) << "Loader: Set skybox: "<< skyboxSrc_ << std::endl << std::endl;
    6364        }
    6465   }
     
    6970   }
    7071
     72   void Skybox::setSkyboxSrc(std::string src){
     73     skyboxSrc_ = src;
     74   }
     75   
    7176    /**
    7277        @brief XML loading and saving.
     
    8085
    8186        XMLPortParamLoadOnly(Skybox, "src", setSkybox, xmlelement, mode);
     87        create();
    8288    }
     89   
     90    bool Skybox::create(){
     91      this->setSkybox(skyboxSrc_);
     92      return true;
     93    }
     94   
     95    void Skybox::registerAllVariables(){
     96      registerVar(&skyboxSrc_, skyboxSrc_.length()+1 ,network::STRING);
     97    }
     98   
    8399}
  • code/branches/network3/src/orxonox/objects/Skybox.h

    r1056 r1174  
    3333
    3434#include "core/BaseObject.h"
     35#include "network/Synchronisable.h"
    3536
    3637namespace orxonox
    3738{
    38     class _OrxonoxExport Skybox : public BaseObject
     39    class _OrxonoxExport Skybox : public BaseObject, public network::Synchronisable
    3940    {
    4041        public:
     
    4546            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    4647            void setSkybox(const std::string& skyboxname);
     48           
     49            bool create();
     50            void registerAllVariables();
     51            void setSkyboxSrc(std::string src);
    4752
    4853        private:
     54            std::string skyboxSrc_;
    4955
    5056
  • code/branches/network3/src/orxonox/objects/WorldEntity.cc

    r1064 r1174  
    7272        }
    7373    }
     74   
    7475
    7576    WorldEntity::~WorldEntity()
     
    162163*/
    163164    }
     165   
    164166
    165167    void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll)
     
    188190
    189191        XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, mode, false, true);
     192       
     193        //create();
    190194    }
    191195
Note: See TracChangeset for help on using the changeset viewer.