11use crate :: {
2- render, AlphaMode , DrawMesh , DrawPrepass , EnvironmentMapLight , MeshPipeline , MeshPipelineKey ,
3- MeshTransforms , PrepassPipelinePlugin , PrepassPlugin , ScreenSpaceAmbientOcclusionSettings ,
4- SetMeshBindGroup , SetMeshViewBindGroup , Shadow ,
2+ is_skinned , render, AlphaMode , DrawMesh , DrawPrepass , EnvironmentMapLight , MeshFlags ,
3+ MeshPipeline , MeshPipelineKey , MeshTransforms , PrepassPipelinePlugin , PrepassPlugin ,
4+ ScreenSpaceAmbientOcclusionSettings , SetMeshBindGroup , SetMeshViewBindGroup , Shadow ,
55} ;
66use bevy_app:: { App , Plugin } ;
77use bevy_asset:: { AddAsset , AssetEvent , AssetServer , Assets , Handle } ;
@@ -409,7 +409,7 @@ pub fn queue_material_meshes<M: Material>(
409409 & Handle < M > ,
410410 & mut MaterialBindGroupId ,
411411 & Handle < Mesh > ,
412- & MeshTransforms ,
412+ & mut MeshTransforms ,
413413 ) > ,
414414 images : Res < RenderAssets < Image > > ,
415415 mut views : Query < (
@@ -494,8 +494,12 @@ pub fn queue_material_meshes<M: Material>(
494494
495495 let rangefinder = view. rangefinder3d ( ) ;
496496 for visible_entity in & visible_entities. entities {
497- if let Ok ( ( material_handle, mut material_bind_group_id, mesh_handle, mesh_transforms) ) =
498- material_meshes. get_mut ( * visible_entity)
497+ if let Ok ( (
498+ material_handle,
499+ mut material_bind_group_id,
500+ mesh_handle,
501+ mut mesh_transforms,
502+ ) ) = material_meshes. get_mut ( * visible_entity)
499503 {
500504 if let ( Some ( mesh) , Some ( material) ) = (
501505 render_meshes. get ( mesh_handle) ,
@@ -504,8 +508,13 @@ pub fn queue_material_meshes<M: Material>(
504508 let mut mesh_key =
505509 MeshPipelineKey :: from_primitive_topology ( mesh. primitive_topology )
506510 | view_key;
511+
512+ if is_skinned ( & mesh. layout ) {
513+ mesh_transforms. flags |= MeshFlags :: SKINNED . bits ( ) ;
514+ }
507515 if mesh. morph_targets . is_some ( ) {
508516 mesh_key |= MeshPipelineKey :: MORPH_TARGETS ;
517+ mesh_transforms. flags |= MeshFlags :: MORPH_TARGETS . bits ( ) ;
509518 }
510519 match material. properties . alpha_mode {
511520 AlphaMode :: Blend => {
0 commit comments