use std::fmt;
pub type Layer = u16;
pub type Level = u8;
pub type Depth = f32;
pub type Stencil = u8;
#[allow(missing_docs)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct Rect {
pub x: u16,
pub y: u16,
pub w: u16,
pub h: u16,
}
pub type ColorValue = [f32; 4];
bitflags!(
#[allow(missing_docs)]
flags Mask: u32 { const COLOR = 0x01,
const COLOR0 = 0x01,
const COLOR1 = 0x02,
const COLOR2 = 0x04,
const COLOR3 = 0x08,
const DEPTH = 0x40,
const STENCIL = 0x80
}
);
impl fmt::Debug for Mask {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Mask({})", self.bits())
}
}
#[derive(Copy)]
pub struct ClearData {
pub color: ColorValue,
pub depth: Depth,
pub stencil: Stencil,
}
impl Clone for ClearData {
fn clone(&self) -> ClearData {
ClearData {
color: self.color,
depth: self.depth,
stencil: self.stencil,
}
}
}
impl fmt::Debug for ClearData {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"ClearData {{ color: {:?}, depth: {:?}, stencil: {:?} }}",
&self.color[], self.depth, self.stencil)
}
}
#[repr(u8)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Access {
Draw,
Read,
}
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Target {
Color(u8),
Depth,
Stencil,
DepthStencil,
}