Fix for lookAt: https://github.com/treeform/vmath/issues/63
This commit is contained in:
parent
aa18b570fb
commit
da54243231
2 changed files with 5 additions and 1 deletions
|
@ -1345,7 +1345,7 @@ proc lookAt*[T](eye, center, up: GVec3[T]): GMat4[T] =
|
||||||
centerz = center[2]
|
centerz = center[2]
|
||||||
|
|
||||||
if eyex == centerx and eyey == centery and eyez == centerz:
|
if eyex == centerx and eyey == centery and eyez == centerz:
|
||||||
return mat4[T]()
|
return GMat4[T]()
|
||||||
|
|
||||||
var
|
var
|
||||||
# vec3.direction(eye, center, z)
|
# vec3.direction(eye, center, z)
|
||||||
|
|
|
@ -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)
|
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(
|
doAssert ortho[float32](-1, 1, 1, -1, -1000, 1000) ~= mat4(
|
||||||
1.0, 0.0, 0.0, 0.0,
|
1.0, 0.0, 0.0, 0.0,
|
||||||
0.0, -1.0, 0.0, 0.0,
|
0.0, -1.0, 0.0, 0.0,
|
||||||
|
|
Loading…
Reference in a new issue