-
Notifications
You must be signed in to change notification settings - Fork 155
directionalLight
Wiki » Internal Components » Objects » Lights » directionalLight
Creates a THREE.DirectionalLight
string
: Name for the 3D Object.
THREE.Vector3
: The scale of the 3D object relative to the parent.
bool
: Whether the 3D object will be culled by the camera frustum or not.
bool
: Whether the 3D object will be visible or not.
number
: The render order override for the 3D object.
bool
: Whether the light will cast shadows or not.
WARNING: changing this property after the scene has been constructed is expensive! See updatesRefreshAllMaterials.
bool
: Whether the 3D object will receive shadows or not.
WARNING: This will trigger a refresh for any materials the object is using.
WARNING: If you use the same material for multiple objects and some of them receive shadows and some do not, it may cause adverse side effects. In that case, it is recommended to use different materials.
bool
: Acknowledges and silences the remount warning message.
It is expensive to add or remove lights from the scene, because all materials need to be refreshed to take the new number of lights into account.
Additionally, toggling castShadow
on a light will trigger a material refresh as well.
In the development environment, a warning message is logged if this happens.
It is generally recommended not to add or remove lights after a scene is constructed, but if you know what you are doing you can ignore the warnings by setting the 'updatesRefreshAllMaterials' attribute to true.
Example warning message:
<directionalLight/>
has been updated which triggered a refresh of all materials. This is a potentially expensive operation. This can happen when you add or remove a light, or add or remove any component before any lights without keys e.g.<object3d> {/* new or removed component here */} <ambientLight/> </object3d>or update some properties of lights.
If you would like to add components you should either add the components after the lights (recommended), e.g.
<object3d> <ambientLight/> {/* new or removed component here */} </object3d>or add a 'key' property to the lights e.g.
<object3d> {/* new or removed component here */} <ambientLight key="light"/> </object3d>If you have modified a light's properties e.g. toggled castShadow, the materials need to be rebuilt as well. To acknowledge and remove this message, please add the '
updatesRefreshAllMaterials
' property. to<directionalLight/>
inside therender()
of the component. For more information, visit https://github.com/mrdoob/threejs/wiki/Updates/.
number
number
number
number
number
number
number
number
number
number
number
one of types [THREE.Color, number, string]
: The light color.
THREE.Vector3
: The position of the 3D object relative to the parent.
Additionally, updating this property will trigger an update for the light target position.
THREE.Euler
: The rotation of the 3D object relative to the parent, in euler form.
Additionally, updating this property will trigger an update for the light target position.
THREE.Quaternion
: The rotation of the 3D object relative to the parent, in quaternion form.
Additionally, updating this property will trigger an update for the light target position.
THREE.Vector3
: The target position for the 3D object to look at.
This calls THREE.Object3D#lookAt every time the value changes or the position of the object changes.
Additionally, updating this property will trigger an update for the light target position.
===
View Source |
---|
Home | Usage | API Reference | Examples