Skip to main content

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

CullerRenderer . buffer


bufferSize

bufferSize: number = 1

The size of the buffer where the result of the visibility check is stored.

Inherited from

CullerRenderer . bufferSize


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

CullerRenderer . components


config

config: CullerRendererConfigManager

Configurable.config

Inherited from

CullerRenderer . config


enabled

enabled: boolean = true

Whether this renderer is active or not. If not, it won't render anything.

Inherited from

CullerRenderer . enabled


isSetup

isSetup: boolean = false

Configurable.isSetup

Inherited from

CullerRenderer . isSetup


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

CullerRenderer . needsUpdate


onDisposed

readonly onDisposed: Event<string>

Disposable.onDisposed

Implementation of

Disposable . onDisposed

Inherited from

CullerRenderer . onDisposed


onSetup

readonly onSetup: Event<unknown>

Configurable.onSetup

Inherited from

CullerRenderer . onSetup


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

CullerRenderer . renderTarget


renderer

readonly renderer: WebGLRenderer

The THREE.js renderer used to make the visibility test.

Inherited from

CullerRenderer . renderer


world

readonly world: World

The world instance to which this renderer belongs.

Inherited from

CullerRenderer . world

Accessors

threshold

get threshold(): number

Deprecated

use config.threshold instead.

set threshold(value): void

Deprecated

use config.threshold instead.

Parameters

ParameterType
valuenumber

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

ParameterTypeDescription
meshMesh<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

Disposable.dispose

Returns

void

Implementation of

Disposable . dispose

Overrides

CullerRenderer . dispose


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

ParameterTypeDescription
meshMesh<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

ParameterTypeDescription
meshesIterable<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

ParameterTypeDescription
force?booleanif true, it will refresh the scene even if needsUpdate is
not true.

Returns

Promise<void>

Inherited from

CullerRenderer . updateVisibility