Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3586 in orxonox.OLD for orxonox/trunk/src/world_entities


Ignore:
Timestamp:
Mar 17, 2005, 2:15:33 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: fixed movement bug (was in the lists), modified the player

Location:
orxonox/trunk/src/world_entities
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world_entities/player.cc

    r3585 r3586  
    167167  //orthDirection = orthDirection.cross (direction);
    168168
    169   if( bUp) { accel = accel+(direction*acceleration); }
    170   if( bDown) { accel = accel-(direction*acceleration); }
    171   if( bLeft ) { accel = accel - (orthDirection*acceleration); }
    172   if( bRight ) { accel = accel + (orthDirection*acceleration); }
    173   if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    174   if( bDescend) {/* FIXME */} /* \todo up and down player movement */
     169  if( this->bUp) { accel = accel+(direction*acceleration); }
     170  if( this->bDown) { accel = accel-(direction*acceleration); }
     171  if( this->bLeft ) { accel = accel - (orthDirection*acceleration); }
     172  if( this->bRight ) { accel = accel + (orthDirection*acceleration); }
     173  if( this->bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
     174  if( this->bDescend) {/* FIXME */} /* \todo up and down player movement */
    175175
    176176  Vector move = accel * time;
     
    211211  else if( !strcmp( cmd->cmd, "right")) this->bRight = !cmd->bUp;
    212212  else if( !strcmp( cmd->cmd, "fire")) this->bFire = !cmd->bUp;
    213   else if( !strcmp( cmd->cmd, "weapon_mode")) this->bWeaponChange = !cmd->bUp;
    214 }
     213  else if( !strcmp( cmd->cmd, "mode")) this->bWeaponChange = !cmd->bUp;
     214}
  • orxonox/trunk/src/world_entities/primitive.cc

    r3578 r3586  
    2626
    2727
     28
     29/**
     30   \brief standard constructor
     31*/
    2832Primitive::Primitive (PRIMITIVE_FORM form) : WorldEntity()
    2933{
    30   this->model = new OBJModel("../data/models/fighter.obj");
     34  //this->model = new OBJModel("../data/models/fighter.obj");
    3135  //this->model = new OBJModel("");
     36  this->object = gluNewQuadric();
     37
     38  gluQuadricTexture(this->object, GL_TRUE);
     39
     40  this->material = new Material("Sky");
     41  this->material->setDiffuseMap("../data/pictures/sky-replace.jpg");
     42  this->material->setIllum(3);
     43  this->material->setAmbient(1.0, 1.0, 1.0);
    3244}
    3345
    3446
    35 
     47/**
     48   \brief standard deconstructor
     49*/
    3650Primitive::~Primitive ()
    3751{
    38 
     52  delete this->material;
     53  free(this->object);
    3954}
    4055
     56/**
     57   \brief called, when the object gets hit
     58   \param other object, that hits it
     59   \param location of impact
     60*/
     61void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
     62
     63
     64/**
     65   \brief object collides
     66*/
     67void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
     68
     69
     70/**
     71   \brief tick singal put everything here, that is timedependent
     72   \param time in sec
     73*/
    4174void Primitive::tick (float time)
    4275{
    43   Vector v(0.0, 0.0, 1.0);
    44   Quaternion q(10.0, v);
     76  //Vector v(0.0, 0.0, 1.0);
     77  //Quaternion q(10.0, v);
    4578  //this->relDirection = this->relDirection * q;
    4679}
    4780
    48 void Primitive::hit (WorldEntity* weapon, Vector* loc) {}
    49 
    50 
    51 void Primitive::collide (WorldEntity* other,  Uint32 ownhitflags, Uint32 otherhitflags) {}
    52 
     81/**
     82   \brief drawing function of the object
     83*/
    5384void Primitive::draw ()
    5485{
    5586  glMatrixMode(GL_MODELVIEW);
    5687  glPushMatrix();
     88
    5789  float matrix[4][4];
    58  
    5990  glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z);
    6091  //rotate
    61   this->getAbsDir().matrix (matrix);
    62   glMultMatrixf((float*)matrix);
    63  
    64   this->model->draw();
     92  //this->getAbsDir().matrix (matrix);
     93  //glMultMatrixf((float*)matrix);
     94  gluSphere(this->object, 2, 20, 20);
     95
    6596  glPopMatrix();
    6697}
  • orxonox/trunk/src/world_entities/primitive.h

    r3578 r3586  
    1919  virtual void draw ();
    2020
     21 private:
     22  GLUquadricObj *object; //!< the object to be rendered
     23  Material *material;    //!< A Material for the SkySphere.
     24
    2125};
    2226
  • orxonox/trunk/src/world_entities/skysphere.cc

    r3566 r3586  
    3838Skysphere::Skysphere()
    3939
    40   initialize("../data/pictures/sky-replace.jpg");
     40  this->initialize("../data/pictures/sky-replace.jpg");
    4141}
    4242
     
    4848Skysphere::Skysphere(char* fileName)
    4949{
    50   initialize(fileName);
     50  this->initialize(fileName);
    5151}
    5252
     
    108108 
    109109  skyMaterial->select();
    110   gluSphere(sphereObj, sphereRadius, 20, 20);
     110  gluSphere(this->sphereObj, this->sphereRadius, 20, 20);
    111111  glPopMatrix();
    112112}
Note: See TracChangeset for help on using the changeset viewer.