Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10698 in orxonox.OLD for trunk/src/util/track


Ignore:
Timestamp:
Jun 14, 2007, 5:33:43 PM (18 years ago)
Author:
snellen
Message:

merged adm, hud, vs-enhancements : beni's responsible for this commit. blame him!

Location:
trunk/src/util/track
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/util/track/track.cc

    r10618 r10698  
    2929
    3030#include "debug.h"
     31#include "action_box.h"
    3132
    3233ObjectListDefinition(Track);
     
    6566  this->duration = 20;
    6667  this->endTime = 20;
    67   this->width = 10;
     68  this->width = 24;
     69  this->height = 18;
     70  this->depth = 200;
     71  this->stretch = 4;
    6872  this->curve = new BezierCurve();
    6973  this->trackNode = new PNode(PNode::getNullParent(), PNODE_ALL);
     
    7175  this->localTime = 0;
    7276  this->pause = false;
     77 
     78  this->actionBox = NULL;
    7379}
    7480
     
    94100     }
    95101     LOAD_PARAM_END_CYCLE(element);
     102
     103     LoadParam(root, "ActionBox", this, Track, addActionBox );
    96104}
    97105
     
    252260       {
    253261           Vector tmp = this->calcPos();
    254    
    255    
     262
     263
    256264           Vector dV = tmp - this->trackNode->getAbsCoor();
    257265           float dx = speed * dt;
    258266           float ratio = dx / dV.len();
    259    
     267
    260268           if( dt > 0.0f)
    261269           {
     
    264272           }
    265273           tmp = this->calcPos();
    266    
     274
    267275           Vector v(0.0, 1.0, 0.0);
    268276           Quaternion quat = Quaternion(this->calcDir(), v);
    269277           Quaternion q(-PI/2, v);
    270278           quat = quat * q;
    271    
     279
    272280           // move trackNode of the track
    273281           this->trackNode->shiftCoor(tmp - this->trackNode->getAbsCoor());
     
    331339    glPopMatrix();
    332340}
     341
     342/**
     343 * creates new action box and assignes it to this track
     344 * @param width_2 width/2 of near end
     345 * @param height_2 height/2 of near end
     346 * @param depth depth
     347 * @param stretch far end will be stretched with this factor
     348 */
     349void Track::addActionBox( float width_2, float height_2, float depth, float stretch )
     350{
     351  actionBox = new ActionBox( this, width_2, height_2, depth, stretch );
     352}
     353
     354
     355
  • trunk/src/util/track/track.h

    r10498 r10698  
    1212class PNode;
    1313class TiXmlElement;
     14class ActionBox;
    1415
    1516class Track : public BaseObject
     
    4243   float                 duration;             //!< The time used to cross this Track (curve).
    4344   float                 endTime;              //!< The time at which this Track ends.
    44    float                 width;                //!< Th width of the Path. This tells the Player(s), how far he(they) can go to the left/right.
     45   float                 width;                //!< The width of the action box, next to the player.
     46   float                 height;               //!< The Height of the action box, next to the player
     47   float                 depth;                //!< Depth of the action box
     48   float                 stretch;              //!< multiplyer between w/h at player and w/h at far end of the action box
    4549
    4650   int                   nodeCount;            //!< The count of points this Track has.
    4751   Curve*                curve;                //!< The Curve of this Track
     52   
     53   ActionBox*            getActionBox(){ return this->actionBox; }
    4854
    4955 private:
    5056   void init();
    51 
    52 
     57   
    5358 private:
    5459   CurveType            curveType;              //!< The CurveType the entire TrackSystem will have.
     
    5762   int                  mode;                   //!< Defines the behaviour of the Track.
    5863   bool                 pause;                  //!< Defines if the track runs (false) or not (true)
     64   
     65   ActionBox*           actionBox;
     66   
     67   void addActionBox( float width_2, float height_2, float depth, float stretch );
     68   
     69
    5970};
    6071
Note: See TracChangeset for help on using the changeset viewer.