Fixed half precision implementation

This commit is contained in:
Christophe Riccio 2013-04-15 11:04:24 +02:00
parent c14e2d7fbc
commit 296e3d7007
14 changed files with 778 additions and 502 deletions

View File

@ -121,14 +121,15 @@ namespace detail
/// 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 mediump_half half_t;
#elif(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_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

View File

@ -370,16 +370,16 @@ namespace detail
//////////////////////////
// Float definition
#if(defined(GLM_PRECISION_HIGHP_FLOAT))
typedef highp_mat2x2 mat2x2;
typedef highp_mat2x3 mat2x3;
typedef highp_mat2x4 mat2x4;
typedef highp_mat3x2 mat3x2;
typedef highp_mat3x3 mat3x3;
typedef highp_mat3x4 mat3x4;
typedef highp_mat4x2 mat4x2;
typedef highp_mat4x3 mat4x3;
typedef highp_mat4x4 mat4x4;
#if(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_mat2x2 mat2x2;
typedef lowp_mat2x3 mat2x3;
typedef lowp_mat2x4 mat2x4;
typedef lowp_mat3x2 mat3x2;
typedef lowp_mat3x3 mat3x3;
typedef lowp_mat3x4 mat3x4;
typedef lowp_mat4x2 mat4x2;
typedef lowp_mat4x3 mat4x3;
typedef lowp_mat4x4 mat4x4;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef mediump_mat2x2 mat2x2;
typedef mediump_mat2x3 mat2x3;
@ -390,61 +390,51 @@ namespace detail
typedef mediump_mat4x2 mat4x2;
typedef mediump_mat4x3 mat4x3;
typedef mediump_mat4x4 mat4x4;
#elif(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_mat2x2 mat2x2;
typedef lowp_mat2x3 mat2x3;
typedef lowp_mat2x4 mat2x4;
typedef lowp_mat3x2 mat3x2;
typedef lowp_mat3x3 mat3x3;
typedef lowp_mat3x4 mat3x4;
typedef lowp_mat4x2 mat4x2;
typedef lowp_mat4x3 mat4x3;
typedef lowp_mat4x4 mat4x4;
#else
//! 2 columns of 2 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat2x2 mat2x2;
typedef highp_mat2x2 mat2x2;
//! 2 columns of 3 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat2x3 mat2x3;
typedef highp_mat2x3 mat2x3;
//! 2 columns of 4 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat2x4 mat2x4;
typedef highp_mat2x4 mat2x4;
//! 3 columns of 2 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat3x2 mat3x2;
typedef highp_mat3x2 mat3x2;
//! 3 columns of 3 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat3x3 mat3x3;
typedef highp_mat3x3 mat3x3;
//! 3 columns of 4 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat3x4 mat3x4;
typedef highp_mat3x4 mat3x4;
//! 4 columns of 2 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat4x2 mat4x2;
typedef highp_mat4x2 mat4x2;
//! 4 columns of 3 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat4x3 mat4x3;
typedef highp_mat4x3 mat4x3;
//! 4 columns of 4 components matrix of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_mat4x4 mat4x4;
typedef highp_mat4x4 mat4x4;
#endif//GLM_PRECISION
@ -727,16 +717,16 @@ namespace detail
/// @}
#if(defined(GLM_PRECISION_HIGHP_DOUBLE))
typedef highp_dmat2x2 dmat2x2;
typedef highp_dmat2x3 dmat2x3;
typedef highp_dmat2x4 dmat2x4;
typedef highp_dmat3x2 dmat3x2;
typedef highp_dmat3x3 dmat3x3;
typedef highp_dmat3x4 dmat3x4;
typedef highp_dmat4x2 dmat4x2;
typedef highp_dmat4x3 dmat4x3;
typedef highp_dmat4x4 dmat4x4;
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dmat2x2 dmat2x2;
typedef lowp_dmat2x3 dmat2x3;
typedef lowp_dmat2x4 dmat2x4;
typedef lowp_dmat3x2 dmat3x2;
typedef lowp_dmat3x3 dmat3x3;
typedef lowp_dmat3x4 dmat3x4;
typedef lowp_dmat4x2 dmat4x2;
typedef lowp_dmat4x3 dmat4x3;
typedef lowp_dmat4x4 dmat4x4;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef mediump_dmat2x2 dmat2x2;
typedef mediump_dmat2x3 dmat2x3;
@ -747,77 +737,67 @@ namespace detail
typedef mediump_dmat4x2 dmat4x2;
typedef mediump_dmat4x3 dmat4x3;
typedef mediump_dmat4x4 dmat4x4;
#elif(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dmat2x2 dmat2x2;
typedef lowp_dmat2x3 dmat2x3;
typedef lowp_dmat2x4 dmat2x4;
typedef lowp_dmat3x2 dmat3x2;
typedef lowp_dmat3x3 dmat3x3;
typedef lowp_dmat3x4 dmat3x4;
typedef lowp_dmat4x2 dmat4x2;
typedef lowp_dmat4x3 dmat4x3;
typedef lowp_dmat4x4 dmat4x4;
#else
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
//! 2 * 2 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat2x2 dmat2;
typedef highp_dmat2x2 dmat2;
//! 3 * 3 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat3x3 dmat3;
typedef highp_dmat3x3 dmat3;
//! 4 * 4 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat4x4 dmat4;
typedef highp_dmat4x4 dmat4;
//! 2 * 2 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat2x2 dmat2x2;
typedef highp_dmat2x2 dmat2x2;
//! 2 * 3 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat2x3 dmat2x3;
typedef highp_dmat2x3 dmat2x3;
//! 2 * 4 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat2x4 dmat2x4;
typedef highp_dmat2x4 dmat2x4;
//! 3 * 2 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat3x2 dmat3x2;
typedef highp_dmat3x2 dmat3x2;
/// 3 * 3 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat3x3 dmat3x3;
typedef highp_dmat3x3 dmat3x3;
/// 3 * 4 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat3x4 dmat3x4;
typedef highp_dmat3x4 dmat3x4;
/// 4 * 2 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat4x2 dmat4x2;
typedef highp_dmat4x2 dmat4x2;
/// 4 * 3 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat4x3 dmat4x3;
typedef highp_dmat4x3 dmat4x3;
/// 4 * 4 matrix of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.6 Matrices</a>
typedef mediump_dmat4x4 dmat4x4;
typedef highp_dmat4x4 dmat4x4;
#endif//GLM_PRECISION

