diff semiconginev2/core/matrix.nim @ 1254:b0f4c8ccd49a

did: stuff to test gltf importer
author sam <sam@basx.dev>
date Sat, 27 Jul 2024 20:47:54 +0700
parents c4f98eb4bb05
children e9b8d87b9883
line wrap: on
line diff
--- a/semiconginev2/core/matrix.nim	Fri Jul 26 23:39:24 2024 +0700
+++ b/semiconginev2/core/matrix.nim	Sat Jul 27 20:47:54 2024 +0700
@@ -23,6 +23,7 @@
   TMat4*[T: SomeNumber] = object
     data*: array[16, T]
   TMat* = TMat2|TMat3|TMat4|TMat23|TMat32|TMat34|TMat43
+  TSquareMat = TMat2|TMat3|TMat4
   Mat2* = TMat2[float32]
   Mat23* = TMat23[float32]
   Mat32* = TMat32[float32]
@@ -312,6 +313,15 @@
 
 createAllMultiplicationOperators()
 
+proc `+=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
+  a = a + b
+
+proc `-=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
+  a = a + b
+
+proc `*=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
+  a = a * b
+
 func `*`*(mat: Mat4, vec: Vec3f): Vec3f =
   (mat * vec.ToVec4(1)).ToVec3