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
ThreePlugin
<any
>↳
OccluderPlugin
Constructors
constructor
• new OccluderPlugin(node
, renderOrder?
)
Constructor
Parameters
Name | Type | Default value | Description |
---|---|---|---|
node | Object3D <Event > | undefined | Scene node of an occluder |
renderOrder | number | -1 | Render order (0,1,2,3) |
Overrides
Properties
loaded
• loaded: boolean
Loaded state
Inherited from
node
• Protected
node: Object3D
<Event
>
Scene node of an occluder
renderOrder
• Protected
renderOrder: number
= -1
Render order (0,1,2,3)
renderer
• Protected
Optional
renderer: Renderer
<any
>
Renderer loaded the plugin
Inherited from
scene
• Protected
Optional
scene: Scene
Reference to a scene instance
Inherited from
Methods
dispose
▸ dispose(): void
Dispose video plugin
Returns
void
Inherited from
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
Name | Type | Description |
---|---|---|
renderer | Renderer <any > | Renderer this plugin is attached to |
Returns
Promise
<void
>
Promise resolving when initialization is finished
Overrides
setupCamera
▸ setupCamera(ratio
, angle
): void
Set camera parameters
Could be overridden to adjust plugin's pipeline.
Parameters
Name | Type | Description |
---|---|---|
ratio | number | Aspect ration of input video |
angle | number | - |
Returns
void
Inherited from
setupVideo
▸ setupVideo(size
): void
Set video size
Could be overridden to adjust plugin's pipeline.
Parameters
Name | Type | Description |
---|---|---|
size | Size | Resolution of input video |
Returns
void
Inherited from
unload
▸ unload(): void
Reset plugin
Releases all resources allocated in load(). Deletes cached reference to the scene object.
Returns
void
Inherited from
update
▸ update(result
, stream
): Promise
<void
>
Update
Main method implementing the logic of the plugin. Overridden by derived classes for particular task.
Parameters
Name | Type | Description |
---|---|---|
result | any | Results of video processing |
stream | HTMLCanvasElement | Captured video frame |
Returns
Promise
<void
>
Promise resolving when update is finished