Lights are treated as a special kind of geometric objects. A light, like any other geometric object, can be a part of a group (and thus, by transitivity, of an entire scene), properties can be attached to it, and it observes both the properties attached to itself and to its ancestors in the scene. In particular, lights are affected by transformation properties: When the transformation property of a light or of one of its ancestors in the scene changes, the light source moves.
Light sources affect all geometric objects of type \type{SurfaceGO}{T} in the scene, by illuminating their surfaces. However, they are invisible themselves.
LightGO.T
is the abstract class of all light sources.
INTERFACELightGO ; IMPORT BooleanProp, ColorProp, Color, GO; TYPE T <: GO.T;
LightGO.T
is a subtype of \type{GO}{T}. No additional fiels or methods
are defined.
VAR Colour : ColorProp.Name; Switch : BooleanProp.Name;
In addition to the properties observed by all \type{GO}{T}'s, there are two additional properties that are observed by allLightGO.T
's.Colour
is the name of a property that determines the colour of the light emitted by theLightGO.T
; it associates with a property value of type \type{ColourProp}{Val}.Switch
is the name of a property that determines if the light source is on or off; it associates with a property value of type \type{BooleanProp}{Val}.
The following two procedures make it more convenient to modify the
Colour
and Switch
properties of a light:
PROCEDURE SetColour (o : GO.T; c : Color.T);
The expressionSetColour(o,c)
is equivalent too.setProp(Colour.bind(ColorProp.NewConst(c)))
.
PROCEDURE SetSwitch (o : GO.T; switch : BOOLEAN);
The expressionSetSwitch(o,b)
is equivalent too.setProp(Switch.bind(BooleanProp.NewConst(b)))
.
END LightGO.