Light

We currently support lights of type Sun, Lamp, Bulb.

makeLight()

Make a light.

Return
Entity , a pointer to a light in the world

setLightType(light, lightType)

Set the light type.

Arguments
light: Entity, a pointer to a light in the world.
lightType: int, available values are LIGHT_SUN, LIGHT_BULB, LIGHT_LAMP,

getLightType(light)

Get the light type.

Arguments
light: Entity, a pointer to a light in the world.

Return
int

setLightCastShadow(light, state)

Set whether this light should cast a shadow. Only one sun light can cast shadows, so if this light is a sun, then all other suns will switched to not casting shadows. For now only a sun light can cast shadows.

Arguments
light: Entity, a pointer to a light in the world.
state: boolean

getLightCastShadow(light)

Get whether this light is casting a shadow.

Arguments
light: Entity, a pointer to a light in the world.

Return
bool

setLightIntensity(light, value)

Set the light intensity.

Arguments
light: Entity, a pointer to a light in the world.
value: number

getLightIntensity(light)

Get the light intensity.

Arguments
light: Entity, a pointer to a light in the world.

Return
float

setLightPenumbra(light, value)

Set the penumbra (soft shadow), only works if this light is casting shadows. Value range is 0.0 to 1.0.

Arguments
light: Entity, a pointer to a light in the world.
value: number

getLightPenumbra(light)

Get the light penumbra for a shadow casting light. Value range is 0.0 to 1.0.

Arguments
light: Entity, a pointer to a light in the world.

Return
float

setLightColor(light, color)

Set the light color.

Arguments
light: Entity, a pointer to a light in the world.
color: vec4

getLightColor(light)

Get the light color.

Arguments
light: Entity, a pointer to a light in the world.

Return
vec4

setLightCone(light, cone)

Set a vec2 containing inner and outer cone radius for a lamp light. Value range is 0.0 to 1.0.

Arguments
light: Entity, a pointer to a light in the world.
cone: vec2, cone.x is inner radius, cone.y is outer radius

getLightCone(light)

Get a vec2 containing inner and outer cone radius for a lamp light. Value range is 0.0 to 1.0.

Arguments
light: Entity, a pointer to a light in the world.

Return
vec2 , ret.x is inner radius, ret.y is outer radius

setLightRadius(light, value)

Set the light radius. Sun lights will use a 0.0 to 1.0 value to define the size of the specular reflections. Bulb and lamp lights will use world unit values to define the radius of influence of the light.

Arguments
light: Entity, a pointer to a light in the world.
value: number

getLightRadius(light)

Get the light radius. Sun lights will use a 0.0 to 1.0 value to define the size of the specular reflections. Bulb and lamp lights will use world unit values to define the radius of influence of the light.

Arguments
light: Entity, a pointer to a light in the world.

Return
float