From fa7d79b11216d634ccef75af61e828ff858e0e7e Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Thu, 11 Oct 2018 19:01:48 -0700 Subject: [PATCH] Show parameters for thumbnail as table. --- rtiow/src/bin/noise_explorer.rs | 39 ++++++++++++++++++++++++++++----- rtiow/templates/index.html | 8 ++++++- rtiow/templates/style.css | 7 +++++- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/rtiow/src/bin/noise_explorer.rs b/rtiow/src/bin/noise_explorer.rs index f376691..8722acc 100644 --- a/rtiow/src/bin/noise_explorer.rs +++ b/rtiow/src/bin/noise_explorer.rs @@ -84,6 +84,22 @@ impl NoiseType { ), } } + + fn parameters(&self) -> Vec<(&str, String)> { + match &self { + NoiseType::Scale(scale) => vec![("Scale", scale.to_string())], + NoiseType::Turbulence(turbulence) => vec![("Turbulence", turbulence.to_string())], + NoiseType::Marble { + period, + power, + size, + } => vec![ + ("Period", period.to_string()), + ("Power", power.to_string()), + ("Size", size.to_string()), + ], + } + } } #[derive(Debug, Deserialize)] @@ -289,12 +305,17 @@ fn build_specimens(width: u32, height: u32) -> Vec { } specimens.push(specimen); - let mut specimen = Specimen { - title: "Varying Marble".into(), - params: Vec::new(), - }; - for power in 1..10 { - for size in 1..6 { + let max_size = 8; + for power in 1..12 { + let mut specimen = Specimen { + title: format!( + "Marble power {}, varying size 2-{}", + power, + 1 << (max_size - 1) + ), + params: Vec::new(), + }; + for size in 1..max_size { let params = NoiseParams { width, height, @@ -306,7 +327,13 @@ fn build_specimens(width: u32, height: u32) -> Vec { }; specimen.params.push(params); } + specimens.push(specimen); } + + let mut specimen = Specimen { + title: "Marble varying power, size = 32".into(), + params: Vec::new(), + }; for power in 1..10 { let params = NoiseParams { width, diff --git a/rtiow/templates/index.html b/rtiow/templates/index.html index d2b7260..e0cf1de 100644 --- a/rtiow/templates/index.html +++ b/rtiow/templates/index.html @@ -14,7 +14,13 @@ -
{{ np.compact_string() }}
+
+ + {% for p in np.noise.parameters() %} + + {% endfor %} +
{{ p.0 }}{{ p.1 }}
+
{% endfor %} {% endfor %} diff --git a/rtiow/templates/style.css b/rtiow/templates/style.css index a984065..967b6c7 100644 --- a/rtiow/templates/style.css +++ b/rtiow/templates/style.css @@ -5,6 +5,11 @@ figure p { figure { display: inline-block; margin: 0.25em; - text-align: center; font-size: smaller; + text-align: left; + line-height: .75em; +} + +figure table tr th { + font-weight: bold; }