From 7795de4ac2c4c8bf177d289c4f66ecd2f9a0fd4c Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 19 Apr 2019 16:26:40 -0700 Subject: [PATCH] added vec{2|3|4} We can now use for e.g. vec4 instead of float4, this is useful for templated code. The existing solution was to reach out to the math::detail::TVec<> class. --- libs/math/include/math/vec2.h | 23 +++++++++++++---------- libs/math/include/math/vec3.h | 23 +++++++++++++---------- libs/math/include/math/vec4.h | 23 +++++++++++++---------- 3 files changed, 39 insertions(+), 30 deletions(-) diff --git a/libs/math/include/math/vec2.h b/libs/math/include/math/vec2.h index 6489dfd2a6..aaa0f30a84 100644 --- a/libs/math/include/math/vec2.h +++ b/libs/math/include/math/vec2.h @@ -95,16 +95,19 @@ public: // ---------------------------------------------------------------------------------------- -typedef details::TVec2 double2; -typedef details::TVec2 float2; -typedef details::TVec2 half2; -typedef details::TVec2 int2; -typedef details::TVec2 uint2; -typedef details::TVec2 short2; -typedef details::TVec2 ushort2; -typedef details::TVec2 byte2; -typedef details::TVec2 ubyte2; -typedef details::TVec2 bool2; +template ::value >::type> +using vec2 = details::TVec2; + +using double2 = vec2; +using float2 = vec2; +using half2 = vec2; +using int2 = vec2; +using uint2 = vec2; +using short2 = vec2; +using ushort2 = vec2; +using byte2 = vec2; +using ubyte2 = vec2; +using bool2 = vec2; // ---------------------------------------------------------------------------------------- } // namespace math diff --git a/libs/math/include/math/vec3.h b/libs/math/include/math/vec3.h index 8829a3ac1f..ac541fe4c9 100644 --- a/libs/math/include/math/vec3.h +++ b/libs/math/include/math/vec3.h @@ -114,16 +114,19 @@ public: // ---------------------------------------------------------------------------------------- -typedef details::TVec3 double3; -typedef details::TVec3 float3; -typedef details::TVec3 half3; -typedef details::TVec3 int3; -typedef details::TVec3 uint3; -typedef details::TVec3 short3; -typedef details::TVec3 ushort3; -typedef details::TVec3 byte3; -typedef details::TVec3 ubyte3; -typedef details::TVec3 bool3; +template ::value >::type> +using vec3 = details::TVec3; + +using double3 = vec3; +using float3 = vec3; +using half3 = vec3; +using int3 = vec3; +using uint3 = vec3; +using short3 = vec3; +using ushort3 = vec3; +using byte3 = vec3; +using ubyte3 = vec3; +using bool3 = vec3; // ---------------------------------------------------------------------------------------- } // namespace math diff --git a/libs/math/include/math/vec4.h b/libs/math/include/math/vec4.h index 48cbd314d7..6c82c2efca 100644 --- a/libs/math/include/math/vec4.h +++ b/libs/math/include/math/vec4.h @@ -106,16 +106,19 @@ public: // ---------------------------------------------------------------------------------------- -typedef details::TVec4 double4; -typedef details::TVec4 float4; -typedef details::TVec4 half4; -typedef details::TVec4 int4; -typedef details::TVec4 uint4; -typedef details::TVec4 short4; -typedef details::TVec4 ushort4; -typedef details::TVec4 byte4; -typedef details::TVec4 ubyte4; -typedef details::TVec4 bool4; +template ::value >::type> +using vec4 = details::TVec4; + +using double4 = vec4; +using float4 = vec4; +using half4 = vec4; +using int4 = vec4; +using uint4 = vec4; +using short4 = vec4; +using ushort4 = vec4; +using byte4 = vec4; +using ubyte4 = vec4; +using bool4 = vec4; // ----------------------------------------------------------------------------------------