Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 29, 2006, 1:03:37 AM (18 years ago)
Author:
patrick
Message:

material displayed now and better

Location:
branches/single_player_map/src/world_entities/weapons
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/weapons/fps_sniper_rifle.cc

    r8897 r8898  
    6767{
    6868  // model will be deleted from WorldEntity-destructor
     69  if( this->material != NULL)
     70    delete this->material;
    6971}
    7072
     
    7577
    7678  this->loadModel("models/guns/fps_sniper_rifle.obj", 0.2);
     79  this->material = new Material();
     80  this->material->setIllum(3);
     81  this->material->setAmbient(1.0, 1.0, 1.0);
     82  this->material->setDiffuseMap("maps/rifle01tex.jpg");
    7783
    7884  this->setStateDuration(WS_SHOOTING, .1);
     
    150156
    151157
     158
     159/**
     160 *  this will draw the weapon
     161 */
     162void FPSSniperRifle::draw () const
     163{
     164  /* draw gun body */
     165  glMatrixMode(GL_MODELVIEW);
     166  glPushMatrix();
     167  glTranslatef (this->getAbsCoor ().x,
     168                this->getAbsCoor ().y,
     169                this->getAbsCoor ().z);
     170
     171  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     172  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     173
     174  if( this->leftRight == W_RIGHT)
     175    glScalef(1.0, 1.0, -1.0);
     176
     177  this->material->select();
     178  static_cast<StaticModel*>(this->getModel())->draw();
     179
     180  glPopMatrix();
     181
     182}
     183
     184
     185
  • branches/single_player_map/src/world_entities/weapons/fps_sniper_rifle.h

    r8894 r8898  
    3535
    3636
     37class Material;
     38
    3739class FPSSniperRifle : public Weapon
    3840  {
     
    5052    virtual void fire();
    5153
     54    virtual void draw() const;
     55
     56
    5257
    5358  private:
    54     int leftRight;   // this will become an enum
     59    int              leftRight;   //!< this will become an enum
     60    Material*        material;    //!< material
    5561
    5662  };
Note: See TracChangeset for help on using the changeset viewer.