How it works...
The SpotLightInfo structure defines all of the configuration options for the spotlight. We declare a single uniform variable named Spot to store the data for our spotlight. The Position field defines the location of the spotlight in eye coordinates. The L field is the intensity (diffuse and specular) of the spotlight, and La is the ambient intensity. The Direction field will contain the direction that the spotlight is pointing, which defines the center axis of the spotlight's cone. This vector should be specified in camera coordinates. Within the OpenGL program, it should be transformed by the normal matrix in the same way that normal vectors would be transformed. We could do so within the shader; however, within the shader, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access