Light

class Light(maxDirs)

Abstract class for lights

Arguments:
  • maxDirs (number) – the maximum number of directions computed for this light.

Light.Light
Light.isGlobal

type: boolean

Says whether the shape is global. True if global, false otherwise.

Light.isLight

type: boolean

Says that the object inherits from Light

Light.isLocal

type: boolean

Says whether the shape is local. True if local, false otherwise

Light.maxDirs

type: number

Maximum number of directions computed for this light.

Light.glslDirections()

Return the chunk of GLSL code corresponding to the direction field. The GLSL direction function should have the following signature bool {{name}}_directions(RelVector v, int i, out RelVector dir, out float intensity) where - v gives the position at which we compute the direction - i means that we are computed the i-th direction (the index start at i = 0) The function returns true if the i-th direction exists and false otherwise. If the i-th direction exists, then it populates dir with the direction and intensity with the light intensity (in this direction).

Returns:

string

Light.glslInstance()

Compile all the function directly related to the object (e.g. direction field).

Returns:

string