added cube mesh
This commit is contained in:
parent
4d95a873b0
commit
62bbf97c6a
53
meshes/cube.rs
Normal file
53
meshes/cube.rs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
mod meshes {
|
||||||
|
use std::mem::size_of;
|
||||||
|
|
||||||
|
const CUBE_VERTEX_SIZE: usize = size_of::<f32>() * 10;
|
||||||
|
const CUBE_VERTEX_COUNT: usize = 36;
|
||||||
|
const CUBE_VERTEX_POS_OFFSET: usize = 0;
|
||||||
|
const CUBE_VERTEX_COLOR_OFFSET: usize = size_of::<f32>() * 4;
|
||||||
|
const CUBE_VERTEX_UV_OFFSET: usize = size_of::<f32>() * 8;
|
||||||
|
const CUBE_VERTICES: [f32; 24] = [
|
||||||
|
// float4 position, float4 color, float2 uv
|
||||||
|
1, -1, 1, 1, 1, 0, 1, 1, 0, 1,
|
||||||
|
-1, -1, 1, 1, 0, 0, 1, 1, 1, 1,
|
||||||
|
-1, -1, -1, 1, 0, 0, 0, 1, 1, 0,
|
||||||
|
1, -1, -1, 1, 1, 0, 0, 1, 0, 0,
|
||||||
|
1, -1, 1, 1, 1, 0, 1, 1, 0, 1,
|
||||||
|
-1, -1, -1, 1, 0, 0, 0, 1, 1, 0,
|
||||||
|
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
|
||||||
|
1, -1, 1, 1, 1, 0, 1, 1, 1, 1,
|
||||||
|
1, -1, -1, 1, 1, 0, 0, 1, 1, 0,
|
||||||
|
1, 1, -1, 1, 1, 1, 0, 1, 0, 0,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
|
||||||
|
1, -1, -1, 1, 1, 0, 0, 1, 1, 0,
|
||||||
|
|
||||||
|
-1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, -1, 1, 1, 1, 0, 1, 1, 0,
|
||||||
|
-1, 1, -1, 1, 0, 1, 0, 1, 0, 0,
|
||||||
|
-1, 1, 1, 1, 0, 1, 1, 1, 0, 1,
|
||||||
|
1, 1, -1, 1, 1, 1, 0, 1, 1, 0,
|
||||||
|
|
||||||
|
-1, -1, 1, 1, 0, 0, 1, 1, 0, 1,
|
||||||
|
-1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
|
||||||
|
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
||||||
|
-1, -1, -1, 1, 0, 0, 0, 1, 0, 0,
|
||||||
|
-1, -1, 1, 1, 0, 0, 1, 1, 0, 1,
|
||||||
|
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
||||||
|
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
|
||||||
|
-1, 1, 1, 1, 0, 1, 1, 1, 1, 1,
|
||||||
|
-1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
|
||||||
|
-1, -1, 1, 1, 0, 0, 1, 1, 1, 0,
|
||||||
|
1, -1, 1, 1, 1, 0, 1, 1, 0, 0,
|
||||||
|
1, 1, 1, 1, 1, 1, 1, 1, 0, 1,
|
||||||
|
|
||||||
|
1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
|
||||||
|
-1, -1, -1, 1, 0, 0, 0, 1, 1, 1,
|
||||||
|
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
||||||
|
1, 1, -1, 1, 1, 1, 0, 1, 0, 0,
|
||||||
|
1, -1, -1, 1, 1, 0, 0, 1, 0, 1,
|
||||||
|
-1, 1, -1, 1, 0, 1, 0, 1, 1, 0,
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user