Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 19, 2007, 12:04:49 AM (16 years ago)
Author:
scheusso
Message:

made Model and WorldEntity synchronisable

Location:
code/branches/FICN/src/orxonox/objects
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/objects/Model.cc

    r622 r630  
    1515    {
    1616        RegisterObject(Model);
     17        registerAllVariables();
    1718    }
    1819
     
    2728        if (xmlElem->Attribute("mesh"))
    2829        {
    29             std::string src = xmlElem->Attribute("mesh");
    30             this->mesh_.setMesh(src);
    31             this->attachObject(this->mesh_.getEntity());
     30            meshSrc_ = xmlElem->Attribute("mesh");
    3231        }
     32    }
     33   
     34    bool Model::create(){
     35      this->mesh_.setMesh(meshSrc_);
     36      this->attachObject(this->mesh_.getEntity());
    3337
    34         COUT(4) << "Loader: Created model" << std::endl;
     38      COUT(4) << "Loader: Created model" << std::endl;
     39      return true;
     40    }
     41   
     42    void Model::registerAllVariables(){
     43      registerVar(&meshSrc_, meshSrc_.length()+1, network::STRING);
    3544    }
    3645}
  • code/branches/FICN/src/orxonox/objects/Model.h

    r576 r630  
    1414            ~Model();
    1515            virtual void loadParams(TiXmlElement* xmlElem);
     16            bool create();
    1617
    1718        private:
     19            std::string meshSrc_;
    1820            Mesh mesh_;
     21            void registerAllVariables();
    1922    };
    2023}
  • code/branches/FICN/src/orxonox/objects/WorldEntity.cc

    r622 r630  
    4646        RegisterObject(WorldEntity);
    4747
     48        registerAllVariables();
    4849        if (Orxonox::getSingleton()->getSceneManager())
    4950        {
     
    151152        }
    152153
     154        create();
     155       
    153156    }
    154157
     158    bool WorldEntity::create(){
     159      return true;
     160    }
     161   
    155162    void WorldEntity::registerAllVariables()
    156163    {
    157       // to be implemented !
     164      // register coordinates
     165      registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA);
     166      registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA);
     167      registerVar( (void*) &(this->getPosition().z), sizeof(this->getPosition().z), network::DATA);
     168      // register orientation
     169      registerVar( (void*) &(this->getOrientation().w), sizeof(this->getOrientation().w), network::DATA);
     170      registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA);
     171      registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA);
     172      registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA);
     173      // not needed at the moment, because we don't have prediction yet
     174      /*// register velocity_
     175      registerVar( (void*) &(this->getVelocity().x), sizeof(this->getVelocity().x), network::DATA);
     176      registerVar( (void*) &(this->getVelocity().y), sizeof(this->getVelocity().y), network::DATA);
     177      registerVar( (void*) &(this->getVelocity().z), sizeof(this->getVelocity().z), network::DATA);
     178      // register rotationAxis/rate
     179      registerVar( (void*) &(this->getRotationRate()), sizeof(this->getRotationRate()), network::DATA);
     180      registerVar( (void*) &(this->getRotationAxis().x), sizeof(this->getRotationAxis().x), network::DATA);
     181      registerVar( (void*) &(this->getRotationAxis().y), sizeof(this->getRotationAxis().y), network::DATA);
     182      registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA);*/
    158183    }
    159184}
  • code/branches/FICN/src/orxonox/objects/WorldEntity.h

    r622 r630  
    2121      virtual void tick(float dt);
    2222      virtual void loadParams(TiXmlElement* xmlElem);
    23 
     23      bool create();
     24     
    2425      inline Ogre::SceneNode* getNode()
    2526          { return this->node_; }
Note: See TracChangeset for help on using the changeset viewer.