summaryrefslogtreecommitdiff
path: root/src/sdf.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdf.rs')
-rw-r--r--src/sdf.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sdf.rs b/src/sdf.rs
index ab30fad..b78d119 100644
--- a/src/sdf.rs
+++ b/src/sdf.rs
@@ -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,
+ }
+ }
}