Skip to content

Documentation / scene / Drawable

Interface: Drawable

Defined in: libs/scene/src/render/drawable.ts:245

Base interface for a drawable (renderable) object.

A drawable encapsulates geometry, material, and GPU-resident data required to be rendered. Implementations integrate with render queues, batching, and instancing.

Extended by

Methods

getName()

getName(): string

Defined in: libs/scene/src/render/drawable.ts:247

Gets the display name of the drawable object (for debugging/UI).

Returns

string


getDrawableId()

getDrawableId(): number

Defined in: libs/scene/src/render/drawable.ts:249

Unique, stable identifier for the drawable, used in caches and picking.

Returns

number


getNode()

getNode(): SceneNode

Defined in: libs/scene/src/render/drawable.ts:251

Returns the owning scene node (transform and hierarchy).

Returns

SceneNode


getPickTarget()

getPickTarget(): PickTarget

Defined in: libs/scene/src/render/drawable.ts:257

Returns the pick target override to be reported when this object is picked.

If not set, a default target derived from the node/material may be used.

Returns

PickTarget


getBoneMatrices()

getBoneMatrices(): Texture2D<unknown>

Defined in: libs/scene/src/render/drawable.ts:259

Returns the texture containing bone matrices for skinned meshes.

Returns

Texture2D<unknown>


getSkinInfluenceData()

getSkinInfluenceData(): SkinInfluenceData

Defined in: libs/scene/src/render/drawable.ts:261

Returns additional per-vertex skinning influences packed in a texture, if needed.

Returns

SkinInfluenceData


getObjectColor()

getObjectColor(): Vector4

Defined in: libs/scene/src/render/drawable.ts:263

Returns the unique color used for GPU picking (object ID in color).

Returns

Vector4


getMorphData()

getMorphData(): MorphData

Defined in: libs/scene/src/render/drawable.ts:265

Returns the morph target data texture (if morphing is used).

Returns

MorphData


getMorphInfo()

getMorphInfo(): MorphInfo

Defined in: libs/scene/src/render/drawable.ts:267

Returns the morph information buffer (weights, ranges, etc.).

Returns

MorphInfo


getSortDistance()

getSortDistance(camera): number

Defined in: libs/scene/src/render/drawable.ts:273

Computes the distance used for sorting (e.g., transparent draw order).

Parameters

camera

Camera

Camera from which to compute distance (usually camera -> object).

Returns

number


getQueueType()

getQueueType(): number

Defined in: libs/scene/src/render/drawable.ts:275

Returns the type/category of render queue this object belongs to.

Returns

number


needSceneColor()

needSceneColor(): boolean

Defined in: libs/scene/src/render/drawable.ts:277

Whether the object requires access to the scene color buffer.

Returns

boolean


needSceneDepth()

needSceneDepth(): boolean

Defined in: libs/scene/src/render/drawable.ts:279

Whether the object requires access to the scene depth (linear or non-linear).

Returns

boolean


needHiZNearest()?

optional needHiZNearest(): boolean

Defined in: libs/scene/src/render/drawable.ts:291

Whether the object queries the Hi-Z pyramid's nearest-depth channel.

Turns that channel on for the frame, which doubles the pyramid's bandwidth, so only a drawable that actually samples it should say yes. Unavailable on WebGL1, where the request is dropped and the drawable has to shade without it.

Optional: almost nothing needs it, and requiring it would break every external Drawable implementation for the sake of a return false.

Returns

boolean


isUnlit()

isUnlit(): boolean

Defined in: libs/scene/src/render/drawable.ts:293

True if shading is unlit (does not depend on scene lighting).

Returns

boolean


getMaterial()

getMaterial(): MeshMaterial

Defined in: libs/scene/src/render/drawable.ts:295

Returns the bound material driving shading for this drawable.

Returns

MeshMaterial


getPrimitive()

getPrimitive(): Primitive

Defined in: libs/scene/src/render/drawable.ts:297

Returns the geometry primitive to be drawn.

Returns

Primitive


pushRenderQueueRef()

pushRenderQueueRef(ref): void

Defined in: libs/scene/src/render/drawable.ts:303

Pushes a reference to the current render queue for cleanup or back-references.

Useful for batching or delayed state application.

Parameters

ref

RenderQueueRef

Returns

void


applyTransformUniforms()

applyTransformUniforms(renderQueue): void

Defined in: libs/scene/src/render/drawable.ts:309

Applies transform-related uniforms to the active bind group or pipeline.

Parameters

renderQueue

RenderQueue

The current render queue issuing this draw.

Returns

void


draw()

draw(ctx, renderQueue, hash?): void

Defined in: libs/scene/src/render/drawable.ts:317

Issues draw commands for this object.

Parameters

ctx

DrawContext

Full draw context for the current pass.

renderQueue

RenderQueue

The current render queue issuing this draw.

hash?

string

Optional hash key for render bundle or pipeline caching.

Returns

void


updateState()

updateState(): void

Defined in: libs/scene/src/render/drawable.ts:321

Updates internal state or GPU resources for this drawable, if needed.

Returns

void


isBatchable()

isBatchable(): this is BatchDrawable

Defined in: libs/scene/src/render/drawable.ts:327

Returns true if the object supports instanced rendering.

When true, the object should also implement the BatchDrawable methods.

Returns

this is BatchDrawable


dispose()

dispose(): void

Defined in: libs/scene/src/render/drawable.ts:329

Releases all GPU resources and detaches from the renderer.

Returns

void

Released under the MIT License.