From d311a20c531419e392596920eb4df68a234d7173 Mon Sep 17 00:00:00 2001 From: sfja Date: Wed, 25 Mar 2026 00:57:39 +0100 Subject: [PATCH] better shape --- game/src/engine/shapes.rs | 20 ++++++++++---------- game/src/main.rs | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/game/src/engine/shapes.rs b/game/src/engine/shapes.rs index 38f8dd3..8ecf818 100644 --- a/game/src/engine/shapes.rs +++ b/game/src/engine/shapes.rs @@ -6,17 +6,17 @@ pub struct Shape { } impl Shape { - pub fn new_cube(V3(x, y, z): V3, V3(w, h, d): V3) -> Self { + pub fn new_cube(V3(w, h, d): V3) -> Self { Self { vertices: vec![ - V3(x, y, z), // 0 front top left - V3(x + w, y, z), // 1 front top right - V3(x, y + h, z), // 2 front bottom left - V3(x + w, y + h, z), // 3 front bottom right - V3(x, y, z + d), // 4 back top left - V3(x + w, y, z + d), // 5 back top right - V3(x, y + h, z + d), // 6 back bottom left - V3(x + w, y + h, z + d), // 7 back bottom right + V3(0.0, 0.0, 0.0), // 0 front top left + V3(0.0 + w, 0.0, 0.0), // 1 front top right + V3(0.0, 0.0 + h, 0.0), // 2 front bottom left + V3(0.0 + w, 0.0 + h, 0.0), // 3 front bottom right + V3(0.0, 0.0, 0.0 + d), // 4 back top left + V3(0.0 + w, 0.0, 0.0 + d), // 5 back top right + V3(0.0, 0.0 + h, 0.0 + d), // 6 back bottom left + V3(0.0 + w, 0.0 + h, 0.0 + d), // 7 back bottom right ], fragments: vec![ // back @@ -41,7 +41,7 @@ impl Shape { } } - pub fn iter<'a>(&'a self) -> impl Iterator + 'a { + pub fn vertices<'a>(&'a self) -> impl Iterator + 'a { let verts: &[V3] = &self.vertices; self.fragments .iter() diff --git a/game/src/main.rs b/game/src/main.rs index 37da723..1fc203a 100644 --- a/game/src/main.rs +++ b/game/src/main.rs @@ -1,5 +1,4 @@ #![allow(dead_code)] -#![allow(unused)] use std::time::Duration;