pub struct PbrSsboTransformRegistry {
pub entity_to_transform: HashMap<Entity, u32>,
pub available_transform_ids: Vec<u32>,
pub next_transform_id: u32,
pub dirty_transforms: Vec<(u32, TransformUniform)>,
}Expand description
Resource to track the mapping between entities and their transform IDs in the SSBO, as well as the list of dirty transforms that need to be updated in the SSBO. This is used to update the PbrSsboTransform with the new transforms of the entities with a PBR material.
Fields§
§entity_to_transform: HashMap<Entity, u32>§available_transform_ids: Vec<u32>§next_transform_id: u32§dirty_transforms: Vec<(u32, TransformUniform)>Implementations§
Source§impl PbrSsboTransformRegistry
impl PbrSsboTransformRegistry
Sourcepub fn add_entity(&mut self, entity: Entity, transform: GlobalTransform) -> u32
pub fn add_entity(&mut self, entity: Entity, transform: GlobalTransform) -> u32
Register an entity with its transform in the registry, returning the assigned transform ID in the SSBO. If the entity is already registered, returns the existing transform ID.
Sourcepub fn get_transform_id(&self, entity: Entity) -> Option<u32>
pub fn get_transform_id(&self, entity: Entity) -> Option<u32>
Get the transform ID of an entity in the registry, if it exists.
Sourcepub fn update_entity(&mut self, entity: Entity, transform: GlobalTransform)
pub fn update_entity(&mut self, entity: Entity, transform: GlobalTransform)
Update the transform of an entity in the registry, marking it as dirty for the next SSBO update. If the entity is not registered, it will be added to the registry.
Sourcepub fn remove_entity(&mut self, entity: Entity)
pub fn remove_entity(&mut self, entity: Entity)
Unregister an entity from the registry, freeing its transform ID for future use.
Trait Implementations§
Source§impl Clone for PbrSsboTransformRegistry
impl Clone for PbrSsboTransformRegistry
Source§fn clone(&self) -> PbrSsboTransformRegistry
fn clone(&self) -> PbrSsboTransformRegistry
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for PbrSsboTransformRegistry
impl Default for PbrSsboTransformRegistry
Source§fn default() -> PbrSsboTransformRegistry
fn default() -> PbrSsboTransformRegistry
impl Resource for PbrSsboTransformRegistry
Auto Trait Implementations§
impl Freeze for PbrSsboTransformRegistry
impl RefUnwindSafe for PbrSsboTransformRegistry
impl Send for PbrSsboTransformRegistry
impl Sync for PbrSsboTransformRegistry
impl Unpin for PbrSsboTransformRegistry
impl UnwindSafe for PbrSsboTransformRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more