summaryrefslogtreecommitdiff
path: root/src/n1ck.rs
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2020-03-04 07:20:49 -0600
committerTom Barrett <tom@tombarrett.xyz>2020-03-04 07:20:49 -0600
commitc7d13e2721482772c12b44773777c5902f25848c (patch)
treead87eaa9487c4336febe8ec07d39077e67897f58 /src/n1ck.rs
parent0c0b348971ee209679b571977115537daf9288cf (diff)
removed surface from inits, now have vector of tessalations, added all the c84 colors
Diffstat (limited to 'src/n1ck.rs')
-rw-r--r--src/n1ck.rs39
1 files changed, 19 insertions, 20 deletions
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<Vertex>) {
}
}
+#[derive(Default)]
pub struct N1ck {
vertices: Vec<Vertex>,
- tessalation: Tess,
+ tessalations: Vec<Tess>,
}
impl N1ck {
- pub fn new<T: GraphicsContext>(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<T: GraphicsContext>(&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(..));
+ }
});
});
},