ft: refactor materials/texture decoupling
made it so all materials can use a texture for colour source. this should be extendable if we want to do e.g. coded patterns in future
This commit is contained in:
1 parent
968c232388
commit
eddde10023
12 files changed
+89
-69
No files matched your search
+6
-3
@@ -29,7 +29,7 @@ pub struct Scene {
|
||||
image_width: u32,
|
||||
image_height: u32,
|
||||
|
||||
// raytracing
|
||||
// raytracing
|
||||
max_depth: u32,
|
||||
}
|
||||
|
||||
@@ -79,7 +79,10 @@ impl Scene {
|
||||
world.push(Arc::new(Sphere::new(
|
||||
center,
|
||||
0.2,
|
||||
Arc::new(Lambertian::new(ColourSource::Colour(Vec3::random() * Vec3::random()), 1.)),
|
||||
Arc::new(Lambertian::new(
|
||||
ColourSource::Colour(Vec3::random() * Vec3::random()),
|
||||
1.,
|
||||
)),
|
||||
)));
|
||||
} else if mat < 0.95 {
|
||||
// metal
|
||||
@@ -187,7 +190,7 @@ struct SceneDef {
|
||||
pub max_depth: u32,
|
||||
}
|
||||
|
||||
// TODO (low priority): rn textures are tightly coupled to materials; what if we wnat different
|
||||
// TODO (low priority): rn textures are tightly coupled to materials; what if we want different
|
||||
// materials to share a texture? apply the same technique we used for decoupling materials/objects
|
||||
// on textures/materials.
|
||||
impl<'de> Deserialize<'de> for Scene {
|
||||
|
||||