Remove broken macros

This commit is contained in:
Brendan Zabarauskas 2013-06-06 12:38:03 +10:00
parent d352577356
commit 288c49b474
3 changed files with 0 additions and 272 deletions

View file

@ -586,27 +586,6 @@ impl<T:Copy + Float + NumAssign> ApproxEq<T> for Mat2<T> {
} }
} }
macro_rules! mat2_type(
($name:ident <$T:ty, $V:ty>) => (
pub mod $name {
use vec::*;
use super::*;
#[inline(always)] pub fn new(c0r0: $T, c0r1: $T, c1r0: $T, c1r1: $T)
-> $name { BaseMat2::new(c0r0, c0r1, c1r0, c1r1) }
#[inline(always)] pub fn from_cols(c0: $V, c1: $V)
-> $name { BaseMat2::from_cols(c0, c1) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseMat::from_value(v) }
#[inline(always)] pub fn identity() -> $name { BaseMat::identity() }
#[inline(always)] pub fn zero() -> $name { BaseMat::zero() }
#[inline(always)] pub fn from_angle(radians: $T) -> $name { BaseMat2::from_angle(radians) }
#[inline(always)] pub fn dim() -> uint { 2 }
#[inline(always)] pub fn rows() -> uint { 2 }
#[inline(always)] pub fn cols() -> uint { 2 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
)
)
// GLSL-style type aliases, corresponding to Section 4.1.6 of the [GLSL 4.30.6 specification] // GLSL-style type aliases, corresponding to Section 4.1.6 of the [GLSL 4.30.6 specification]
// (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf). // (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf).
@ -615,18 +594,11 @@ pub type mat2 = Mat2<f32>;
// a 2×2 double-precision floating-point matrix // a 2×2 double-precision floating-point matrix
pub type dmat2 = Mat2<f64>; pub type dmat2 = Mat2<f64>;
mat2_type!(mat2<f32,vec2>)
mat2_type!(dmat2<f64,dvec2>)
// Rust-style type aliases // Rust-style type aliases
pub type Mat2f = Mat2<float>; pub type Mat2f = Mat2<float>;
pub type Mat2f32 = Mat2<f32>; pub type Mat2f32 = Mat2<f32>;
pub type Mat2f64 = Mat2<f64>; pub type Mat2f64 = Mat2<f64>;
mat2_type!(Mat2f<float,Vec2f>)
mat2_type!(Mat2f32<f32,Vec2f32>)
mat2_type!(Mat2f64<f64,Vec2f64>)
/// A 3 x 3 column major matrix /// A 3 x 3 column major matrix
/// ///
/// # Type parameters /// # Type parameters
@ -1170,55 +1142,16 @@ impl<T:Copy + Float + NumAssign> ApproxEq<T> for Mat3<T> {
} }
} }
macro_rules! mat3_type(
($name:ident <$T:ty, $V:ty>) => (
pub mod $name {
use vec::*;
use super::*;
#[inline(always)] pub fn new(c0r0: $T, c0r1: $T, c0r2: $T,
c1r0: $T, c1r1: $T, c1r2: $T,
c2r0: $T, c2r1: $T, c2r2: $T) -> $name {
BaseMat3::new(c0r0, c0r1, c0r2,
c1r0, c1r1, c1r2,
c2r0, c2r1, c2r2)
}
#[inline(always)] pub fn from_cols(c0: $V, c1: $V, c2: $V)
-> $name { BaseMat3::from_cols(c0, c1, c2) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseMat::from_value(v) }
#[inline(always)] pub fn identity() -> $name { BaseMat::identity() }
#[inline(always)] pub fn zero() -> $name { BaseMat::zero() }
#[inline(always)] pub fn from_angle_x(radians: $T) -> $name { BaseMat3::from_angle_x(radians) }
#[inline(always)] pub fn from_angle_y(radians: $T) -> $name { BaseMat3::from_angle_y(radians) }
#[inline(always)] pub fn from_angle_z(radians: $T) -> $name { BaseMat3::from_angle_z(radians) }
#[inline(always)] pub fn from_angle_xyz(radians_x: $T, radians_y: $T, radians_z: $T) -> $name { BaseMat3::from_angle_xyz(radians_x, radians_y, radians_z) }
#[inline(always)] pub fn from_angle_axis(radians: $T, axis: &$V) -> $name { BaseMat3::from_angle_axis(radians, axis) }
#[inline(always)] pub fn from_axes(x: $V, y: $V, z: $V) -> $name { BaseMat3::from_axes(x, y, z) }
#[inline(always)] pub fn look_at(dir: &$V, up: &$V) -> $name { BaseMat3::look_at(dir, up) }
#[inline(always)] pub fn dim() -> uint { 3 }
#[inline(always)] pub fn rows() -> uint { 3 }
#[inline(always)] pub fn cols() -> uint { 3 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
)
)
// a 3×3 single-precision floating-point matrix // a 3×3 single-precision floating-point matrix
pub type mat3 = Mat3<f32>; pub type mat3 = Mat3<f32>;
// a 3×3 double-precision floating-point matrix // a 3×3 double-precision floating-point matrix
pub type dmat3 = Mat3<f64>; pub type dmat3 = Mat3<f64>;
mat3_type!(mat3<f32,vec3>)
mat3_type!(dmat3<f64,dvec3>)
// Rust-style type aliases // Rust-style type aliases
pub type Mat3f = Mat3<float>; pub type Mat3f = Mat3<float>;
pub type Mat3f32 = Mat3<f32>; pub type Mat3f32 = Mat3<f32>;
pub type Mat3f64 = Mat3<f64>; pub type Mat3f64 = Mat3<f64>;
mat3_type!(Mat3f<float,Vec3f>)
mat3_type!(Mat3f32<f32,Vec3f32>)
mat3_type!(Mat3f64<f64,Vec3f64>)
/// A 4 x 4 column major matrix /// A 4 x 4 column major matrix
/// ///
/// # Type parameters /// # Type parameters
@ -1722,33 +1655,6 @@ impl<T:Copy + Float + NumAssign> ApproxEq<T> for Mat4<T> {
} }
} }
macro_rules! mat4_type(
($name:ident <$T:ty, $V:ty>) => (
pub mod $name {
use vec::*;
use super::*;
#[inline(always)] pub fn new(c0r0: $T, c0r1: $T, c0r2: $T, c0r3: $T,
c1r0: $T, c1r1: $T, c1r2: $T, c1r3: $T,
c2r0: $T, c2r1: $T, c2r2: $T, c2r3: $T,
c3r0: $T, c3r1: $T, c3r2: $T, c3r3: $T) -> $name {
BaseMat4::new(c0r0, c0r1, c0r2, c0r3,
c1r0, c1r1, c1r2, c1r3,
c2r0, c2r1, c2r2, c2r3,
c3r0, c3r1, c3r2, c3r3)
}
#[inline(always)] pub fn from_cols(c0: $V, c1: $V, c2: $V, c3: $V)
-> $name { BaseMat4::from_cols(c0, c1, c2, c3) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseMat::from_value(v) }
#[inline(always)] pub fn identity() -> $name { BaseMat::identity() }
#[inline(always)] pub fn zero() -> $name { BaseMat::zero() }
#[inline(always)] pub fn dim() -> uint { 4 }
#[inline(always)] pub fn rows() -> uint { 4 }
#[inline(always)] pub fn cols() -> uint { 4 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
)
)
// GLSL-style type aliases, corresponding to Section 4.1.6 of the [GLSL 4.30.6 specification] // GLSL-style type aliases, corresponding to Section 4.1.6 of the [GLSL 4.30.6 specification]
// (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf). // (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf).
@ -1757,14 +1663,7 @@ pub type mat4 = Mat4<f32>;
// a 4×4 double-precision floating-point matrix // a 4×4 double-precision floating-point matrix
pub type dmat4 = Mat4<f64>; pub type dmat4 = Mat4<f64>;
mat4_type!(mat4<f32,vec4>)
mat4_type!(dmat4<f64,dvec4>)
// Rust-style type aliases // Rust-style type aliases
pub type Mat4f = Mat4<float>; pub type Mat4f = Mat4<float>;
pub type Mat4f32 = Mat4<f32>; pub type Mat4f32 = Mat4<f32>;
pub type Mat4f64 = Mat4<f64>; pub type Mat4f64 = Mat4<f64>;
mat4_type!(Mat4f<float,Vec4f>)
mat4_type!(Mat4f32<f32,Vec4f32>)
mat4_type!(Mat4f64<f64,Vec4f64>)

