Updated to latest Rust: priv/pub
This commit is contained in:
parent
0aa401109a
commit
18fe0e74b5
17 changed files with 66 additions and 66 deletions
|
@ -72,8 +72,8 @@ pub trait Aabb
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Aabb2<S> {
|
||||
min: Point2<S>,
|
||||
max: Point2<S>,
|
||||
pub min: Point2<S>,
|
||||
pub max: Point2<S>,
|
||||
}
|
||||
|
||||
impl<S: PartOrdPrim> Aabb2<S> {
|
||||
|
@ -103,8 +103,8 @@ impl<S: fmt::Show> fmt::Show for Aabb2<S> {
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Aabb3<S> {
|
||||
min: Point3<S>,
|
||||
max: Point3<S>,
|
||||
pub min: Point3<S>,
|
||||
pub max: Point3<S>,
|
||||
}
|
||||
|
||||
impl<S: PartOrdPrim> Aabb3<S> {
|
||||
|
|
|
@ -23,8 +23,8 @@ use std::num::{One, one, Zero, zero, cast};
|
|||
|
||||
use approx::ApproxEq;
|
||||
|
||||
#[deriving(Clone, Eq, Ord, Hash)] pub struct Rad<S> { s: S }
|
||||
#[deriving(Clone, Eq, Ord, Hash)] pub struct Deg<S> { s: S }
|
||||
#[deriving(Clone, Eq, Ord, Hash)] pub struct Rad<S> { pub s: S }
|
||||
#[deriving(Clone, Eq, Ord, Hash)] pub struct Deg<S> { pub s: S }
|
||||
|
||||
#[inline] pub fn rad<S: Float>(s: S) -> Rad<S> { Rad { s: s } }
|
||||
#[inline] pub fn deg<S: Float>(s: S) -> Deg<S> { Deg { s: s } }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#[macro_escape];
|
||||
#![macro_escape]
|
||||
|
||||
use std::slice::{Items, MutItems};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ use vector::Vec3;
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Cylinder<S> {
|
||||
center: Point3<S>,
|
||||
axis: Vec3<S>,
|
||||
radius: S,
|
||||
pub center: Point3<S>,
|
||||
pub axis: Vec3<S>,
|
||||
pub radius: S,
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ use partial_ord::PartOrdFloat;
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Frustum<S> {
|
||||
left: Plane<S>,
|
||||
right: Plane<S>,
|
||||
bottom: Plane<S>,
|
||||
top: Plane<S>,
|
||||
near: Plane<S>,
|
||||
far: Plane<S>,
|
||||
pub left: Plane<S>,
|
||||
pub right: Plane<S>,
|
||||
pub bottom: Plane<S>,
|
||||
pub top: Plane<S>,
|
||||
pub near: Plane<S>,
|
||||
pub far: Plane<S>,
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>>
|
||||
|
@ -60,12 +60,12 @@ Frustum<S> {
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct FrustumPoints<S> {
|
||||
near_top_left: Point3<S>,
|
||||
near_top_right: Point3<S>,
|
||||
near_bottom_left: Point3<S>,
|
||||
near_bottom_right: Point3<S>,
|
||||
far_top_left: Point3<S>,
|
||||
far_top_right: Point3<S>,
|
||||
far_bottom_left: Point3<S>,
|
||||
far_bottom_right: Point3<S>,
|
||||
pub near_top_left: Point3<S>,
|
||||
pub near_top_right: Point3<S>,
|
||||
pub near_bottom_left: Point3<S>,
|
||||
pub near_bottom_right: Point3<S>,
|
||||
pub far_top_left: Point3<S>,
|
||||
pub far_top_right: Point3<S>,
|
||||
pub far_bottom_left: Point3<S>,
|
||||
pub far_bottom_right: Point3<S>,
|
||||
}
|
||||
|
|
|
@ -13,14 +13,14 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#[crate_id="cgmath#0.1"];
|
||||
#[crate_type = "rlib"];
|
||||
#[crate_type = "dylib"];
|
||||
#[comment = "A mathematics library for computer graphics."];
|
||||
#[license = "ASL2"];
|
||||
#![crate_id="cgmath#0.1"]
|
||||
#![crate_type = "rlib"]
|
||||
#![crate_type = "dylib"]
|
||||
#![comment = "A mathematics library for computer graphics."]
|
||||
#![license = "ASL2"]
|
||||
|
||||
#[feature(globs)];
|
||||
#[feature(macro_rules)];
|
||||
#![feature(globs)]
|
||||
#![feature(macro_rules)]
|
||||
|
||||
pub mod array;
|
||||
pub mod matrix;
|
||||
|
|
|
@ -29,15 +29,15 @@ use partial_ord::PartOrdFloat;
|
|||
|
||||
/// A 2 x 2, column major matrix
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Mat2<S> { x: Vec2<S>, y: Vec2<S> }
|
||||
pub struct Mat2<S> { pub x: Vec2<S>, pub y: Vec2<S> }
|
||||
|
||||
/// A 3 x 3, column major matrix
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Mat3<S> { x: Vec3<S>, y: Vec3<S>, z: Vec3<S> }
|
||||
pub struct Mat3<S> { pub x: Vec3<S>, pub y: Vec3<S>, pub z: Vec3<S> }
|
||||
|
||||
/// A 4 x 4, column major matrix
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Mat4<S> { x: Vec4<S>, y: Vec4<S>, z: Vec4<S>, w: Vec4<S> }
|
||||
pub struct Mat4<S> { pub x: Vec4<S>, pub y: Vec4<S>, pub z: Vec4<S>, pub w: Vec4<S> }
|
||||
|
||||
|
||||
impl<S: Primitive> Mat2<S> {
|
||||
|
|
|
@ -20,14 +20,14 @@ use vector::{Vec2, Vec3};
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Obb2<S> {
|
||||
center: Point2<S>,
|
||||
axis: Vec2<S>,
|
||||
extents: Vec2<S>,
|
||||
pub center: Point2<S>,
|
||||
pub axis: Vec2<S>,
|
||||
pub extents: Vec2<S>,
|
||||
}
|
||||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Obb3<S> {
|
||||
center: Point3<S>,
|
||||
axis: Vec3<S>,
|
||||
extents: Vec3<S>,
|
||||
pub center: Point3<S>,
|
||||
pub axis: Vec3<S>,
|
||||
pub extents: Vec3<S>,
|
||||
}
|
||||
|
|
|
@ -43,8 +43,8 @@ use partial_ord::PartOrdFloat;
|
|||
/// superfluous negations (see _Real Time Collision Detection_, p. 55).
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Plane<S> {
|
||||
n: Vec3<S>,
|
||||
d: S,
|
||||
pub n: Vec3<S>,
|
||||
pub d: S,
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>>
|
||||
|
|
|
@ -26,11 +26,11 @@ use partial_ord::PartOrdPrim;
|
|||
|
||||
/// A point in 2-dimensional space.
|
||||
#[deriving(Eq, Clone, Hash)]
|
||||
pub struct Point2<S> { x: S, y: S }
|
||||
pub struct Point2<S> { pub x: S, pub y: S }
|
||||
|
||||
/// A point in 3-dimensional space.
|
||||
#[deriving(Eq, Clone, Hash)]
|
||||
pub struct Point3<S> { x: S, y: S, z: S }
|
||||
pub struct Point3<S> { pub x: S, pub y: S, pub z: S }
|
||||
|
||||
|
||||
impl<S: Num> Point2<S> {
|
||||
|
|
|
@ -71,10 +71,10 @@ pub trait Projection<S>: ToMat4<S> {
|
|||
/// A perspective projection based on a vertical field-of-view angle.
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct PerspectiveFov<S, A> {
|
||||
fovy: A,
|
||||
aspect: S,
|
||||
near: S,
|
||||
far: S,
|
||||
pub fovy: A,
|
||||
pub aspect: S,
|
||||
pub near: S,
|
||||
pub far: S,
|
||||
}
|
||||
|
||||
impl<S: Float, A: Angle<S>> PerspectiveFov<S, A> {
|
||||
|
@ -146,9 +146,9 @@ impl<S: Float, A: Angle<S>> ToMat4<S> for PerspectiveFov<S, A> {
|
|||
/// A perspective projection with arbitrary left/right/bottom/top distances
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Perspective<S> {
|
||||
left: S, right: S,
|
||||
bottom: S, top: S,
|
||||
near: S, far: S,
|
||||
pub left: S, right: S,
|
||||
pub bottom: S, top: S,
|
||||
pub near: S, far: S,
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>>
|
||||
|
@ -197,9 +197,9 @@ impl<S: Float> ToMat4<S> for Perspective<S> {
|
|||
/// An orthographic projection with arbitrary left/right/bottom/top distances
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Ortho<S> {
|
||||
left: S, right: S,
|
||||
bottom: S, top: S,
|
||||
near: S, far: S,
|
||||
pub left: S, right: S,
|
||||
pub bottom: S, top: S,
|
||||
pub near: S, far: S,
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>>
|
||||
|
|
|
@ -27,7 +27,7 @@ use partial_ord::PartOrdFloat;
|
|||
|
||||
/// A quaternion in scalar/vector form
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Quat<S> { s: S, v: Vec3<S> }
|
||||
pub struct Quat<S> { pub s: S, pub v: Vec3<S> }
|
||||
|
||||
array!(impl<S> Quat<S> -> [S, ..4] _4)
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ use vector::{Vector, Vec2, Vec3};
|
|||
#[deriving(Clone, Eq)]
|
||||
pub struct Ray<P,V>
|
||||
{
|
||||
origin: P,
|
||||
direction: V,
|
||||
pub origin: P,
|
||||
pub direction: V,
|
||||
}
|
||||
|
||||
impl
|
||||
|
|
|
@ -135,7 +135,7 @@ pub trait Rotation3
|
|||
/// to a subset of those implemented on `Mat2`.
|
||||
#[deriving(Eq, Clone)]
|
||||
pub struct Basis2<S> {
|
||||
priv mat: Mat2<S>
|
||||
mat: Mat2<S>
|
||||
}
|
||||
|
||||
impl<S: Float> Basis2<S> {
|
||||
|
@ -213,7 +213,7 @@ Rotation2<S> for Basis2<S> {
|
|||
/// been restricted to a subeset of those implemented on `Mat3`.
|
||||
#[deriving(Eq, Clone)]
|
||||
pub struct Basis3<S> {
|
||||
priv mat: Mat3<S>
|
||||
mat: Mat3<S>
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>>
|
||||
|
|
|
@ -30,8 +30,8 @@ fn cast<T: NumCast, U: NumCast>(n: T) -> U {
|
|||
|
||||
#[deriving(Clone, Eq)]
|
||||
pub struct Sphere<S> {
|
||||
center: Point3<S>,
|
||||
radius: S,
|
||||
pub center: Point3<S>,
|
||||
pub radius: S,
|
||||
}
|
||||
|
||||
impl<S: PartOrdFloat<S>> Intersect<Option<Point3<S>>> for (Sphere<S>, Ray3<S>) {
|
||||
|
|
|
@ -71,9 +71,9 @@ pub trait Transform
|
|||
/// A generic transformation consisting of a rotation,
|
||||
/// displacement vector and scale amount.
|
||||
pub struct Decomposed<S,V,R> {
|
||||
scale: S,
|
||||
rot: R,
|
||||
disp: V,
|
||||
pub scale: S,
|
||||
pub rot: R,
|
||||
pub disp: V,
|
||||
}
|
||||
|
||||
impl
|
||||
|
@ -169,7 +169,7 @@ fmt::Show for Decomposed<S,Vec3<S>,R> {
|
|||
|
||||
/// A homogeneous transformation matrix.
|
||||
pub struct AffineMatrix3<S> {
|
||||
mat: Mat4<S>,
|
||||
pub mat: Mat4<S>,
|
||||
}
|
||||
|
||||
impl<S : PartOrdFloat<S>>
|
||||
|
|
|
@ -81,7 +81,7 @@ pub trait Vector
|
|||
macro_rules! vec(
|
||||
($Self:ident <$S:ident> { $($field:ident),+ }, $n:expr) => (
|
||||
#[deriving(Eq, Clone, Hash)]
|
||||
pub struct $Self<S> { $($field: S),+ }
|
||||
pub struct $Self<S> { $(pub $field: S),+ }
|
||||
|
||||
impl<$S: Primitive> $Self<$S> {
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue