Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4178 in orxonox.OLD for orxonox/branches/physics/src/world_entities


Ignore:
Timestamp:
May 13, 2005, 11:16:33 PM (20 years ago)
Author:
bensch
Message:

orxonox/branches/physics: merged the Trunk into the physics Branche again:
merged with command:
svn merge ../trunk physics -r 3953:HEAD
no important conflicts

Location:
orxonox/branches/physics
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics

    • Property svn:externals
      •  

        old new  
        1 data http://svn.orxonox.ethz.ch/data
         1
  • orxonox/branches/physics/src/world_entities/camera.cc

    r3953 r4178  
    139139  if (tmpFovy > .001)
    140140    this->fovy += (this->toFovy - this->fovy) * dt;
    141   Vector tmpPos = (this->toRelCoor - *this->getRelCoor()) * dt;
     141  Vector tmpPos = (this->toRelCoor - this->getRelCoor()) * dt;
    142142  if (tmpPos.len() >= .001)
    143143    {
    144       tmpPos = tmpPos + *this->getRelCoor();
     144      tmpPos = tmpPos + this->getRelCoor();
    145145      this->setRelCoor(tmpPos);
    146146    }
  • orxonox/branches/physics/src/world_entities/environment.cc

    r3739 r4178  
    3030{
    3131  this->model = (Model*) ResourceManager::getInstance()->load("cube", RP_LEVEL);
    32   //  this->model = new OBJModel("../data/models/fighter.obj");
    3332}
    3433
     
    5049void Environment::draw ()
    5150{
     51  //this->getRelCoor().debug();
     52
    5253  glMatrixMode(GL_MODELVIEW);
    5354  glPushMatrix();
  • orxonox/branches/physics/src/world_entities/player.cc

    r3953 r4178  
    1 
    2 
    31/*
    42   orxonox - the future of 3D-vertical-scrollers
     
    3129
    3230using namespace std;
     31
     32CREATE_FACTORY(Player);
    3333
    3434/**
     
    5252  //weapons:
    5353  this->weaponMan = new WeaponManager();
    54   Weapon* wpRight = new TestGun(this,Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
     54  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
    5555  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
    5656 
    57   this->weaponMan->addWeapon(wpRight, W_CONFIG0);
    58   this->weaponMan->addWeapon(wpLeft, W_CONFIG1);
     57  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
     58  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
    5959  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
    6060  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
     
    7474}
    7575
     76/**
     77   \brief creates a new Player from Xml Data
     78   \param root the xml element containing player data
     79   
     80   \todo add more parameters to load
     81*/
     82Player::Player(TiXmlElement* root) : WorldEntity(root)
     83{
     84  this->weapons = new tList<Weapon>();
     85  this->activeWeapon = NULL;
     86  /*
     87    this is the debug player - actualy we would have to make a new
     88     class derivated from Player for each player. for now, we just use
     89     the player.cc for debug also
     90  */
     91  travelSpeed = 15.0;
     92  velocity = new Vector();
     93  bUp = bDown = bLeft = bRight = bAscend = bDescend = false;
     94  bFire = false;
     95  this->bWeaponChange = false;
     96  acceleration = 10.0;
     97  //weapons:
     98  this->weaponMan = new WeaponManager();
     99  Weapon* wpRight = new TestGun(this, Vector(-2.6, 0.1, 3.0), Quaternion(), 0);
     100  Weapon* wpLeft = new TestGun(this, Vector(-2.6, 0.1, -3.0), Quaternion(), 1);
     101 
     102  this->weaponMan->addWeapon(wpRight, W_CONFIG0, W_SLOT0);
     103  this->weaponMan->addWeapon(wpLeft, W_CONFIG1, W_SLOT1);
     104  this->weaponMan->addWeapon(wpRight, W_CONFIG2);
     105  this->weaponMan->addWeapon(wpLeft, W_CONFIG2);
     106}
    76107
    77108/**
     
    188219  //orthDirection = orthDirection.cross (direction);
    189220
    190   if( this->bUp && this->getRelCoor()->x < 20)
     221  if( this->bUp && this->getRelCoor().x < 20)
    191222    accel = accel+(direction*acceleration);
    192   if( this->bDown && this->getRelCoor()->x > -5)
     223  if( this->bDown && this->getRelCoor().x > -5)
    193224    accel = accel-(direction*acceleration);
    194   if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor()->z*2)
     225  if( this->bLeft &&  TrackManager::getInstance()->getWidth() > -this->getRelCoor().z*2)
    195226    accel = accel - (orthDirection*acceleration);
    196   if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor()->z*2)
     227  if( this->bRight &&  TrackManager::getInstance()->getWidth() > this->getRelCoor().z*2)
    197228    accel = accel + (orthDirection*acceleration);
    198229  if( this->bAscend )
     
    230261{
    231262  PRINTF(3)("recieved command [%s]\n", cmd->cmd);
    232   if( !strcmp( cmd->cmd, "up")) this->bUp = !cmd->bUp;
    233   if( !strcmp( cmd->cmd, "down")) this->bDown = !cmd->bUp;
    234   if( !strcmp( cmd->cmd, "left")) this->bLeft = !cmd->bUp;
    235   if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    236   if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
    237   if( !strcmp( cmd->cmd, "mode")) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
    238 }
     263  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_UP)) this->bUp = !cmd->bUp;
     264  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_DOWN)) this->bDown = !cmd->bUp;
     265  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_LEFT)) this->bLeft = !cmd->bUp;
     266  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_RIGHT)) this->bRight = !cmd->bUp;
     267  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_FIRE)) this->bFire = !cmd->bUp;
     268  if( !strcmp( cmd->cmd, CONFIG_NAME_PLAYER_NEXT_WEAPON)) if(cmd->bUp) this->bWeaponChange = !this->bWeaponChange;
     269}
  • orxonox/branches/physics/src/world_entities/player.h

    r3953 r4178  
    2222 public:
    2323  Player();
     24  Player(TiXmlElement* root);
    2425  virtual ~Player();
    2526
  • orxonox/branches/physics/src/world_entities/skybox.cc

    r3953 r4178  
    2828
    2929#include "skybox.h"
     30
    3031#include "stdincl.h"
     32#include "factory.h"
    3133
    3234#include "material.h"
     
    3638//#include "world_entity.h"
    3739
     40CREATE_FACTORY(SkyBox);
    3841
    3942using namespace std;
     
    4548SkyBox::SkyBox(char* fileName)
    4649{
     50  this->preInit();
     51  this->postInit();
     52}
     53
     54SkyBox::SkyBox(TiXmlElement* root) : WorldEntity(root)
     55{
     56  this->preInit();
     57
     58  const char* string;
     59
     60  // Model Loading     
     61  string = grabParameter( root, "materialset");
     62  if( string != NULL)
     63    this->setTexture(string, "jpg");
     64  else
     65    {
     66      PRINTF(0)("SkyBox is missing a proper 'MaterialSet'\n");
     67    }
     68  if( this->skyModel == NULL)
     69    {
     70      PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
     71    }
     72  this->postInit();
     73}
     74
     75void SkyBox::preInit(void)
     76{
    4777  this->setClassName("SkyBox");
     78  this->skyModel = NULL;
    4879  this->material = new Material*[6];
    49   for (int i = 0; i <6; i++)
     80  for (int i = 0; i < 6; i++)
    5081    {
    5182      this->material[i] = new Material();
     
    5687    }
    5788  this->setMode(PNODE_MOVEMENT);
    58 
     89}
     90
     91void SkyBox::postInit(void)
     92{
    5993  this->setSize(1900.0);
     94  this->rebuild();
    6095}
    6196
     
    66101SkyBox::~SkyBox()
    67102{
    68   PRINTF(5)("Deleting the SkyBox\n");
    69  
     103  PRINTF(5)("Deleting SkyBox\n");
    70104  for (int i = 0; i < 6; i++)
    71105    delete this->material[i];
     
    84118void SkyBox::setTexture(const char* name, const char* extension)
    85119{
    86   char* top    = new char[strlen(name)+strlen(extension)+ 6];
    87   char* bottom = new char[strlen(name)+strlen(extension)+ 9];
    88   char* left   = new char[strlen(name)+strlen(extension)+ 7];
    89   char* right  = new char[strlen(name)+strlen(extension)+ 8];
    90   char* front  = new char[strlen(name)+strlen(extension)+ 8];
    91   char* back   = new char[strlen(name)+strlen(extension)+ 7];
     120  char* top    = new char[strlen(name)+strlen(extension)+ 10];
     121  char* bottom = new char[strlen(name)+strlen(extension)+ 10];
     122  char* left   = new char[strlen(name)+strlen(extension)+ 10];
     123  char* right  = new char[strlen(name)+strlen(extension)+ 10];
     124  char* front  = new char[strlen(name)+strlen(extension)+ 10];
     125  char* back   = new char[strlen(name)+strlen(extension)+ 10];
    92126
    93127  sprintf(top, "%s_top.%s", name, extension);
     
    100134  this->setTextures(top, bottom, left, right, front, back);
    101135
     136  // deleted alocated memory of this function
    102137  delete []top;
    103138  delete []bottom;
     
    125160  this->material[4]->setDiffuseMap(front);
    126161  this->material[5]->setDiffuseMap(back);
    127 
    128   this->rebuild();
    129162}
    130163
     
    135168{
    136169  this->size = size;
    137 
    138   this->rebuild();
    139170}
    140171
     
    149180  glTranslatef(r.x, r.y, r.z);
    150181
    151   this->model->draw();
     182  this->skyModel->draw();
    152183
    153184  glPopMatrix();
     
    162193void SkyBox::rebuild()
    163194{
    164   if (this->model)
    165     delete model;
    166   model = new Model();
    167 
    168   model->addVertex (-0.5*size, -0.5*size, 0.5*size); 
    169   model->addVertex (0.5*size, -0.5*size, 0.5*size);
    170   model->addVertex (-0.5*size, 0.5*size, 0.5*size);
    171   model->addVertex (0.5*size, 0.5*size, 0.5*size);
    172   model->addVertex (-0.5*size, 0.5*size, -0.5*size);
    173   model->addVertex (0.5*size, 0.5*size, -0.5*size);
    174   model->addVertex (-0.5*size, -0.5*size, -0.5*size);
    175   model->addVertex (0.5*size, -0.5*size, -0.5*size);
    176 
    177   model->addVertexTexture (0.0, 0.0);
    178   model->addVertexTexture (1.0, 0.0);
    179   model->addVertexTexture (1.0, 1.0);
    180   model->addVertexTexture (0.0, 1.0);
    181 
    182   model->addVertexNormal (0.0, 0.0, 1.0);
    183   model->addVertexNormal (0.0, 1.0, 0.0);
    184   model->addVertexNormal (0.0, 0.0, -1.0);
    185   model->addVertexNormal (0.0, -1.0, 0.0);
    186   model->addVertexNormal (1.0, 0.0, 0.0);
    187   model->addVertexNormal (-1.0, 0.0, 0.0);
    188 
    189   model->setMaterial(material[0]);
    190   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top
    191   model->setMaterial(material[1]);
    192   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom
    193   model->setMaterial(material[2]);
    194   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left
    195   model->setMaterial(material[3]);
    196   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right
    197   model->setMaterial(material[4]);
    198   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front
    199   model->setMaterial(material[5]);
    200   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back
     195  if (this->skyModel)
     196    delete skyModel;
     197  skyModel = new Model();
     198
     199  this->skyModel->addVertex (-0.5*size, -0.5*size, 0.5*size); 
     200  this->skyModel->addVertex (0.5*size, -0.5*size, 0.5*size);
     201  this->skyModel->addVertex (-0.5*size, 0.5*size, 0.5*size);
     202  this->skyModel->addVertex (0.5*size, 0.5*size, 0.5*size);
     203  this->skyModel->addVertex (-0.5*size, 0.5*size, -0.5*size);
     204  this->skyModel->addVertex (0.5*size, 0.5*size, -0.5*size);
     205  this->skyModel->addVertex (-0.5*size, -0.5*size, -0.5*size);
     206  this->skyModel->addVertex (0.5*size, -0.5*size, -0.5*size);
     207
     208  this->skyModel->addVertexTexture (0.0, 0.0);
     209  this->skyModel->addVertexTexture (1.0, 0.0);
     210  this->skyModel->addVertexTexture (1.0, 1.0);
     211  this->skyModel->addVertexTexture (0.0, 1.0);
     212
     213  this->skyModel->addVertexNormal (0.0, 0.0, 1.0);
     214  this->skyModel->addVertexNormal (0.0, 1.0, 0.0);
     215  this->skyModel->addVertexNormal (0.0, 0.0, -1.0);
     216  this->skyModel->addVertexNormal (0.0, -1.0, 0.0);
     217  this->skyModel->addVertexNormal (1.0, 0.0, 0.0);
     218  this->skyModel->addVertexNormal (-1.0, 0.0, 0.0);
     219
     220  this->skyModel->setMaterial(material[0]);
     221  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top
     222  this->skyModel->setMaterial(material[1]);
     223  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom
     224  this->skyModel->setMaterial(material[2]);
     225  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left
     226  this->skyModel->setMaterial(material[3]);
     227  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right
     228  this->skyModel->setMaterial(material[4]);
     229  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
     230  this->skyModel->setMaterial(material[5]);
     231  this->skyModel->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
    201232 
    202   model->finalize();
    203 }
     233  this->skyModel->finalize();
     234}
  • orxonox/branches/physics/src/world_entities/skybox.h

    r3807 r4178  
    2222 public:
    2323  SkyBox(char* fileName = NULL);
     24  SkyBox(TiXmlElement* root);
     25
    2426  virtual ~SkyBox();
     27
     28  void preInit(void);
     29  void postInit(void);
     30
    2531
    2632  void setSize(float size);
     
    3339  void rebuild();
    3440
     41  Model* skyModel;        //!< A Model for the Sky. This must not be the same as the Model from WorldEntity, because it is not alocated through the ResourceManager.
    3542  Material **material;    //!< Materials for the SkyBox. sorted by number (0-5) top, bottom, left, right, front, back
    3643  float size;             //!< Size of the SkyBox. This should match the frustum maximum range.
  • orxonox/branches/physics/src/world_entities/skysphere.cc

    r3763 r4178  
    4444{
    4545  if (fileName == NULL)
    46     this->initialize("../data/pictures/sky-replace.jpg");
     46    this->initialize("pictures/sky-replace.jpg");
    4747  else
    4848    this->initialize(fileName);
  • orxonox/branches/physics/src/world_entities/terrain.cc

    r3677 r4178  
    7777void Terrain::init(void)
    7878{
    79    this->setClassName ("Terrain");
    80 
    81    this->objectList = 0;
     79  this->setClassName ("Terrain");
     80 
     81  this->objectList = 0;
    8282}
    8383
     
    9898  glMultMatrixf((float*)matrix);
    9999
    100   if (objectList)
    101     glCallList(objectList);
    102   else if (model)
    103     model->draw();
    104   //  this->model->draw();
     100  if (this->objectList)
     101    glCallList(this->objectList);
     102  else if (this->model)
     103    this->model->draw();
    105104  glPopMatrix();
    106105}
  • orxonox/branches/physics/src/world_entities/test_gun.cc

    r3953 r4178  
    4949  this->objectComponent1 = new PNode();
    5050  this->animation1 = new Animation3D(this->objectComponent1);
    51   parent->addChild(this->objectComponent1, PNODE_ALL);
     51  this->animation2 = new Animation3D(this);
     52  this->animation3 = new Animation3D(this);
     53  //parent->addChild(this->objectComponent1, PNODE_ALL);
     54  this->addChild(this->objectComponent1, PNODE_ALL);
    5255
    5356  this->animation1->setInfinity(ANIM_INF_CONSTANT);
    54   // ANIM_LINEAR was ANIM_NEG_EXP
     57  this->animation2->setInfinity(ANIM_INF_CONSTANT);
     58  this->animation3->setInfinity(ANIM_INF_CONSTANT);
    5559  if( this->leftRight == W_LEFT)
    5660    {
    5761      this->projectileOffset = Vector(1.0, 0.0, -0.35);
    5862
    59       this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
    60       this->animation1->addKeyFrame(Vector(-3.0, 0.1, 3.0), Quaternion(), 0.5, ANIM_LINEAR);
    61       this->animation1->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR);
     63      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     64      this->animation1->addKeyFrame(Vector(-0.4, 0, 0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     65      this->animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     66
     67      this->animation2->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     68      this->animation2->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     69
     70      this->animation3->addKeyFrame(Vector(-2.6, 0.1, 3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     71      this->animation3->addKeyFrame(Vector(-2.6, 0.1, 2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    6272    }
    6373  else if( this->leftRight == W_RIGHT)
     
    6575      this->projectileOffset = Vector(1.0, 0.0, 0.5);
    6676
    67       this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
    68       this->animation1->addKeyFrame(Vector(-3.0, 0.1, -2.5), Quaternion(), 0.5, ANIM_LINEAR);
    69       this->animation1->addKeyFrame(Vector(-2.6, 0.1, -2.5), Quaternion(), 0.1, ANIM_LINEAR);
     77      this->objectComponent1->setRelCoor(Vector(0,0,0.35));
     78      this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     79      this->animation1->addKeyFrame(Vector(-0.4, 0, .5), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     80      this->animation1->addKeyFrame(Vector(0, 0, .5), Quaternion(), 0.0, ANIM_LINEAR, ANIM_CONSTANT);
     81
     82      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     83      this->animation2->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     84
     85      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -3.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
     86      this->animation3->addKeyFrame(Vector(-2.6, 0.1, -2.0), Quaternion(), 0.1, ANIM_LINEAR, ANIM_CONSTANT);
    7087    }
     88
    7189}
    7290
     
    89107*/
    90108void TestGun::activate()
    91 {}
     109{
     110  this->animation2->replay();
     111}
    92112
    93113
     
    100120*/
    101121void TestGun::deactivate()
    102 {}
     122{
     123  this->animation3->replay();
     124}
    103125
    104126
  • orxonox/branches/physics/src/world_entities/weapon.cc

    r3953 r4178  
    110110void WeaponManager::nextWeaponConf()
    111111{
    112   PRINTF(4)("Changing weapon configuration: from %i\n", this->currConfID);
    113 
    114   Weapon* w;
    115   for(int i = 0; i < W_MAX_SLOTS; ++i)
    116     {
    117       w = this->configs[this->currConfID].slots[i];
    118       if( w != NULL) w->deactivate();
    119     }
    120   int i;
     112  PRINTF(4)("Changing weapon configuration: from %i to next\n", this->currConfID);
     113
     114  int i, lastConfID;
     115  lastConfID = this->currConfID;
    121116  for(i = this->currConfID + 1; i < W_MAX_CONFIGS && !this->configs[i].bUsed; ++i);
    122117  if( i == W_MAX_CONFIGS) this->currConfID = W_CONFIG0;
    123118  else this->currConfID = i; 
    124   PRINTF(4)("\tto %i\n", this->currConfID);
    125 
    126   for(int i = 0; i < W_MAX_SLOTS; ++i)
    127     {
    128       w = this->configs[this->currConfID].slots[i];
    129       if( w != NULL) w->activate();
     119
     120 
     121  Weapon *w1, *w2;
     122  for(int j = 0; j < W_MAX_SLOTS; ++j)
     123    {
     124      w1 = this->configs[lastConfID].slots[j];
     125      w2 = this->configs[this->currConfID].slots[j];
     126     
     127      if( w1 == w2)
     128        {
     129          printf("no need for change\n");
     130        }
     131      else
     132        {
     133        if( w1 != NULL )
     134          {
     135            w1->deactivate();
     136            printf("deactivating %i,%i\n", j,lastConfID);
     137          }
     138        if( w2 != NULL)
     139          {
     140            w2->activate();
     141            printf("activating %i,%i\n", j, this->currConfID);
     142          }
     143        }
    130144    }
    131145}
  • orxonox/branches/physics/src/world_entities/world_entity.cc

    r3832 r4178  
    3030/**
    3131   \brief standard constructor
    32    
    33    Every derived contructor HAS to call the previous one supplying the isFree parameter. This is necessary to distunguish
    34    between free and bound entities. The difference between them is simply the fact that the movement of a free entity is
    35    not bound to the track of a world. Use this to implement projectile or effect classes that do not have to travel along the track.
    36    To specify an entity to be free or bound set the default parameter in the declaration of the constructor.
    37    Theoretically you should never have to call the constructor of an Entity directly, for it is called by the spawn() function of the World
    38    class. So if you want to create a new entity at any time, call World::spawn(). It will handle everything that is necessary.
    39 */
    40 WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
     32*/
     33WorldEntity::WorldEntity ()
    4134{
    4235  this->setClassName ("WorldEntity");
     
    4740
    4841/**
     42   \brief Loads the WordEntity-specific Part of any derived Class
     43*/
     44WorldEntity::WorldEntity(TiXmlElement* root)
     45{
     46  // Name Setup
     47  char* temp;
     48  const char* string;
     49  string = grabParameter( root, "name");
     50  if( string == NULL)
     51    {
     52      PRINTF(2)("WorldEntity is missing a proper 'name'\n");
     53      string = "Unknown";
     54      temp = new char[strlen(string + 2)];
     55      strcpy( temp, string);
     56      this->setName( temp);
     57    }
     58  else
     59    {
     60      temp = new char[strlen(string + 2)];
     61      strcpy( temp, string);
     62      this->setName( temp);
     63    }
     64  // Model Loading     
     65  this->model = NULL;
     66  string = grabParameter( root, "model");
     67  if( string != NULL)
     68    this->model = (Model*)ResourceManager::getInstance()->load(string, OBJ, RP_CAMPAIGN);
     69  else
     70    {
     71      PRINTF(2)("WorldEntity is missing a proper 'model'\n");
     72      this->model = NULL;
     73    }
     74  if( this->model == NULL)
     75    {
     76      PRINTF(2)("WorldEntity model '%s' could not be loaded\n", string);
     77    }
     78  this->bDraw = true;
     79}
     80
     81/**
    4982   \brief standard destructor
    5083*/
     
    73106{}
    74107
    75 
    76 /**
    77    \brief query whether the WorldEntity in question is free
    78    \return true if the WorldEntity is free or false if it isn't
    79 */
    80 bool WorldEntity::isFree ()
    81 {
    82   return bFree;
    83 }
    84108
    85109/**
  • orxonox/branches/physics/src/world_entities/world_entity.h

    r3799 r4178  
    2323
    2424 public:
    25   WorldEntity (bool isFree = false);
     25  WorldEntity (void);
     26  WorldEntity(TiXmlElement* root);
    2627  virtual ~WorldEntity ();
    2728
     
    3233  //void removeAbility(Ability* ability);
    3334  void setDrawable (bool bDraw); 
    34   bool isFree ();
    3535  void setCharacterAttributes(CharacterAttributes* charAttr);
    3636  CharacterAttributes* getCharacterAttributes();
     
    5252 
    5353 private:
    54   const bool bFree;                   //!< If the entity is free.
    5554  bool bCollide;                      //!< If it should be considered for the collisiontest.
    5655  bool bDraw;                         //!< If it should be visible.
Note: See TracChangeset for help on using the changeset viewer.