diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-06 16:15:00 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-06 16:15:00 +0200 |
| commit | 6f683a66582dd543b957216b466c07dc64d5b9a7 (patch) | |
| tree | 13a269bf3ead7f29900b7c39033cc71e25040253 /engine/src/rendering.rs | |
| parent | 26a5b10d84dcbb9f22acec30aa549e9992235e9e (diff) | |
feat(engine): add depth function to rendering::DrawProperties
Diffstat (limited to 'engine/src/rendering.rs')
| -rw-r--r-- | engine/src/rendering.rs | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/engine/src/rendering.rs b/engine/src/rendering.rs index dc3cb76..3af1ab8 100644 --- a/engine/src/rendering.rs +++ b/engine/src/rendering.rs @@ -321,6 +321,37 @@ impl Default for ScissorBox } } +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] +pub enum DepthFunction +{ + /// Never passes. + Never, + + /// Passes if the incoming depth value is less than the stored depth value. + #[default] + Less, + + /// Passes if the incoming depth value is equal to the stored depth value. + Equal, + + /// Passes if the incoming depth value is less than or equal to the stored depth + /// value. + LessOrEqual, + + /// Passes if the incoming depth value is greater than the stored depth value. + Greater, + + /// Passes if the incoming depth value is not equal to the stored depth value. + NotEqual, + + /// Passes if the incoming depth value is greater than or equal to the stored depth + /// value. + GreaterOrEqual, + + /// Always passes. + Always, +} + #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] pub struct DrawProperties @@ -329,6 +360,7 @@ pub struct DrawProperties pub blending_enabled: bool, pub blending_config: BlendingConfig, pub depth_test_enabled: bool, + pub depth_function: DepthFunction, pub scissor_test_enabled: bool, pub scissor_box: ScissorBox, pub face_culling_enabled: bool, @@ -343,6 +375,7 @@ impl Default for DrawProperties blending_enabled: false, blending_config: BlendingConfig::default(), depth_test_enabled: true, + depth_function: DepthFunction::default(), scissor_test_enabled: false, scissor_box: ScissorBox::default(), face_culling_enabled: false, @@ -358,9 +391,10 @@ bitflags! { const BLENDING_CONFIG = 1 << 1; const BLENDING_ENABLED = 1 << 2; const DEPTH_TEST_ENABLED = 1 << 3; - const SCISSOR_TEST_ENABLED = 1 << 4; - const SCISSOR_BOX = 1 << 5; - const FACE_CULLING_ENABLED = 1 << 6; + const DEPTH_FUNCTION = 1 << 4; + const SCISSOR_TEST_ENABLED = 1 << 5; + const SCISSOR_BOX = 1 << 6; + const FACE_CULLING_ENABLED = 1 << 7; } } |
