use super::ExampleVertices;
use crate::{
BufferElementType, Mesh, Primitive, PrimitiveType, Renderable, ShortIndex, VertexAttr,
};
pub fn new<R: Renderable>(eg: &mut ExampleVertices<R>, size: f32) {
let vertex_data = [
-size, -size, 0.0, size, -size, 0.0, 0.0, size, 0.0, 0., 0., 1., 0., 0., 1., 0., 0., 1.,
];
let index_data = [0u8, 1, 2];
let data_vertices = eg.push_byte_buffer(Box::new(vertex_data));
let data_indices = eg.push_byte_buffer(Box::new(index_data));
let indices = eg.push_accessor(data_indices, 3, BufferElementType::Int8, 0, 0);
let vertices = eg.push_accessor(data_vertices, 3, BufferElementType::Float32, 0, 0);
let normals = eg.push_accessor(data_vertices, 3, BufferElementType::Float32, 9 * 4, 0);
eg.push_vertices(indices, vertices, &[(VertexAttr::Normal, normals)]);
}
pub fn mesh(v_id: ShortIndex, m_id: ShortIndex) -> Mesh {
let mut mesh = Mesh::default();
mesh.add_primitive(Primitive::new(PrimitiveType::Triangles, v_id, 0, 3, m_id));
mesh
}