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<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, 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.