Class: ThreeRenderer<ResultT>
@geenee/bodyrenderers-three.ThreeRenderer
Generic three.js renderer
Extends @geenee/armature!SceneRenderer for the three.js rendering engine. ThreeRenderer does basic initialization of engine, scene, and camera. It's a generic class that should be parameterized by type of processing results to build an app using particular implementation of @geenee/armature!Processor.
Type parameters
Name | Type | Description |
---|---|---|
ResultT | extends Object = | Type of processing results |
Hierarchy
-
SceneRenderer
<ResultT
,three.Scene
>↳
ThreeRenderer
↳↳
PoseRenderer
↳↳
FaceRenderer
Constructors
constructor
• new ThreeRenderer<ResultT
>(container
, mode?
, mirror?
)
Constructor
Type parameters
Name | Type |
---|---|
ResultT | extends Object = |
Parameters
Name | Type | Description |
---|---|---|
container | HTMLElement | Container of @geenee/armature!ResponsiveCanvas |
mode? | CanvasMode | Fitting mode |
mirror? | boolean | Mirror the output |
Overrides
Properties
camera
• Protected
camera: Camera
Camera instance
cameraAngle
• Protected
cameraAngle: number
Camera vertical angle in radians
Inherited from
cameraRatio
• Protected
cameraRatio: number
Camera aspect ratio
Inherited from
canvas
• canvas: ResponsiveCanvas
Responsive canvas
Inherited from
current
• current: null
| WebGLTexture
Current image texture
Inherited from
input
• Optional
input: ImageTexture
Input image texture
Inherited from
loaded
• Protected
loaded: boolean
Loaded state
Inherited from
padCtx
• Protected
padCtx: [null
| CanvasRenderingContext2D
, null
| CanvasRenderingContext2D
]
Drawing context of padding canvases
Inherited from
plugins
• Protected
plugins: Plugin
<ResultT
>[]
Attached plugins
Inherited from
renderer
• Protected
renderer: WebGLRenderer
Rendering engine
scene
• Optional
scene: Scene
Renderer scene
Inherited from
setupPadding
• Protected
setupPadding: () => void
Type declaration
▸ (): void
Setup padding canvases
Callback sets up size of padding canvases.
Returns
void
Inherited from
shader
• Protected
Optional
shader: ShaderProgram
Rendering shader
Inherited from
shaderCtx
• shaderCtx: null
| WebGL2RenderingContext
Context of the video canvas layer
Inherited from
videoRatio
• Protected
videoRatio: number
Aspect ratio of input video
Inherited from
videoSize
• Protected
videoSize: Size
Resolution of input video
Inherited from
Methods
addListener
▸ addListener<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Adds the listener function to the end of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | RendererEvents [E ] | The callback function |
Returns
ThreeRenderer
<ResultT
>
This EventEmitter
Inherited from
addPlugin
▸ addPlugin(plugin
): Promise
<void
>
Add render plugin
Initializes the plugin if it's not loaded yet but renderer is ready. Renderer takes ownership of the plugin instance meaning it will release it when plugin is detached or renderer is disposed itself.
Parameters
Name | Type |
---|---|
plugin | Plugin <ResultT > |
Returns
Promise
<void
>
Inherited from
dispose
▸ dispose(): void
Dispose renderer object
Extended to dispose scene object.
Returns
void
Inherited from
disposeObject
▸ Protected
disposeObject(object
): void
Dispose object
Helper method to remove object from the scene and recursively dispose it with all its children and allocated resources like materials and textures.
Parameters
Name | Type | Description |
---|---|---|
object | Object3D <Object3DEventMap > | Object to dispose |
Returns
void
emit
▸ emit<E
>(event
, ...args
): boolean
Synchronously calls each of the listeners registered for the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
...args | Args <RendererEvents [E ]> | Arguments passed to the listeners |
Returns
boolean
True if the event had listeners, False otherwise
Inherited from
eventNames
▸ eventNames(): (string
| symbol
)[]
List of emitter's events
Returns
(string
| symbol
)[]
List of emitter's events
Inherited from
getMaxListeners
▸ getMaxListeners(): number
Maximum number of listeners per event
Returns
number
Maximum number of listeners per event
Inherited from
listenerCount
▸ listenerCount<E
>(event
): number
The number of listeners listening to the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
Returns
number
Number of listeners
Inherited from
listeners
▸ listeners<E
>(event
): Function
[]
Copy of the array of listeners for the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
Returns
Function
[]
Copy of the listeners array
Inherited from
load
▸ load(): Promise
<void
>
Initialize renderer
Initializes rendering context, shader program and buffers.
Returns
Promise
<void
>
Promise resolving when initialization is finished
Inherited from
off
▸ off<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Removes the listener from the listener array for the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | RendererEvents [E ] | The callback function |
Returns
ThreeRenderer
<ResultT
>
This EventEmitter
Inherited from
on
▸ on<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Adds the listener function to the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | RendererEvents [E ] | The callback function |
Returns
ThreeRenderer
<ResultT
>
This EventEmitter
Inherited from
once
▸ once<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Adds a one-time listener function for the event
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | RendererEvents [E ] | The callback function |
Returns
ThreeRenderer
<ResultT
>
This EventEmitter
Inherited from
prependListener
▸ prependListener<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Adds the listener function to the beginning of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |
Parameters
Name | Type | Description |
---|---|---|
event | E | The name of the event |
listener | RendererEvents [E ] | The callback function |
Returns
ThreeRenderer
<ResultT
>
This EventEmitter
Inherited from
prependOnceListener
▸ prependOnceListener<E
>(event
, listener
): ThreeRenderer
<ResultT
>
Adds a one-time listener function to the beginning of the listeners array
Type parameters
Name | Type |
---|---|
E | extends keyof RendererEvents |