Skip to content

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

Extends

Constructors

new OccluderPlugin()

new OccluderPlugin(node, renderOrder): OccluderPlugin

Constructor

Parameters

node: Object3D<Object3DEventMap>

Scene node of an occluder

renderOrder: number = -1

Render order (0,1,2,3)

Returns

OccluderPlugin

Overrides

ThreePlugin.constructor

Properties

loaded

loaded: boolean

Loaded state

Inherited from

ThreePlugin.loaded


node

protected node: Object3D<Object3DEventMap>

Scene node of an occluder


ordinal

ordinal: number

Ordinal number

Inherited from

ThreePlugin.ordinal


renderer?

protected optional renderer: Renderer<any>

Renderer loaded the plugin

Inherited from

ThreePlugin.renderer


renderOrder

protected renderOrder: number = -1

Render order (0,1,2,3)


scene?

protected optional scene: Scene

Reference to a scene instance

Inherited from

ThreePlugin.scene

Methods

dispose()

dispose(): void

Dispose video plugin

Returns

void

Inherited from

ThreePlugin.dispose


load()

load(renderer): 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

renderer: Renderer<any>

Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Overrides

ThreePlugin.load


setupCamera()

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

Parameters

ratio: number

Aspect ration of input video

angle: number

Vertical field of view in radians

Returns

void

Inherited from

ThreePlugin.setupCamera


setupVideo()

setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Parameters

size: Size

Resolution of input video

Returns

void

Inherited from

ThreePlugin.setupVideo


unload()

unload(): void

Reset plugin

Releases all resources allocated in load(). Deletes cached reference to the scene object.

Returns

void

Inherited from

ThreePlugin.unload


update()

update(result, stream): Promise<void>

Update

Main method implementing the logic of the plugin. Overridden by derived classes for particular task.

Parameters

result: any

Results of video processing

stream: HTMLCanvasElement

Captured video frame

Returns

Promise<void>

Promise resolving when update is finished

Inherited from

ThreePlugin.update