added vec{2|3|4}<T>

We can now use for e.g. vec4<float> instead of float4, this is
useful for templated code. The existing solution was to reach
out to the math::detail::TVec<> class.
This commit is contained in:
Mathias Agopian
2019-04-19 16:26:40 -07:00
committed by Mathias Agopian
parent 0cdfbc9524
commit 7795de4ac2
3 changed files with 39 additions and 30 deletions

View File

@@ -95,16 +95,19 @@ public:
// ----------------------------------------------------------------------------------------
typedef details::TVec2<double> double2;
typedef details::TVec2<float> float2;
typedef details::TVec2<half> half2;
typedef details::TVec2<int32_t> int2;
typedef details::TVec2<uint32_t> uint2;
typedef details::TVec2<int16_t> short2;
typedef details::TVec2<uint16_t> ushort2;
typedef details::TVec2<int8_t> byte2;
typedef details::TVec2<uint8_t> ubyte2;
typedef details::TVec2<bool> bool2;
template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value >::type>
using vec2 = details::TVec2<T>;
using double2 = vec2<double>;
using float2 = vec2<float>;
using half2 = vec2<half>;
using int2 = vec2<int32_t>;
using uint2 = vec2<uint32_t>;
using short2 = vec2<int16_t>;
using ushort2 = vec2<uint16_t>;
using byte2 = vec2<int8_t>;
using ubyte2 = vec2<uint8_t>;
using bool2 = vec2<bool>;
// ----------------------------------------------------------------------------------------
} // namespace math

View File

@@ -114,16 +114,19 @@ public:
// ----------------------------------------------------------------------------------------
typedef details::TVec3<double> double3;
typedef details::TVec3<float> float3;
typedef details::TVec3<half> half3;
typedef details::TVec3<int32_t> int3;
typedef details::TVec3<uint32_t> uint3;
typedef details::TVec3<int16_t> short3;
typedef details::TVec3<uint16_t> ushort3;
typedef details::TVec3<int8_t> byte3;
typedef details::TVec3<uint8_t> ubyte3;
typedef details::TVec3<bool> bool3;
template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value >::type>
using vec3 = details::TVec3<T>;
using double3 = vec3<double>;
using float3 = vec3<float>;
using half3 = vec3<half>;
using int3 = vec3<int32_t>;
using uint3 = vec3<uint32_t>;
using short3 = vec3<int16_t>;
using ushort3 = vec3<uint16_t>;
using byte3 = vec3<int8_t>;
using ubyte3 = vec3<uint8_t>;
using bool3 = vec3<bool>;
// ----------------------------------------------------------------------------------------
} // namespace math

View File

@@ -106,16 +106,19 @@ public:
// ----------------------------------------------------------------------------------------
typedef details::TVec4<double> double4;
typedef details::TVec4<float> float4;
typedef details::TVec4<half> half4;
typedef details::TVec4<int32_t> int4;
typedef details::TVec4<uint32_t> uint4;
typedef details::TVec4<int16_t> short4;
typedef details::TVec4<uint16_t> ushort4;
typedef details::TVec4<int8_t> byte4;
typedef details::TVec4<uint8_t> ubyte4;
typedef details::TVec4<bool> bool4;
template <typename T, typename = typename std::enable_if<std::is_arithmetic<T>::value >::type>
using vec4 = details::TVec4<T>;
using double4 = vec4<double>;
using float4 = vec4<float>;
using half4 = vec4<half>;
using int4 = vec4<int32_t>;
using uint4 = vec4<uint32_t>;
using short4 = vec4<int16_t>;
using ushort4 = vec4<uint16_t>;
using byte4 = vec4<int8_t>;
using ubyte4 = vec4<uint8_t>;
using bool4 = vec4<bool>;
// ----------------------------------------------------------------------------------------