Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3238 in orxonox.OLD for orxonox/branches/sound/src/track.cc


Ignore:
Timestamp:
Dec 20, 2004, 2:42:54 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches: updated branches: buerli, nico, sound. And moved bezierTrack to old.bezierTrack. Conflicts resolved in a usefull order.
Conflics mostly resolved in favor of trunk
merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/sound/src/track.cc

    r2636 r3238  
    2121
    2222/**
    23         \brief creates a null Track part
     23   \brief creates a null Track part
    2424*/
    2525Track::Track ()
    2626{
    27         ID = 0;
    28         offset = NULL;
    29         end = NULL;
    30         nextID = 0;
     27  this->ID = 0;
     28  this->offset = NULL;
     29  this->end = NULL;
     30  this->nextID = 0;
    3131}
    3232
    3333/**
    34         \brief creates a functional base Track part
    35         \param number: the ID if this Track part
    36         \param next: the ID of the next Track part
    37         \param start: pointer to an anchor point (Vector) representing the offset of this part
    38         \param finish: pointer to an anchor point (Vector) representing the end of this part
     34   \brief creates a functional base Track part
     35   \param number: the ID if this Track part
     36   \param next: the ID of the next Track part
     37   \param start: pointer to an anchor point (Vector) representing the offset of this part
     38   \param finish: pointer to an anchor point (Vector) representing the end of this part
    3939*/
    4040Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
    4141{
    42         ID = number;
    43         offset = start;
    44         end = finish;
    45         nextID = next;
     42  this->ID = number;
     43  this->offset = start;
     44  this->end = finish;
     45  this->nextID = next;
    4646}
    4747
    4848/**
    49         \brief removes the Track part from memory
     49   \brief removes the Track part from memory
    5050*/
    5151Track::~Track ()
     
    6868   at inside camera boundaries.
    6969*/
    70 void Track::map_camera (Location* lookat, Placement* camplc)
     70void Track::mapCamera (Location* lookat, Placement* camplc)
    7171{
    7272  Line trace(*offset, *end - *offset);
     
    103103   when transfering between track parts.
    104104*/
    105 bool Track::map_coords (Location* loc, Placement* plc)
     105bool Track::mapCoords (Location* loc, Placement* plc)
    106106{
    107         Line trace(*offset, *end - *offset);
    108         float l = trace.len ();
    109        
    110         /* change to the next track? */
    111         if( loc->dist > l)
    112         {
    113                 loc->dist -= l;
    114                 loc->part = nextID;
    115                 //FIXME: loc->track = this;
    116                 return true;
    117         }
    118        
    119         /* this quaternion represents the rotation from start-vector (0,0,1) to the direction of
    120         * the track */
    121         Quaternion dir(trace.a, Vector(0,0,1));
    122 
    123         plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);
    124         plc->w = dir * loc->rot;
    125        
    126         return false;
     107  Line trace(*offset, *end - *offset);
     108  float l = trace.len ();
     109 
     110  /* change to the next track? */
     111  if( loc->dist > l)
     112    {
     113      loc->dist -= l;
     114      loc->part = nextID;
     115      //FIXME: loc->track = this;
     116      return true;
     117    }
     118 
     119  /* this quaternion represents the rotation from start-vector (0,0,1) to the direction of
     120  * the track */
     121  Quaternion dir(trace.a, Vector(0,0,1));
     122 
     123  plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);
     124  plc->w = dir * loc->rot;
     125 
     126  return false;
    127127}
    128128
     129
    129130/**
    130         \brief this is called when a WorldEntity enters a Track part
    131         \param entity: pointer to the WorldEntity in question
    132        
    133         You can do stuff like add or remove effects, do some coordinate finetuning
    134         or whatever in here.
     131   \brief this is called when a WorldEntity enters a Track part
     132   \param entity: pointer to the WorldEntity in question
     133   
     134   You can do stuff like add or remove effects, do some coordinate finetuning
     135   or whatever in here.
    135136*/
    136 void Track::post_enter (WorldEntity* entity)
     137void Track::postEnter (WorldEntity* entity)
    137138{
    138139}
    139140
     141
    140142/**
    141         \brief this is called when a WorldEntity leaves a Track part
    142         \param entity: pointer to the WorldEntity in question
    143        
    144         You can do stuff like add or remove effects, do some coordinate finetuning
    145         or whatever in here.
     143   \brief this is called when a WorldEntity leaves a Track part
     144   \param entity: pointer to the WorldEntity in question
     145   
     146   You can do stuff like add or remove effects, do some coordinate finetuning
     147   or whatever in here.
    146148*/
    147 void Track::post_leave (WorldEntity* entity)
     149void Track::postLeave (WorldEntity* entity)
    148150{
    149151}
    150152
     153
    151154/**
    152         \brief this is called every frame
    153         \param deltaT: amount of time passed since the last frame in seconds
    154        
    155         Do time based or polling scripts here.
     155   \brief this is called every frame
     156   \param deltaT: amount of time passed since the last frame in seconds
     157   
     158   Do time based or polling scripts here.
    156159*/
    157160void Track::tick (float deltaT)
Note: See TracChangeset for help on using the changeset viewer.