From c7d13e2721482772c12b44773777c5902f25848c Mon Sep 17 00:00:00 2001 From: Tom Barrett Date: Wed, 4 Mar 2020 07:20:49 -0600 Subject: removed surface from inits, now have vector of tessalations, added all the c84 colors --- src/n1ck.rs | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) (limited to 'src/n1ck.rs') diff --git a/src/n1ck.rs b/src/n1ck.rs index db77278..721e755 100644 --- a/src/n1ck.rs +++ b/src/n1ck.rs @@ -35,37 +35,34 @@ fn alter_vertices(vertices: &mut Vec) { } } +#[derive(Default)] pub struct N1ck { vertices: Vec, - tessalation: Tess, + tessalations: Vec, } impl N1ck { - pub fn new(mut surface: T) -> (N1ck, T) { + pub fn new() -> N1ck { let vertices = gen_vertices(); - let tessalation = TessBuilder::new(&mut surface) - .add_vertices(&vertices) - .set_mode(Mode::Triangle) - .build() - .unwrap(); + let tessalations = Vec::new(); - ( - N1ck { - vertices, - tessalation, - }, - surface, - ) + N1ck { + vertices, + tessalations, + } } pub fn update(&mut self, mut surface: T) -> T { alter_vertices(&mut self.vertices); - self.tessalation = TessBuilder::new(&mut surface) - .add_vertices(&self.vertices) - .set_mode(Mode::Triangle) - .build() - .unwrap(); + self.tessalations.clear(); + self.tessalations.push( + TessBuilder::new(&mut surface) + .add_vertices(&self.vertices) + .set_mode(Mode::Triangle) + .build() + .unwrap(), + ); surface } @@ -83,7 +80,9 @@ impl N1ck { |_pipeline, mut shd_gate| { shd_gate.shade(&program, |_, mut rdr_gate| { rdr_gate.render(&RenderState::default(), |mut tess_gate| { - tess_gate.render(self.tessalation.slice(..)); + for tessalation in self.tessalations.iter() { + tess_gate.render(tessalation.slice(..)); + } }); }); }, -- cgit v1.2.3