00001
00002
00004
00005
00006
00007
00009
00010 #ifndef glm_core_type_half
00011 #define glm_core_type_half
00012
00013 #include <cstdlib>
00014
00015 namespace glm{
00016 namespace detail
00017 {
00018 typedef short hdata;
00019
00020 float toFloat32(hdata value);
00021 hdata toFloat16(float const & value);
00022
00025 class thalf
00026 {
00027 public:
00028
00029 GLM_FUNC_DECL thalf();
00030 GLM_FUNC_DECL thalf(thalf const & s);
00031
00032 template <typename U>
00033 GLM_FUNC_DECL explicit thalf(U const & s);
00034
00035
00036
00037 GLM_FUNC_DECL operator float() const;
00038
00039
00040
00041
00042 GLM_FUNC_DECL thalf& operator= (thalf const & s);
00043 GLM_FUNC_DECL thalf& operator+=(thalf const & s);
00044 GLM_FUNC_DECL thalf& operator-=(thalf const & s);
00045 GLM_FUNC_DECL thalf& operator*=(thalf const & s);
00046 GLM_FUNC_DECL thalf& operator/=(thalf const & s);
00047 GLM_FUNC_DECL thalf& operator++();
00048 GLM_FUNC_DECL thalf& operator--();
00049
00050 GLM_FUNC_DECL float toFloat() const{return toFloat32(data);}
00051
00052 GLM_FUNC_DECL hdata _data() const{return data;}
00053
00054 private:
00055 hdata data;
00056 };
00057
00058 thalf operator+ (thalf const & s1, thalf const & s2);
00059
00060 thalf operator- (thalf const & s1, thalf const & s2);
00061
00062 thalf operator* (thalf const & s1, thalf const & s2);
00063
00064 thalf operator/ (thalf const & s1, thalf const & s2);
00065
00066
00067 thalf operator- (thalf const & s);
00068
00069 thalf operator-- (thalf const & s, int);
00070
00071 thalf operator++ (thalf const & s, int);
00072
00073 }
00074 }
00075
00076 #include "type_half.inl"
00077
00078 #endif//glm_core_type_half