hotfix: panic trying to create a character

This commit is contained in:
Songtronix 2020-06-14 11:47:41 +02:00
parent 0fba5283a2
commit 779769f64e

View File

@ -120,7 +120,7 @@ pub fn draw_vox(
.xyz()
.map(|e| e.abs());
let dims = match sample_strat {
let mut dims = match sample_strat {
SampleStrat::None => output_size,
SampleStrat::SuperSampling(min_samples) => {
output_size * (min_samples as f32).sqrt().ceil() as usize
@ -137,6 +137,16 @@ pub fn draw_vox(
}
.into_array();
// TODO: Imbris please fix
if dims[0] == 0 {
log::warn!("Tried to render an image with a width of 0. Defaulting to 1.");
dims[0] = 1;
}
if dims[1] == 0 {
log::warn!("Tried to render an image with a height of 0. Defaulting to 1.");
dims[1] = 1;
}
// Rendering buffers
let mut color = Buffer2d::new(dims, [0; 4]);
let mut depth = Buffer2d::new(dims, 1.0);