diff --git a/rtchallenge/src/lib.rs b/rtchallenge/src/lib.rs index 937090f..a20a328 100644 --- a/rtchallenge/src/lib.rs +++ b/rtchallenge/src/lib.rs @@ -40,7 +40,10 @@ pub use float::Float; pub mod prelude { pub use crate::{ + materials::{Material, MaterialBuilder}, matrices::{identity, rotation_x, rotation_y, rotation_z, scaling, shearing, translation}, + shapes::{plane, sphere, test_shape}, + transformations::view_transform, tuples::{point, vector, Color}, }; } diff --git a/rtchallenge/src/shapes.rs b/rtchallenge/src/shapes.rs index 682b24b..12be159 100644 --- a/rtchallenge/src/shapes.rs +++ b/rtchallenge/src/shapes.rs @@ -53,6 +53,40 @@ pub struct Shape { geometry: Geometry, } +/// Short hand for creating a Shape with a plane geometry. +/// +/// # Examples +/// ``` +/// use rtchallenge::shapes::{plane, Shape}; +/// +/// assert_eq!(plane(), Shape::plane()); +/// ``` +pub fn plane() -> Shape { + Shape::plane() +} +/// Short hand for creating a Shape with a sphere geometry. +/// +/// # Examples +/// ``` +/// use rtchallenge::shapes::{sphere, Shape}; +/// +/// assert_eq!(sphere(), Shape::sphere()); +/// ``` +pub fn sphere() -> Shape { + Shape::sphere() +} +/// Short hand for creating a Shape with a test shape geometry. +/// +/// # Examples +/// ``` +/// use rtchallenge::shapes::{test_shape, Shape}; +/// +/// assert_eq!(test_shape(), Shape::test_shape()); +/// ``` +pub fn test_shape() -> Shape { + Shape::test_shape() +} + impl ShapeBuilder { fn default_inverse_transform(&self) -> Result { Ok(self.transform.unwrap_or(Matrix4x4::identity()).inverse())