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
-
Array<Shadow>↳
Shadows
Constructors
constructor
• new Shadows(world): Shadows
Create a shadow manager.
Parameters
| Name | Type | Description |
|---|---|---|
world | World<any> | The world to cast shadows in. |
Returns
Overrides
Array<Shadow>.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
| Name | Type | Description |
|---|---|---|
object | Object3D<Object3DEventMap> | The object to add a shadow to. |
options | Partial<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