Routines (alphabetical) > Object Classes > Graphics Object Classes > IDLgrLight Properties

# IDLgrLight Properties

IDLgrLight objects have the following properties in addition to properties inherited from any superclasses. Properties with the word “Yes” in the “Get” column of the property table can be retrieved via IDLgrLight::GetProperty. Properties with the word “Yes” in the “Init” column of the property table can be set via IDLgrLight::Init. Properties with the word “Yes” in the “Set” column in the property table can be set via IDLgrLight::SetProperty.

Note: For a discussion of the property description tables shown below, see About Object Property Descriptions.

Objects of this class have the following properties.

- ALL
- ATTENUATION
- COLOR
- CONEANGLE
- DIRECTION
- FOCUS
- HIDE
- INTENSITY
- LIGHT_INDEX
- LOCATION
- PALETTE
- PARENT
- REGISTER_PROPERTIES
- SHADER
- TYPE
- XCOORD_CONV
- YCOORD_CONV
- ZCOORD_CONV

In addition, objects of this class inherit:

- IDLitComponent

### ALL

An anonymous structure that contains the values of all of the properties associated with the state of this object. State information about the object includes things like color, range, tick direction, etc., but not image, vertex, or connectivity data, or user values.

Note: The fields of this structure may change in subsequent releases of IDL.

Note: This structure returns ALPHA_CHANNEL, CLIP_PLANES, DEPTH_TEST_DISABLE, DEPTH_TEST_FUNCTION, DEPTH_WRITE_DISABLE, and [XYZ]RANGE properties that are consistent with other graphic objects. However, these properties are not used by the IDLgrLight object.

Property Type | Structure
Name String | not displayed
Get: Yes | Set: No | Init: No | Registered: No

### ATTENUATION

A 3-element floating-point vector of the form [constant, linear, quadratic] that describes the factor by which light intensity is to fall with respect to distance from the light source. ATTENUATION applies only to Positional and Spot lights, as specified by the TYPE property. The overall attenuation factor is computed as follows:

attenuation = 1/(constant + linear*distance + quadratic*distance^2)

By default, the values are [1, 0, 0].

This property is registered as a user-defined property, but it is hidden by default.

Property Type | USERDEF
Name String | Attenuation
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### COLOR

A three-element byte vector specifying the RGB color of the light. The default is [255, 255, 255], which is a white light. The color of a light is ignored when graphics are sent to graphics destinations using the Indexed color model, in which case light intensities are scaled into the range of colors available on the graphics destination.

In a property sheet, this property appears as a color property.

Property Type | COLOR
Name String | Color
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### CONEANGLE

A floating-point value that specifies the angle (measured in degrees) of coverage for a spotlight. The default is 60.

Property Type | FLOAT
Name String | Spotlight cone angle
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### DIRECTION

A three-element floating-point vector representing the direction in which a spotlight is to be pointed. The default is [0,0,-1].

Note: For directional lights, the light’s parallel rays follow a vector beginning at the position specified by LOCATION and ending at [0, 0, 0].

This property is registered as a user-defined property, but it is hidden by default.

Property Type | USERDEF
Name String | Spotlight direction
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### FOCUS

A floating-point value that describes the attenuation of intensity for spotlights as the distance from the center of the cone of coverage increases. This factor is used as an exponent to the cosine of the angle between the direction of the spotlight and the direction from the light to the vertex being lighted. The default is 0.0.

Property Type | FLOAT
Name String | Spotlight attenuation
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### HIDE

A Boolean value or enumerated list item that indicates whether this light should be enabled:

Value | Property Sheet Value | Description
0 | True | Enable light (the default)
1 | False | Disable light

Note: If no lights are present in the view (or if all lights in the view are hidden), an ambient light will be provided by default.

Property Type | ENUMLIST
Name String | Show
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### INTENSITY

A floating-point value between 0.0 (darkest) and 1.0 (brightest) that indicates the intensity of the light. The default is 1.0.

Property Type | FLOAT
Name String | Intensity
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### LIGHT_INDEX

Use this property to allow a vertex shader program to identify individual light objects in a scene and to locate property information such as color or position associated with the light object. This property is only useful when the IDLgrShader object referenced by the SHADER property has a vertex shader program that does lighting calculations.

Set this property to a scalar integer between the values of -1 and 7, inclusive. If set to -1, IDL ignores this property. Otherwise, each light in a scene, up to the maximum number of 8, should have a unique index value. If any non-ambient light objects share LIGHT_INDEX property values, the object with a shared LIGHT_INDEX value encountered last in the scene deactivates all prior light objects with the same index value.

