Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 14, 2008, 3:40:48 PM (16 years ago)
Author:
rgrieder
Message:

Convert.h done. Has yet to be tested with gcc. And the comments have to be adapted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core3/src/util/MathConvert.h

    r1777 r1778  
    2727 */
    2828
    29 /*!
     29/**
    3030    @file
    31     @brief Actual conversion functions.
     31    @brief
     32        Math conversion functions. Definitions are in Math.cc
    3233*/
    3334
     
    3839#include "Convert.h"
    3940#include "Math.h"
    40 
    41 // Note: explicitConversion function is used whenever possible prior to
    42 //       template specialisations to allow for manual calls and overwrites.
    4341
    4442
     
    113111
    114112// std::string to Vector2
    115 _UtilExport bool explicitConversion(orxonox::Vector2* output, const std::string& input);
     113_UtilExport bool fallbackConversion(orxonox::Vector2* output, const std::string& input);
    116114// std::string to Vector3
    117 _UtilExport bool explicitConversion(orxonox::Vector3* output, const std::string& input);
     115_UtilExport bool fallbackConversion(orxonox::Vector3* output, const std::string& input);
    118116// std::string to Vector4
    119 _UtilExport bool explicitConversion(orxonox::Vector4* output, const std::string& input);
     117_UtilExport bool fallbackConversion(orxonox::Vector4* output, const std::string& input);
    120118// std::string to Quaternion
    121 _UtilExport bool explicitConversion(orxonox::Quaternion* output, const std::string& input);
     119_UtilExport bool fallbackConversion(orxonox::Quaternion* output, const std::string& input);
    122120// std::string to ColourValue
    123 _UtilExport bool explicitConversion(orxonox::ColourValue* output, const std::string& input);
     121_UtilExport bool fallbackConversion(orxonox::ColourValue* output, const std::string& input);
    124122
    125123
     
    130128// From Radian
    131129template <class ToType>
    132 inline bool explicitConversion(ToType* output, const orxonox::Radian input)
     130inline bool fallbackConversion(ToType* output, const orxonox::Radian input)
    133131{
    134132    return convertValue<ToType, Ogre::Real>(output, input.valueRadians());
     
    137135// From Degree
    138136template <class ToType>
    139 inline bool explicitConversion(ToType* output, const orxonox::Degree input)
     137inline bool fallbackConversion(ToType* output, const orxonox::Degree input)
    140138{
    141139    return convertValue<ToType, Ogre::Real>(output, input.valueDegrees());
     
    144142// To Radian
    145143template <class FromType>
    146 inline bool explicitConversion(orxonox::Radian* output, const FromType input)
     144inline bool fallbackConversion(orxonox::Radian* output, const FromType input)
    147145{
    148146    float temp;
     
    158156// To Degree
    159157template <class FromType>
    160 inline bool explicitConversion(orxonox::Degree* output, const FromType input)
     158inline bool fallbackConversion(orxonox::Degree* output, const FromType input)
    161159{
    162160    float temp;
     
    169167        return false;
    170168}
    171 // Radian to Radian
    172 inline bool explicitConversion(orxonox::Radian* output, const orxonox::Radian input)
    173 { *output = input; return true; }
    174 // Degree to Degree
    175 inline bool explicitConversion(orxonox::Degree* output, const orxonox::Degree input)
    176 { *output = input; return true; }
    177 // Radian to Degree
    178 inline bool explicitConversion(orxonox::Degree* output, const orxonox::Radian input)
    179 { *output = input; return true; }
    180 // Degree to Radian
    181 inline bool explicitConversion(orxonox::Radian* output, const orxonox::Degree input)
    182 { *output = input; return true; }
    183 
    184 //template <class ToType>
    185 //struct ConverterExplicit<ToType, Ogre::Radian>
    186 //{
    187 //    static bool convert(ToType* output, const Ogre::Radian input)
    188 //    {
    189 //        return ConverterExplicit<ToType, Ogre::Real>::convert(output, input.valueRadians());
    190 //    }
    191 //};
    192 
    193 //// Conversion from Ogre::Radian
    194 //template <class ToType>
    195 //struct ConverterExplicit<ToType, const Ogre::Radian>
    196 //{
    197 //    static bool convert(ToType* output, const Ogre::Radian input)
    198 //    {
    199 //        return ConverterExplicit<ToType, Ogre::Real>::convert(output, input.getValueRadian());
    200 //    }
    201 //};
    202 
    203 //template <class ToType>
    204 //inline bool explicitConversion(ToType* output, const Ogre::Radian& input)
    205 //{
    206 //    return ConvertValue(output, ;
    207 //}
    208 
    209 //// Conversion from Ogre::Degrees
    210 //inline bool explicitConversion(std::string* output, const orxonox::ColourValue& input)
    211 //{
    212 //    std::ostringstream ostream;
    213 //    if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
    214 //    {
    215 //        (*output) = ostream.str();
    216 //        return true;
    217 //    }
    218 //    return false;
    219 //}
    220 //
    221 //// Conversion to Ogre::Radian
    222 //inline bool explicitConversion(std::string* output, const orxonox::ColourValue& input)
    223 //{
    224 //    std::ostringstream ostream;
    225 //    if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
    226 //    {
    227 //        (*output) = ostream.str();
    228 //        return true;
    229 //    }
    230 //    return false;
    231 //}
    232 //
    233 //// Conversion to Ogre::Degrees
    234 //inline bool explicitConversion(std::string* output, const orxonox::ColourValue& input)
    235 //{
    236 //    std::ostringstream ostream;
    237 //    if (ostream << input.r << "," << input.g << "," << input.b << "," << input.a)
    238 //    {
    239 //        (*output) = ostream.str();
    240 //        return true;
    241 //    }
    242 //    return false;
    243 //}
    244169
    245170#endif /* _MathConvert_H__ */
Note: See TracChangeset for help on using the changeset viewer.