use constants in dummy_scene

This commit is contained in:
Marcel Märtens 2024-01-31 18:33:03 +01:00
parent 95c7e6bd82
commit db9eca031c
2 changed files with 11 additions and 6 deletions

View File

@ -11,12 +11,14 @@ impl Scene {
pub fn new(renderer: &mut Renderer) -> Self {
let global_data = GlobalModel {
globals: renderer.create_consts(&[Globals::default()]),
lights: renderer.create_consts(&[Light::default(); 20]),
shadows: renderer.create_consts(&[Shadow::default(); 32]),
lights: renderer.create_consts(&[Light::default(); crate::scene::MAX_LIGHT_COUNT]),
shadows: renderer.create_consts(&[Shadow::default(); crate::scene::MAX_SHADOW_COUNT]),
shadow_mats: renderer.create_shadow_bound_locals(&[ShadowLocals::default()]),
rain_occlusion_mats: renderer
.create_rain_occlusion_bound_locals(&[RainOcclusionLocals::default()]),
point_light_matrices: Box::new([PointLightMatrix::default(); 126]),
point_light_matrices: Box::new(
[PointLightMatrix::default(); crate::scene::MAX_POINT_LIGHT_MATRICES_COUNT],
),
};
let lod_data = LodData::dummy(renderer);

View File

@ -53,8 +53,9 @@ const ZOOM_CAP_ADMIN: f32 = 100000.0;
// TODO: Don't hard-code this.
const CURSOR_PAN_SCALE: f32 = 0.005;
const MAX_LIGHT_COUNT: usize = 20; // 31 (total shadow_mats is limited to 128 with default max_uniform_buffer_binding_size)
const MAX_SHADOW_COUNT: usize = 24;
pub(crate) const MAX_LIGHT_COUNT: usize = 20; // 31 (total shadow_mats is limited to 128 with default max_uniform_buffer_binding_size)
pub(crate) const MAX_SHADOW_COUNT: usize = 24;
pub(crate) const MAX_POINT_LIGHT_MATRICES_COUNT: usize = MAX_LIGHT_COUNT * 6 + 6;
const NUM_DIRECTED_LIGHTS: usize = 1;
const LIGHT_DIST_RADIUS: f32 = 64.0; // The distance beyond which lights may not emit light from their origin
const SHADOW_DIST_RADIUS: f32 = 8.0;
@ -304,7 +305,9 @@ impl Scene {
shadow_mats: renderer.create_shadow_bound_locals(&[ShadowLocals::default()]),
rain_occlusion_mats: renderer
.create_rain_occlusion_bound_locals(&[RainOcclusionLocals::default()]),
point_light_matrices: Box::new([PointLightMatrix::default(); MAX_LIGHT_COUNT * 6 + 6]),
point_light_matrices: Box::new(
[PointLightMatrix::default(); MAX_POINT_LIGHT_MATRICES_COUNT],
),
};
let lod = Lod::new(renderer, client, settings);