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_fade_material.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));
|
||||
// Blackout disabled for now
|
||||
//app.add_systems(Update, update_blackout);
|
||||
|
@ -123,56 +123,56 @@ pub fn setup(
|
|||
let graph = graphs.add(graph);
|
||||
commands.insert_resource(SuitAnimation { index, graph });
|
||||
|
||||
// Add atmosphere box
|
||||
let box_material_handle = materials.add(StandardMaterial {
|
||||
base_color: Color::srgba(0.0, 0.0, 0.0, 1.0),
|
||||
alpha_mode: AlphaMode::Blend,
|
||||
cull_mode: None,
|
||||
unlit: true,
|
||||
..default()
|
||||
});
|
||||
let r = 1000.0;
|
||||
let mesh = Mesh::from(Cuboid::new(r, r, r).mesh());
|
||||
let box_handle = meshes.add(mesh);
|
||||
commands.spawn((
|
||||
InnerAtmosphereBox,
|
||||
NotShadowReceiver,
|
||||
PbrBundle {
|
||||
mesh: box_handle,
|
||||
material: box_material_handle,
|
||||
..default()
|
||||
},
|
||||
));
|
||||
//// Add atmosphere box
|
||||
//let box_material_handle = materials.add(StandardMaterial {
|
||||
// base_color: Color::srgba(0.0, 0.0, 0.0, 1.0),
|
||||
// alpha_mode: AlphaMode::Blend,
|
||||
// cull_mode: None,
|
||||
// unlit: true,
|
||||
// ..default()
|
||||
//});
|
||||
//let r = 1000.0;
|
||||
//let mesh = Mesh::from(Cuboid::new(r, r, r).mesh());
|
||||
//let box_handle = meshes.add(mesh);
|
||||
//commands.spawn((
|
||||
// InnerAtmosphereBox,
|
||||
// NotShadowReceiver,
|
||||
// PbrBundle {
|
||||
// mesh: box_handle,
|
||||
// material: box_material_handle,
|
||||
// ..default()
|
||||
// },
|
||||
//));
|
||||
|
||||
// Add atmosphere cloud
|
||||
let texture = asset_server.load("models/textures/cloud.png");
|
||||
let cloud_material_handle = materials.add(StandardMaterial {
|
||||
base_color: Color::srgba(1.0, 1.0, 1.0, 1.0),
|
||||
base_color_texture: Some(texture),
|
||||
perceptual_roughness: 1.0,
|
||||
alpha_mode: AlphaMode::Blend,
|
||||
cull_mode: None,
|
||||
unlit: true,
|
||||
..default()
|
||||
});
|
||||
let mesh = Rectangle::new(100000.0, 25000.0);
|
||||
let mesh_handle = meshes.add(mesh);
|
||||
commands.spawn((
|
||||
AtmosphereCloud::Above,
|
||||
PbrBundle {
|
||||
mesh: mesh_handle.clone(),
|
||||
material: cloud_material_handle.clone(),
|
||||
..default()
|
||||
},
|
||||
));
|
||||
commands.spawn((
|
||||
AtmosphereCloud::Below,
|
||||
PbrBundle {
|
||||
mesh: mesh_handle,
|
||||
material: cloud_material_handle,
|
||||
..default()
|
||||
},
|
||||
));
|
||||
//// Add atmosphere cloud
|
||||
//let texture = asset_server.load("models/textures/cloud.png");
|
||||
//let cloud_material_handle = materials.add(StandardMaterial {
|
||||
// base_color: Color::srgba(1.0, 1.0, 1.0, 1.0),
|
||||
// base_color_texture: Some(texture),
|
||||
// perceptual_roughness: 1.0,
|
||||
// alpha_mode: AlphaMode::Blend,
|
||||
// cull_mode: None,
|
||||
// unlit: true,
|
||||
// ..default()
|
||||
//});
|
||||
//let mesh = Rectangle::new(100000.0, 25000.0);
|
||||
//let mesh_handle = meshes.add(mesh);
|
||||
//commands.spawn((
|
||||
// AtmosphereCloud::Above,
|
||||
// PbrBundle {
|
||||
// mesh: mesh_handle.clone(),
|
||||
// material: cloud_material_handle.clone(),
|
||||
// ..default()
|
||||
// },
|
||||
//));
|
||||
//commands.spawn((
|
||||
// AtmosphereCloud::Below,
|
||||
// PbrBundle {
|
||||
// mesh: mesh_handle,
|
||||
// material: cloud_material_handle,
|
||||
// ..default()
|
||||
// },
|
||||
//));
|
||||
|
||||
// Blackout disabled for now
|
||||
// commands.spawn((
|
||||
|
@ -395,73 +395,73 @@ fn play_animations(
|
|||
// }
|
||||
//}
|
||||
|
||||
fn update_atmosphere(
|
||||
settings: Res<Settings>,
|
||||
mut q_atmobox: Query<
|
||||
(&mut Transform, &Handle<StandardMaterial>, &mut Visibility),
|
||||
With<InnerAtmosphereBox>,
|
||||
>,
|
||||
mut q_atmocloud: Query<
|
||||
(&mut Transform, &mut Visibility, &AtmosphereCloud),
|
||||
Without<InnerAtmosphereBox>,
|
||||
>,
|
||||
q_player: Query<
|
||||
&Transform,
|
||||
(
|
||||
With<actor::PlayerCamera>,
|
||||
Without<InnerAtmosphereBox>,
|
||||
Without<AtmosphereCloud>,
|
||||
),
|
||||
>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
let player_trans = if let Ok(trans) = q_player.get_single() {
|
||||
trans
|
||||
} else {
|
||||
return;
|
||||
};
|
||||
|
||||
for (mut trans, material_handle, mut vis) in &mut q_atmobox {
|
||||
if let Some(x) = settings.atmo_altitude {
|
||||
*vis = Visibility::Inherited;
|
||||
trans.translation = player_trans.translation;
|
||||
let opacity = if x < -20000.0 {
|
||||
1.0
|
||||
} else if x > 300000.0 {
|
||||
0.0
|
||||
} else {
|
||||
// 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
|
||||
};
|
||||
if let Some(material) = materials.get_mut(material_handle) {
|
||||
material.base_color = Color::srgba(0.0, 0.0, 0.0, opacity);
|
||||
if opacity >= 1.0 {
|
||||
material.alpha_mode = AlphaMode::Opaque;
|
||||
} else {
|
||||
material.alpha_mode = AlphaMode::Blend;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*vis = Visibility::Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
for (mut trans, mut vis, cloud_type) in &mut q_atmocloud {
|
||||
if let Some(_x) = settings.atmo_altitude {
|
||||
*vis = Visibility::Inherited;
|
||||
match cloud_type {
|
||||
AtmosphereCloud::Above => {
|
||||
trans.translation = player_trans.translation + Vec3::new(0.0, 10000.0, 0.0);
|
||||
}
|
||||
AtmosphereCloud::Below => {
|
||||
trans.translation = player_trans.translation + Vec3::new(0.0, -10000.0, 0.0);
|
||||
}
|
||||
AtmosphereCloud::Fog => {
|
||||
}
|
||||
}
|
||||
trans.look_at(player_trans.translation, Dir3::X);
|
||||
} else {
|
||||
*vis = Visibility::Hidden;
|
||||
}
|
||||
}
|
||||
}
|
||||
//fn update_atmosphere(
|
||||
// settings: Res<Settings>,
|
||||
// mut q_atmobox: Query<
|
||||
// (&mut Transform, &Handle<StandardMaterial>, &mut Visibility),
|
||||
// With<InnerAtmosphereBox>,
|
||||
// >,
|
||||
// mut q_atmocloud: Query<
|
||||
// (&mut Transform, &mut Visibility, &AtmosphereCloud),
|
||||
// Without<InnerAtmosphereBox>,
|
||||
// >,
|
||||
// q_player: Query<
|
||||
// &Transform,
|
||||
// (
|
||||
// With<actor::PlayerCamera>,
|
||||
// Without<InnerAtmosphereBox>,
|
||||
// Without<AtmosphereCloud>,
|
||||
// ),
|
||||
// >,
|
||||
// mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
//) {
|
||||
// let player_trans = if let Ok(trans) = q_player.get_single() {
|
||||
// trans
|
||||
// } else {
|
||||
// return;
|
||||
// };
|
||||
//
|
||||
// for (mut trans, material_handle, mut vis) in &mut q_atmobox {
|
||||
// if let Some(x) = settings.atmo_altitude {
|
||||
// *vis = Visibility::Inherited;
|
||||
// trans.translation = player_trans.translation;
|
||||
// let opacity = if x < -20000.0 {
|
||||
// 1.0
|
||||
// } else if x > 300000.0 {
|
||||
// 0.0
|
||||
// } else {
|
||||
// // 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
|
||||
// };
|
||||
// if let Some(material) = materials.get_mut(material_handle) {
|
||||
// material.base_color = Color::srgba(0.0, 0.0, 0.0, opacity);
|
||||
// if opacity >= 1.0 {
|
||||
// material.alpha_mode = AlphaMode::Opaque;
|
||||
// } else {
|
||||
// material.alpha_mode = AlphaMode::Blend;
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// *vis = Visibility::Hidden;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (mut trans, mut vis, cloud_type) in &mut q_atmocloud {
|
||||
// if let Some(_x) = settings.atmo_altitude {
|
||||
// *vis = Visibility::Inherited;
|
||||
// match cloud_type {
|
||||
// AtmosphereCloud::Above => {
|
||||
// trans.translation = player_trans.translation + Vec3::new(0.0, 10000.0, 0.0);
|
||||
// }
|
||||
// AtmosphereCloud::Below => {
|
||||
// trans.translation = player_trans.translation + Vec3::new(0.0, -10000.0, 0.0);
|
||||
// }
|
||||
// AtmosphereCloud::Fog => {
|
||||
// }
|
||||
// }
|
||||
// trans.look_at(player_trans.translation, Dir3::X);
|
||||
// } else {
|
||||
// *vis = Visibility::Hidden;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
|
Loading…
Reference in a new issue