Changeset 3232 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Dec 20, 2004, 12:52:09 AM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/track.cc
r3005 r3232 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) -
orxonox/trunk/src/track.h
r3224 r3232 25 25 Uint32 nextID; 26 26 27 27 28 28 public: 29 29 Track (); … … 32 32 virtual void init(); 33 33 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); 36 36 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 boundaries37 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 39 39 }; 40 40
Note: See TracChangeset
for help on using the changeset viewer.