A class that allows mesh to dynamically change brightness based on the voxel light level at their position.
By default, VOXELIZE.Shadow
and VOXELIZE.NameTag
is ignored by this effect.
Example
// Create a light shined effect manager.
const lightShined = new VOXELIZE.LightShined();
// Add the effect to a mesh.
lightShined.add(character);
// In the render loop, update the effect.
lightShined.update();
Constructors
constructor
• new LightShined(world
, options?
): LightShined
Construct a light shined effect manager.
Parameters
Name | Type | Description |
---|---|---|
world | World <any > | The world that the effect is applied to. |
options | Partial <LightShinedOptions > | Parameters to customize the effect. |
Returns
Properties
ignored
• ignored: Set
<any
>
A list of types that are ignored by this effect.
list
• list: Set
<Object3D
<Object3DEventMap
>>
A list of meshes that are effected by this effect.
options
• options: LightShinedOptions
Parameters to customize the effect.
world
• world: World
<any
>
The world that the effect is applied to.
Methods
add
▸ add(obj
): void
Add an object to be affected by this effect.
Parameters
Name | Type | Description |
---|---|---|
obj | Object3D <Object3DEventMap > | A THREE.JS object to be shined on. |
Returns
void
ignore
▸ ignore(...types
): void
Ignore a certain type of object from being affected by this effect.
Parameters
Name | Type | Description |
---|---|---|
...types | any [] | A type or a list of types to be ignored by this effect. |
Returns
void
Example
// Ignore all shadows. (This is done by default)
lightShined.ignore(VOXELIZE.Shadow);
remove
▸ remove(obj
): void
Remove an object from being affected by this effect
Parameters
Name | Type | Description |
---|---|---|
obj | Object3D <Object3DEventMap > | The object to be removed from the effect. |
Returns
void
update
▸ update(): void
Update the light shined effect. This fetches the light level at the position of each object and recursively updates the brightness of the object.
This should be called in the render loop.
Returns
void