ScummVM API documentation
te_model_animation.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 TETRAEDGE_TE_TE_MODEL_ANIMATION_H
23#define TETRAEDGE_TE_TE_MODEL_ANIMATION_H
24
25#include "common/path.h"
26#include "common/stream.h"
27
28#include "tetraedge/te/te_animation.h"
29#include "tetraedge/te/te_intrusive_ptr.h"
30#include "tetraedge/te/te_model.h"
31#include "tetraedge/te/te_quaternion.h"
32#include "tetraedge/te/te_resource.h"
33#include "tetraedge/te/te_trs.h"
34#include "tetraedge/te/te_vector3f32.h"
35
36namespace Tetraedge {
37
38class TeModel;
39
40class TeModelAnimation : public TeAnimation, public TeResource {
41public:
42 struct NMORotation {
43 float _f;
44 TeQuaternion _rot;
45 };
47 float _f;
48 TeVector3f32 _trans;
49 };
50 struct NMOScale {
51 float _f;
52 TeVector3f32 _scale;
53 };
54
56
57 virtual ~TeModelAnimation() {
58 destroy();
59 }
60
61 void bind(const TeIntrusivePtr<TeModel> &ptr) {
62 _model = ptr;
63 };
64 int calcCurrentFrame(double millis);
65 void cont() override;
66 void destroy();
67 int findBone(const Common::String &bname);
68 int firstFrame() const;
69 TeMatrix4x4 getMatrix(const Common::String &name, uint frame, bool param_5);
70 TeQuaternion getNMORotation(uint boneNo, float amount) const;
71 TeVector3f32 getNMOTranslation(uint boneNo, float amount) const;
72 TeTRS getTRS(const Common::String &boneName, uint frame, bool forceUseFbx);
73 TeTRS getTRS(uint boneNo, uint frame, bool forceUseFbx) const;
74 int lastFrame() const;
75 bool load(const Common::Path &path);
76 bool load(Common::SeekableReadStream &stream);
77 int nbFrames();
78 void reset() override;
79 void resizeFBXArrays(uint len);
80 void resizeNMOArrays(uint len);
81 void save(Common::SeekableWriteStream &stream);
82 void saveBone(Common::SeekableWriteStream &stream, uint boneNo);
83 void setBoneName(uint boneNo, const Common::String &bname);
84 void setFrameLimits(int framemin, int framemax) {
85 _firstFrame = framemin;
86 _lastFrame = framemax;
87 }
88 void setRotation(uint num, float amount, const TeQuaternion &rot);
89 void setScale(uint num, float amount, const TeVector3f32 &scale);
90 void setTranslation(uint num, float amount, const TeVector3f32 &trans);
91 void unbind();
92 void update(double millis) override;
93
94 int curFrame2() const { return _curFrame2; }
95 float speed() const { return _speed; }
96 const Common::Path &loadedPath() const { return _loadedPath; }
97
98 static void deleteLaterStatic(TeModelAnimation *obj) { TeObject::deleteLaterStatic(obj); }
99
100private:
101 TeIntrusivePtr<TeModel> _model;
102 Common::Path _loadedPath;
103
109 int _curFrame;
110 int _curFrame2;
111 int _firstFrame;
112 int _lastFrame;
113 int _repeatNum;
114
115 bool _curFrameValFresh;
116 bool _finishedSignalPending;
117
118 int _useNMOArrays;
119 int _numNMOFrames;
120
121 float _speed;
122
123};
124
125} // end namespace Tetraedge
126
127#endif // TETRAEDGE_TE_TE_MODEL_ANIMATION_H
Definition: array.h:52
Definition: path.h:52
Definition: stream.h:745
Definition: stream.h:351
Definition: str.h:59
Definition: te_animation.h:31
Definition: te_intrusive_ptr.h:31
Definition: te_model_animation.h:40
Definition: te_quaternion.h:32
Definition: te_resource.h:31
Definition: te_vector3f32.h:33
Definition: te_model_animation.h:42
Definition: te_model_animation.h:50
Definition: te_model_animation.h:46