Merge pull request #58 from ozkriff/master

Updated to latest Rust: priv/pub
This commit is contained in:
Andrey Lesnikov 2014-04-01 15:09:55 +04:00
commit 12e01894b7
17 changed files with 66 additions and 66 deletions

View file

@ -72,8 +72,8 @@ pub trait Aabb
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Aabb2<S> { pub struct Aabb2<S> {
min: Point2<S>, pub min: Point2<S>,
max: Point2<S>, pub max: Point2<S>,
} }
impl<S: PartOrdPrim> Aabb2<S> { impl<S: PartOrdPrim> Aabb2<S> {
@ -103,8 +103,8 @@ impl<S: fmt::Show> fmt::Show for Aabb2<S> {
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Aabb3<S> { pub struct Aabb3<S> {
min: Point3<S>, pub min: Point3<S>,
max: Point3<S>, pub max: Point3<S>,
} }
impl<S: PartOrdPrim> Aabb3<S> { impl<S: PartOrdPrim> Aabb3<S> {

View file

@ -23,8 +23,8 @@ use std::num::{One, one, Zero, zero, cast};
use approx::ApproxEq; use approx::ApproxEq;
#[deriving(Clone, Eq, Ord, Hash)] pub struct Rad<S> { s: S } #[deriving(Clone, Eq, Ord, Hash)] pub struct Rad<S> { pub s: S }
#[deriving(Clone, Eq, Ord, Hash)] pub struct Deg<S> { 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 rad<S: Float>(s: S) -> Rad<S> { Rad { s: s } }
#[inline] pub fn deg<S: Float>(s: S) -> Deg<S> { Deg { s: s } } #[inline] pub fn deg<S: Float>(s: S) -> Deg<S> { Deg { s: s } }

View file

@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#[macro_escape]; #![macro_escape]
use std::slice::{Items, MutItems}; use std::slice::{Items, MutItems};

View file

@ -20,7 +20,7 @@ use vector::Vec3;
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Cylinder<S> { pub struct Cylinder<S> {
center: Point3<S>, pub center: Point3<S>,
axis: Vec3<S>, pub axis: Vec3<S>,
radius: S, pub radius: S,
} }

View file

@ -23,12 +23,12 @@ use partial_ord::PartOrdFloat;
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Frustum<S> { pub struct Frustum<S> {
left: Plane<S>, pub left: Plane<S>,
right: Plane<S>, pub right: Plane<S>,
bottom: Plane<S>, pub bottom: Plane<S>,
top: Plane<S>, pub top: Plane<S>,
near: Plane<S>, pub near: Plane<S>,
far: Plane<S>, pub far: Plane<S>,
} }
impl<S: PartOrdFloat<S>> impl<S: PartOrdFloat<S>>
@ -60,12 +60,12 @@ Frustum<S> {
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct FrustumPoints<S> { pub struct FrustumPoints<S> {
near_top_left: Point3<S>, pub near_top_left: Point3<S>,
near_top_right: Point3<S>, pub near_top_right: Point3<S>,
near_bottom_left: Point3<S>, pub near_bottom_left: Point3<S>,
near_bottom_right: Point3<S>, pub near_bottom_right: Point3<S>,
far_top_left: Point3<S>, pub far_top_left: Point3<S>,
far_top_right: Point3<S>, pub far_top_right: Point3<S>,
far_bottom_left: Point3<S>, pub far_bottom_left: Point3<S>,
far_bottom_right: Point3<S>, pub far_bottom_right: Point3<S>,
} }

View file

@ -13,14 +13,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#[crate_id="cgmath#0.1"]; #![crate_id="cgmath#0.1"]
#[crate_type = "rlib"]; #![crate_type = "rlib"]
#[crate_type = "dylib"]; #![crate_type = "dylib"]
#[comment = "A mathematics library for computer graphics."]; #![comment = "A mathematics library for computer graphics."]
#[license = "ASL2"]; #![license = "ASL2"]
#[feature(globs)]; #![feature(globs)]
#[feature(macro_rules)]; #![feature(macro_rules)]
pub mod array; pub mod array;
pub mod matrix; pub mod matrix;

View file

@ -29,15 +29,15 @@ use partial_ord::PartOrdFloat;
/// A 2 x 2, column major matrix /// A 2 x 2, column major matrix
#[deriving(Clone, Eq)] #[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 /// A 3 x 3, column major matrix
#[deriving(Clone, Eq)] #[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 /// A 4 x 4, column major matrix
#[deriving(Clone, Eq)] #[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> { impl<S: Primitive> Mat2<S> {

View file

@ -20,14 +20,14 @@ use vector::{Vec2, Vec3};
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Obb2<S> { pub struct Obb2<S> {
center: Point2<S>, pub center: Point2<S>,
axis: Vec2<S>, pub axis: Vec2<S>,
extents: Vec2<S>, pub extents: Vec2<S>,
} }
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Obb3<S> { pub struct Obb3<S> {
center: Point3<S>, pub center: Point3<S>,
axis: Vec3<S>, pub axis: Vec3<S>,
extents: Vec3<S>, pub extents: Vec3<S>,
} }

View file

@ -43,8 +43,8 @@ use partial_ord::PartOrdFloat;
/// superfluous negations (see _Real Time Collision Detection_, p. 55). /// superfluous negations (see _Real Time Collision Detection_, p. 55).
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Plane<S> { pub struct Plane<S> {
n: Vec3<S>, pub n: Vec3<S>,
d: S, pub d: S,
} }
impl<S: PartOrdFloat<S>> impl<S: PartOrdFloat<S>>

View file

@ -26,11 +26,11 @@ use partial_ord::PartOrdPrim;
/// A point in 2-dimensional space. /// A point in 2-dimensional space.
#[deriving(Eq, Clone, Hash)] #[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. /// A point in 3-dimensional space.
#[deriving(Eq, Clone, Hash)] #[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> { impl<S: Num> Point2<S> {

View file

@ -71,10 +71,10 @@ pub trait Projection<S>: ToMat4<S> {
/// A perspective projection based on a vertical field-of-view angle. /// A perspective projection based on a vertical field-of-view angle.
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct PerspectiveFov<S, A> { pub struct PerspectiveFov<S, A> {
fovy: A, pub fovy: A,
aspect: S, pub aspect: S,
near: S, pub near: S,
far: S, pub far: S,
} }
impl<S: Float, A: Angle<S>> PerspectiveFov<S, A> { 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 /// A perspective projection with arbitrary left/right/bottom/top distances
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Perspective<S> { pub struct Perspective<S> {
left: S, right: S, pub left: S, right: S,
bottom: S, top: S, pub bottom: S, top: S,
near: S, far: S, pub near: S, far: S,
} }
impl<S: PartOrdFloat<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 /// An orthographic projection with arbitrary left/right/bottom/top distances
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Ortho<S> { pub struct Ortho<S> {
left: S, right: S, pub left: S, right: S,
bottom: S, top: S, pub bottom: S, top: S,
near: S, far: S, pub near: S, far: S,
} }
impl<S: PartOrdFloat<S>> impl<S: PartOrdFloat<S>>

View file

@ -27,7 +27,7 @@ use partial_ord::PartOrdFloat;
/// A quaternion in scalar/vector form /// A quaternion in scalar/vector form
#[deriving(Clone, Eq)] #[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) array!(impl<S> Quat<S> -> [S, ..4] _4)

View file

@ -20,8 +20,8 @@ use vector::{Vector, Vec2, Vec3};
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Ray<P,V> pub struct Ray<P,V>
{ {
origin: P, pub origin: P,
direction: V, pub direction: V,
} }
impl impl

View file

@ -135,7 +135,7 @@ pub trait Rotation3
/// to a subset of those implemented on `Mat2`. /// to a subset of those implemented on `Mat2`.
#[deriving(Eq, Clone)] #[deriving(Eq, Clone)]
pub struct Basis2<S> { pub struct Basis2<S> {
priv mat: Mat2<S> mat: Mat2<S>
} }
impl<S: Float> Basis2<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`. /// been restricted to a subeset of those implemented on `Mat3`.
#[deriving(Eq, Clone)] #[deriving(Eq, Clone)]
pub struct Basis3<S> { pub struct Basis3<S> {
priv mat: Mat3<S> mat: Mat3<S>
} }
impl<S: PartOrdFloat<S>> impl<S: PartOrdFloat<S>>

View file

@ -30,8 +30,8 @@ fn cast<T: NumCast, U: NumCast>(n: T) -> U {
#[deriving(Clone, Eq)] #[deriving(Clone, Eq)]
pub struct Sphere<S> { pub struct Sphere<S> {
center: Point3<S>, pub center: Point3<S>,
radius: S, pub radius: S,
} }
impl<S: PartOrdFloat<S>> Intersect<Option<Point3<S>>> for (Sphere<S>, Ray3<S>) { impl<S: PartOrdFloat<S>> Intersect<Option<Point3<S>>> for (Sphere<S>, Ray3<S>) {

View file

@ -71,9 +71,9 @@ pub trait Transform
/// A generic transformation consisting of a rotation, /// A generic transformation consisting of a rotation,
/// displacement vector and scale amount. /// displacement vector and scale amount.
pub struct Decomposed<S,V,R> { pub struct Decomposed<S,V,R> {
scale: S, pub scale: S,
rot: R, pub rot: R,
disp: V, pub disp: V,
} }
impl impl
@ -169,7 +169,7 @@ fmt::Show for Decomposed<S,Vec3<S>,R> {
/// A homogeneous transformation matrix. /// A homogeneous transformation matrix.
pub struct AffineMatrix3<S> { pub struct AffineMatrix3<S> {
mat: Mat4<S>, pub mat: Mat4<S>,
} }
impl<S : PartOrdFloat<S>> impl<S : PartOrdFloat<S>>

View file

@ -81,7 +81,7 @@ pub trait Vector
macro_rules! vec( macro_rules! vec(
($Self:ident <$S:ident> { $($field:ident),+ }, $n:expr) => ( ($Self:ident <$S:ident> { $($field:ident),+ }, $n:expr) => (
#[deriving(Eq, Clone, Hash)] #[deriving(Eq, Clone, Hash)]
pub struct $Self<S> { $($field: S),+ } pub struct $Self<S> { $(pub $field: S),+ }
impl<$S: Primitive> $Self<$S> { impl<$S: Primitive> $Self<$S> {
#[inline] #[inline]