View file

@ -360,29 +360,6 @@ impl<T:Copy + Eq + Float + NumAssign> ApproxEq<T> for Quat<T> {
} }
} }
macro_rules! quat_type(
($name:ident <$T:ty, $V:ty>) => (
pub mod $name {
use vec::*;
use super::*;
#[inline(always)] pub fn new(w: $T, xi: $T, yj: $T, zk: $T) -> $name { Quat::new(w, xi, yj, zk) }
#[inline(always)] pub fn from_sv(s: $T, v: $V) -> $name { Quat::from_sv(s, v) }
#[inline(always)] pub fn identity() -> $name { Quat::identity() }
#[inline(always)] pub fn zero() -> $name { Quat::zero() }
#[inline(always)] pub fn from_angle_x(radians: $T) -> $name { Quat::from_angle_x(radians) }
#[inline(always)] pub fn from_angle_y(radians: $T) -> $name { Quat::from_angle_y(radians) }
#[inline(always)] pub fn from_angle_z(radians: $T) -> $name { Quat::from_angle_z(radians) }
#[inline(always)] pub fn from_angle_xyz(radians_x: $T, radians_y: $T, radians_z: $T)
-> $name { Quat::from_angle_xyz(radians_x, radians_y, radians_z) }
#[inline(always)] pub fn from_angle_axis(radians: $T, axis: &$V) -> $name { Quat::from_angle_axis(radians, axis) }
#[inline(always)] pub fn from_axes(x: $V, y: $V, z: $V) -> $name { Quat::from_axes(x, y, z) }
#[inline(always)] pub fn look_at(dir: &$V, up: &$V) -> $name { Quat::look_at(dir, up) }
#[inline(always)] pub fn dim() -> uint { 4 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
)
// GLSL-style type aliases for quaternions. These are not present in the GLSL // GLSL-style type aliases for quaternions. These are not present in the GLSL
// specification, but they roughly follow the same nomenclature. // specification, but they roughly follow the same nomenclature.
@ -391,14 +368,7 @@ type quat = Quat<f32>;
/// a double-precision floating-point quaternion /// a double-precision floating-point quaternion
type dquat = Quat<f64>; type dquat = Quat<f64>;
quat_type!(quat<f32,vec3>)
quat_type!(dquat<f64,dvec3>)
// Rust-style type aliases // Rust-style type aliases
type Quatf = Quat<float>; type Quatf = Quat<float>;
type Quatf32 = Quat<f32>; type Quatf32 = Quat<f32>;
type Quatf64 = Quat<f64>; type Quatf64 = Quat<f64>;
quat_type!(Quatf<float,Vec3f>)
quat_type!(Quatf32<f32,Vec3f32>)
quat_type!(Quatf64<f64,Vec3f64>)

View file

@ -681,31 +681,6 @@ impl BoolVec for Vec2<bool> {
} }
} }
macro_rules! vec2_type(
($name:ident <bool>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: bool, y: bool) -> $name { BaseVec2::new(x, y) }
#[inline(always)] pub fn from_value(v: bool) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn dim() -> uint { 2 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
($name:ident <$T:ty>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: $T, y: $T) -> $name { BaseVec2::new(x, y) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn identity() -> $name { NumVec::identity() }
#[inline(always)] pub fn zero() -> $name { NumVec::zero() }
#[inline(always)] pub fn unit_x() -> $name { NumVec2::unit_x() }
#[inline(always)] pub fn unit_y() -> $name { NumVec2::unit_y() }
#[inline(always)] pub fn dim() -> uint { 2 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
)
// GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification] // GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification]
// (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf). // (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf).
@ -720,12 +695,6 @@ pub type ivec2 = Vec2<i32>;
// a two-component unsigned integer vector // a two-component unsigned integer vector
pub type uvec2 = Vec2<u32>; pub type uvec2 = Vec2<u32>;
vec2_type!(vec2<f32>)
vec2_type!(dvec2<f64>)
vec2_type!(bvec2<bool>)
vec2_type!(ivec2<i32>)
vec2_type!(uvec2<u32>)
// Rust-style type aliases // Rust-style type aliases
pub type Vec2f = Vec2<float>; pub type Vec2f = Vec2<float>;
pub type Vec2f32 = Vec2<f32>; pub type Vec2f32 = Vec2<f32>;
@ -742,21 +711,6 @@ pub type Vec2u32 = Vec2<u32>;
pub type Vec2u64 = Vec2<u64>; pub type Vec2u64 = Vec2<u64>;
pub type Vec2b = Vec2<bool>; pub type Vec2b = Vec2<bool>;
vec2_type!(Vec2f<float>)
vec2_type!(Vec2f32<f32>)
vec2_type!(Vec2f64<f64>)
vec2_type!(Vec2i<int>)
vec2_type!(Vec2i8<i8>)
vec2_type!(Vec2i16<i16>)
vec2_type!(Vec2i32<i32>)
vec2_type!(Vec2i64<i64>)
vec2_type!(Vec2u<uint>)
vec2_type!(Vec2u8<u8>)
vec2_type!(Vec2u16<u16>)
vec2_type!(Vec2u32<u32>)
vec2_type!(Vec2u64<u64>)
vec2_type!(Vec2b<bool>)
/// A 3-dimensional vector /// A 3-dimensional vector
/// ///
/// # Type parameters /// # Type parameters
@ -1083,32 +1037,6 @@ impl BoolVec for Vec3<bool> {
} }
} }
macro_rules! vec3_type(
($name:ident <bool>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: bool, y: bool, z: bool) -> $name { BaseVec3::new(x, y, z) }
#[inline(always)] pub fn from_value(v: bool) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn dim() -> uint { 3 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
($name:ident <$T:ty>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: $T, y: $T, z: $T) -> $name { BaseVec3::new(x, y, z) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn identity() -> $name { NumVec::identity() }
#[inline(always)] pub fn zero() -> $name { NumVec::zero() }
#[inline(always)] pub fn unit_x() -> $name { NumVec3::unit_x() }
#[inline(always)] pub fn unit_y() -> $name { NumVec3::unit_y() }
#[inline(always)] pub fn unit_z() -> $name { NumVec3::unit_z() }
#[inline(always)] pub fn dim() -> uint { 3 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
)
// GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification] // GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification]
// (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf). // (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf).
@ -1123,12 +1051,6 @@ pub type ivec3 = Vec3<i32>;
// a three-component unsigned integer vector // a three-component unsigned integer vector
pub type uvec3 = Vec3<u32>; pub type uvec3 = Vec3<u32>;
vec3_type!(vec3<f32>)
vec3_type!(dvec3<f64>)
vec3_type!(bvec3<bool>)
vec3_type!(ivec3<i32>)
vec3_type!(uvec3<u32>)
// Rust-style type aliases // Rust-style type aliases
pub type Vec3f = Vec3<float>; pub type Vec3f = Vec3<float>;
pub type Vec3f32 = Vec3<f32>; pub type Vec3f32 = Vec3<f32>;
@ -1145,21 +1067,6 @@ pub type Vec3u32 = Vec3<u32>;
pub type Vec3u64 = Vec3<u64>; pub type Vec3u64 = Vec3<u64>;
pub type Vec3b = Vec3<bool>; pub type Vec3b = Vec3<bool>;
vec3_type!(Vec3f<float>)
vec3_type!(Vec3f32<f32>)
vec3_type!(Vec3f64<f64>)
vec3_type!(Vec3i<int>)
vec3_type!(Vec3i8<i8>)
vec3_type!(Vec3i16<i16>)
vec3_type!(Vec3i32<i32>)
vec3_type!(Vec3i64<i64>)
vec3_type!(Vec3u<uint>)
vec3_type!(Vec3u8<u8>)
vec3_type!(Vec3u16<u16>)
vec3_type!(Vec3u32<u32>)
vec3_type!(Vec3u64<u64>)
vec3_type!(Vec3b<bool>)
/// A 4-dimensional vector /// A 4-dimensional vector
/// ///
/// # Type parameters /// # Type parameters
@ -1485,33 +1392,6 @@ impl BoolVec for Vec4<bool> {
} }
} }
macro_rules! vec4_type(
($name:ident <bool>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: bool, y: bool, z: bool, w: bool) -> $name { BaseVec4::new(x, y, z, w) }
#[inline(always)] pub fn from_value(v: bool) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn dim() -> uint { 4 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
($name:ident <$T:ty>) => (
pub mod $name {
use super::*;
#[inline(always)] pub fn new(x: $T, y: $T, z: $T, w: $T) -> $name { BaseVec4::new(x, y, z, w) }
#[inline(always)] pub fn from_value(v: $T) -> $name { BaseVec::from_value(v) }
#[inline(always)] pub fn identity() -> $name { NumVec::identity() }
#[inline(always)] pub fn zero() -> $name { NumVec::zero() }
#[inline(always)] pub fn unit_x() -> $name { NumVec4::unit_x() }
#[inline(always)] pub fn unit_y() -> $name { NumVec4::unit_y() }
#[inline(always)] pub fn unit_z() -> $name { NumVec4::unit_z() }
#[inline(always)] pub fn unit_w() -> $name { NumVec4::unit_w() }
#[inline(always)] pub fn dim() -> uint { 4 }
#[inline(always)] pub fn size_of() -> uint { sys::size_of::<$name>() }
}
);
)
// GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification] // GLSL-style type aliases, corresponding to Section 4.1.5 of the [GLSL 4.30.6 specification]
// (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf). // (http://www.opengl.org/registry/doc/GLSLangSpec.4.30.6.pdf).
@ -1526,12 +1406,6 @@ pub type ivec4 = Vec4<i32>;
// a four-component unsigned integer vector // a four-component unsigned integer vector
pub type uvec4 = Vec4<u32>; pub type uvec4 = Vec4<u32>;
vec4_type!(vec4<f32>)
vec4_type!(dvec4<f64>)
vec4_type!(bvec4<bool>)
vec4_type!(ivec4<i32>)
vec4_type!(uvec4<u32>)
// Rust-style type aliases // Rust-style type aliases
pub type Vec4f = Vec4<float>; pub type Vec4f = Vec4<float>;
pub type Vec4f32 = Vec4<f32>; pub type Vec4f32 = Vec4<f32>;
@ -1547,18 +1421,3 @@ pub type Vec4u16 = Vec4<u16>;
pub type Vec4u32 = Vec4<u32>; pub type Vec4u32 = Vec4<u32>;
pub type Vec4u64 = Vec4<u64>; pub type Vec4u64 = Vec4<u64>;
pub type Vec4b = Vec4<bool>; pub type Vec4b = Vec4<bool>;
vec4_type!(Vec4f<float>)
vec4_type!(Vec4f32<f32>)
vec4_type!(Vec4f64<f64>)
vec4_type!(Vec4i<int>)
vec4_type!(Vec4i8<i8>)
vec4_type!(Vec4i16<i16>)
vec4_type!(Vec4i32<i32>)
vec4_type!(Vec4i64<i64>)
vec4_type!(Vec4u<uint>)
vec4_type!(Vec4u8<u8>)
vec4_type!(Vec4u16<u16>)
vec4_type!(Vec4u32<u32>)
vec4_type!(Vec4u64<u64>)
vec4_type!(Vec4b<bool>)