Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10156 in orxonox.OLD for branches/playability/src/world_entities


Ignore:
Timestamp:
Jan 1, 2007, 9:51:49 PM (18 years ago)
Author:
marcscha
Message:

Addition of billboard calc to wobblegrid. Temp addition to show it of in spaceship

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

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/effects/wobblegrid.cc

    r10154 r10156  
    8989
    9090  this->grid  = new Grid( this->size, this->size, this->subdivision, this->subdivision);
    91   for (int i = 0; i < 25; i++)
    92     PRINTF(0)("Coordinate %i: %f,%f\n",i,this->grid->vertex(i).x,this->grid->vertex(i).z);
    9391  this->angularSpeed = M_PI; //180;
     92  this->setModel(this->grid);
    9493}
    9594
     
    145144  }
    146145  //this->grid->finalize();
     146
     147  Vector view = this->getAbsCoor() - State::getCameraNode()->getAbsCoor();
     148  view.normalize();
     149
     150  Vector up = Vector(0, 1, 0);
     151  Vector h = up.cross(view);
     152  up = h.cross(view);
     153
     154  Quaternion dir = Quaternion::lookAt( this->getAbsCoor(), this->getAbsCoor() + up, view);
     155  this->setAbsDir(dir);
     156
    147157}
    148158
     
    153163void Wobblegrid::draw() const
    154164{
     165
     166//   this->material->select();
     167//   WorldEntity::draw();
     168//   return;
     169
     170
    155171  if( !this->isVisible())
    156172    return;
     
    160176  glDisable(GL_FOG);
    161177
     178  glMatrixMode(GL_MODELVIEW);
    162179  glPushMatrix();
    163180
     
    166183  this->material->select();
    167184
    168   const PNode* camera = State::getCameraNode();  //!< @todo MUST be different
    169   Vector cameraPos = camera->getAbsCoor();
    170   Vector cameraTargetPos = State::getCameraTargetNode()->getAbsCoor();
    171   Vector view = cameraTargetPos - cameraPos;
    172 
    173 
    174   Vector up = Vector(0, 1, 0);
    175   up = camera->getAbsDir().apply(up);
    176   Vector h = up.cross(view);
    177   Vector v = h.cross(view);
    178   h.normalize();
    179   v.normalize();
    180 
    181   float rangle  = acosf(v.dot(view)/view.len());
    182 
    183   v *= size;
    184   h *= size;
    185 
    186 //v += this->getAbsCoor();
    187     //PRINTF(0)("sizeX: %f sizeZ: %f\n", sizeX, sizeZ);
    188   /*int xone = 0;
    189   int zone = 0;
    190185 
    191   glBegin(GL_QUADS);
    192 
    193   for( int z=0; z<4; z++)
    194   {
    195     for( int x=0; x<4; x++)
    196     {
    197       xone = x + 1;
    198       zone = z + 1;
    199       glTexCoord2f(x*.25f,z*.25f);
    200       glVertex3f( this->getAbsCoor().x + this->grid[z][x].x*this->sizeX2 - h.x - v.x,
    201                   this->getAbsCoor().y - h.y - v.y,
    202                   this->getAbsCoor().z + this->grid[z][x].z*this->sizeZ2 - h.z - v.z);
    203 
    204       glTexCoord2f(x*.25f,zone*.25f);
    205       glVertex3f( this->getAbsCoor().x + this->grid[zone][x].x*this->sizeX2 - h.x - v.x,
    206                   this->getAbsCoor().y - h.y - v.y,
    207                   this->getAbsCoor().z + this->grid[zone][x].z*this->sizeZ2 - h.z - v.z);
    208 
    209       glTexCoord2f(xone*.25f,zone*.25f);
    210       glVertex3f( this->getAbsCoor().x + this->grid[zone][xone].x*this->sizeX2 - h.x - v.x,
    211                   this->getAbsCoor().y - h.y - v.y,
    212                   this->getAbsCoor().z + this->grid[zone][xone].z*this->sizeZ2 - h.z - v.z);
    213 
    214       glTexCoord2f(xone*.25f,z*.25f);
    215       glVertex3f( this->getAbsCoor().x + this->grid[z][xone].x*this->sizeX2 - h.x - v.x,
    216                   this->getAbsCoor().y - h.y - v.y,
    217                   this->getAbsCoor().z + this->grid[z][xone].z*this->sizeZ2 - h.z - v.z);
    218     }
    219   }
    220   glEnd();*/
    221186  glTranslatef (this->getAbsCoor ().x,
    222187                  this->getAbsCoor ().y,
    223188                  this->getAbsCoor ().z);
    224   //Vector tmpRot = this->getAbsDir().getSpacialAxis();
    225   glRotatef (rangle, view.x, view.y, view.z );
     189
     190  Vector tmpRot = this->getAbsDir().getSpacialAxis();
     191  glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
     192
     193  //Quaternion  dir = Quaternion(this->getAbsDir().getSpacialAxisAngle(),view);
     194  //this->setAbsDir(dir);
    226195  //glRotatef(this->angle, 0.0, 0.0, 1.0);
    227 
    228196  this->grid->draw();
    229197
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10155 r10156  
    358358
    359359 
    360   this->trail = new Trail( 30, 100, .2, this);
     360  this->trail = new Trail( 10, 10, .2, this);
    361361  //this->trail->setParent( this);
    362362  this->trail->setTexture( "maps/engine.png");
    363363
    364   this->trailL = new Trail( 30, 100, .2, this);
     364  this->trailL = new Trail( 10, 10, .2, this);
    365365  //this->trailL->setParent( this);
    366366  this->trailL->setTexture( "maps/engine.png");
    367367
    368   this->trailR = new Trail( 30, 100, .2, this);
     368  this->trailR = new Trail( 10, 10, .2, this);
    369369  //this->trailR->setParent( this);
    370370  this->trailR->setTexture( "maps/engine.png");
     
    374374
    375375  //FIXME Just testaddition to show the wobblegrid
    376   Wobblegrid* test  = new Wobblegrid(5);
     376  this->test  = new Wobblegrid(5);
    377377  test->setTexture("maps/fichte_ast6.tga");
    378378 
     
    491491{
    492492  // Playable::tick(time);$
    493 
     493  this->test->tick(time);
    494494  // Own Tick Setup, as a different fire routine is used on the weapon manager
    495495  this->weaponMan.tick(time);
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10120 r10156  
    2020class ParticleSystem;
    2121class Trail;
     22class Wobblegrid;
    2223
    2324class SpaceShip : public Playable
     
    199200    Trail*                trailR;              //!< Burst trail
    200201
     202    Wobblegrid*           test;
     203
    201204};
    202205
Note: See TracChangeset for help on using the changeset viewer.