Add planets as ray-traced spheres inside the RK4 geodesic loop. A new planets.wgsl shader tests each integrator segment against a storage buffer of SphereData (center/radius/color/emissive) and composites hits front-to-back alongside the accretion disk. Lambert shading with a fixed light direction; emissive flag bypasses shading. - assets/shaders/planets.wgsl: segment-sphere intersection + shading - src/scene/: Planet component, upload_planets system, default planet - black_hole.wgsl: wire planet_hit into the compositing loop - geodesic_schwarzschild.wgsl: replace tuple return with Deriv struct
35 lines
818 B
Rust
35 lines
818 B
Rust
use bevy::prelude::*;
|
|
use bevy::window::WindowPlugin;
|
|
|
|
#[cfg(target_arch = "wasm32")]
|
|
mod web;
|
|
mod render;
|
|
mod camera;
|
|
mod params;
|
|
mod ui;
|
|
mod scene;
|
|
|
|
fn main() {
|
|
// On web, abort startup if WebGPU isn't available and show a message.
|
|
#[cfg(target_arch = "wasm32")]
|
|
{
|
|
if !web::webgpu_available() {
|
|
web::show_fallback_message();
|
|
return;
|
|
}
|
|
}
|
|
|
|
App::new()
|
|
.add_plugins(DefaultPlugins.set(WindowPlugin {
|
|
primary_window: Some(Window {
|
|
title: "singularity-rs".into(),
|
|
// On web, make the canvas track the browser window size.
|
|
fit_canvas_to_parent: true,
|
|
..default()
|
|
}),
|
|
..default()
|
|
}))
|
|
.add_plugins(render::BlackHolePlugin)
|
|
.run();
|
|
}
|