pub struct Decal {
pub asset_id: AssetId,
pub texture: Option<TextureHandle>,
pub position: [f32; 3],
pub rotation_deg: [f32; 3],
pub size: [f32; 3],
pub tint: [f32; 4],
pub visible: bool,
}Expand description
A projected texture stamped onto whatever scene geometry sits inside the decal’s oriented box.
The decal is a box volume positioned by position/rotation_deg/size in
world space. The texture is projected down the box’s local +Y axis onto the
local X-Z plane and stamped onto the surfaces inside the box; anything
outside the box is unaffected. Surfaces near the box’s top and bottom faces
fade out so the stamp doesn’t show a hard edge on a curved surface.
The defaults orient the decal as a ground stamp: a flat 1×1 m square laid on
the world X-Z plane, projecting down from +Y. To stamp a wall, rotate so
local +Y points into the surface (e.g. rotation_deg:[0,0,90] for a +X
wall).
Decals blend over the lit image without affecting depth, so they layer on top of the surfaces they stamp.
Decal {
position: [2.0, 0.01, -1.5],
size: [1.5, 0.5, 1.5],
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
texture: Option<TextureHandle>The Texture asset projected onto the scene.
position: [f32; 3]World-space position of the decal box’s centre.
rotation_deg: [f32; 3]Euler rotation in degrees [pitch, yaw, roll], YXZ order, same as Prop.
size: [f32; 3]Local-space box extents. Local +Y is the projection axis; the texture is sampled on the local X-Z plane. A non-positive component disables the decal.
tint: [f32; 4]Linear-space RGBA tint multiplied with the sampled texture. The alpha
channel scales the final blend, so [1,1,1,0] hides the decal.
visible: boolWhen false the decal is skipped each frame.
Trait Implementations§
Source§impl Component for Decal
impl Component for Decal
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 Decal
impl ComponentSlot for Decal
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.