1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
mod errors; use raw::*; use texture::*; mod state; pub use self::state::*; mod framebuffer; pub use self::framebuffer::*; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum DefaultFramebufferDrawBuffer { None, FrontLeft, FrontRight, BackLeft, BackRight, } impl From<DefaultFramebufferDrawBuffer> for FramebufferDrawBuffer { fn from(draw_buffer: DefaultFramebufferDrawBuffer) -> Self { match draw_buffer { DefaultFramebufferDrawBuffer::None => FramebufferDrawBuffer::None, DefaultFramebufferDrawBuffer::FrontLeft => FramebufferDrawBuffer::FrontLeft, DefaultFramebufferDrawBuffer::FrontRight => FramebufferDrawBuffer::FrontRight, DefaultFramebufferDrawBuffer::BackLeft => FramebufferDrawBuffer::BackLeft, DefaultFramebufferDrawBuffer::BackRight => FramebufferDrawBuffer::BackRight, } } } #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum GeneralFramebufferDrawBuffer { None, ColorAttachment0, ColorAttachment1, ColorAttachment2, ColorAttachment3, ColorAttachment4, ColorAttachment5, ColorAttachment6, ColorAttachment7, } impl From<GeneralFramebufferDrawBuffer> for FramebufferDrawBuffer { fn from(draw_buffer: GeneralFramebufferDrawBuffer) -> Self { match draw_buffer { GeneralFramebufferDrawBuffer::None => FramebufferDrawBuffer::None, GeneralFramebufferDrawBuffer::ColorAttachment0 => { FramebufferDrawBuffer::ColorAttachment0 } GeneralFramebufferDrawBuffer::ColorAttachment1 => { FramebufferDrawBuffer::ColorAttachment1 } GeneralFramebufferDrawBuffer::ColorAttachment2 => { FramebufferDrawBuffer::ColorAttachment2 } GeneralFramebufferDrawBuffer::ColorAttachment3 => { FramebufferDrawBuffer::ColorAttachment3 } GeneralFramebufferDrawBuffer::ColorAttachment4 => { FramebufferDrawBuffer::ColorAttachment4 } GeneralFramebufferDrawBuffer::ColorAttachment5 => { FramebufferDrawBuffer::ColorAttachment5 } GeneralFramebufferDrawBuffer::ColorAttachment6 => { FramebufferDrawBuffer::ColorAttachment6 } GeneralFramebufferDrawBuffer::ColorAttachment7 => { FramebufferDrawBuffer::ColorAttachment7 } } } } pub enum DrawTextureAttachOption<'a> { AttachTexture(&'a mut Texture), AttachTextureLayer { texture: &'a mut Texture, level: u32, layer: u32, }, None, Keep, } impl<'a> Default for DrawTextureAttachOption<'a> { fn default() -> DrawTextureAttachOption<'a> { DrawTextureAttachOption::None } } pub enum DepthStencilOption<'a> { Separate { depth: DrawTextureAttachOption<'a>, stencil: DrawTextureAttachOption<'a>, }, Together(DrawTextureAttachOption<'a>), } impl<'a> Default for DepthStencilOption<'a> { fn default() -> DepthStencilOption<'a> { DepthStencilOption::Separate { depth: DrawTextureAttachOption::None, stencil: DrawTextureAttachOption::None, } } } #[derive(Default)] pub struct DrawTextureTarget<'a> { pub depth_stencil: DepthStencilOption<'a>, pub color0: DrawTextureAttachOption<'a>, pub color1: DrawTextureAttachOption<'a>, pub color2: DrawTextureAttachOption<'a>, pub color3: DrawTextureAttachOption<'a>, pub color4: DrawTextureAttachOption<'a>, pub color5: DrawTextureAttachOption<'a>, pub color6: DrawTextureAttachOption<'a>, pub color7: DrawTextureAttachOption<'a>, } pub enum FramebufferRenderTarget<'a> { Default, General(&'a GeneralFramebuffer, &'a DrawTextureTarget<'a>), }