View File

@ -74,27 +74,48 @@ namespace detail
/// @addtogroup core_precision
/// @{
/// 2 components vector of high precision floating-point numbers.
/// 2 components vector of high single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<float, highp> highp_vec2;
/// 2 components vector of medium precision floating-point numbers.
/// 2 components vector of medium single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<float, mediump> mediump_vec2;
/// 2 components vector of low precision floating-point numbers.
/// 2 components vector of low single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<float, lowp> lowp_vec2;
/// 2 components vector of high double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<double, highp> highp_dvec2;
/// 2 components vector of medium double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<double, mediump> mediump_dvec2;
/// 2 components vector of low double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<double, lowp> lowp_dvec2;
/// 2 components vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision.
///
@ -136,6 +157,27 @@ namespace detail
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<uint, lowp> lowp_uvec2;
/// 2 components vector of high precision bool numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<bool, highp> highp_bvec2;
/// 2 components vector of medium precision bool numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<bool, mediump> mediump_bvec2;
/// 2 components vector of low precision bool numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec2<bool, lowp> lowp_bvec2;
/// @}
@ -143,27 +185,48 @@ namespace detail
/// @addtogroup core_precision
/// @{
/// 3 components vector of high precision floating-point numbers.
/// 3 components vector of high single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<float, highp> highp_vec3;
/// 3 components vector of medium precision floating-point numbers.
/// 3 components vector of medium single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<float, mediump> mediump_vec3;
/// 3 components vector of low precision floating-point numbers.
/// 3 components vector of low single-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<float, lowp> lowp_vec3;
/// 3 components vector of high double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<double, highp> highp_dvec3;
/// 3 components vector of medium double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<double, mediump> mediump_dvec3;
/// 3 components vector of low double-precision floating-point numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<double, lowp> lowp_dvec3;
/// 3 components vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision.
///
@ -206,73 +269,118 @@ namespace detail
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<uint, lowp> lowp_uvec3;
/// 3 components vector of high precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<bool, highp> highp_bvec3;
/// 3 components vector of medium precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<bool, mediump> mediump_bvec3;
/// 3 components vector of low precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec3<bool, lowp> lowp_bvec3;
/// @}
/// @addtogroup core_precision
/// @{
/// 4 components vector of high precision floating-point numbers.
/// There is no guarantee on the actual precision.
/// 4 components vector of high single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<float, highp> highp_vec4;
/// 4 components vector of medium precision floating-point numbers.
/// There is no guarantee on the actual precision.
/// 4 components vector of medium single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<float, mediump> mediump_vec4;
/// 4 components vector of low precision floating-point numbers.
/// There is no guarantee on the actual precision.
/// 4 components vector of low single-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<float, lowp> lowp_vec4;
/// 4 components vector of high double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<double, highp> highp_dvec4;
/// 4 components vector of medium double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<double, mediump> mediump_dvec4;
/// 4 components vector of low double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<double, lowp> lowp_dvec4;
/// 4 components vector of high precision signed integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<int, highp> highp_ivec4;
/// 4 components vector of medium precision signed integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<int, mediump> mediump_ivec4;
/// 4 components vector of low precision signed integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<int, lowp> lowp_ivec4;
/// 4 components vector of high precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<uint, highp> highp_uvec4;
/// 4 components vector of medium precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<uint, mediump> mediump_uvec4;
/// 4 components vector of low precision unsigned integer numbers.
/// There is no guarantee on the actual precision.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<uint, lowp> lowp_uvec4;
/// 4 components vector of high precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<bool, highp> highp_bvec4;
/// 4 components vector of medium precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<bool, mediump> mediump_bvec4;
/// 4 components vector of low precision bool numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.7.2 Precision Qualifier</a>
typedef detail::tvec4<bool, lowp> lowp_bvec4;
/// @}
@ -280,136 +388,144 @@ namespace detail
/// @{
//////////////////////////
// Float definition
// Default float definition
#if(defined(GLM_PRECISION_HIGHP_FLOAT))
typedef highp_vec2 vec2;
typedef highp_vec3 vec3;
typedef highp_vec4 vec4;
#if(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_vec2 vec2;
typedef lowp_vec3 vec3;
typedef lowp_vec4 vec4;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef mediump_vec2 vec2;
typedef mediump_vec3 vec3;
typedef mediump_vec4 vec4;
#elif(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_vec2 vec2;
typedef lowp_vec3 vec3;
typedef lowp_vec4 vec4;
#else
#else //defined(GLM_PRECISION_HIGHP_FLOAT)
/// 2 components vector of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_vec2 vec2;
typedef highp_vec2 vec2;
//! 3 components vector of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_vec3 vec3;
typedef highp_vec3 vec3;
//! 4 components vector of floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_vec4 vec4;
typedef highp_vec4 vec4;
#endif//GLM_PRECISION
//////////////////////////
// Default double definition
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dvec2 dvec2;
typedef lowp_dvec3 dvec3;
typedef lowp_dvec4 dvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef mediump_dvec2 dvec2;
typedef mediump_dvec3 dvec3;
typedef mediump_dvec4 dvec4;
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
/// 2 components vector of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef highp_dvec2 dvec2;
//! 3 components vector of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef highp_dvec3 dvec3;
//! 4 components vector of double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef highp_dvec4 dvec4;
#endif//GLM_PRECISION
//////////////////////////
// Signed integer definition
#if(defined(GLM_PRECISION_HIGHP_INT))
typedef highp_ivec2 ivec2;
typedef highp_ivec3 ivec3;
typedef highp_ivec4 ivec4;
#if(defined(GLM_PRECISION_LOWP_INT))
typedef lowp_ivec2 ivec2;
typedef lowp_ivec3 ivec3;
typedef lowp_ivec4 ivec4;
#elif(defined(GLM_PRECISION_MEDIUMP_INT))
typedef mediump_ivec2 ivec2;
typedef mediump_ivec3 ivec3;
typedef mediump_ivec4 ivec4;
#elif(defined(GLM_PRECISION_LOWP_INT))
typedef lowp_ivec2 ivec2;
typedef lowp_ivec3 ivec3;
typedef lowp_ivec4 ivec4;
#else
#else //defined(GLM_PRECISION_HIGHP_INT)
//! 2 components vector of signed integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_ivec2 ivec2;
typedef highp_ivec2 ivec2;
//! 3 components vector of signed integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_ivec3 ivec3;
typedef highp_ivec3 ivec3;
//! 4 components vector of signed integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_ivec4 ivec4;
typedef highp_ivec4 ivec4;
#endif//GLM_PRECISION
//////////////////////////
// Unsigned integer definition
#if(defined(GLM_PRECISION_HIGHP_UINT))
typedef highp_uvec2 uvec2;
typedef highp_uvec3 uvec3;
typedef highp_uvec4 uvec4;
#if(defined(GLM_PRECISION_LOWP_UINT))
typedef lowp_uvec2 uvec2;
typedef lowp_uvec3 uvec3;
typedef lowp_uvec4 uvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef mediump_uvec2 uvec2;
typedef mediump_uvec3 uvec3;
typedef mediump_uvec4 uvec4;
#elif(defined(GLM_PRECISION_LOWP_UINT))
typedef lowp_uvec2 uvec2;
typedef lowp_uvec3 uvec3;
typedef lowp_uvec4 uvec4;
#else
#else //defined(GLM_PRECISION_HIGHP_UINT)
/// 2 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_uvec2 uvec2;
typedef highp_uvec2 uvec2;
/// 3 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_uvec3 uvec3;
typedef highp_uvec3 uvec3;
/// 4 components vector of unsigned integer numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef mediump_uvec4 uvec4;
typedef highp_uvec4 uvec4;
#endif//GLM_PRECISION
//////////////////////////
// Boolean definition
#if(defined(GLM_PRECISION_LOWP_BOOL))
typedef lowp_bvec2 bvec2;
typedef lowp_bvec3 bvec3;
typedef lowp_bvec4 bvec4;
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
typedef mediump_bvec2 bvec2;
typedef mediump_bvec3 bvec3;
typedef mediump_bvec4 bvec4;
#else //defined(GLM_PRECISION_HIGHP_BOOL)
//! 2 components vector of boolean.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec2<bool, mediump> bvec2;
typedef highp_bvec2 bvec2;
//! 3 components vector of boolean.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec3<bool, mediump> bvec3;
typedef highp_bvec3 bvec3;
//! 4 components vector of boolean.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec4<bool, mediump> bvec4;
//////////////////////////
// Double definition
//! Vector of 2 double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec2<double, mediump> dvec2;
//! Vector of 3 double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec3<double, mediump> dvec3;
//! Vector of 4 double-precision floating-point numbers.
///
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 4.1.5 Vectors</a>
typedef detail::tvec4<double, mediump> dvec4;
typedef highp_bvec4 bvec4;
#endif//GLM_PRECISION
/// @}
}//namespace glm

