type_half.hpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef glm_core_type_half
00030 #define glm_core_type_half
00031 
00032 #include <cstdlib>
00033 
00034 namespace glm{
00035 namespace detail
00036 {
00037         typedef short hdata;
00038 
00039         float toFloat32(hdata value);
00040         hdata toFloat16(float const & value);
00041 
00044         class thalf
00045         {
00046         public: 
00047                 // Constructors
00048                 GLM_FUNC_DECL thalf();
00049                 GLM_FUNC_DECL thalf(thalf const & s);
00050                         
00051                 template <typename U>
00052                 GLM_FUNC_DECL explicit thalf(U const & s);
00053 
00054                 // Cast
00055                 //operator float();
00056                 GLM_FUNC_DECL operator float() const;
00057                 //operator double();
00058                 //operator double() const;
00059 
00060                 // Unary updatable operators
00061                 GLM_FUNC_DECL thalf& operator= (thalf const & s);
00062                 GLM_FUNC_DECL thalf& operator+=(thalf const & s);
00063                 GLM_FUNC_DECL thalf& operator-=(thalf const & s);
00064                 GLM_FUNC_DECL thalf& operator*=(thalf const & s);
00065                 GLM_FUNC_DECL thalf& operator/=(thalf const & s);
00066                 GLM_FUNC_DECL thalf& operator++();
00067                 GLM_FUNC_DECL thalf& operator--();
00068         
00069                 GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
00070 
00071                 GLM_FUNC_DECL hdata _data() const{return data;}
00072 
00073         private:
00074                 hdata data;
00075         };
00076 
00077         thalf operator+ (thalf const & s1, thalf const & s2);
00078 
00079         thalf operator- (thalf const & s1, thalf const & s2);
00080 
00081         thalf operator* (thalf const & s1, thalf const & s2);
00082 
00083         thalf operator/ (thalf const & s1, thalf const & s2);
00084 
00085         // Unary constant operators
00086         thalf operator- (thalf const & s);
00087 
00088         thalf operator-- (thalf const & s, int);
00089 
00090         thalf operator++ (thalf const & s, int);
00091 
00092 }//namespace detail
00093 }//namespace glm
00094 
00095 #include "type_half.inl"
00096 
00097 #endif//glm_core_type_half