shorthands like glsl

This commit is contained in:
Ryan Oldenburg 2020-05-17 23:41:33 -05:00
parent ee9a1f8c88
commit 22364a1c9b

View file

@ -32,6 +32,10 @@ func vec2*(x, y: float32): Vec2 =
result.x = x
result.y = y
func vec2*(v: float32): Vec2 =
result.x = v
result.y = v
func vec2*(a: Vec2): Vec2 =
result.x = a.x
result.y = a.y
@ -190,6 +194,11 @@ func vec3*(x, y, z: float32): Vec3 =
result.y = y
result.z = z
func vec3*(v: float32): Vec3 =
result.x = v
result.y = v
result.z = v
func vec3*(a: Vec3): Vec3 =
result.x = a.x
result.y = a.y
@ -389,6 +398,12 @@ func vec4*(x, y, z, w: float32): Vec4 =
result.z = z
result.w = w
func vec4*(v: float32): Vec4 =
result.x = v
result.y = v
result.z = v
result.w = v
func `+`*(a: Vec4, b: Vec4): Vec4 =
result.x = a.x + b.x
result.y = a.y + b.y