Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3743 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Apr 7, 2005, 2:57:33 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: SimpleAnimation - work is progressing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/simple_animation.cc

    r3739 r3743  
    9797{
    9898  this->workingObject = NULL;
     99  this->workingAnimator = NULL;
    99100  this->bDescriptive = false;
    100101}
     
    117118void SimpleAnimation::selectObject(WorldEntity* entity)
    118119{
     120  printf("SimpleAnimation::selectObject() - selecing active object\n");
    119121  Animation* anim = getAnimationFromWorldEntity(entity);
    120122  if( anim == NULL)
     
    125127      anim->lastPosition = new Vector();
    126128      anim->tmpVect = new Vector();
    127       frames = new tList<KeyFrame>();
     129      anim->frames = new tList<KeyFrame>();
    128130      bRunning = false;
    129131      deltaT = 0.0;
    130132      this->animators->add(anim);
    131133    }
     134  else
     135    printf("SimpleAnimation::selectObject() - animation already existent, using it\n");
    132136  this->workingAnimator = anim;
     137  printf("SimpleAnimation::selectObject() - selection completed\n");
    133138}
    134139
     
    143148void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time)
    144149{
    145   if( !this->bDescriptive)
     150  if( !this->bDescriptive || this->workingAnimator == NULL)
    146151    {
    147152      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     
    153158  frame->time = time;
    154159  frame->mode = DEFAULT_ANIMATION_MODE;
    155   frame->object = this->workingObject;
    156   this->frames->add(frame);
     160  frame->object = this->workingAnimator->object;
     161  this->workingAnimator->frames->add(frame);
    157162}
    158163
     
    167172void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode)
    168173{
    169   if( !this->bDescriptive)
     174  if( !this->bDescriptive || this->workingAnimator == NULL)
    170175    {
    171176      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     
    177182  frame->time = time;
    178183  frame->mode = mode;
    179   frame->object = this->workingObject;
    180   this->frames->add(frame);
     184  frame->object = this->workingAnimator->object;
     185  this->workingAnimator->frames->add(frame);
    181186}
    182187
     
    187192void SimpleAnimation::addKeyFrame(KeyFrame* frame)
    188193{
    189   if( !this->bDescriptive)
     194  printf("SimpleAnimation::addKeyFrame() - adding frame\n");
     195  if( !this->bDescriptive || this->workingAnimator == NULL)
    190196    {
    191197      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
    192198      return;
    193199    }
    194   frame->object = this->workingObject;
    195   this->frames->add(frame);
     200  frame->object = this->workingAnimator->object;
     201  this->workingAnimator->frames->add(frame);
     202  printf("SimpleAnimation::addKeyFrame() - addition completed\n");
    196203}
    197204
     
    202209void SimpleAnimation::reset()
    203210{
     211  /*
    204212  tIterator<KeyFrame>* iterator = this->frames->getIterator();
    205213  KeyFrame* frame = iterator->nextElement();
     
    218226  this->currentFrame = NULL;
    219227  this->lastFrame = NULL;
     228  */
    220229}
    221230
     
    232241 
    233242  this->localTime = 0;
    234   this->lastFrame = this->frames->firstElement();
    235   this->currentFrame = this->frames->nextElement(this->currentFrame);
     243
     244  /*
     245  tIterator<Animation>* iterator = this->animators->getIterator();
     246  Animation* anim = iterator->nextElement();
     247  while( anim != NULL)
     248    {
     249      printf("SimpleAnimation::start() - initializing an animaion\n");
     250      anim->currentFrame = anim->frames->firstElement();
     251      anim->lastFrame = anim->frames->nextElement(anim->currentFrame);
     252      anim = iterator->nextElement();
     253    }
     254  */
     255
    236256  this->bRunning = true;
    237257}
     
    252272{
    253273  this->localTime = 0;
    254   this->lastFrame = this->frames->firstElement();
    255   this->currentFrame = this->frames->nextElement(this->currentFrame);
     274  //this->lastFrame = this->frames->firstElement();
     275  //this->currentFrame = this->frames->nextElement(this->currentFrame);
    256276  this->bRunning = true;
    257277}
     
    285305    {
    286306      if( anim->bRunning)
    287         {
    288          
     307        {
    289308         
    290309          /* first get the current frame via time-stamps */
Note: See TracChangeset for help on using the changeset viewer.