pub trait GetBatchData {
    type Param: SystemParam + 'static;
    type Query: ReadOnlyWorldQueryData;
    type QueryFilter: WorldQueryFilter;
    type CompareData: PartialEq<Self::CompareData>;
    type BufferData: GpuArrayBufferable + Sync + Send + 'static;

    // Required method
    fn get_batch_data(
        param: &<Self::Param as SystemParam>::Item<'_, '_>,
        query_item: &<Self::Query as WorldQuery>::Item<'_>
    ) -> (Self::BufferData, Option<Self::CompareData>);
}
Expand description

A trait to support getting data used for batching draw commands via phase items.

Required Associated Types§

type Param: SystemParam + 'static

type Query: ReadOnlyWorldQueryData

type QueryFilter: WorldQueryFilter

type CompareData: PartialEq<Self::CompareData>

Data used for comparison between phase items. If the pipeline id, draw function id, per-instance data buffer dynamic offset and this data matches, the draws can be batched.

type BufferData: GpuArrayBufferable + Sync + Send + 'static

The per-instance data to be inserted into the GpuArrayBuffer containing these data for all instances.

Required Methods§

fn get_batch_data( param: &<Self::Param as SystemParam>::Item<'_, '_>, query_item: &<Self::Query as WorldQuery>::Item<'_> ) -> (Self::BufferData, Option<Self::CompareData>)

Get the per-instance data to be inserted into the GpuArrayBuffer. If the instance can be batched, also return the data used for comparison when deciding whether draws can be batched, else return None for the CompareData.

Implementors§