Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3232 in orxonox.OLD


Ignore:
Timestamp:
Dec 20, 2004, 12:52:09 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: unstable - cleared track

Location:
orxonox/trunk/src
Files:
2 edited

Legend:

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

    r3005 r3232  
    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)
  • orxonox/trunk/src/track.h

    r3224 r3232  
    2525  Uint32 nextID;
    2626 
    27         
     27  
    2828 public:
    2929  Track ();
     
    3232  virtual void init();
    3333 
    34   virtual void post_enter (WorldEntity* entity);        // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
    35   virtual void post_leave (WorldEntity* entity);
     34  virtual void postEnter (WorldEntity* entity); // handle coordinate transition in here !!! (when dist < 0 or dist > lasttracklenght)
     35  virtual void postLeave (WorldEntity* entity);
    3636  virtual void tick (float deltaT);
    37   virtual void map_camera (Location* lookat, Placement* camplc);
    38   virtual bool map_coords (Location* loc, Placement* plc);      // this should return true if the entity left track boundaries
     37  virtual void mapCamera (Location* lookat, Placement* camplc);
     38  virtual bool mapCoords (Location* loc, Placement* plc);       // this should return true if the entity left track boundaries
    3939};
    4040
Note: See TracChangeset for help on using the changeset viewer.