1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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 #include "nel/3d/track.h"
21 #include "nel/misc/rgba.h"
22 #include "nel/misc/hierarchical_timer.h"
24 using namespace NLMISC
;
33 H_AUTO_DECL( NL3D_UTrack_interpolate
)
35 #define NL3D_HAUTO_UTRACK_INTERPOLATE H_AUTO_USE( NL3D_UTrack_interpolate )
38 // ***************************************************************************
41 // Some compilation check: force Visual to compile to template
42 CTrackDefaultFloat ttoto10;
43 CTrackDefaultVector ttoto11;
44 CTrackDefaultQuat ttoto12;
45 CTrackDefaultInt ttoto13;
46 CTrackDefaultRGBA ttoto16;
47 CTrackDefaultString ttoto14;
48 CTrackDefaultBool ttoto15;
51 // ***************************************************************************
52 static CAnimatedValueBlock AnimatedValueBlock
;
54 // ***************************************************************************
56 bool ITrack::interpolate (TAnimationTime time
, float& res
)
58 NL3D_HAUTO_UTRACK_INTERPOLATE
;
61 const CAnimatedValueFloat
*value
;
62 value
= dynamic_cast<const CAnimatedValueFloat
*>(&eval (time
, AnimatedValueBlock
));
67 // Ok, return the value
76 // ***************************************************************************
78 bool ITrack::interpolate (TAnimationTime time
, sint32
& res
)
80 NL3D_HAUTO_UTRACK_INTERPOLATE
;
83 const CAnimatedValueInt
*value
;
84 value
= dynamic_cast<const CAnimatedValueInt
*>(&eval (time
, AnimatedValueBlock
));
89 // Ok, return the value
98 // ***************************************************************************
100 bool ITrack::interpolate (TAnimationTime time
, CRGBA
& res
)
102 NL3D_HAUTO_UTRACK_INTERPOLATE
;
105 const CAnimatedValueRGBA
*value
;
106 value
= dynamic_cast<const CAnimatedValueRGBA
*>(&eval (time
, AnimatedValueBlock
));
111 // Ok, return the value
120 // ***************************************************************************
122 bool ITrack::interpolate (TAnimationTime time
, CVector
& res
)
124 NL3D_HAUTO_UTRACK_INTERPOLATE
;
127 const CAnimatedValueVector
*value
;
128 value
= dynamic_cast<const CAnimatedValueVector
*>(&eval (time
, AnimatedValueBlock
));
133 // Ok, return the value
142 // ***************************************************************************
144 bool ITrack::interpolate (TAnimationTime time
, CQuat
& res
)
146 NL3D_HAUTO_UTRACK_INTERPOLATE
;
149 const CAnimatedValueQuat
*value
;
150 value
= dynamic_cast<const CAnimatedValueQuat
*>(&eval (time
, AnimatedValueBlock
));
155 // Ok, return the value
164 // ***************************************************************************
166 bool ITrack::interpolate (TAnimationTime time
, std::string
& res
)
168 NL3D_HAUTO_UTRACK_INTERPOLATE
;
171 const CAnimatedValueString
*value
;
172 value
= dynamic_cast<const CAnimatedValueString
*>(&eval (time
, AnimatedValueBlock
));
177 // Ok, return the value
186 // ***************************************************************************
188 bool ITrack::interpolate (TAnimationTime time
, bool& res
)
190 NL3D_HAUTO_UTRACK_INTERPOLATE
;
193 const CAnimatedValueBool
*value
;
194 value
= dynamic_cast<const CAnimatedValueBool
*>(&eval (time
, AnimatedValueBlock
));
199 // Ok, return the value
208 // ***************************************************************************