Change Encyclo button name and macros icon
[ryzomcore.git] / nel / src / 3d / track.cpp
bloba731865258cf6dbed0bfbee75055d1e73c7f4f4b
1 // NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
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/>.
17 #include "std3d.h"
19 #include "nel/3d/track.h"
21 #include "nel/misc/rgba.h"
22 #include "nel/misc/hierarchical_timer.h"
24 using namespace NLMISC;
26 #ifdef DEBUG_NEW
27 #define new DEBUG_NEW
28 #endif
30 namespace NL3D
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;
60 // Evaluate it
61 const CAnimatedValueFloat *value;
62 value= dynamic_cast<const CAnimatedValueFloat*>(&eval (time, AnimatedValueBlock));
64 // Type is good ?
65 if (value)
67 // Ok, return the value
68 res=value->Value;
69 return true;
71 else
72 // No, return false
73 return false;
76 // ***************************************************************************
78 bool ITrack::interpolate (TAnimationTime time, sint32& res)
80 NL3D_HAUTO_UTRACK_INTERPOLATE;
82 // Evaluate it
83 const CAnimatedValueInt *value;
84 value= dynamic_cast<const CAnimatedValueInt*>(&eval (time, AnimatedValueBlock));
86 // Type is good ?
87 if (value)
89 // Ok, return the value
90 res=value->Value;
91 return true;
93 else
94 // No, return false
95 return false;
98 // ***************************************************************************
100 bool ITrack::interpolate (TAnimationTime time, CRGBA& res)
102 NL3D_HAUTO_UTRACK_INTERPOLATE;
104 // Evaluate it
105 const CAnimatedValueRGBA *value;
106 value= dynamic_cast<const CAnimatedValueRGBA*>(&eval (time, AnimatedValueBlock));
108 // Type is good ?
109 if (value)
111 // Ok, return the value
112 res=value->Value;
113 return true;
115 else
116 // No, return false
117 return false;
120 // ***************************************************************************
122 bool ITrack::interpolate (TAnimationTime time, CVector& res)
124 NL3D_HAUTO_UTRACK_INTERPOLATE;
126 // Evaluate it
127 const CAnimatedValueVector *value;
128 value= dynamic_cast<const CAnimatedValueVector*>(&eval (time, AnimatedValueBlock));
130 // Type is good ?
131 if (value)
133 // Ok, return the value
134 res=value->Value;
135 return true;
137 else
138 // No, return false
139 return false;
142 // ***************************************************************************
144 bool ITrack::interpolate (TAnimationTime time, CQuat& res)
146 NL3D_HAUTO_UTRACK_INTERPOLATE;
148 // Evaluate it
149 const CAnimatedValueQuat *value;
150 value= dynamic_cast<const CAnimatedValueQuat*>(&eval (time, AnimatedValueBlock));
152 // Type is good ?
153 if (value)
155 // Ok, return the value
156 res=value->Value;
157 return true;
159 else
160 // No, return false
161 return false;
164 // ***************************************************************************
166 bool ITrack::interpolate (TAnimationTime time, std::string& res)
168 NL3D_HAUTO_UTRACK_INTERPOLATE;
170 // Evaluate it
171 const CAnimatedValueString *value;
172 value= dynamic_cast<const CAnimatedValueString*>(&eval (time, AnimatedValueBlock));
174 // Type is good ?
175 if (value)
177 // Ok, return the value
178 res=value->Value;
179 return true;
181 else
182 // No, return false
183 return false;
186 // ***************************************************************************
188 bool ITrack::interpolate (TAnimationTime time, bool& res)
190 NL3D_HAUTO_UTRACK_INTERPOLATE;
192 // Evaluate it
193 const CAnimatedValueBool *value;
194 value= dynamic_cast<const CAnimatedValueBool*>(&eval (time, AnimatedValueBlock));
196 // Type is good ?
197 if (value)
199 // Ok, return the value
200 res=value->Value;
201 return true;
203 else
204 // No, return false
205 return false;
208 // ***************************************************************************
210 } // NL3D