to rebase
This commit is contained in:
+36
-9
@@ -10,6 +10,7 @@ use crate::fractal::{
|
||||
};
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
use crate::fractal::{compute_reference, compute_set_reference};
|
||||
use crate::lights::Light;
|
||||
use crate::view::{
|
||||
Big, DEFAULT_HALF_HEIGHT, ViewState, big_from_decimal_str, big_from_f64, big_to_decimal_str,
|
||||
precision_for,
|
||||
@@ -30,7 +31,7 @@ const INTERACT_SETTLE: f64 = 0.12;
|
||||
/// Palette names; index maps to `palette_id` in the shader.
|
||||
const PALETTE_NAMES: &[&str] = &["Amber", "Rainbow", "Ember", "Lime", "Grayscale"];
|
||||
/// Shadow palette names; index maps to `palette_id` in the shader.
|
||||
const SHADOW_PALETTE_NAMES: &[&str] = &["Grayscale", "Red & Blue"];
|
||||
const SHADOW_PALETTE_NAMES: &[&str] = &["Grayscale", "Red & Blue", "Custom lights"];
|
||||
/// Buddhabrot tonemap style names; index maps to `BuddhabrotUniforms::palette`.
|
||||
const BUDDHA_PALETTE_NAMES: &[&str] = &["Nebula", "Yellow", "Grayscale"];
|
||||
|
||||
@@ -273,6 +274,9 @@ pub struct FractalApp {
|
||||
// Use shadow coloring
|
||||
shadow: bool,
|
||||
|
||||
/// List of enabled lights in the world
|
||||
lights: Vec<Light>,
|
||||
|
||||
/// Render as a Buddhabrot (Monte-Carlo orbit-density histogram) instead of
|
||||
/// the ordinary escape-time set. Plain f32 view — no deep zoom, no
|
||||
/// perturbation/reference-orbit machinery (see `fractal::buddhabrot`).
|
||||
@@ -410,6 +414,7 @@ impl FractalApp {
|
||||
antialias: false,
|
||||
de_coloring: false,
|
||||
shadow: false,
|
||||
lights: vec![Light::default()],
|
||||
buddhabrot: false,
|
||||
buddha_r_cap: 50,
|
||||
buddha_g_cap: 500,
|
||||
@@ -1384,6 +1389,25 @@ impl FractalApp {
|
||||
}
|
||||
});
|
||||
}
|
||||
if self.shadow && self.shadow_palette as usize == SHADOW_PALETTE_NAMES.len() - 1 {
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("lights:");
|
||||
if ui.button("+").clicked() {
|
||||
self.lights.push(Light::default());
|
||||
}
|
||||
});
|
||||
egui::Grid::new("lights")
|
||||
.striped(true)
|
||||
.num_columns(1)
|
||||
.show(ui, |ui| {
|
||||
self.lights.retain_mut(|light| {
|
||||
let delete = !light.widget(ui);
|
||||
ui.end_row();
|
||||
delete
|
||||
});
|
||||
});
|
||||
}
|
||||
ui.separator();
|
||||
ui.checkbox(&mut self.antialias, "Antialiasing (2×2)")
|
||||
.on_hover_text("Supersample each pixel for smoother edges (~4× slower).");
|
||||
if !self.shadow {
|
||||
@@ -1397,14 +1421,16 @@ impl FractalApp {
|
||||
}
|
||||
|
||||
ui.collapsing("Animation", |ui| {
|
||||
ui.checkbox(&mut self.anim.color, "Cycle colours")
|
||||
.on_hover_text("Scroll the palette offset over time.");
|
||||
if self.anim.color {
|
||||
ui.add(
|
||||
egui::Slider::new(&mut self.anim.color_speed, 0.01..=2.0)
|
||||
.text("cycles/s")
|
||||
.logarithmic(true),
|
||||
);
|
||||
if !self.shadow {
|
||||
ui.checkbox(&mut self.anim.color, "Cycle colours")
|
||||
.on_hover_text("Scroll the palette offset over time.");
|
||||
if self.anim.color {
|
||||
ui.add(
|
||||
egui::Slider::new(&mut self.anim.color_speed, 0.01..=2.0)
|
||||
.text("cycles/s")
|
||||
.logarithmic(true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
ui.checkbox(&mut self.anim.zoom, "Auto-zoom")
|
||||
@@ -1779,6 +1805,7 @@ impl FractalApp {
|
||||
rect,
|
||||
FractalCallback {
|
||||
uniforms,
|
||||
lights: self.lights.clone(),
|
||||
reference: Arc::clone(&self.reference),
|
||||
generation: self.generation,
|
||||
size_px,
|
||||
|
||||
Reference in New Issue
Block a user