Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3399 in orxonox.OLD for orxonox/branches/nico/src/camera.cc


Ignore:
Timestamp:
Feb 6, 2005, 11:27:25 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/nico: merged trunk into branches/nico
merged with command:
svn merge ../trunk/ nico/ -r 3238:HEAD
resolved conflict in favor of branches/nico.

Location:
orxonox/branches/nico
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/nico

    • Property svn:externals set to
  • orxonox/branches/nico/src/camera.cc

    r3238 r3399  
    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;
     44
     45  this->setDrawable (false);
    4746}
    4847
     
    6766  //printf("time is: t=%f\n", t );
    6867  updateDesiredPlace();
    69   jump(NULL);
     68  //jump(NULL);
    7069}
    7170
     
    8382    case ELLIPTICAL:
    8483      {
     84        /*
    8585        //r = actual_place.r
    8686        Orxonox *orx = Orxonox::getInstance();
     
    9595              {
    9696                Vector *start = new Vector(0.0, 1.0, 0.0);
    97                 //r = /*actual_place.r*/ *start - plFocus.r;
    9897                r = *(new Vector(0.0, 5.0, 0.0));
    9998
     
    120119            //printf("vector r = %f, %f, %f\n",r.x, r.y, r.z );
    121120            rAbs = r.len();
    122             if(t < 30.0) /* FIXME!!*/
     121            if(t < 30)
    123122              {
    124123                ka = rAbs / deltaTime*deltaTime;
    125124              }
    126             /* this is the new length of the vector */
    127             //float len = ka * powf((deltaTime - t), 2);
    128            
    129             /* calc the rotation */
    130             /*
    131             Vector axis(0.0, 0.0, 1.0);
    132             if(t < 30.0)
    133               a0 = PI/4 - atanf(fabs(r.x) / fabs(r.y));
    134             printf("a0 = %f\n", a0);
    135             float angle = a0/deltaTime * (deltaTime - t);
    136             printf("angle is: %f\n", angle);
    137             Quaternion q(angle, axis);
    138             */
    139             //r = q.apply(r);
    140             //r = r * (len/r.len());
    141            
    142             //res->quatSlerp(from, to, t/deltaTime, res);
     125
    143126            res->quatSlerp(to, from, t/deltaTime, res);
    144127
    145128            Vector ursp(0.0, 0.0, 0.0);
    146             desiredPlace.r = /*plFocus.r -*/ ursp - res->apply(r);
     129            desiredPlace.r = ursp - res->apply(r);
    147130
    148131            printf("desired place is: %f, %f, %f\n", desiredPlace.r.x, desiredPlace.r.y, desiredPlace.r.z);
    149132            //plLastBPlace = *bound->get_placement();
     133           
    150134          }
     135      */
    151136      }
    152137      break;
    153138    case SMOTH_FOLLOW:
    154139      {
     140        /*
    155141        Placement *plBound = bound->getPlacement();
    156142        Location lcBound;
     
    160146            Vector vDirection(0.0, 0.0, 1.0);
    161147            vDirection = plBound->w.apply(vDirection);
    162             desiredPlace.r = (vDirection * ((lcBound.dist-10.0)/* / l*/)) + Vector(0,0,5.0);
     148            desiredPlace.r = (vDirection * ((lcBound.dist-10.0))) + Vector(0,0,5.0);
    163149          }
     150        */
    164151        break;
    165152      }
     
    167154    case STICKY:
    168155      {
     156        /*
    169157        if(bound != null)
    170158          {
     
    175163            desiredPlace.r = plBound->r - vDirection*10 + eclipticOffset;
    176164          }
     165        */
    177166        break;
    178167      }
    179168      /* the camera is handled like an entity and rolls on the track */
    180169    case NORMAL:
    181       Location lookat; 
    182170      if( bound != NULL && world != NULL )
    183171        {
    184           bound->getLookat (&lookat);
    185           world->calcCameraPos (&lookat, &desiredPlace);
     172          //FIXME: camera should be made via relative coordinates
     173          Vector* cameraOffset = new Vector (-10, 5, 0);
     174          this->setRelCoor (cameraOffset);
    186175        }
    187176      else
    188177        {
     178          /*
    189179          desiredPlace.r = Vector (0,0,0);
    190180          desiredPlace.w = Quaternion ();
     181          */
    191182        }
    192183      break;
     
    237228  // rotation
    238229  float matrix[4][4];
    239   actualPlace.w.conjugate().matrix (matrix);
     230  //this->absDirection.conjugate().matrix (matrix);
    240231  /* orientation and */
    241   glMultMatrixf ((float*)matrix);
     232  //glMultMatrixf ((float*)matrix);
     233
    242234  /*  translation */
    243   glTranslatef (-actualPlace.r.x, -actualPlace.r.y,- actualPlace.r.z);
    244 //Placement *plBound = bound->get_placement();
     235  //glTranslatef (this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z );
     236
    245237
    246238  // ===== second camera control calculation option
    247   /*
    248    gluLookAt(actual_place.r.x, actual_place.r.y, actual_place.r.z,
    249               plBound->r.x, plBound->r.y, plBound->r.z,
    250               0.0, 0.0, 1.0);
    251   */
     239 
     240  gluLookAt(this->absCoordinate.x, this->absCoordinate.y, this->absCoordinate.z,
     241            this->parent->getAbsCoor ().x, this->parent->getAbsCoor ().y, this->parent->getAbsCoor ().z,
     242            0.0, 1.0, 0.0);
     243 
    252244
    253245  glMatrixMode (GL_MODELVIEW);
     
    255247}
    256248
    257 /**
    258   \brief set the camera position
    259   \param plc: The Placement to set the camera to
    260        
    261         This will set the actual and desired placement of the camera to plc
    262 */
    263 void Camera::jump (Placement* plc = NULL)
    264 {
    265   if( plc == NULL)
    266     {
    267       actualPlace = desiredPlace;
    268       //printf("Camera|jump: camer@ %f, %f, %f\n\n", actual_place.r.x, actual_place.r.y, actual_place.r.z);
    269     }
    270   else
    271     {
    272       desiredPlace = *plc;
    273       actualPlace = *plc;
    274     }
    275 }
     249
    276250
    277251/**
Note: See TracChangeset for help on using the changeset viewer.