MeshCullerRenderer
A renderer to hide/show meshes depending on their visibility from the user's point of view.
Extends
Implements
Properties
buffer
buffer:
Uint8Array
The buffer when the result of the visibility check is stored.
Inherited from
bufferSize
bufferSize:
number
=1
The size of the buffer where the result of the visibility check is stored.
Inherited from
colorMeshes
colorMeshes:
Map
<string
,InstancedMesh
<BufferGeometry
<NormalBufferAttributes
>,Material
|Material
[]>>
Map of color code to THREE.InstancedMesh. Used to keep track of color-coded meshes.
components
components:
Components
The components instance to which this renderer belongs.
Inherited from
config
config:
CullerRendererConfigManager
Inherited from
enabled
enabled:
boolean
=true
Whether this renderer is active or not. If not, it won't render anything.
Inherited from
isSetup
isSetup:
boolean
=false
Inherited from
needsUpdate
needsUpdate:
boolean
=false
Needs to check whether there are objects that need to be hidden or shown. You can bind this to the camera movement, to a certain interval, etc.
Inherited from
onDisposed
readonly
onDisposed:Event
<string
>
Implementation of
Inherited from
onSetup
readonly
onSetup:Event
<unknown
>
Inherited from
onViewUpdated
readonly
onViewUpdated:Event
<object
>
Event triggered when the visibility of meshes is updated. Contains two sets: seen and unseen.
Type declaration
seen
seen:
Set
<Mesh
<BufferGeometry
<NormalBufferAttributes
>,Material
|Material
[],Object3DEventMap
>>
unseen
unseen:
Set
<Mesh
<BufferGeometry
<NormalBufferAttributes
>,Material
|Material
[],Object3DEventMap
>>
Overrides
CullerRenderer
. onViewUpdated
preventUpdate
preventUpdate:
boolean
=false
Flag to indicate if the renderer shouldn't update the visibility.
Inherited from
CullerRenderer
. preventUpdate
renderTarget
renderTarget:
WebGLRenderTarget
<Texture
>
The render target used to render the visibility scene.
Inherited from
renderer
readonly
renderer:WebGLRenderer
The THREE.js renderer used to make the visibility test.
Inherited from
world
readonly
world:World
The world instance to which this renderer belongs.
Inherited from
Accessors
threshold
get
threshold():number
Deprecated
use config.threshold instead.
set
threshold(value
):void
Deprecated
use config.threshold instead.
Parameters
Parameter | Type |
---|---|
value | number |
Returns
number
Methods
add()
add(
mesh
):void
Adds a mesh to the culler. When the mesh is not visibile anymore, it will be removed from the scene. When it's visible again, it will be added to the scene.
Parameters
Parameter | Type | Description |
---|---|---|
mesh | Mesh <BufferGeometry <NormalBufferAttributes >, Material | Material [], Object3DEventMap > | InstancedMesh <BufferGeometry <NormalBufferAttributes >, Material | Material []> | The mesh to add. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh. |
Returns
void
dispose()
dispose():
void
Returns
void
Implementation of
Overrides
remove()
remove(
mesh
):void
Removes a mesh from the culler, so its visibility is not controlled by the culler anymore. When the mesh is removed, it will be hidden from the scene and its color-coded mesh will be destroyed.
Parameters
Parameter | Type | Description |
---|---|---|
mesh | Mesh <BufferGeometry <NormalBufferAttributes >, Material | Material [], Object3DEventMap > | InstancedMesh <BufferGeometry <NormalBufferAttributes >, Material | Material []> | The mesh to remove. It can be a regular THREE.Mesh or an instance of THREE.InstancedMesh. |
Returns
void
updateInstanced()
updateInstanced(
meshes
):void
Updates the given instanced meshes inside the culler. You should use this if you change the count property, e.g. when changing the visibility of fragments.
Parameters
Parameter | Type | Description |
---|---|---|
meshes | Iterable <InstancedMesh <BufferGeometry <NormalBufferAttributes >, Material | Material []>> | The meshes to update. |
Returns
void
updateVisibility()
updateVisibility(
force
?):Promise
<void
>
The function that the culler uses to reprocess the scene. Generally it's better to call needsUpdate, but you can also call this to force it.
Parameters
Parameter | Type | Description |
---|---|---|
force ? | boolean | if true, it will refresh the scene even if needsUpdate is |
not true. |
Returns
Promise
<void
>