fix GMat4.pos
This commit is contained in:
parent
2f970dd4f8
commit
dcc1f0f5c6
|
@ -898,12 +898,12 @@ proc `pos=`*[T](a: var GMat3[T], pos: GVec2[T]) =
|
|||
a[2, 1] = pos.y
|
||||
|
||||
proc pos*[T](a: GMat4[T]): GVec3[T] =
|
||||
gvec2[T](a[2].x, a[2].y, a[2].z)
|
||||
gvec3[T](a[3].x, a[3].y, a[3].z)
|
||||
|
||||
proc `pos=`*[T](a: var GMat4[T], pos: GVec3[T]) =
|
||||
a[2, 0] = pos.x
|
||||
a[2, 1] = pos.y
|
||||
a[2, 2] = pos.z
|
||||
a[3, 0] = pos.x
|
||||
a[3, 1] = pos.y
|
||||
a[3, 2] = pos.z
|
||||
|
||||
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]
|
||||
|
|
|
@ -591,11 +591,20 @@ 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:
|
||||
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:
|
||||
doAssert translate(vec3(1, 2, 3)).pos == vec3(1, 2, 3)
|
||||
|
||||
var translation = translate(vec3(1, 2, 3))
|
||||
translation.pos = vec3(3, 4, 5)
|
||||
doAssert translation.pos == vec3(3, 4, 5)
|
||||
|
||||
block:
|
||||
# Test basic vector mat4 and quat.
|
||||
|
|
Loading…
Reference in a new issue