RenderCollector

RenderCollector traverses the scene graph and collects all necessary rendering information. It manages scene data, lighting data, and per-camera render states/queues.

Constructor

new RenderCollector()

Creates a new RenderCollector instance. In most cases, RenderCollector does not need to be created manually, as Scene will automatically create one. See Scene#collector.

Members

lightingNeedsUpdate :boolean

Setting this property to true indicates the lighting data needs to be updated. Lighting data updates are triggered by the RenderCollector#traverseAndCollect method.

Type:
  • boolean
Default Value
  • false

skeletonNeedsUpdate :boolean

Setting this property to true indicates all skeletons in the scene should be updated. Skeleton updates are triggered by the RenderCollector#traverseAndCollect method.

Type:
  • boolean
Default Value
  • false

Methods

checkVisibility(object, camera) → {boolean}

Visibility checking function called during scene traversal. Determines whether an object should be included in the render queue. Can be overridden to implement custom culling logic (LOD, distance, etc.).

Parameters:
NameTypeDescription
objectObject3D

The object to test for visibility.

cameraCamera

The camera to test against.

Returns:

True if the object should be rendered, false to cull it.

Type: 
boolean
Example
// Custom visibility check that always returns true
collector.checkVisibility = function(object, camera) {
    return true;
};

getRenderQueue(camera) → {RenderQueue}

Get the RenderQueue for the scene and camera. If the RenderQueue for the camera does not exist, it will be created.

Parameters:
NameTypeDescription
cameraCamera

The render camera.

Returns:

The target render queue.

Type: 
RenderQueue

getRenderStates(camera) → {RenderStates}

Get the RenderStates for the scene and camera. If the RenderStates for the camera does not exist, it will be created.

Parameters:
NameTypeDescription
cameraCamera

The render camera.

Returns:

The target render states.

Type: 
RenderStates

traverseAndCollect(scene, camera) → {RenderQueue}

Traverse the scene and collect all renderable objects, lights and skeletons. This method will update the RenderQueue and RenderStates for the camera.

Parameters:
NameTypeDescription
sceneScene

The scene to traverse.

cameraCamera

The camera to collect renderable objects for.

Returns:

The collected render queue.

Type: 
RenderQueue