Skip to main content

Class: OccluderPlugin

@geenee/bodyrenderers-babylon.OccluderPlugin

Occluder plugin

Plugin making provided node an occluder. Usually node is a base mesh (average approximation) of a body representing its real counterpart in a scene. Occluders are not rendered by themselves but still participate in occlusion queries. This is achieved by setting disableColorWrite=true to materials of node's meshes. This flag tells rendering engine to not write to color buffer but still write to depth buffer. Then meshes are effectively not rendered (fragment color write is skipped) and only occlude all other meshes of the scene (during depth test).

Hierarchy

Constructors

constructor

new OccluderPlugin(node, renderOrder?)

Constructor

Parameters

NameTypeDefault valueDescription
nodeTransformNodeundefinedScene node of an occluder
renderOrdernumber0Render order (0,1,2,3)

Overrides

BabylonPlugin.constructor

Properties

loaded

loaded: boolean

Loaded state

Inherited from

BabylonPlugin.loaded


node

Protected node: TransformNode


renderOrder

Protected renderOrder: number = 0


scene

Protected Optional scene: Scene

Inherited from

BabylonPlugin.scene

Methods

dispose

dispose(): void

Dispose render plugin

Returns

void

Inherited from

BabylonPlugin.dispose


load

load(scene?): Promise<void>

Initialize plugin

Sets disableColorWrite=true to node's materials. This tells rendering engine to not write to color buffer, but still write to depth buffer. This way mesh is effectively not drawn (color buffer) but occludes other meshes of the scene (depth test).

Parameters

NameTypeDescription
scene?SceneScene this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Overrides

BabylonPlugin.load


unload

unload(): void

Reset plugin

Releases all resources/instances created in load(). Overridden by derived classes for particular task.

Returns

void

Inherited from

BabylonPlugin.unload


update

update(result, stream): Promise<void>

Update the scene node

Main method implementing the logic of the plugin. Updates the node according to provided results. Overridden by derived classes for particular task.

Parameters

NameTypeDescription
resultanyResults of video processing
streamHTMLCanvasElementCaptured video frame

Returns

Promise<void>

Promise resolving when update is finished

Inherited from

BabylonPlugin.update