ScummVM API documentation
keyframe.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_KEYFRAME_H
23 #define GRIM_KEYFRAME_H
24 
25 #include "math/vector3d.h"
26 
27 #include "engines/grim/object.h"
28 
29 namespace Common {
30 class SeekableReadStream;
31 }
32 
33 namespace Grim {
34 
35 class ModelNode;
36 class TextSplitter;
37 
38 class KeyframeAnim : public Object {
39 public:
41  ~KeyframeAnim();
42 
43  void loadBinary(Common::SeekableReadStream *data);
44  void loadText(TextSplitter &ts);
45  bool isNodeAnimated(ModelNode *nodes, int num, float time, bool tagged) const;
46  void animate(ModelNode *nodes, int num, float time, float fade, bool tagged) const;
47  int getMarker(float startTime, float stopTime) const;
48 
49  float getLength() const { return _numFrames / _fps; }
50  const Common::String &getFilename() const { return _fname; }
51 
52 private:
53  Common::String _fname;
54  unsigned int _flags;
61  unsigned int _type;
62  int _numFrames, _numJoints;
63  float _fps;
64  int _numMarkers;
65 
66  struct Marker {
67  float frame;
68  int val;
69  };
70  Marker *_markers;
71 
72  struct KeyframeEntry {
73  void loadBinary(Common::SeekableReadStream *data);
74 
75  float _frame;
76  int _flags;
77  Math::Vector3d _pos, _dpos;
78  Math::Angle _pitch, _yaw, _roll, _dpitch, _dyaw, _droll;
79  };
80 
81  struct KeyframeNode {
82  void loadBinary(Common::SeekableReadStream *data, char *meshName);
83  void loadText(TextSplitter &ts);
84  ~KeyframeNode();
85 
86  void animate(ModelNode &node, float frame, float fade, bool useDelta) const;
87 
88  char _meshName[32];
89  int _numEntries;
90  KeyframeEntry *_entries;
91  };
92 
93  KeyframeNode **_nodes;
94 };
95 
96 } // end of namespace Grim
97 
98 #endif
Definition: str.h:59
Definition: stream.h:745
Definition: actor.h:33
Definition: algorithm.h:29
Definition: keyframe.h:38
Definition: textsplit.h:35
Definition: model.h:158
Definition: object.h:32