1
1
use 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 ,
5
5
} ;
6
6
use bevy_app:: { App , Plugin } ;
7
7
use bevy_asset:: { AddAsset , AssetEvent , AssetServer , Assets , Handle } ;
@@ -409,7 +409,7 @@ pub fn queue_material_meshes<M: Material>(
409
409
& Handle < M > ,
410
410
& mut MaterialBindGroupId ,
411
411
& Handle < Mesh > ,
412
- & MeshTransforms ,
412
+ & mut MeshTransforms ,
413
413
) > ,
414
414
images : Res < RenderAssets < Image > > ,
415
415
mut views : Query < (
@@ -494,8 +494,12 @@ pub fn queue_material_meshes<M: Material>(
494
494
495
495
let rangefinder = view. rangefinder3d ( ) ;
496
496
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)
499
503
{
500
504
if let ( Some ( mesh) , Some ( material) ) = (
501
505
render_meshes. get ( mesh_handle) ,
@@ -504,8 +508,13 @@ pub fn queue_material_meshes<M: Material>(
504
508
let mut mesh_key =
505
509
MeshPipelineKey :: from_primitive_topology ( mesh. primitive_topology )
506
510
| view_key;
511
+
512
+ if is_skinned ( & mesh. layout ) {
513
+ mesh_transforms. flags |= MeshFlags :: SKINNED . bits ( ) ;
514
+ }
507
515
if mesh. morph_targets . is_some ( ) {
508
516
mesh_key |= MeshPipelineKey :: MORPH_TARGETS ;
517
+ mesh_transforms. flags |= MeshFlags :: MORPH_TARGETS . bits ( ) ;
509
518
}
510
519
match material. properties . alpha_mode {
511
520
AlphaMode :: Blend => {
0 commit comments