add debug function that applies JupitersRing shader to all scenes
This commit is contained in:
parent
fc01b68086
commit
b186b37ffb
26
src/main.rs
26
src/main.rs
|
@ -47,6 +47,7 @@ impl Plugin for OutFlyPlugin {
|
||||||
fn build(&self, app: &mut App) {
|
fn build(&self, app: &mut App) {
|
||||||
app.add_systems(Startup, setup);
|
app.add_systems(Startup, setup);
|
||||||
app.add_systems(Update, handle_input);
|
app.add_systems(Update, handle_input);
|
||||||
|
app.add_systems(Update, debug);
|
||||||
app.insert_resource(var::Settings::default());
|
app.insert_resource(var::Settings::default());
|
||||||
app.insert_resource(var::GameVars::default());
|
app.insert_resource(var::GameVars::default());
|
||||||
app.add_plugins((
|
app.add_plugins((
|
||||||
|
@ -95,3 +96,28 @@ fn handle_input(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn debug(
|
||||||
|
settings: Res<var::Settings>,
|
||||||
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
|
mut commands: Commands,
|
||||||
|
mut materials_custom: ResMut<Assets<shading::JupitersRing>>,
|
||||||
|
materials: Query<(Entity, &Name, &Handle<StandardMaterial>)>,
|
||||||
|
) {
|
||||||
|
if settings.dev_mode && keyboard_input.pressed(KeyCode::KeyP) {
|
||||||
|
for (entity, name, mat) in &materials {
|
||||||
|
dbg!(name);
|
||||||
|
dbg!(mat);
|
||||||
|
let mut entity = commands.entity(entity);
|
||||||
|
entity.remove::<Handle<StandardMaterial>>();
|
||||||
|
let ring_radius = 229_000_000.0;
|
||||||
|
let jupiter_radius = 71_492_000.0;
|
||||||
|
let material = materials_custom.add(shading::JupitersRing {
|
||||||
|
alpha_mode: AlphaMode::Blend,
|
||||||
|
ring_radius: ring_radius,
|
||||||
|
jupiter_radius: jupiter_radius,
|
||||||
|
});
|
||||||
|
entity.insert(material);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue