bevy_render::render_phase

Trait Draw

Source
pub trait Draw<P: PhaseItem>:
    Send
    + Sync
    + 'static {
    // Required method
    fn draw<'w>(
        &mut self,
        world: &'w World,
        pass: &mut TrackedRenderPass<'w>,
        view: Entity,
        item: &P,
    ) -> Result<(), DrawError>;

    // Provided method
    fn prepare(&mut self, world: &World) { ... }
}
Expand description

A draw function used to draw PhaseItems.

The draw function can retrieve and query the required ECS data from the render world.

This trait can either be implemented directly or implicitly composed out of multiple modular RenderCommands. For more details and an example see the RenderCommand documentation.

Required Methods§

Source

fn draw<'w>( &mut self, world: &'w World, pass: &mut TrackedRenderPass<'w>, view: Entity, item: &P, ) -> Result<(), DrawError>

Draws a PhaseItem by issuing zero or more draw calls via the TrackedRenderPass.

Provided Methods§

Source

fn prepare(&mut self, world: &World)

Prepares the draw function to be used. This is called once and only once before the phase begins. There may be zero or more draw calls following a call to this function. Implementing this is optional.

Implementors§

Source§

impl<P: PhaseItem, C: RenderCommand<P> + Send + Sync + 'static> Draw<P> for RenderCommandState<P, C>