pub enum RenderMorphTargetAllocator {
Image {
mesh_id_to_image: HashMap<AssetId<Mesh>, MorphTargetImage>,
},
Storage,
}Expand description
Stores the images for all morph target displacement data, if the current platform doesn’t support storage buffers.
If the current platform does support storage buffers, the mesh allocator stores displacement data instead.
Variants§
Image
The variant used when the current platform doesn’t support storage buffers.
Fields
mesh_id_to_image: HashMap<AssetId<Mesh>, MorphTargetImage>Maps the ID of each mesh to the image containing its morph target displacements.
Storage
The variant used when the current platform does support storage buffers.
In this case, this resource is empty, because the mesh allocator stores displacements instead.
Implementations§
Source§impl RenderMorphTargetAllocator
impl RenderMorphTargetAllocator
Sourcepub fn allocate(
&mut self,
render_device: &RenderDevice,
render_queue: &RenderQueue,
mesh_id: AssetId<Mesh>,
targets: &[MorphAttributes],
vertex_count: usize,
)
pub fn allocate( &mut self, render_device: &RenderDevice, render_queue: &RenderQueue, mesh_id: AssetId<Mesh>, targets: &[MorphAttributes], vertex_count: usize, )
Allocates morph target displacements for the given mesh.
If storage buffers aren’t supported on the current platform, this method
creates a new MorphTargetImage and stores it inside the allocator.
If storage buffers are supported on the current platform, this method does nothing, as morph target displacements are instead managed by the mesh allocator.
Sourcepub fn free(&mut self, mesh_id: AssetId<Mesh>)
pub fn free(&mut self, mesh_id: AssetId<Mesh>)
Frees the storage associated with morph target displacements for the mesh with the given ID.
If the current platform doesn’t support storage buffers, this drops the
reference to the MorphTargetImage that stores the data for the
mesh’s morph target displacements. If the current platform does support
storage buffers, this method does nothing, as morph target displacements
are managed by the mesh allocator in this case.
If passed a mesh without morph targets, this method does nothing.
Sourcepub fn get_image(&self, mesh_id: AssetId<Mesh>) -> Option<MorphTargetImage>
pub fn get_image(&self, mesh_id: AssetId<Mesh>) -> Option<MorphTargetImage>
Returns the MorphTargetImage containing the packed morph target
displacements for the mesh with the given ID, if that image is present.
A MorphTargetImage is only available if storage buffers aren’t
supported on the given platform. If storage buffers are supported, this
method returns None, as the mesh allocator stores the morph target
displacements in that case.
Trait Implementations§
Source§impl Component for RenderMorphTargetAllocator
impl Component for RenderMorphTargetAllocator
Source§const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
const STORAGE_TYPE: StorageType = bevy_ecs::component::StorageType::SparseSet
Source§type Mutability = Mutable
type Mutability = Mutable
Component<Mutability = Mutable>,
while immutable components will instead have Component<Mutability = Immutable>. Read moreSource§fn register_required_components(
_requiree: ComponentId,
required_components: &mut RequiredComponentsRegistrator<'_, '_>,
)
fn register_required_components( _requiree: ComponentId, required_components: &mut RequiredComponentsRegistrator<'_, '_>, )
Source§fn clone_behavior() -> ComponentCloneBehavior
fn clone_behavior() -> ComponentCloneBehavior
Source§fn map_entities<M>(this: &mut RenderMorphTargetAllocator, mapper: &mut M)where
M: EntityMapper,
fn map_entities<M>(this: &mut RenderMorphTargetAllocator, mapper: &mut M)where
M: EntityMapper,
EntityMapper. This is used to remap entities in contexts like scenes and entity cloning.
When deriving Component, this is populated by annotating fields containing entities with #[entities] Read moreSource§fn relationship_accessor() -> Option<ComponentRelationshipAccessor<RenderMorphTargetAllocator>>
fn relationship_accessor() -> Option<ComponentRelationshipAccessor<RenderMorphTargetAllocator>>
ComponentRelationshipAccessor required for working with relationships in dynamic contexts. Read moreSource§fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_add() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_insert() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_discard() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_remove() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
fn on_despawn() -> Option<for<'w> fn(DeferredWorld<'w>, HookContext)>
Source§impl FromWorld for RenderMorphTargetAllocator
impl FromWorld for RenderMorphTargetAllocator
Source§fn from_world(world: &mut World) -> RenderMorphTargetAllocator
fn from_world(world: &mut World) -> RenderMorphTargetAllocator
Self using data from the given World.impl Resource for RenderMorphTargetAllocator
Auto Trait Implementations§
impl !RefUnwindSafe for RenderMorphTargetAllocator
impl !UnwindSafe for RenderMorphTargetAllocator
impl Freeze for RenderMorphTargetAllocator
impl Send for RenderMorphTargetAllocator
impl Sync for RenderMorphTargetAllocator
impl Unpin for RenderMorphTargetAllocator
impl UnsafeUnpin for RenderMorphTargetAllocator
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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<C> Bundle for Cwhere
C: Component,
impl<C> Bundle for Cwhere
C: Component,
fn component_ids( components: &mut ComponentsRegistrator<'_>, ) -> impl Iterator<Item = ComponentId> + use<C>
Source§fn get_component_ids(
components: &Components,
) -> impl Iterator<Item = Option<ComponentId>>
fn get_component_ids( components: &Components, ) -> impl Iterator<Item = Option<ComponentId>>
Source§impl<C> BundleFromComponents for Cwhere
C: Component,
impl<C> BundleFromComponents for Cwhere
C: Component,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<C> DynamicBundle for Cwhere
C: Component,
impl<C> DynamicBundle for Cwhere
C: Component,
Source§unsafe fn get_components(
ptr: MovingPtr<'_, C>,
func: &mut impl FnMut(StorageType, OwningPtr<'_>),
) -> <C as DynamicBundle>::Effect
unsafe fn get_components( ptr: MovingPtr<'_, C>, func: &mut impl FnMut(StorageType, OwningPtr<'_>), ) -> <C as DynamicBundle>::Effect
Source§unsafe fn apply_effect(
_ptr: MovingPtr<'_, MaybeUninit<C>>,
_entity: &mut EntityWorldMut<'_>,
)
unsafe fn apply_effect( _ptr: MovingPtr<'_, MaybeUninit<C>>, _entity: &mut EntityWorldMut<'_>, )
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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