feat(rendering): add default checkerboard texture

This commit is contained in:
Chance 2025-04-20 14:47:03 -04:00
parent 415cc477f7
commit 0127f57045
Signed by: caznix
GPG key ID: 489D213143D753FD
3 changed files with 57 additions and 18 deletions

View file

@ -85,3 +85,24 @@ impl Texture {
})
}
}
pub fn create_checkerboard() -> image::DynamicImage {
let size = 512;
let tile_size = 24;
let mut img = image::RgbaImage::new(size, size);
for y in 0..size {
for x in 0..size {
let tile_x = x / tile_size;
let tile_y = y / tile_size;
let color = if (tile_x + tile_y) % 2 == 0 {
[0, 0, 0, 255]
} else {
[255, 5, 255, 255]
};
img.put_pixel(x, y, image::Rgba(color));
}
}
image::DynamicImage::ImageRgba8(img)
}