use super::*;
#[derive(Clone, Copy, Data, Debug, New, PartialEq, PartialOrd)]
pub struct Camera2D {
#[get(type(copy))]
pub(crate) position: Vector2D,
#[get(type(copy))]
pub(crate) zoom: f64,
#[get(type(copy))]
pub(crate) rotation: f64,
#[get(type(copy))]
pub(crate) viewport_width: f64,
#[get(type(copy))]
pub(crate) viewport_height: f64,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq, PartialOrd)]
pub struct Camera3D {
#[get(type(copy))]
pub(crate) position: Vector3D,
#[get(type(copy))]
pub(crate) target: Vector3D,
#[get(type(copy))]
#[new(skip)]
pub(crate) up: Vector3D,
#[get(type(copy))]
#[new(skip)]
pub(crate) fov: f64,
#[get(type(copy))]
#[new(skip)]
pub(crate) near: f64,
#[get(type(copy))]
#[new(skip)]
pub(crate) far: f64,
#[get(type(copy))]
pub(crate) viewport_width: f64,
#[get(type(copy))]
pub(crate) viewport_height: f64,
}
#[derive(Clone, Data, New)]
pub struct CanvasRenderer {
pub(crate) context: CanvasRenderingContext2d,
#[get(type(copy))]
pub(crate) camera: Camera2D,
#[get(type(copy))]
pub(crate) quality: RenderQuality,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct LinearGradient {
#[get(type(copy))]
pub(crate) start: Vector2D,
#[get(type(copy))]
pub(crate) end: Vector2D,
pub(crate) stops: Vec<(f64, String)>,
}
#[derive(Clone, Data, Debug, New, PartialEq)]
pub struct RadialGradient {
#[get(type(copy))]
pub(crate) inner_center: Vector2D,
#[get(type(copy))]
pub(crate) inner_radius: f64,
#[get(type(copy))]
pub(crate) outer_center: Vector2D,
#[get(type(copy))]
pub(crate) outer_radius: f64,
pub(crate) stops: Vec<(f64, String)>,
}
#[derive(Clone, Data, Debug, New, PartialEq, PartialOrd)]
pub struct ShadowConfig {
#[get(type(clone))]
pub(crate) color: String,
#[get(type(copy))]
pub(crate) blur: f64,
#[get(type(copy))]
pub(crate) offset_x: f64,
#[get(type(copy))]
pub(crate) offset_y: f64,
}
#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, Ord, PartialEq, PartialOrd)]
pub struct RenderLayer {
#[get(type(copy))]
pub(crate) z_index: i32,
#[get(type(copy))]
pub(crate) visible: bool,
}
#[derive(Clone, Data, Debug, Default, New)]
pub struct DrawList {
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) commands: Vec<DrawCommand>,
}
#[derive(Clone, Data, New)]
pub struct SsaaCanvas {
pub(crate) display_canvas: HtmlCanvasElement,
pub(crate) display_context: CanvasRenderingContext2d,
pub(crate) offscreen_canvas: HtmlCanvasElement,
pub(crate) offscreen_context: CanvasRenderingContext2d,
#[get(type(copy))]
pub(crate) scale_factor: f64,
#[new(skip)]
#[get(type(copy))]
pub(crate) quality: RenderQuality,
#[get(type(copy))]
pub(crate) width: f64,
#[get(type(copy))]
pub(crate) height: f64,
}
#[derive(Clone, Data)]
pub struct WebGpuRenderer {
pub(crate) device: JsValue,
pub(crate) queue: JsValue,
pub(crate) context: JsValue,
pub(crate) canvas: HtmlCanvasElement,
#[get(type(clone))]
pub(crate) format: String,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) antialias: bool,
#[get(type(clone))]
pub(crate) multisample_texture: Option<JsValue>,
#[get(type(clone))]
pub(crate) multisample_view: Option<JsValue>,
#[get(type(clone))]
pub(crate) depth_texture: Option<JsValue>,
#[get(type(clone))]
pub(crate) depth_view: Option<JsValue>,
#[get(type(clone))]
pub(crate) depth_format: Option<String>,
#[get(type(clone))]
pub(crate) device_lost_callback: Option<js_sys::Function>,
#[get(type(copy))]
pub(crate) device_lost: bool,
pub(crate) pending_error: Rc<PendingErrorCell>,
#[get(type(clone))]
pub(crate) command_encoder: Option<JsValue>,
}
#[derive(Clone, Data)]
pub struct WebGlRenderer {
pub(crate) context: WebGl2RenderingContext,
pub(crate) canvas: HtmlCanvasElement,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
}
#[derive(Clone, Copy, Debug, New, PartialEq, Eq, Hash, Getter)]
pub struct VertexAttribute {
#[get(type(copy))]
pub(crate) shader_location: u32,
#[get(type(copy))]
pub(crate) offset: u64,
#[get(type(clone))]
pub(crate) format: &'static str,
}
#[derive(Clone, Debug, New, Getter)]
pub struct VertexBufferLayout {
#[get(type(copy))]
pub(crate) array_stride: u64,
#[get(type(copy))]
pub(crate) step_mode: VertexStepMode,
pub(crate) attributes: Vec<VertexAttribute>,
}
#[derive(Clone, Debug, New, Getter)]
pub struct Texture2DDescriptor {
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(clone))]
pub(crate) format: &'static str,
#[get(type(copy))]
#[new(skip)]
pub(crate) mip_level_count: u32,
#[get(type(copy))]
#[new(skip)]
pub(crate) sample_count: u32,
#[get(type(clone))]
#[new(skip)]
pub(crate) usage: &'static str,
}
#[derive(Clone, Debug, New, Getter)]
pub struct GpuSamplerDescriptor {
#[get(type(clone))]
#[new(skip)]
pub(crate) mag_filter: &'static str,
#[get(type(clone))]
#[new(skip)]
pub(crate) min_filter: &'static str,
#[get(type(clone))]
#[new(skip)]
pub(crate) mipmap_filter: &'static str,
#[get(type(clone))]
#[new(skip)]
pub(crate) address_mode_u: &'static str,
#[get(type(clone))]
#[new(skip)]
pub(crate) address_mode_v: &'static str,
#[get(type(clone))]
#[new(skip)]
pub(crate) address_mode_w: &'static str,
#[get(type(copy))]
#[new(skip)]
pub(crate) compare: bool,
}
#[derive(Clone, Debug)]
pub struct RenderPassColorAttachment {
pub(crate) view: Option<JsValue>,
pub(crate) resolve_target: Option<JsValue>,
pub(crate) clear_value: Option<(f64, f64, f64, f64)>,
pub(crate) load_op: Option<&'static str>,
pub(crate) store_op: Option<&'static str>,
}
#[derive(Clone, Debug)]
pub struct RenderPassDepthStencilAttachment {
pub(crate) view: Option<JsValue>,
pub(crate) depth_clear_value: Option<f32>,
pub(crate) depth_load_op: Option<&'static str>,
pub(crate) depth_store_op: Option<&'static str>,
pub(crate) depth_read_only: Option<bool>,
}
#[derive(Clone, Debug, New, Getter)]
pub struct TextureViewDescriptor {
#[get(type(clone))]
#[new(value = "None")]
pub(crate) format: Option<&'static str>,
#[get(type(clone))]
#[new(value = "None")]
pub(crate) dimension: Option<&'static str>,
#[get(type(copy))]
#[new(value = "0")]
pub(crate) base_mip_level: u32,
#[get(type(copy))]
#[new(value = "0")]
pub(crate) mip_level_count: u32,
#[get(type(copy))]
#[new(value = "0")]
pub(crate) base_array_layer: u32,
#[get(type(copy))]
#[new(value = "0")]
pub(crate) array_layer_count: u32,
#[get(type(clone))]
#[new(value = "None")]
pub(crate) aspect: Option<&'static str>,
}
#[derive(Clone, Debug, New, Getter)]
pub struct TextureWriteDescriptor {
#[get(type(clone))]
pub(crate) data: Vec<u8>,
#[get(type(copy))]
pub(crate) bytes_per_row: u32,
#[get(type(copy))]
pub(crate) rows_per_image: u32,
#[get(type(copy))]
pub(crate) mip_level: u32,
#[get(type(clone))]
pub(crate) texture: JsValue,
#[get(type(clone))]
#[new(value = "None")]
pub(crate) origin: Option<JsValue>,
#[get(type(copy))]
#[new(value = "false")]
pub(crate) flip_y: bool,
}
pub struct PendingErrorCell(
)` (not just `pub`) because the field is
pub(crate) UnsafeCell<Option<JsValue>>,
);