Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 9, 2008, 4:44:36 PM (16 years ago)
Author:
landauf
Message:

merged core branch to trunk

File:
1 edited

Legend:

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

    r790 r871  
    3737#include "../Orxonox.h"
    3838#include "WorldEntity.h"
     39#include "core/XMLPort.h"
    3940
    4041namespace orxonox
     
    8687    void WorldEntity::loadParams(TiXmlElement* xmlElem)
    8788    {
     89
    8890        BaseObject::loadParams(xmlElem);
    89 
     91/*
    9092        if (xmlElem->Attribute("position"))
    9193        {
     
    153155
    154156        create();
    155 
     157*/
     158    }
     159
     160    void WorldEntity::setYawPitchRoll(const Degree& yaw, const Degree& pitch, const Degree& roll)
     161    {
     162        this->yaw(yaw);
     163        this->pitch(pitch);
     164        this->roll(roll);
     165    }
     166
     167    /**
     168        @brief XML loading and saving.
     169        @param xmlelement The XML-element
     170        @param loading Loading (true) or saving (false)
     171        @return The XML-element
     172    */
     173    void WorldEntity::XMLPort(Element& xmlelement, bool loading)
     174    {
     175        BaseObject::XMLPort(xmlelement, loading);
     176
     177        XMLPortParam(WorldEntity, "position", setPositionLoader2, getPosition, xmlelement, loading);
     178        XMLPortParamLoadOnly(WorldEntity, "direction", setDirectionLoader, xmlelement, loading);
     179        XMLPortParamLoadOnly(WorldEntity, "yawpitchroll", setYawPitchRoll, xmlelement, loading);
     180        XMLPortParam(WorldEntity, "scale", setTotalScale, getScale, xmlelement, loading);
     181        XMLPortParam(WorldEntity, "rotationAxis", setRotationAxisLoader, getRotationAxis, xmlelement, loading);
     182        XMLPortParam(WorldEntity, "rotationRate", setRotationRate, getRotationRate, xmlelement, loading);
     183
     184        XMLPortObject(WorldEntity, WorldEntity, "attached", attachWorldEntity, getAttachedWorldEntity, xmlelement, loading);
    156185    }
    157186
     
    163192    void WorldEntity::registerAllVariables()
    164193    {
    165       // register coordinates
     194/*      // register coordinates
    166195      registerVar( (void*) &(this->getPosition().x), sizeof(this->getPosition().x), network::DATA);
    167196      registerVar( (void*) &(this->getPosition().y), sizeof(this->getPosition().y), network::DATA);
     
    171200      registerVar( (void*) &(this->getOrientation().x), sizeof(this->getOrientation().x), network::DATA);
    172201      registerVar( (void*) &(this->getOrientation().y), sizeof(this->getOrientation().y), network::DATA);
    173       registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA);
     202      registerVar( (void*) &(this->getOrientation().z), sizeof(this->getOrientation().z), network::DATA);*/
    174203      // not needed at the moment, because we don't have prediction yet
    175204      /*// register velocity_
     
    183212      registerVar( (void*) &(this->getRotationAxis().z), sizeof(this->getRotationAxis().z), network::DATA);*/
    184213    }
     214
     215    void WorldEntity::attachWorldEntity(WorldEntity* entity)
     216    {
     217        this->attachedWorldEntities_.push_back(entity);
     218    }
     219
     220    const WorldEntity* WorldEntity::getAttachedWorldEntity(unsigned int index)
     221    {
     222        if (index < this->attachedWorldEntities_.size())
     223            return this->attachedWorldEntities_[index];
     224        else
     225            return 0;
     226    }
    185227}
Note: See TracChangeset for help on using the changeset viewer.