Skip to content

Commit

Permalink
Fix: Handle possible missing settings in atmosphere_insert (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptsd authored Dec 12, 2024
1 parent 0f6bb31 commit c404dad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@ pub struct AtmosphereSkyBox;
fn atmosphere_insert(
mut commands: Commands,
mut mesh_assets: ResMut<Assets<Mesh>>,
settings: Res<AtmosphereSettings>,
settings: Option<Res<AtmosphereSettings>>,
material: Res<AtmosphereSkyBoxMaterial>,
atmosphere_cameras: Query<(Entity, &Projection, &AtmosphereCamera), Added<AtmosphereCamera>>,
) {
let skybox_creation_mode = match settings {
Some(settings) => settings.skybox_creation_mode,
None => SkyboxCreationMode::default(),
};

for (camera, projection, atmosphere_camera) in &atmosphere_cameras {
let far_size = match settings.skybox_creation_mode {
let far_size = match skybox_creation_mode {
// TODO: Use `unwrap_or(fallback)` when `projection.far()` becomes an `Option<f32>`
SkyboxCreationMode::FromProjectionFarWithFallback(_fallback) => projection.far(),
SkyboxCreationMode::FromSpecifiedFar(specified) => specified,
Expand Down

0 comments on commit c404dad

Please sign in to comment.