# HG changeset patch # User sam # Date 1723107632 -25200 # Node ID 53a8766292a7fe29324425a86418e5c54d5bba3f # Parent 196bfc6af8e07cca3b6bd57730ab8e67e776f438 did: cleanup, add: vec2 matrix multiplication helpers diff -r 196bfc6af8e0 -r 53a8766292a7 semicongine/core/matrix.nim --- a/semicongine/core/matrix.nim Wed Aug 07 22:46:52 2024 +0700 +++ b/semicongine/core/matrix.nim Thu Aug 08 16:00:32 2024 +0700 @@ -323,6 +323,9 @@ func `*`*(mat: Mat4, vec: Vec3f): Vec3f = (mat * vec.ToVec4(1)).ToVec3 +func `*`*(mat: Mat3, vec: Vec2f): Vec2f = + (mat * vec.ToVec3(1)).ToVec2 + func transposed*[T](m: TMat2[T]): TMat2[T] = TMat2[T](data: [ m[0, 0], m[1, 0], m[0, 1], m[1, 1], diff -r 196bfc6af8e0 -r 53a8766292a7 semicongine/core/vector.nim --- a/semicongine/core/vector.nim Wed Aug 07 22:46:52 2024 +0700 +++ b/semicongine/core/vector.nim Thu Aug 08 16:00:32 2024 +0700 @@ -372,8 +372,5 @@ createVectorAttribAccessorFuncs() -# converter Vec2VkExtent*(vec: TVec2[uint32]): VkExtent2D = VkExtent2D(width: vec[0], height: vec[1]) -# converter Vec3VkExtent*(vec: TVec2[uint32]): VkExtent3D = VkExtent3D(width: vec[0], height: vec[1], depth: vec[2]) - func angleBetween*(a, b: Vec3f): float32 = arccos(a.dot(b) / (a.length * b.length))