Fix text-2d. (#17674)
# Objective Fix text 2d. Fixes https://github.com/bevyengine/bevy/issues/17670 ## Solution Evidently there's a 1:N extraction going on here that requires using the render entity rather than main entity. ## Testing Text 2d example
This commit is contained in:
parent
18c4050dd2
commit
8c7f1b34d3
@ -485,9 +485,9 @@ pub struct SpriteViewBindGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Resource, Deref, DerefMut, Default)]
|
#[derive(Resource, Deref, DerefMut, Default)]
|
||||||
pub struct SpriteBatches(HashMap<(RetainedViewEntity, MainEntity), SpriteBatch>);
|
pub struct SpriteBatches(HashMap<(RetainedViewEntity, Entity), SpriteBatch>);
|
||||||
|
|
||||||
#[derive(PartialEq, Eq, Clone)]
|
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||||
pub struct SpriteBatch {
|
pub struct SpriteBatch {
|
||||||
image_handle_id: AssetId<Image>,
|
image_handle_id: AssetId<Image>,
|
||||||
range: Range<u32>,
|
range: Range<u32>,
|
||||||
@ -694,7 +694,7 @@ pub fn prepare_sprite_image_bind_groups(
|
|||||||
});
|
});
|
||||||
|
|
||||||
batch_item_index = item_index;
|
batch_item_index = item_index;
|
||||||
current_batch = Some(batches.entry((*retained_view, item.main_entity())).insert(
|
current_batch = Some(batches.entry((*retained_view, item.entity())).insert(
|
||||||
SpriteBatch {
|
SpriteBatch {
|
||||||
image_handle_id: batch_image_handle,
|
image_handle_id: batch_image_handle,
|
||||||
range: index..index,
|
range: index..index,
|
||||||
@ -846,7 +846,7 @@ impl<P: PhaseItem, const I: usize> RenderCommand<P> for SetSpriteTextureBindGrou
|
|||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
let image_bind_groups = image_bind_groups.into_inner();
|
let image_bind_groups = image_bind_groups.into_inner();
|
||||||
let Some(batch) = batches.get(&(view.retained_view_entity, item.main_entity())) else {
|
let Some(batch) = batches.get(&(view.retained_view_entity, item.entity())) else {
|
||||||
return RenderCommandResult::Skip;
|
return RenderCommandResult::Skip;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -876,7 +876,7 @@ impl<P: PhaseItem> RenderCommand<P> for DrawSpriteBatch {
|
|||||||
pass: &mut TrackedRenderPass<'w>,
|
pass: &mut TrackedRenderPass<'w>,
|
||||||
) -> RenderCommandResult {
|
) -> RenderCommandResult {
|
||||||
let sprite_meta = sprite_meta.into_inner();
|
let sprite_meta = sprite_meta.into_inner();
|
||||||
let Some(batch) = batches.get(&(view.retained_view_entity, item.main_entity())) else {
|
let Some(batch) = batches.get(&(view.retained_view_entity, item.entity())) else {
|
||||||
return RenderCommandResult::Skip;
|
return RenderCommandResult::Skip;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user