Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2141 in orxonox.OLD for orxonox/branches/chris/src/track.cc


Ignore:
Timestamp:
Jul 14, 2004, 3:31:42 PM (21 years ago)
Author:
chris
Message:

orxonox/branches/chris: added lots and lots of doxygen tags

File:
1 edited

Legend:

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

    r2115 r2141  
    2020using namespace std;
    2121
     22/**
     23        \brief creates a null Track part
     24*/
    2225Track::Track ()
    2326{
     
    2831}
    2932
     33/**
     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
     39*/
    3040Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
    3141{
     
    3646}
    3747
     48/**
     49        \brief removes the Track part from memory
     50*/
    3851Track::~Track ()
    3952{
    4053}
    4154
     55/**
     56        \brief calculate a camera Placement from a "look at"-Location
     57        \param lookat: the Location the camera should be centered on
     58        \param camplc: pointer to a buffer where the new camera Placement should be put into
     59       
     60        Theoretically you can place the camera wherever you want, but for the sake of common sense I suggest that you at least
     61        try to keep the thing that should be looked at inside camera boundaries.
     62*/
    4263void Track::map_camera (Location* lookat, Placement* camplc)
    4364{
    44 printf("Track|Mapping camera: %d (%f)\n", lookat->part, lookat->dist);
    4565        Line trace(*offset, *end - *offset);
    4666        float l = trace.len ();
     
    4868//      camplc->r = *offset + Vector(0,0,0.5);
    4969//      camplc->w = Quaternion (trace.a, Vector(0,0,1));
    50        
     70        float r = (lookat->dist)*PI / l;
    5171        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    52         camplc->w = Quaternion(Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r)), Vector(0,0,1));
     72        camplc->w = Quaternion(Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r)), Vector(0,sin(r),cos(r)));
    5373       
    5474}
    5575
     76/**
     77        \brief calculate a Placement from a given Location
     78        \param loc: the Location the entity is in
     79        \param plc: a pointer to a buffer where the corresponding Placement should be put into
     80       
     81        There are no limitations to how you transform a Location into a Placement, but for the sake of placement compatibility between
     82        track parts you should make sure that the resulting Placement at dist == 0 is equal to the offset Vector and the Placement at
     83        dist == len() is equal to the end Vector. Elseway there will be ugly artifacts when transfering between track parts.
     84*/
    5685bool Track::map_coords (Location* loc, Placement* plc)
    5786{
    58 printf("Track|Mapping coords: %d (%f)\n", loc->part, loc->dist);
    5987        Line trace(*offset, *end - *offset);
    6088        float l = trace.len ();
     
    75103}
    76104
     105/**
     106        \brief this is called when a WorldEntity enters a Track part
     107        \param entity: pointer to the WorldEntity in question
     108       
     109        You can do stuff like add or remove effects, do some coordinate finetuning or whatever in here.
     110*/
    77111void Track::post_enter (WorldEntity* entity)
    78112{
    79113}
    80114
     115/**
     116        \brief this is called when a WorldEntity leaves a Track part
     117        \param entity: pointer to the WorldEntity in question
     118       
     119        You can do stuff like add or remove effects, do some coordinate finetuning or whatever in here.
     120*/
    81121void Track::post_leave (WorldEntity* entity)
    82122{
    83123}
    84124
     125/**
     126        \brief this is called every frame
     127        \param deltaT: amount of time passed since the last frame in seconds
     128       
     129        Do time based or polling scripts here.
     130*/
    85131void Track::tick (float deltaT)
    86132{
Note: See TracChangeset for help on using the changeset viewer.