Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3342 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Jan 5, 2005, 3:18:28 PM (20 years ago)
Author:
patrick
Message:

orxonox/branches/parenting: removed old coordinates.h system now using parenting for the game

Location:
orxonox/branches/parenting/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/parenting/src/camera.cc

    r3323 r3342  
    4242  this->t = 0.0;
    4343
    44   this->actualPlace.r.x = 0.0;
    45   this->actualPlace.r.y = 10.0;
    46   this->actualPlace.r.z = -5.0;
    4744
    4845  this->setDrawable (false);
     
    6966  //printf("time is: t=%f\n", t );
    7067  updateDesiredPlace();
    71   jump(NULL);
     68  //jump(NULL);
    7269}
    7370
     
    171168      /* the camera is handled like an entity and rolls on the track */
    172169    case NORMAL:
    173       Location lookat; 
    174170      if( bound != NULL && world != NULL )
    175171        {
    176           //bound->getLookat (&lookat);
    177           //bound->getAbsCoor ()
    178           //world->calcCameraPos (&lookat, &desiredPlace);
    179172          //FIXME: camera should be made via relative coordinates
    180173          Vector* cameraOffset = new Vector (-10, 5, 0);
     
    254247}
    255248
    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
    275250
    276251/**
  • orxonox/branches/parenting/src/camera.h

    r3302 r3342  
    2727 private:
    2828  WorldEntity* bound;           //!< the WorldEntity the Camera is bound to
    29   Placement actualPlace;                //!< the Camera's current position
    30   Placement desiredPlace;        //!< where the Camera should be according to calculations
    3129  World* world;
    3230 
     
    3836 
    3937  /* elliptical camera mode variables */
    40   Placement plLastBPlace;
    4138  float cameraOffset;
    4239  float cameraOffsetZ;
     
    6461  void apply ();
    6562  void bind (WorldEntity* entity);
    66   void jump (Placement* plc);
    6763  void destroy();
    6864
  • orxonox/branches/parenting/src/stdincl.h

    r3338 r3342  
    3535#include "matrix.h"
    3636#include "curve.h"
    37 #include "coordinates.h"
     37//#include "coordinates.h"
    3838#include "list.h"
    3939#include "list_template.h"
  • orxonox/branches/parenting/src/track.cc

    r3302 r3342  
    6161
    6262
    63 /**
    64    \brief calculate a camera Placement from a "look at"-Location
    65    \param lookat: the Location the camera should be centered on
    66    \param camplc: pointer to a buffer where the new camera Placement should be put into
    67    
    68    Theoretically you can place the camera wherever you want, but for the sake of
    69    common sense I suggest that you at least try to keep the thing that should be looked
    70    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);
    8663
    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 Location
    96    \param loc: the Location the entity is in
    97    \param plc: a pointer to a buffer where the corresponding Placement should be put
    98    into
    99    \return: true if track changes - false if track stays
    100    
    101    There are no limitations to how you transform a Location into a Placement, but for
    102    the sake of placement compatibility between track parts you should make sure that
    103    the resulting Placement at dist == 0 is equal to the offset Vector and the Placement
    104    at dist == len() is equal to the end Vector. Elseway there will be ugly artifacts
    105    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 of
    122    * 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 }
    13064
    13165
  • orxonox/branches/parenting/src/track.h

    r3302 r3342  
    3535  virtual void postLeave (WorldEntity* entity);
    3636  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 boundaries
    3937};
    4038
  • orxonox/branches/parenting/src/world.cc

    r3339 r3342  
    751751
    752752
    753 
    754 /**
    755    \brief calls the correct mapping function to convert a given "look at"-Location to a
    756    Camera Placement
    757 */
    758 void World::calcCameraPos (Location* loc, Placement* plc)
    759 {
    760   track[loc->part].mapCamera (loc, plc);
    761 }
    762 
    763 
    764753void World::setTrackLen(Uint32 len)
    765754{
  • orxonox/branches/parenting/src/world.h

    r3338 r3342  
    2424  World (int worldID);
    2525  virtual ~World ();
    26 
    27   template<typename T>
    28     T* spawn (Location* loc, WorldEntity* owner);       // template to be able to spawn any derivation of WorldEntity
    29   template<typename T>
    30     T* spawn (Placement* plc, WorldEntity* owner);
    3126 
    3227  virtual ErrorMessage init ();
     
    4540  void draw ();
    4641  void update ();       // maps Locations to Placements
    47   void calcCameraPos (Location* loc, Placement* plc);
     42  //void calcCameraPos (Location* loc, Placement* plc);
    4843       
    4944  void unload ();
  • orxonox/branches/parenting/src/world_entity.cc

    r3309 r3342  
    161161
    162162/**
    163    \brief basic initialisation for bound Entities
    164 */
    165 void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
    166 {
    167   //  loc = *spawnloc;
    168   //owner = spawnowner;
    169 }
    170 
    171 /**
    172    \brief basic initialisation for free Entities
    173 */
    174 void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
    175 {
    176   //place = *spawnplc;
    177   //owner = spawnowner;
    178 }
    179 
    180 /**
    181163   \brief this is called immediately after the Entity has been constructed and initialized
    182164   
  • orxonox/branches/parenting/src/world_entity.h

    r3309 r3342  
    2424  Object* model;
    2525 
    26   //PNode* pNode;
    27   //PN Location* getLocation ();
    28   //PN Placement* getPlacement ();
    2926  void setCollision (CollisionCluster* newhull);
    3027 
     
    4441  virtual void draw ();
    4542  void setDrawable (bool bDraw);
    46   //PN virtual void getLookat (Location* locbuf);
    4743 
    4844  virtual void leftWorld ();
     
    5349  bool bDraw;
    5450
    55   //PN WorldEntity* owner;
    5651  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);
    6252};
    6353
Note: See TracChangeset for help on using the changeset viewer.