comparison 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
comparison
equal deleted inserted replaced
1253:c4f98eb4bb05 1254:b0f4c8ccd49a
21 TMat43*[T: SomeNumber] = object 21 TMat43*[T: SomeNumber] = object
22 data*: array[12, T] 22 data*: array[12, T]
23 TMat4*[T: SomeNumber] = object 23 TMat4*[T: SomeNumber] = object
24 data*: array[16, T] 24 data*: array[16, T]
25 TMat* = TMat2|TMat3|TMat4|TMat23|TMat32|TMat34|TMat43 25 TMat* = TMat2|TMat3|TMat4|TMat23|TMat32|TMat34|TMat43
26 TSquareMat = TMat2|TMat3|TMat4
26 Mat2* = TMat2[float32] 27 Mat2* = TMat2[float32]
27 Mat23* = TMat23[float32] 28 Mat23* = TMat23[float32]
28 Mat32* = TMat32[float32] 29 Mat32* = TMat32[float32]
29 Mat3* = TMat3[float32] 30 Mat3* = TMat3[float32]
30 Mat34* = TMat34[float32] 31 Mat34* = TMat34[float32]
310 result.add(createVecMatMultiplicationOperator(TMat3, TVec3)) 311 result.add(createVecMatMultiplicationOperator(TMat3, TVec3))
311 result.add(createVecMatMultiplicationOperator(TMat4, TVec4)) 312 result.add(createVecMatMultiplicationOperator(TMat4, TVec4))
312 313
313 createAllMultiplicationOperators() 314 createAllMultiplicationOperators()
314 315
316 proc `+=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
317 a = a + b
318
319 proc `-=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
320 a = a + b
321
322 proc `*=`*[T1: TSquareMat, T2: TSquareMat|SomeNumber](a: var T1, b: T2) =
323 a = a * b
324
315 func `*`*(mat: Mat4, vec: Vec3f): Vec3f = 325 func `*`*(mat: Mat4, vec: Vec3f): Vec3f =
316 (mat * vec.ToVec4(1)).ToVec3 326 (mat * vec.ToVec4(1)).ToVec3
317 327
318 func Transposed*[T](m: TMat2[T]): TMat2[T] = TMat2[T](data: [ 328 func Transposed*[T](m: TMat2[T]): TMat2[T] = TMat2[T](data: [
319 m[0, 0], m[1, 0], 329 m[0, 0], m[1, 0],