Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 3, 2006, 3:45:24 PM (18 years ago)
Author:
bensch
Message:

obetter cruizeer

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

Legend:

Unmodified
Added
Removed
  • branches/single_player_map/src/world_entities/projectiles/laser.cc

    r8362 r9044  
    140140void Laser::draw () const
    141141{
    142   glMatrixMode(GL_MODELVIEW);
    143   glPushMatrix();
    144142  glPushAttrib(GL_ENABLE_BIT);
    145143  glDisable(GL_LIGHTING);
     144
     145  WorldEntity::draw();
     146/*  glMatrixMode(GL_MODELVIEW);
     147  glPushMatrix();
    146148
    147149  float matrix[4][4];
     
    151153  glScalef(2.0, 2.0, 2.0);
    152154  this->getModel()->draw();
     155  glPopMatrix();*/
     156
    153157  glPopAttrib();
    154   glPopMatrix();
    155158}
    156159
  • branches/single_player_map/src/world_entities/space_ships/cruizer.cc

    r9039 r9044  
    7878  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    7979
    80   exit(-1);
    81   this->loadModel("models/ships/human_cruizer.obj");
     80  this->loadModel("models/ships/human_cruizer.obj", 0.05);
     81
    8282}
    8383
     
    9292
    9393  this->setSupportedPlaymodes(Playable::Full3D | Playable::Horizontal | Playable::Vertical);
    94 
    95   this->loadModel("models/ships/hoverglider_wing.obj", 1.0f, 3);
    96   this->loadModel("models/ships/hoverglider_turbine.obj", 1.0f, 4);
    97   this->loadModel("models/ships/hoverglider_turbine_rotors.obj", 1.0f, 5);
    9894
    9995  bForward = bBackward = bLeft = bRight = bAscend = bDescend = false;
     
    117113  //this->cameraNode.setParent(this);
    118114
    119   // rotors
    120   this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT );
    121   this->wingNodeLeft.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    122   this->wingNodeLeft.setParent(this);
    123   this->wingNodeLeft.setRelCoor(-1.5, -.3, -1.0);
    124   this->rotorNodeLeft.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    125   this->rotorNodeLeft.setParent(&this->wingNodeLeft);
    126   this->rotorNodeLeft.setRelCoor(0, 1.0, -2.3);
    127 
    128   this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    129   this->wingNodeRight.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
    130   this->wingNodeRight.setParent(this);
    131   this->wingNodeRight.setRelCoor(-1.5, -0.3, 1.0);
    132   this->rotorNodeRight.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    133   this->rotorNodeRight.setParent(&this->wingNodeRight);
    134   this->rotorNodeRight.setRelCoor(0, 1.0, 2.3);
    135115
    136116  // PARTICLES
    137   this->burstEmitter[0] = new DotEmitter(200, 5.0, .01);
    138   this->burstEmitter[0]->setParent(&this->rotorNodeLeft);
    139   this->burstEmitter[0]->setRelCoor(0, -0.7, 0);
    140   this->burstEmitter[0]->setRelDir(Quaternion(-M_PI_2, Vector(0,0,1)));
    141   this->burstEmitter[0]->setName("Cruizer_Burst_emitter_Left");
    142 
    143   this->burstEmitter[1] = new DotEmitter(200, 5.0, .01);
    144   this->burstEmitter[1]->setParent(&this->rotorNodeRight);
    145   this->burstEmitter[1]->setRelCoor(0, -0.7, 0);
    146   this->burstEmitter[1]->setRelDir(Quaternion(-M_PI_2, Vector(0,0,1)));
    147   this->burstEmitter[1]->setName("Cruizer_Burst_emitter_Right");
     117  this->burstEmitter = new DotEmitter(200, 5.0, .01);
     118  this->burstEmitter->setParent(this);
     119  this->burstEmitter->setRelCoor(0, -0.7, 0);
     120  this->burstEmitter->setRelDir(Quaternion(-M_PI_2, Vector(0,0,1)));
     121  this->burstEmitter->setName("Cruizer_Burst_emitter_Left");
    148122
    149123
    150124  this->burstSystem = new SpriteParticles(1000);
    151   this->burstSystem->addEmitter(this->burstEmitter[0]);
    152   this->burstSystem->addEmitter(this->burstEmitter[1]);
     125  this->burstSystem->addEmitter(this->burstEmitter);
    153126  this->burstSystem->setName("SpaceShip_Burst_System");
    154127  ((SpriteParticles*)this->burstSystem)->setMaterialTexture("maps/radial-trans-noise.png");
     
    181154  this->getWeaponManager().setSlotCount(5);
    182155
    183   this->getWeaponManager().setSlotPosition(0, Vector(-0.28, 1.186, -2.750), &this->wingNodeLeft);
    184   this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    185 
    186   this->getWeaponManager().setSlotPosition(1, Vector(-0.28, 1.186, 2.750), &this->wingNodeRight);
    187   this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    188 
    189156  this->getWeaponManager().setSlotPosition(2, Vector(-1.63, .809, -.003));
    190157  this->getWeaponManager().setSlotCapability(2, WTYPE_HEAVY);
     
    352319
    353320        this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    354 
    355         this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    356         this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
    357 
    358         this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    359         this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
    360       }
     321     }
    361322      break;
    362323
    363     case Playable::Horizontal:
    364       {
    365         accel.y = 0.0;
    366         Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    367         accelerationDir.y = 0.0;
    368 
    369         // this is the air friction (necessary for a smooth control)
    370         Vector damping = (this->velocity * this->airFriction);
    371 
    372 
    373         this->velocity += (accelerationDir - damping)* dt;
    374         this->shiftCoor (this->velocity * dt);
    375 
    376         // limit the maximum rotation speed.
    377         if (this->rotation != 0.0f)
    378         {
    379           float maxRot = 10.0 * dt;
    380           if (unlikely(this->rotation > maxRot)) this->rotation = maxRot;
    381           if (unlikely(this->rotation < -maxRot)) this->rotation = -maxRot;
    382           this->direction *= Quaternion(-M_PI/4.0*this->rotation, Vector(0,1,0));
    383 
    384           this->rotation = 0.0f;
    385         }
    386 
    387         this->setRelDirSoft(this->direction, 5);
    388 
    389         this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    390         this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation, Vector(0,0,1)), 5);
    391 
    392         this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    393         this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation, Vector(0,0,1)), 5);
    394       }
    395       break;
    396 
    397     case Playable::Vertical:
    398     {
    399       accel.z = 0;
    400       Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    401       accelerationDir.z=0;
    402 
    403         // this is the air friction (necessary for a smooth control)
    404       Vector damping = (this->velocity * this->airFriction);
    405 
    406       this->velocity += (accelerationDir - damping)* dt;
    407       this->shiftCoor (this->velocity * dt);
    408 
    409       this->setRelDirSoft(this->direction * Quaternion(-cameraLook, Vector(0,0,1)), 5);
    410 
    411       this->wingNodeLeft.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    412       this->rotorNodeLeft.setRelDirSoft(Quaternion(-accel.x * .07+this->rotation + cameraLook, Vector(0,0,1)), 5);
    413 
    414       this->wingNodeRight.setRelDirSoft(Quaternion(accel.z * .05 +this->rotation, Vector(1,0,0)), 5);
    415       this->rotorNodeRight.setRelDirSoft(Quaternion(-accel.x*.07 -this->rotation + cameraLook, Vector(0,0,1)), 5);
    416     }
    417     break;
    418324    default:
    419325      PRINTF(2)("Playmode %s Not Implemented\n", Playable::playmodeToString(this->getPlaymode()).c_str());
     
    426332  Vector tmpRot;
    427333  WorldEntity::draw();
    428 
    429   glPushMatrix();
    430   /// LEFT SIDE
    431   glTranslatef (this->wingNodeLeft.getAbsCoor ().x,
    432                 this->wingNodeLeft.getAbsCoor ().y,
    433                 this->wingNodeLeft.getAbsCoor ().z);
    434   tmpRot = this->wingNodeLeft.getAbsDir().getSpacialAxis();
    435   glRotatef (this->wingNodeLeft.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    436   this->getModel(3)->draw();
    437   glPopMatrix ();
    438 
    439   glPushMatrix();
    440   glTranslatef (this->rotorNodeLeft.getAbsCoor ().x,
    441                 this->rotorNodeLeft.getAbsCoor ().y,
    442                 this->rotorNodeLeft.getAbsCoor ().z);
    443   tmpRot = this->rotorNodeLeft.getAbsDir().getSpacialAxis();
    444   glRotatef (this->rotorNodeLeft.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    445   this->getModel(4)->draw();
    446   glRotatef(this->rotorCycle, 0,1,0);
    447   this->getModel(5)->draw();
    448   glPopMatrix ();
    449 
    450   /// RIGHT SIDE
    451   glPushMatrix();
    452   glTranslatef (this->wingNodeRight.getAbsCoor ().x,
    453                 this->wingNodeRight.getAbsCoor ().y,
    454                 this->wingNodeRight.getAbsCoor ().z);
    455   tmpRot = this->wingNodeRight.getAbsDir().getSpacialAxis();
    456   glRotatef (this->wingNodeRight.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    457   glScalef(1,1,-1);
    458   this->getModel(3)->draw();
    459   glPopMatrix ();
    460 
    461   glPushMatrix();
    462   glTranslatef (this->rotorNodeRight.getAbsCoor ().x,
    463                 this->rotorNodeRight.getAbsCoor ().y,
    464                 this->rotorNodeRight.getAbsCoor ().z);
    465   tmpRot = this->rotorNodeRight.getAbsDir().getSpacialAxis();
    466   glRotatef (this->rotorNodeRight.getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );
    467   glScalef(1,1,-1);
    468   this->getModel(4)->draw();
    469   glRotatef(this->rotorCycle, 0,1,0);
    470   this->getModel(5)->draw();
    471   glPopMatrix ();
    472334}
    473335
  • branches/single_player_map/src/world_entities/space_ships/cruizer.h

    r9039 r9044  
    5050    float                 mouseSensitivity;   //!< the mouse sensitivity
    5151
    52     PNode                 wingNodeLeft;
    53     PNode                 wingNodeRight;
    54     PNode                 rotorNodeLeft;
    55     PNode                 rotorNodeRight;
    56 
    5752    PNode                 cameraNode;
    5853    float                 cameraLook;
     
    7065    float                 airViscosity;
    7166
    72     ParticleEmitter*      burstEmitter[2];
     67    ParticleEmitter*      burstEmitter;
    7368    ParticleSystem*       burstSystem;
    7469};
Note: See TracChangeset for help on using the changeset viewer.