Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3851 in orxonox.OLD


Ignore:
Timestamp:
Apr 17, 2005, 1:21:59 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: animation: more adaptions to the new Framework

Location:
orxonox/trunk/src
Files:
2 added
10 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/Makefile.am

    r3812 r3851  
    3434                 track_node.cc \
    3535                 animation.cc \
     36                 animation3d.cc \
    3637                 animation_player.cc \
    37                  simple_animation.cc \
    3838                 garbage_collector.cc \
    3939                 story_entities/story_entity.cc \
     
    8686                 track_node.h \
    8787                 animation.h \
     88                 t_animation.h \
     89                 animation3d.h \
    8890                 animation_player.h \
    89                  simple_animation.h \
    9091                 garbage_collector.h \
    9192                 story_entities/story_entity.h \
  • orxonox/trunk/src/Makefile.in

    r3812 r3851  
    5656        command_node.$(OBJEXT) keynames.$(OBJEXT) camera.$(OBJEXT) \
    5757        track_manager.$(OBJEXT) track_node.$(OBJEXT) \
    58         animation.$(OBJEXT) animation_player.$(OBJEXT) \
    59         simple_animation.$(OBJEXT) garbage_collector.$(OBJEXT) \
     58        animation.$(OBJEXT) animation3d.$(OBJEXT) \
     59        animation_player.$(OBJEXT) garbage_collector.$(OBJEXT) \
    6060        story_entity.$(OBJEXT) campaign.$(OBJEXT) world.$(OBJEXT) \
    6161        world_entity.$(OBJEXT) player.$(OBJEXT) environment.$(OBJEXT) \
     
    7777am__depfiles_maybe = depfiles
    7878@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/animation.Po \
     79@AMDEP_TRUE@    ./$(DEPDIR)/animation3d.Po \
    7980@AMDEP_TRUE@    ./$(DEPDIR)/animation_player.Po \
    8081@AMDEP_TRUE@    ./$(DEPDIR)/array.Po ./$(DEPDIR)/base_entity.Po \
     
    99100@AMDEP_TRUE@    ./$(DEPDIR)/projectile.Po \
    100101@AMDEP_TRUE@    ./$(DEPDIR)/resource_manager.Po \
    101 @AMDEP_TRUE@    ./$(DEPDIR)/satellite.Po \
    102 @AMDEP_TRUE@    ./$(DEPDIR)/simple_animation.Po \
    103 @AMDEP_TRUE@    ./$(DEPDIR)/skybox.Po ./$(DEPDIR)/skysphere.Po \
     102@AMDEP_TRUE@    ./$(DEPDIR)/satellite.Po ./$(DEPDIR)/skybox.Po \
     103@AMDEP_TRUE@    ./$(DEPDIR)/skysphere.Po \
    104104@AMDEP_TRUE@    ./$(DEPDIR)/story_entity.Po ./$(DEPDIR)/terrain.Po \
    105105@AMDEP_TRUE@    ./$(DEPDIR)/test_bullet.Po ./$(DEPDIR)/test_gun.Po \
     
    247247                 track_node.cc \
    248248                 animation.cc \
     249                 animation3d.cc \
    249250                 animation_player.cc \
    250                  simple_animation.cc \
    251251                 garbage_collector.cc \
    252252                 story_entities/story_entity.cc \
     
    299299                 track_node.h \
    300300                 animation.h \
     301                 t_animation.h \
     302                 animation3d.h \
    301303                 animation_player.h \
    302                  simple_animation.h \
    303304                 garbage_collector.h \
    304305                 story_entities/story_entity.h \
     
    425426@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@
    426427@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation.Po@am__quote@
     428@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation3d.Po@am__quote@
    427429@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/animation_player.Po@am__quote@
    428430@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
     
    456458@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/resource_manager.Po@am__quote@
    457459@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/satellite.Po@am__quote@
    458 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple_animation.Po@am__quote@
    459460@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skybox.Po@am__quote@
    460461@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/skysphere.Po@am__quote@
  • orxonox/trunk/src/animation.h

    r3849 r3851  
    4949  virtual void rewind() = 0;
    5050
    51   virtual void tick(float time) = 0;
     51  virtual void tick(float timePassed) = 0;
    5252
    5353  /* implement in subclasses:
     
    6464     \returns the BaseObject, this animation operates on
    6565  */
    66   BaseObject* getBaseObject(void) const { return baseObject;}
     66  BaseObject* getBaseObject(void) const {return baseObject;}
    6767
    6868 protected:
  • orxonox/trunk/src/simple_animation.cc

    r3850 r3851  
    11
    2 
    3 
    4 /*
     2/*
    53   orxonox - the future of 3D-vertical-scrollers
    64
     
    1412   ### File Specific:
    1513   main-programmer: Patrick Boenzli
    16    co-programmer: ...
     14   co-programmer: Benjamin Grauer
     15
     16   2005-04-17: Benjamin Grauer
     17          Rewritte all functions, so it will fit into the Animation-class
    1718*/
    1819
    1920
    2021#include "simple_animation.h"
    21 #include "stdincl.h"
    22 #include "vector.h"
    23 #include "world_entity.h"
    24 
    25 using namespace std;
    26 
    27 
    28 Animation3D::Animation3D(void)
    29 {
    30 
    31 }
    32 
    33 Animation3D::~Animation3D(void)
    34 {
    35 
    36 }
    37 
    38 
    39 void Animation3D::rewind(void)
    40 {
    41 
    42 }
    43 
    44 void Animation3D::setAnimFunc(ANIM_FUNCTION animFunc)
    45 {
    46   switch (animFunc)
    47     {
    48     default:
    49     case ANIM_CONSTANT:
    50       this->animFunc = &Animation3D::constant;
    51       break;
    52     case ANIM_LINEAR:
    53       this->animFunc = &Animation3D::linear;
    54       break;
    55     case ANIM_SINE:
    56       this->animFunc = &Animation3D::sine;
    57       break;
    58     case ANIM_COSINE:
    59       this->animFunc = &Animation3D::cosine;
    60       break;
    61     case ANIM_EXP:
    62       this->animFunc = &Animation3D::exp;
    63       break;
    64     case ANIM_NEG_EXP:
    65       this->animFunc = &Animation3D::negExp;
    66       break;
    67     case ANIM_QUADRATIC:
    68       this->animFunc = &Animation3D::quadratic;
    69       break;
    70     case ANIM_RANDOM:
    71       this->animFunc = &Animation3D::random;
    72       break;
    73     }
    74 }
    75 
    76 
    77 void Animation3D::tick(float timePassed)
    78 {
    79 
    80 }
    81 
    82 
    83 float Animation3D::constant(float timePassed) const
    84 {
    85 
    86 }
    87 
    88 float Animation3D::linear(float timePassed) const
    89 {
    90 
    91 }
    92 
    93 float Animation3D::sine(float timePassed) const
    94 {
    95 
    96 }
    97 
    98 float Animation3D::cosine(float timePassed) const
    99 {
    100 
    101 }
    102 
    103 float Animation3D::exp(float timePassed) const
    104 {
    105 
    106 }
    107 
    108 float Animation3D::negExp(float timePassed) const
    109 {
    110 
    111 }
    112 
    113 float Animation3D::quadratic(float timePassed) const
    114 {
    115 
    116 }
    117 
    118 float Animation3D::random(float timePassed) const
    119 {
    120 
    121 }
    122 
    123 
    124 
    125 
    12622
    12723
     
    216112   \param object wo work on
    217113*/
    218 void SimpleAnimation::selectObject(WorldEntity* entity)
    219 {
    220   Animation3D* anim = getAnimationFromWorldEntity(entity);
     114void SimpleAnimation::selectObject(PNode* entity)
     115{
     116  Animation3D* anim = getAnimationFromPNode(entity);
    221117  if( anim == NULL)
    222118    {
     
    482378
    483379
    484 Animation3D* SimpleAnimation::getAnimationFromWorldEntity(WorldEntity* entity)
     380Animation3D* SimpleAnimation::getAnimationFromPNode(PNode* entity)
    485381{
    486382  tIterator<Animation3D>* iterator = this->animators->getIterator();
  • orxonox/trunk/src/simple_animation.h

    r3850 r3851  
    1818class Vector;
    1919class Quaternion;
    20 class WorldEntity;
    2120class PNode;
    2221
     
    3332  Vector* position;
    3433  Quaternion* direction;
    35   WorldEntity* object;
     34  PNode* object;
    3635  float time;
    3736  movementMode mode;
     
    5857  void setAnimFunc(ANIM_FUNCTION animFunc);
    5958
     59 private:
    6060  float constant(float timePassed) const;
    6161  float linear(float timePassed) const;
     
    7373
    7474  // private
    75   WorldEntity* object;
     75  PNode* object;
    7676  Vector* lastPosition;
    7777  Vector* tmpVect;
     
    100100  void animatorBegin();
    101101  void animatorEnd();
    102   void selectObject(WorldEntity* entity);
     102  void selectObject(PNode* entity);
    103103  void addKeyFrame(Vector* point, Quaternion* direction, float time);
    104104  void addKeyFrame(Vector* point, Quaternion* direction, float time, movementMode mode);
     
    132132 
    133133  Vector* tmpVect;                 //<! this is the temporary vector save place -
    134   WorldEntity* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
     134  PNode* workingObject;      //<! this is a pointer to the current working object that has been selected via selectObject()
    135135  Animation3D* workingAnimator;       //<! the animator with which you are currently working
    136136  float deltaT;                    //<! this is a time constant for the movement
    137137
    138   Animation3D* getAnimationFromWorldEntity(WorldEntity* entity);
     138  Animation3D* getAnimationFromPNode(PNode* entity);
    139139
    140140};
  • orxonox/trunk/src/story_entities/world.cc

    r3848 r3851  
    3838#include "track_manager.h"
    3939#include "garbage_collector.h"
    40 #include "simple_animation.h"
    4140#include "animation_player.h"
    4241
     
    161160  TextEngine::getInstance()->flush();
    162161
    163   delete this->simpleAnimation;
    164 
    165162  AnimationPlayer::getInstance()->debug();
    166163  delete AnimationPlayer::getInstance(); // this should be at the end of the unloading sequence.
     
    203200  wi->init(this);
    204201  this->garbageCollector = GarbageCollector::getInstance();
    205   this->simpleAnimation = SimpleAnimation::getInstance();
    206202}
    207203
     
    935931      this->localCamera->tick(this->dt);
    936932      this->garbageCollector->tick(seconds);
    937       this->simpleAnimation->tick(seconds);
     933
    938934      AnimationPlayer::getInstance()->tick(seconds);
    939935    }
  • orxonox/trunk/src/story_entities/world.h

    r3847 r3851  
    2424class Terrain;
    2525class GarbageCollector;
    26 class SimpleAnimation;
    2726class Text;
    2827
     
    116115  GarbageCollector* garbageCollector; //!< reference to the garbage  collector
    117116
    118   SimpleAnimation* simpleAnimation;   //!< reference to the SimpleAnimation object
    119  
    120117  /* function for main-loop */
    121118  void mainLoop ();
  • orxonox/trunk/src/t_animation.h

    r3849 r3851  
    1 
    2 
     1/*
     2   orxonox - the future of 3D-vertical-scrollers
     3
     4   Copyright (C) 2004 orx
     5
     6   This program is free software; you can redistribute it and/or modify
     7   it under the terms of the GNU General Public License as published by
     8   the Free Software Foundation; either version 2, or (at your option)
     9   any later version.
     10
     11   ### File Specific:
     12   main-programmer: Benjamin Grauer
     13   co-programmer: ...
     14*/
     15
     16
     17/*!
     18    \file t_animation.h
     19*/
     20
     21#ifndef _T_ANIMATION_H
     22#define _T_ANIMATION_H
    323
    424#include "animation.h"
     
    1636  void addKeyFrame(float value, float duration, ANIM_FUNCTION animFunc = ANIM_LINEAR);
    1737
    18   virtual void tick(float time);
     38  virtual void tick(float timePassed);
    1939
    2040  // animation functions
    2141  void setAnimFunc(ANIM_FUNCTION animFunc);
     42
     43 private:
    2244
    2345  float constant(float timePassed) const;
     
    2951  float quadratic(float timePassed) const;
    3052  float random(float timePassed) const;
     53
     54
    3155  //  ANIM_FUNCTION animFunc;
    3256  float (tAnimation<T>::*animFunc)(float) const;
     
    3559  tList<KeyFrameF>* keyFrameList;
    3660
    37 
    38 
    39 
    40  private:
    4161  float expFactor;
    4262  T* object;
     
    110130  if (duration <= 0.0)
    111131    duration = 1.0;
    112  
    113132
    114133  KeyFrameF* tmpKeyFrame;
     
    135154
    136155template<class T>
    137 void tAnimation<T>::tick(float time)
     156void tAnimation<T>::tick(float timePassed)
    138157{
    139158  if (this->bRunning)
    140159    {
    141       this->localTime += time;
     160      this->localTime += timePassed;
    142161      if (localTime >= this->currentKeyFrame->duration)
    143162        {
    144163          // switching to the next Key-Frame
     164          this->localTime -= this->currentKeyFrame->duration;
     165
    145166          this->currentKeyFrame = this->nextKeyFrame;
    146           this->localTime = 0;
    147167          // checking, if we should still Play the animation
    148168          if (this->currentKeyFrame == this->keyFrameList->lastElement())
     
    270290
    271291}
     292
     293
     294#endif /* _T_ANIMATION_H */
  • orxonox/trunk/src/world_entities/test_gun.cc

    r3847 r3851  
    3030#include "vector.h"
    3131#include "list.h"
    32 #include "simple_animation.h"
     32#include "animation3d.h"
    3333
    3434using namespace std;
     
    5353
    5454
    55   this->animator = SimpleAnimation::getInstance();
     55  this->animaton = new Animation3D;
    5656  this->dummy1 = new WorldEntity(); // a world entity that is not drawed: use this for the weapon
    5757  /*
  • orxonox/trunk/src/world_entities/test_gun.h

    r3757 r3851  
    2929class Vector;
    3030class Quaternion;
    31 class SimpleAnimation;
     31class Animation3D;
    3232
    3333
     
    5252
    5353 private:
    54   SimpleAnimation* animator;
     54  Animation3D* animaton;
    5555  Vector* projOffset;
    5656  WorldEntity* dummy1;
Note: See TracChangeset for help on using the changeset viewer.