feat(params): planet system params + orbit_system wiring
This commit is contained in:
parent
474dfbe723
commit
78a222e685
@ -151,6 +151,12 @@ pub struct BlackHoleParams {
|
||||
pub jets_strength: f32,
|
||||
// Anti-aliasing (Phase 3.3): supersample count for the lensed-image rings.
|
||||
pub aa_quality: AaQuality,
|
||||
// Planets (Phase 3.4: Kerr orbiting planets)
|
||||
pub planets_enabled: bool,
|
||||
pub planet_count_target: u32, // 0..=8
|
||||
pub planet_radius_factor: f32, // k, 乘到 kerr_isco(χ) 上
|
||||
pub planet_seed: u32, // ChaCha8Rng 种子, 改了触发系统重生
|
||||
pub planet_time_scale: f32, // 模拟时间放大 (进动很慢, 需放大才可见)
|
||||
}
|
||||
|
||||
impl Default for BlackHoleParams {
|
||||
@ -206,6 +212,13 @@ impl Default for BlackHoleParams {
|
||||
// at 2× by default — enough to soften the rings — with High (4×)
|
||||
// available in the UI for a fully smooth Gargantua look.
|
||||
aa_quality: if cfg!(target_arch = "wasm32") { AaQuality::Off } else { AaQuality::Low },
|
||||
// Planets: 6 颗, k=2.5 (r ∈ [1.25, 7.5], 横跨强场区),
|
||||
// 种子 42, time_scale 50× (Ω_LT 在 r=8 转一圈 ~25 min, 放大才可见).
|
||||
planets_enabled: true,
|
||||
planet_count_target: 6,
|
||||
planet_radius_factor: 2.5,
|
||||
planet_seed: 42,
|
||||
planet_time_scale: 50.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,6 +67,23 @@ pub fn orbit_position(orbit: &OrbitParams, t: f32, chi: f32) -> Vec3 {
|
||||
r * (theta.cos() * u_p + theta.sin() * v_p)
|
||||
}
|
||||
|
||||
/// 每帧读 OrbitParams + time + spin, 用闭式公式写 Planet.center.
|
||||
/// 必须在 upload_planets 之前运行 (plugin.rs 用 .before() 保证).
|
||||
pub fn orbit_system(
|
||||
time: Res<Time>,
|
||||
params: Res<crate::params::BlackHoleParams>,
|
||||
mut query: Query<(&OrbitParams, &mut Planet)>,
|
||||
) {
|
||||
if !params.planets_enabled {
|
||||
return;
|
||||
}
|
||||
// time_scale 放大模拟时间, 让慢进动在合理时间内可见 (Ω_LT 在 r=8 转一圈 ~25 min)
|
||||
let t = time.elapsed_secs() * params.planet_time_scale;
|
||||
for (orbit, mut planet) in &mut query {
|
||||
planet.center = orbit_position(orbit, t, params.spin);
|
||||
}
|
||||
}
|
||||
|
||||
/// Collects all Planet components, writes them into the shared MAX_PLANETS-sized
|
||||
/// `ShaderBuffer` that the material already binds, and updates `planet_count`.
|
||||
///
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user