RetainedViewEntity is used as a stable identifier across frames
|
/// An identifier for a view that is stable across frames. |
|
/// |
|
/// We can't use [`Entity`] for this because render world entities aren't |
|
/// stable, and we can't use just [`MainEntity`] because some main world views |
|
/// extract to multiple render world views. For example, a directional light |
|
/// extracts to one render world view per cascade, and a point light extracts to |
|
/// one render world view per cubemap face. So we pair the main entity with an |
|
/// *auxiliary entity* and a *subview index*, which *together* uniquely identify |
|
/// a view in the render world in a way that's stable from frame to frame. |
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] |
|
pub struct RetainedViewEntity { |
Since #18722 is fixed, the render entity across frames should be stable now. We can try replacing RetainedViewEntity with Entity and use faster EntityHasher.
Also ViewKeyCache may be converted from a Hashmap to a Component.
RetainedViewEntityis used as a stable identifier across framesbevy/crates/bevy_render/src/view/mod.rs
Lines 268 to 278 in 25368b7
Since #18722 is fixed, the render entity across frames should be stable now. We can try replacing
RetainedViewEntitywithEntityand use fasterEntityHasher.Also
ViewKeyCachemay be converted from a Hashmap to a Component.