ScummVM API documentation
animationemi.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef GRIM_ANIMATIONEMI_H
23 #define GRIM_ANIMATIONEMI_H
24 
25 #include "common/str.h"
26 
27 #include "math/mathfwd.h"
28 #include "math/quat.h"
29 
30 #include "engines/grim/animation.h"
31 #include "engines/grim/object.h"
32 #include "engines/grim/emi/skeleton.h"
33 
34 namespace Grim {
35 
36 struct AnimRotation {
37  Math::Quaternion _quat;
38  float _time;
39 };
40 
42  Math::Vector3d _vec;
43  float _time;
44 };
45 
46 struct Bone {
47  Common::String _boneName;
48  int _operation;
49  int _priority;
50  int _c;
51  int _count;
52  AnimRotation *_rotations;
53  AnimTranslation *_translations;
54  Joint *_target;
55  Bone() : _rotations(NULL), _translations(NULL), _boneName(""), _operation(0), _target(NULL) {}
56  ~Bone();
57  void loadBinary(Common::SeekableReadStream *data);
58 };
59 
60 class AnimationEmi : public Object {
61  void loadAnimation(Common::SeekableReadStream *data);
62 public:
63  Common::String _name;
64  Common::String _fname;
65  float _duration;
66  int _numBones;
67  Bone *_bones;
69  ~AnimationEmi();
70 
71  const Common::String &getFilename() const { return _fname; }
72 };
73 
75 public:
76  AnimationStateEmi(const Common::String &anim);
78 
79  void update(uint time);
80  void computeWeights();
81  void animate();
82  void play();
83  void stop();
84  void setPaused(bool paused);
85  void setLooping(bool loop);
86  void setSkeleton(Skeleton *skel);
87  void fade(Animation::FadeMode mode, int fadeLength);
88  void advance(uint msecs);
89  void saveState(SaveGame *state);
90  void restoreState(SaveGame *state);
91 
92 private:
93  void activate();
94  void deactivate();
95 
96  friend class Skeleton;
97 
98  Skeleton *_skel;
100  bool _looping;
101  bool _active;
102  bool _paused;
103  int _time;
104  float _fade;
105  float _startFade;
106  Animation::FadeMode _fadeMode;
107  int _fadeLength;
108  int *_boneJoints;
109 };
110 
111 } // end of namespace Grim
112 
113 #endif
Definition: str.h:59
Definition: animationemi.h:46
Definition: animationemi.h:74
Definition: animationemi.h:41
Definition: savegame.h:33
Definition: stream.h:745
Definition: actor.h:33
Definition: skeleton.h:68
Definition: animationemi.h:36
Definition: object.h:69
Definition: animationemi.h:60
Definition: object.h:32
Definition: skeleton.h:43