Fixed out of bounds error
This commit is contained in:
@@ -7,7 +7,7 @@ const BUFFER_PROPORTION_MAX: f32 = 0.9;
|
|||||||
|
|
||||||
const RAYS_INIT: i32 = 100;
|
const RAYS_INIT: i32 = 100;
|
||||||
const RAYS_MIN: i32 = 100;
|
const RAYS_MIN: i32 = 100;
|
||||||
const RAYS_MAX: i32 = 1000;
|
const RAYS_MAX: i32 = 10000;
|
||||||
|
|
||||||
/// Manages all state required for rendering Dear ImGui over `Pixels`.
|
/// Manages all state required for rendering Dear ImGui over `Pixels`.
|
||||||
pub(crate) struct Gui {
|
pub(crate) struct Gui {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ impl State {
|
|||||||
let mut pixels = self.pixels.lock().unwrap();
|
let mut pixels = self.pixels.lock().unwrap();
|
||||||
let frame = pixels.frame_mut();
|
let frame = pixels.frame_mut();
|
||||||
frame[i * 4..(i + 1) * 4].copy_from_slice(&rgba);
|
frame[i * 4..(i + 1) * 4].copy_from_slice(&rgba);
|
||||||
self.index = self.index + 1;
|
self.index = (self.index + 1) % (frame.len() / 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user