Skip to content

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.

ResultT extends object = { }

Type of processing results

new ThreePlugin<ResultT>(): ThreePlugin<ResultT>

Constructor

ThreePlugin<ResultT>

ScenePlugin.constructor

loaded: boolean

Loaded state

ScenePlugin.loaded


ordinal: number

Ordinal number

ScenePlugin.ordinal


protected optional renderer: Renderer<ResultT>

Renderer loaded the plugin

ScenePlugin.renderer


protected optional scene: Scene

Reference to a scene instance

ScenePlugin.scene

dispose(): void

Dispose video plugin

void

ScenePlugin.dispose


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.

Renderer<ResultT>

Renderer this plugin is attached to

Promise<void>

Promise resolving when initialization is finished

ScenePlugin.load


setupCamera(ratio, angle): void

Set camera parameters

Could be overridden to adjust plugin’s pipeline.

number

Aspect ration of input video

number

Vertical field of view in radians

void

ScenePlugin.setupCamera


setupVideo(size): void

Set video size

Could be overridden to adjust plugin’s pipeline.

Size

Resolution of input video

void

ScenePlugin.setupVideo


unload(): void

Reset plugin

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

void

ScenePlugin.unload


update(result, stream): Promise<void>

Update

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

ResultT

Results of video processing

HTMLCanvasElement

Captured video frame

Promise<void>

Promise resolving when update is finished

ScenePlugin.update