Skip to content

Documentation / scene / MeshDrawable

Class: MeshDrawable<M>

Defined in: libs/scene/src/scene/meshdrawable.ts:131

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.

Extends

Type Parameters

M

M extends MeshMaterial

Implements

Constructors

Constructor

new MeshDrawable<M>(node, material, primitive): MeshDrawable<M>

Defined in: libs/scene/src/scene/meshdrawable.ts:137

Parameters

node

SceneNode

material

M

primitive

Primitive

Returns

MeshDrawable<M>

Overrides

applyMixins(MeshDrawableBase, mixinDrawable).constructor

Properties

objectColor

readonly objectColor: Vector4

Defined in: libs/scene/src/render/drawable_mixin.ts:13

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).objectColor

Accessors

disposed

Get Signature

get disposed(): boolean

Defined in: libs/base/dist/index.d.ts:6107

Returns

boolean

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).disposed


material

Get Signature

get material(): M

Defined in: libs/scene/src/scene/meshdrawable.ts:142

Returns

M

Set Signature

set material(mat): void

Defined in: libs/scene/src/scene/meshdrawable.ts:145

Parameters
mat

M

Returns

void


primitive

Get Signature

get primitive(): Primitive

Defined in: libs/scene/src/scene/meshdrawable.ts:151

Returns

Primitive

Set Signature

set primitive(prim): void

Defined in: libs/scene/src/scene/meshdrawable.ts:154

Parameters
prim

Primitive

Returns

void

Methods

isPrototypeOf()

static isPrototypeOf(v): boolean

Defined in: libs/base/dist/index.d.ts:80

Parameters

v

object

Returns

boolean

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).isPrototypeOf


on()

on<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:630

IEventTarget.on

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).on


once()

once<K>(type, listener, context?): void

Defined in: libs/base/dist/index.d.ts:634

IEventTarget.once

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener

EventListener<{ dispose: []; }, K>

context?

unknown

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).once


off()

off<K>(type, listener?, context?): void

Defined in: libs/base/dist/index.d.ts:638

IEventTarget.off

Type Parameters

K

K extends "dispose"

Parameters

type

K

listener?

EventListener<{ dispose: []; }>

context?

unknown

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).off


dispatchEvent()

dispatchEvent<K>(type, ...args): void

Defined in: libs/base/dist/index.d.ts:642

IEventTarget.dispatchEvent

Type Parameters

K

K extends "dispose"

Parameters

type

K

args

...object[K]

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).dispatchEvent


dispose()

dispose(): void

Defined in: libs/base/dist/index.d.ts:6108

Releases all GPU resources and detaches from the renderer.

Returns

void

Implementation of

Drawable.dispose

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).dispose


getDrawableId()

getDrawableId(): number

Defined in: libs/scene/src/render/drawable_mixin.ts:14

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

Returns

number

Implementation of

Drawable.getDrawableId

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).getDrawableId


pushRenderQueueRef()

pushRenderQueueRef(ref): void

Defined in: libs/scene/src/render/drawable_mixin.ts:15

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

Implementation of

Drawable.pushRenderQueueRef

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).pushRenderQueueRef


applyInstanceOffsetAndStride()

applyInstanceOffsetAndStride(renderQueue, stride, offset): void

Defined in: libs/scene/src/render/drawable_mixin.ts:16

Parameters

renderQueue

RenderQueue

stride

number

offset

number

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).applyInstanceOffsetAndStride


applyTransformUniforms()

applyTransformUniforms(renderQueue): void

Defined in: libs/scene/src/render/drawable_mixin.ts:17

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

Parameters

renderQueue

RenderQueue

The current render queue issuing this draw.

Returns

void

Implementation of

Drawable.applyTransformUniforms

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).applyTransformUniforms


applyMaterialUniforms()

applyMaterialUniforms(instanceInfo): void

Defined in: libs/scene/src/render/drawable_mixin.ts:18

Parameters

instanceInfo

DrawableInstanceInfo

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).applyMaterialUniforms


applyMaterialUniformsAll()

applyMaterialUniformsAll(): void

Defined in: libs/scene/src/render/drawable_mixin.ts:19

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).applyMaterialUniformsAll


getObjectColor()

getObjectColor(): Vector4

Defined in: libs/scene/src/render/drawable_mixin.ts:20

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

