Changeset 2141 in orxonox.OLD for orxonox/branches/chris/src/track.cc
- Timestamp:
- Jul 14, 2004, 3:31:42 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/chris/src/track.cc
r2115 r2141 20 20 using namespace std; 21 21 22 /** 23 \brief creates a null Track part 24 */ 22 25 Track::Track () 23 26 { … … 28 31 } 29 32 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 */ 30 40 Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish) 31 41 { … … 36 46 } 37 47 48 /** 49 \brief removes the Track part from memory 50 */ 38 51 Track::~Track () 39 52 { 40 53 } 41 54 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 */ 42 63 void Track::map_camera (Location* lookat, Placement* camplc) 43 64 { 44 printf("Track|Mapping camera: %d (%f)\n", lookat->part, lookat->dist);45 65 Line trace(*offset, *end - *offset); 46 66 float l = trace.len (); … … 48 68 // camplc->r = *offset + Vector(0,0,0.5); 49 69 // camplc->w = Quaternion (trace.a, Vector(0,0,1)); 50 70 float r = (lookat->dist)*PI / l; 51 71 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))); 53 73 54 74 } 55 75 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 */ 56 85 bool Track::map_coords (Location* loc, Placement* plc) 57 86 { 58 printf("Track|Mapping coords: %d (%f)\n", loc->part, loc->dist);59 87 Line trace(*offset, *end - *offset); 60 88 float l = trace.len (); … … 75 103 } 76 104 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 */ 77 111 void Track::post_enter (WorldEntity* entity) 78 112 { 79 113 } 80 114 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 */ 81 121 void Track::post_leave (WorldEntity* entity) 82 122 { 83 123 } 84 124 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 */ 85 131 void Track::tick (float deltaT) 86 132 {
Note: See TracChangeset
for help on using the changeset viewer.