From ff7cc186e7c323245d154e5bcb523fc05abccba4 Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Tue, 13 Dec 2016 15:09:38 -0800 Subject: [PATCH] add mat4 * vec3 (implicit w=1) --- modules/mat4.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/mat4.lua b/modules/mat4.lua index 7b87edd..717d84d 100644 --- a/modules/mat4.lua +++ b/modules/mat4.lua @@ -819,6 +819,11 @@ end function mat4_mt.__mul(a, b) assert(mat4.is_mat4(a), "__mul: Wrong argument type for left hand operant. ( expected)") + + if vec3.is_vec3(b) then + return vec3(mat4.mul_vec4({}, a, { b.x, b.y, b.z, 1 })) + end + assert(mat4.is_mat4(b) or #b == 4, "__mul: Wrong argument type for right hand operant. ( or table #4 expected)") if mat4.is_mat4(b) then