Returns

Vector4

Implementation of

Drawable.getObjectColor

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).getObjectColor


updateState()

updateState(): void

Defined in: libs/scene/src/render/drawable_mixin.ts:21

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

Returns

void

Implementation of

Drawable.updateState

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).updateState


bind()

bind(ctx, renderQueue): void

Defined in: libs/scene/src/render/drawable_mixin.ts:22

Parameters

ctx

DrawContext

renderQueue

RenderQueue

Returns

void

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).bind


getNode()

getNode(): SceneNode

Defined in: libs/scene/src/scene/meshdrawable.ts:126

Returns the owning scene node (transform and hierarchy).

Returns

SceneNode

Implementation of

Drawable.getNode

Inherited from

applyMixins(MeshDrawableBase, mixinDrawable).getNode


getMaterial()

getMaterial(): MeshMaterial

Defined in: libs/scene/src/scene/meshdrawable.ts:148

Returns the bound material driving shading for this drawable.

Returns

MeshMaterial

Implementation of

Drawable.getMaterial


getPrimitive()

getPrimitive(): Primitive

Defined in: libs/scene/src/scene/meshdrawable.ts:157

Returns the geometry primitive to be drawn.

Returns

Primitive

Implementation of

Drawable.getPrimitive


getPickTarget()

getPickTarget(): PickTarget

Defined in: libs/scene/src/scene/meshdrawable.ts:160

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

Implementation of

Drawable.getPickTarget


getBoneMatrices()

getBoneMatrices(): Texture2D<unknown>

Defined in: libs/scene/src/scene/meshdrawable.ts:163

Returns the texture containing bone matrices for skinned meshes.

Returns

Texture2D<unknown>

Implementation of

Drawable.getBoneMatrices


getSkinInfluenceData()

getSkinInfluenceData(): SkinInfluenceData

Defined in: libs/scene/src/scene/meshdrawable.ts:166

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

Returns

SkinInfluenceData

Implementation of

Drawable.getSkinInfluenceData


getMorphData()

getMorphData(): MorphData

Defined in: libs/scene/src/scene/meshdrawable.ts:169

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

Returns

MorphData

Implementation of

Drawable.getMorphData


getMorphInfo()

getMorphInfo(): MorphInfo

Defined in: libs/scene/src/scene/meshdrawable.ts:172

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

Returns

MorphInfo

Implementation of

Drawable.getMorphInfo


getSortDistance()

getSortDistance(camera): number

Defined in: libs/scene/src/scene/meshdrawable.ts:178

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

Implementation of

Drawable.getSortDistance


getQueueType()

getQueueType(): number

Defined in: libs/scene/src/scene/meshdrawable.ts:186

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

Returns

number

Implementation of

Drawable.getQueueType


needSceneColor()

needSceneColor(): boolean

Defined in: libs/scene/src/scene/meshdrawable.ts:189

Whether the object requires access to the scene color buffer.

Returns

boolean

Implementation of

Drawable.needSceneColor


needSceneDepth()

needSceneDepth(): boolean

Defined in: libs/scene/src/scene/meshdrawable.ts:192

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

Returns

boolean

Implementation of

Drawable.needSceneDepth


isUnlit()

isUnlit(): boolean

Defined in: libs/scene/src/scene/meshdrawable.ts:195

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

Returns

boolean

Implementation of

Drawable.isUnlit


isBatchable()

isBatchable(): this is BatchDrawable

Defined in: libs/scene/src/scene/meshdrawable.ts:198

Returns true if the object supports instanced rendering.

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

Returns

this is BatchDrawable

Implementation of

Drawable.isBatchable


draw()

draw(ctx, renderQueue): void

Defined in: libs/scene/src/scene/meshdrawable.ts:201

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.

Returns

void

Implementation of

Drawable.draw


onDispose()

protected onDispose(): void

Defined in: libs/scene/src/scene/meshdrawable.ts:209

Returns

void

Overrides

applyMixins(MeshDrawableBase, mixinDrawable).onDispose


getName()

getName(): string

Defined in: libs/scene/src/scene/meshdrawable.ts:215

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

Returns

string

Implementation of

Drawable.getName

Overrides

applyMixins(MeshDrawableBase, mixinDrawable).getName

Released under the MIT License.