diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 50a25c4e..5193be3b 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -83,7 +83,7 @@ private: }; /* The generic "matrix" type, which is a fixed-size matrix */ -template +template struct matrix { private: @@ -123,6 +123,13 @@ LOL_VECTOR_TYPEDEFS(matrix<2 COMMA 2 COMMA, >, mat2) LOL_VECTOR_TYPEDEFS(matrix<3 COMMA 3 COMMA, >, mat3) LOL_VECTOR_TYPEDEFS(matrix<4 COMMA 4 COMMA, >, mat4) +LOL_VECTOR_TYPEDEFS(matrix<2 COMMA 3 COMMA, >, mat2x3) +LOL_VECTOR_TYPEDEFS(matrix<2 COMMA 4 COMMA, >, mat2x4) +LOL_VECTOR_TYPEDEFS(matrix<3 COMMA 2 COMMA, >, mat3x2) +LOL_VECTOR_TYPEDEFS(matrix<3 COMMA 4 COMMA, >, mat3x4) +LOL_VECTOR_TYPEDEFS(matrix<4 COMMA 2 COMMA, >, mat4x2) +LOL_VECTOR_TYPEDEFS(matrix<4 COMMA 3 COMMA, >, mat4x3) + LOL_VECTOR_TYPEDEFS(Cmplx<, >, cmplx) LOL_VECTOR_TYPEDEFS(Quat<, >, quat) @@ -138,6 +145,12 @@ typedef vec4 float4; typedef mat2 float2x2; typedef mat3 float3x3; typedef mat4 float4x4; +typedef mat2x3 float2x3; +typedef mat2x4 float2x4; +typedef mat3x2 float3x2; +typedef mat3x4 float3x4; +typedef mat4x2 float4x2; +typedef mat4x3 float4x3; typedef ivec2 int2; typedef ivec3 int3; @@ -145,6 +158,12 @@ typedef ivec4 int4; typedef imat2 int2x2; typedef imat3 int3x3; typedef imat4 int4x4; +typedef imat2x3 int2x3; +typedef imat2x4 int2x4; +typedef imat3x2 int3x2; +typedef imat3x4 int3x4; +typedef imat4x2 int4x2; +typedef imat4x3 int4x3; /* * Helper macros for vector type member functions @@ -1420,8 +1439,10 @@ LOL_SWIZZLE_V_VV_FUN(fmod) #undef LOL_SWIZZLE_V_VV_FUN /* - * vec clamp(vec, vec|scalar, vec|scalar) - * vec mix(vec, vec, vec|scalar) + * vec clamp(vec, vec, vec) + * vec clamp(vec, scalar, vec) + * vec clamp(vec, vec, scalar) + * vec clamp(vec, scalar, scalar) */ template @@ -1456,6 +1477,11 @@ static inline vec clamp(vec const &x, return max(min(x, b), a); } +/* + * vec mix(vec, vec, vec) + * vec mix(vec, vec, scalar) + */ + template static inline vec mix(vec const &x, vec const &y, diff --git a/tools/vimlol/vimlol.vim b/tools/vimlol/vimlol.vim index 66cc41a7..ec088481 100644 --- a/tools/vimlol/vimlol.vim +++ b/tools/vimlol/vimlol.vim @@ -22,27 +22,13 @@ au Syntax cpp " GLSL types and the Lol Engine extensions au Syntax cpp - \ syn keyword cType - \ f16vec2 f16cmplx f16vec3 f16vec4 f16quat f16mat2 f16mat3 f16mat4 - \ vec2 cmplx vec3 vec4 quat mat2 mat3 mat4 - \ f64vec2 f64cmplx f64vec3 f64vec4 f64quat f64mat2 f64mat3 f64mat4 - \ f128vec2 f128cmplx f128vec3 f128vec4 f128quat f128mat2 f128mat3 f128mat4 - \ rvec2 rcmplx rvec3 rvec4 rquat rmat2 rmat3 rmat4 - \ - \ i8vec2 i8cmplx i8vec3 i8vec4 i8quat i8mat2 i8mat3 i8mat4 - \ u8vec2 u8cmplx u8vec3 u8vec4 u8quat u8mat2 u8mat3 u8mat4 - \ i16vec2 i16cmplx i16vec3 i16vec4 i16quat i16mat2 i16mat3 i16mat4 - \ u16vec2 u16cmplx u16vec3 u16vec4 u16quat u16mat2 u16mat3 u16mat4 - \ ivec2 icmplx ivec3 ivec4 iquat imat2 imat3 imat4 - \ uvec2 ucmplx uvec3 uvec4 uquat umat2 umat3 umat4 - \ i64vec2 i64cmplx i64vec3 i64vec4 i64quat i64mat2 i64mat3 i64mat4 - \ u64vec2 u64cmplx u64vec3 u64vec4 u64quat u64mat2 u64mat3 u64mat4 + \ syn match cType + \ "\<\(f16\|\|f64\|f128\|r\|[iu]\(8\|16\|\|64\)\)\(vec[234]\|cmplx\|quat\|mat\([234]\|2x3\|3x2\|3x4\|4x3\|2x4\|4x2\)\)\>" " HLSL types au Syntax cpp - \ syn keyword cType - \ int2 int3 int4 int2x2 int3x3 int4x4 - \ float2 float3 float4 float2x2 float3x3 float4x4 + \ syn match cType + \ "\<\(int\|float\)[234]\(\|x[234]\)\>" " More GLSL-like types from the Lol Engine au Syntax cpp