#[non_exhaustive]pub struct MeshInstanceItem {
pub mesh_id: MeshId,
pub texture_id: Option<TextureId>,
pub transforms: Vec<[[f32; 4]; 4]>,
pub colours: Vec<[f32; 4]>,
pub blend: SpriteBlend,
pub settings: ItemSettings,
pub lod_group: Option<LodGroupId>,
}Expand description
A host-built instanced draw of a single mesh at many per-instance transforms.
Use this for mesh-based particle effects (falling leaves, debris, alembic
snippets, projectile clouds) where the simulation lives in the host and the
renderer only needs to draw N copies of one mesh per frame in a single
draw call. The list of instances is rebuilt every frame from the supplied
transforms and colours vectors; nothing is retained between frames.
All instances in a batch share the same mesh_id, texture_id, and
blend mode. To mix meshes or blend modes, submit multiple
MeshInstanceItem entries on [SceneFrame::mesh_instances].
The fragment shader is the unlit instanced mesh shader (the same shader
backing the scene-graph instanced path). Mesh particles do not receive
shadows or lighting; they are tinted by colours and optionally sampled
from texture_id.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.mesh_id: MeshIdMesh handle returned by DeviceResources::upload_mesh_data.
texture_id: Option<TextureId>Optional albedo texture handle. None renders flat-shaded with the
per-instance colours alone.
transforms: Vec<[[f32; 4]; 4]>Per-instance world-space TRS matrices. Length defines the instance count.
colours: Vec<[f32; 4]>Per-instance RGBA tints. If shorter than transforms, missing entries
fall back to opaque white.
blend: SpriteBlendGPU blend state for this batch. Reuses SpriteBlend from the sprite
path so both particle systems share one enum.
settings: ItemSettingsPer-item render settings (visibility, pick identity, selection state).
lod_group: Option<LodGroupId>LOD group to draw these instances from. None means draw mesh_id
directly for every instance.
When set, the renderer measures each instance’s on-screen size and groups
the instances by level, drawing each level’s subset with its own mesh. So
near instances in the batch draw the full mesh while far ones drop to a
cheaper one, all from a single submitted item. mesh_id is ignored.
Set pick_id for the per-instance level to use hysteresis across frames.
Trait Implementations§
Source§impl Clone for MeshInstanceItem
impl Clone for MeshInstanceItem
Source§fn clone(&self) -> MeshInstanceItem
fn clone(&self) -> MeshInstanceItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for MeshInstanceItem
impl RefUnwindSafe for MeshInstanceItem
impl Send for MeshInstanceItem
impl Sync for MeshInstanceItem
impl Unpin for MeshInstanceItem
impl UnsafeUnpin for MeshInstanceItem
impl UnwindSafe for MeshInstanceItem
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.