diff options
Diffstat (limited to 'engine/src/renderer.rs')
| -rw-r--r-- | engine/src/renderer.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/engine/src/renderer.rs b/engine/src/renderer.rs index 3b6bdf0..52764db 100644 --- a/engine/src/renderer.rs +++ b/engine/src/renderer.rs @@ -14,6 +14,7 @@ use ecs::{Component, Query, Sole, declare_entity}; use crate::asset::{Assets, Handle as AssetHandle}; use crate::builder; +use crate::data_types::dimens::Dimens; use crate::draw_flags::{DrawFlags, NoDraw, PolygonModeConfig}; use crate::mesh::Mesh; use crate::model::{MaterialSearchResult, Model}; @@ -32,6 +33,7 @@ use crate::shader::{ Shader, }; use crate::texture::{Texture, WHITE_1X1_ASSET_LABEL as TEXTURE_WHITE_1X1_ASSET_LABEL}; +use crate::vector::Vec2; use crate::windowing::window::Window; pub mod blending; @@ -216,6 +218,28 @@ pub enum MeshUsage } #[derive(Debug, Clone, PartialEq, Eq)] +pub struct ScissorBox +{ + /// Size of the scissor box in window coordinates. When `None`, the dimensions of the + /// window is used + pub size: Option<Dimens<u16>>, + + /// Position (in window coordinates) of the lower left corner of the scissor box. + pub lower_left_corner_pos: Vec2<u16>, +} + +impl Default for ScissorBox +{ + fn default() -> Self + { + Self { + size: None, + lower_left_corner_pos: Vec2 { x: 0, y: 0 }, + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] pub struct DrawProperties { @@ -223,6 +247,8 @@ pub struct DrawProperties pub blending_enabled: bool, pub blending_config: BlendingConfig, pub depth_test_enabled: bool, + pub scissor_test_enabled: bool, + pub scissor_box: ScissorBox, } impl Default for DrawProperties @@ -234,6 +260,8 @@ impl Default for DrawProperties blending_enabled: false, blending_config: BlendingConfig::default(), depth_test_enabled: true, + scissor_test_enabled: false, + scissor_box: ScissorBox::default(), } } } @@ -246,6 +274,8 @@ 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; } } |
