world: add default empty World constructor.
This commit is contained in:
parent
cbecaa70ef
commit
3bc9f6f924
@ -6,6 +6,7 @@ pub mod matrices;
|
||||
pub mod rays;
|
||||
pub mod spheres;
|
||||
pub mod tuples;
|
||||
pub mod world;
|
||||
|
||||
/// Value considered close enough for PartialEq implementations.
|
||||
pub const EPSILON: f32 = 0.00001;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use crate::tuples::{Color, Tuple};
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct PointLight {
|
||||
pub position: Tuple,
|
||||
pub intensity: Color,
|
||||
|
||||
19
rtchallenge/src/world.rs
Normal file
19
rtchallenge/src/world.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use crate::{lights::PointLight, spheres::Sphere};
|
||||
|
||||
/// World holds all drawable objects and the light(s) that illuminate them.
|
||||
///
|
||||
/// # Examples
|
||||
/// ```
|
||||
/// use rtchallenge::world::World;
|
||||
///
|
||||
/// let w = World::default();
|
||||
/// assert!(w.objects.is_empty());
|
||||
/// assert_eq!(w.light, None);
|
||||
/// ```
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct World {
|
||||
// TODO(wathiede): make this a list of abstract Light traits.
|
||||
pub light: Option<PointLight>,
|
||||
pub objects: Vec<Sphere>,
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user