Skip to content

Documentation / scene / Drawable

Interface: Drawable

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

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:196

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

Returns

string


getDrawableId()

getDrawableId(): number

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

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

Returns

number


getNode()

getNode(): SceneNode

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

Returns the owning scene node (transform and hierarchy).

Returns

SceneNode


getPickTarget()

getPickTarget(): PickTarget

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

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:208

Returns the texture containing bone matrices for skinned meshes.

Returns

Texture2D<unknown>


getObjectColor()

getObjectColor(): Vector4

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

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:212

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

Returns

MorphData


getMorphInfo()

getMorphInfo(): MorphInfo

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

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

Returns

MorphInfo


getSortDistance()

getSortDistance(camera): number

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

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:222

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

Returns

number


needSceneColor()

needSceneColor(): boolean

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

Whether the object requires access to the scene color buffer.

Returns

boolean


needSceneDepth()

needSceneDepth(): boolean

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

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

Returns

boolean


isUnlit()

isUnlit(): boolean

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

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

Returns

boolean


getMaterial()

getMaterial(): MeshMaterial

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

Returns the bound material driving shading for this drawable.

Returns

MeshMaterial


getPrimitive()

getPrimitive(): Primitive

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

Returns the geometry primitive to be drawn.

Returns

Primitive


pushRenderQueueRef()

pushRenderQueueRef(ref): void

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

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:244

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:252

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:256

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:262

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:264

Releases all GPU resources and detaches from the renderer.

Returns

void

Released under the MIT License.