rsagl- The RogueStar Animation and Graphics Library




data LightSource Source

A light source. In addition to position information, each type of light source (except NoLight) has a color term, indicating the color of direct lighting, and an ambient term, indicating the color of indirect lighting.



A directional or infinite light source, which always appears to be comming from the specified vector


A point light, which has a specific position. The intensity of point light radiation falls off with the inverse square of distance, normalized to one at the specified radius. This means that point lights will be overbright inside that radius.


An inactive light source, equivalent to any light source with a color and ambient term of rgb 0 0 0.

skylight :: Vector3D -> RGB -> LightSourceSource

A DirectionalLight approximation of ambient sky radiation. Normally, set the vector to straight up, since that is the direction of the sky.

data MapLightSource Source

Encodes a transformation of a light source, including the light color and ambient color terms, and any affine transformation. The Monoid instance supports MapLightSource as a specialized endomorphism (see Endo).

mapLight :: (RGB -> RGB) -> MapLightSourceSource

Transformation of the direct illumination color of a light source.

mapAmbient :: (RGB -> RGB) -> MapLightSourceSource

Transformation of the ambient color of a light source.

mapBoth :: (RGB -> RGB) -> MapLightSourceSource

Transformation of both the direct illumination and the ambient color terms of a light source.

infiniteLightSourceOf :: LightSource -> LightSourceSource

Converts a PointLight to a DirectionalLight, assuming that the camera is at the origin.

setLightSourcesToOpenGL :: [LightSource] -> IO ()Source

Set OpenGL light sources starting from 0.

setLightSourceToOpenGL :: (Light, LightSource) -> IO ()Source

Set one specific OpenGL light source.