//! Particle rendering — dispatches to per-mode renderers.

pub mod billboard;

use super::buffers::GpuPhysicsBuffers;
use crate::camera::Camera;

/// Main particle renderer — delegates to mode-specific sub-renderers.
pub struct ParticleRenderer {
    pub billboard: billboard::BillboardRenderer,
}

impl ParticleRenderer {
    pub fn new(device: &wgpu::Device) -> Self {
        Self {
            billboard: billboard::BillboardRenderer::new(device),
        }
    }

    /// Prepare rendering state (bind groups, uniforms). Call before the render pass.
    pub fn prepare(
        &mut self,
        device: &wgpu::Device,
        queue: &wgpu::Queue,
        buffers: &GpuPhysicsBuffers,
        camera: &Camera,
    ) {
        self.billboard.prepare(device, queue, buffers, camera);
    }

    /// Render particles. Call after prepare, inside a render pass.
    pub fn render<'a>(&'a self, render_pass: &mut wgpu::RenderPass<'a>, max_particles: u32) {
        self.billboard.render(render_pass, max_particles);
    }
}
