Add Texture struct to add extra texture information

This commit is contained in:
bijan2005 2021-01-24 00:06:23 -05:00
parent 07445dd4be
commit 20c32fc467
7 changed files with 51 additions and 35 deletions

View file

@ -18,8 +18,8 @@ fn trace(ray: Ray, objects: &Vec<Object>) -> Option<(&Object, f32)> {
pub fn cast_ray(ray: Ray, scene: &Scene) -> Color {
if let Some((obj, dist)) = trace(ray, &scene.objects) {
let point = ray.project(dist);
let surface_color = obj.getcolor(point);
surface_color
let surface_texture = obj.gettexture(point);
surface_texture.color
}
else { scene.background }
}