pub struct InstancedProp {
pub asset_id: AssetId,
pub mesh: Option<MeshHandle>,
pub material: Option<MaterialHandle>,
pub texture: Option<TextureHandle>,
pub instances: Vec<InstanceTransform>,
pub cull_distance: f32,
}Expand description
A single mesh + material drawn at many world-space transforms.
Use for foliage, debris, projectiles, or any content that repeats the same shape with varied placement. Each instance gets its own world transform and culling without the overhead of declaring many separate Props.
Each instances entry has the shape {"position":[x,y,z], "rotation_deg":[p,y,r], "scale":[sx,sy,sz]}.
rotation_deg and scale may be omitted (defaults [0,0,0] and [1,1,1]).
Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
mesh: Option<MeshHandle>A Mesh, ProceduralMesh, VoxelChunk, or mesh-kind File asset.
material: Option<MaterialHandle>A Material; takes precedence over texture when set.
texture: Option<TextureHandle>Older texture-only reference; ignored when material is set.
instances: Vec<InstanceTransform>Per-instance transforms. Empty list renders nothing.
cull_distance: f32View-distance cutoff in world units per instance. 0 = always draw.
Trait Implementations§
Source§impl Clone for InstancedProp
impl Clone for InstancedProp
Source§fn clone(&self) -> InstancedProp
fn clone(&self) -> InstancedProp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for InstancedProp
impl Component for InstancedProp
Source§const NAME: &'static str = "InstancedProp"
const NAME: &'static str = "InstancedProp"
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<InstancedProp, CnResult>
fn from_baked(bytes: &[u8]) -> Result<InstancedProp, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for InstancedProp
impl ComponentSlot for InstancedProp
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<InstancedProp>
fn slot(s: &ComponentStorage) -> &Column<InstancedProp>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<InstancedProp>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<InstancedProp>
Source§impl Debug for InstancedProp
impl Debug for InstancedProp
Source§impl Default for InstancedProp
impl Default for InstancedProp
Source§fn default() -> InstancedProp
fn default() -> InstancedProp
Source§impl<'de> Deserialize<'de> for InstancedPropwhere
InstancedProp: Default,
impl<'de> Deserialize<'de> for InstancedPropwhere
InstancedProp: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstancedProp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<InstancedProp, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<InstancedProp> for ComponentAsset
impl From<InstancedProp> for ComponentAsset
Source§fn from(c: InstancedProp) -> ComponentAsset
fn from(c: InstancedProp) -> ComponentAsset
impl RuntimeComponent for InstancedProp
Source§impl Serialize for InstancedProp
impl Serialize for InstancedProp
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for InstancedProp
impl RefUnwindSafe for InstancedProp
impl Send for InstancedProp
impl Sync for InstancedProp
impl Unpin for InstancedProp
impl UnsafeUnpin for InstancedProp
impl UnwindSafe for InstancedProp
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().