This repository has been archived by the owner on Feb 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
skeleton_anim.h
86 lines (69 loc) · 2.06 KB
/
skeleton_anim.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* Residual - A 3D game interpreter
*
* Residual is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the AUTHORS
* file distributed with this source distribution.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*
* $URL$
* $Id$
*
*/
#ifndef STARK_SKELETON_ANIM_H
#define STARK_SKELETON_ANIM_H
#include "graphics/vector3d.h"
#include "engines/stark/gfx/coordinate.h"
#include "common/array.h"
namespace Common {
class ReadStream;
}
namespace Stark {
class AnimKey {
public:
uint32 _time;
Graphics::Vector3d _rot;
float _rotW;
Graphics::Vector3d _pos;
};
class AnimNode {
public:
~AnimNode() {
for (Common::Array<AnimKey *>::iterator it = _keys.begin(); it != _keys.end(); ++it)
delete *it;
}
uint32 _bone;
Common::Array<AnimKey *> _keys;
};
/**
* Data structure responsible for skeletal animation of an actor object.
*/
class SkeletonAnim {
public:
SkeletonAnim();
~SkeletonAnim();
bool createFromStream(Common::ReadStream *stream);
/**
* Get the interpolated bone coordinate for a given bone at a given animation timestamp
*/
Coordinate getCoordForBone(uint32 time, int boneIdx);
/**
* Get total animation length (in ms)
*/
uint32 getLength() const { return _time; }
private:
uint32 _id, _ver, _u1, _u2, _time;
Common::Array<AnimNode *> _anims;
};
} // End of namespace Stark
#endif // STARK_SKELETON_ANIM_H