mod execute;
mod prepare;

use crate::render::wgpu::rendergraph::{PassExecutionContext, PassNode};

use super::pass::SkinnedMeshPass;

impl PassNode<crate::ecs::world::World> for SkinnedMeshPass {
    fn name(&self) -> &str {
        "skinned_mesh_pass"
    }

    fn reads(&self) -> Vec<&str> {
        vec!["shadow_depth", "spotlight_shadow_atlas"]
    }

    fn writes(&self) -> Vec<&str> {
        vec![]
    }

    fn reads_writes(&self) -> Vec<&str> {
        vec!["color", "depth", "entity_id"]
    }

    fn prepare(
        &mut self,
        device: &wgpu::Device,
        queue: &wgpu::Queue,
        world: &crate::ecs::world::World,
    ) {
        self.prepare_pass_node(device, queue, world);
    }

    fn execute<'r, 'e>(
        &mut self,
        context: PassExecutionContext<'r, 'e, crate::ecs::world::World>,
    ) -> crate::render::wgpu::rendergraph::Result<
        Vec<crate::render::wgpu::rendergraph::SubGraphRunCommand<'r>>,
    > {
        self.execute_pass_node(context)
    }
}
