diff --git a/src/main.rs b/src/main.rs index d598f32..3768197 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,10 +1,6 @@ mod math; mod lerp; mod float4; -mod vector; -mod point; -mod normal; -mod matrix; fn main() { println!("Hello, world!"); diff --git a/src/matrix.rs b/src/math/matrix.rs similarity index 100% rename from src/matrix.rs rename to src/math/matrix.rs diff --git a/src/math.rs b/src/math/mod.rs similarity index 68% rename from src/math.rs rename to src/math/mod.rs index 6dbd23a..57afcb2 100644 --- a/src/math.rs +++ b/src/math/mod.rs @@ -1,5 +1,15 @@ #![allow(dead_code)] +mod vector; +mod normal; +mod point; +mod matrix; + +pub use self::vector::Vector; +pub use self::normal::Normal; +pub use self::point::Point; +pub use self::matrix::Matrix4x4; + /// Trait for calculating dot products. pub trait DotProduct { diff --git a/src/normal.rs b/src/math/normal.rs similarity index 98% rename from src/normal.rs rename to src/math/normal.rs index 1a16f8d..9a9cb5d 100644 --- a/src/normal.rs +++ b/src/math/normal.rs @@ -4,9 +4,10 @@ use std::ops::{Index, IndexMut, Add, Sub, Mul, Div}; use std::cmp::PartialEq; use lerp::Lerp; -use math::{DotProduct, CrossProduct}; use float4::Float4; -use matrix::Matrix4x4; + +use super::{DotProduct, CrossProduct}; +use super::Matrix4x4; /// A surface normal in 3d homogeneous space. #[derive(Debug, Copy, Clone)] @@ -138,9 +139,8 @@ impl CrossProduct for Normal { #[cfg(test)] mod tests { use super::*; - use math::*; + use super::super::{Matrix4x4, CrossProduct, DotProduct}; use lerp::Lerp; - use matrix::Matrix4x4; #[test] fn add() { diff --git a/src/point.rs b/src/math/point.rs similarity index 98% rename from src/point.rs rename to src/math/point.rs index 57f921e..a123f2f 100644 --- a/src/point.rs +++ b/src/math/point.rs @@ -5,8 +5,9 @@ use std::cmp::PartialEq; use lerp::Lerp; use float4::Float4; -use vector::Vector; -use matrix::Matrix4x4; + +use super::Vector; +use super::Matrix4x4; /// A position in 3d homogeneous space. #[derive(Debug, Copy, Clone)] @@ -96,9 +97,8 @@ impl Lerp for Point { #[cfg(test)] mod tests { use super::*; - use vector::Vector; + use super::super::{Vector, Matrix4x4}; use lerp::Lerp; - use matrix::Matrix4x4; #[test] fn norm() { diff --git a/src/vector.rs b/src/math/vector.rs similarity index 98% rename from src/vector.rs rename to src/math/vector.rs index 91caeb1..13ebdc0 100644 --- a/src/vector.rs +++ b/src/math/vector.rs @@ -4,9 +4,10 @@ use std::ops::{Index, IndexMut, Add, Sub, Mul, Div}; use std::cmp::PartialEq; use lerp::Lerp; -use math::{DotProduct, CrossProduct}; use float4::Float4; -use matrix::Matrix4x4; + +use super::{DotProduct, CrossProduct}; +use super::Matrix4x4; /// A direction vector in 3d homogeneous space. #[derive(Debug, Copy, Clone)] @@ -138,9 +139,8 @@ impl CrossProduct for Vector { #[cfg(test)] mod tests { use super::*; - use math::*; + use super::super::{Matrix4x4, CrossProduct, DotProduct}; use lerp::Lerp; - use matrix::Matrix4x4; #[test] fn add() {