Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6799 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jan 27, 2006, 4:16:02 PM (19 years ago)
Author:
bensch
Message:

trunk: new Hover

Location:
trunk/src
Files:
3 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/graphics/importer/material.cc

    r6763 r6799  
    112112      glEnable(GL_BLEND);
    113113      glBlendFunc(GL_SRC_ALPHA, GL_ONE);
    114       glColor4f(*(this->diffuse), *(this->diffuse+1), *(this->diffuse+2), this->transparency);
     114      //glColor4f(*(this->diffuse), *(this->diffuse+1), *(this->diffuse+2), this->transparency);
    115115    }
    116116  else
    117117    {
    118118      glDisable(GL_BLEND);
    119       glColor4f(*(this->diffuse), *(this->diffuse+1), *(this->diffuse+2), 1);
     119      //glColor4f(*(this->diffuse), *(this->diffuse+1), *(this->diffuse+2), 1);
    120120    }
    121121
  • trunk/src/lib/particles/sprite_particles.cc

    r6729 r6799  
    106106
    107107  Particle* drawPart = particles;
     108  this->material.select();
    108109
    109110  GLboolean checkLight = false;
     
    111112  if (checkLight == GL_TRUE)
    112113    glDisable(GL_LIGHTING);
     114  glEnable(GL_ALPHA_TEST);
     115  glEnable(GL_DEPTH_TEST);
     116  glClearDepth(1.0);
     117  glDepthFunc(GL_LEQUAL);
     118  glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
     119  glEnable(GL_BLEND);
     120  glAlphaFunc(GL_GREATER,0.1);
     121  glEnable(GL_ALPHA_TEST);
     122  glEnable(GL_TEXTURE_2D);
     123  glEnable(GL_CULL_FACE);
     124
    113125  glMatrixMode(GL_MODELVIEW);
    114   glDepthMask(GL_FALSE);
    115 
    116   material.select();
    117   glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
     126  //glDepthMask(GL_FALSE);
     127//glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA);
    118128
    119129  glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE);
     
    160170    drawPart = drawPart->next;
    161171  }
    162   glDepthMask(GL_TRUE);
     172  //glDepthMask(GL_TRUE);
    163173  glPopAttrib();
    164174}
  • trunk/src/world_entities/space_ships/hover.cc

    r6780 r6799  
    1717#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
    1818
    19 #include "helicopter.h"
     19#include "hover.h"
    2020
    2121#include "weapons/weapon_manager.h"
     
    3333using namespace std;
    3434
    35 CREATE_FACTORY(Helicopter, CL_HELICOPTER);
    36 
    37 /**
    38  *  creates the controlable Helicopter
    39  */
    40 Helicopter::Helicopter()
     35CREATE_FACTORY(Hover, CL_HOVER);
     36
     37/**
     38 *  creates the controlable Hover
     39 */
     40Hover::Hover()
    4141{
    4242  this->init();
     
    4444
    4545/**
    46  *  destructs the helicopter, deletes alocated memory
    47  */
    48 Helicopter::~Helicopter ()
    49 {
    50 }
    51 
    52 /**
    53  * loads a Helicopter information from a specified file.
    54  * @param fileName the name of the File to load the helicopter from (absolute path)
    55  */
    56 Helicopter::Helicopter(const char* fileName)
     46 *  destructs the hover, deletes alocated memory
     47 */
     48Hover::~Hover ()
     49{
     50}
     51
     52/**
     53 * loads a Hover information from a specified file.
     54 * @param fileName the name of the File to load the hover from (absolute path)
     55 */
     56Hover::Hover(const char* fileName)
    5757{
    5858  this->init();
     
    6161  if(!doc.LoadFile())
    6262  {
    63     PRINTF(2)("Loading file %s failed for Helicopter.\n", fileName);
     63    PRINTF(2)("Loading file %s failed for Hover.\n", fileName);
    6464    return;
    6565  }
     
    7474   @todo add more parameters to load
    7575*/
    76 Helicopter::Helicopter(const TiXmlElement* root)
     76Hover::Hover(const TiXmlElement* root)
    7777{
    7878  this->init();
     
    101101
    102102/**
    103  * initializes a Helicopter
    104  */
    105 void Helicopter::init()
     103 * initializes a Hover
     104 */
     105void Hover::init()
    106106{
    107107//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    108   this->setClassID(CL_HELICOPTER, "Helicopter");
    109 
    110   PRINTF(4)("HELICOPTER INIT\n");
    111 
    112   this->loadModel("models/ships/helicopter_#.obj", 1.0);
     108  this->setClassID(CL_HOVER, "Hover");
     109
     110  PRINTF(4)("HOVER INIT\n");
     111
     112  this->loadModel("models/ships/hover_#.obj", 1.0);
    113113
    114114  EventHandler::getInstance()->grabEvents(true);
     
    124124
    125125  //cycle = 0.0;
    126  
     126
    127127  // cameraissue
    128128  this->cameraNode.setParent(this);
    129129  this->cameraNode.setParentMode(PNODE_ALL);
    130  
    131  
     130
     131
    132132  // rotors
    133133  this->topRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    134134  this->tailRotor.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    135  
     135
    136136  this->topRotor.setParent(this);
    137137  this->tailRotor.setParent(this);
    138  
     138
    139139  this->topRotor.setRelCoor(Vector(-0.877,0.627,0));
    140140  this->tailRotor.setRelCoor(Vector(-4.43,0.297,0.068));
    141141  this->tailRotor.setAbsDir(Quaternion(M_PI_2,Vector(1,0,0)));
    142  
     142
    143143  this->loadModel("models/ships/rotor.obj",1.0,3);
    144144  this->loadModel("models/ships/rotor.obj",0.2,4);
     
    205205
    206206/**
    207  * loads the Settings of a Helicopter from an XML-element.
     207 * loads the Settings of a Hover from an XML-element.
    208208 * @param root the XML-element to load the Spaceship's properties from
    209209 */
    210 void Helicopter::loadParams(const TiXmlElement* root)
     210void Hover::loadParams(const TiXmlElement* root)
    211211{
    212212  WorldEntity::loadParams(root);
    213213}
    214214
    215 void  Helicopter::attachCamera()
     215void  Hover::attachCamera()
    216216{
    217217  State::getCamera()->setParentSoft(this->getWeaponManager()->getFixedTarget());
     
    221221
    222222
    223 void Helicopter::enter()
     223void Hover::enter()
    224224{
    225225  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
     
    229229}
    230230
    231 void Helicopter::leave()
     231void Hover::leave()
    232232{
    233233  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
     
    238238
    239239/**
    240  *  effect that occurs after the Helicopter is spawned
    241 */
    242 void Helicopter::postSpawn ()
     240 *  effect that occurs after the Hover is spawned
     241*/
     242void Hover::postSpawn ()
    243243{
    244244  //setCollision(new CollisionCluster(1.0, Vector(0,0,0)));
     
    246246
    247247/**
    248  *  the action occuring if the helicopter left the game
    249 */
    250 void Helicopter::leftWorld ()
     248 *  the action occuring if the hover left the game
     249*/
     250void Hover::leftWorld ()
    251251{}
    252252
     
    257257 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
    258258 */
    259 void Helicopter::collidesWith(WorldEntity* entity, const Vector& location)
     259void Hover::collidesWith(WorldEntity* entity, const Vector& location)
    260260{
    261261  if (entity->isA(CL_TURRET_POWER_UP))
     
    272272 * @param time The timespan passed since last update
    273273*/
    274 void Helicopter::tick (float time)
     274void Hover::tick (float time)
    275275{
    276276  if( xMouse != 0 || yMouse != 0)
     
    281281    else if (yMouse < -controlVelocityY) yMouse = -controlVelocityY;
    282282  }
    283  
     283
    284284  // rotorrotation
    285285  this->topRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    286286  this->tailRotor.shiftDir(Quaternion(time*10, Vector(0,1,0)));
    287  
     287
    288288  // spaceship controlled movement
    289289  this->calculateVelocity(time);
     
    293293  // this is the air friction (necessary for a smooth control)
    294294  if(velocity.len() != 0) velocity -= velocity*0.1;
    295  
     295
    296296  //travelSpeed = velocity.len();
    297297
     
    301301  this->shiftCoor(getAbsDirY()*rotorspeed);
    302302  */
    303  
     303
    304304  /*
    305305  //hoover effect
     
    326326 * @param time the timeslice since the last frame
    327327*/
    328 void Helicopter::calculateVelocity (float time)
     328void Hover::calculateVelocity (float time)
    329329{
    330330  Vector accel(0.0, 0.0, 0.0);
     
    338338     //this->shiftCoor(this->getAbsDirX());
    339339     //accel -= this->getAbsDirY();
    340      
     340
    341341     accel += Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
    342342     if((this->getAbsDirX()).y >= -0.1) rotValZ -= time;
     
    351351     //this->shiftCoor((this->getAbsDirX())*-1);
    352352     //accel -= this->getAbsDirY();
    353      
     353
    354354     accel -= Vector((this->getAbsDirX()).x,0,(this->getAbsDirX()).z);
    355355     rotValZ += time;
     
    365365    //accel -= this->getAbsDirY();
    366366    //velocityDir.normalize();
    367    
     367
    368368    accel -= Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
    369369    rotValX -= time;
     
    379379    //accel += this->getAbsDirY();
    380380    //velocityDir.normalize();
    381    
     381
    382382    accel += Vector((this->getAbsDirZ()).x,0,(this->getAbsDirZ()).z);
    383383    rotValX += time;
     
    443443
    444444
    445 void Helicopter::draw() const
     445void Hover::draw() const
    446446{
    447447  WorldEntity::draw();
    448  
     448
    449449  glMatrixMode(GL_MODELVIEW);
    450450    glPushMatrix();
     
    478478 * weapon manipulation by the player
    479479*/
    480 void Helicopter::weaponAction()
     480void Hover::weaponAction()
    481481{
    482482  if( this->bFire)
     
    489489 * @todo switch statement ??
    490490 */
    491 void Helicopter::process(const Event &event)
     491void Hover::process(const Event &event)
    492492{
    493493
     
    517517
    518518    this->shiftDir(Quaternion(-M_PI/4*xMouse*mouseSensitivity, Vector(0,1,0)));
    519    
     519
    520520    Quaternion yDir = Quaternion(-M_PI/4*yMouse*mouseSensitivity, Vector(0,0,1));
    521521
    522    
     522
    523523    if ((this->cameraNode.getAbsDirY()).y < 0.5)
    524524    {
     
    538538#include "weapons/aiming_turret.h"
    539539// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
    540 void Helicopter::ADDWEAPON()
     540void Hover::ADDWEAPON()
    541541{
    542542  Weapon* turret = NULL;
  • trunk/src/world_entities/space_ships/hover.h

    r6780 r6799  
    11
    22/*!
    3  * @file helicopter.h
    4  * Implements the Control of a Helicopter
     3 * @file hover.h
     4 * Implements the Control of a Hover
    55 */
    66
    7 #ifndef _HELICOPTER_H
    8 #define _HELICOPTER_H
     7#ifndef _HOVER_H
     8#define _HOVER_H
    99
    1010#include "playable.h"
    1111
    1212
    13 class Helicopter : public Playable
     13class Hover : public Playable
    1414{
    1515
    1616  public:
    1717
    18     Helicopter();
    19     Helicopter(const char* fileName);
    20     Helicopter(const TiXmlElement* root);
    21     virtual ~Helicopter();
     18    Hover();
     19    Hover(const char* fileName);
     20    Hover(const TiXmlElement* root);
     21    virtual ~Hover();
    2222
    2323    void init();
     
    6363    int                   controlVelocityY;
    6464    //float                 cycle;              //!< hovercycle
    65    
     65
    6666    PNode                 topRotor;
    6767    PNode                 tailRotor;
    68    
     68
    6969    PNode                 cameraNode;
    7070
     
    8080};
    8181
    82 #endif /* _HELICOPTERS_H */
     82#endif /* _HOVERS_H */
  • trunk/src/world_entities/weapons/cannon.cc

    r6671 r6799  
    7474//  this->model = (Model*)ResourceManager::getInstance()->load("models/guns/test_gun.obj", OBJ, RP_CAMPAIGN);
    7575
    76   this->loadModel("models/guns/cannon.obj");
     76  this->loadModel("models/guns/plasmadriver_#.obj");
    7777
    7878  this->setStateDuration(WS_SHOOTING, 2.0);
Note: See TracChangeset for help on using the changeset viewer.