lighting

Utilities for lighting computation. All direction vectors must be normalized.

Compute the intensity of the diffuse lighting component based on the direction of light rays and the surface normal.

float diffuseLight(vec3 lightDirection, vec3 normal);

Compute the intensity of the specular lighting component based on the direction of light rays, the surface normal, direction towards the camera, and the Phong exponent.

float specularLight(vec3 lightDirection, vec3 normal, vec3 cameraDirection, float exponent);