Fix UI borders (#10078)
# Objective Fixes #10069 ## Solution Extracted UI nodes were previously stored in a `SparseSet` and had a predictable iteration order. UI borders and outlines relied on this. Now they are stored in a HashMap and that is no longer true. This adds `entity.index()` to the sort key for `TransparentUi` so that the iteration order is predictable and the "border entities" that get spawned during extraction are guaranteed to get drawn after their respective container nodes again. I **think** that everything still works for overlapping ui nodes etc, because the z value / primary sort is still controlled by the "ui stack." Text above is just my current understanding. A rendering expert should check this out. I will do some more testing when I can.
This commit is contained in:
parent
4a61f894b7
commit
26ecfcff43
@ -759,7 +759,10 @@ pub fn queue_uinodes(
|
|||||||
draw_function,
|
draw_function,
|
||||||
pipeline,
|
pipeline,
|
||||||
entity: *entity,
|
entity: *entity,
|
||||||
sort_key: FloatOrd(extracted_uinode.stack_index as f32),
|
sort_key: (
|
||||||
|
FloatOrd(extracted_uinode.stack_index as f32),
|
||||||
|
entity.index(),
|
||||||
|
),
|
||||||
// batch_range will be calculated in prepare_uinodes
|
// batch_range will be calculated in prepare_uinodes
|
||||||
batch_range: 0..0,
|
batch_range: 0..0,
|
||||||
dynamic_offset: None,
|
dynamic_offset: None,
|
||||||
|
|||||||
@ -88,7 +88,7 @@ impl Node for UiPassNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub struct TransparentUi {
|
pub struct TransparentUi {
|
||||||
pub sort_key: FloatOrd,
|
pub sort_key: (FloatOrd, u32),
|
||||||
pub entity: Entity,
|
pub entity: Entity,
|
||||||
pub pipeline: CachedRenderPipelineId,
|
pub pipeline: CachedRenderPipelineId,
|
||||||
pub draw_function: DrawFunctionId,
|
pub draw_function: DrawFunctionId,
|
||||||
@ -97,7 +97,7 @@ pub struct TransparentUi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl PhaseItem for TransparentUi {
|
impl PhaseItem for TransparentUi {
|
||||||
type SortKey = FloatOrd;
|
type SortKey = (FloatOrd, u32);
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn entity(&self) -> Entity {
|
fn entity(&self) -> Entity {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user