use super::*;
#[derive(Clone, Data, Debug)]
pub struct GlBuffer {
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) buffer: WebGlBuffer,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub capacity: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub usage: u32,
}
#[derive(Clone, Data, Debug)]
pub struct GlTexture {
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub texture: WebGlTexture,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub width: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub height: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub levels: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub mipmapped: bool,
}
#[derive(Clone, Data, Debug)]
pub struct GlVertexArray {
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) vao: WebGlVertexArrayObject,
}
#[derive(Clone, Data, Debug)]
pub struct GlFramebuffer {
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) framebuffer: WebGlFramebuffer,
#[get(type(clone))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub depth: Option<WebGlRenderbuffer>,
#[get(type(clone))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub color: GlTexture,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub width: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub height: u32,
}
#[derive(Clone, Data, Debug)]
pub struct GlProgram {
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) program: WebGlProgram,
#[get(pub(crate), type(clone))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) uniforms: HashMap<String, Option<WebGlUniformLocation>>,
#[get(pub(crate), type(clone))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) blocks: HashMap<String, u32>,
}
#[derive(Clone, Data, Debug)]
pub struct GlUniformBlock {
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) buffer: WebGlBuffer,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub binding: u32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub capacity: u32,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct GlBlendState {
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub enabled: bool,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub color: BlendComponent,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub alpha: BlendComponent,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct GlDepthState {
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub enabled: bool,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub compare: CompareFunction,
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) write_enabled: bool,
}
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct GlCullState {
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub mode: CullMode,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub front_face: FrontFace,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct GlColorMask {
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub bits: u32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct GlScissor {
#[get(type(copy))]
#[get_mut(pub(crate))]
pub x: i32,
#[get(type(copy))]
pub y: i32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub width: i32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub height: i32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct GlViewport {
#[get(type(copy))]
pub x: i32,
#[get(type(copy))]
#[get_mut(pub(crate))]
pub y: i32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub width: i32,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub height: i32,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct GlRenderState {
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub depth: GlDepthState,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub blend: GlBlendState,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub cull: GlCullState,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub color_mask: GlColorMask,
#[get(type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub scissor: Option<GlScissor>,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub viewport: GlViewport,
}
#[derive(Clone, Data, Debug)]
pub struct WebGl2Backend {
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub canvas: HtmlCanvasElement,
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub context: WebGl2RenderingContext,
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) shadow: GlRenderState,
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) active_unit: u32,
#[get(pub(crate))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) bound_program: JsValue,
#[get(pub(crate), type(copy))]
#[set(pub(crate))]
#[get_mut(pub(crate))]
pub(crate) clear_color_field: Color,
#[get_mut(pub(crate))]
#[get(pub(crate))]
#[set(pub(crate))]
pub(crate) readback: Vec<u8>,
}
#[derive(Clone, Data, New)]
pub struct WebGl2BackendInit {
pub canvas: HtmlCanvasElement,
pub context: WebGl2RenderingContext,
#[get(type(copy))]
pub width: u32,
#[get(type(copy))]
pub height: u32,
pub clear_color: Color,
}
#[derive(Clone, Copy, Data, New)]
pub struct GlRenderStateInit {
pub depth: GlDepthState,
pub blend: GlBlendState,
pub cull: GlCullState,
pub color_mask: GlColorMask,
#[get(type(copy))]
pub scissor: Option<GlScissor>,
pub viewport: GlViewport,
}