diffuse raytracing

This commit is contained in:
zomseffen 2025-01-17 11:10:39 +01:00
parent 729fcb8559
commit 86135cb2ce
6 changed files with 57 additions and 24 deletions
src/scene

View file

@ -138,7 +138,9 @@ impl Scene {
let index = self.sized_vertices.len();
cube.draw(&data.topology, index, self);
let mut memory_index = 1; // zero should be the location for the overall length (also will be the invalid memory allocation for pointing to a nonexistant neighbor)
let mut memory_index = 2;
// 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
for light in &mut self.point_lights {
light.memory_start = memory_index;
memory_index += light.get_buffer_mem_size() as usize;
@ -157,6 +159,8 @@ impl Scene {
}
println!("Memory size is {} kB, max indes is {}", memory_index * 32 / 8 /1024 + 1, memory_index);
let mut volume_vec = vec![data.num_lights_per_volume; memory_index];
volume_vec[1] = data.max_iterations_per_light;
for volume in &empty_volumes {
volume_vec = volume.borrow().insert_into_memory(volume_vec, data.num_lights_per_volume, &self.point_lights);
}