atmosphere: comment out cloud/box
This commit is contained in:
parent
727d8d2493
commit
a98c1d3d3a
240
src/visual.rs
240
src/visual.rs
|
@ -33,7 +33,7 @@ impl Plugin for VisualPlugin {
|
||||||
app.add_systems(Update, update_fadeout.run_if(game_running));
|
app.add_systems(Update, update_fadeout.run_if(game_running));
|
||||||
app.add_systems(Update, update_fade_material.run_if(game_running));
|
app.add_systems(Update, update_fade_material.run_if(game_running));
|
||||||
app.add_systems(Update, update_grow.run_if(game_running));
|
app.add_systems(Update, update_grow.run_if(game_running));
|
||||||
app.add_systems(Update, update_atmosphere.run_if(game_running));
|
//app.add_systems(Update, update_atmosphere.run_if(game_running));
|
||||||
app.add_systems(Update, play_animations.run_if(game_running));
|
app.add_systems(Update, play_animations.run_if(game_running));
|
||||||
// Blackout disabled for now
|
// Blackout disabled for now
|
||||||
//app.add_systems(Update, update_blackout);
|
//app.add_systems(Update, update_blackout);
|
||||||
|
@ -123,56 +123,56 @@ pub fn setup(
|
||||||
let graph = graphs.add(graph);
|
let graph = graphs.add(graph);
|
||||||
commands.insert_resource(SuitAnimation { index, graph });
|
commands.insert_resource(SuitAnimation { index, graph });
|
||||||
|
|
||||||
// Add atmosphere box
|
//// Add atmosphere box
|
||||||
let box_material_handle = materials.add(StandardMaterial {
|
//let box_material_handle = materials.add(StandardMaterial {
|
||||||
base_color: Color::srgba(0.0, 0.0, 0.0, 1.0),
|
// base_color: Color::srgba(0.0, 0.0, 0.0, 1.0),
|
||||||
alpha_mode: AlphaMode::Blend,
|
// alpha_mode: AlphaMode::Blend,
|
||||||
cull_mode: None,
|
// cull_mode: None,
|
||||||
unlit: true,
|
// unlit: true,
|
||||||
..default()
|
// ..default()
|
||||||
});
|
//});
|
||||||
let r = 1000.0;
|
//let r = 1000.0;
|
||||||
let mesh = Mesh::from(Cuboid::new(r, r, r).mesh());
|
//let mesh = Mesh::from(Cuboid::new(r, r, r).mesh());
|
||||||
let box_handle = meshes.add(mesh);
|
//let box_handle = meshes.add(mesh);
|
||||||
commands.spawn((
|
//commands.spawn((
|
||||||
InnerAtmosphereBox,
|
// InnerAtmosphereBox,
|
||||||
NotShadowReceiver,
|
// NotShadowReceiver,
|
||||||
PbrBundle {
|
// PbrBundle {
|
||||||
mesh: box_handle,
|
// mesh: box_handle,
|
||||||
material: box_material_handle,
|
// material: box_material_handle,
|
||||||
..default()
|
// ..default()
|
||||||
},
|
// },
|
||||||
));
|
//));
|
||||||
|
|
||||||
// Add atmosphere cloud
|
//// Add atmosphere cloud
|
||||||
let texture = asset_server.load("models/textures/cloud.png");
|
//let texture = asset_server.load("models/textures/cloud.png");
|
||||||
let cloud_material_handle = materials.add(StandardMaterial {
|
//let cloud_material_handle = materials.add(StandardMaterial {
|
||||||
base_color: Color::srgba(1.0, 1.0, 1.0, 1.0),
|
// base_color: Color::srgba(1.0, 1.0, 1.0, 1.0),
|
||||||
base_color_texture: Some(texture),
|
// base_color_texture: Some(texture),
|
||||||
perceptual_roughness: 1.0,
|
// perceptual_roughness: 1.0,
|
||||||
alpha_mode: AlphaMode::Blend,
|
// alpha_mode: AlphaMode::Blend,
|
||||||
cull_mode: None,
|
// cull_mode: None,
|
||||||
unlit: true,
|
// unlit: true,
|
||||||
..default()
|
// ..default()
|
||||||
});
|
//});
|
||||||
let mesh = Rectangle::new(100000.0, 25000.0);
|
//let mesh = Rectangle::new(100000.0, 25000.0);
|
||||||
let mesh_handle = meshes.add(mesh);
|
//let mesh_handle = meshes.add(mesh);
|
||||||
commands.spawn((
|
//commands.spawn((
|
||||||
AtmosphereCloud::Above,
|
// AtmosphereCloud::Above,
|
||||||
PbrBundle {
|
// PbrBundle {
|
||||||
mesh: mesh_handle.clone(),
|
// mesh: mesh_handle.clone(),
|
||||||
material: cloud_material_handle.clone(),
|
// material: cloud_material_handle.clone(),
|
||||||
..default()
|
// ..default()
|
||||||
},
|
// },
|
||||||
));
|
//));
|
||||||
commands.spawn((
|
//commands.spawn((
|
||||||
AtmosphereCloud::Below,
|
// AtmosphereCloud::Below,
|
||||||
PbrBundle {
|
// PbrBundle {
|
||||||
mesh: mesh_handle,
|
// mesh: mesh_handle,
|
||||||
material: cloud_material_handle,
|
// material: cloud_material_handle,
|
||||||
..default()
|
// ..default()
|
||||||
},
|
// },
|
||||||
));
|
//));
|
||||||
|
|
||||||
// Blackout disabled for now
|
// Blackout disabled for now
|
||||||
// commands.spawn((
|
// commands.spawn((
|
||||||
|
@ -395,73 +395,73 @@ fn play_animations(
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
fn update_atmosphere(
|
//fn update_atmosphere(
|
||||||
settings: Res<Settings>,
|
// settings: Res<Settings>,
|
||||||
mut q_atmobox: Query<
|
// mut q_atmobox: Query<
|
||||||
(&mut Transform, &Handle<StandardMaterial>, &mut Visibility),
|
// (&mut Transform, &Handle<StandardMaterial>, &mut Visibility),
|
||||||
With<InnerAtmosphereBox>,
|
// With<InnerAtmosphereBox>,
|
||||||
>,
|
// >,
|
||||||
mut q_atmocloud: Query<
|
// mut q_atmocloud: Query<
|
||||||
(&mut Transform, &mut Visibility, &AtmosphereCloud),
|
// (&mut Transform, &mut Visibility, &AtmosphereCloud),
|
||||||
Without<InnerAtmosphereBox>,
|
// Without<InnerAtmosphereBox>,
|
||||||
>,
|
// >,
|
||||||
q_player: Query<
|
// q_player: Query<
|
||||||
&Transform,
|
// &Transform,
|
||||||
(
|
// (
|
||||||
With<actor::PlayerCamera>,
|
// With<actor::PlayerCamera>,
|
||||||
Without<InnerAtmosphereBox>,
|
// Without<InnerAtmosphereBox>,
|
||||||
Without<AtmosphereCloud>,
|
// Without<AtmosphereCloud>,
|
||||||
),
|
// ),
|
||||||
>,
|
// >,
|
||||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
// mut materials: ResMut<Assets<StandardMaterial>>,
|
||||||
) {
|
//) {
|
||||||
let player_trans = if let Ok(trans) = q_player.get_single() {
|
// let player_trans = if let Ok(trans) = q_player.get_single() {
|
||||||
trans
|
// trans
|
||||||
} else {
|
// } else {
|
||||||
return;
|
// return;
|
||||||
};
|
// };
|
||||||
|
//
|
||||||
for (mut trans, material_handle, mut vis) in &mut q_atmobox {
|
// for (mut trans, material_handle, mut vis) in &mut q_atmobox {
|
||||||
if let Some(x) = settings.atmo_altitude {
|
// if let Some(x) = settings.atmo_altitude {
|
||||||
*vis = Visibility::Inherited;
|
// *vis = Visibility::Inherited;
|
||||||
trans.translation = player_trans.translation;
|
// trans.translation = player_trans.translation;
|
||||||
let opacity = if x < -20000.0 {
|
// let opacity = if x < -20000.0 {
|
||||||
1.0
|
// 1.0
|
||||||
} else if x > 300000.0 {
|
// } else if x > 300000.0 {
|
||||||
0.0
|
// 0.0
|
||||||
} else {
|
// } else {
|
||||||
// quadratic regression with [(-2e4, 1.0), (1e5, 0.9), (3e5, 1.0)]
|
// // quadratic regression with [(-2e4, 1.0), (1e5, 0.9), (3e5, 1.0)]
|
||||||
(-(1.14583e-11) * x * x + (8.33333e-8) * x + 1.00625) as f32
|
// (-(1.14583e-11) * x * x + (8.33333e-8) * x + 1.00625) as f32
|
||||||
};
|
// };
|
||||||
if let Some(material) = materials.get_mut(material_handle) {
|
// if let Some(material) = materials.get_mut(material_handle) {
|
||||||
material.base_color = Color::srgba(0.0, 0.0, 0.0, opacity);
|
// material.base_color = Color::srgba(0.0, 0.0, 0.0, opacity);
|
||||||
if opacity >= 1.0 {
|
// if opacity >= 1.0 {
|
||||||
material.alpha_mode = AlphaMode::Opaque;
|
// material.alpha_mode = AlphaMode::Opaque;
|
||||||
} else {
|
// } else {
|
||||||
material.alpha_mode = AlphaMode::Blend;
|
// material.alpha_mode = AlphaMode::Blend;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
*vis = Visibility::Hidden;
|
// *vis = Visibility::Hidden;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
for (mut trans, mut vis, cloud_type) in &mut q_atmocloud {
|
// for (mut trans, mut vis, cloud_type) in &mut q_atmocloud {
|
||||||
if let Some(_x) = settings.atmo_altitude {
|
// if let Some(_x) = settings.atmo_altitude {
|
||||||
*vis = Visibility::Inherited;
|
// *vis = Visibility::Inherited;
|
||||||
match cloud_type {
|
// match cloud_type {
|
||||||
AtmosphereCloud::Above => {
|
// AtmosphereCloud::Above => {
|
||||||
trans.translation = player_trans.translation + Vec3::new(0.0, 10000.0, 0.0);
|
// trans.translation = player_trans.translation + Vec3::new(0.0, 10000.0, 0.0);
|
||||||
}
|
// }
|
||||||
AtmosphereCloud::Below => {
|
// AtmosphereCloud::Below => {
|
||||||
trans.translation = player_trans.translation + Vec3::new(0.0, -10000.0, 0.0);
|
// trans.translation = player_trans.translation + Vec3::new(0.0, -10000.0, 0.0);
|
||||||
}
|
// }
|
||||||
AtmosphereCloud::Fog => {
|
// AtmosphereCloud::Fog => {
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
trans.look_at(player_trans.translation, Dir3::X);
|
// trans.look_at(player_trans.translation, Dir3::X);
|
||||||
} else {
|
// } else {
|
||||||
*vis = Visibility::Hidden;
|
// *vis = Visibility::Hidden;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
Loading…
Reference in a new issue