From da542432311809e22cc1166960d85e777d9d0be0 Mon Sep 17 00:00:00 2001 From: treeform Date: Mon, 27 Feb 2023 11:57:22 -0800 Subject: [PATCH] Fix for lookAt: https://github.com/treeform/vmath/issues/63 --- src/vmath.nim | 2 +- tests/test.nim | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/vmath.nim b/src/vmath.nim index 8e5808f..070e79e 100644 --- a/src/vmath.nim +++ b/src/vmath.nim @@ -1345,7 +1345,7 @@ proc lookAt*[T](eye, center, up: GVec3[T]): GMat4[T] = centerz = center[2] if eyex == centerx and eyey == centery and eyez == centerz: - return mat4[T]() + return GMat4[T]() var # vec3.direction(eye, center, z) diff --git a/tests/test.nim b/tests/test.nim index 88b315e..e7de428 100644 --- a/tests/test.nim +++ b/tests/test.nim @@ -882,6 +882,10 @@ block: ) doAssert lookAt(vec3(0, 0, 1), vec3(0, 0, 0)).quat ~= quat(0.0, 0.0, 0.0, 1.0) + let + a = lookAt(vec3(1, 2, 3), vec3(0, 0, 0)) + b = lookAt(dvec3(1, 2, 3), dvec3(0, 0, 0)) + doAssert ortho[float32](-1, 1, 1, -1, -1000, 1000) ~= mat4( 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0,