Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3729 in orxonox.OLD for orxonox/trunk/src


Ignore:
Timestamp:
Apr 5, 2005, 11:51:15 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: simple animation is moving, but not realy what it should

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/glmenu/glmenu_imagescreen.cc

    r3678 r3729  
    114114  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    115115
    116 
    117   //PRINTF()();
    118   printf("GLMenuImagEscreen::draw() - drawing step %i/%i\n",
     116  PRINTF(4)("GLMenuImagEscreen::draw() - drawing step %i/%i\n",
    119117         this->currentValue, this->maxValue);
    120118
  • orxonox/trunk/src/lib/coord/p_node.cc

    r3687 r3729  
    565565  this->time = dt;
    566566  PRINTF(4)("PNode::update - %s - (%f, %f, %f)\n", this->objectName, this->absCoordinate->x, this->absCoordinate->y, this->absCoordinate->z);
    567   // printf("%s", this->objectName);
    568567  if(this->mode & PNODE_MOVEMENT )
    569568    {
  • orxonox/trunk/src/simple_animation.cc

    r3727 r3729  
    1919#include "simple_animation.h"
    2020#include "stdincl.h"
    21 #include "p_node.h"
    2221#include "vector.h"
     22#include "world_entity.h"
    2323
    2424using namespace std;
     
    5151
    5252   this->tmpVect = new Vector();
     53   this->lastPosition = new Vector();
    5354}
    5455
     
    7879   will be closed with AnimatiorEnd()
    7980*/
    80 void SimpleAnimation::AnimatorBegin()
     81void SimpleAnimation::animatorBegin()
    8182{
    8283  this->bDescriptive = true;
     
    9091   will be closed with AnimatiorEnd()
    9192*/
    92 void SimpleAnimation::AnimatorEnd()
     93void SimpleAnimation::animatorEnd()
    9394{
    9495  this->workingObject = NULL;
     
    111112   \brief adds a keyframe with properties
    112113   \param the point of the object
    113    \param and the orientation of it
     114   \param and the direction of it
    114115   \param at this time
    115116*/
    116 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time)
     117void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time)
    117118{
    118119  if( !this->bDescriptive)
     
    123124  KeyFrame* frame = new KeyFrame;
    124125  frame->position = point;
    125   frame->orientation = orientation;
     126  frame->direction = direction;
    126127  frame->time = time;
    127128  frame->mode = DEFAULT_ANIMATION_MODE;
     
    134135   \brief adds a keyframe with properties
    135136   \param the point of the object
    136    \param and the orientation of it
     137   \param and the direction of it
    137138   \param at this time
    138139   \param function of the velocity of the movement
    139140*/
    140 void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode)
     141void SimpleAnimation::addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode)
    141142{
    142143  if( !this->bDescriptive)
     
    147148  KeyFrame* frame = new KeyFrame;
    148149  frame->position = point;
    149   frame->orientation = orientation;
     150  frame->direction = direction;
    150151  frame->time = time;
    151152  frame->mode = mode;
     
    259260  while( this->localTime > this->currentFrame->time)
    260261    {
    261       printf("SimpleAnimation::tick(...) - changing Frame");
     262      printf("SimpleAnimation::tick(...) - changing Frame\n");
     263      this->localTime -= this->currentFrame->time;
     264
     265      this->lastPosition = this->currentFrame->position;
    262266      this->lastFrame = this->currentFrame;
    263267      this->currentFrame = this->frames->nextElement(this->currentFrame);
    264       this->localTime -= this->currentFrame->time;
    265268    }
    266269 
     
    273276      *this->tmpVect = *this->currentFrame->position - *this->lastFrame->position;
    274277      *this->tmpVect = *this->tmpVect * this->localTime / this->currentFrame->time;
    275       //this->setAbsCoordinate(this->tmpVect);
     278      this->currentFrame->object->shiftCoor(*this->tmpVect - *this->lastPosition);
     279      *this->lastPosition = *this->tmpVect;
    276280      break;
    277281    case EXP:
  • orxonox/trunk/src/simple_animation.h

    r3727 r3729  
    2525//! KeyFrame Struct
    2626/**
    27    This represents one point with orientation of the animation
     27   This represents one point with direction of the animation
    2828*/
    2929typedef struct KeyFrame {
    3030  Vector* position;
    31   Quaternion* orientation;
     31  Quaternion* direction;
    3232  WorldEntity* object;
    3333  float time;
     
    4545  static SimpleAnimation* getInstance();
    4646
    47   void AnimatorBegin();
    48   void AnimatorEnd();
     47  void animatorBegin();
     48  void animatorEnd();
    4949  void selectObject(WorldEntity* entity);
    50   void addKeyFrame(Vector* point, Quaternion* orientation, float time);
    51   void addKeyFrame(Vector* point, Quaternion* orientation, float time, movementMode mode);
     50  void addKeyFrame(Vector* point, Quaternion* direction, float time);
     51  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
    5252  void addKeyFrame(KeyFrame* frame);
    5353  void reset();
     
    7171  KeyFrame* currentFrame;          //<! the frame that is been played now
    7272  KeyFrame* lastFrame;
     73  Vector* lastPosition;
    7374  movementMode mode;               //<! this is an enum of the mode, how the speed is distributed
    7475  float localTime;
  • orxonox/trunk/src/story_entities/world.cc

    r3727 r3729  
    3535#include "track_manager.h"
    3636#include "garbage_collector.h"
     37#include "simple_animation.h"
    3738
    3839#include "command_node.h"
     
    155156  delete this->lightMan;
    156157  delete this->trackManager;
     158
     159  //delete garbagecollecor
     160  //delete animator
    157161}
    158162
     
    188192  wi->init(this);
    189193  this->garbageCollector = GarbageCollector::getInstance();
     194  this->simpleAnimation = SimpleAnimation::getInstance();
    190195}
    191196
     
    394399        case DEBUG_WORLD_2:
    395400          {
     401            lightMan->setAmbientColor(.1,.1,.1);
     402            lightMan->addLight();
    396403            lightMan->setPosition(-5.0, 10.0, -40.0);
    397404            this->nullParent = NullParent::getInstance ();
     
    434441            this->glmis->step();
    435442
    436            
    437             WorldEntity* env = new Environment();
    438             env->setName ("env");
    439             this->spawn(env);
    440 
     443
     444            WorldEntity* a = new Environment();
     445            this->spawn(a, new Vector(200.0, -35.0, 5.0), new Quaternion());
     446
     447            WorldEntity* b = new Environment();
     448            this->localPlayer->addChild(b);
     449            b->setRelCoor(new Vector(10.0, 0.0, 0.0));
     450            this->spawn(b);
    441451           
     452            this->simpleAnimation = SimpleAnimation::getInstance();
     453
     454            /*
     455              frame->position = point;
     456              frame->orientation = orientation;
     457              frame->time = time;
     458              frame->mode = DEFAULT_ANIMATION_MODE;
     459            */
     460
     461            KeyFrame* f1 = new KeyFrame;
     462            f1->position = new Vector(10.0, 1.0, 1.0);
     463            f1->direction = new Quaternion();
     464            f1->time = 1.0;
     465            f1->mode = LINEAR;
     466
     467
     468            KeyFrame* f2 = new KeyFrame;
     469            f2->position = new Vector(10.0, 1.0, -1.0);
     470            f2->direction = new Quaternion();
     471            f2->time = 1.0;
     472            f2->mode = LINEAR;
     473
     474            this->simpleAnimation->animatorBegin();
     475            this->simpleAnimation->selectObject(b);
     476            this->simpleAnimation->addKeyFrame(f1);
     477            this->simpleAnimation->addKeyFrame(f2);
     478            this->simpleAnimation->animatorEnd();
     479
     480            this->simpleAnimation->start();
     481
    442482            /*
    443483            Vector* es = new Vector (10, 5, 0);
     
    850890      this->localCamera->tick(this->dt);
    851891      this->garbageCollector->tick(seconds);
     892      this->simpleAnimation->tick(seconds);
    852893    }
    853894  this->lastFrame = currentFrame;
  • orxonox/trunk/src/world_entities/environment.cc

    r3672 r3729  
    2929Environment::Environment () : WorldEntity()
    3030{
    31   this->model = (Model*) ResourceManager::getInstance()->load("models/reaplow.obj", OBJ);
     31  this->model = (Model*) ResourceManager::getInstance()->load("sphere", RP_LEVEL);
    3232  //  this->model = new OBJModel("../data/models/fighter.obj");
    3333}
Note: See TracChangeset for help on using the changeset viewer.