View File

@ -47,40 +47,107 @@ namespace detail
template <typename T, precision P> struct tquat;
}//namespace detail
/// Quaternion of floating-point numbers.
/// Quaternion of low half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float, mediump> quat;
typedef detail::tquat<half, lowp> lowp_hquat;
/// Quaternion of half-precision floating-point numbers.
/// Quaternion of medium half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<detail::half, mediump> hquat;
typedef detail::tquat<half, mediump> mediump_hquat;
/// Quaternion of high half-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<half, highp> 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 single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float, mediump> fquat;
/// Quaternion of double-precision floating-point numbers.
/// Quaternion of low single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double, mediump> dquat;
typedef detail::tquat<float, lowp> lowp_quat;
/// Quaternion of low precision floating-point numbers.
/// Quaternion of medium single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float, lowp> lowp_quat;
typedef detail::tquat<float, mediump> mediump_quat;
/// Quaternion of medium precision floating-point numbers.
/// Quaternion of high single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float, mediump> mediump_quat;
typedef detail::tquat<float, highp> highp_quat;
/// Quaternion of high precision floating-point numbers.
#if(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef highp_quat quat;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef mediump_quat quat;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_quat quat;
#elif(!defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
/// Quaternion of default single-precision floating-point numbers.
typedef highp_quat quat;
#endif
/// Quaternion of low single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<float, highp> highp_quat;
typedef lowp_quat lowp_fquat;
/// Quaternion of medium single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef mediump_quat mediump_fquat;
/// Quaternion of high single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef highp_quat highp_fquat;
/// Quaternion of default single-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef quat fquat;
/// Quaternion of low double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double, lowp> lowp_dquat;
/// Quaternion of medium double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double, mediump> mediump_dquat;
/// Quaternion of high double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef detail::tquat<double, highp> highp_dquat;
#if(defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
typedef highp_dquat dquat;
#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
typedef mediump_dquat dquat;
#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dquat dquat;
#elif(!defined(GLM_PRECISION_HIGHP_DOUBLE) && !defined(GLM_PRECISION_MEDIUMP_DOUBLE) && !defined(GLM_PRECISION_LOWP_DOUBLE))
/// Quaternion of default double-precision floating-point numbers.
///
/// @see gtc_quaternion
typedef highp_dquat dquat;
#endif
}//namespace glm

