1.1.0 • Published 10 years ago
gl-light v1.1.0
gl-light
Create 3d lights for use with stack.gl.
install
npm install gl-lightexample
Define data for your light
var data = {
position: [0, 10, 20, 1]
}Then create it
var light = require('gl-light')(data)usage
light = require('gl-light')(data)
Create a light by providing data.
The following properties on data are required:
positiona 3 or 4 vector with the position, with the fourth element specifying point or directional light, default[0, 0, 0, 1]
The fourth element of position specifies a point (1) or directional (0) light. If a 3 vector is passed, the fourth element will be set to 1.
light.attributes
All derived attributes are stored on light.attributes, and include:
positiona 4 vector with the position in homogenous coordinates
light.position([x, y, z, [w]])
Update the position. If a 3 vector is passed, the fourth element will be kept the same.