d = (dx,dy,dz) is the spotlight's direction (GL_SPOT_DIRECTION), assuming the light is a spotlight and the vertex lies inside the cone of illumination produced by the spotlight.
The dot product of the two vectors v and d varies as the cosine of the angle between them; hence, objects directly in line get maximum illumination, and objects off the axis have their illumination drop as the cosine of the angle.
To determine whether a particular vertex lies within the cone of
illumination, OpenGL evaluates
where
and
are as
defined above. If this value is less than the cosine of the spotlight's
cutoff angle (GL_SPOT_CUTOFF), then the vertex lies outside the cone;
otherwise, it's inside the cone.