Skip to main content

Class: OccluderPlugin

@geenee/bodyrenderers-three.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 colorWrite=false to all 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
nodeObject3D<Event>undefinedScene node of an occluder
renderOrdernumber-1Render order (0,1,2,3)

Overrides

ThreePlugin.constructor

Properties

loaded

loaded: boolean

Loaded state

Inherited from

ThreePlugin.loaded


node

Protected node: Object3D<Event>


renderOrder

Protected renderOrder: number = -1


scene

Protected Optional scene: Scene

Inherited from

ThreePlugin.scene

Methods

dispose

dispose(): void

Dispose render plugin

Returns

void

Inherited from

ThreePlugin.dispose


load

load(scene?): Promise<void>

Initialize plugin

Sets colorWrite=false to all 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

ThreePlugin.load


unload

unload(): void

Reset plugin

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

Returns

void

Inherited from

ThreePlugin.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

ThreePlugin.update