Merge pull request #17 from guzba/master

shorthands like glsl
This commit is contained in:
treeform 2020-05-17 22:54:12 -07:00 committed by GitHub
commit b776179c00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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