mirror of
https://github.com/CrispyPin/julia-fractal-renderer.git
synced 2024-11-23 02:20:27 +01:00
Compare commits
No commits in common. "0052bd16869cbf68aa05b9bd9f1e0f51ed1e4349" and "f4394ad27340cc3d336fa9b88736952bc9848518" have entirely different histories.
0052bd1686
...
f4394ad273
3 changed files with 877 additions and 39 deletions
851
Cargo.lock
generated
851
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -1,15 +1,12 @@
|
||||||
[package]
|
[package]
|
||||||
name = "julia-fractal-renderer"
|
name = "julia-fractal-renderer"
|
||||||
version = "1.1.0"
|
version = "1.0.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
eframe = { version = "0.22.0", default-features = false, features = [
|
eframe = "0.22.0"
|
||||||
"glow",
|
|
||||||
"default_fonts",
|
|
||||||
] }
|
|
||||||
image = { version = "0.24.6", default-features = false, features = ["png"] }
|
image = { version = "0.24.6", default-features = false, features = ["png"] }
|
||||||
native-dialog = "0.6.4"
|
native-dialog = "0.6.4"
|
||||||
rand = "0.8.5"
|
rand = "0.8.5"
|
||||||
|
|
58
src/main.rs
58
src/main.rs
|
@ -229,26 +229,27 @@ impl eframe::App for JuliaGUI {
|
||||||
.exact_width(200.0)
|
.exact_width(200.0)
|
||||||
.show(ctx, |ui| {
|
.show(ctx, |ui| {
|
||||||
ui.label(format!(
|
ui.label(format!(
|
||||||
"Preview render took {}",
|
"Preview render took {:.2}ms",
|
||||||
format_time(self.preview_render_ms, true)
|
self.preview_render_ms
|
||||||
));
|
));
|
||||||
|
|
||||||
let set_point_vis = ui.checkbox(&mut self.preview_point, "View offset point");
|
let set_point_vis = ui.checkbox(&mut self.preview_point, "View C point");
|
||||||
ui.label("Offset point (x, y):");
|
ui.label("C point (X, Y):");
|
||||||
let set_cx =
|
let set_cx =
|
||||||
ui.add(Slider::new(&mut self.settings.cx, -1.0..=1.0).clamp_to_range(false));
|
ui.add(Slider::new(&mut self.settings.cx, -1.0..=1.0).clamp_to_range(false));
|
||||||
let set_cy =
|
let set_cy =
|
||||||
ui.add(Slider::new(&mut self.settings.cy, -1.0..=1.0).clamp_to_range(false));
|
ui.add(Slider::new(&mut self.settings.cy, -1.0..=1.0).clamp_to_range(false));
|
||||||
ui.label("Width:");
|
ui.label("render width:");
|
||||||
let set_unit_width = ui.add(Slider::new(&mut self.settings.unit_width, 0.1..=6.0));
|
let set_unit_width = ui.add(Slider::new(&mut self.settings.unit_width, 0.1..=6.0));
|
||||||
|
ui.label("Fill style:");
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
ui.label("Fill style:");
|
let set_black =
|
||||||
self.settings_changed |= ui
|
ui.radio_value(&mut self.settings.fill_style, FillStyle::Black, "Black");
|
||||||
.radio_value(&mut self.settings.fill_style, FillStyle::Black, "Black")
|
let set_bright =
|
||||||
.changed();
|
ui.radio_value(&mut self.settings.fill_style, FillStyle::Bright, "Bright");
|
||||||
self.settings_changed |= ui
|
if set_bright.changed() || set_black.changed() {
|
||||||
.radio_value(&mut self.settings.fill_style, FillStyle::Bright, "Bright")
|
self.settings_changed = true;
|
||||||
.changed();
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
@ -369,19 +370,24 @@ impl eframe::App for JuliaGUI {
|
||||||
|
|
||||||
let predicted_render_time = (self.preview_render_ms
|
let predicted_render_time = (self.preview_render_ms
|
||||||
* (1 << (self.export_res_power * 2)) as f64
|
* (1 << (self.export_res_power * 2)) as f64
|
||||||
* (self.export_max_iter as f64 / self.settings.max_iter as f64))
|
* (self.export_max_iter as f64 / self.settings.max_iter as f64)
|
||||||
|
/ 1000.0)
|
||||||
.floor();
|
.floor();
|
||||||
ui.label(format!(
|
if predicted_render_time < 60.0 {
|
||||||
"Predicted render time: {}",
|
ui.label(format!("Predicted render time: {predicted_render_time}s"));
|
||||||
format_time(predicted_render_time, false)
|
} else {
|
||||||
));
|
ui.label(format!(
|
||||||
|
"Predicted render time: {:.1} min",
|
||||||
|
predicted_render_time / 60.0
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
ui.label(
|
ui.label(
|
||||||
self.export_render_ms
|
self.export_render_ms
|
||||||
.map(|ms| format!("Took {}", format_time(ms, true)))
|
.map(|ms| format!("took {ms:.2}ms"))
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
);
|
);
|
||||||
ui.label(format!("Version: {}", env!("CARGO_PKG_VERSION")));
|
ui.label(format!("version {}", env!("CARGO_PKG_VERSION")));
|
||||||
|
|
||||||
if set_cx.changed()
|
if set_cx.changed()
|
||||||
|| set_cy.changed() || set_unit_width.changed()
|
|| set_cy.changed() || set_unit_width.changed()
|
||||||
|
@ -409,17 +415,3 @@ impl eframe::App for JuliaGUI {
|
||||||
self.render_thread_handle.take().unwrap().join().unwrap();
|
self.render_thread_handle.take().unwrap().join().unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn format_time(ms: f64, precise: bool) -> String {
|
|
||||||
if ms < 1000.0 {
|
|
||||||
if precise {
|
|
||||||
format!("{ms:.2}ms")
|
|
||||||
} else {
|
|
||||||
"<1s".into()
|
|
||||||
}
|
|
||||||
} else if ms < 60_000.0 {
|
|
||||||
format!("{:.1}s", ms / 1000.0)
|
|
||||||
} else {
|
|
||||||
format!("{:.1}m", ms / 60_000.0)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue