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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
use blending::{Equation, Factor};
use depth_test::DepthTest;
use face_culling::FaceCulling;
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub struct RenderState {
  pub(crate) blending: Option<(Equation, Factor, Factor)>,
  pub(crate) depth_test: DepthTest,
  pub(crate) face_culling: Option<FaceCulling>
}
impl RenderState {
  pub fn set_blending<B>(self, blending: B) -> Self where B: Into<Option<(Equation, Factor, Factor)>> {
    RenderState {
      blending: blending.into(),
      .. self
    }
  }
  pub fn blending(&self) -> Option<(Equation, Factor, Factor)> {
    self.blending
  }
  pub fn set_depth_test(self, depth_test: DepthTest) -> Self {
    RenderState {
      depth_test,
      .. self
    }
  }
  pub fn depth_test(&self) -> DepthTest {
    self.depth_test
  }
  pub fn set_face_culling<FC>(self, face_culling: FC) -> Self where FC: Into<Option<FaceCulling>> {
    RenderState {
      face_culling: face_culling.into(),
      .. self
    }
  }
  pub fn face_culling(&self) -> Option<FaceCulling> {
    self.face_culling
  }
}
impl Default for RenderState {
  
  
  
  
  
  fn default() -> Self {
    RenderState {
      blending: None,
      depth_test: DepthTest::Enabled,
      face_culling: None,
    }
  }
}