Class: DecalComponent
Defined in: src/components/DecalComponent.ts:44
Projected-decal volume component.
Attach to an Object3D whose localScale = (footprintX, depth, footprintZ) spans the volume that the decal projects through. The decal pass uses the host transform's world matrix as the volume's model matrix, then stencil-marks pixels of the opaque scene that fall inside that volume and composites the assigned texture into _ColorBuffer.
Pipeline integration: enable via Engine3D.setting.render.decals = true. When enabled, ForwardRendererJob inserts a DecalShadowVolumePass between the opaque/transmission passes and the transparent pass — decals draw on top of opaque terrain.
Occlusion is a composition concern, not a decal concern: if specific meshes (e.g. tall buildings standing in a decal footprint) should occlude the projection, the application controls that through the RenderGraph — exclude those meshes from ColorPass.layerMask and draw them in a user-defined pass after DecalShadowVolumePass. See samples/render/Sample_DecalShadowVolume.ts for the pattern.
Usage:
const obj = new Object3D();
obj.localPosition = ...; // volume center
obj.localScale = new Vector3(w, depth, w); // xz = footprint, y = extrusion
DecalComponent.alignTopToward(obj, surfaceNormal); // local +Y → surface normal
obj.addComponent(DecalComponent, { texture, tint });
scene.addChild(obj);
Extends
Constructors
Constructor
new DecalComponent():
DecalComponent
Returns
DecalComponent
Inherited from
Properties
object3D
object3D:
Object3D=null
Defined in: src/components/ComponentBase.ts:29
owner object3D
Inherited from
isDestroyed
isDestroyed:
boolean=false
Defined in: src/components/ComponentBase.ts:77
Inherited from
texture
texture:
Texture=null
Defined in: src/components/DecalComponent.ts:51
Decal texture sampled in the composite pass. Any engine Texture works — load images with Engine3D.res.loadTexture(url, …, 'srgb') for a pooled BitmapTexture2D, or feed a Canvas2D source via bitmapTexture.source = canvas. Swapping at runtime is allowed — the pass rebuilds the texture view on the next frame.
tint
tint:
Color
Defined in: src/components/DecalComponent.ts:54
Tint multiplier (RGB) and alpha multiplier (A) applied in the FS.
maxAngleDeg
maxAngleDeg:
number=90
Defined in: src/components/DecalComponent.ts:61
Maximum angle (degrees) between the volume's local +Y and the receiving surface's normal for the decal to project onto it. 90 (the default) disables the filter entirely so the decal wraps every face it touches. Smaller values restrict the decal to faces roughly aligned with decal-up — closer to a rigid "stamp".
Accessors
visibleLayer
Get Signature
get visibleLayer():
number
Defined in: src/components/ComponentBase.ts:46
Composition-layer membership bitmask. The pass / camera / collector filters via
(component.visibleLayer & pass.layerMask & camera.cullingMask) !== 0
Defaults to VisibleLayer.Default (bit 0) so a fresh subclass is visible to passes whose layerMask is VisibleLayer.All (which includes bit 0). Application code can assign project-specific bits (1..31) to organise the scene into composition layers.
Returns
number
Set Signature
set visibleLayer(
value):void
Defined in: src/components/ComponentBase.ts:50
Parameters
value
number
Returns
void
Inherited from
eventDispatcher
Get Signature
get eventDispatcher():
CEventDispatcher
Defined in: src/components/ComponentBase.ts:63
Returns
Set Signature
set eventDispatcher(
value):void
Defined in: src/components/ComponentBase.ts:68
Parameters
value
Returns
void
Inherited from
isStart
Get Signature
get isStart():
boolean
Defined in: src/components/ComponentBase.ts:79
Returns
boolean
Inherited from
transform
Get Signature
get transform():
Transform
Defined in: src/components/ComponentBase.ts:89
Return the Transform component attached to the Object3D. Null before the component is attached — addComponent assigns object3D only after construction — so constructor-time callers can probe safely via this.transform?..
Returns
Inherited from
enable
Get Signature
get enable():
boolean
Defined in: src/components/ComponentBase.ts:113
Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.
Returns
boolean
Set Signature
set enable(
value):void
Defined in: src/components/ComponentBase.ts:96
Enable/disable components. The enabled components can be updated, while the disabled components cannot be updated.
Parameters
value
boolean
Returns
void
Inherited from
Methods
alignTopToward()
staticalignTopToward(obj,normal):void
Defined in: src/components/DecalComponent.ts:65
Orient obj's local +Y to point along normal (world space). Convenience helper for placing a decal on a curved surface.
Parameters
obj
normal
Returns
void
start()
start():
void
Defined in: src/components/ComponentBase.ts:162
Returns
void
Inherited from
stop()
stop():
void
Defined in: src/components/ComponentBase.ts:163
Returns
void
Inherited from
onEnable()?
optionalonEnable(view?):any
Defined in: src/components/ComponentBase.ts:164
Parameters
view?
Returns
any
Inherited from
onDisable()?
optionalonDisable(view?):any
Defined in: src/components/ComponentBase.ts:165
Parameters
view?
Returns
any
Inherited from
onUpdate()?
optionalonUpdate(view?):any
Defined in: src/components/ComponentBase.ts:166
Parameters
view?
Returns
any
Inherited from
onLateUpdate()?
optionalonLateUpdate(view?):any
Defined in: src/components/ComponentBase.ts:167
Parameters
view?
Returns
any
Inherited from
onBeforeUpdate()?
optionalonBeforeUpdate(view?):any
Defined in: src/components/ComponentBase.ts:168
Parameters
view?
Returns
any
Inherited from
onCompute()?
optionalonCompute(view?,command?):any
Defined in: src/components/ComponentBase.ts:169
Parameters
view?
command?
GPUCommandEncoder
Returns
any
Inherited from
onGraphic()?
optionalonGraphic(view?):any
Defined in: src/components/ComponentBase.ts:170
Parameters
view?
Returns
any
Inherited from
onParentChange()?
optionalonParentChange(lastParent?,currentParent?):any
Defined in: src/components/ComponentBase.ts:171
Parameters
lastParent?
currentParent?
Returns
any
Inherited from
onAddChild()?
optionalonAddChild(child):any
Defined in: src/components/ComponentBase.ts:172
Parameters
child
Returns
any
Inherited from
onRemoveChild()?
optionalonRemoveChild(child):any
Defined in: src/components/ComponentBase.ts:173
Parameters
child
Returns
any
Inherited from
cloneTo()
cloneTo(
obj):void
Defined in: src/components/ComponentBase.ts:180
clone component data to target object3D
Parameters
obj
target object3D
Returns
void
Inherited from
copyComponent()
copyComponent(
from):this
Defined in: src/components/ComponentBase.ts:182
Parameters
from
this
Returns
this
Inherited from
beforeDestroy()
beforeDestroy(
force?):void
Defined in: src/components/ComponentBase.ts:249
before release this component, object refrences are not be set null now.
Parameters
force?
boolean
Returns
void
Inherited from
destroy()
destroy(
force?):void
Defined in: src/components/ComponentBase.ts:256
release this component
Parameters
force?
boolean
Returns
void
Inherited from
init()
init(
param?):void
Defined in: src/components/DecalComponent.ts:72
Parameters
param?
texture?
tint?
maxAngleDeg?
number
Returns
void

