1.0.4 mat3.pos=

This commit is contained in:
Ryan Oldenburg 2021-04-27 20:26:39 -05:00
parent 19eb9dd330
commit 322c4f6a98
3 changed files with 12 additions and 2 deletions

View file

@ -499,7 +499,11 @@ proc `~=`*[T](a, b: GMat4[T]): bool =
a[0] ~= b[0] and a[1] ~= b[1] and a[2] ~= b[2] and a[3] ~= b[3]
proc pos*[T](a: GMat3[T]): GVec2[T] =
return [a[2][2], a[2][1]]
[a[2][0], a[2][1]]
proc `pos=`*[T](a: var GMat3[T], pos: GVec2[T]) =
a[2][0] = pos.x
a[2][1] = pos.y
proc `*`*[T](a, b: GMat3[T]): GMat3[T] =
result[0, 0] = b[0, 0] * a[0, 0] + b[0, 1] * a[1, 0] + b[0, 2] * a[2, 0]

View file

@ -355,6 +355,12 @@ block:
[0.0, 0.0, 0.0, 1.0]
]
doAssert translate(vec2(1, 2)).pos == vec2(1, 2)
var translation = translate(vec2(1, 2))
translation.pos = vec2(3, 4)
doAssert translation.pos == vec2(3, 4)
block:
# Test basic vector mat4 and quat.
var m1 = mat4(

View file

@ -1,4 +1,4 @@
version = "1.0.3"
version = "1.0.4"
author = "treeform"
description = "Your single stop for vector math routines for 2d and 3d graphics."
license = "MIT"