ModelLightData

Package: Libraries.Game.Graphics.Models.Data · Inherits from: Libraries.Language.Object

ModelLightData holds one light read from a model file, such as a lamp's bulb in a glTF file that uses the KHR_lights_punctual extension. A Model loaded from such a file turns each of these into a PointLight, SpotLight or DirectionalLight. The position and direction are in the model's own space, the same space its meshes are in, so a light placed on a lamp's bulb in the file lands on the bulb in the loaded model. Area lights in a file are read as point lights. Ambient lights are not read. The color is kept with its brightest part at 1, and the strength is kept separately as the intensity, as it was in the file (candela for point and spot lights in glTF, lux for directional lights).

Variables

  • integer DIRECTIONAL
  • number INTENSITY_SCALE: How many units of Quorum light intensity one unit of a file light's intensity becomes. Quorum's lighting divides a point light's color times intensity by the distance squared and uses the albedo over pi for diffuse light, as the glTF lights extension expects, so a glTF light in candela (point and spot) or lux (directional) is used as it is. Unsure: files exported from Blender often have large values, and how they look also depends on the layer's exposure.
  • integer SPOT: How many units of Quorum light intensity one unit of a file light's intensity becomes. Quorum's lighting divides a point light's color times intensity by the distance squared and uses the albedo over pi for diffuse light, as the glTF lights extension expects, so a glTF light in candela (point and spot) or lux (directional) is used as it is. Unsure: files exported from Blender often have large values, and how they look also depends on the layer's exposure.
  • integer POINT: The kinds of light a file can hold.

Actions

GetColor()

This action returns the light's color, with its brightest part at 1. Change it with SetColor.

Returns

Libraries.Game.Graphics.Color: The light's color.

GetDirection()

This action returns the direction the light shines, in the model's own space, of length 1. Point lights ignore it. Change it with SetDirection.

Returns

Libraries.Compute.Vector3: The light's direction.

GetInnerAngle()

This action returns a spot light's inner angle, in degrees, measured from the direction it points: inside it, the light is at full strength.

Returns

number: The inner angle, in degrees.

GetIntensity()

This action returns how bright the light is, as it was in the file. For glTF, this is in candela for point and spot lights, and lux for directional lights.

Returns

number: The light's intensity in the file's units.

GetName()

This action returns the light's name, as it is in the file. For glTF files, this is the name of the node the light is on.

Returns

text: The light's name.

GetOuterAngle()

This action returns a spot light's outer angle, in degrees, measured from the direction it points: past it, the light gives no light.

Returns

number: The outer angle, in degrees.

GetPosition()

This action returns where the light is, in the model's own space. Change it with SetPosition.

Returns

Libraries.Compute.Vector3: The light's position.

GetQuorumIntensity()

This action returns how bright the light is in Quorum's units: the file's intensity times INTENSITY_SCALE.

Returns

number: The intensity to give a Quorum light.

GetRange()

This action returns how far the light reaches, or 0 if the file did not say. Directional lights have no range.

Returns

number: The light's range, in the model's units, or 0.

GetType()

This action returns the kind of light: POINT, DIRECTIONAL or SPOT.

Returns

integer: The kind of light.

IsDirectionalLight()

This action returns true if the light is a directional light, like the sun.

Returns

boolean: True for a directional light.

IsPointLight()

This action returns true if the light is a point light.

Returns

boolean: True for a point light.

IsSpotLight()

This action returns true if the light is a spot light.

Returns

boolean: True for a spot light.

SetColor(number red, number green, number blue)

This action sets the light's color from its red, green and blue parts, each from 0 to 1.

Parameters

  • red number: The red part.
  • green number: The green part.
  • blue number: The blue part.

SetConeAngles(number inner, number outer)

This action sets a spot light's inner and outer angles, in degrees, each measured from the direction it points.

Parameters

  • inner number: The angle of full strength, in degrees.
  • outer number: The angle where the light ends, in degrees.

SetDirection(number x, number y, number z)

This action sets the direction the light shines, in the model's own space. It is made length 1. A direction of zero length is ignored.

Parameters

  • x number: The direction along x.
  • y number: The direction along y.
  • z number: The direction along z.

SetIntensity(number intensity)

This action sets how bright the light is, in the file's units. A value below 0 is kept as 0.

Parameters

  • intensity number: The light's intensity.

SetName(text name)

This action sets the light's name.

Parameters

  • name text: The light's name.

SetPosition(number x, number y, number z)

This action sets where the light is, in the model's own space.

Parameters

  • x number: The position along x.
  • y number: The position along y.
  • z number: The position along z.

SetRange(number range)

This action sets how far the light reaches, or 0 if the file did not say. A value below 0 is kept as 0.

Parameters

  • range number: The light's range, or 0.

SetType(integer type)

This action sets the kind of light: POINT, DIRECTIONAL or SPOT. Any other value is treated as POINT.

Parameters

  • type integer: The kind of light.

Inherited Actions

3 actions from Libraries.Language.Object