Skip to content

Documentation / scene / BatchDrawable

Interface: BatchDrawable

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

Interface for drawables that support hardware instancing.

Instanced drawables supply instance-specific uniforms, offsets, and strides to allow a single draw call to render many instances efficiently.

Extends

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

Inherited from

Drawable.getName


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

Inherited from

Drawable.getDrawableId


getNode()

getNode(): SceneNode

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

Returns the owning scene node (transform and hierarchy).

Returns

SceneNode

Inherited from

Drawable.getNode


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

Inherited from

Drawable.getPickTarget


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>

Inherited from

Drawable.getBoneMatrices


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

Inherited from

Drawable.getObjectColor


getMorphData()

getMorphData(): MorphData

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

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

Returns

MorphData

Inherited from

Drawable.getMorphData


getMorphInfo()

getMorphInfo(): MorphInfo

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

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

Returns

MorphInfo

Inherited from

Drawable.getMorphInfo


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

Inherited from

Drawable.getSortDistance


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

Inherited from

Drawable.getQueueType


needSceneColor()

needSceneColor(): boolean

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

Whether the object requires access to the scene color buffer.

Returns

boolean

Inherited from

Drawable.needSceneColor


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

Inherited from

Drawable.needSceneDepth


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

Inherited from

Drawable.isUnlit


getMaterial()

getMaterial(): MeshMaterial

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

Returns the bound material driving shading for this drawable.

Returns

MeshMaterial

Inherited from

Drawable.getMaterial


getPrimitive()

getPrimitive(): Primitive

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

Returns the geometry primitive to be drawn.

Returns

Primitive

Inherited from

Drawable.getPrimitive


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

Inherited from

Drawable.pushRenderQueueRef


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

Inherited from

Drawable.applyTransformUniforms


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

Inherited from

Drawable.draw


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

Inherited from

Drawable.updateState


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

Inherited from

Drawable.isBatchable


dispose()

dispose(): void

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

Releases all GPU resources and detaches from the renderer.

Returns

void

Inherited from

Drawable.dispose

Released under the MIT License.