Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6269 in orxonox.OLD for branches


Ignore:
Timestamp:
Dec 23, 2005, 2:42:54 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches: Power-UPS:
added capability to Collide with a PowerUP. This has been added through the conjunction between:

  1. Model* a= new Model
  2. this→setModel(a)
  3. this→buildObbTree(n);

Now the Sphere is loaded easily, and fast
Also the draw algorithm is as modern, as it should be :)

Location:
branches/powerups/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/powerups/src/world_entities/extendable.h

    r6113 r6269  
    1717class Extendable : virtual public BaseObject {
    1818
    19  public:
    20 //   Extendable();
    21 //   virtual ~Extendable();
     19  public:
     20   //   virtual ~Extendable();
    2221   virtual bool pickup(PowerUp* powerUp) { return false; };
    2322
    24  private:
     23  protected:
     24    Extendable() { this->setClassID(CL_EXTENDABLE, "Extendable"); };
     25
     26  private:
    2527
    2628};
  • branches/powerups/src/world_entities/power_ups/power_up.cc

    r6243 r6269  
    2323using namespace std;
    2424
    25 Model* PowerUp::sphereModel = NULL;
    26 
    2725PowerUp::PowerUp(float r, float g, float b)
    2826{
    2927  this->respawnType = RESPAWN_NONE;
    30   if(!PowerUp::sphereModel) {
    31     PowerUp::sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
    32   }
     28/*  if(!PowerUp::sphereModel) {*/
     29
     30  Model* sphereModel = new PrimitiveModel(PRIM_SPHERE, 7, 5);
     31
     32  this->setModel(sphereModel);
     33  this->buildObbTree( 4);
    3334  this->sphereMaterial = new Material;
    3435  this->sphereMaterial->setTransparency(.1);
     
    5556    if(dynamic_cast<Extendable*>(entity)->pickup(this))
    5657    {
    57       this->setVisibiliy(false);
     58      this->toList(OM_DEAD_TICK);
    5859    }
    5960  }
     
    6263void PowerUp::draw() const
    6364{
    64   WorldEntity::draw();
    65 
    6665  glMatrixMode(GL_MODELVIEW);
    6766  glPushMatrix();
    68   float matrix[4][4];
    6967
    7068  /* translate */
     
    7270                this->getAbsCoor ().y,
    7371                this->getAbsCoor ().z);
    74   /* rotate */ // FIXME: devise a new Way to rotate this
    75   this->getAbsDir ().matrix (matrix);
    76   glMultMatrixf((float*)matrix);
     72  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     73  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    7774
    78   this->sphereMaterial->select();
    79   sphereModel->draw();
     75   this->sphereMaterial->select();
     76   this->getModel(0)->draw();
    8077
    81   glPopMatrix();
     78   glPopMatrix();
    8279}
    8380
  • branches/powerups/src/world_entities/power_ups/power_up.h

    r6113 r6269  
    3131  virtual void respawn() {};
    3232
    33   static Model* sphereModel;
    34 
    3533private:
    3634  Material* sphereMaterial;
Note: See TracChangeset for help on using the changeset viewer.