fn prepare_uniform_components<C: Component>(
    mut commands: Commands,
    render_device: Res<RenderDevice>,
    render_queue: Res<RenderQueue>,
    mut component_uniforms: ResMut<ComponentUniforms<C>>,
    components: Query<(Entity, &C)>,
) where
    C: AsStd140 + Clone,
{
    component_uniforms.uniforms.clear();
    for (entity, component) in components.iter() {
        commands
            .get_or_spawn(entity)
            .insert(DynamicUniformIndex::<C> {
                index: component_uniforms.uniforms.push(component.clone()),
                marker: PhantomData,
            });
    }

    component_uniforms
        .uniforms
        .write_buffer(&render_device, &render_queue);
}
/// This system prepares all components of the corresponding component type.
/// They are transformed into uniforms and stored in the [`ComponentUniforms`] resource.
This system prepares all components of the corresponding component type.
They are transformed into uniforms and stored in the [`ComponentUniforms`] resource.
This system prepares all components of the corresponding component type . They are transformed into uniforms and stored in the [ ` ComponentUniforms ` ] resource .
fn prepare_uniform_components<C: Component>(
    mut commands: Commands,
    render_device: Res<RenderDevice>,
    render_queue: Res<RenderQueue>,
    mut component_uniforms: ResMut<ComponentUniforms<C>>,
    components: Query<(Entity, &C)>,
) where
    C: AsStd140 + Clone,
{
    component_uniforms.uniforms.clear();
    for (entity, component) in components.iter() {
        commands
            .get_or_spawn(entity)
            .insert(DynamicUniformIndex::<C> {
                index: component_uniforms.uniforms.push(component.clone()),
                marker: PhantomData,
            });
    }
    component_uniforms
        .uniforms
        .write_buffer(&render_device, &render_queue);
}
fn prepare_uniform_components < C : Component > ( mut commands : Commands , render_device : Res < RenderDevice > , render_queue : Res < RenderQueue > , mut component_uniforms : ResMut < ComponentUniforms < C > > , components : Query < ( Entity , & C ) > , ) where C : AsStd140 + Clone , { component_uniforms . uniforms . clear ( ) ; for ( entity , component ) in components . iter ( ) { commands . get_or_spawn ( entity ) . insert ( DynamicUniformIndex :: < C > { index : component_uniforms . uniforms . push ( component . clone ( ) ) , marker : PhantomData , } ) ; } component_uniforms . uniforms . write_buffer ( & render_device , & render_queue ) ; }
This system prepares all components of the corresponding component type.
This system prepares all components of the corresponding component type .
commands
Commands
render_device
Res<RenderDevice>
render_queue
Res<RenderQueue>
component_uniforms
ResMut<ComponentUniforms<C>>
components
Query<(Entity, &C)>
commands
Commands
render_device
Res<RenderDevice>
render_queue
Res<RenderQueue>
component_uniforms
ResMut<ComponentUniforms<C>>
components
Query<(Entity, &C)>