Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2005, 11:29:19 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/heightMap: merged the Trunk back into branches/heightMap:
merged with Command
svn merge -r 3918:HEAD trunk branches/heightMap
conflicts resolved in favor of the Trunk

Location:
orxonox/branches/heightMap
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/heightMap

    • Property svn:externals
      •  

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

    r3869 r4122  
    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/heightMap/src/world_entities/environment.cc

    r3739 r4122  
    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/heightMap/src/world_entities/player.cc

    r3881 r4122  
    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/heightMap/src/world_entities/player.h

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

    r3913 r4122  
    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;
     
    4447*/
    4548SkyBox::SkyBox(char* fileName)
     49{
     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->model == NULL)
     69    {
     70      PRINTF(0)("SkyBox model '%s' could not be loaded\n", string);
     71    }
     72  this->postInit();
     73}
     74
     75void SkyBox::preInit(void)
    4676{
    4777  this->setClassName("SkyBox");
     
    5686    }
    5787  this->setMode(PNODE_MOVEMENT);
    58 
     88}
     89
     90void SkyBox::postInit(void)
     91{
    5992  this->setSize(1900.0);
     93  this->rebuild();
    6094}
    6195
     
    67101{
    68102  PRINTF(5)("Deleting the SkyBox\n");
    69  
    70103  for (int i = 0; i < 6; i++)
    71104    delete this->material[i];
     
    84117void SkyBox::setTexture(const char* name, const char* extension)
    85118{
    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];
     119  char* top    = new char[strlen(name)+strlen(extension)+ 10];
     120  char* bottom = new char[strlen(name)+strlen(extension)+ 10];
     121  char* left   = new char[strlen(name)+strlen(extension)+ 10];
     122  char* right  = new char[strlen(name)+strlen(extension)+ 10];
     123  char* front  = new char[strlen(name)+strlen(extension)+ 10];
     124  char* back   = new char[strlen(name)+strlen(extension)+ 10];
    92125
    93126  sprintf(top, "%s_top.%s", name, extension);
     
    100133  this->setTextures(top, bottom, left, right, front, back);
    101134
     135  // deleted alocated memory of this function
    102136  delete []top;
    103137  delete []bottom;
     
    125159  this->material[4]->setDiffuseMap(front);
    126160  this->material[5]->setDiffuseMap(back);
    127 
    128   this->rebuild();
    129161}
    130162
     
    135167{
    136168  this->size = size;
    137 
    138   this->rebuild();
    139169}
    140170
     
    188218
    189219  model->setMaterial(material[0]);
    190   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 3,2,4, 4,3,4, 6,4,4, 5,1,4); // top
     220  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,3, 3,2,3, 5,3,3, 4,0,3); // top
    191221  model->setMaterial(material[1]);
    192   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,4,2, 8,1,2, 2,2,2, 1,3,2); // bottom
     222  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,3,1, 7,0,1, 1,1,1, 0,2,1); // bottom
    193223  model->setMaterial(material[2]);
    194   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,1,3, 2,2,3, 4,3,3, 3,4,3); // left
     224  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 0,0,2, 1,1,2, 3,2,2, 2,3,2); // left
    195225  model->setMaterial(material[3]);
    196   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 5,3,1, 6,4,1, 8,1,1, 7,2,1); // right
     226  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 4,2,0, 5,3,0, 7,0,0, 6,1,0); // right
    197227  model->setMaterial(material[4]);
    198   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 2,1,6, 8,2,6, 6,3,6, 4,4,6); // front
     228  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 1,0,5, 7,1,5, 5,2,5, 3,3,6); // front
    199229  model->setMaterial(material[5]);
    200   model->addFace (4, VERTEX_TEXCOORD_NORMAL, 7,1,5, 1,2,5, 3,3,5, 5,4,5); // back
     230  model->addFace (4, VERTEX_TEXCOORD_NORMAL, 6,0,4, 0,1,4, 2,2,4, 4,3,4); // back
    201231 
    202232  model->finalize();
  • orxonox/branches/heightMap/src/world_entities/skybox.h

    r3807 r4122  
    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);
  • orxonox/branches/heightMap/src/world_entities/skysphere.cc

    r3763 r4122  
    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/heightMap/src/world_entities/test_gun.cc

    r3888 r4122  
    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/heightMap/src/world_entities/weapon.cc

    r3888 r4122  
    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/heightMap/src/world_entities/world_entity.cc

    r3832 r4122  
    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/heightMap/src/world_entities/world_entity.h

    r3799 r4122  
    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.