feat(rendering): add default checkerboard texture
This commit is contained in:
parent
415cc477f7
commit
0127f57045
3 changed files with 57 additions and 18 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue