From 6babc92c2b7185263db130ac64d363ffb047e28e Mon Sep 17 00:00:00 2001 From: Colby Klein Date: Thu, 21 Apr 2022 13:02:58 -0700 Subject: [PATCH] use mul_vec3_perspective on mat4.__mul if you are using the `mat4 * vec3` overload, this is probably what you would expect to be happening. this should be the same for any case which worked previously, but will return a correct result with perspective. --- modules/mat4.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/mat4.lua b/modules/mat4.lua index f954114..4fb6890 100644 --- a/modules/mat4.lua +++ b/modules/mat4.lua @@ -887,7 +887,7 @@ function mat4_mt.__mul(a, b) precond.assert(mat4.is_mat4(a), "__mul: Wrong argument type '%s' for left hand operand. ( expected)", type(a)) if vec3.is_vec3(b) then - return vec3(mat4.mul_vec4({}, a, { b.x, b.y, b.z, 1 })) + return mat4.mul_vec3_perspective(vec3(), a, b) end assert(mat4.is_mat4(b) or #b == 4, "__mul: Wrong argument type for right hand operand. ( or table #4 expected)")