Mercurial > games > semicongine
changeset 1309:53a8766292a7
did: cleanup, add: vec2 matrix multiplication helpers
author | sam <sam@basx.dev> |
---|---|
date | Thu, 08 Aug 2024 16:00:32 +0700 |
parents | 196bfc6af8e0 |
children | 3f79b3efca95 |
files | semicongine/core/matrix.nim semicongine/core/vector.nim |
diffstat | 2 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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],
--- 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))