LittleJS 1.30.0

Render3D

DirectionalLight3D

DirectionalLight3D - A Light3D that shines from far away with no falloff, like sunlight

  • It shines from its position toward the origin, like a three.js DirectionalLight: only the direction to it counts, so moving it or its parent swings the light around; parent it to a sun in the sky and it follows
  • It cannot sit on the origin, since that leaves no direction
  • It casts no shadow: the sun, render3D.sunDirection, does, or a spotlight set as render3D.shadowLight

Extends Light3D

Constructor

new DirectionalLight3D(pos3D, color, intensity)render3dObject.js:1734

Create a directional light

pos3D Vector3 optional

Where it shines from, toward the origin

color Color optional

Light color, its alpha fades it

intensity number optional, default 1

Brightness, multiplies the color, above 1 is brighter than white

const fill = new DirectionalLight3D(vec3(-1, 1, 1), hsl(.6, .5, .3)); // from the back left and above

Inherited from Light3D

Inherited from EngineObject3D

Inherited from EngineObject