diff src/zamikongine/math/vector.nim @ 20:beb86492b178

add: generate ubermeshes
author Sam <sam@basx.dev>
date Tue, 10 Jan 2023 00:23:40 +0700
parents b55d6ecde79d
children c3c963e7c1a6
line wrap: on
line diff
--- a/src/zamikongine/math/vector.nim	Mon Jan 09 11:04:19 2023 +0700
+++ b/src/zamikongine/math/vector.nim	Tue Jan 10 00:23:40 2023 +0700
@@ -12,6 +12,11 @@
   Vec4*[T: SomeNumber] = array[4, T]
   Vec* = Vec2|Vec3|Vec4
 
+converter toVec2*[T: SomeNumber](orig: Vec3[T]|Vec4[T]): Vec2[T] =
+  Vec2[T]([orig[0], orig[1]])
+converter toVec3*[T: SomeNumber](orig: Vec4[T]): Vec3[T] =
+  Vec2[T]([orig[0], orig[1], orig[2]])
+
 # define some often used constants
 func ConstOne2[T: SomeNumber](): auto {.compiletime.} = Vec2[T]([T(1), T(1)])
 func ConstOne3[T: SomeNumber](): auto {.compiletime.} = Vec3[T]([T(1), T(1), T(1)])