adds scene info for recursive rays

This commit is contained in:
zomseffen 2025-02-04 10:51:48 +01:00
parent 709c2f0569
commit ffbba3be19
4 changed files with 12 additions and 2 deletions
src/scene

View file

@ -149,11 +149,13 @@ impl Scene {
let index = self.sized_vertices.len();
cube.draw(&data.topology, index, self);
let mut memory_index = 4;
let mut memory_index = 6;
// 0 - location for the maximum number of lights referenced per chunk (also will be the invalid memory allocation for pointing to a nonexistant neighbor)
// 1 - location for the max iterations per light
// 2 - diffuse raster samples (2*n + 1) * (2*n + 1) so as to always have at least the central fragment covered
// 3 - diffuse raster size
// 4 - max recursive rays
// 5 - diffuse rays per hit
for light in &mut self.point_lights {
light.memory_start = memory_index;
memory_index += light.get_buffer_mem_size() as usize;
@ -175,6 +177,8 @@ impl Scene {
volume_vec[1] = data.max_iterations_per_light;
volume_vec[2] = data.diffuse_raster_steps;
volume_vec[3] = u32::from_ne_bytes(data.diffuse_raster_size.to_ne_bytes());
volume_vec[4] = data.max_recursive_rays;
volume_vec[5] = data.diffuse_rays_per_hit;
for volume in &empty_volumes {
volume_vec = volume.borrow().insert_into_memory(volume_vec, data.num_lights_per_volume, &self.point_lights);