Changeset 2014 for code/branches/core3/src/util/MathConvert.h
- Timestamp:
- Oct 26, 2008, 12:35:58 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core3/src/util/MathConvert.h
r1779 r2014 37 37 38 38 #include "UtilPrereqs.h" 39 #include "Math.h" 39 40 #include "Convert.h" 40 #include "Math.h"41 41 42 42 … … 153 153 // From Radian 154 154 template <class ToType> 155 inline bool fallbackConversion(ToType* output, const orxonox::Radian input) 156 { 157 return convertValue<ToType, Ogre::Real>(output, input.valueRadians()); 158 } 155 struct ConverterFallback<ToType, orxonox::Radian> 156 { 157 static bool convert(ToType* output, const orxonox::Radian& input) 158 { 159 return convertValue<ToType, Ogre::Real>(output, input.valueRadians()); 160 } 161 }; 159 162 160 163 // From Degree 161 164 template <class ToType> 162 inline bool fallbackConversion(ToType* output, const orxonox::Degree input) 163 { 164 return convertValue<ToType, Ogre::Real>(output, input.valueDegrees()); 165 } 165 struct ConverterFallback<ToType, orxonox::Degree> 166 { 167 static bool convert(ToType* output, const orxonox::Degree& input) 168 { 169 return convertValue<ToType, Ogre::Real>(output, input.valueDegrees()); 170 } 171 }; 166 172 167 173 // To Radian 168 174 template <class FromType> 169 inline bool fallbackConversion(orxonox::Radian* output, const FromType input) 170 { 171 float temp; 172 if (convertValue(&temp, input)) 173 { 174 *output = temp; 175 return true; 176 } 177 else 178 return false; 179 } 175 struct ConverterFallback<orxonox::Radian, FromType> 176 { 177 static bool convert(orxonox::Radian* output, const FromType& input) 178 { 179 float temp; 180 if (convertValue(&temp, input)) 181 { 182 *output = temp; 183 return true; 184 } 185 else 186 return false; 187 } 188 }; 180 189 181 190 // To Degree 182 191 template <class FromType> 183 inline bool fallbackConversion(orxonox::Degree* output, const FromType input) 184 { 185 float temp; 186 if (convertValue(&temp, input)) 187 { 188 *output = temp; 189 return true; 190 } 191 else 192 return false; 193 } 192 struct ConverterFallback<orxonox::Degree, FromType> 193 { 194 static bool convert(orxonox::Degree* output, const FromType& input) 195 { 196 float temp; 197 if (convertValue(&temp, input)) 198 { 199 *output = temp; 200 return true; 201 } 202 else 203 return false; 204 } 205 }; 194 206 195 207 #endif /* _MathConvert_H__ */
Note: See TracChangeset
for help on using the changeset viewer.