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<Decal, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Decal, 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.Source§impl<'de> Deserialize<'de> for Decal
impl<'de> Deserialize<'de> for Decal
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Decal, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Decal, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl RuntimeComponent for Decal
Source§impl Serialize for Decal
impl Serialize for Decal
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 Decal
impl RefUnwindSafe for Decal
impl Send for Decal
impl Sync for Decal
impl Unpin for Decal
impl UnsafeUnpin for Decal
impl UnwindSafe for Decal
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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 more