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
ThreePlugin
<any
>
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
Overrides
Properties
loaded
loaded:
boolean
Loaded state
Inherited from
node
protected
node:Object3D
<Object3DEventMap
>
Scene node of an occluder
ordinal
ordinal:
number
Ordinal number
Inherited from
renderer?
protected
optional
renderer:Renderer
<any
>
Renderer loaded the plugin
Inherited from
renderOrder
protected
renderOrder:number
=-1
Render order (0,1,2,3)
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
• 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
• ratio: number
Aspect ration of input video
• angle: number
Vertical field of view in radians
Returns
void
Inherited from
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
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
• result: any
Results of video processing
• stream: HTMLCanvasElement
Captured video frame
Returns
Promise
<void
>
Promise resolving when update is finished