48 lines
1.5 KiB
Rust
48 lines
1.5 KiB
Rust
use mangotune::config::parser::Parser;
|
|
use mangotune::preview::{PreviewController, PreviewScene, PreviewStudioOptions, StudioScene};
|
|
use std::path::PathBuf;
|
|
use std::thread;
|
|
use std::time::Duration;
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
let mut args = std::env::args().skip(1);
|
|
let profile = args
|
|
.next()
|
|
.map(PathBuf::from)
|
|
.expect("usage: preview_probe <profile> [studio-scene] [width] [height] [seconds]");
|
|
let studio_scene = args
|
|
.next()
|
|
.as_deref()
|
|
.and_then(StudioScene::from_label)
|
|
.unwrap_or(StudioScene::BrightWash);
|
|
let width = args
|
|
.next()
|
|
.and_then(|v| v.parse::<i32>().ok())
|
|
.unwrap_or(1400);
|
|
let height = args
|
|
.next()
|
|
.and_then(|v| v.parse::<i32>().ok())
|
|
.unwrap_or(760);
|
|
let seconds = args.next().and_then(|v| v.parse::<u64>().ok()).unwrap_or(8);
|
|
|
|
let config = Parser::read(&profile)?;
|
|
let controller = PreviewController::new();
|
|
let studio = PreviewStudioOptions {
|
|
scene: studio_scene,
|
|
fps_cap: Some(500),
|
|
vsync: false,
|
|
vram_pressure_mb: 64,
|
|
particle_count: 20_000,
|
|
particle_size: 0.25,
|
|
gpu_passes: 2,
|
|
interaction_steps: 8,
|
|
paused: false,
|
|
};
|
|
|
|
let pid = controller.start(PreviewScene::Studio, &config, width, height, false, studio)?;
|
|
eprintln!("preview pid={pid} profile={}", profile.display());
|
|
thread::sleep(Duration::from_secs(seconds));
|
|
let _ = controller.stop();
|
|
Ok(())
|
|
}
|