Finish M4: cart, log facade, idle diagnostics and terrain LOD
Add the core::log facade with five levels and a sink; migrate the app dev log and enable trace in --dev. Replace the dropped cubes with a four-wheel cart on revolute joints driven by velocity motors, add WASD controls, a golden trajectory and a slope test. Instrument idle frame spikes and throttle the window title. Add chunked terrain LOD with skirts (2368 vs 8192 triangles) while physics keeps the full mesh. Pin Rust 1.100.0; edition stays 2024.
This commit is contained in:
parent
190ef9cc4b
commit
1042269d7e
38 changed files with 2348 additions and 374 deletions
|
|
@ -12,7 +12,6 @@ mod sim;
|
|||
|
||||
pub use error::AppError;
|
||||
|
||||
use devlog::DevLog;
|
||||
use devlog::startup::StartupInfo;
|
||||
use gpu::WindowRenderer;
|
||||
use scene::View;
|
||||
|
|
@ -52,17 +51,14 @@ fn open_csv(config: &Config) -> Result<Option<CsvLog>, AppError> {
|
|||
.map_err(|error| AppError::Log(format!("{}: {error}", path.display())))
|
||||
}
|
||||
|
||||
/// Writes the startup banner, reporting a write failure without stopping the app.
|
||||
/// Writes the startup banner through the log facade.
|
||||
fn log_startup(
|
||||
dev: Option<&mut DevLog>,
|
||||
config: &Config,
|
||||
view: &View,
|
||||
renderer: &WindowRenderer,
|
||||
window: &Window,
|
||||
simulation: &sim::Simulation,
|
||||
) {
|
||||
let Some(dev) = dev else {
|
||||
return;
|
||||
};
|
||||
let gpu = renderer.info();
|
||||
let size = window.inner_size();
|
||||
let metrics_path = config
|
||||
|
|
@ -70,13 +66,15 @@ fn log_startup(
|
|||
.as_ref()
|
||||
.map(|path| path.display().to_string());
|
||||
let log_path = config.log.as_ref().map(|path| path.display().to_string());
|
||||
let cart = simulation.cart_info();
|
||||
let info = StartupInfo {
|
||||
window: (size.width, size.height),
|
||||
scale: window.scale_factor(),
|
||||
terrain: view.terrain_config,
|
||||
boxes: sim::DROPS.len(),
|
||||
box_mass_kg: sim::BOX_MASS,
|
||||
box_size_m: sim::BOX_SIZE,
|
||||
cart_mass_kg: cart.mass_kg,
|
||||
wheels: cart.wheels,
|
||||
wheel_radius_m: cart.wheel_radius_m,
|
||||
spawn: cart.spawn,
|
||||
eye: view.camera.eye(),
|
||||
target: view.camera.target(),
|
||||
adapter: &gpu.adapter,
|
||||
|
|
@ -87,9 +85,7 @@ fn log_startup(
|
|||
dev: config.dev,
|
||||
append: config.append,
|
||||
};
|
||||
if let Err(error) = devlog::startup::write(dev, &info) {
|
||||
eprintln!("fabrilis: dev log write failed: {error}");
|
||||
}
|
||||
devlog::startup::write(&info);
|
||||
}
|
||||
|
||||
fn aspect(size: winit::dpi::PhysicalSize<u32>) -> f32 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue