shade/
common.rs

1// use super::*;
2
3/// Primitive type.
4#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
5pub enum PrimType {
6	/// Triangles.
7	Triangles,
8	/// Lines.
9	Lines,
10}
11
12/// Blend mode.
13#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Hash)]
14pub enum BlendMode {
15	/// Solid color.
16	///
17	/// ```text
18	/// result[rgb] = src[rgb]
19	/// result[a] = src[a]
20	/// ```
21	#[default]
22	Solid,
23
24	/// Alpha blending.
25	///
26	/// ```text
27	/// result[rgb] = src[rgb] * src[a] + dest[rgb] * (1 - src[a])
28	/// result[a] = src[a] + dest[a] * (1 - src[a])
29	/// ```
30	Alpha,
31
32	/// Additive blending.
33	///
34	/// ```text
35	/// result[rgb] = src[rgb] + dest[rgb]
36	/// ```
37	Additive,
38
39	/// Maximum of the src and dest colors.
40	///
41	/// ```text
42	/// result[rgb] = max(src[rgb], dest[rgb])
43	/// ```
44	Lighten,
45
46	/// Screen effect.
47	///
48	/// ```text
49	/// result[rgb] = src[rgb] + (1 - dest[rgb])
50	/// ```
51	Screen,
52
53	/// Minimum of the src and dest colors.
54	///
55	/// ```text
56	/// result[rgb] = min(src[rgb], dest[rgb])
57	/// ```
58	Darken,
59
60	/// Multiply blending.
61	///
62	/// ```text
63	/// result[rgb] = src[rgb] * dest[rgb]
64	/// ```
65	Multiply,
66}
67
68/// Depth test.
69#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
70pub enum DepthTest {
71	/// Never pass.
72	Never,
73	/// Pass if the new depth is less than the old depth.
74	Less,
75	/// Pass if the new depth is equal to the old depth.
76	Equal,
77	/// Pass if the new depth is not equal to the old depth.
78	NotEqual,
79	/// Pass if the new depth is less than or equal to the old depth.
80	LessEqual,
81	/// Pass if the new depth is greater than the old depth.
82	Greater,
83	/// Pass if the new depth is greater than or equal to the old depth.
84	GreaterEqual,
85	/// Always pass.
86	Always,
87}
88
89/// Cull mode.
90#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
91pub enum CullMode {
92	/// Cull counter-clockwise faces.
93	CCW,
94	/// Cull clockwise faces.
95	CW,
96}
97
98/// Buffer usage.
99#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
100pub enum BufferUsage {
101	/// Buffer is static and used frequently.
102	Static,
103	/// Buffer is dynamic and used frequently.
104	Dynamic,
105	/// Buffer is streamed and used infrequently.
106	Stream,
107}