Module light

Source
Expand description

A collection of lights implementing the Light trait.

Lights shines onto objects in the scene, note however that some materials are affected by lights, others are not.

Structs§

AmbientLight
A light which shines on all surfaces. Can be uniform (a light that shines equally on any surface) or calculated from an environment map using the Environment struct.
Attenuation
Specifies how the intensity of a light fades over distance. The light intensity is scaled by 1 / max(1, constant + distance * linear + distance * distance * quadratic).
DirectionalLight
A light which shines in the given direction. The light will cast shadows if you generate a shadow map.
Environment
Precalculations of light shining from an environment map (known as image based lighting - IBL). This allows for real-time rendering of ambient light from the environment (see AmbientLight).
PointLight
A light which shines from the given position in all directions.
SpotLight
A light which shines from the given position and in the given direction. The light will cast shadows if you generate a shadow map.

Traits§

Light
Represents a light source.

Functions§

lights_shader_source
Returns shader source code with the function calculate_lighting which calculate the lighting contribution for the given lights and the given LightingModel. Use this if you want to implement a custom Material but use the default lighting calculations.