Changeset 3342 in orxonox.OLD for orxonox/branches/parenting
- Timestamp:
- Jan 5, 2005, 3:18:28 PM (20 years ago)
- Location:
- orxonox/branches/parenting/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/parenting/src/camera.cc
r3323 r3342 42 42 this->t = 0.0; 43 43 44 this->actualPlace.r.x = 0.0;45 this->actualPlace.r.y = 10.0;46 this->actualPlace.r.z = -5.0;47 44 48 45 this->setDrawable (false); … … 69 66 //printf("time is: t=%f\n", t ); 70 67 updateDesiredPlace(); 71 jump(NULL);68 //jump(NULL); 72 69 } 73 70 … … 171 168 /* the camera is handled like an entity and rolls on the track */ 172 169 case NORMAL: 173 Location lookat;174 170 if( bound != NULL && world != NULL ) 175 171 { 176 //bound->getLookat (&lookat);177 //bound->getAbsCoor ()178 //world->calcCameraPos (&lookat, &desiredPlace);179 172 //FIXME: camera should be made via relative coordinates 180 173 Vector* cameraOffset = new Vector (-10, 5, 0); … … 254 247 } 255 248 256 /** 257 \brief set the camera position 258 \param plc: The Placement to set the camera to 259 260 This will set the actual and desired placement of the camera to plc 261 */ 262 void Camera::jump (Placement* plc = NULL) 263 { 264 if( plc == NULL) 265 { 266 actualPlace = desiredPlace; 267 //printf("Camera|jump: camer@ %f, %f, %f\n\n", actual_place.r.x, actual_place.r.y, actual_place.r.z); 268 } 269 else 270 { 271 desiredPlace = *plc; 272 actualPlace = *plc; 273 } 274 } 249 275 250 276 251 /** -
orxonox/branches/parenting/src/camera.h
r3302 r3342 27 27 private: 28 28 WorldEntity* bound; //!< the WorldEntity the Camera is bound to 29 Placement actualPlace; //!< the Camera's current position30 Placement desiredPlace; //!< where the Camera should be according to calculations31 29 World* world; 32 30 … … 38 36 39 37 /* elliptical camera mode variables */ 40 Placement plLastBPlace;41 38 float cameraOffset; 42 39 float cameraOffsetZ; … … 64 61 void apply (); 65 62 void bind (WorldEntity* entity); 66 void jump (Placement* plc);67 63 void destroy(); 68 64 -
orxonox/branches/parenting/src/stdincl.h
r3338 r3342 35 35 #include "matrix.h" 36 36 #include "curve.h" 37 #include "coordinates.h"37 //#include "coordinates.h" 38 38 #include "list.h" 39 39 #include "list_template.h" -
orxonox/branches/parenting/src/track.cc
r3302 r3342 61 61 62 62 63 /**64 \brief calculate a camera Placement from a "look at"-Location65 \param lookat: the Location the camera should be centered on66 \param camplc: pointer to a buffer where the new camera Placement should be put into67 68 Theoretically you can place the camera wherever you want, but for the sake of69 common sense I suggest that you at least try to keep the thing that should be looked70 at inside camera boundaries.71 */72 void Track::mapCamera (Location* lookat, Placement* camplc)73 {74 Line trace(*offset, *end - *offset);75 float l = trace.len ();76 77 // camplc->r = *offset + Vector(0,0,0.5);78 // camplc->w = Quaternion (trace.a, Vector(0,0,1));79 float r = (lookat->dist)*PI / l;80 camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);81 82 Vector w(0.0,0.0,0.0);83 w=Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r));84 //Vector up(0.0,sin(r),cos(r)); // corrupt...85 Vector up(0.0, 0.0, 1.0);86 63 87 camplc->w = Quaternion(w, up);88 89 //printf("\n------\nup vector: [%f, %f, %f]\n", up.x, up.y, up.z);90 //printf("direction: [%f, %f, %f]\n", w.x, w.y, w.z);91 //printf("quaternion: w[ %f ], v[ %f, %f, %f ]\n", camplc->w.w, camplc->w.v.x, camplc->w.v.y, camplc->w.v.z);92 }93 94 /**95 \brief calculate a Placement from a given Location96 \param loc: the Location the entity is in97 \param plc: a pointer to a buffer where the corresponding Placement should be put98 into99 \return: true if track changes - false if track stays100 101 There are no limitations to how you transform a Location into a Placement, but for102 the sake of placement compatibility between track parts you should make sure that103 the resulting Placement at dist == 0 is equal to the offset Vector and the Placement104 at dist == len() is equal to the end Vector. Elseway there will be ugly artifacts105 when transfering between track parts.106 */107 bool Track::mapCoords (Location* loc, Placement* plc)108 {109 Line trace(*offset, *end - *offset);110 float l = trace.len ();111 112 /* change to the next track? */113 if( loc->dist > l)114 {115 loc->dist -= l;116 loc->part = nextID;117 //FIXME: loc->track = this;118 return true;119 }120 121 /* this quaternion represents the rotation from start-vector (0,0,1) to the direction of122 * the track */123 Quaternion dir(trace.a, Vector(0,0,1));124 125 plc->r = trace.r + (trace.a * ((loc->dist) / l)) + /*dir.apply*/(loc->pos);126 plc->w = dir * loc->rot;127 128 return false;129 }130 64 131 65 -
orxonox/branches/parenting/src/track.h
r3302 r3342 35 35 virtual void postLeave (WorldEntity* entity); 36 36 virtual void tick (float deltaT); 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 boundaries39 37 }; 40 38 -
orxonox/branches/parenting/src/world.cc
r3339 r3342 751 751 752 752 753 754 /**755 \brief calls the correct mapping function to convert a given "look at"-Location to a756 Camera Placement757 */758 void World::calcCameraPos (Location* loc, Placement* plc)759 {760 track[loc->part].mapCamera (loc, plc);761 }762 763 764 753 void World::setTrackLen(Uint32 len) 765 754 { -
orxonox/branches/parenting/src/world.h
r3338 r3342 24 24 World (int worldID); 25 25 virtual ~World (); 26 27 template<typename T>28 T* spawn (Location* loc, WorldEntity* owner); // template to be able to spawn any derivation of WorldEntity29 template<typename T>30 T* spawn (Placement* plc, WorldEntity* owner);31 26 32 27 virtual ErrorMessage init (); … … 45 40 void draw (); 46 41 void update (); // maps Locations to Placements 47 void calcCameraPos (Location* loc, Placement* plc);42 //void calcCameraPos (Location* loc, Placement* plc); 48 43 49 44 void unload (); -
orxonox/branches/parenting/src/world_entity.cc
r3309 r3342 161 161 162 162 /** 163 \brief basic initialisation for bound Entities164 */165 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)166 {167 // loc = *spawnloc;168 //owner = spawnowner;169 }170 171 /**172 \brief basic initialisation for free Entities173 */174 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)175 {176 //place = *spawnplc;177 //owner = spawnowner;178 }179 180 /**181 163 \brief this is called immediately after the Entity has been constructed and initialized 182 164 -
orxonox/branches/parenting/src/world_entity.h
r3309 r3342 24 24 Object* model; 25 25 26 //PNode* pNode;27 //PN Location* getLocation ();28 //PN Placement* getPlacement ();29 26 void setCollision (CollisionCluster* newhull); 30 27 … … 44 41 virtual void draw (); 45 42 void setDrawable (bool bDraw); 46 //PN virtual void getLookat (Location* locbuf);47 43 48 44 virtual void leftWorld (); … … 53 49 bool bDraw; 54 50 55 //PN WorldEntity* owner;56 51 CollisionCluster* collisioncluster; 57 //PN Placement place;58 //PN Location loc;59 60 void init( Location* spawnloc, WorldEntity* spawnowner);61 void init( Placement* spawnplc, WorldEntity* spawnowner);62 52 }; 63 53
Note: See TracChangeset
for help on using the changeset viewer.