#[derive(Copy, Clone, Debug, PartialEq)]
pub struct DepthTestMode {
pub function: DepthTestFunction,
pub range_near: f32,
pub range_far: f32,
pub depth_mask: bool,
}
impl Default for DepthTestMode {
fn default() -> Self {
Self {
function: DepthTestFunction::default(),
range_near: 0.0,
range_far: 1.0,
depth_mask: true,
}
}
}
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub enum DepthTestFunction {
Never,
Less,
Equal,
LessOrEqual,
Greater,
NotEqual,
GreaterOrEqual,
Always,
}
impl Default for DepthTestFunction {
fn default() -> Self {
DepthTestFunction::Less
}
}
impl DepthTestFunction {
#[allow(clippy::wrong_self_convention)] pub(crate) fn to_gl(self) -> u32 {
use DepthTestFunction::*;
match self {
Never => glow::NEVER,
Less => glow::LESS,
Equal => glow::EQUAL,
LessOrEqual => glow::LEQUAL,
Greater => glow::GREATER,
NotEqual => glow::NOTEQUAL,
GreaterOrEqual => glow::GEQUAL,
Always => glow::ALWAYS,
}
}
}