ft (wip): texture/material overhaul

This commit is contained in:
djaidjai committed 2026-09-13 11:58:25 +02:00
1 parent 2800d911c3
commit 968c232388
11 files changed
+89 -33

No files matched your search

+5 -1
View File
@@ -1,3 +1,4 @@
use crate::objects::materials::colour_source::ColourSource;
use std::sync::Arc;
use rand::RngExt;
@@ -78,7 +79,7 @@ impl Scene {
world.push(Arc::new(Sphere::new(
center,
0.2,
Arc::new(Lambertian::new(Vec3::random() * Vec3::random(), 1.)),
Arc::new(Lambertian::new(ColourSource::Colour(Vec3::random() * Vec3::random()), 1.)),
)));
} else if mat < 0.95 {
// metal
@@ -186,6 +187,9 @@ struct SceneDef {
pub max_depth: u32,
}
// TODO (low priority): rn textures are tightly coupled to materials; what if we wnat 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 {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.