Changeset 3238 in orxonox.OLD for orxonox/branches/sound/src/track.cc
- Timestamp:
- Dec 20, 2004, 2:42:54 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/sound/src/track.cc
r2636 r3238 21 21 22 22 /** 23 23 \brief creates a null Track part 24 24 */ 25 25 Track::Track () 26 26 { 27 28 29 30 27 this->ID = 0; 28 this->offset = NULL; 29 this->end = NULL; 30 this->nextID = 0; 31 31 } 32 32 33 33 /** 34 35 36 37 38 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 39 */ 40 40 Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish) 41 41 { 42 43 44 45 42 this->ID = number; 43 this->offset = start; 44 this->end = finish; 45 this->nextID = next; 46 46 } 47 47 48 48 /** 49 49 \brief removes the Track part from memory 50 50 */ 51 51 Track::~Track () … … 68 68 at inside camera boundaries. 69 69 */ 70 void Track::map _camera (Location* lookat, Placement* camplc)70 void Track::mapCamera (Location* lookat, Placement* camplc) 71 71 { 72 72 Line trace(*offset, *end - *offset); … … 103 103 when transfering between track parts. 104 104 */ 105 bool Track::map _coords (Location* loc, Placement* plc)105 bool Track::mapCoords (Location* loc, Placement* plc) 106 106 { 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 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; 127 127 } 128 128 129 129 130 /** 130 131 132 133 134 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. 135 136 */ 136 void Track::post _enter (WorldEntity* entity)137 void Track::postEnter (WorldEntity* entity) 137 138 { 138 139 } 139 140 141 140 142 /** 141 142 143 144 145 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. 146 148 */ 147 void Track::post _leave (WorldEntity* entity)149 void Track::postLeave (WorldEntity* entity) 148 150 { 149 151 } 150 152 153 151 154 /** 152 153 154 155 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. 156 159 */ 157 160 void Track::tick (float deltaT)
Note: See TracChangeset
for help on using the changeset viewer.