ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

animationemi.h

Go to the documentation of this file.
00001 /* ResidualVM - A 3D game interpreter
00002  *
00003  * ResidualVM is the legal property of its developers, whose names
00004  * are too numerous to list here. Please refer to the COPYRIGHT
00005  * file distributed with this source distribution.
00006  *
00007  * This program is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU General Public License
00009  * as published by the Free Software Foundation; either version 2
00010  * of the License, or (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #ifndef GRIM_ANIMATIONEMI_H
00024 #define GRIM_ANIMATIONEMI_H
00025 
00026 #include "common/str.h"
00027 #include "math/mathfwd.h"
00028 #include "math/quat.h"
00029 #include "engines/grim/animation.h"
00030 #include "engines/grim/object.h"
00031 #include "engines/grim/emi/skeleton.h"
00032 
00033 namespace Grim {
00034 
00035 struct AnimRotation {
00036     Math::Quaternion _quat;
00037     float _time;
00038 };
00039 
00040 struct AnimTranslation {
00041     Math::Vector3d _vec;
00042     float _time;
00043 };
00044 
00045 struct Bone {
00046     Common::String _boneName;
00047     int _operation;
00048     int _priority;
00049     int _c;
00050     int _count;
00051     AnimRotation *_rotations;
00052     AnimTranslation *_translations;
00053     Joint *_target;
00054     Bone() : _rotations(NULL), _translations(NULL), _boneName(""), _operation(0), _target(NULL) {}
00055     ~Bone();
00056     void loadBinary(Common::SeekableReadStream *data);
00057 };
00058 
00059 class AnimationEmi : public Object {
00060     void loadAnimation(Common::SeekableReadStream *data);
00061 public:
00062     Common::String _name;
00063     Common::String _fname;
00064     float _duration;
00065     int _numBones;
00066     Bone *_bones;
00067     AnimationEmi(const Common::String &filename, Common::SeekableReadStream *data);
00068     ~AnimationEmi();
00069 
00070     const Common::String &getFilename() const { return _fname; }
00071 };
00072 
00073 class AnimationStateEmi {
00074 public:
00075     AnimationStateEmi(const Common::String &anim);
00076     ~AnimationStateEmi();
00077 
00078     void update(uint time);
00079     void computeWeights();
00080     void animate();
00081     void play();
00082     void stop();
00083     void setPaused(bool paused);
00084     void setLooping(bool loop);
00085     void setSkeleton(Skeleton *skel);
00086     void fade(Animation::FadeMode mode, int fadeLength);
00087     void advance(uint msecs);
00088     void saveState(SaveGame *state);
00089     void restoreState(SaveGame *state);
00090 
00091 private:
00092     void activate();
00093     void deactivate();
00094 
00095     friend class Skeleton;
00096 
00097     Skeleton *_skel;
00098     ObjectPtr<AnimationEmi> _anim;
00099     bool _looping;
00100     bool _active;
00101     bool _paused;
00102     int _time;
00103     float _fade;
00104     float _startFade;
00105     Animation::FadeMode _fadeMode;
00106     int _fadeLength;
00107     int *_boneJoints;
00108 };
00109 
00110 } // end of namespace Grim
00111 
00112 #endif


Generated on Sat Nov 9 2019 05:00:27 for ResidualVM by doxygen 1.7.1
curved edge   curved edge