witchcraft_renderer/
shapes.rs

1//! A collection of constants defining basic shapes.
2
3use lazy_static::lazy_static;
4
5pub struct Shape {
6    pub vertex_buffer: &'static [u8],
7    pub index_buffer: &'static [u8],
8}
9
10#[rustfmt::skip]
11lazy_static! {
12    pub static ref SQUARE: Shape = Shape {
13        vertex_buffer: bytemuck::cast_slice(&[
14            -0.1, 0.1, 0.0,
15            -0.1, -0.1, 0.0,
16            0.1, -0.1, 0.0,
17            0.1, 0.1, 0.0
18        ]),
19        index_buffer: bytemuck::cast_slice(&[
20            1u32, 2u32, 3u32,
21            3u32, 4u32, 1u32
22        ])
23    };
24}
25
26#[rustfmt::skip]
27lazy_static! {
28    pub static ref ISOSCELES_TRIANGLE: Shape = Shape {
29        vertex_buffer: bytemuck::cast_slice(&[
30            0.0, 0.1, 0.0,
31            -0.1, 0.0, 0.0,
32            0.1, 0.0, 0.0
33        ]),
34        index_buffer: bytemuck::cast_slice(&[
35            1u32, 2u32, 3u32
36        ])
37    };
38}