Switch to [u32; DIM] instead of Point<u32> for element indices.

This commit is contained in:
Crozet Sébastien
2021-01-20 15:40:00 +01:00
parent e2006599a8
commit 28b7866aee
9 changed files with 46 additions and 42 deletions

View File

@@ -21,7 +21,7 @@ impl Convex {
body: ColliderHandle,
delta: Isometry<f32>,
vertices: Vec<Point<f32>>,
#[cfg(feature = "dim3")] indices: Vec<Point<u32>>,
#[cfg(feature = "dim3")] indices: Vec<[u32; 3]>,
color: Point3<f32>,
window: &mut Window,
) -> Convex {
@@ -35,9 +35,9 @@ impl Convex {
let mut mesh_indices = Vec::new();
for idx in indices {
let i = mesh_vertices.len() as u16;
mesh_vertices.push(vertices[idx.x as usize]);
mesh_vertices.push(vertices[idx.y as usize]);
mesh_vertices.push(vertices[idx.z as usize]);
mesh_vertices.push(vertices[idx[0] as usize]);
mesh_vertices.push(vertices[idx[1] as usize]);
mesh_vertices.push(vertices[idx[2] as usize]);
mesh_indices.push(Point3::new(i, i + 1, i + 2));
}