diff options
Diffstat (limited to 'src/scene')
-rw-r--r-- | src/scene/mod.rs | 3 | ||||
-rw-r--r-- | src/scene/shapes/mod.rs | 12 | ||||
-rw-r--r-- | src/scene/shapes/sphere.rs | 16 |
3 files changed, 31 insertions, 0 deletions
diff --git a/src/scene/mod.rs b/src/scene/mod.rs new file mode 100644 index 0000000..3482bb6 --- /dev/null +++ b/src/scene/mod.rs @@ -0,0 +1,3 @@ +mod shapes; + + diff --git a/src/scene/shapes/mod.rs b/src/scene/shapes/mod.rs new file mode 100644 index 0000000..76fb6f2 --- /dev/null +++ b/src/scene/shapes/mod.rs @@ -0,0 +1,12 @@ +mod sphere; + +pub use sphere::Sphere; + +use crate::core::Ray; +use crate::Float; + +trait Shape { + // + fn intersect(ray: Ray) -> Float; + fn intersect_ +} diff --git a/src/scene/shapes/sphere.rs b/src/scene/shapes/sphere.rs new file mode 100644 index 0000000..9598422 --- /dev/null +++ b/src/scene/shapes/sphere.rs @@ -0,0 +1,16 @@ +use crate::Float; +use crate::core::{Ray, Vector3f}; + +pub struct Sphere { + radius: Float, + center: Vector3f, +} + +impl Sphere { + pub fn new(radius: Float, center: Vector3f) -> Sphere { + Sphere { + radius, + center, + } + } +} |