From be97b8b2135396f36f6bbefea0a2cd6232509859 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 18 Oct 2011 14:14:48 +0100 Subject: [PATCH] Added vec1 types --- glm/core/type_vec1.hpp | 62 ++++++++++++++++++++++++++------------ glm/gtc/type_precision.hpp | 22 +++++++------- 2 files changed, 53 insertions(+), 31 deletions(-) diff --git a/glm/core/type_vec1.hpp b/glm/core/type_vec1.hpp index 1e41bd86..6d1f89ad 100644 --- a/glm/core/type_vec1.hpp +++ b/glm/core/type_vec1.hpp @@ -118,33 +118,55 @@ namespace detail // Unary arithmetic operators GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator+=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator+=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator-=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator-=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator*=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator*=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator/=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator/=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator+=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator+=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator-=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator-=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator*=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator*=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator/=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator/=(tvec1 const & v); GLM_FUNC_DECL tvec1 & operator++(); GLM_FUNC_DECL tvec1 & operator--(); ////////////////////////////////////// // Unary bit operators - GLM_FUNC_DECL tvec1 & operator%=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator%=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator&=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator&=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator|=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator|=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator^=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator^=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator<<=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator<<=(tvec1 const & v); - GLM_FUNC_DECL tvec1 & operator>>=(value_type const & s); - GLM_FUNC_DECL tvec1 & operator>>=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator%=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator%=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator&=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator&=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator|=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator|=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator^=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator^=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator<<=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator<<=(tvec1 const & v); + template + GLM_FUNC_DECL tvec1 & operator>>=(U const & s); + template + GLM_FUNC_DECL tvec1 & operator>>=(tvec1 const & v); ////////////////////////////////////// // Swizzle operators diff --git a/glm/gtc/type_precision.hpp b/glm/gtc/type_precision.hpp index aa817477..0cbf51d0 100644 --- a/glm/gtc/type_precision.hpp +++ b/glm/gtc/type_precision.hpp @@ -75,22 +75,22 @@ namespace glm typedef int32 i32; //!< \brief 32bit signed integer. (from GLM_GTC_type_precision extension) typedef int64 i64; //!< \brief 64bit signed integer. (from GLM_GTC_type_precision extension) - //typedef i8 i8vec1; //!< \brief 8bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 i8vec1; //!< \brief 8bit signed integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 i8vec2; //!< \brief 8bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 i8vec3; //!< \brief 8bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 i8vec4; //!< \brief 8bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef i16 i16vec1; //!< \brief 16bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 i16vec1; //!< \brief 16bit signed integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 i16vec2; //!< \brief 16bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 i16vec3; //!< \brief 16bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 i16vec4; //!< \brief 16bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef i32 i32vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 i32vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 i32vec2; //!< \brief 32bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 i32vec3; //!< \brief 32bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 i32vec4; //!< \brief 32bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef i64 i64vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 i64vec1; //!< \brief 32bit signed integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 i64vec2; //!< \brief 64bit signed integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 i64vec3; //!< \brief 64bit signed integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 i64vec4; //!< \brief 64bit signed integer vector of 4 components. (from GLM_GTC_type_precision extension) @@ -113,22 +113,22 @@ namespace glm typedef uint32 u32; //!< \brief 32bit unsigned integer. (from GLM_GTC_type_precision extension) typedef uint64 u64; //!< \brief 64bit unsigned integer. (from GLM_GTC_type_precision extension) - //typedef u8 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 u8vec1; //!< \brief 8bit unsigned integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 u8vec2; //!< \brief 8bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 u8vec3; //!< \brief 8bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 u8vec4; //!< \brief 8bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef u16 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 u16vec1; //!< \brief 16bit unsigned integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 u16vec2; //!< \brief 16bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 u16vec3; //!< \brief 16bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 u16vec4; //!< \brief 16bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef u32 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 u32vec1; //!< \brief 32bit unsigned integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 u32vec2; //!< \brief 32bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 u32vec3; //!< \brief 32bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 u32vec4; //!< \brief 32bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef u64 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 u64vec1; //!< \brief 64bit unsigned integer scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 u64vec2; //!< \brief 64bit unsigned integer vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 u64vec3; //!< \brief 64bit unsigned integer vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 u64vec4; //!< \brief 64bit unsigned integer vector of 4 components. (from GLM_GTC_type_precision extension) @@ -152,17 +152,17 @@ namespace glm typedef detail::tvec3 fvec3; //!< Vector of 3 single-precision floating-point numbers. (from GLM_GTC_type_precision extension) typedef detail::tvec4 fvec4; //!< Vector of 4 single-precision floating-point numbers. (from GLM_GTC_type_precision extension) - //typedef f16 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 f16vec1; //!< \brief Half-precision floating-point scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 f16vec2; //!< \brief Half-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 f16vec3; //!< \brief Half-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 f16vec4; //!< \brief Half-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef f32 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 f32vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 f32vec2; //!< \brief Single-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 f32vec3; //!< \brief Single-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 f32vec4; //!< \brief Single-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension) - //typedef f64 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) + typedef detail::tvec1 f64vec1; //!< \brief Single-precision floating-point scalar. (from GLM_GTC_type_precision extension) typedef detail::tvec2 f64vec2; //!< \brief Double-precision floating-point vector of 2 components. (from GLM_GTC_type_precision extension) typedef detail::tvec3 f64vec3; //!< \brief Double-precision floating-point vector of 3 components. (from GLM_GTC_type_precision extension) typedef detail::tvec4 f64vec4; //!< \brief Double-precision floating-point vector of 4 components. (from GLM_GTC_type_precision extension)