Skip to content

Commit d5d57bb

Browse files
komadorialice-i-cecile
authored andcommitted
Expose symbols needed to replicate SetMeshBindGroup in ecosystem crates. (#18613)
# Objective My ecosystem crate, bevy_mod_outline, currently uses `SetMeshBindGroup` as part of its custom rendering pipeline. I would like to allow for possibility that, due to changes in 0.16, I need to customise the behaviour of `SetMeshBindGroup` in order to make it work. However, not all of the symbol needed to implement this render command are public outside of Bevy. ## Solution - Include `MorphIndices` in re-export list. I feel this is morally equivalent to `SkinUniforms` already being exported. - Change `MorphIndex::index` field to be public. I feel this is morally equivalent to the `SkinByteOffset::byte_offset` field already being public. - Change `RenderMeshIntances::mesh_asset_id()` to be public (although since all the fields of `RenderMeshInstances` are public it's possible to work around this one by reimplementing). These changes exclude: - Making any change to the `RenderLightmaps` type as I don't need to bind the light-maps for my use-case and I wanted to keep these changes minimal. It has a private field which would need to be public or have access methods. - The changes already included in #18612. ## Testing Confirmed that a copy of `SetMeshBindGroup` can be compiled outside of Bevy with these changes, provided that the light-map code is removed. --------- Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
1 parent 754d1fa commit d5d57bb

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

crates/bevy_pbr/src/render/mesh.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ impl RenderMeshInstances {
937937
}
938938

939939
/// Returns the ID of the mesh asset attached to the given entity, if any.
940-
pub(crate) fn mesh_asset_id(&self, entity: MainEntity) -> Option<AssetId<Mesh>> {
940+
pub fn mesh_asset_id(&self, entity: MainEntity) -> Option<AssetId<Mesh>> {
941941
match *self {
942942
RenderMeshInstances::CpuBuilding(ref instances) => instances.mesh_asset_id(entity),
943943
RenderMeshInstances::GpuBuilding(ref instances) => instances.mesh_asset_id(entity),

crates/bevy_pbr/src/render/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,5 @@ pub use light::*;
1313
pub use mesh::*;
1414
pub use mesh_bindings::MeshLayouts;
1515
pub use mesh_view_bindings::*;
16+
pub use morph::*;
1617
pub use skin::{extract_skins, prepare_skins, skins_use_uniform_buffers, SkinUniforms, MAX_JOINTS};

crates/bevy_pbr/src/render/morph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use bytemuck::NoUninit;
1414

1515
#[derive(Component)]
1616
pub struct MorphIndex {
17-
pub(super) index: u32,
17+
pub index: u32,
1818
}
1919

2020
/// Maps each mesh affected by morph targets to the applicable offset within the

0 commit comments

Comments
 (0)