If you do not set this property, IDL automatically assigns an index value, but this value is unimportant unless you have a shader program performing lighting calculations. If your application is using a shader program, associate the light index with the OpenGL Shading Language (GLSL) light source. For example, if you set the LIGHT_INDEX property on an instance of a diffuse IDLgrLight object to the value of 3, the following GLSL shader language code retrieves the color of that light:

Vec4 diffuse_light_color = gl_LightSource[3].diffuse;

where `gl_LightSource` is a built-in GLSL uniform variable.

Note: IDL does not store ambient lights in the `gl_LightSource` table. In a GLSL shader program, retrieve the color of the IDL ambient light using uniform variable `gl_LightModelProperties.ambient`, the built-in GLSL ambient light uniform variable.

Property Type | Integer
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### LOCATION

A floating-point vector of the form [x, y, z] describing the position of the light. By default, the position is [0, 0, 0]. IDL converts, maintains, and returns this data as double-precision floating-point.

This property is registered as a user-defined property, but it is hidden by default.

Property Type | USERDEF
Name String | Location
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### PALETTE

An object reference to a palette object (an instance of the IDLgrPalette object class) that specifies the red, green, and blue values of the color lookup table to be associated with the image if it is an indexed color image. This property is ignored if the image is a greyscale or RGB image.

Note: This table is only used when the destination is an RGB model device. The Indexed color model writes the indices directly to the device. In order to ensure that these colors are used when the image is displayed, this palette must be copied to the graphics destination’s palette for any graphics destination that uses the Indexed color model.

Note: Objects specified via this property are not automatically cleaned up when the IDLgrLight object is destroyed.

This property is registered as a user-defined property, but it is hidden by default.

Property Type | USERDEF
Name String | Color palette
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### PARENT

An object reference to the object that contains this object.

Property Type | Object reference
Name String | not displayed
Get: Yes | Set: No | Init: No | Registered: No

### REGISTER_PROPERTIES

A Boolean value that determines whether to register properties available for this object. If this property is set, all properties marked in this properties section as “Registered: Yes” will be registered for display in a property sheet. This property is useful mainly when creating iTools. By default, no properties are registered.

Property Type | Boolean
Name String | not displayed
Get: No | Set: No | Init: Yes | Registered: No

### SHADER

An object reference to an IDLgrShader object (or an object containing IDLgrShader as a superclass).

Note: IDLgrLight ignores this property.

Property Type | Object reference
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### TYPE

An integer value or an enumerated list item that indicates the type of light. Valid values are:

Value | Property Sheet Value | Description
0 | Ambient | An ambient light is a universal light source, which has no direction or position. An ambient light illuminates every surface in the scene equally, which means that no edges are made visible by contrast. Ambient lights control the overall brightness and color of the entire scene. If no value is specified for the TYPE property, an ambient light is created.
1 | Positional | A positional light supplies divergent light rays, and will make the edges of surfaces visible by contrast if properly positioned. A positional light source can be located anywhere in the scene.
2 | Directional | A directional light supplies parallel light rays. The effect is that of a positional light source located at an infinite distance from scene.
3 | Spotlight | A spotlight illuminates only a specific area defined by the light’s position, direction, and the cone angle, or angle which the spotlight covers

Property Type | ENUMLIST
Name String | Type
Get: Yes | Set: Yes | Init: Yes | Registered: Yes

### XCOORD_CONV

A floating-point vector, [s0, s1], of scaling factors that convert X coordinates from data units to normalized units. The formula for the conversion is as follows:

NormalizedX = s0 + s1 * DataX

Recommended values are:

[(-Xmin)/(Xmax-Xmin), 1/(Xmax-Xmin)]

The default is [0.0, 1.0]. IDL converts, maintains, and returns this data as double-precision floating-point.

Property Type | Double-precision floating-point vector
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### YCOORD_CONV

A floating-point vector, [s0, s1], of scaling factors that convert Y coordinates from data units to normalized units. The formula for the conversion is as follows:

NormalizedY = s0 + s1 * DataY

Recommended values are:

[(-Ymin)/(Ymax-Ymin), 1/(Ymax-Ymin)]

The default is [0.0, 1.0]. IDL converts, maintains, and returns this data as double-precision floating-point.

Property Type | Double-precision floating-point vector
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No

### ZCOORD_CONV

A floating-point vector, [s0, s1], of scaling factors that convert Z coordinates from data units to normalized units. The formula for the conversion is as follows:

NormalizedZ = s0 + s1 * DataZ

Recommended values are:

[(-Zmin)/(Zmax-Zmin), 1/(Zmax-Zmin)]

The default is [0.0, 1.0]. IDL converts, maintains, and returns this data as double-precision floating-point.

Property Type | Double-precision floating-point vector
Name String | not displayed
Get: Yes | Set: Yes | Init: Yes | Registered: No