From 0a60f090424f3d7eb91dc127861ac5b54859624e Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Tue, 11 Sep 2012 08:13:49 +1000 Subject: [PATCH] Add static constant functions (commented out) --- src/vec.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/vec.rs b/src/vec.rs index cc22ab0..8a53ee9 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -119,6 +119,10 @@ impl vec2: Vector2 { #[inline(always)] pure fn x() -> float { self.data[0] } #[inline(always)] pure fn y() -> float { self.data[1] } + + // #[inline(always)] static pure fn unit_x() -> vec2 { vec2(1f, 0f) } + // #[inline(always)] static pure fn unit_y() -> vec2 { vec2(0f, 1f) } + // #[inline(always)] static pure fn unit_z() -> vec2 { vec2(0f, 0f) } } impl vec2: Vector { @@ -284,6 +288,10 @@ impl vec3: Vector3 { (self[2] * other[0]) - (self[0] * other[2]), (self[0] * other[1]) - (self[1] * other[0])) } + + // #[inline(always)] static pure fn unit_x() -> vec3 { vec3(1f, 0f, 0f) } + // #[inline(always)] static pure fn unit_y() -> vec3 { vec3(0f, 1f, 0f) } + // #[inline(always)] static pure fn unit_z() -> vec3 { vec3(0f, 0f, 1f) } } impl vec3: Vector { @@ -457,6 +465,11 @@ impl vec4: Vector4 { #[inline(always)] pure fn y() -> float { self.data[1] } #[inline(always)] pure fn z() -> float { self.data[2] } #[inline(always)] pure fn w() -> float { self.data[3] } + + // #[inline(always)] static pure fn unit_x() -> vec4 { vec4(1f, 0f, 0f, 0f) } + // #[inline(always)] static pure fn unit_y() -> vec4 { vec4(0f, 1f, 0f, 0f) } + // #[inline(always)] static pure fn unit_z() -> vec4 { vec4(0f, 0f, 1f, 0f) } + // #[inline(always)] static pure fn unit_w() -> vec4 { vec4(0f, 0f, 0f, 1f) } } impl vec4: Vector {