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.
This commit is contained in:
Colby Klein 2022-04-21 13:02:58 -07:00
parent c84a8e07c0
commit 6babc92c2b

View File

@ -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. (<cpml.mat4> 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. (<cpml.mat4> or table #4 expected)")