Add ConstantTexture and use it for Lambertian material.

This commit is contained in:
2018-09-22 19:53:27 -07:00
parent e1c430b9b2
commit a1d3cce4e4
10 changed files with 88 additions and 25 deletions

View File

@@ -234,6 +234,7 @@ mod tests {
use material::Lambertian;
use material::Metal;
use sphere::Sphere;
use texture::ConstantTexture;
use vec3::Vec3;
use super::*;
@@ -245,7 +246,9 @@ mod tests {
Box::new(Sphere::new(
Vec3::new(0., 0., 0.),
0.5,
Box::new(Lambertian::new(Vec3::new(0.1, 0.2, 0.5))),
Box::new(Lambertian::new(Box::new(ConstantTexture::new(Vec3::new(
0.1, 0.2, 0.5,
))))),
)),
Box::new(Sphere::new(
Vec3::new(1., 0., 0.),
@@ -271,7 +274,9 @@ mod tests {
Box::new(Sphere::new(
Vec3::new(0., 0., 0.),
0.5,
Box::new(Lambertian::new(Vec3::new(0.1, 0.2, 0.5))),
Box::new(Lambertian::new(Box::new(ConstantTexture::new(Vec3::new(
0.1, 0.2, 0.5,
))))),
)),
Box::new(Sphere::new(
Vec3::new(1., 0., 0.),