use super::*;
#[derive(Clone, Copy, Data, Debug, Default, PartialEq)]
pub struct RenderStats3D {
#[get(type(copy))]
pub(crate) render_width: u32,
#[get(type(copy))]
pub(crate) render_height: u32,
#[get(type(copy))]
pub(crate) visible_objects: usize,
#[get(type(copy))]
pub(crate) culled_objects: usize,
#[get(type(copy))]
pub(crate) instanced_batches: usize,
#[get(type(copy))]
pub(crate) triangles_drawn: usize,
#[get(type(copy))]
pub(crate) rays_traced: usize,
#[get(type(copy))]
pub(crate) bvh_nodes: usize,
#[get(type(copy))]
pub(crate) lod_simplified_objects: usize,
#[get(type(copy))]
pub(crate) meshlets_drawn: usize,
#[get(type(copy))]
pub(crate) meshlets_culled: usize,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct GShadeTri {
pub(crate) shade_n: Vec3,
pub(crate) mat_base: Vec3,
pub(crate) mat_emissive: Vec3,
pub(crate) ambient_sky: Vec3,
pub(crate) f0: Vec3,
pub(crate) n_dot_l: f32,
pub(crate) alpha2: f32,
pub(crate) diffuse_scale: f32,
pub(crate) mat_refl: f32,
pub(crate) metallic: f32,
pub(crate) do_refl: bool,
pub(crate) surface_detail: SurfaceDetailMode,
}
#[derive(Clone, Copy, Debug, Default)]
pub(crate) struct RtProbeSample {
pub(crate) shadow: f32,
pub(crate) refl_r: f32,
pub(crate) refl_g: f32,
pub(crate) refl_b: f32,
pub(crate) gi_r: f32,
pub(crate) gi_g: f32,
pub(crate) gi_b: f32,
pub(crate) ao: f32,
pub(crate) depth: f32,
pub(crate) nx: f32,
pub(crate) ny: f32,
pub(crate) nz: f32,
pub(crate) valid: u8,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct DeferredFrameCtx {
pub(crate) w: usize,
pub(crate) h: usize,
pub(crate) gw: usize,
pub(crate) gh: usize,
pub(crate) bw: usize,
pub(crate) rt_step: usize,
pub(crate) inv_w_f: f32,
pub(crate) inv_h_f: f32,
pub(crate) cam_pos: Vec3,
pub(crate) cam_fwd: Vec3,
pub(crate) cam_right_scaled: Vec3,
pub(crate) cam_up_scaled: Vec3,
pub(crate) sun: DirectionalLight3D,
pub(crate) inv_sun_dir: Vec3,
pub(crate) rt_mode: RayTracingMode,
pub(crate) reflection_bounces: u8,
pub(crate) fog_on: bool,
pub(crate) inv_fog_dist: f32,
pub(crate) exposure_scale: f32,
pub(crate) bloom_on: bool,
}
#[derive(Clone, Data, Debug, Default)]
pub struct Renderer3D {
pub(crate) color_buffer: Vec<u8>,
pub(crate) aa_buffer: Vec<u8>,
pub(crate) depth_buffer: Vec<f32>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) g_tri_idx: Vec<u32>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) luma_buffer: Vec<u8>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) shaded_tris: Vec<GShadeTri>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) rt_probes: Vec<RtProbeSample>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) rt_probes_denoised: Vec<RtProbeSample>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) bloom_a: Vec<[f32; 3]>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) bloom_b: Vec<[f32; 3]>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) visible_scratch: Vec<(f32, usize)>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) unique_meshes_scratch: HashSet<usize>,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) has_taa_history: bool,
#[get(skip)]
#[get_mut(skip)]
#[set(skip)]
pub(crate) prev_vp_m0: f32,
#[get(type(copy))]
pub(crate) width: u32,
#[get(type(copy))]
pub(crate) height: u32,
#[get(type(copy))]
pub(crate) last_stats: RenderStats3D,
}