1
// $Id: animation_base.hpp 1681 2008-04-09 13:52:48Z hikerstk $
3
// SuperTuxKart - a fun racing game with go-kart
4
// Copyright (C) 2009 Joerg Henrichs
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 3
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
#ifndef HEADER_ANIMATION_BASE_HPP
21
#define HEADER_ANIMATION_BASE_HPP
24
* \defgroup animations
32
#include "tracks/track_object.hpp"
33
#include "utils/no_copy.hpp"
39
* \brief A base class for all animations.
42
class AnimationBase : public TrackObject, public NoCopy
45
/** Two types of animations: cyclic ones that play all the time, and
46
* one time only (which might get triggered more than once). */
47
enum AnimTimeType { ATT_CYCLIC, ATT_CYCLIC_ONCE } m_anim_type;
49
/** True if the animation is currently playing. */
52
/** For one time animations: start time. */
55
/** For cyclic animations: duration of the cycle. */
58
/** The current time in the cycle of a cyclic animation. */
61
/** The inital position of this object. */
62
core::vector3df m_initial_xyz;
64
/** The initial rotation of this object. */
65
core::vector3df m_initial_hpr;
67
/** All IPOs for this animation. */
68
std::vector<Ipo*> m_all_ipos;
71
AnimationBase(const XMLNode &node);
72
virtual ~AnimationBase();
73
virtual void update(float dt, core::vector3df *xyz, core::vector3df *hpr,
74
core::vector3df *scale);
75
/** This needs to be implemented by the inheriting classes. It is called
76
* once per frame from the track. */
77
virtual void update(float dt) = 0;
78
void setInitialTransform(const core::vector3df &xyz,
79
const core::vector3df &hpr);