Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3727 in orxonox.OLD for orxonox/trunk/src/simple_animation.cc


Ignore:
Timestamp:
Apr 5, 2005, 7:44:05 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: added a third debug level, made SimpleAnimation singleton and restructured it to be more opengl command style

File:
1 edited

Legend:

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

    r3726 r3727  
    2626
    2727
     28SimpleAnimation* SimpleAnimation::singletonRef = 0;
     29/**
     30   \brief gets the singleton instance
     31   \returns singleton instance
     32*/
     33SimpleAnimation* SimpleAnimation::getInstance()
     34{
     35  if( singletonRef == NULL)
     36    singletonRef = new SimpleAnimation();
     37  return singletonRef;
     38}
     39
    2840/**
    2941   \brief standard constructor
    3042*/
    31 SimpleAnimation::SimpleAnimation (PNode* parent)
     43SimpleAnimation::SimpleAnimation ()
    3244{
    3345   this->setClassName ("SimpleAnimation");
     
    3547   this->localTime = 0;
    3648   this->bRunning = false;
    37    this->parent = parent;
    3849   this->currentFrame = NULL;
    3950   this->lastFrame = NULL;
     
    6172
    6273
     74/**
     75   \brief this determines the start of an Animator Describtion
     76
     77   this can then be followed by different commands like addKeyFrame(..) etc. and
     78   will be closed with AnimatiorEnd()
     79*/
     80void SimpleAnimation::AnimatorBegin()
     81{
     82  this->bDescriptive = true;
     83}
     84
     85
     86/**
     87   \brief this determines the end of an Animator Describtion
     88
     89   this can then be followed by different commands like addKeyFrame(..) etc. and
     90   will be closed with AnimatiorEnd()
     91*/
     92void SimpleAnimation::AnimatorEnd()
     93{
     94  this->workingObject = NULL;
     95  this->bDescriptive = false;
     96}
     97
     98
     99/**
     100   \brief select an object to work on by using this function
     101   \param object wo work on
     102*/
     103void SimpleAnimation::selectObject(WorldEntity* entity)
     104{
     105  this->workingObject = entity;
     106}
     107
     108
    63109
    64110/**
     
    70116void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
    71117{
     118  if( !this->bDescriptive)
     119    {
     120      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     121      return;
     122    }
    72123  KeyFrame* frame = new KeyFrame;
    73124  frame->position = point;
     
    75126  frame->time = time;
    76127  frame->mode = DEFAULT_ANIMATION_MODE;
     128  frame->object = this->workingObject;
    77129  this->frames->add(frame);
    78130}
     
    88140void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
    89141{
     142  if( !this->bDescriptive)
     143    {
     144      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     145      return;
     146    }
    90147  KeyFrame* frame = new KeyFrame;
    91148  frame->position = point;
     
    93150  frame->time = time;
    94151  frame->mode = mode;
     152  frame->object = this->workingObject;
    95153  this->frames->add(frame);
    96154}
     
    102160void SimpleAnimation::addKeyFrame(KeyFrame* frame)
    103161{
    104   if( frame != NULL)
    105     this->frames->add(frame);
     162  if( !this->bDescriptive)
     163    {
     164      PRINTF(1)("SimpleAnimation: executing animation code outside a AnimationBegin()/AnimationEnd() - ignoring\n");
     165      return;
     166    }
     167  frame->object = this->workingObject;
     168  this->frames->add(frame);
    106169}
    107170
Note: See TracChangeset for help on using the changeset viewer.