Skip to content

Commit

Permalink
fix: cornell cube cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure committed Sep 7, 2024
1 parent 1b21283 commit c719dc9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 46 deletions.
6 changes: 6 additions & 0 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,12 @@ fn insert_cameras(
..default()
},
exposure: Exposure::INDOOR,
projection: Projection::Perspective(
PerspectiveProjection {
fov: 60.0 * std::f32::consts::PI / 180.0,
..default()
},
),
transform: zeroverse_camera.sampler.sample(),
tonemapping: Tonemapping::None,
..default()
Expand Down
67 changes: 21 additions & 46 deletions src/scene/cornell_cube.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use bevy::{
Sphere,
},
pbr::{
// CascadeShadowConfigBuilder,
CascadeShadowConfigBuilder,
NotShadowCaster,
TransmittedShadowReceiver,
},
Expand Down Expand Up @@ -220,26 +220,26 @@ fn setup_scene(
}
});

// commands.spawn((
// DirectionalLightBundle {
// transform: Transform::from_xyz(1.0, -3.0, 2.0)
// .looking_at(Vec3::ZERO, Vec3::Y),
// directional_light: DirectionalLight {
// illuminance: 800.0,
// shadows_enabled: true,
// ..default()
// },
// cascade_shadow_config: CascadeShadowConfigBuilder {
// first_cascade_far_bound: 4.0,
// maximum_distance: 10.0,
// ..default()
// }
// .into(),
// ..default()
// },
// ZeroverseScene,
// Name::new("directional_light"),
// ));
commands.spawn((
DirectionalLightBundle {
transform: Transform::from_xyz(1.0, -3.0, 2.0)
.looking_at(Vec3::ZERO, Vec3::Y),
directional_light: DirectionalLight {
illuminance: 800.0,
shadows_enabled: true,
..default()
},
cascade_shadow_config: CascadeShadowConfigBuilder {
first_cascade_far_bound: 4.0,
maximum_distance: 10.0,
..default()
}
.into(),
..default()
},
ZeroverseScene,
Name::new("directional_light"),
));

for _ in 0..scene_settings.num_cameras {
commands.spawn(ZeroverseCamera {
Expand All @@ -257,26 +257,6 @@ fn setup_scene(
}


fn setup_cameras(
mut commands: Commands,
scene_settings: &ZeroverseSceneSettings,
) {
for _ in 0..scene_settings.num_cameras {
commands.spawn(ZeroverseCamera {
sampler: CameraPositionSampler {
sampler_type: CameraPositionSamplerType::Sphere {
radius: 3.25,
},
..default()
},
..default()
})
.insert(ZeroverseScene)
.insert(RotationAugment);
}
}


#[allow(clippy::too_many_arguments)]
fn regenerate_scene(
mut commands: Commands,
Expand All @@ -301,11 +281,6 @@ fn regenerate_scene(
commands.entity(entity).despawn_recursive();
}

setup_cameras(
commands.reborrow(),
&scene_settings,
);

setup_scene(
commands,
load_event,
Expand Down

0 comments on commit c719dc9

Please sign in to comment.