Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab8ef03ec4 | ||
|
|
0ae461aef2 | ||
|
|
6b66d205ec | ||
|
|
067c588704 | ||
|
|
a527a9f812 | ||
|
|
2110d038a1 | ||
|
|
95b85fdfae | ||
|
|
e954524e99 | ||
|
|
b078a3f97a | ||
|
|
f34e398223 | ||
|
|
6caa23accd |
@@ -32,15 +32,14 @@ python3 -m http.server -d dist 8080
|
|||||||
```
|
```
|
||||||
|
|
||||||
Native CLI flags (`src/cli.rs`, applied in `FractalApp::apply_cli`): `--kind`,
|
Native CLI flags (`src/cli.rs`, applied in `FractalApp::apply_cli`): `--kind`,
|
||||||
`--power`, `--julia re,im`, `--phoenix-p re,im`, `--lambda-l re,im`,
|
`--power`, `--julia re,im`, `--share <fragment>`,
|
||||||
`--palette`, `--share <fragment>`,
|
|
||||||
`--view re,im,half_height[,iterations]`, `--de`, `--buddhabrot`,
|
`--view re,im,half_height[,iterations]`, `--de`, `--buddhabrot`,
|
||||||
`--buddha-palette`. `--headless` (`src/headless.rs`) skips the window
|
`--buddha-palette`, `--export` (+ `--export-path out.png`). `--headless`
|
||||||
entirely: it builds the same view from the other flags, creates its own
|
(`src/headless.rs`) skips the window entirely: it builds the same view from
|
||||||
offscreen wgpu device, and renders straight to a PNG (`--width`/`--height`,
|
the other flags, creates its own offscreen wgpu device, and renders straight
|
||||||
default 1920×1080, `--export-path out.png`) without needing a GPU-backed
|
to a PNG (`--width`/`--height`, default 1920×1080) — implies `--export`'s
|
||||||
window/event loop. Not yet supported with `--buddhabrot`. Run
|
save behavior without needing a GPU-backed window/event loop. Not yet
|
||||||
`mandelbrot --help` for the full list.
|
supported with `--buddhabrot`. Run `mandelbrot --help` for the full list.
|
||||||
|
|
||||||
There's no GPU in most sandboxes: `cargo check`/`cargo test --test shader_valid`
|
There's no GPU in most sandboxes: `cargo check`/`cargo test --test shader_valid`
|
||||||
are the fast, headless way to validate a change. `cargo test` also runs but
|
are the fast, headless way to validate a change. `cargo test` also runs but
|
||||||
|
|||||||
+4
-22
@@ -327,7 +327,7 @@ pub struct FractalApp {
|
|||||||
export_requested: bool,
|
export_requested: bool,
|
||||||
/// Progress/handle for an in-flight PNG export, if any.
|
/// Progress/handle for an in-flight PNG export, if any.
|
||||||
export: Option<Arc<Mutex<ExportShared>>>,
|
export: Option<Arc<Mutex<ExportShared>>>,
|
||||||
/// Output path for `--export-path` (native CLI only); falls back to a
|
/// Output path for `--export` (native CLI only); falls back to a
|
||||||
/// timestamped name when unset.
|
/// timestamped name when unset.
|
||||||
export_path: Option<String>,
|
export_path: Option<String>,
|
||||||
/// Short status line (saved path, "link copied", errors).
|
/// Short status line (saved path, "link copied", errors).
|
||||||
@@ -500,24 +500,6 @@ impl FractalApp {
|
|||||||
self.view = Self::default_view_for(FractalMode::Julia, self.kind);
|
self.view = Self::default_view_for(FractalMode::Julia, self.kind);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(pp) = &cli.phoenix_p {
|
|
||||||
let p: Vec<&str> = pp.split(',').collect();
|
|
||||||
if let (Some(Ok(re)), Some(Ok(im))) = (
|
|
||||||
p.first().map(|s| s.trim().parse::<f64>()),
|
|
||||||
p.get(1).map(|s| s.trim().parse::<f64>()),
|
|
||||||
) {
|
|
||||||
self.phoenix_p = (re, im);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(ll) = &cli.lambda_l {
|
|
||||||
let p: Vec<&str> = ll.split(',').collect();
|
|
||||||
if let (Some(Ok(re)), Some(Ok(im))) = (
|
|
||||||
p.first().map(|s| s.trim().parse::<f64>()),
|
|
||||||
p.get(1).map(|s| s.trim().parse::<f64>()),
|
|
||||||
) {
|
|
||||||
self.lambda_l = (re, im);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(frag) = cli.share
|
if let Some(frag) = cli.share
|
||||||
&& let Some(state) = ShareState::decode(&frag)
|
&& let Some(state) = ShareState::decode(&frag)
|
||||||
{
|
{
|
||||||
@@ -535,10 +517,10 @@ impl FractalApp {
|
|||||||
if let Some(p) = cli.buddha_palette {
|
if let Some(p) = cli.buddha_palette {
|
||||||
self.buddha_palette = p.min(BUDDHA_PALETTE_NAMES.len() as u32 - 1);
|
self.buddha_palette = p.min(BUDDHA_PALETTE_NAMES.len() as u32 - 1);
|
||||||
}
|
}
|
||||||
if let Some(p) = cli.palette {
|
|
||||||
self.palette = p.min(PALETTE_NAMES.len() as u32 - 1);
|
|
||||||
}
|
|
||||||
self.export_path = cli.export_path;
|
self.export_path = cli.export_path;
|
||||||
|
if cli.export {
|
||||||
|
self.export_requested = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply a view spec "re,im,half_height[,iterations]" (re/im are decimal,
|
/// Apply a view spec "re,im,half_height[,iterations]" (re/im are decimal,
|
||||||
|
|||||||
+5
-13
@@ -25,18 +25,6 @@ pub struct Cli {
|
|||||||
#[arg(long, value_name = "RE,IM")]
|
#[arg(long, value_name = "RE,IM")]
|
||||||
pub julia: Option<String>,
|
pub julia: Option<String>,
|
||||||
|
|
||||||
/// Coloring palette index.
|
|
||||||
#[arg(long, value_name = "INDEX")]
|
|
||||||
pub palette: Option<u32>,
|
|
||||||
|
|
||||||
/// Phoenix constant p for the Phoenix kind (z -> z^2 + c + p*z_prev).
|
|
||||||
#[arg(long, value_name = "RE,IM")]
|
|
||||||
pub phoenix_p: Option<String>,
|
|
||||||
|
|
||||||
/// Lambda constant λ for the Lambda kind (z -> λ*z*(1 - z)).
|
|
||||||
#[arg(long, value_name = "RE,IM")]
|
|
||||||
pub lambda_l: Option<String>,
|
|
||||||
|
|
||||||
/// Restore a view from a share-link fragment (the part after '#').
|
/// Restore a view from a share-link fragment (the part after '#').
|
||||||
#[arg(long, value_name = "FRAGMENT")]
|
#[arg(long, value_name = "FRAGMENT")]
|
||||||
pub share: Option<String>,
|
pub share: Option<String>,
|
||||||
@@ -57,7 +45,11 @@ pub struct Cli {
|
|||||||
#[arg(long, value_name = "INDEX")]
|
#[arg(long, value_name = "INDEX")]
|
||||||
pub buddha_palette: Option<u32>,
|
pub buddha_palette: Option<u32>,
|
||||||
|
|
||||||
/// Output path for --headless (default: fractal-<timestamp>.png).
|
/// Render a PNG export on startup.
|
||||||
|
#[arg(long)]
|
||||||
|
pub export: bool,
|
||||||
|
|
||||||
|
/// Output path for --export/--headless (default: fractal-<timestamp>.png).
|
||||||
#[arg(long, value_name = "PATH")]
|
#[arg(long, value_name = "PATH")]
|
||||||
pub export_path: Option<String>,
|
pub export_path: Option<String>,
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user