View File

@ -48,8 +48,8 @@ namespace glm{
namespace detail
{
#if(GLM_COMPONENT == GLM_COMPONENT_CXX98)
template <>
struct tvec2<half, defaultp>
template <precision P>
struct tvec2<half, P>
{
enum ctor{null};
typedef half value_type;
@ -58,8 +58,8 @@ namespace detail
GLM_FUNC_DECL size_type length() const;
static GLM_FUNC_DECL size_type value_size();
typedef tvec2<half, defaultp> type;
typedef tvec2<bool, defaultp> bool_type;
typedef tvec2<half, P> type;
typedef tvec2<bool, P> bool_type;
//////////////////////////////////////
// Data
@ -76,7 +76,7 @@ namespace detail
// Implicit basic constructors
tvec2();
tvec2(tvec2<half, defaultp> const & v);
tvec2(tvec2<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
@ -91,7 +91,7 @@ namespace detail
//////////////////////////////////////
// Swizzle constructors
tvec2(tref2<half, defaultp> const & r);
tvec2(tref2<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
@ -108,42 +108,42 @@ namespace detail
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec2(tvec2<U, defaultp> const & v);
explicit tvec2(tvec2<U, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec2(tvec3<U, defaultp> const & v);
explicit tvec2(tvec3<U, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec2(tvec4<U, defaultp> const & v);
explicit tvec2(tvec4<U, P> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec2<half, defaultp>& operator= (tvec2<half, defaultp> const & v);
tvec2<half, P>& operator= (tvec2<half, P> const & v);
tvec2<half, defaultp>& operator+=(half const & s);
tvec2<half, defaultp>& operator+=(tvec2<half, defaultp> const & v);
tvec2<half, defaultp>& operator-=(half const & s);
tvec2<half, defaultp>& operator-=(tvec2<half, defaultp> const & v);
tvec2<half, defaultp>& operator*=(half const & s);
tvec2<half, defaultp>& operator*=(tvec2<half, defaultp> const & v);
tvec2<half, defaultp>& operator/=(half const & s);
tvec2<half, defaultp>& operator/=(tvec2<half, defaultp> const & v);
tvec2<half, defaultp>& operator++();
tvec2<half, defaultp>& operator--();
tvec2<half, P>& operator+=(half const & s);
tvec2<half, P>& operator+=(tvec2<half, P> const & v);
tvec2<half, P>& operator-=(half const & s);
tvec2<half, P>& operator-=(tvec2<half, P> const & v);
tvec2<half, P>& operator*=(half const & s);
tvec2<half, P>& operator*=(tvec2<half, P> const & v);
tvec2<half, P>& operator/=(half const & s);
tvec2<half, P>& operator/=(tvec2<half, P> const & v);
tvec2<half, P>& operator++();
tvec2<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, defaultp> swizzle(comp X, comp Y) const;
tvec3<half, defaultp> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, defaultp> swizzle(comp X, comp Y, comp Z, comp W) const;
tref2<half, defaultp> swizzle(comp X, comp Y);
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref2<half, P> swizzle(comp X, comp Y);
};
template <>
struct tvec3<half, defaultp>
template <precision P>
struct tvec3<half, P>
{
enum ctor{null};
typedef half value_type;
@ -151,8 +151,8 @@ namespace detail
GLM_FUNC_DECL size_type length() const;
static GLM_FUNC_DECL size_type value_size();
typedef tvec3<half, defaultp> type;
typedef tvec3<bool, defaultp> bool_type;
typedef tvec3<half, P> type;
typedef tvec3<bool, P> bool_type;
//////////////////////////////////////
// Data
@ -169,7 +169,7 @@ namespace detail
// Implicit basic constructors
tvec3();
tvec3(tvec3<half, defaultp> const & v);
tvec3(tvec3<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
@ -185,7 +185,7 @@ namespace detail
//////////////////////////////////////
// Swizzle constructors
tvec3(tref3<half, defaultp> const & r);
tvec3(tref3<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
@ -202,45 +202,45 @@ namespace detail
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
explicit tvec3(tvec2<A, defaultp> const & v, B const & s);
explicit tvec3(tvec2<A, P> const & v, B const & s);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
explicit tvec3(A const & s, tvec2<B, defaultp> const & v);
explicit tvec3(A const & s, tvec2<B, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec3(tvec3<U, defaultp> const & v);
explicit tvec3(tvec3<U, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec3(tvec4<U, defaultp> const & v);
explicit tvec3(tvec4<U, P> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec3<half, defaultp>& operator= (tvec3<half, defaultp> const & v);
tvec3<half, P>& operator= (tvec3<half, P> const & v);
tvec3<half, defaultp>& operator+=(half const & s);
tvec3<half, defaultp>& operator+=(tvec3<half, defaultp> const & v);
tvec3<half, defaultp>& operator-=(half const & s);
tvec3<half, defaultp>& operator-=(tvec3<half, defaultp> const & v);
tvec3<half, defaultp>& operator*=(half const & s);
tvec3<half, defaultp>& operator*=(tvec3<half, defaultp> const & v);
tvec3<half, defaultp>& operator/=(half const & s);
tvec3<half, defaultp>& operator/=(tvec3<half, defaultp> const & v);
tvec3<half, defaultp>& operator++();
tvec3<half, defaultp>& operator--();
tvec3<half, P>& operator+=(half const & s);
tvec3<half, P>& operator+=(tvec3<half, P> const & v);
tvec3<half, P>& operator-=(half const & s);
tvec3<half, P>& operator-=(tvec3<half, P> const & v);
tvec3<half, P>& operator*=(half const & s);
tvec3<half, P>& operator*=(tvec3<half, P> const & v);
tvec3<half, P>& operator/=(half const & s);
tvec3<half, P>& operator/=(tvec3<half, P> const & v);
tvec3<half, P>& operator++();
tvec3<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, defaultp> swizzle(comp X, comp Y) const;
tvec3<half, defaultp> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, defaultp> swizzle(comp X, comp Y, comp Z, comp W) const;
tref3<half, defaultp> swizzle(comp X, comp Y, comp Z);
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref3<half, P> swizzle(comp X, comp Y, comp Z);
};
template <>
struct tvec4<half, defaultp>
template <precision P>
struct tvec4<half, P>
{
enum ctor{null};
typedef half value_type;
@ -248,8 +248,8 @@ namespace detail
GLM_FUNC_DECL size_type length() const;
static GLM_FUNC_DECL size_type value_size();
typedef tvec4<half, defaultp> type;
typedef tvec4<bool, defaultp> bool_type;
typedef tvec4<half, P> type;
typedef tvec4<bool, P> bool_type;
//////////////////////////////////////
// Data
@ -266,7 +266,7 @@ namespace detail
// Implicit basic constructors
tvec4();
tvec4(tvec4<half, defaultp> const & v);
tvec4(tvec4<half, P> const & v);
//////////////////////////////////////
// Explicit basic constructors
@ -283,7 +283,7 @@ namespace detail
//////////////////////////////////////
// Swizzle constructors
tvec4(tref4<half, defaultp> const & r);
tvec4(tref4<half, P> const & r);
//////////////////////////////////////
// Convertion scalar constructors
@ -300,50 +300,50 @@ namespace detail
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
explicit tvec4(tvec2<A, defaultp> const & v, B const & s1, C const & s2);
explicit tvec4(tvec2<A, P> 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 <typename A, typename B, typename C>
explicit tvec4(A const & s1, tvec2<B, defaultp> const & v, C const & s2);
explicit tvec4(A const & s1, tvec2<B, P> const & v, C const & s2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B, typename C>
explicit tvec4(A const & s1, B const & s2, tvec2<C, defaultp> const & v);
explicit tvec4(A const & s1, B const & s2, tvec2<C, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
explicit tvec4(tvec3<A, defaultp> const & v, B const & s);
explicit tvec4(tvec3<A, P> const & v, B const & s);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
explicit tvec4(A const & s, tvec3<B, defaultp> const & v);
explicit tvec4(A const & s, tvec3<B, P> const & v);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename A, typename B>
explicit tvec4(tvec2<A, defaultp> const & v1, tvec2<B, defaultp> const & v2);
explicit tvec4(tvec2<A, P> const & v1, tvec2<B, P> const & v2);
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
explicit tvec4(tvec4<U, defaultp> const & v);
explicit tvec4(tvec4<U, P> const & v);
//////////////////////////////////////
// Unary arithmetic operators
tvec4<half, defaultp>& operator= (tvec4<half, defaultp> const & v);
tvec4<half, P>& operator= (tvec4<half, P> const & v);
tvec4<half, defaultp>& operator+=(half const & s);
tvec4<half, defaultp>& operator+=(tvec4<half, defaultp> const & v);
tvec4<half, defaultp>& operator-=(half const & s);
tvec4<half, defaultp>& operator-=(tvec4<half, defaultp> const & v);
tvec4<half, defaultp>& operator*=(half const & s);
tvec4<half, defaultp>& operator*=(tvec4<half, defaultp> const & v);
tvec4<half, defaultp>& operator/=(half const & s);
tvec4<half, defaultp>& operator/=(tvec4<half, defaultp> const & v);
tvec4<half, defaultp>& operator++();
tvec4<half, defaultp>& operator--();
tvec4<half, P>& operator+=(half const & s);
tvec4<half, P>& operator+=(tvec4<half, P> const & v);
tvec4<half, P>& operator-=(half const & s);
tvec4<half, P>& operator-=(tvec4<half, P> const & v);
tvec4<half, P>& operator*=(half const & s);
tvec4<half, P>& operator*=(tvec4<half, P> const & v);
tvec4<half, P>& operator/=(half const & s);
tvec4<half, P>& operator/=(tvec4<half, P> const & v);
tvec4<half, P>& operator++();
tvec4<half, P>& operator--();
//////////////////////////////////////
// Swizzle operators
half swizzle(comp X) const;
tvec2<half, defaultp> swizzle(comp X, comp Y) const;
tvec3<half, defaultp> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, defaultp> swizzle(comp X, comp Y, comp Z, comp W) const;
tref4<half, defaultp> swizzle(comp X, comp Y, comp Z, comp W);
tvec2<half, P> swizzle(comp X, comp Y) const;
tvec3<half, P> swizzle(comp X, comp Y, comp Z) const;
tvec4<half, P> swizzle(comp X, comp Y, comp Z, comp W) const;
tref4<half, P> swizzle(comp X, comp Y, comp Z, comp W);
};
#endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98)
}
@ -548,123 +548,105 @@ namespace detail
/// 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 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 mediump_hvec2 hvec2;
typedef highp_hvec2 hvec2;
/// Vector of 3 default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hvec3 hvec3;
typedef highp_hvec3 hvec3;
/// Vector of 4 default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hvec4 hvec4;
typedef highp_hvec4 hvec4;
/// 2 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat2x2 hmat2;
typedef highp_hmat2x2 hmat2;
/// 3 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat3x3 hmat3;
typedef highp_hmat3x3 hmat3;
/// 4 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat4x4 hmat4;
typedef highp_hmat4x4 hmat4;
/// 2 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat2x2 hmat2x2;
typedef highp_hmat2x2 hmat2x2;
/// 2 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat2x3 hmat2x3;
typedef highp_hmat2x3 hmat2x3;
/// 2 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat2x4 hmat2x4;
typedef highp_hmat2x4 hmat2x4;
/// 3 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat3x2 hmat3x2;
typedef highp_hmat3x2 hmat3x2;
/// 3 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat3x3 hmat3x3;
typedef highp_hmat3x3 hmat3x3;
/// 3 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat3x4 hmat3x4;
typedef highp_hmat3x4 hmat3x4;
/// 4 * 2 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat4x2 hmat4x2;
typedef highp_hmat4x2 hmat4x2;
/// 4 * 3 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat4x3 hmat4x3;
typedef highp_hmat4x3 hmat4x3;
/// 4 * 4 matrix of default half-precision floating-point numbers.
/// @see gtc_half_float
typedef mediump_hmat4x4 hmat4x4;
#elif(defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
typedef detail::tvec2<half_t, highp> hvec2;
typedef detail::tvec3<half_t, highp> hvec3;
typedef detail::tvec4<half_t, highp> hvec4;
typedef detail::tmat2x2<half_t, highp> hmat2;
typedef detail::tmat3x3<half_t, highp> hmat3;
typedef detail::tmat4x4<half_t, highp> hmat4;
typedef detail::tmat2x2<half_t, highp> hmat2x2;
typedef detail::tmat2x3<half_t, highp> hmat2x3;
typedef detail::tmat2x4<half_t, highp> hmat2x4;
typedef detail::tmat3x2<half_t, highp> hmat3x2;
typedef detail::tmat3x3<half_t, highp> hmat3x3;
typedef detail::tmat3x4<half_t, highp> hmat3x4;
typedef detail::tmat4x2<half_t, highp> hmat4x2;
typedef detail::tmat4x3<half_t, highp> hmat4x3;
typedef detail::tmat4x4<half_t, highp> hmat4x4;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && defined(GLM_PRECISION_MEDIUMP_HALF) && !defined(GLM_PRECISION_LOWP_HALF))
typedef detail::tvec2<half_t, mediump> hvec2;
typedef detail::tvec3<half_t, mediump> hvec3;
typedef detail::tvec4<half_t, mediump> hvec4;
typedef detail::tmat2x2<half_t, mediump> hmat2;
typedef detail::tmat3x3<half_t, mediump> hmat3;
typedef detail::tmat4x4<half_t, mediump> hmat4;
typedef detail::tmat2x2<half_t, mediump> hmat2x2;
typedef detail::tmat2x3<half_t, mediump> hmat2x3;
typedef detail::tmat2x4<half_t, mediump> hmat2x4;
typedef detail::tmat3x2<half_t, mediump> hmat3x2;
typedef detail::tmat3x3<half_t, mediump> hmat3x3;
typedef detail::tmat3x4<half_t, mediump> hmat3x4;
typedef detail::tmat4x2<half_t, mediump> hmat4x2;
typedef detail::tmat4x3<half_t, mediump> hmat4x3;
typedef detail::tmat4x4<half_t, mediump> hmat4x4;
#elif(!defined(GLM_PRECISION_HIGHP_HALF) && !defined(GLM_PRECISION_MEDIUMP_HALF) && defined(GLM_PRECISION_LOWP_HALF))
typedef detail::tvec2<half_t, lowp> hvec2;
typedef detail::tvec3<half_t, lowp> hvec3;
typedef detail::tvec4<half_t, lowp> hvec4;
typedef detail::tmat2x2<half_t, lowp> hmat2;
typedef detail::tmat3x3<half_t, lowp> hmat3;
typedef detail::tmat4x4<half_t, lowp> hmat4;
typedef detail::tmat2x2<half_t, lowp> hmat2x2;
typedef detail::tmat2x3<half_t, lowp> hmat2x3;
typedef detail::tmat2x4<half_t, lowp> hmat2x4;
typedef detail::tmat3x2<half_t, lowp> hmat3x2;
typedef detail::tmat3x3<half_t, lowp> hmat3x3;
typedef detail::tmat3x4<half_t, lowp> hmat3x4;
typedef detail::tmat4x2<half_t, lowp> hmat4x2;
typedef detail::tmat4x3<half_t, lowp> hmat4x3;
typedef detail::tmat4x4<half_t, lowp> hmat4x4;
#endif
typedef highp_hmat4x4 hmat4x4;
#endif//GLM_PRECISION
/// Returns the absolute value of a half-precision floating-point value
/// @see gtc_half_float

File diff suppressed because it is too large Load Diff

View File

@ -308,21 +308,6 @@ namespace detail
detail::tvec3<T, P> axis(
detail::tquat<T, P> const & x);
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.
/// @param x x component of the x-axis, x, y, z must be a normalized axis
/// @param y y component of the y-axis, x, y, z must be a normalized axis
/// @param z z component of the z-axis, x, y, z must be a normalized axis
///
/// @see gtc_quaternion
template <typename T, precision P>
detail::tquat<T, P> angleAxis(
T const & angle,
T const & x,
T const & y,
T const & z);
/// Build a quaternion from an angle and a normalized axis.
///
/// @param angle Angle expressed in radians if GLM_FORCE_RADIANS is define or degrees otherwise.

View File

@ -754,18 +754,6 @@ namespace detail
return detail::tvec3<T, P>(x.x * tmp2, x.y * tmp2, x.z * tmp2);
}
template <typename T>
GLM_FUNC_QUALIFIER detail::tquat<T, defaultp> angleAxis
(
T const & angle,
T const & x,
T const & y,
T const & z
)
{
return angleAxis(angle, detail::tvec3<T, defaultp>(x, y, z));
}
template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tquat<T, P> angleAxis
(

View File

@ -271,12 +271,12 @@ namespace detail
/// Dual-quaternion of floating-point numbers.
///
/// @see gtc_dual_quaternion
typedef mediump_fdualquat dualquat;
typedef highp_fdualquat dualquat;
/// Dual-quaternion of single-precision floating-point numbers.
///
/// @see gtc_dual_quaternion
typedef mediump_fdualquat fdualquat;
typedef highp_fdualquat fdualquat;
#elif(defined(GLM_PRECISION_HIGHP_FLOAT) && !defined(GLM_PRECISION_MEDIUMP_FLOAT) && !defined(GLM_PRECISION_LOWP_FLOAT))
typedef highp_fdualquat dualquat;
typedef highp_fdualquat fdualquat;

View File

@ -42,12 +42,24 @@ static int test_vec()
return Error;
}
static int test_dvec()
{
int Error = 0;
Error += sizeof(glm::dvec2) == sizeof(glm::highp_dvec2) ? 0 : 1;
Error += sizeof(glm::dvec3) == sizeof(glm::highp_dvec3) ? 0 : 1;
Error += sizeof(glm::dvec4) == sizeof(glm::highp_dvec4) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
Error += test_mat();
Error += test_vec();
Error += test_dvec();
return Error;
}

View File

@ -210,8 +210,8 @@ int test_vec2_size()
Error += sizeof(glm::vec2) == sizeof(glm::mediump_vec2) ? 0 : 1;
Error += 8 == sizeof(glm::mediump_vec2) ? 0 : 1;
Error += sizeof(glm::dvec2) == sizeof(glm::highp_vec2) ? 0 : 1;
Error += 16 == sizeof(glm::highp_vec2) ? 0 : 1;
Error += sizeof(glm::dvec2) == sizeof(glm::highp_dvec2) ? 0 : 1;
Error += 16 == sizeof(glm::highp_dvec2) ? 0 : 1;
Error += glm::vec2().length() == 2 ? 0 : 1;
Error += glm::dvec2().length() == 2 ? 0 : 1;
@ -223,7 +223,7 @@ int main()
int Error = 0;
Error += test_vec2_size();
Error += test_vec2_ctor();
Error += test_vec2_ctor();
Error += test_vec2_operators();
return Error;

View File

@ -46,8 +46,8 @@ int test_half_precision_vec()
Error += sizeof(glm::hvec2) == 4 ? 0 : 1;
Error += sizeof(glm::hvec3) == 6 ? 0 : 1;
Error += sizeof(glm::hvec4) == 8 ? 0 : 1;
return Error;
return Error;
}
int test_half_precision_mat()
@ -68,7 +68,7 @@ int test_half_precision_mat()
Error += sizeof(glm::hmat4x3) == 24 ? 0 : 1;
Error += sizeof(glm::hmat4x4) == 32 ? 0 : 1;
return Error;
return Error;
}
int test_half_ctor_mat2x2()
@ -103,7 +103,7 @@ int test_half_ctor_mat2x2()
Error += A == C ? 0 : 1;
}
return Error;
return Error;
}
int test_half_ctor_mat2x3()
@ -208,7 +208,7 @@ int test_half_ctor_mat3x2()
Error += A == C ? 0 : 1;
}
return Error;
return Error;
}
int test_half_ctor_mat3x3()
@ -243,7 +243,7 @@ int test_half_ctor_mat3x3()
Error += A == C ? 0 : 1;
}
return Error;
return Error;
}
int test_half_ctor_mat3x4()
@ -278,7 +278,7 @@ int test_half_ctor_mat3x4()
Error += A == C ? 0 : 1;
}
return Error;
return Error;
}
int test_half_ctor_mat4x2()
@ -527,10 +527,69 @@ int test_hvec4_size()
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;
}
int main()
{
int Error = 0;
Error += test_hvec_precision();
Error += test_hvec2_size();
Error += test_hvec3_size();
Error += test_hvec4_size();

View File

@ -200,7 +200,7 @@ int test_quat_slerp()
// Testing almost equal quaternions (this test should pass through the linear interpolation)
// Must be 0 0.00X 0 0.99999
glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, 0.0f, 1.0f, 0.0f), 0.5f);
glm::quat almostid = glm::slerp(id, glm::angleAxis(0.1f, glm::vec3(0.0f, 1.0f, 0.0f)), 0.5f);
return Error;
}

View File

@ -602,7 +602,5 @@ int main()
Error += ::extractField::test();
Error += ::bitRevert::test();
while(true);
return Error;
}