Add infos into target window
[ryzomcore.git] / ryzom / client / src / animation_misc.h
blob40969cd362c2984c718b4bb080ffe9aa445fa012
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef CL_ANIMATION_MISC_H
20 #define CL_ANIMATION_MISC_H
22 /////////////
23 // INCLUDE //
24 /////////////
25 // misc
26 #include "nel/misc/types_nl.h"
27 #include "nel/misc/vector.h"
28 #include "nel/misc/quat.h"
29 // 3d
30 #include "nel/3d/u_animation_set.h"
31 #include "nel/3d/animation_time.h"
32 #include "nel/3d/u_animation.h"
35 ///////////
36 // CLASS //
37 ///////////
38 /**
39 * <Class description>
40 * \author Guillaume PUZIN (GUIGUI)
41 * \author Nevrax France
42 * \date 2002
44 class CAnimationMisc
46 public:
47 /// Constructor
48 CAnimationMisc();
50 /**
51 * Function to get the position in an animation at timeOffset.
52 * \param animationSet : search the animation in this set.
53 * \param idAnim : id of the animation.
54 * \param timeOffset : time for the interpolation.
55 * \param result : is the reference on the value to get the result (position).
56 * \return bool : true if the parameter result is valid.
58 static bool interpolate(NL3D::UAnimationSet *animationSet, uint idAnim, double timeOffset, NLMISC::CVector &result);
59 /**
60 * Function to get the rotation in an animation at timeOffset.
61 * \param animationSet : search the animation in this set.
62 * \param idAnim : id of the animation.
63 * \param timeOffset : time for the interpolation.
64 * \param result : is the reference on the value to get the result (rotation).
65 * \return bool : true if the parameter result is valid.
67 static bool interpolate(NL3D::UAnimationSet *animationSet, uint idAnim, double timeOffset, NLMISC::CQuat &result);
69 /**
70 * Return an animation length (in sec).
71 * \param animationSet : search the animation in this set.
72 * \param string animName : Animation Name.
73 * \return double : the length of the animation or 0 if any pb.
74 * \warning This Method is slower than the one with the animation Id instead of the animation Name.
76 static double getAnimationLength(NL3D::UAnimationSet *animationSet, const std::string &animName);
77 /**
78 * Return an animation length (in sec).
79 * \param animationSet : search the animation in this set.
80 * \param idAnim : id of the animation.
81 * \return double : the length of the animation or 0 if any pb.
83 static double getAnimationLength(NL3D::UAnimationSet *animationSet, uint idAnim);
85 /**
86 * Get the average speed of an animation (in meters/sec).
87 * \param animationSet : search the animation in this set.
88 * \param string animName : Animation Name.
89 * \return double : the average speed (in m/s).
91 static double getAnimationAverageSpeed(NL3D::UAnimationSet *animationSet, const std::string &animName);
92 /**
93 * Get the average speed of an animation (in meters/sec).
94 * \param animationSet : search the animation in this set.
95 * \param idAnim : id of the animation.
96 * \return double : the average speed (in m/s).
98 static double getAnimationAverageSpeed(NL3D::UAnimationSet *animationSet, uint idAnim);
101 * Get the rotation done by the animation (in radian).
102 * \param animationSet : search the animation in this set.
103 * \param string animName : Animation Name.
104 * \return double : the rotation (in radian).
106 static double getAnimationRotation(NL3D::UAnimationSet *animationSet, const std::string &animName);
108 * Get the rotation done by the animation (in radian).
109 * \param animationSet : search the animation in this set.
110 * \param idAnim : id of the animation.
111 * \return double : the rotation (in radian).
113 static double getAnimationRotation(NL3D::UAnimationSet *animationSet, uint idAnim);
115 /** // Get the vector covered by the given animation.
116 * \param animationSet : search the animation in this set.
117 * \param idAnim : id of the animation.
118 * \param move : filled with the vector of the move if possible
119 * \return bool : true if 'move' has been filled, else false.
121 static bool getAnimationMove(NL3D::UAnimationSet *animationSet, uint idAnim, NLMISC::CVector &move);
125 #endif // CL_ANIMATION_MISC_H
127 /* End of animation_misc.h */