diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index b666a91c..cc615dd4 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -95,12 +95,6 @@ namespace detail VECTORIZE_VEC(sign) // floor - template <> - GLM_FUNC_QUALIFIER detail::half floor(detail::half const & x) - { - return detail::half(::std::floor(float(x))); - } - template GLM_FUNC_QUALIFIER genType floor(genType const & x) { diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp index 5609bdd2..c5b0532b 100644 --- a/glm/core/type_float.hpp +++ b/glm/core/type_float.hpp @@ -34,20 +34,11 @@ namespace glm{ namespace detail { - class half; - - typedef half float16; typedef float float32; typedef double float64; }//namespace detail - - typedef detail::half half; -#ifdef GLM_USE_HALF_SCALAR - typedef detail::half lowp_float_t; -#else//GLM_USE_HALF_SCALAR typedef float lowp_float_t; -#endif//GLM_USE_HALF_SCALAR typedef float mediump_float_t; typedef double highp_float_t; @@ -87,7 +78,6 @@ namespace detail # error "GLM error: multiple default precision requested for floating-point types" #endif - typedef half float16; typedef float float32; typedef double float64; @@ -121,17 +111,10 @@ namespace detail //////////////////// // Mark half to be flaot - GLM_DETAIL_IS_FLOAT(half); GLM_DETAIL_IS_FLOAT(float); GLM_DETAIL_IS_FLOAT(double); GLM_DETAIL_IS_FLOAT(long double); - template <> - struct float_or_int_trait - { - enum{ID = float_or_int_value::GLM_FLOAT}; - }; - template <> struct float_or_int_trait { diff --git a/glm/core/type_half.hpp b/glm/core/type_half.hpp index 88f75e05..17f55c94 100644 --- a/glm/core/type_half.hpp +++ b/glm/core/type_half.hpp @@ -39,101 +39,11 @@ namespace detail GLM_FUNC_DECL float toFloat32(hdata value); GLM_FUNC_DECL hdata toFloat16(float const & value); - class half - { - public: - // Constructors - GLM_FUNC_DECL half(); - GLM_FUNC_DECL half(half const & s); - - template - GLM_FUNC_DECL explicit half(U const & s); - - // Cast - //template - //GLM_FUNC_DECL operator U() const; - GLM_FUNC_DECL operator float() const; - - // Unary updatable operators - GLM_FUNC_DECL half& operator= (half const & s); - GLM_FUNC_DECL half& operator+=(half const & s); - GLM_FUNC_DECL half& operator-=(half const & s); - GLM_FUNC_DECL half& operator*=(half const & s); - GLM_FUNC_DECL half& operator/=(half const & s); - GLM_FUNC_DECL half& operator++(); - GLM_FUNC_DECL half& operator--(); - - GLM_FUNC_DECL float toFloat() const{return toFloat32(data);} - - GLM_FUNC_DECL hdata _data() const{return data;} - - private: - hdata data; - }; - - GLM_FUNC_DECL half operator+ (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator- (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator* (half const & s1, half const & s2); - - GLM_FUNC_DECL half operator/ (half const & s1, half const & s2); - - // Unary constant operators - GLM_FUNC_DECL half operator- (half const & s); - - GLM_FUNC_DECL half operator-- (half const & s, int); - - GLM_FUNC_DECL half operator++ (half const & s, int); - - GLM_FUNC_DECL bool operator==( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator!=( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator<( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator<=( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator>( - detail::half const & x, - detail::half const & y); - - GLM_FUNC_DECL bool operator>=( - detail::half const & x, - detail::half const & y); - }//namespace detail - /// Low half-precision floating-point numbers. - typedef detail::half lowp_half; - - /// Medium half-precision floating-point numbers. - typedef detail::half mediump_half; - - /// High half-precision floating-point numbers. - typedef detail::half highp_half; - -#if(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef highp_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef mediump_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_half half_t; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - /// Default half-precision floating-point numbers. - typedef highp_half half_t; -#else -# error "GLM error: Multiple default precisions requested for half-precision floating-point types" -#endif - + /// half-precision floating-point numbers. + //typedef detail::hdata half; + }//namespace glm #include "type_half.inl" diff --git a/glm/core/type_half.inl b/glm/core/type_half.inl index 520df75d..fb33cf49 100644 --- a/glm/core/type_half.inl +++ b/glm/core/type_half.inl @@ -252,168 +252,5 @@ namespace detail } } - GLM_FUNC_QUALIFIER half::half() : - data(0) - {} - - GLM_FUNC_QUALIFIER half::half(half const & s) : - data(s.data) - {} - - template - GLM_FUNC_QUALIFIER half::half(U const & s) : - data(toFloat16(float(s))) - {} -/* - template - GLM_FUNC_QUALIFIER half::operator U() const - { - return static_cast(toFloat32(this->data)); - } -*/ - - GLM_FUNC_QUALIFIER half::operator float() const - { - return toFloat32(this->data); - } - - // Unary updatable operators - GLM_FUNC_QUALIFIER half& half::operator= (half const & s) - { - data = s.data; - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator+=(half const & s) - { - data = toFloat16(toFloat32(data) + toFloat32(s.data)); - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator-=(half const & s) - { - data = toFloat16(toFloat32(data) - toFloat32(s.data)); - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator*=(half const & s) - { - data = toFloat16(toFloat32(data) * toFloat32(s.data)); - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator/=(half const & s) - { - data = toFloat16(toFloat32(data) / toFloat32(s.data)); - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator++() - { - float Casted = toFloat32(data); - this->data = toFloat16(++Casted); - return *this; - } - - GLM_FUNC_QUALIFIER half& half::operator--() - { - float Casted = toFloat32(data); - this->data = toFloat16(--Casted); - return *this; - } - - ////////////////////////////////////// - // Binary arithmetic operators - - GLM_FUNC_QUALIFIER detail::half operator+ (detail::half const & s1, detail::half const & s2) - { - return detail::half(float(s1) + float(s2)); - } - - GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s1, detail::half const & s2) - { - return detail::half(float(s1) - float(s2)); - } - - GLM_FUNC_QUALIFIER detail::half operator* (detail::half const & s1, detail::half const & s2) - { - return detail::half(float(s1) * float(s2)); - } - - GLM_FUNC_QUALIFIER detail::half operator/ (detail::half const & s1, detail::half const & s2) - { - return detail::half(float(s1) / float(s2)); - } - - // Unary constant operators - GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s) - { - return detail::half(-float(s)); - } - - GLM_FUNC_QUALIFIER detail::half operator-- (detail::half const & s, int) - { - return detail::half(float(s) - 1.0f); - } - - GLM_FUNC_QUALIFIER detail::half operator++ (detail::half const & s, int) - { - return detail::half(float(s) + 1.0f); - } - - GLM_FUNC_QUALIFIER bool operator== - ( - detail::half const & x, - detail::half const & y - ) - { - return x._data() == y._data(); - } - - GLM_FUNC_QUALIFIER bool operator!= - ( - detail::half const & x, - detail::half const & y - ) - { - return x._data() != y._data(); - } - - GLM_FUNC_QUALIFIER bool operator< - ( - detail::half const & x, - detail::half const & y - ) - { - return float(x) < float(y); - } - - GLM_FUNC_QUALIFIER bool operator<= - ( - detail::half const & x, - detail::half const & y - ) - { - return float(x) <= float(y); - } - - GLM_FUNC_QUALIFIER bool operator> - ( - detail::half const & x, - detail::half const & y - ) - { - return float(x) > float(y); - } - - GLM_FUNC_QUALIFIER bool operator>= - ( - detail::half const & x, - detail::half const & y - ) - { - return float(x) >= float(y); - } - }//namespace detail }//namespace glm diff --git a/glm/fwd.hpp b/glm/fwd.hpp index 2822aab9..72247341 100644 --- a/glm/fwd.hpp +++ b/glm/fwd.hpp @@ -46,33 +46,7 @@ namespace detail template struct tquat; }//namespace detail - - /// Quaternion of low half-precision floating-point numbers. - /// - /// @see gtc_quaternion - typedef detail::tquat lowp_hquat; - - /// Quaternion of medium half-precision floating-point numbers. - /// - /// @see gtc_quaternion - typedef detail::tquat mediump_hquat; - /// Quaternion of high half-precision floating-point numbers. - /// - /// @see gtc_quaternion - typedef detail::tquat highp_hquat; - -#if(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef highp_hquat hquat; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef mediump_hquat hquat; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_hquat hquat; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - /// Default half-precision floating-point numbers. - typedef highp_hquat hquat; -#endif - /// Quaternion of low single-precision floating-point numbers. /// @@ -1356,10 +1330,6 @@ namespace glm ////////////////////// // Float vector types - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16; - /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 lowp_float32; @@ -1368,10 +1338,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 lowp_float64; - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16_t; - /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 lowp_float32_t; @@ -1380,10 +1346,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 lowp_float64_t; - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 lowp_f16; - /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 lowp_f32; @@ -1391,10 +1353,6 @@ namespace glm /// Low 64 bit double-precision floating-point scalar. /// @see gtc_type_precision typedef float64 lowp_f64; - - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16; /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision @@ -1403,11 +1361,7 @@ namespace glm /// Low 64 bit double-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float64 lowp_float64; - - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16_t; - + /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 lowp_float32_t; @@ -1416,10 +1370,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 lowp_float64_t; - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 lowp_f16; - /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 lowp_f32; @@ -1429,11 +1379,6 @@ namespace glm typedef float64 lowp_f64; - - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16; - /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 lowp_float32; @@ -1441,11 +1386,7 @@ namespace glm /// Low 64 bit double-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float64 lowp_float64; - - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 lowp_float16_t; - + /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 lowp_float32_t; @@ -1453,11 +1394,7 @@ namespace glm /// Low 64 bit double-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float64 lowp_float64_t; - - /// Low 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 lowp_f16; - + /// Low 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 lowp_f32; @@ -1467,10 +1404,6 @@ namespace glm typedef float64 lowp_f64; - /// Medium 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 mediump_float16; - /// Medium 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 mediump_float32; @@ -1478,11 +1411,7 @@ namespace glm /// Medium 64 bit double-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float64 mediump_float64; - - /// Medium 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 mediump_float16_t; - + /// Medium 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 mediump_float32_t; @@ -1491,10 +1420,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 mediump_float64_t; - /// Medium 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 mediump_f16; - /// Medium 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 mediump_f32; @@ -1503,10 +1428,6 @@ namespace glm /// @see gtc_type_precision typedef float64 mediump_f64; - - /// High 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 highp_float16; /// High 32 bit single-precision floating-point scalar. /// @see gtc_type_precision @@ -1516,10 +1437,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 highp_float64; - /// High 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 highp_float16_t; - /// High 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 highp_float32_t; @@ -1528,10 +1445,6 @@ namespace glm /// @see gtc_type_precision typedef detail::float64 highp_float64_t; - /// High 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 highp_f16; - /// High 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 highp_f32; @@ -1542,10 +1455,6 @@ namespace glm #if(defined(GLM_PRECISION_LOWP_FLOAT)) - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef lowp_float16 float16; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef lowp_float32 float32; @@ -1554,10 +1463,6 @@ namespace glm /// @see gtc_type_precision typedef lowp_float64 float64; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef lowp_float16 float16_t; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef lowp_float32_t float32_t; @@ -1566,10 +1471,6 @@ namespace glm /// @see gtc_type_precision typedef lowp_float64_t float64_t; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef lowp_f16 f16; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef lowp_f32 f32; @@ -1579,9 +1480,6 @@ namespace glm typedef lowp_f64 f64; #elif(defined(GLM_PRECISION_MEDIUMP_FLOAT)) - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef mediump_float16 float16; /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision @@ -1591,10 +1489,6 @@ namespace glm /// @see gtc_type_precision typedef mediump_float64 float64; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef mediump_float16 float16_t; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef mediump_float32 float32_t; @@ -1603,10 +1497,6 @@ namespace glm /// @see gtc_type_precision typedef mediump_float64 float64_t; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef mediump_float16 f16; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef mediump_float32 f32; @@ -1616,9 +1506,6 @@ namespace glm typedef mediump_float64 f64; #else//(defined(GLM_PRECISION_HIGHP_FLOAT)) - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef highp_float16 float16; /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision @@ -1628,10 +1515,6 @@ namespace glm /// @see gtc_type_precision typedef highp_float64 float64; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef highp_float16_t float16_t; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef highp_float32_t float32_t; @@ -1640,10 +1523,6 @@ namespace glm /// @see gtc_type_precision typedef highp_float64_t float64_t; - /// Default 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef highp_float16_t f16; - /// Default 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef highp_float32_t f32; @@ -1755,57 +1634,6 @@ namespace glm typedef detail::tvec4 highp_fvec4; - - /// Low half-precision floating-point vector of 1 component. - /// @see gtc_type_precision - typedef detail::tvec1 lowp_f16vec1; - - /// Low half-precision floating-point vector of 2 components. - /// @see gtc_type_precision - typedef detail::tvec2 lowp_f16vec2; - - /// Low half-precision floating-point vector of 3 components. - /// @see gtc_type_precision - typedef detail::tvec3 lowp_f16vec3; - - /// Low half-precision floating-point vector of 4 components. - /// @see gtc_type_precision - typedef detail::tvec4 lowp_f16vec4; - - /// Medium half-precision floating-point vector of 1 component. - /// @see gtc_type_precision - typedef detail::tvec1 mediump_f16vec1; - - /// Medium half-precision floating-point vector of 2 components. - /// @see gtc_type_precision - typedef detail::tvec2 mediump_f16vec2; - - /// Medium half-precision floating-point vector of 3 components. - /// @see gtc_type_precision - typedef detail::tvec3 mediump_f16vec3; - - /// Medium half-precision floating-point vector of 4 components. - /// @see gtc_type_precision - typedef detail::tvec4 mediump_f16vec4; - - /// High half-precision floating-point vector of 1 component. - /// @see gtc_type_precision - typedef detail::tvec1 highp_f16vec1; - - /// High half-precision floating-point vector of 2 components. - /// @see gtc_type_precision - typedef detail::tvec2 highp_f16vec2; - - /// High half-precision floating-point vector of 3 components. - /// @see gtc_type_precision - typedef detail::tvec3 highp_f16vec3; - - /// High half-precision floating-point vector of 4 components. - /// @see gtc_type_precision - typedef detail::tvec4 highp_f16vec4; - - - /// Low single-precision floating-point vector of 1 component. /// @see gtc_type_precision typedef detail::tvec1 lowp_f32vec1; @@ -1853,9 +1681,8 @@ namespace glm /// High single-precision floating-point vector of 4 components. /// @see gtc_type_precision typedef detail::tvec4 highp_f32vec4; + - - /// Low double-precision floating-point vector of 1 component. /// @see gtc_type_precision typedef detail::tvec1 lowp_f64vec1; @@ -1904,9 +1731,9 @@ namespace glm /// @see gtc_type_precision typedef detail::tvec4 highp_f64vec4; + ////////////////////// // Float matrix types - /// Low single-precision floating-point 1x1 matrix. /// @see gtc_type_precision @@ -2079,181 +1906,6 @@ namespace glm /// @see gtc_type_precision typedef highp_fmat4x4 highp_fmat4; - - - - /// Low half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef lowp_f16 lowp_f16mat1x1; - - /// Low half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x2 lowp_f16mat2x2; - - /// Low half-precision floating-point 2x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x3 lowp_f16mat2x3; - - /// Low half-precision floating-point 2x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x4 lowp_f16mat2x4; - - /// Low half-precision floating-point 3x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x2 lowp_f16mat3x2; - - /// Low half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x3 lowp_f16mat3x3; - - /// Low half-precision floating-point 3x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x4 lowp_f16mat3x4; - - /// Low half-precision floating-point 4x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x2 lowp_f16mat4x2; - - /// Low half-precision floating-point 4x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x3 lowp_f16mat4x3; - - /// Low half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x4 lowp_f16mat4x4; - - /// Low half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef lowp_f16mat1x1 lowp_f16mat1; - - /// Low half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef lowp_f16mat2x2 lowp_f16mat2; - - /// Low half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef lowp_f16mat3x3 lowp_f16mat3; - - /// Low half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef lowp_f16mat4x4 lowp_f16mat4; - - - /// Medium half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef mediump_f16 mediump_f16mat1x1; - - /// Medium half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x2 mediump_f16mat2x2; - - /// Medium half-precision floating-point 2x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x3 mediump_f16mat2x3; - - /// Medium half-precision floating-point 2x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x4 mediump_f16mat2x4; - - /// Medium half-precision floating-point 3x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x2 mediump_f16mat3x2; - - /// Medium half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x3 mediump_f16mat3x3; - - /// Medium half-precision floating-point 3x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x4 mediump_f16mat3x4; - - /// Medium half-precision floating-point 4x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x2 mediump_f16mat4x2; - - /// Medium half-precision floating-point 4x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x3 mediump_f16mat4x3; - - /// Medium half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x4 mediump_f16mat4x4; - - /// Medium half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef mediump_f16mat1x1 mediump_f16mat1; - - /// Medium half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef mediump_f16mat2x2 mediump_f16mat2; - - /// Medium half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef mediump_f16mat3x3 mediump_f16mat3; - - /// Medium half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef mediump_f16mat4x4 mediump_f16mat4; - - - - /// High half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef highp_f16 highp_f16mat1x1; - - /// High half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x2 highp_f16mat2x2; - - /// High half-precision floating-point 2x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x3 highp_f16mat2x3; - - /// High half-precision floating-point 2x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x4 highp_f16mat2x4; - - /// High half-precision floating-point 3x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x2 highp_f16mat3x2; - - /// High half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x3 highp_f16mat3x3; - - /// High half-precision floating-point 3x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x4 highp_f16mat3x4; - - /// High half-precision floating-point 4x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x2 highp_f16mat4x2; - - /// High half-precision floating-point 4x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x3 highp_f16mat4x3; - - /// High half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x4 highp_f16mat4x4; - - /// High half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef highp_f16mat1x1 highp_f16mat1; - - /// High half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef highp_f16mat2x2 highp_f16mat2; - - /// High half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef highp_f16mat3x3 highp_f16mat3; - - /// High half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef highp_f16mat4x4 highp_f16mat4; - - /// Low single-precision floating-point 1x1 matrix. /// @see gtc_type_precision @@ -2544,8 +2196,6 @@ namespace glm /// @see gtc_type_precision typedef mediump_f64mat4x4 mediump_f64mat4; - - /// High double-precision floating-point 1x1 matrix. /// @see gtc_type_precision //typedef f64 highp_f64mat1x1; @@ -2602,15 +2252,9 @@ namespace glm /// @see gtc_type_precision typedef highp_f64mat4x4 highp_f64mat4; - - ////////////////////////// // Quaternion types - /// Low half-precision floating-point quaternion. - /// @see gtc_type_precision - typedef detail::tquat lowp_f16quat; - /// Low single-precision floating-point quaternion. /// @see gtc_type_precision typedef detail::tquat lowp_f32quat; @@ -2619,10 +2263,6 @@ namespace glm /// @see gtc_type_precision typedef detail::tquat lowp_f64quat; - /// Medium half-precision floating-point quaternion. - /// @see gtc_type_precision - typedef detail::tquat mediump_f16quat; - /// Medium single-precision floating-point quaternion. /// @see gtc_type_precision typedef detail::tquat mediump_f32quat; @@ -2631,10 +2271,6 @@ namespace glm /// @see gtc_type_precision typedef detail::tquat mediump_f64quat; - /// High half-precision floating-point quaternion. - /// @see gtc_type_precision - typedef detail::tquat highp_f16quat; - /// High single-precision floating-point quaternion. /// @see gtc_type_precision typedef detail::tquat highp_f32quat; @@ -2643,113 +2279,6 @@ namespace glm /// @see gtc_type_precision typedef detail::tquat highp_f64quat; - -#if(defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_f16vec1 f16vec1; - typedef lowp_f16vec2 f16vec2; - typedef lowp_f16vec3 f16vec3; - typedef lowp_f16vec4 f16vec4; - typedef lowp_f16mat2 f16mat2; - typedef lowp_f16mat3 f16mat3; - typedef lowp_f16mat4 f16mat4; - typedef lowp_f16mat2x2 f16mat2x2; - typedef lowp_f16mat3x2 f16mat3x2; - typedef lowp_f16mat4x2 f16mat4x2; - typedef lowp_f16mat2x3 f16mat2x3; - typedef lowp_f16mat3x3 f16mat3x3; - typedef lowp_f16mat4x3 f16mat4x3; - typedef lowp_f16mat2x4 f16mat2x4; - typedef lowp_f16mat3x4 f16mat3x4; - typedef lowp_f16mat4x4 f16mat4x4; - typedef lowp_f16quat f16quat; -#elif(defined(GLM_PRECISION_MEDIUMP_HALF)) - typedef mediump_f16vec1 f16vec1; - typedef mediump_f16vec2 f16vec2; - typedef mediump_f16vec3 f16vec3; - typedef mediump_f16vec4 f16vec4; - typedef mediump_f16mat2 f16mat2; - typedef mediump_f16mat3 f16mat3; - typedef mediump_f16mat4 f16mat4; - typedef mediump_f16mat2x2 f16mat2x2; - typedef mediump_f16mat3x2 f16mat3x2; - typedef mediump_f16mat4x2 f16mat4x2; - typedef mediump_f16mat2x3 f16mat2x3; - typedef mediump_f16mat3x3 f16mat3x3; - typedef mediump_f16mat4x3 f16mat4x3; - typedef mediump_f16mat2x4 f16mat2x4; - typedef mediump_f16mat3x4 f16mat3x4; - typedef mediump_f16mat4x4 f16mat4x4; - typedef mediump_f16quat f16quat; -#else//if(defined(GLM_PRECISION_HIGHP_HALF)) - /// Default half-precision floating-point vector of 1 components. - /// @see gtc_type_precision - typedef highp_f16vec1 f16vec1; - - /// Default half-precision floating-point vector of 2 components. - /// @see gtc_type_precision - typedef highp_f16vec2 f16vec2; - - /// Default half-precision floating-point vector of 3 components. - /// @see gtc_type_precision - typedef highp_f16vec3 f16vec3; - - /// Default half-precision floating-point vector of 4 components. - /// @see gtc_type_precision - typedef highp_f16vec4 f16vec4; - - /// Default half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef highp_f16mat2x2 f16mat2x2; - - /// Default half-precision floating-point 2x3 matrix. - /// @see gtc_type_precision - typedef highp_f16mat2x3 f16mat2x3; - - /// Default half-precision floating-point 2x4 matrix. - /// @see gtc_type_precision - typedef highp_f16mat2x4 f16mat2x4; - - /// Default half-precision floating-point 3x2 matrix. - /// @see gtc_type_precision - typedef highp_f16mat3x2 f16mat3x2; - - /// Default half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef highp_f16mat3x3 f16mat3x3; - - /// Default half-precision floating-point 3x4 matrix. - /// @see gtc_type_precision - typedef highp_f16mat3x4 f16mat3x4; - - /// Default half-precision floating-point 4x2 matrix. - /// @see gtc_type_precision - typedef highp_f16mat4x2 f16mat4x2; - - /// Default half-precision floating-point 4x3 matrix. - /// @see gtc_type_precision - typedef highp_f16mat4x3 f16mat4x3; - - /// Default half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef highp_f16mat4x4 f16mat4x4; - - /// Default half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef f16mat2x2 f16mat2; - - /// Default half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef f16mat3x3 f16mat3; - - /// Default half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef f16mat4x4 f16mat4; - - /// Default half-precision floating-point quaternion. - /// @see gtc_type_precision - typedef highp_f16quat f16quat; -#endif - #if(defined(GLM_PRECISION_LOWP_FLOAT)) typedef lowp_f32vec1 fvec1; diff --git a/glm/glm.cpp b/glm/glm.cpp index 44ac3dee..59d1c4a1 100644 --- a/glm/glm.cpp +++ b/glm/glm.cpp @@ -80,7 +80,6 @@ template struct tvec2; template struct tvec2; template struct tvec2; template struct tvec2; -template struct tvec2; template struct tvec2; template struct tvec2; @@ -92,7 +91,6 @@ template struct tvec2; template struct tvec2; template struct tvec2; template struct tvec2; -template struct tvec2; template struct tvec2; template struct tvec2; @@ -104,7 +102,6 @@ template struct tvec2; template struct tvec2; template struct tvec2; template struct tvec2; -template struct tvec2; template struct tvec2; template struct tvec2; @@ -117,7 +114,6 @@ template struct tvec3; template struct tvec3; template struct tvec3; template struct tvec3; -template struct tvec3; template struct tvec3; template struct tvec3; @@ -129,7 +125,6 @@ template struct tvec3; template struct tvec3; template struct tvec3; template struct tvec3; -template struct tvec3; template struct tvec3; template struct tvec3; @@ -141,7 +136,6 @@ template struct tvec3; template struct tvec3; template struct tvec3; template struct tvec3; -template struct tvec3; template struct tvec3; template struct tvec3; @@ -154,7 +148,6 @@ template struct tvec4; template struct tvec4; template struct tvec4; template struct tvec4; -template struct tvec4; template struct tvec4; template struct tvec4; @@ -166,7 +159,6 @@ template struct tvec4; template struct tvec4; template struct tvec4; template struct tvec4; -template struct tvec4; template struct tvec4; template struct tvec4; @@ -178,150 +170,116 @@ template struct tvec4; template struct tvec4; template struct tvec4; template struct tvec4; -template struct tvec4; template struct tvec4; template struct tvec4; // tmat2x2 type explicit instantiation -template struct tmat2x2; template struct tmat2x2; template struct tmat2x2; -template struct tmat2x2; template struct tmat2x2; template struct tmat2x2; -template struct tmat2x2; template struct tmat2x2; template struct tmat2x2; // tmat2x3 type explicit instantiation -template struct tmat2x3; template struct tmat2x3; template struct tmat2x3; -template struct tmat2x3; template struct tmat2x3; template struct tmat2x3; -template struct tmat2x3; template struct tmat2x3; template struct tmat2x3; // tmat2x4 type explicit instantiation -template struct tmat2x4; template struct tmat2x4; template struct tmat2x4; -template struct tmat2x4; template struct tmat2x4; template struct tmat2x4; -template struct tmat2x4; template struct tmat2x4; template struct tmat2x4; // tmat3x2 type explicit instantiation -template struct tmat3x2; template struct tmat3x2; template struct tmat3x2; -template struct tmat3x2; template struct tmat3x2; template struct tmat3x2; -template struct tmat3x2; template struct tmat3x2; template struct tmat3x2; // tmat3x3 type explicit instantiation -template struct tmat3x3; template struct tmat3x3; template struct tmat3x3; -template struct tmat3x3; template struct tmat3x3; template struct tmat3x3; -template struct tmat3x3; template struct tmat3x3; template struct tmat3x3; // tmat3x4 type explicit instantiation -template struct tmat3x4; template struct tmat3x4; template struct tmat3x4; -template struct tmat3x4; template struct tmat3x4; template struct tmat3x4; -template struct tmat3x4; template struct tmat3x4; template struct tmat3x4; // tmat4x2 type explicit instantiation -template struct tmat4x2; template struct tmat4x2; template struct tmat4x2; -template struct tmat4x2; template struct tmat4x2; template struct tmat4x2; -template struct tmat4x2; template struct tmat4x2; template struct tmat4x2; // tmat4x3 type explicit instantiation -template struct tmat4x3; template struct tmat4x3; template struct tmat4x3; -template struct tmat4x3; template struct tmat4x3; template struct tmat4x3; -template struct tmat4x3; template struct tmat4x3; template struct tmat4x3; // tmat4x4 type explicit instantiation -template struct tmat4x4; template struct tmat4x4; template struct tmat4x4; -template struct tmat4x4; template struct tmat4x4; template struct tmat4x4; -template struct tmat4x4; template struct tmat4x4; template struct tmat4x4; // tquat type explicit instantiation -template struct tquat; template struct tquat; template struct tquat; -template struct tquat; template struct tquat; template struct tquat; -template struct tquat; template struct tquat; template struct tquat; //tdualquat type explicit instantiation -template struct tdualquat; template struct tdualquat; template struct tdualquat; -template struct tdualquat; template struct tdualquat; template struct tdualquat; -template struct tdualquat; template struct tdualquat; template struct tdualquat; diff --git a/glm/gtc/constants.hpp b/glm/gtc/constants.hpp index 48876297..45367cf0 100644 --- a/glm/gtc/constants.hpp +++ b/glm/gtc/constants.hpp @@ -41,7 +41,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTC_constants extension included") diff --git a/glm/gtc/constants.inl b/glm/gtc/constants.inl index e9bde753..a1665c09 100644 --- a/glm/gtc/constants.inl +++ b/glm/gtc/constants.inl @@ -34,12 +34,6 @@ namespace glm return std::numeric_limits::epsilon(); } - template <> - GLM_FUNC_QUALIFIER half epsilon() - { - return half(1.19209290e-007); - } - template GLM_FUNC_QUALIFIER genType zero() { diff --git a/glm/gtc/epsilon.hpp b/glm/gtc/epsilon.hpp index 7cc3a55f..be63a6a2 100644 --- a/glm/gtc/epsilon.hpp +++ b/glm/gtc/epsilon.hpp @@ -42,7 +42,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtc/quaternion.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) diff --git a/glm/gtc/epsilon.inl b/glm/gtc/epsilon.inl index 0a871596..4190cef8 100644 --- a/glm/gtc/epsilon.inl +++ b/glm/gtc/epsilon.inl @@ -28,16 +28,6 @@ namespace glm { - GLM_FUNC_QUALIFIER bool epsilonEqual - ( - glm::half const & x, - glm::half const & y, - glm::half const & epsilon - ) - { - return abs(x - y) < epsilon; - } - GLM_FUNC_QUALIFIER bool epsilonEqual ( float const & x, @@ -58,16 +48,6 @@ namespace glm return abs(x - y) < epsilon; } - GLM_FUNC_QUALIFIER bool epsilonNotEqual - ( - glm::half const & x, - glm::half const & y, - glm::half const & epsilon - ) - { - return abs(x - y) >= epsilon; - } - GLM_FUNC_QUALIFIER bool epsilonNotEqual ( float const & x, diff --git a/glm/gtc/half_float.hpp b/glm/gtc/half_float.hpp deleted file mode 100644 index 83649296..00000000 --- a/glm/gtc/half_float.hpp +++ /dev/null @@ -1,685 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref gtc_half_float -/// @file glm/gtc/half_float.hpp -/// @date 2009-04-29 / 2012-11-06 -/// @author Christophe Riccio -/// -/// @see core (dependence) -/// -/// @defgroup gtc_half_float GLM_GTC_half_float -/// @ingroup gtc -/// -/// Defines the half-precision floating-point type, along with various typedefs for vectors and matrices. -/// need to be included to use these functionalities. -/////////////////////////////////////////////////////////////////////////////////// - -#ifndef GLM_GTC_half_float -#define GLM_GTC_half_float GLM_VERSION - -// Dependency: -#include "../glm.hpp" - -#if(defined(GLM_MESSAGES) && !defined(glm_ext)) -# pragma message("GLM: GLM_GTC_half_float extension included") -#endif - -namespace glm{ -namespace detail -{ -#if(GLM_COMPONENT == GLM_COMPONENT_CXX98) - template - struct tvec2 - { - enum ctor{_null}; - typedef half value_type; - typedef std::size_t size_type; - - GLM_FUNC_DECL size_type length() const; - - typedef tvec2 type; - typedef tvec2 bool_type; - - ////////////////////////////////////// - // Data - - half x, y; - - ////////////////////////////////////// - // Accesses - - GLM_FUNC_DECL half & operator[](size_type i); - GLM_FUNC_DECL half const & operator[](size_type i) const; - - ////////////////////////////////////// - // Implicit basic constructors - - GLM_FUNC_DECL tvec2(); - GLM_FUNC_DECL tvec2(tvec2 const & v); - - ////////////////////////////////////// - // Explicit basic constructors - - GLM_FUNC_DECL explicit tvec2(ctor){} - GLM_FUNC_DECL explicit tvec2( - half const & s); - GLM_FUNC_DECL explicit tvec2( - half const & s1, - half const & s2); - - ////////////////////////////////////// - // Swizzle constructors - - GLM_FUNC_DECL tvec2(tref2 const & r); - - ////////////////////////////////////// - // Convertion scalar constructors - - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2(U const & x); - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2(U const & x, V const & y); - - ////////////////////////////////////// - // Convertion vector constructors - - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2(tvec2 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2(tvec3 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec2(tvec4 const & v); - - ////////////////////////////////////// - // Unary arithmetic operators - - GLM_FUNC_DECL tvec2& operator= (tvec2 const & v); - - GLM_FUNC_DECL tvec2& operator+=(half const & s); - GLM_FUNC_DECL tvec2& operator+=(tvec2 const & v); - GLM_FUNC_DECL tvec2& operator-=(half const & s); - GLM_FUNC_DECL tvec2& operator-=(tvec2 const & v); - GLM_FUNC_DECL tvec2& operator*=(half const & s); - GLM_FUNC_DECL tvec2& operator*=(tvec2 const & v); - GLM_FUNC_DECL tvec2& operator/=(half const & s); - GLM_FUNC_DECL tvec2& operator/=(tvec2 const & v); - GLM_FUNC_DECL tvec2& operator++(); - GLM_FUNC_DECL tvec2& operator--(); - - ////////////////////////////////////// - // Swizzle operators - - GLM_FUNC_DECL half swizzle(comp X) const; - GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; - GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; - GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; - GLM_FUNC_DECL tref2 swizzle(comp X, comp Y); - }; - - template - struct tvec3 - { - enum ctor{_null}; - typedef half value_type; - typedef std::size_t size_type; - GLM_FUNC_DECL size_type length() const; - - typedef tvec3 type; - typedef tvec3 bool_type; - - ////////////////////////////////////// - // Data - - half x, y, z; - - ////////////////////////////////////// - // Accesses - - GLM_FUNC_DECL half & operator[](size_type i); - GLM_FUNC_DECL half const & operator[](size_type i) const; - - ////////////////////////////////////// - // Implicit basic constructors - - GLM_FUNC_DECL tvec3(); - GLM_FUNC_DECL tvec3(tvec3 const & v); - - ////////////////////////////////////// - // Explicit basic constructors - - GLM_FUNC_DECL explicit tvec3(ctor){} - GLM_FUNC_DECL explicit tvec3( - half const & s); - GLM_FUNC_DECL explicit tvec3( - half const & s1, - half const & s2, - half const & s3); - - ////////////////////////////////////// - // Swizzle constructors - - GLM_FUNC_DECL tvec3(tref3 const & r); - - ////////////////////////////////////// - // Convertion scalar constructors - - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(U const & x); - - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(U const & x, V const & y, W const & z); - - ////////////////////////////////////// - // Convertion vector constructors - - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(tvec2 const & v, B const & s); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(A const & s, tvec2 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(tvec3 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec3(tvec4 const & v); - - ////////////////////////////////////// - // Unary arithmetic operators - - GLM_FUNC_DECL tvec3& operator= (tvec3 const & v); - - GLM_FUNC_DECL tvec3& operator+=(half const & s); - GLM_FUNC_DECL tvec3& operator+=(tvec3 const & v); - GLM_FUNC_DECL tvec3& operator-=(half const & s); - GLM_FUNC_DECL tvec3& operator-=(tvec3 const & v); - GLM_FUNC_DECL tvec3& operator*=(half const & s); - GLM_FUNC_DECL tvec3& operator*=(tvec3 const & v); - GLM_FUNC_DECL tvec3& operator/=(half const & s); - GLM_FUNC_DECL tvec3& operator/=(tvec3 const & v); - GLM_FUNC_DECL tvec3& operator++(); - GLM_FUNC_DECL tvec3& operator--(); - - ////////////////////////////////////// - // Swizzle operators - - GLM_FUNC_DECL half swizzle(comp X) const; - GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; - GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; - GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; - GLM_FUNC_DECL tref3 swizzle(comp X, comp Y, comp Z); - }; - - template - struct tvec4 - { - enum ctor{_null}; - typedef half value_type; - typedef std::size_t size_type; - GLM_FUNC_DECL size_type length() const; - - typedef tvec4 type; - typedef tvec4 bool_type; - - ////////////////////////////////////// - // Data - - half x, y, z, w; - - ////////////////////////////////////// - // Accesses - - GLM_FUNC_DECL half & operator[](size_type i); - GLM_FUNC_DECL half const & operator[](size_type i) const; - - ////////////////////////////////////// - // Implicit basic constructors - - GLM_FUNC_DECL tvec4(); - GLM_FUNC_DECL tvec4(tvec4 const & v); - - ////////////////////////////////////// - // Explicit basic constructors - - - GLM_FUNC_DECL explicit tvec4(ctor){} - GLM_FUNC_DECL explicit tvec4( - half const & s); - GLM_FUNC_DECL explicit tvec4( - half const & s0, - half const & s1, - half const & s2, - half const & s3); - - ////////////////////////////////////// - // Swizzle constructors - - GLM_FUNC_DECL tvec4(tref4 const & r); - - ////////////////////////////////////// - // Convertion scalar constructors - - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(U const & x); - //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(A const & x, B const & y, C const & z, D const & w); - - ////////////////////////////////////// - // Convertion vector constructors - - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(tvec2 const & v, B const & s1, C const & s2); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(A const & s1, tvec2 const & v, C const & s2); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(A const & s1, B const & s2, tvec2 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(tvec3 const & v, B const & s); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(A const & s, tvec3 const & v); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(tvec2 const & v1, tvec2 const & v2); - //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) - template - GLM_FUNC_DECL explicit tvec4(tvec4 const & v); - - ////////////////////////////////////// - // Unary arithmetic operators - - GLM_FUNC_DECL tvec4& operator= (tvec4 const & v); - - GLM_FUNC_DECL tvec4& operator+=(half const & s); - GLM_FUNC_DECL tvec4& operator+=(tvec4 const & v); - GLM_FUNC_DECL tvec4& operator-=(half const & s); - GLM_FUNC_DECL tvec4& operator-=(tvec4 const & v); - GLM_FUNC_DECL tvec4& operator*=(half const & s); - GLM_FUNC_DECL tvec4& operator*=(tvec4 const & v); - GLM_FUNC_DECL tvec4& operator/=(half const & s); - GLM_FUNC_DECL tvec4& operator/=(tvec4 const & v); - GLM_FUNC_DECL tvec4& operator++(); - GLM_FUNC_DECL tvec4& operator--(); - - ////////////////////////////////////// - // Swizzle operators - - GLM_FUNC_DECL half swizzle(comp X) const; - GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; - GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; - GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; - GLM_FUNC_DECL tref4 swizzle(comp X, comp Y, comp Z, comp W); - }; -#endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98) -} -//namespace detail - - /// @addtogroup gtc_half_float - /// @{ - - ////////////////////////////////////////////// - // High half precision floating-point numbers. - - /// Vector of 2 high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec2 highp_hvec2; - - /// Vector of 3 high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec3 highp_hvec3; - - /// Vector of 4 high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec4 highp_hvec4; - - /// 2 * 2 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 highp_hmat2; - - /// 3 * 3 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 highp_hmat3; - - /// 4 * 4 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 highp_hmat4; - - /// 2 * 2 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 highp_hmat2x2; - - /// 2 * 3 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x3 highp_hmat2x3; - - /// 2 * 4 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x4 highp_hmat2x4; - - /// 3 * 2 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x2 highp_hmat3x2; - - /// 3 * 3 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 highp_hmat3x3; - - /// 3 * 4 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x4 highp_hmat3x4; - - /// 4 * 2 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x2 highp_hmat4x2; - - /// 4 * 3 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x3 highp_hmat4x3; - - /// 4 * 4 matrix of high half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 highp_hmat4x4; - - ////////////////////////////////////////////// - // Medium half precision floating-point numbers. - - /// Vector of 2 medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec2 mediump_hvec2; - - /// Vector of 3 medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec3 mediump_hvec3; - - /// Vector of 4 medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec4 mediump_hvec4; - - /// 2 * 2 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 mediump_hmat2; - - /// 3 * 3 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 mediump_hmat3; - - /// 4 * 4 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 mediump_hmat4; - - /// 2 * 2 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 mediump_hmat2x2; - - /// 2 * 3 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x3 mediump_hmat2x3; - - /// 2 * 4 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x4 mediump_hmat2x4; - - /// 3 * 2 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x2 mediump_hmat3x2; - - /// 3 * 3 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 mediump_hmat3x3; - - /// 3 * 4 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x4 mediump_hmat3x4; - - /// 4 * 2 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x2 mediump_hmat4x2; - - /// 4 * 3 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x3 mediump_hmat4x3; - - /// 4 * 4 matrix of medium half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 mediump_hmat4x4; - - - ////////////////////////////////////////////// - // Low half precision floating-point numbers. - - /// Vector of 2 low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec2 lowp_hvec2; - - /// Vector of 3 low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec3 lowp_hvec3; - - /// Vector of 4 low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tvec4 lowp_hvec4; - - /// 2 * 2 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 lowp_hmat2; - - /// 3 * 3 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 lowp_hmat3; - - /// 4 * 4 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 lowp_hmat4; - - /// 2 * 2 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x2 lowp_hmat2x2; - - /// 2 * 3 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x3 lowp_hmat2x3; - - /// 2 * 4 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat2x4 lowp_hmat2x4; - - /// 3 * 2 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x2 lowp_hmat3x2; - - /// 3 * 3 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x3 lowp_hmat3x3; - - /// 3 * 4 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat3x4 lowp_hmat3x4; - - /// 4 * 2 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x2 lowp_hmat4x2; - - /// 4 * 3 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x3 lowp_hmat4x3; - - /// 4 * 4 matrix of low half-precision floating-point numbers. - /// @see gtc_half_float - typedef detail::tmat4x4 lowp_hmat4x4; - - - ////////////////////////////////////////////// - // Default half precision floating-point numbers. - - /// Type for default half-precision floating-point numbers. - /// @see gtc_half_float - typedef half_t half; - - -#if(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_hvec2 hvec2; - typedef lowp_hvec3 hvec3; - typedef lowp_hvec4 hvec4; - typedef lowp_hmat2 hmat2; - typedef lowp_hmat3 hmat3; - typedef lowp_hmat4 hmat4; - typedef lowp_hmat2x2 hmat2x2; - typedef lowp_hmat2x3 hmat2x3; - typedef lowp_hmat2x4 hmat2x4; - typedef lowp_hmat3x2 hmat3x2; - typedef lowp_hmat3x3 hmat3x3; - typedef lowp_hmat3x4 hmat3x4; - typedef lowp_hmat4x2 hmat4x2; - typedef lowp_hmat4x3 hmat4x3; - typedef lowp_hmat4x4 hmat4x4; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef mediump_hvec2 hvec2; - typedef mediump_hvec3 hvec3; - typedef mediump_hvec4 hvec4; - typedef mediump_hmat2 hmat2; - typedef mediump_hmat3 hmat3; - typedef mediump_hmat4 hmat4; - typedef mediump_hmat2x2 hmat2x2; - typedef mediump_hmat2x3 hmat2x3; - typedef mediump_hmat2x4 hmat2x4; - typedef mediump_hmat3x2 hmat3x2; - typedef mediump_hmat3x3 hmat3x3; - typedef mediump_hmat3x4 hmat3x4; - typedef mediump_hmat4x2 hmat4x2; - typedef mediump_hmat4x3 hmat4x3; - typedef mediump_hmat4x4 hmat4x4; -#else //(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - ////////////////////////////////////////////// - // Default half precision floating-point numbers. - - /// Vector of 2 default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hvec2 hvec2; - - /// Vector of 3 default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hvec3 hvec3; - - /// Vector of 4 default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hvec4 hvec4; - - /// 2 * 2 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat2x2 hmat2; - - /// 3 * 3 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat3x3 hmat3; - - /// 4 * 4 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat4x4 hmat4; - - /// 2 * 2 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat2x2 hmat2x2; - - /// 2 * 3 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat2x3 hmat2x3; - - /// 2 * 4 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat2x4 hmat2x4; - - /// 3 * 2 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat3x2 hmat3x2; - - /// 3 * 3 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat3x3 hmat3x3; - - /// 3 * 4 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat3x4 hmat3x4; - - /// 4 * 2 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat4x2 hmat4x2; - - /// 4 * 3 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat4x3 hmat4x3; - - /// 4 * 4 matrix of default half-precision floating-point numbers. - /// @see gtc_half_float - typedef highp_hmat4x4 hmat4x4; -#endif//GLM_PRECISION - - /// Returns the absolute value of a half-precision floating-point value - /// @see gtc_half_float - GLM_FUNC_DECL half abs(half const & x); - - /// Returns the absolute value of a half-precision floating-point two dimensional vector - /// @see gtc_half_float - GLM_FUNC_DECL hvec2 abs(hvec2 const & x); - - /// Returns the absolute value of a half-precision floating-point three dimensional vector - /// @see gtc_half_float - GLM_FUNC_DECL hvec3 abs(hvec3 const & x); - - /// Returns the absolute value of a half-precision floating-point four dimensional vector - /// @see gtc_half_float - GLM_FUNC_DECL hvec4 abs(hvec4 const & x); - - /// Selects which vector each returned component comes - /// from. For a component of that is false, the - /// corresponding component of x is returned. For a - /// component of a that is true, the corresponding - /// component of y is returned. Components of x and y that - /// are not selected are allowed to be invalid floating point - /// values and will have no effect on the results. Thus, this - /// provides different functionality than - /// genType mix(genType x, genType y, genType(a)) - /// where a is a Boolean vector. - /// - /// @see gtc_half_float - GLM_FUNC_DECL half mix(half const & x, half const & y, bool const & a); - - /// @} -}// namespace glm - -#include "half_float.inl" - -#endif//GLM_GTC_half_float diff --git a/glm/gtc/half_float.inl b/glm/gtc/half_float.inl deleted file mode 100644 index c883e3b1..00000000 --- a/glm/gtc/half_float.inl +++ /dev/null @@ -1,1123 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref gtc_half_float -/// @file glm/gtc/half_float.inl -/// @date 2009-04-29 / 2012-11-06 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - -namespace glm{ -namespace detail -{ -#if(GLM_COMPONENT == GLM_COMPONENT_CXX98) - ////////////////////////////////////// - // hvec2 - - template - GLM_FUNC_QUALIFIER typename tvec2::size_type tvec2::length() const{return 2;} - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER half & tvec2::operator[](typename tvec2::size_type i) - { - assert(i < this->length()); - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER half const & tvec2::operator[](typename tvec2::size_type i) const - { - assert(i < this->length()); - return (&x)[i]; - } - - ////////////////////////////////////// - // Implicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec2::tvec2() : - x(half(0.f)), - y(half(0.f)) - {} - - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec2 const & v - ) : - x(v.x), - y(v.y) - {} - - ////////////////////////////////////// - // Explicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - half const & s - ) : - x(s), - y(s) - {} - - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - half const & s1, - half const & s2 - ) : - x(s1), - y(s2) - {} - - ////////////////////////////////////// - // Swizzle constructors - - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tref2 const & r - ) : - x(r.x), - y(r.y) - {} - - ////////////////////////////////////// - // Convertion scalar constructors - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & x - ) : - x(half(x)), - y(half(x)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - U const & x, - V const & y - ) : - x(half(x)), - y(half(y)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec2 const & v - ) : - x(half(v.x)), - y(half(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec3 const & v - ) : - x(half(v.x)), - y(half(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec2::tvec2 - ( - tvec4 const & v - ) : - x(half(v.x)), - y(half(v.y)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= - ( - tvec2 const & v - ) - { - this->x = v.x; - this->y = v.y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - half const & s - ) - { - this->x += s; - this->y += s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator+= - ( - tvec2 const & v - ) - { - this->x += v.x; - this->y += v.y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - half const & s - ) - { - this->x -= s; - this->y -= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator-= - ( - tvec2 const & v - ) - { - this->x -= v.x; - this->y -= v.y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2& tvec2::operator*= - ( - half const & s - ) - { - this->x *= s; - this->y *= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator*= - ( - tvec2 const & v - ) - { - this->x *= v.x; - this->y *= v.y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - half const & s - ) - { - this->x /= s; - this->y /= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator/= - ( - tvec2 const & v - ) - { - this->x /= v.x; - this->y /= v.y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2 & tvec2::operator++() - { - ++this->x; - ++this->y; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec2& tvec2::operator--() - { - --this->x; - --this->y; - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER half tvec2::swizzle(comp x) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec2::swizzle(comp x, comp y) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec2::swizzle(comp x, comp y, comp z) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec2::swizzle(comp x, comp y, comp z, comp w) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref2 tvec2::swizzle(comp x, comp y) - { - return tref2( - (*this)[x], - (*this)[y]); - } - - ////////////////////////////////////// - // hvec3 - - template - GLM_FUNC_QUALIFIER typename tvec3::size_type tvec3::length() const - { - return 3; - } - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER half & tvec3::operator[] - ( - typename tvec3::size_type i - ) - { - assert(i < this->length()); - - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER half const & tvec3::operator[] - ( - typename tvec3::size_type i - ) const - { - assert(i < this->length()); - - return (&x)[i]; - } - - ////////////////////////////////////// - // Implicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec3::tvec3() : - x(half(0)), - y(half(0)), - z(half(0)) - {} - - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec3 const & v - ) : - x(v.x), - y(v.y), - z(v.z) - {} - - ////////////////////////////////////// - // Explicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - half const & s - ) : - x(s), - y(s), - z(s) - {} - - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - half const & s0, - half const & s1, - half const & s2 - ) : - x(s0), - y(s1), - z(s2) - {} - - ////////////////////////////////////// - // Swizzle constructors - - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tref3 const & r - ) : - x(r.x), - y(r.y), - z(r.z) - {} - - ////////////////////////////////////// - // Convertion scalar constructors - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - U const & x - ) : - x(half(x)), - y(half(x)), - z(half(x)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - A const & x, - B const & y, - C const & z - ) : - x(half(x)), - y(half(y)), - z(half(z)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec2 const & v, - B const & s - ) : - x(half(v.x)), - y(half(v.y)), - z(half(s)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - A const & s, - tvec2 const & v - ) : - x(half(s)), - y(half(v.x)), - z(half(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec3 const & v - ) : - x(half(v.x)), - y(half(v.y)), - z(half(v.z)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec3::tvec3 - ( - tvec4 const & v - ) : - x(half(v.x)), - y(half(v.y)), - z(half(v.z)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator= - ( - tvec3 const & v - ) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= - ( - half const & s - ) - { - this->x += s; - this->y += s; - this->z += s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= - ( - tvec3 const & v - ) - { - this->x += v.x; - this->y += v.y; - this->z += v.z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= - ( - half const & s - ) - { - this->x -= s; - this->y -= s; - this->z -= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= - ( - tvec3 const & v - ) - { - this->x -= v.x; - this->y -= v.y; - this->z -= v.z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= - ( - half const & s - ) - { - this->x *= s; - this->y *= s; - this->z *= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= - ( - tvec3 const & v - ) - { - this->x *= v.x; - this->y *= v.y; - this->z *= v.z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= - ( - half const & s - ) - { - this->x /= s; - this->y /= s; - this->z /= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= - ( - tvec3 const & v - ) - { - this->x /= v.x; - this->y /= v.y; - this->z /= v.z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator++() - { - ++this->x; - ++this->y; - ++this->z; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator--() - { - --this->x; - --this->y; - --this->z; - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER half tvec3::swizzle(comp x) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec3::swizzle(comp x, comp y) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec3::swizzle(comp x, comp y, comp z) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec3::swizzle(comp x, comp y, comp z, comp w) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref3 tvec3::swizzle(comp x, comp y, comp z) - { - return tref3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - ////////////////////////////////////// - // hvec4 - - template - GLM_FUNC_QUALIFIER typename tvec4::size_type tvec4::length() const - { - return 4; - } - - ////////////////////////////////////// - // Accesses - - template - GLM_FUNC_QUALIFIER half & tvec4::operator[] - ( - typename tvec4::size_type i - ) - { - assert(i < this->length()); - - return (&x)[i]; - } - - template - GLM_FUNC_QUALIFIER half const & tvec4::operator[] - ( - typename tvec4::size_type i - ) const - { - assert(i < this->length()); - - return (&x)[i]; - } - - ////////////////////////////////////// - // Implicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec4::tvec4() : - x(half(0)), - y(half(0)), - z(half(0)), - w(half(0)) - {} - - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec4 const & v - ) : - x(v.x), - y(v.y), - z(v.z), - w(v.w) - {} - - ////////////////////////////////////// - // Explicit basic constructors - - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - half const & s - ) : - x(s), - y(s), - z(s), - w(s) - {} - - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - half const & s1, - half const & s2, - half const & s3, - half const & s4 - ) : - x(s1), - y(s2), - z(s3), - w(s4) - {} - - ////////////////////////////////////// - // Swizzle constructors - - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tref4 const & r - ) : - x(r.x), - y(r.y), - z(r.z), - w(r.w) - {} - - ////////////////////////////////////// - // Convertion scalar constructors - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - U const & x - ) : - x(half(x)), - y(half(x)), - z(half(x)), - w(half(x)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & x, - B const & y, - C const & z, - D const & w - ) : - x(half(x)), - y(half(y)), - z(half(z)), - w(half(w)) - {} - - ////////////////////////////////////// - // Convertion vector constructors - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec2 const & v, - B const & s1, - C const & s2 - ) : - x(half(v.x)), - y(half(v.y)), - z(half(s1)), - w(half(s2)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s1, - tvec2 const & v, - C const & s2 - ) : - x(half(s1)), - y(half(v.x)), - z(half(v.y)), - w(half(s2)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s1, - B const & s2, - tvec2 const & v - ) : - x(half(s1)), - y(half(s2)), - z(half(v.x)), - w(half(v.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec3 const & v, - B const & s - ) : - x(half(v.x)), - y(half(v.y)), - z(half(v.z)), - w(half(s)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - A const & s, - tvec3 const & v - ) : - x(half(s)), - y(half(v.x)), - z(half(v.y)), - w(half(v.z)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec2 const & v1, - tvec2 const & v2 - ) : - x(half(v1.x)), - y(half(v1.y)), - z(half(v2.x)), - w(half(v2.y)) - {} - - template - template - GLM_FUNC_QUALIFIER tvec4::tvec4 - ( - tvec4 const & v - ) : - x(half(v.x)), - y(half(v.y)), - z(half(v.z)), - w(half(v.w)) - {} - - ////////////////////////////////////// - // Unary arithmetic operators - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator= - ( - tvec4 const & v - ) - { - this->x = v.x; - this->y = v.y; - this->z = v.z; - this->w = v.w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator+= - ( - half const & s - ) - { - this->x += s; - this->y += s; - this->z += s; - this->w += s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator+= - ( - tvec4 const & v - ) - { - this->x += v.x; - this->y += v.y; - this->z += v.z; - this->w += v.w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator-= - ( - half const & s - ) - { - this->x -= s; - this->y -= s; - this->z -= s; - this->w -= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator-= - ( - tvec4 const & v - ) - { - this->x -= v.x; - this->y -= v.y; - this->z -= v.z; - this->w -= v.w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator*= - ( - half const & s - ) - { - this->x *= s; - this->y *= s; - this->z *= s; - this->w *= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator*= - ( - tvec4 const & v - ) - { - this->x *= v.x; - this->y *= v.y; - this->z *= v.z; - this->w *= v.w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator/= - ( - half const & s - ) - { - this->x /= s; - this->y /= s; - this->z /= s; - this->w /= s; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator/= - ( - tvec4 const & v - ) - { - this->x /= v.x; - this->y /= v.y; - this->z /= v.z; - this->w /= v.w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator++() - { - ++this->x; - ++this->y; - ++this->z; - ++this->w; - return *this; - } - - template - GLM_FUNC_QUALIFIER tvec4& tvec4::operator--() - { - --this->x; - --this->y; - --this->z; - --this->w; - return *this; - } - - ////////////////////////////////////// - // Swizzle operators - - template - GLM_FUNC_QUALIFIER half tvec4::swizzle(comp x) const - { - return (*this)[x]; - } - - template - GLM_FUNC_QUALIFIER tvec2 tvec4::swizzle(comp x, comp y) const - { - return tvec2( - (*this)[x], - (*this)[y]); - } - - template - GLM_FUNC_QUALIFIER tvec3 tvec4::swizzle(comp x, comp y, comp z) const - { - return tvec3( - (*this)[x], - (*this)[y], - (*this)[z]); - } - - template - GLM_FUNC_QUALIFIER tvec4 tvec4::swizzle(comp x, comp y, comp z, comp w) const - { - return tvec4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - - template - GLM_FUNC_QUALIFIER tref4 tvec4::swizzle(comp x, comp y, comp z, comp w) - { - return tref4( - (*this)[x], - (*this)[y], - (*this)[z], - (*this)[w]); - } - -#endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98) - -}//namespace detail - - GLM_FUNC_QUALIFIER half abs(half const & x) - { - return float(x) >= float(0) ? x : -x; - } - - GLM_FUNC_QUALIFIER hvec2 abs(hvec2 const & v) - { - return hvec2( - float(v.x) >= float(0) ? v.x : -v.x, - float(v.y) >= float(0) ? v.y : -v.y); - } - - GLM_FUNC_QUALIFIER hvec3 abs(hvec3 const & v) - { - return hvec3( - float(v.x) >= float(0) ? v.x : -v.x, - float(v.y) >= float(0) ? v.y : -v.y, - float(v.z) >= float(0) ? v.z : -v.z); - } - - GLM_FUNC_QUALIFIER hvec4 abs(hvec4 const & v) - { - return hvec4( - float(v.x) >= float(0) ? v.x : -v.x, - float(v.y) >= float(0) ? v.y : -v.y, - float(v.z) >= float(0) ? v.z : -v.z, - float(v.w) >= float(0) ? v.w : -v.w); - } - - template <> - GLM_FUNC_QUALIFIER glm::half mix - ( - glm::half const & x, - glm::half const & y, - bool const & a - ) - { - return a ? y : x; - } - -}//namespace glm diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 9e70f8c8..f1782069 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -42,7 +42,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtc/constants.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) diff --git a/glm/gtc/random.hpp b/glm/gtc/random.hpp index e46199aa..60501c79 100644 --- a/glm/gtc/random.hpp +++ b/glm/gtc/random.hpp @@ -42,7 +42,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTC_random extension included") diff --git a/glm/gtc/random.inl b/glm/gtc/random.inl index 34755e84..02e4de78 100644 --- a/glm/gtc/random.inl +++ b/glm/gtc/random.inl @@ -44,12 +44,6 @@ namespace detail } */ }; - - template <> - GLM_FUNC_QUALIFIER half compute_linearRand::operator() (half const & Min, half const & Max) const - { - return half(float(std::rand()) / float(RAND_MAX) * (float(Max) - float(Min)) + float(Min)); - } template <> GLM_FUNC_QUALIFIER float compute_linearRand::operator() (float const & Min, float const & Max) const diff --git a/glm/gtc/swizzle.hpp b/glm/gtc/swizzle.hpp index 3b54972f..f40db631 100644 --- a/glm/gtc/swizzle.hpp +++ b/glm/gtc/swizzle.hpp @@ -101,9 +101,6 @@ namespace glm GLM_FUNC_QUALIFIER TYPE& swizzle(detail::tvec##SIZE & v) \ {return v[x];} - static_swizzle1_ref(detail::float16, 2) - static_swizzle1_ref(detail::float16, 3) - static_swizzle1_ref(detail::float16, 4) static_swizzle1_ref(detail::float32, 2) static_swizzle1_ref(detail::float32, 3) static_swizzle1_ref(detail::float32, 4) @@ -172,9 +169,6 @@ namespace glm {return detail::tvec4(v[x], v[y], v[z], v[w]);} - static_swizzle2_const(glm::f16, 2) - static_swizzle2_const(glm::f16, 3) - static_swizzle2_const(glm::f16, 4) static_swizzle2_const(glm::f32, 2) static_swizzle2_const(glm::f32, 3) static_swizzle2_const(glm::f32, 4) @@ -208,9 +202,6 @@ namespace glm static_swizzle2_const(glm::u64, 3) static_swizzle2_const(glm::u64, 4) - static_swizzle3_const(glm::f16, 2) - static_swizzle3_const(glm::f16, 3) - static_swizzle3_const(glm::f16, 4) static_swizzle3_const(glm::f32, 2) static_swizzle3_const(glm::f32, 3) static_swizzle3_const(glm::f32, 4) @@ -244,9 +235,6 @@ namespace glm static_swizzle3_const(glm::u64, 3) static_swizzle3_const(glm::u64, 4) - static_swizzle4_const(glm::f16, 2) - static_swizzle4_const(glm::f16, 3) - static_swizzle4_const(glm::f16, 4) static_swizzle4_const(glm::f32, 2) static_swizzle4_const(glm::f32, 3) static_swizzle4_const(glm::f32, 4) @@ -298,9 +286,6 @@ namespace glm detail::tvec##SIZE & v) \ {return glm::detail::tref4(v[x], v[y], v[z], v[w]);} - static_swizzle2_ref(glm::f16, 2) - static_swizzle2_ref(glm::f16, 3) - static_swizzle2_ref(glm::f16, 4) static_swizzle2_ref(glm::f32, 2) static_swizzle2_ref(glm::f32, 3) static_swizzle2_ref(glm::f32, 4) @@ -334,8 +319,6 @@ namespace glm static_swizzle2_ref(glm::u64, 3) static_swizzle2_ref(glm::u64, 4) - static_swizzle3_ref(glm::f16, 3) - static_swizzle3_ref(glm::f16, 4) static_swizzle3_ref(glm::f32, 3) static_swizzle3_ref(glm::f32, 4) static_swizzle3_ref(glm::f64, 3) @@ -359,7 +342,6 @@ namespace glm static_swizzle3_ref(glm::u64, 3) static_swizzle3_ref(glm::u64, 4) - static_swizzle4_ref(glm::f16, 4) static_swizzle4_ref(glm::f32, 4) static_swizzle4_ref(glm::f64, 4) diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index 9bc109dc..5894bc58 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -45,13 +45,12 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtc/quaternion.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTC_type_precision extension included") #endif -/* + namespace glm { /////////////////////////// @@ -590,10 +589,6 @@ namespace glm ////////////////////// // Float vector types - /// 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 float16; - /// 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 float32; @@ -603,10 +598,6 @@ namespace glm typedef detail::float64 float64; - /// 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef detail::float16 float16_t; - /// 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef detail::float32 float32_t; @@ -616,10 +607,6 @@ namespace glm typedef detail::float64 float64_t; - /// 16 bit half-precision floating-point scalar. - /// @see gtc_type_precision - typedef float16 f16; - /// 32 bit single-precision floating-point scalar. /// @see gtc_type_precision typedef float32 f32; @@ -645,23 +632,6 @@ namespace glm /// @see gtc_type_precision typedef detail::tvec4 fvec4; - - /// Half-precision floating-point vector of 1 component. - /// @see gtc_type_precision - typedef detail::tvec1 f16vec1; - - /// Half-precision floating-point vector of 2 components. - /// @see gtc_type_precision - typedef detail::tvec2 f16vec2; - - /// Half-precision floating-point vector of 3 components. - /// @see gtc_type_precision - typedef detail::tvec3 f16vec3; - - /// Half-precision floating-point vector of 4 components. - /// @see gtc_type_precision - typedef detail::tvec4 f16vec4; - /// Single-precision floating-point vector of 1 component. /// @see gtc_type_precision @@ -758,64 +728,6 @@ namespace glm typedef detail::tmat4x4 fmat4x4; - /// Half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef detail::tmat1x1 f16mat1; - - /// Half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x2 f16mat2; - - /// Half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x3 f16mat3; - - /// Half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x4 f16mat4; - - - /// Half-precision floating-point 1x1 matrix. - /// @see gtc_type_precision - //typedef f16 f16mat1x1; - - /// Half-precision floating-point 2x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x2 f16mat2x2; - - /// Half-precision floating-point 2x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x3 f16mat2x3; - - /// Half-precision floating-point 2x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat2x4 f16mat2x4; - - /// Half-precision floating-point 3x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x2 f16mat3x2; - - /// Half-precision floating-point 3x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x3 f16mat3x3; - - /// Half-precision floating-point 3x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat3x4 f16mat3x4; - - /// Half-precision floating-point 4x2 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x2 f16mat4x2; - - /// Half-precision floating-point 4x3 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x3 f16mat4x3; - - /// Half-precision floating-point 4x4 matrix. - /// @see gtc_type_precision - typedef detail::tmat4x4 f16mat4x4; - - /// Single-precision floating-point 1x1 matrix. /// @see gtc_type_precision //typedef detail::tmat1x1 f32mat1; @@ -935,10 +847,6 @@ namespace glm ////////////////////////// // Quaternion types - /// Half-precision floating-point quaternion. - /// @see gtc_type_precision - typedef detail::tquat f16quat; - /// Single-precision floating-point quaternion. /// @see gtc_type_precision typedef detail::tquat f32quat; @@ -949,7 +857,7 @@ namespace glm /// @} }//namespace glm -*/ + #include "type_precision.inl" #endif//GLM_GTC_type_precision diff --git a/glm/gtc/type_ptr.hpp b/glm/gtc/type_ptr.hpp index 4adda9c1..045a0ba1 100644 --- a/glm/gtc/type_ptr.hpp +++ b/glm/gtc/type_ptr.hpp @@ -61,7 +61,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtc/quaternion.hpp" #include diff --git a/glm/gtc/type_ptr.inl b/glm/gtc/type_ptr.inl index e2276d8c..a247cfc4 100644 --- a/glm/gtc/type_ptr.inl +++ b/glm/gtc/type_ptr.inl @@ -26,6 +26,8 @@ /// @author Christophe Riccio /////////////////////////////////////////////////////////////////////////////////// +#include + namespace glm { /// @addtogroup gtc_type_ptr diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp index 0d98c441..caa14751 100644 --- a/glm/gtx/bit.hpp +++ b/glm/gtx/bit.hpp @@ -41,7 +41,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTX_bit extension included") diff --git a/glm/gtx/bit.inl b/glm/gtx/bit.inl index 93f563fa..598c78fc 100644 --- a/glm/gtx/bit.inl +++ b/glm/gtx/bit.inl @@ -20,19 +20,6 @@ namespace glm VECTORIZE_VEC(mask) - // extractField - template - GLM_FUNC_QUALIFIER genIType extractField - ( - half const & value, - genIType const & first, - genIType const & count - ) - { - assert(first + count < sizeof(half)); - return (value._data() << first) >> ((sizeof(half) << 3) - count); - } - template GLM_FUNC_QUALIFIER genIType extractField ( diff --git a/glm/gtx/dual_quaternion.hpp b/glm/gtx/dual_quaternion.hpp index e3a870fb..4cee9524 100644 --- a/glm/gtx/dual_quaternion.hpp +++ b/glm/gtx/dual_quaternion.hpp @@ -43,7 +43,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtc/constants.hpp" #include "../gtc/quaternion.hpp" @@ -202,22 +201,6 @@ namespace detail detail::tdualquat dualquat_cast( detail::tmat3x4 const & x); - - /// Dual-quaternion of low half-precision floating-point numbers. - /// - /// @see gtc_dual_quaternion - typedef detail::tdualquat lowp_hdualquat; - - /// Dual-quaternion of medium half-precision floating-point numbers. - /// - /// @see gtc_dual_quaternion - typedef detail::tdualquat mediump_hdualquat; - - /// Dual-quaternion of high half-precision floating-point numbers. - /// - /// @see gtc_dual_quaternion - typedef detail::tdualquat highp_hdualquat; - /// Dual-quaternion of low single-precision floating-point numbers. /// @@ -290,22 +273,6 @@ namespace detail # error "GLM error: multiple default precision requested for single-precision floating-point types" #endif - -#if(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - /// Dual-quaternion of default half-precision floating-point numbers. - /// - /// @see gtc_dual_quaternion - typedef highp_hdualquat hdualquat; -#elif(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef highp_hdualquat hdualquat; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF)) - typedef mediump_hdualquat hdualquat; -#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF)) - typedef lowp_hdualquat hdualquat; -#else -# error "GLM error: Multiple default precision requested for half-precision floating-point types" -#endif - #if(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE)) /// Dual-quaternion of default double-precision floating-point numbers. diff --git a/glm/gtx/euler_angles.hpp b/glm/gtx/euler_angles.hpp index 72ce7a03..d16afff6 100644 --- a/glm/gtx/euler_angles.hpp +++ b/glm/gtx/euler_angles.hpp @@ -41,7 +41,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #if(defined(GLM_MESSAGES) && !defined(glm_ext)) # pragma message("GLM: GLM_GTX_euler_angles extension included") diff --git a/glm/gtx/multiple.inl b/glm/gtx/multiple.inl index 80752446..c5f134dd 100644 --- a/glm/gtx/multiple.inl +++ b/glm/gtx/multiple.inl @@ -31,25 +31,6 @@ namespace glm return Source + (-Source % Multiple); } - template <> - GLM_FUNC_QUALIFIER detail::half higherMultiple - ( - detail::half const & SourceH, - detail::half const & MultipleH - ) - { - float Source = SourceH.toFloat(); - float Multiple = MultipleH.toFloat(); - - if (Source > float(0)) - { - float Tmp = Source - float(1); - return detail::half(Tmp + (Multiple - std::fmod(Tmp, Multiple))); - } - else - return detail::half(Source + std::fmod(-Source, Multiple)); - } - template <> GLM_FUNC_QUALIFIER float higherMultiple ( @@ -103,25 +84,6 @@ namespace glm } } - template <> - GLM_FUNC_QUALIFIER detail::half lowerMultiple - ( - detail::half const & SourceH, - detail::half const & MultipleH - ) - { - float Source = SourceH.toFloat(); - float Multiple = MultipleH.toFloat(); - - if (Source >= float(0)) - return detail::half(Source - std::fmod(Source, Multiple)); - else - { - float Tmp = Source + float(1); - return detail::half(Tmp - std::fmod(Tmp, Multiple) - Multiple); - } - } - template <> GLM_FUNC_QUALIFIER float lowerMultiple ( diff --git a/glm/gtx/number_precision.hpp b/glm/gtx/number_precision.hpp index 1597936b..7d116119 100644 --- a/glm/gtx/number_precision.hpp +++ b/glm/gtx/number_precision.hpp @@ -65,15 +65,12 @@ namespace gtx ////////////////////// // Float vector types - typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) ////////////////////// // Float matrix types - typedef f16 f16mat1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) - typedef f16 f16mat1x1; //!< \brief Half-precision floating-point scalar. (from GLM_GTX_number_precision extension) typedef f32 f32mat1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) typedef f32 f32mat1x1; //!< \brief Single-precision floating-point scalar. (from GLM_GTX_number_precision extension) typedef f64 f64mat1; //!< \brief Double-precision floating-point scalar. (from GLM_GTX_number_precision extension) diff --git a/glm/gtx/string_cast.hpp b/glm/gtx/string_cast.hpp index f5efa6ac..79845a52 100644 --- a/glm/gtx/string_cast.hpp +++ b/glm/gtx/string_cast.hpp @@ -43,7 +43,6 @@ // Dependency: #include "../glm.hpp" -#include "../gtc/half_float.hpp" #include "../gtx/integer.hpp" #include "../gtx/quaternion.hpp" #include diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl index f100c959..09e6e240 100644 --- a/glm/gtx/string_cast.inl +++ b/glm/gtx/string_cast.inl @@ -41,11 +41,6 @@ namespace detail //////////////////////////////// // Scalars - GLM_FUNC_QUALIFIER std::string to_string(half const & x) - { - return detail::format("half(%2.4f)", float(x)); - } - GLM_FUNC_QUALIFIER std::string to_string(float x) { return detail::format("float(%f)", x); @@ -105,36 +100,6 @@ namespace detail v.w ? detail::True : detail::False); } - //////////////////////////////// - // Half vectors - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tvec2 const & v - ) - { - return detail::format("hvec2(%2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tvec3 const & v - ) - { - return detail::format("hvec3(%2.4f, %2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat(), v.z.toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tvec4 const & v - ) - { - return detail::format("hvec4(%2.4f, %2.4f, %2.4f, %2.4f)", v.x.toFloat(), v.y.toFloat(), v.z.toFloat(), v.w.toFloat()); - } - //////////////////////////////// // Float vectors @@ -255,117 +220,6 @@ namespace detail return detail::format("uvec4(%d, %d, %d, %d)", v.x, v.y, v.z, v.w); } - //////////////////////////////// - // Half matrices - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat2x2 const & m - ) - { - return detail::format("hmat2x2((%f, %f), (%f, %f))", - m[0][0].toFloat(), m[0][1].toFloat(), - m[1][0].toFloat(), m[1][1].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat2x3 const & x - ) - { - return detail::format("hmat2x3((%f, %f, %f), (%f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat2x4 const & x - ) - { - return detail::format("hmat2x4((%f, %f, %f, %f), (%f, %f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat3x2 const & x - ) - { - return detail::format("hmat3x2((%f, %f), (%f, %f), (%f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat3x3 const & x - ) - { - return detail::format("hmat3x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat3x4 const & x - ) - { - return detail::format("hmat3x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(), x[2][3].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat4x2 const & x - ) - { - return detail::format("hmat4x2((%f, %f), (%f, %f), (%f, %f), (%f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat(), - x[3][0].toFloat(), x[3][1].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat4x3 const & x - ) - { - return detail::format("hmat4x3((%f, %f, %f), (%f, %f, %f), (%f, %f, %f), (%f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(), - x[3][0].toFloat(), x[3][1].toFloat(), x[3][2].toFloat()); - } - - template - GLM_FUNC_QUALIFIER std::string to_string - ( - detail::tmat4x4 const & x - ) - { - return detail::format("hmat4x4((%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f), (%f, %f, %f, %f))", - x[0][0].toFloat(), x[0][1].toFloat(), x[0][2].toFloat(), x[0][3].toFloat(), - x[1][0].toFloat(), x[1][1].toFloat(), x[1][2].toFloat(), x[1][3].toFloat(), - x[2][0].toFloat(), x[2][1].toFloat(), x[2][2].toFloat(), x[2][3].toFloat(), - x[3][0].toFloat(), x[3][1].toFloat(), x[3][2].toFloat(), x[3][3].toFloat()); - } - //////////////////////////////// // Float matrices diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 4eb28256..0f5b9b49 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -1,6 +1,5 @@ glmCreateTestGTC(core_type_cast) glmCreateTestGTC(core_type_float) -glmCreateTestGTC(core_type_half) glmCreateTestGTC(core_type_int) glmCreateTestGTC(core_type_length) glmCreateTestGTC(core_type_mat2x2) diff --git a/test/core/core_func_packing.cpp b/test/core/core_func_packing.cpp index ba683db5..307d0fff 100644 --- a/test/core/core_func_packing.cpp +++ b/test/core/core_func_packing.cpp @@ -8,7 +8,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include #include #include #include diff --git a/test/core/core_type_half.cpp b/test/core/core_type_half.cpp deleted file mode 100644 index 66849724..00000000 --- a/test/core/core_type_half.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////////////////////// -// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Created : 2008-08-31 -// Updated : 2011-09-20 -// Licence : This source is under MIT licence -// File : test/core/type_half.cpp -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include -#include - -int test_half_ctor() -{ - int Error = 0; - - glm::half A(1.0f); - Error += float(A) == 1.0f ? 0 : 1; - - glm::half B = glm::half(1.0f); - Error += float(B) == 1.0f ? 0 : 1; - - glm::half C = B; - Error += float(C) == 1.0f ? 0 : 1; - - return Error; -} - -int test_half_cast() -{ - int Error = 0; - - glm::half A(2.0f); - Error += float(A) == 2.0f ? 0 : 1; - - glm::half B(2.0); - Error += float(B) == 2.0f ? 0 : 1; - - glm::half C(2); - Error += float(C) == 2.0f ? 0 : 1; - - float D(A); - Error += D == 2.0f ? 0 : 1; - - double E(A); - Error += E == 2.0 ? 0 : 1; - - int F(A); - Error += F == 2.0 ? 0 : 1; - - return Error; -} - -int test_half_relational() -{ - int Error = 0; - - glm::half A(1.0f); - glm::half B(2.0f); - - Error += !(A == B) ? 0 : 1; - Error += (A != B) ? 0 : 1; - Error += (A <= B) ? 0 : 1; - Error += (A < B) ? 0 : 1; - Error += !(A >= B) ? 0 : 1; - Error += !(A > B) ? 0 : 1; - - return Error; -} - -int test_half_arithmetic_unary_ops() -{ - int Error = 0; - - { - glm::half A(2.0f); - glm::half B(3.0f); - A += B; - Error += (A == glm::half( 5.0f) ? 0 : 1); - } - - { - glm::half A(2.0f); - glm::half B(3.0f); - A -= B; - Error += (A == glm::half(-1.0f) ? 0 : 1); - } - - { - glm::half A(2.0f); - glm::half B(3.0f); - B -= A; - Error += (B == glm::half( 1.0f) ? 0 : 1); - } - - { - glm::half A(2.0f); - glm::half B(3.0f); - A *= B; - Error += (A == glm::half(6.0f) ? 0 : 1); - } - - { - glm::half A(2.0f); - glm::half B(3.0f); - A /= B; - Error += (A == glm::half(2.0f / 3.0f) ? 0 : 1); - } - - { - glm::half A(2.0f); - glm::half B(3.0f); - B /= A; - Error += (B == glm::half(3.0f / 2.0f) ? 0 : 1); - } - - return Error; -} - -int test_half_arithmetic_binary_ops() -{ - int Error = 0; - - glm::half A(2.0f); - glm::half B(3.0f); - - Error += A + B == glm::half( 5.0f) ? 0 : 1; - Error += A - B == glm::half(-1.0f) ? 0 : 1; - Error += B - A == glm::half( 1.0f) ? 0 : 1; - Error += A * B == glm::half( 6.0f) ? 0 : 1; - Error += A / B == glm::half(2.0f / 3.0f) ? 0 : 1; - Error += B / A == glm::half(3.0f / 2.0f) ? 0 : 1; - - return Error; -} - -int test_half_arithmetic_counter_ops() -{ - int Error = 0; - - { - glm::half A(2.0f); - Error += A == glm::half(2.0f) ? 0 : 1; - } - - { - glm::half A(2.0f); - glm::half B = A++; - Error += B == glm::half(3.0f) ? 0 : 1; - } - - { - glm::half A(2.0f); - glm::half B = A--; - Error += B == glm::half(1.0f) ? 0 : 1; - } - - { - glm::half A(2.0f); - glm::half B = ++A; - Error += B == glm::half(3.0f) ? 0 : 1; - } - - { - glm::half A(2.0f); - glm::half B = --A; - Error += B == glm::half(1.0f) ? 0 : 1; - } - - { - glm::half A(2.0f); - glm::half B = -A; - Error += B == glm::half(-2.0f) ? 0 : 1; - } - - return Error; -} - -int main() -{ - int Result = 0; - - Result += test_half_ctor(); - Result += test_half_cast(); - Result += test_half_relational(); - Result += test_half_arithmetic_unary_ops(); - Result += test_half_arithmetic_binary_ops(); - Result += test_half_arithmetic_counter_ops(); - - return Result; -} diff --git a/test/core/core_type_length.cpp b/test/core/core_type_length.cpp index d52caf05..b669f97b 100644 --- a/test/core/core_type_length.cpp +++ b/test/core/core_type_length.cpp @@ -8,7 +8,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include int test_length_mat_non_squared() { @@ -28,13 +27,6 @@ int test_length_mat_non_squared() Error += glm::dmat4x2().length() == 4 ? 0 : 1; Error += glm::dmat4x3().length() == 4 ? 0 : 1; - Error += glm::hmat2x3().length() == 2 ? 0 : 1; - Error += glm::hmat2x4().length() == 2 ? 0 : 1; - Error += glm::hmat3x2().length() == 3 ? 0 : 1; - Error += glm::hmat3x4().length() == 3 ? 0 : 1; - Error += glm::hmat4x2().length() == 4 ? 0 : 1; - Error += glm::hmat4x3().length() == 4 ? 0 : 1; - return Error; } @@ -56,13 +48,6 @@ int test_length_mat() Error += glm::dmat3x3().length() == 3 ? 0 : 1; Error += glm::dmat4x4().length() == 4 ? 0 : 1; - Error += glm::hmat2().length() == 2 ? 0 : 1; - Error += glm::hmat3().length() == 3 ? 0 : 1; - Error += glm::hmat4().length() == 4 ? 0 : 1; - Error += glm::hmat2x2().length() == 2 ? 0 : 1; - Error += glm::hmat3x3().length() == 3 ? 0 : 1; - Error += glm::hmat4x4().length() == 4 ? 0 : 1; - return Error; } @@ -81,11 +66,7 @@ int test_length_vec() Error += glm::uvec2().length() == 2 ? 0 : 1; Error += glm::uvec3().length() == 3 ? 0 : 1; - Error += glm::uvec4().length() == 4 ? 0 : 1; - - Error += glm::hvec2().length() == 2 ? 0 : 1; - Error += glm::hvec3().length() == 3 ? 0 : 1; - Error += glm::hvec4().length() == 4 ? 0 : 1; + Error += glm::uvec4().length() == 4 ? 0 : 1; Error += glm::dvec2().length() == 2 ? 0 : 1; Error += glm::dvec3().length() == 3 ? 0 : 1; diff --git a/test/core/core_type_vec3.cpp b/test/core/core_type_vec3.cpp index e60c3b18..88e6f4c5 100644 --- a/test/core/core_type_vec3.cpp +++ b/test/core/core_type_vec3.cpp @@ -9,7 +9,6 @@ #define GLM_SWIZZLE #include -#include #include #include @@ -274,46 +273,6 @@ int test_vec3_swizzle3_3() return Error; } -int test_vec3_swizzle_half() -{ - int Error = 0; - - glm::half a1(1); - glm::half b1(2); - glm::half c1(3); - glm::hvec3 v(a1, b1, c1); - glm::hvec3 u; - - u = v; - - Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1; - -#if(GLM_SUPPORT_SWIZZLE_OPERATOR()) - u = v.xyz; - Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1; - u = v.zyx; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; - u.zyx = v; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; - - u = v.rgb; - Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1; - u = v.bgr; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; - u.bgr = v; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; - - u = v.stp; - Error += (u.x == glm::half(1.0f) && u.y == glm::half(2.0f) && u.z == glm::half(3.0f)) ? 0 : 1; - u = v.pts; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; - u.pts = v; - Error += (u.x == glm::half(3.0f) && u.y == glm::half(2.0f) && u.z == glm::half(1.0f)) ? 0 : 1; -#endif//(GLM_SUPPORT_SWIZZLE_OPERATOR()) - - return Error; -} - int test_vec3_swizzle_operators() { int Error = 0; @@ -459,7 +418,6 @@ int main() Error += test_vec3_size(); Error += test_vec3_swizzle3_2(); Error += test_vec3_swizzle3_3(); - Error += test_vec3_swizzle_half(); Error += test_vec3_swizzle_partial(); Error += test_vec3_swizzle_operators(); Error += test_vec3_swizzle_functions(); diff --git a/test/core/core_type_vec4.cpp b/test/core/core_type_vec4.cpp index 8b13667a..733ca067 100644 --- a/test/core/core_type_vec4.cpp +++ b/test/core/core_type_vec4.cpp @@ -9,7 +9,6 @@ #define GLM_SWIZZLE #include -#include #include template @@ -33,15 +32,6 @@ enum comp // return _mm_shuffle_ps(Src, Src, mask<(int(W) << 6) | (int(Z) << 4) | (int(Y) << 2) | (int(X) << 0)>::value); //} -int test_hvec4() -{ - glm::hvec4 const A = glm::hvec4(0, 1, 2, 3); - //glm::hvec4 B = glm::swizzle(A); - - //glm::vec4 B = glm::detail::tvec##(glm::vec4::_size)(); - - return 0; -} int test_vec4_ctor() { @@ -294,7 +284,6 @@ int main() Error += test_vec4_ctor(); Error += test_vec4_size(); Error += test_vec4_operators(); - Error += test_hvec4(); Error += test_vec4_swizzle_partial(); Error += test_operator_increment(); diff --git a/test/gtc/CMakeLists.txt b/test/gtc/CMakeLists.txt index 62c33063..6c341c92 100644 --- a/test/gtc/CMakeLists.txt +++ b/test/gtc/CMakeLists.txt @@ -1,6 +1,5 @@ glmCreateTestGTC(gtc_constants) glmCreateTestGTC(gtc_epsilon) -glmCreateTestGTC(gtc_half_float) glmCreateTestGTC(gtc_matrix_access) glmCreateTestGTC(gtc_matrix_integer) glmCreateTestGTC(gtc_matrix_inverse) diff --git a/test/gtc/gtc_constants.cpp b/test/gtc/gtc_constants.cpp index 2cbf5cd1..3b00ef84 100644 --- a/test/gtc/gtc_constants.cpp +++ b/test/gtc/gtc_constants.cpp @@ -14,10 +14,6 @@ int test_epsilon() { int Error(0); - { - glm::half Test = glm::epsilon(); - } - { float Test = glm::epsilon(); } @@ -33,9 +29,10 @@ int main() { int Error(0); - float MinHalf = 0.0f; - while (glm::half(MinHalf) == glm::half(0.0f)) - MinHalf += std::numeric_limits::epsilon(); - + //float MinHalf = 0.0f; + //while (glm::half(MinHalf) == glm::half(0.0f)) + // MinHalf += std::numeric_limits::epsilon(); + Error += test_epsilon(); + return Error; } diff --git a/test/gtc/gtc_epsilon.cpp b/test/gtc/gtc_epsilon.cpp index 6eda6c8d..40610963 100644 --- a/test/gtc/gtc_epsilon.cpp +++ b/test/gtc/gtc_epsilon.cpp @@ -8,7 +8,6 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// #include -#include #include #include @@ -78,7 +77,6 @@ int main() int Error(0); Error += test_defined(); - Error += test_equal(); Error += test_equal(); Error += test_equal(); diff --git a/test/gtc/gtc_half_float.cpp b/test/gtc/gtc_half_float.cpp deleted file mode 100644 index 41266142..00000000 --- a/test/gtc/gtc_half_float.cpp +++ /dev/null @@ -1,845 +0,0 @@ -/////////////////////////////////////////////////////////////////////////////////// -/// OpenGL Mathematics (glm.g-truc.net) -/// -/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) -/// Permission is hereby granted, free of charge, to any person obtaining a copy -/// of this software and associated documentation files (the "Software"), to deal -/// in the Software without restriction, including without limitation the rights -/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -/// copies of the Software, and to permit persons to whom the Software is -/// furnished to do so, subject to the following conditions: -/// -/// The above copyright notice and this permission notice shall be included in -/// all copies or substantial portions of the Software. -/// -/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -/// THE SOFTWARE. -/// -/// @ref test -/// @file test/gtc/half_float.cpp -/// @date 2011-05-32 / 2012-04-07 -/// @author Christophe Riccio -/////////////////////////////////////////////////////////////////////////////////// - - -#include -#include -#include - -int test_half_precision_scalar() -{ - int Error = 0; - - Error += sizeof(glm::half) == 2 ? 0 : 1; - - return Error; -} - -int test_half_precision_vec() -{ - int Error = 0; - - Error += sizeof(glm::hvec2) == 4 ? 0 : 1; - Error += sizeof(glm::hvec3) == 6 ? 0 : 1; - Error += sizeof(glm::hvec4) == 8 ? 0 : 1; - - return Error; -} - -int test_half_precision_mat() -{ - int Error = 0; - - Error += sizeof(glm::hmat2) == 8 ? 0 : 1; - Error += sizeof(glm::hmat3) == 18 ? 0 : 1; - Error += sizeof(glm::hmat4) == 32 ? 0 : 1; - - Error += sizeof(glm::hmat2x2) == 8 ? 0 : 1; - Error += sizeof(glm::hmat2x3) == 12 ? 0 : 1; - Error += sizeof(glm::hmat2x4) == 16 ? 0 : 1; - Error += sizeof(glm::hmat3x2) == 12 ? 0 : 1; - Error += sizeof(glm::hmat3x3) == 18 ? 0 : 1; - Error += sizeof(glm::hmat3x4) == 24 ? 0 : 1; - Error += sizeof(glm::hmat4x2) == 16 ? 0 : 1; - Error += sizeof(glm::hmat4x3) == 24 ? 0 : 1; - Error += sizeof(glm::hmat4x4) == 32 ? 0 : 1; - - return Error; -} - -int test_half_ctor_mat2x2() -{ - int Error = 0; - - { - glm::hvec2 A(1, 2); - glm::hvec2 B(3, 4); - glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f); - glm::hmat2 D(1, 2, 3, 4); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hvec2 A(1, 2.0); - glm::hvec2 B(3, 4.0); - glm::hmat2 C(A, B);//, 2.0f, 3.0f, 4.0f); - glm::hmat2 D(1, 2.0, 3u, 4.0f); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hmat2 A(1); - glm::mat2 B(1); - glm::hmat2 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat2x3() -{ - int Error = 0; - - { - glm::hvec3 A(1, 2, 3); - glm::hvec3 B(4, 5, 6); - glm::hmat2x3 C(A, B); - glm::hmat2x3 D(1, 2, 3, 4, 5, 6); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hvec3 A(1.0, 2.0f, 3u); - glm::hvec3 B(4, 5u, 6u); - glm::hmat2x3 C(A, B); - glm::hmat2x3 D(1, 2.0, 3u, 4.0f, 5.0, 6); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hmat2x3 A(1); - glm::mat2x3 B(1); - glm::hmat2x3 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat2x4() -{ - int Error = 0; - - { - glm::hvec4 A(1, 2, 3, 4); - glm::hvec4 B(5, 6, 7, 8); - glm::hmat2x4 C(A, B); - glm::hmat2x4 D(1, 2, 3, 4, 5, 6, 7, 8); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hvec4 A(1.0, 2.0f, 3u, 4u); - glm::hvec4 B(5u, 6u, 7.0, 8.0); - glm::hmat2x4 C(A, B); - glm::hmat2x4 D(1, 2.0, 3u, 4.0f, 5.0, 6, 7.0f, 8.0f); - - Error += C[0] == D[0] ? 0 : 1; - Error += C[1] == D[1] ? 0 : 1; - } - - { - glm::hmat2x4 A(1); - glm::mat2x4 B(1); - glm::hmat2x4 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat3x2() -{ - int Error = 0; - - { - glm::hvec2 A(1, 2); - glm::hvec2 B(3, 4); - glm::hvec2 C(5, 6); - glm::hmat3x2 M(A, B, C); - glm::hmat3x2 N(1, 2, 3, 4, 5, 6); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec2 A(1, 2.0); - glm::hvec2 B(3, 4.0f); - glm::hvec2 C(5u, 6.0f); - glm::hmat3x2 M(A, B, C); - glm::hmat3x2 N(1, 2.0, 3u, 4.0f, 5, 6); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat3x2 A(1); - glm::mat3x2 B(1); - glm::hmat3x2 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat3x3() -{ - int Error = 0; - - { - glm::hvec3 A(1, 2, 3); - glm::hvec3 B(4, 5, 6); - glm::hvec3 C(7, 8, 9); - glm::hmat3x3 M(A, B, C); - glm::hmat3x3 N(1, 2, 3, 4, 5, 6, 7, 8, 9); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec3 A(1, 2.0, 3.0f); - glm::hvec3 B(4, 5.0f, 6.0); - glm::hvec3 C(7u, 8.0f, 9); - glm::hmat3x3 M(A, B, C); - glm::hmat3x3 N(1, 2.0, 3u, 4.0f, 5, 6, 7.0f, 8.0, 9u); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat3x3 A(1); - glm::mat3x3 B(1); - glm::hmat3x3 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat3x4() -{ - int Error = 0; - - { - glm::hvec4 A(1, 2, 3, 4); - glm::hvec4 B(5, 6, 7, 8); - glm::hvec4 C(9, 10, 11, 12); - glm::hmat3x4 M(A, B, C); - glm::hmat3x4 N(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec4 A(1, 2.0, 3.0f, 4u); - glm::hvec4 B(5, 6.0f, 7.0, 8); - glm::hvec4 C(9u, 10.0f, 11, 12.f); - glm::hmat3x4 M(A, B, C); - glm::hmat3x4 N(1, 2.0, 3u, 4.0f, 5, 6, 7.0f, 8.0, 9u, 10, 11.f, 12.0); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat3x4 A(1); - glm::mat3x4 B(1); - glm::hmat3x4 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat4x2() -{ - int Error = 0; - - { - glm::hvec2 A(1, 2); - glm::hvec2 B(3, 4); - glm::hvec2 C(5, 6); - glm::hvec2 D(7, 8); - glm::hmat4x2 M(A, B, C, D); - glm::hmat4x2 N(1, 2, 3, 4, 5, 6, 7, 8); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec2 A(1, 2.0); - glm::hvec2 B(3.0f, 4); - glm::hvec2 C(5.0, 6u); - glm::hvec2 D(7, 8u); - glm::hmat4x2 M(A, B, C, D); - glm::hmat4x2 N(1, 2.0, 3u, 4.0f, 5u, 6.0, 7, 8.0f); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat4x2 A(1); - glm::mat4x2 B(1); - glm::hmat4x2 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat4x3() -{ - int Error = 0; - - { - glm::hvec3 A(1, 2, 3); - glm::hvec3 B(4, 5, 6); - glm::hvec3 C(7, 8, 9); - glm::hvec3 D(10, 11, 12); - glm::hmat4x3 M(A, B, C, D); - glm::hmat4x3 N(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec3 A(1, 2.0, 3u); - glm::hvec3 B(4.0f, 5, 6u); - glm::hvec3 C(7.0, 8u, 9.f); - glm::hvec3 D(10, 11u, 12.0); - glm::hmat4x3 M(A, B, C, D); - glm::hmat4x3 N(1, 2.0, 3u, 4.0f, 5u, 6.0, 7, 8.0f, 9, 10u, 11.f, 12.0); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat4x3 A(1); - glm::mat4x3 B(1); - glm::hmat4x3 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_mat4x4() -{ - int Error = 0; - - { - glm::hvec4 A(1, 2, 3, 4); - glm::hvec4 B(5, 6, 7, 8); - glm::hvec4 C(9, 10, 11, 12); - glm::hvec4 D(13, 14, 15, 16); - glm::hmat4x4 M(A, B, C, D); - glm::hmat4x4 N(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16); - - Error += M == N ? 0 : 1; - } - - { - glm::hvec4 A(1, 2.0, 3u, 4); - glm::hvec4 B(5.0f, 6, 7u, 8.0); - glm::hvec4 C(9.0, 10u, 11.f, 12); - glm::hvec4 D(13, 14u, 15.0, 16u); - glm::hmat4x4 M(A, B, C, D); - glm::hmat4x4 N(1, 2.0, 3u, 4.0f, 5u, 6.0, 7, 8.0f, 9, 10u, 11.f, 12.0, 13, 14u, 15.0f, 16.0); - - Error += M == N ? 0 : 1; - } - - { - glm::hmat4x4 A(1); - glm::mat4x4 B(1); - glm::hmat4x4 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_vec2() -{ - int Error = 0; - - { - glm::hvec2 A; - A.x = glm::half(1); - A.y = glm::half(2); - //glm::hvec2 A(1, 2); - glm::hvec2 B(A); - glm::vec2 C(1, 2); - glm::hvec2 D(C); - glm::dvec2 E(1, 2); - glm::hvec2 F(E); - glm::hvec2 G(1, 2.0); - glm::hvec2 H; - H = A; - - Error += A == B ? 0 : 1; - //Error += C == D ? 0 : 1; //Error - //Error += E == F ? 0 : 1; //Error - Error += A == G ? 0 : 1; - Error += A == H ? 0 : 1; - } - - { - glm::hvec2 A(1); - glm::vec2 B(1); - glm::hvec2 C(A); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_vec3() -{ - int Error = 0; - - { - glm::hvec3 A(1, 2, 3); - glm::hvec3 B(A); - glm::vec3 C(1, 2, 3); - glm::hvec3 D(C); - glm::dvec3 E(1, 2, 3); - glm::hvec3 F(E); - glm::hvec3 G(1, 2.0, 3); - glm::hvec3 H; - H = A; - - Error += A == B ? 0 : 1; - //Error += C == D ? 0 : 1; - //Error += E == F ? 0 : 1; - Error += A == G ? 0 : 1; - Error += A == H ? 0 : 1; - } - - { - glm::hvec3 A(1); - glm::vec3 B(1); - glm::hvec3 C(B); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_half_ctor_vec4() -{ - int Error = 0; - - { - glm::hvec4 A(1, 2, 3, 4); - glm::hvec4 B(A); - glm::vec4 C(1, 2, 3, 4); - glm::hvec4 D(C); - glm::dvec4 E(1, 2, 3, 4); - glm::hvec4 F(E); - glm::hvec4 G(1, 2.0, 3, 4); - glm::hvec4 H; - H = A; - - Error += A == B ? 0 : 1; - //Error += C == D ? 0 : 1; - //Error += E == F ? 0 : 1; - Error += A == G ? 0 : 1; - Error += A == H ? 0 : 1; - } - - { - glm::hvec4 A(1); - glm::vec4 B(1); - glm::hvec4 C(B); - - Error += A == C ? 0 : 1; - } - - return Error; -} - -int test_hvec2_size() -{ - int Error = 0; - - Error += sizeof(glm::hvec2) <= sizeof(glm::lowp_vec2) ? 0 : 1; - Error += 4 == sizeof(glm::hvec2) ? 0 : 1; - Error += glm::hvec2().length() == 2 ? 0 : 1; - - return Error; -} - -int test_hvec3_size() -{ - int Error = 0; - - Error += sizeof(glm::hvec3) <= sizeof(glm::lowp_vec3) ? 0 : 1; - Error += 6 <= sizeof(glm::hvec3) ? 0 : 1; - Error += glm::hvec3().length() == 3 ? 0 : 1; - - return Error; -} - -int test_hvec4_size() -{ - int Error = 0; - - Error += sizeof(glm::hvec4) <= sizeof(glm::lowp_vec4) ? 0 : 1; - Error += 8 <= sizeof(glm::hvec4) ? 0 : 1; - Error += glm::hvec4().length() == 4 ? 0 : 1; - - return Error; -} - -static int test_hvec_precision() -{ - int Error = 0; - - Error += sizeof(glm::hvec2) == sizeof(glm::highp_hvec2) ? 0 : 1; - Error += sizeof(glm::hvec3) == sizeof(glm::highp_hvec3) ? 0 : 1; - Error += sizeof(glm::hvec4) == sizeof(glm::highp_hvec4) ? 0 : 1; - - return Error; -} - -static int test_hmat_precision() -{ - int Error = 0; - - Error += sizeof(glm::hmat2) == sizeof(glm::lowp_hmat2) ? 0 : 1; - Error += sizeof(glm::hmat3) == sizeof(glm::lowp_hmat3) ? 0 : 1; - Error += sizeof(glm::hmat4) == sizeof(glm::lowp_hmat4) ? 0 : 1; - Error += sizeof(glm::hmat2) == sizeof(glm::mediump_hmat2) ? 0 : 1; - Error += sizeof(glm::hmat3) == sizeof(glm::mediump_hmat3) ? 0 : 1; - Error += sizeof(glm::hmat4) == sizeof(glm::mediump_hmat4) ? 0 : 1; - Error += sizeof(glm::hmat2) == sizeof(glm::highp_hmat2) ? 0 : 1; - Error += sizeof(glm::hmat3) == sizeof(glm::highp_hmat3) ? 0 : 1; - Error += sizeof(glm::hmat4) == sizeof(glm::highp_hmat4) ? 0 : 1; - - Error += sizeof(glm::hmat2x2) == sizeof(glm::lowp_hmat2x2) ? 0 : 1; - Error += sizeof(glm::hmat3x2) == sizeof(glm::lowp_hmat3x2) ? 0 : 1; - Error += sizeof(glm::hmat4x2) == sizeof(glm::lowp_hmat4x2) ? 0 : 1; - Error += sizeof(glm::hmat2x2) == sizeof(glm::mediump_hmat2x2) ? 0 : 1; - Error += sizeof(glm::hmat3x2) == sizeof(glm::mediump_hmat3x2) ? 0 : 1; - Error += sizeof(glm::hmat4x2) == sizeof(glm::mediump_hmat4x2) ? 0 : 1; - Error += sizeof(glm::hmat2x2) == sizeof(glm::highp_hmat2x2) ? 0 : 1; - Error += sizeof(glm::hmat3x2) == sizeof(glm::highp_hmat3x2) ? 0 : 1; - Error += sizeof(glm::hmat4x2) == sizeof(glm::highp_hmat4x2) ? 0 : 1; - - Error += sizeof(glm::hmat2x3) == sizeof(glm::lowp_hmat2x3) ? 0 : 1; - Error += sizeof(glm::hmat3x3) == sizeof(glm::lowp_hmat3x3) ? 0 : 1; - Error += sizeof(glm::hmat4x3) == sizeof(glm::lowp_hmat4x3) ? 0 : 1; - Error += sizeof(glm::hmat2x3) == sizeof(glm::mediump_hmat2x3) ? 0 : 1; - Error += sizeof(glm::hmat3x3) == sizeof(glm::mediump_hmat3x3) ? 0 : 1; - Error += sizeof(glm::hmat4x3) == sizeof(glm::mediump_hmat4x3) ? 0 : 1; - Error += sizeof(glm::hmat2x3) == sizeof(glm::highp_hmat2x3) ? 0 : 1; - Error += sizeof(glm::hmat3x3) == sizeof(glm::highp_hmat3x3) ? 0 : 1; - Error += sizeof(glm::hmat4x3) == sizeof(glm::highp_hmat4x3) ? 0 : 1; - - Error += sizeof(glm::hmat2x4) == sizeof(glm::lowp_hmat2x4) ? 0 : 1; - Error += sizeof(glm::hmat3x4) == sizeof(glm::lowp_hmat3x4) ? 0 : 1; - Error += sizeof(glm::hmat4x4) == sizeof(glm::lowp_hmat4x4) ? 0 : 1; - Error += sizeof(glm::hmat2x4) == sizeof(glm::mediump_hmat2x4) ? 0 : 1; - Error += sizeof(glm::hmat3x4) == sizeof(glm::mediump_hmat3x4) ? 0 : 1; - Error += sizeof(glm::hmat4x4) == sizeof(glm::mediump_hmat4x4) ? 0 : 1; - Error += sizeof(glm::hmat2x4) == sizeof(glm::highp_hmat2x4) ? 0 : 1; - Error += sizeof(glm::hmat3x4) == sizeof(glm::highp_hmat3x4) ? 0 : 1; - Error += sizeof(glm::hmat4x4) == sizeof(glm::highp_hmat4x4) ? 0 : 1; - - return Error; -} - - -namespace detail -{ - glm::uint16 float2half(glm::uint32 const & f) - { - // 10 bits => EE EEEFFFFF - // 11 bits => EEE EEFFFFFF - // Half bits => SEEEEEFF FFFFFFFF - // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF - - // 0x00007c00 => 00000000 00000000 01111100 00000000 - // 0x000003ff => 00000000 00000000 00000011 11111111 - // 0x38000000 => 00111000 00000000 00000000 00000000 - // 0x7f800000 => 01111111 10000000 00000000 00000000 - // 0x00008000 => 00000000 00000000 10000000 00000000 - return - ((f >> 16) & 0x8000) | // sign - ((((f & 0x7f800000) - 0x38000000) >> 13) & 0x7c00) | // exponential - ((f >> 13) & 0x03ff); // Mantissa - } - - glm::uint16 float2packed11(glm::uint32 const & f) - { - // 10 bits => EE EEEFFFFF - // 11 bits => EEE EEFFFFFF - // Half bits => SEEEEEFF FFFFFFFF - // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF - - // 0x000007c0 => 00000000 00000000 00000111 11000000 - // 0x00007c00 => 00000000 00000000 01111100 00000000 - // 0x000003ff => 00000000 00000000 00000011 11111111 - // 0x38000000 => 00111000 00000000 00000000 00000000 - // 0x7f800000 => 01111111 10000000 00000000 00000000 - // 0x00008000 => 00000000 00000000 10000000 00000000 - return - ((((f & 0x7f800000) - 0x38000000) >> 17) & 0x07c0) | // exponential - ((f >> 17) & 0x003f); // Mantissa - } - - glm::uint float2packed10(glm::uint const & f) - { - // 10 bits => EE EEEFFFFF - // 11 bits => EEE EEFFFFFF - // Half bits => SEEEEEFF FFFFFFFF - // Float bits => SEEEEEEE EFFFFFFF FFFFFFFF FFFFFFFF - - // 0x0000001F => 00000000 00000000 00000000 00011111 - // 0x0000003F => 00000000 00000000 00000000 00111111 - // 0x000003E0 => 00000000 00000000 00000011 11100000 - // 0x000007C0 => 00000000 00000000 00000111 11000000 - // 0x00007C00 => 00000000 00000000 01111100 00000000 - // 0x000003FF => 00000000 00000000 00000011 11111111 - // 0x38000000 => 00111000 00000000 00000000 00000000 - // 0x7f800000 => 01111111 10000000 00000000 00000000 - // 0x00008000 => 00000000 00000000 10000000 00000000 - return - ((((f & 0x7f800000) - 0x38000000) >> 18) & 0x03E0) | // exponential - ((f >> 18) & 0x001f); // Mantissa - } - - glm::uint half2float(glm::uint const & h) - { - return ((h & 0x8000) << 16) | ((( h & 0x7c00) + 0x1C000) << 13) | ((h & 0x03FF) << 13); - } - - union uif - { - glm::uint i; - float f; - }; - - glm::uint floatTo11bit(float x) - { - if(x == 0.0f) - return 0; - else if(glm::isnan(x)) - return ~0; - else if(glm::isinf(x)) - return 0x1f << 6; - - uif Union; - Union.f = x; - return float2packed11(Union.i); - } - - glm::uint floatTo10bit(float x) - { - if(x == 0.0f) - return 0; - else if(glm::isnan(x)) - return ~0; - else if(glm::isinf(x)) - return 0x1f << 5; - - uif Union; - Union.f = x; - return float2packed10(Union.i); - } - - glm::uint f11_f11_f10(float x, float y, float z) - { - return ((floatTo11bit(x) & ((1 << 11) - 1)) << 0) | ((floatTo11bit(y) & ((1 << 11) - 1)) << 11) | ((floatTo10bit(z) & ((1 << 10) - 1)) << 22); - } -}//namespace detail - -class f11f11f10 -{ -public: - f11f11f10(float x, float y, float z) : - x(detail::floatTo11bit(x)), - y(detail::floatTo11bit(y)), - z(detail::floatTo10bit(z)) - {} - /* - operator glm::vec3() - { - return glm::vec3( - float(x) / 511.0f, - float(y) / 511.0f, - float(z) / 511.0f); - } - */ -private: - int x : 11; - int y : 11; - int z : 10; -}; - -void print_bits(glm::half const & s) -{ - union - { - glm::detail::hdata h; - unsigned short i; - } uif; - - uif.h = s._data(); - - printf("f16: "); - for(std::size_t j = sizeof(s) * 8; j > 0; --j) - { - if(j == 10 || j == 15) - printf(" "); - printf("%d", (uif.i & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_bits(float const & s) -{ - union - { - float f; - unsigned int i; - } uif; - - uif.f = s; - - printf("f32: "); - for(std::size_t j = sizeof(s) * 8; j > 0; --j) - { - if(j == 23 || j == 31) - printf(" "); - printf("%d", (uif.i & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_10bits(glm::uint const & s) -{ - printf("10b: "); - for(std::size_t j = 10; j > 0; --j) - { - if(j == 5) - printf(" "); - printf("%d", (s & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_11bits(glm::uint const & s) -{ - printf("11b: "); - for(std::size_t j = 11; j > 0; --j) - { - if(j == 6) - printf(" "); - printf("%d", (s & (1 << (j - 1))) ? 1 : 0); - } -} - -void print_value(float const & s) -{ - printf("%2.5f, ", s); - print_bits(s); - printf(", "); - print_bits(glm::half(s)); - printf(", "); - print_11bits(detail::floatTo11bit(s)); - printf(", "); - print_10bits(detail::floatTo10bit(s)); - printf("\n"); -} - -int test_half() -{ - int Error = 0; - - print_value(0.0f); - print_value(0.1f); - print_value(0.2f); - print_value(0.3f); - print_value(0.4f); - print_value(0.5f); - print_value(0.6f); - print_value(1.0f); - print_value(1.1f); - print_value(1.2f); - print_value(1.3f); - print_value(1.4f); - print_value(1.5f); - print_value(1.6f); - print_value(2.0f); - print_value(2.1f); - print_value(2.2f); - print_value(2.3f); - print_value(2.4f); - print_value(2.5f); - print_value(2.6f); - - return Error; -} - -int main() -{ - int Error = 0; - - Error += test_half(); - Error += test_hvec_precision(); - Error += test_hvec2_size(); - Error += test_hvec3_size(); - Error += test_hvec4_size(); - Error += test_half_ctor_vec2(); - Error += test_half_ctor_vec3(); - Error += test_half_ctor_vec4(); - Error += test_half_ctor_mat2x2(); - Error += test_half_ctor_mat2x3(); - Error += test_half_ctor_mat2x4(); - Error += test_half_ctor_mat3x2(); - Error += test_half_ctor_mat3x3(); - Error += test_half_ctor_mat3x4(); - Error += test_half_ctor_mat4x2(); - Error += test_half_ctor_mat4x3(); - Error += test_half_ctor_mat4x4(); - Error += test_half_precision_scalar(); - Error += test_half_precision_vec(); - Error += test_half_precision_mat(); - - return Error; -} diff --git a/test/gtc/gtc_quaternion.cpp b/test/gtc/gtc_quaternion.cpp index 9a57f542..e3528679 100644 --- a/test/gtc/gtc_quaternion.cpp +++ b/test/gtc/gtc_quaternion.cpp @@ -133,14 +133,6 @@ int test_quat_euler() glm::dvec3 Angles = glm::eulerAngles(q); } - { - glm::hquat q(glm::half(1.0f), glm::half(0.0f), glm::half(0.0f), glm::half(1.0f)); - glm::half Roll = glm::roll(q); - glm::half Pitch = glm::pitch(q); - glm::half Yaw = glm::yaw(q); - glm::hvec3 Angles = glm::eulerAngles(q); - } - return Error; } diff --git a/test/gtc/gtc_type_precision.cpp b/test/gtc/gtc_type_precision.cpp index d27ee5a6..8d1f8411 100644 --- a/test/gtc/gtc_type_precision.cpp +++ b/test/gtc/gtc_type_precision.cpp @@ -22,7 +22,6 @@ static int test_scalar_size() Error += sizeof(glm::uint16) != 2; Error += sizeof(glm::uint32) != 4; Error += sizeof(glm::uint64) != 8; - Error += sizeof(glm::float16) != 2; Error += sizeof(glm::float32) != 4; Error += sizeof(glm::float64) != 8; @@ -34,7 +33,6 @@ static int test_scalar_size() Error += sizeof(glm::lowp_uint16) != 2; Error += sizeof(glm::lowp_uint32) != 4; Error += sizeof(glm::lowp_uint64) != 8; - Error += sizeof(glm::lowp_float16) != 2; Error += sizeof(glm::lowp_float32) != 4; Error += sizeof(glm::lowp_float64) != 8; @@ -46,7 +44,6 @@ static int test_scalar_size() Error += sizeof(glm::mediump_uint16) != 2; Error += sizeof(glm::mediump_uint32) != 4; Error += sizeof(glm::mediump_uint64) != 8; - Error += sizeof(glm::mediump_float16) != 2; Error += sizeof(glm::mediump_float32) != 4; Error += sizeof(glm::mediump_float64) != 8; @@ -58,7 +55,6 @@ static int test_scalar_size() Error += sizeof(glm::highp_uint16) != 2; Error += sizeof(glm::highp_uint32) != 4; Error += sizeof(glm::highp_uint64) != 8; - Error += sizeof(glm::highp_float16) != 2; Error += sizeof(glm::highp_float32) != 4; Error += sizeof(glm::highp_float64) != 8; return Error; @@ -67,9 +63,6 @@ static int test_scalar_size() static int test_fvec_size() { int Error(0); - Error += sizeof(glm::f16vec2) != 4; - Error += sizeof(glm::f16vec3) != 6; - Error += sizeof(glm::f16vec4) != 8; Error += sizeof(glm::f32vec2) != 8; Error += sizeof(glm::f32vec3) != 12; Error += sizeof(glm::f32vec4) != 16; @@ -77,9 +70,6 @@ static int test_fvec_size() Error += sizeof(glm::f64vec3) != 24; Error += sizeof(glm::f64vec4) != 32; - Error += sizeof(glm::lowp_f16vec2) != 4; - Error += sizeof(glm::lowp_f16vec3) != 6; - Error += sizeof(glm::lowp_f16vec4) != 8; Error += sizeof(glm::lowp_f32vec2) != 8; Error += sizeof(glm::lowp_f32vec3) != 12; Error += sizeof(glm::lowp_f32vec4) != 16; @@ -87,9 +77,6 @@ static int test_fvec_size() Error += sizeof(glm::lowp_f64vec3) != 24; Error += sizeof(glm::lowp_f64vec4) != 32; - Error += sizeof(glm::mediump_f16vec2) != 4; - Error += sizeof(glm::mediump_f16vec3) != 6; - Error += sizeof(glm::mediump_f16vec4) != 8; Error += sizeof(glm::mediump_f32vec2) != 8; Error += sizeof(glm::mediump_f32vec3) != 12; Error += sizeof(glm::mediump_f32vec4) != 16; @@ -97,9 +84,6 @@ static int test_fvec_size() Error += sizeof(glm::mediump_f64vec3) != 24; Error += sizeof(glm::mediump_f64vec4) != 32; - Error += sizeof(glm::highp_f16vec2) != 4; - Error += sizeof(glm::highp_f16vec3) != 6; - Error += sizeof(glm::highp_f16vec4) != 8; Error += sizeof(glm::highp_f32vec2) != 8; Error += sizeof(glm::highp_f32vec3) != 12; Error += sizeof(glm::highp_f32vec4) != 16; @@ -109,46 +93,6 @@ static int test_fvec_size() return Error; } -static int test_hvec_precision() -{ - int Error(0); - - { - glm::f16vec2 v1; - glm::lowp_f16vec2 v2(v1); - glm::mediump_f16vec2 v3(v1); - glm::highp_f16vec2 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f16vec2(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec2(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec2(v4))) ? 0 : 1; - } - - { - glm::f16vec3 v1; - glm::lowp_f16vec3 v2(v1); - glm::mediump_f16vec3 v3(v1); - glm::highp_f16vec3 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f16vec3(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec3(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec3(v4))) ? 0 : 1; - } - - { - glm::f16vec4 v1; - glm::lowp_f16vec4 v2(v1); - glm::mediump_f16vec4 v3(v1); - glm::highp_f16vec4 v4(v1); - - Error += glm::all(glm::equal(v1, glm::f16vec4(v2))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec4(v3))) ? 0 : 1; - Error += glm::all(glm::equal(v1, glm::f16vec4(v4))) ? 0 : 1; - } - - return Error; -} - static int test_fvec_precision() { int Error(0); @@ -632,63 +576,6 @@ static int test_uvec_precision() return Error; } -static int test_hmat_size() -{ - int Error(0); - Error += sizeof(glm::f16mat2) != 8; - Error += sizeof(glm::f16mat3) != 18; - Error += sizeof(glm::f16mat4) != 32; - Error += sizeof(glm::f16mat2x2) != 8; - Error += sizeof(glm::f16mat2x3) != 12; - Error += sizeof(glm::f16mat2x4) != 16; - Error += sizeof(glm::f16mat3x2) != 12; - Error += sizeof(glm::f16mat3x3) != 18; - Error += sizeof(glm::f16mat3x4) != 24; - Error += sizeof(glm::f16mat4x2) != 16; - Error += sizeof(glm::f16mat4x3) != 24; - Error += sizeof(glm::f16mat4x4) != 32; - - Error += sizeof(glm::lowp_f16mat2) != 8; - Error += sizeof(glm::lowp_f16mat3) != 18; - Error += sizeof(glm::lowp_f16mat4) != 32; - Error += sizeof(glm::lowp_f16mat2x2) != 8; - Error += sizeof(glm::lowp_f16mat2x3) != 12; - Error += sizeof(glm::lowp_f16mat2x4) != 16; - Error += sizeof(glm::lowp_f16mat3x2) != 12; - Error += sizeof(glm::lowp_f16mat3x3) != 18; - Error += sizeof(glm::lowp_f16mat3x4) != 24; - Error += sizeof(glm::lowp_f16mat4x2) != 16; - Error += sizeof(glm::lowp_f16mat4x3) != 24; - Error += sizeof(glm::lowp_f16mat4x4) != 32; - - Error += sizeof(glm::mediump_f16mat2) != 8; - Error += sizeof(glm::mediump_f16mat3) != 18; - Error += sizeof(glm::mediump_f16mat4) != 32; - Error += sizeof(glm::mediump_f16mat2x2) != 8; - Error += sizeof(glm::mediump_f16mat2x3) != 12; - Error += sizeof(glm::mediump_f16mat2x4) != 16; - Error += sizeof(glm::mediump_f16mat3x2) != 12; - Error += sizeof(glm::mediump_f16mat3x3) != 18; - Error += sizeof(glm::mediump_f16mat3x4) != 24; - Error += sizeof(glm::mediump_f16mat4x2) != 16; - Error += sizeof(glm::mediump_f16mat4x3) != 24; - Error += sizeof(glm::mediump_f16mat4x4) != 32; - - Error += sizeof(glm::highp_f16mat2) != 8; - Error += sizeof(glm::highp_f16mat3) != 18; - Error += sizeof(glm::highp_f16mat4) != 32; - Error += sizeof(glm::highp_f16mat2x2) != 8; - Error += sizeof(glm::highp_f16mat2x3) != 12; - Error += sizeof(glm::highp_f16mat2x4) != 16; - Error += sizeof(glm::highp_f16mat3x2) != 12; - Error += sizeof(glm::highp_f16mat3x3) != 18; - Error += sizeof(glm::highp_f16mat3x4) != 24; - Error += sizeof(glm::highp_f16mat4x2) != 16; - Error += sizeof(glm::highp_f16mat4x3) != 24; - Error += sizeof(glm::highp_f16mat4x4) != 32; - return Error; -} - static int test_fmat_size() { int Error(0); @@ -914,19 +801,15 @@ static int test_dmat_size() static int test_quat_size() { int Error = 0; - Error += sizeof(glm::f16quat) != 8; Error += sizeof(glm::f32quat) != 16; Error += sizeof(glm::f64quat) != 32; - Error += sizeof(glm::lowp_f16quat) != 8; Error += sizeof(glm::lowp_f32quat) != 16; Error += sizeof(glm::lowp_f64quat) != 32; - Error += sizeof(glm::mediump_f16quat) != 8; Error += sizeof(glm::mediump_f32quat) != 16; Error += sizeof(glm::mediump_f64quat) != 32; - Error += sizeof(glm::highp_f16quat) != 8; Error += sizeof(glm::highp_f32quat) != 16; Error += sizeof(glm::highp_f64quat) != 32; return Error; @@ -958,14 +841,12 @@ int main() int Error(0); Error += test_scalar_size(); Error += test_fvec_size(); - Error += test_hvec_precision(); Error += test_fvec_precision(); Error += test_dvec_precision(); Error += test_ivec_size(); Error += test_ivec_precision(); Error += test_uvec_size(); Error += test_uvec_precision(); - Error += test_hmat_size(); Error += test_fmat_size(); Error += test_dmat_size(); Error += test_quat_size(); diff --git a/test/gtc/gtc_type_ptr.cpp b/test/gtc/gtc_type_ptr.cpp index 932fbcfb..acc4bfc1 100644 --- a/test/gtc/gtc_type_ptr.cpp +++ b/test/gtc/gtc_type_ptr.cpp @@ -13,22 +13,6 @@ int test_value_ptr_vec() { int Error = 0; - - { - glm::hvec2 v(1.0); - glm::half * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::hvec3 v(1.0); - glm::half * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::hvec4 v(1.0); - glm::half * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } { glm::vec2 v(1.0); @@ -69,22 +53,6 @@ int test_value_ptr_vec_const() { int Error = 0; - { - glm::hvec2 const v(1.0); - glm::half const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::hvec3 const v(1.0); - glm::half const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { - glm::hvec4 const v(1.0); - glm::half const * p = glm::value_ptr(v); - Error += p == &v[0] ? 0 : 1; - } - { glm::vec2 const v(1.0); float const * p = glm::value_ptr(v); diff --git a/test/gtx/gtx_string_cast.cpp b/test/gtx/gtx_string_cast.cpp index 2519da15..b7880bd6 100644 --- a/test/gtx/gtx_string_cast.cpp +++ b/test/gtx/gtx_string_cast.cpp @@ -15,10 +15,6 @@ int test_string_cast_scalar() { int Error = 0; - - glm::half A1(1.0); - std::string A2 = glm::to_string(A1); - Error += A2 != std::string("half(1.0000)") ? 1 : 0; float B1(1.0); std::string B2 = glm::to_string(B1); @@ -59,18 +55,6 @@ int test_string_cast_vector() std::string F2 = glm::to_string(F1); Error += F2 != std::string("ivec4(1, 2, 3, 4)") ? 1 : 0; - glm::hvec2 G1(1, 2); - std::string G2 = glm::to_string(G1); - Error += G2 != std::string("hvec2(1.0000, 2.0000)") ? 1 : 0; - - glm::hvec3 H1(1, 2, 3); - std::string H2 = glm::to_string(H1); - Error += H2 != std::string("hvec3(1.0000, 2.0000, 3.0000)") ? 1 : 0; - - glm::hvec4 I1(1, 2, 3, 4); - std::string I2 = glm::to_string(I1); - Error += I2 != std::string("hvec4(1.0000, 2.0000, 3.0000, 4.0000)") ? 1 : 0; - glm::dvec2 J1(1, 2); std::string J2 = glm::to_string(J1); Error += J2 != std::string("dvec2(1.000000, 2.000000)") ? 1 : 0;