Skip to main content

Class: ThreePlugin<ResultT>

@geenee/bodyrenderers-three.ThreePlugin

Generic plugin for ThreeRenderer

Extends @geenee/armature!ScenePlugin for the three.js rendering engine. ThreePlugin is an abstract generic class simplifying library's API, it doesn't implement any logic and can be used as basis for actual render plugins. It should be parameterized by type of processing results to build a plugin for the implementation of @geenee/armature!Processor.

Type parameters

NameTypeDescription
ResultTextends Object = Type of processing results

Hierarchy

Constructors

constructor

new ThreePlugin<ResultT>()

Constructor

Type parameters

NameType
ResultTextends Object =

Inherited from

ScenePlugin.constructor

Properties

loaded

loaded: boolean

Loaded state

Inherited from

ScenePlugin.loaded


ordinal

ordinal: number

Ordinal number

Inherited from

ScenePlugin.ordinal


renderer

Protected Optional renderer: Renderer<ResultT>

Renderer loaded the plugin

Inherited from

ScenePlugin.renderer


scene

Protected Optional scene: Scene

Reference to a scene instance

Inherited from

ScenePlugin.scene

Methods

dispose

dispose(): void

Dispose video plugin

Returns

void

Inherited from

ScenePlugin.dispose


load

load(renderer): Promise<void>

Initialize plugin

Prepares or modifies the attached node if required. Reference to the scene object is cached and used by plugin on update() and unload(). You need to reload plugin if you want to change scene it's attached to.

Parameters

NameTypeDescription
rendererRenderer<ResultT>Renderer this plugin is attached to

Returns

Promise<void>

Promise resolving when initialization is finished

Inherited from

ScenePlugin.load


setupCamera

setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin's pipeline.

Parameters

NameTypeDescription
rationumberAspect ration of input video
anglenumberVertical field of view in radians

Returns

void

Inherited from

ScenePlugin.setupCamera


setupVideo

setupVideo(size): void

Set video size

Could be overridden to adjust plugin's pipeline.

Parameters

NameTypeDescription
sizeSizeResolution of input video

Returns

void

Inherited from

ScenePlugin.setupVideo


unload

unload(): void

Reset plugin

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

Returns

void

Inherited from

ScenePlugin.unload


update

update(result, stream): Promise<void>

Update

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

Parameters

NameTypeDescription
resultResultTResults of video processing
streamHTMLCanvasElementCaptured video frame

Returns

Promise<void>

Promise resolving when update is finished

Inherited from

ScenePlugin.update