Fix alignment in cube::vertices

This commit is contained in:
Sijmen 2021-05-31 14:38:44 +02:00
parent c08ff4b6eb
commit 54549b8e16
Signed by: vijfhoek
GPG key ID: 82D05C89B28B0DAE

View file

@ -2,6 +2,7 @@ use cgmath::Vector3;
use crate::{quad::Quad, vertex::Vertex}; use crate::{quad::Quad, vertex::Vertex};
#[allow(clippy::many_single_char_names)]
pub fn vertices( pub fn vertices(
quad: &Quad, quad: &Quad,
y: i32, y: i32,
@ -38,10 +39,10 @@ pub fn vertices(
Vertex { position: [x + w, y, z ], texture_coordinates: [0.0, 1.0, t.2 as f32], normal: [0.0, 0.0, -1.0] }, Vertex { position: [x + w, y, z ], texture_coordinates: [0.0, 1.0, t.2 as f32], normal: [0.0, 0.0, -1.0] },
// Front // Front
Vertex { position: [x, y, z + h], texture_coordinates: [0.0, 1.0, t.3 as f32], normal: [0.0, 0.0, 1.0] }, Vertex { position: [x, y, z + h ], texture_coordinates: [0.0, 1.0, t.3 as f32], normal: [0.0, 0.0, 1.0] },
Vertex { position: [x, y + 1.0, z + h], texture_coordinates: [0.0, 0.0, t.3 as f32], normal: [0.0, 0.0, 1.0] }, Vertex { position: [x, y + 1.0, z + h ], texture_coordinates: [0.0, 0.0, t.3 as f32], normal: [0.0, 0.0, 1.0] },
Vertex { position: [x + w, y + 1.0, z + h], texture_coordinates: [w, 0.0, t.3 as f32], normal: [0.0, 0.0, 1.0] }, Vertex { position: [x + w, y + 1.0, z + h ], texture_coordinates: [w, 0.0, t.3 as f32], normal: [0.0, 0.0, 1.0] },
Vertex { position: [x + w, y, z + h], texture_coordinates: [w, 1.0, t.3 as f32], normal: [0.0, 0.0, 1.0] }, Vertex { position: [x + w, y, z + h ], texture_coordinates: [w, 1.0, t.3 as f32], normal: [0.0, 0.0, 1.0] },
// Bottom // Bottom
Vertex { position: [x, y, z + 0.0], texture_coordinates: [w, 0.0, t.4 as f32], normal: [0.0, -1.0, 0.0] }, Vertex { position: [x, y, z + 0.0], texture_coordinates: [w, 0.0, t.4 as f32], normal: [0.0, -1.0, 0.0] },
@ -51,8 +52,8 @@ pub fn vertices(
// Top // Top
Vertex { position: [x, y + 1.0, z ], texture_coordinates: [0.0, 0.0, t.5 as f32], normal: [0.0, 1.0, 0.0] }, Vertex { position: [x, y + 1.0, z ], texture_coordinates: [0.0, 0.0, t.5 as f32], normal: [0.0, 1.0, 0.0] },
Vertex { position: [x, y + 1.0, z + h], texture_coordinates: [0.0, h, t.5 as f32], normal: [0.0, 1.0, 0.0] }, Vertex { position: [x, y + 1.0, z + h ], texture_coordinates: [0.0, h, t.5 as f32], normal: [0.0, 1.0, 0.0] },
Vertex { position: [x + w, y + 1.0, z + h], texture_coordinates: [w, h, t.5 as f32], normal: [0.0, 1.0, 0.0] }, Vertex { position: [x + w, y + 1.0, z + h ], texture_coordinates: [w, h, t.5 as f32], normal: [0.0, 1.0, 0.0] },
Vertex { position: [x + w, y + 1.0, z ], texture_coordinates: [w, 0.0, t.5 as f32], normal: [0.0, 1.0, 0.0] }, Vertex { position: [x + w, y + 1.0, z ], texture_coordinates: [w, 0.0, t.5 as f32], normal: [0.0, 1.0, 0.0] },
]; ];
vertices vertices