Skip to main content

A manager for all shadows in the world. Shadows should be updated every frame.

Example

// Create a shadow manager.
const shadows = new VOXELIZE.Shadows(world);

// Add a shadow to an object managed by the shadow manager.
shadows.add(object);

// Update the shadows every frame.
shadows.update();

Hierarchy

Constructors

constructor

new Shadows(world): Shadows

Create a shadow manager.

Parameters

NameTypeDescription
worldWorld<any>The world to cast shadows in.

Returns

Shadows

Overrides

Array&lt;Shadow&gt;.constructor

Properties

enabled

enabled: boolean = true

Whether shadows are enabled. When disabled, all shadows are hidden.


world

world: World<any>

The world to cast shadows in.

Methods

add

add(object, options?): void

Add a shadow to an object under the shadow manager.

Parameters

NameTypeDescription
objectObject3D<Object3DEventMap>The object to add a shadow to.
optionsPartial<ShadowOptions>The options of the shadow.

Returns

void


update

update(): void

Loops through all tracked shadows and updates them. This should be called every frame. This also removes any shadows that are no longer attached to an object or whose parent is no longer in the scene.

Returns

void