use super::{GpuTriangle, GpuVertex};
use crate::Z_MAX;
pub struct GpuMesh {
pub vertices: Vec<GpuVertex>,
pub triangles: Vec<GpuTriangle>,
}
impl GpuMesh {
pub fn new() -> GpuMesh {
GpuMesh {
vertices: Vec::new(),
triangles: Vec::new(),
}
}
pub fn clear(&mut self) {
self.vertices.clear();
self.triangles.clear();
}
pub fn set_z(&mut self, z: i16) {
for v in &mut self.vertices {
v.z = z as f32 / Z_MAX as f32;
}
for t in &mut self.triangles {
t.z = z as f32 / Z_MAX as f32;
}
}
pub fn scale(&mut self, r: f32) {
for p in self.vertices.iter_mut() {
p.pos *= r;
}
}
}