diff options
Diffstat (limited to 'engine/src/rendering.rs')
| -rw-r--r-- | engine/src/rendering.rs | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/engine/src/rendering.rs b/engine/src/rendering.rs index dc3cb76..f40f774 100644 --- a/engine/src/rendering.rs +++ b/engine/src/rendering.rs @@ -216,6 +216,7 @@ pub enum Command ActivateShader(ObjectId), SetShaderBinding(ShaderBinding), CreateTexture(ObjectId, AssetOrValue<Texture>), + // TODO: Make UpdateTexture command able to handle textures other than 2D textures UpdateTexture { obj_id: ObjectId, @@ -321,6 +322,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 +361,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 +376,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 +392,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; } } |
