1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
use super::{Batch, Layer};
use nalgebra as na;
impl Layer {
pub fn empty() -> Self {
Self {
projection: na::Matrix4::identity(),
batches: vec![],
}
}
pub fn clear(&mut self) {
self.batches.clear();
}
pub fn set_projection(&mut self, projection: na::Matrix4<f32>) {
self.projection = projection;
}
pub fn projection(&self) -> &na::Matrix4<f32> {
&self.projection
}
pub fn push_batch(&mut self, batch: Batch) {
self.batches.push(batch);
}
pub fn push_batches(&mut self, batches: &[Batch]) {
self.batches.extend_from_slice(batches);
}
pub fn batches(&self) -> &[Batch] {
&self.batches
}
}