diff options
Diffstat (limited to 'src/sdf.rs')
-rw-r--r-- | src/sdf.rs | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -543,6 +543,11 @@ impl R3ToR3 { } } +pub struct SceneConfig { + pub sdf_max_depth: isize, + pub color_max_depth: isize +} + #[derive(Serialize, Deserialize)] pub struct Scene { pub sdf: R3ToR, @@ -563,4 +568,13 @@ impl Scene { let bytes = decode_hex(s)?; serde_cbor::from_reader(&bytes[..]).ok()? } + + pub fn good_random(rng: &mut impl Rng, config: &SceneConfig) -> Self { + let sdf = R3ToR::good_random(rng, config.sdf_max_depth); + let color_function = R3ToR3::good_random(rng, config.color_max_depth); + Scene { + sdf, + color_function, + } + } } |