diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 05292f7fce..ca9b63e95d 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -550,7 +550,7 @@ pub(super) fn clear_material_instances( fn extract_mesh_materials( mut material_instances: ResMut>, - query: Extract), With>>, + query: Extract)>>, ) { for (entity, view_visibility, material) in &query { if view_visibility.get() { diff --git a/crates/bevy_pbr/src/meshlet/mod.rs b/crates/bevy_pbr/src/meshlet/mod.rs index 84c89ff440..17793af5d6 100644 --- a/crates/bevy_pbr/src/meshlet/mod.rs +++ b/crates/bevy_pbr/src/meshlet/mod.rs @@ -55,7 +55,7 @@ use self::{ }, visibility_buffer_raster_node::MeshletVisibilityBufferRasterPassNode, }; -use crate::{graph::NodePbr, Material}; +use crate::{graph::NodePbr, Material, MeshMaterial3d}; use bevy_app::{App, Plugin, PostUpdate}; use bevy_asset::{load_internal_asset, AssetApp, Handle}; use bevy_core_pipeline::{ @@ -288,7 +288,7 @@ impl Plugin for MeshletPlugin { #[derive(Bundle, Clone)] pub struct MaterialMeshletMeshBundle { pub meshlet_mesh: Handle, - pub material: Handle, + pub material: MeshMaterial3d, pub transform: Transform, pub global_transform: GlobalTransform, /// User indication of whether an entity is visible diff --git a/examples/3d/meshlet.rs b/examples/3d/meshlet.rs index d8a09a2356..5a9e040194 100644 --- a/examples/3d/meshlet.rs +++ b/examples/3d/meshlet.rs @@ -86,7 +86,7 @@ fn setup( for x in -2..=2 { commands.spawn(MaterialMeshletMeshBundle { meshlet_mesh: meshlet_mesh_handle.clone(), - material: standard_materials.add(StandardMaterial { + material: MeshMaterial3d(standard_materials.add(StandardMaterial { base_color: match x { -2 => Srgba::hex("#dc2626").unwrap().into(), -1 => Srgba::hex("#ea580c").unwrap().into(), @@ -97,7 +97,7 @@ fn setup( }, perceptual_roughness: (x + 2) as f32 / 4.0, ..default() - }), + })), transform: Transform::default() .with_scale(Vec3::splat(0.2)) .with_translation(Vec3::new(x as f32 / 2.0, 0.0, -0.3)), @@ -107,7 +107,7 @@ fn setup( for x in -2..=2 { commands.spawn(MaterialMeshletMeshBundle { meshlet_mesh: meshlet_mesh_handle.clone(), - material: debug_material.clone(), + material: debug_material.clone().into(), transform: Transform::default() .with_scale(Vec3::splat(0.2)) .with_rotation(Quat::from_rotation_y(PI))