Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 583


Ignore:
Timestamp:
Dec 17, 2007, 4:54:42 PM (16 years ago)
Author:
landauf
Message:

loadParams

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

Legend:

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

    r576 r583  
    2323    void Model::loadParams(TiXmlElement* xmlElem)
    2424    {
    25         std::cout << "1\n";
    26         if (xmlElem->Attribute("position"))
    27         {
    28         std::cout << "2\n";
    29                 std::vector<std::string> pos = tokenize(xmlElem->Attribute("position"),",");
    30                 float x, y, z;
    31                 String2Number<float>(x, pos[0]);
    32                 String2Number<float>(y, pos[1]);
    33                 String2Number<float>(z, pos[2]);
    34                 this->setPosition(x, y, z);
    35         }
     25        WorldEntity::loadParams(xmlElem);
    3626
    37         std::cout << "3\n";
    38         if (xmlElem->Attribute("direction"))
    39         {
    40         std::cout << "4\n";
    41                 std::vector<std::string> pos = tokenize(xmlElem->Attribute("direction"),",");
    42                 float x, y, z;
    43                 String2Number<float>(x, pos[0]);
    44                 String2Number<float>(y, pos[1]);
    45                 String2Number<float>(z, pos[2]);
    46                 this->setDirection(x, y, z);
    47         }
    48 
    49         std::cout << "5\n";
     27        std::cout << "10\n";
    5028        if (xmlElem->Attribute("mesh"))
    5129        {
    52         std::cout << "6_1\n";
     30        std::cout << "11_1\n";
    5331                std::string src = xmlElem->Attribute("mesh");
    54         std::cout << "6_2\n";
     32        std::cout << "11_2\n";
    5533        std::cout << this->mesh_.getEntity() << std::endl;
    5634                this->mesh_ = Mesh(src);
    57         std::cout << "6_3\n";
     35        std::cout << "11_3\n";
    5836        std::cout << this->mesh_.getEntity() << std::endl;
    5937                    this->attachObject(this->mesh_.getEntity());
    60         std::cout << "6_4\n";
     38        std::cout << "11_4\n";
    6139        }
    62 
    63         std::cout << "7\n";
    64         if (xmlElem->Attribute("scale"))
    65         {
    66         std::cout << "8\n";
    67                     std::string scaleStr = xmlElem->Attribute("scale");
    68                     float scale;
    69                     String2Number<float>(scale, scaleStr);
    70                     this->setScale(scale);
    71         }
    72         std::cout << "9\n";
     40        std::cout << "12\n";
    7341
    7442        COUT(4) << "Loader: Created model" << std::endl;
  • code/branches/FICN/src/orxonox/objects/WorldEntity.cc

    r580 r583  
    3232#include "../core/CoreIncludes.h"
    3333#include "../orxonox.h"
     34#include "../../tinyxml/tinyxml.h"
     35#include "../../misc/Tokenizer.h"
     36#include "../../misc/String2Number.h"
    3437
    3538namespace orxonox
     
    5053            name << (WorldEntity::worldEntityCounter_s++);
    5154            this->setName("WorldEntity" + name.str());
    52             // don't set the node yet!
    5355            //node_ = Orxonox::getSingleton()->getSceneManager()->getRootSceneNode()->createChildSceneNode(this->getName());
    5456            std::cout << "blubbbi: " << this->getName() << " .. " << this->node_ << std::endl;
     
    7981        }
    8082    }
    81    
    82     void WorldEntity::registerAllVariables(){
     83
     84    void WorldEntity::loadParams(TiXmlElement* xmlElem)
     85    {
     86        BaseObject::loadParams(xmlElem);
     87
     88        std::cout << "1\n";
     89        if (xmlElem->Attribute("name"))
     90        {
     91        std::cout << "2\n";
     92                this->setName(xmlElem->Attribute("mesh"));
     93        }
     94        std::cout << "3\n";
     95        if (xmlElem->Attribute("position"))
     96        {
     97        std::cout << "4\n";
     98                std::vector<std::string> pos = tokenize(xmlElem->Attribute("position"),",");
     99                float x, y, z;
     100                String2Number<float>(x, pos[0]);
     101                String2Number<float>(y, pos[1]);
     102                String2Number<float>(z, pos[2]);
     103                this->setPosition(x, y, z);
     104        }
     105        std::cout << "5\n";
     106        if (xmlElem->Attribute("direction"))
     107        {
     108        std::cout << "6\n";
     109                std::vector<std::string> pos = tokenize(xmlElem->Attribute("direction"),",");
     110                float x, y, z;
     111                String2Number<float>(x, pos[0]);
     112                String2Number<float>(y, pos[1]);
     113                String2Number<float>(z, pos[2]);
     114                this->setDirection(x, y, z);
     115        }
     116        std::cout << "7\n";
     117        if (xmlElem->Attribute("scale"))
     118        {
     119        std::cout << "8\n";
     120                    std::string scaleStr = xmlElem->Attribute("scale");
     121                    float scale;
     122                    String2Number<float>(scale, scaleStr);
     123                    this->setScale(scale);
     124        }
     125        std::cout << "9\n";
     126    }
     127
     128    void WorldEntity::registerAllVariables()
     129    {
    83130      // to be implemented !
    84      
    85131    }
    86132}
  • code/branches/FICN/src/orxonox/objects/WorldEntity.h

    r580 r583  
    99#include "Mesh.h"
    1010#include "network/Synchronisable.h"
     11#include "tinyxml/tinyxml.h"
    1112
    1213namespace orxonox
     
    1819      ~WorldEntity();
    1920
    20       void tick(float dt);
     21      virtual void tick(float dt);
     22      virtual void loadParams(TiXmlElement* xmlElem);
    2123
    2224      inline Ogre::SceneNode* getNode()
Note: See TracChangeset for help on using the changeset viewer.