Skip to content

Documentation / scene / BatchDrawable

Interface: BatchDrawable

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

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

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

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

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

Inherited from

Drawable.getPickTarget


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>

Inherited from

Drawable.getBoneMatrices


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

Inherited from

Drawable.getSkinInfluenceData


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

Inherited from

Drawable.getObjectColor


getMorphData()

getMorphData(): MorphData

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

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

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

Inherited from

Drawable.getSortDistance


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

Inherited from

Drawable.getQueueType


needSceneColor()

needSceneColor(): boolean

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

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

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

Returns

boolean

Inherited from

Drawable.needSceneDepth


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

Inherited from

Drawable.needHiZNearest


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

Inherited from

Drawable.isUnlit


getMaterial()

getMaterial(): MeshMaterial

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

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

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

Inherited from

Drawable.pushRenderQueueRef


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

Inherited from

Drawable.applyTransformUniforms


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

Inherited from

Drawable.draw


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

Inherited from

Drawable.updateState


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

Inherited from

Drawable.isBatchable


dispose()

dispose(): void

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

Releases all GPU resources and detaches from the renderer.

Returns

void

Inherited from

Drawable.dispose

Released under the MIT License.