set_mesh_motion_vector_flags

Function set_mesh_motion_vector_flags 

Source
pub fn set_mesh_motion_vector_flags(
    render_mesh_instances: ResMut<'_, RenderMeshInstances>,
    skin_uniforms: Res<'_, SkinUniforms>,
    morph_indices: Res<'_, MorphIndices>,
)
Expand description

A system that sets the RenderMeshInstanceFlags for each mesh based on whether the previous frame had skins and/or morph targets.

Ordinarily, RenderMeshInstanceFlags are set during the extraction phase. However, we can’t do that for the flags related to skins and morph targets because the previous frame’s skin and morph targets are the responsibility of extract_skins and extract_morphs respectively. We want to run those systems in parallel with mesh extraction for performance, so we need to defer setting of these mesh instance flags to after extraction, which this system does. An alternative to having skin- and morph-target-related data in RenderMeshInstanceFlags would be to have crate::material::queue_material_meshes check the skin and morph target tables for each mesh, but that would be too slow in the hot mesh queuing loop.