///////////////////////////////////////////////////////////////////////////////
// Light3D
// - Class for managing an OpenGL light source
///////////////////////////////////////////////////////////////////////////////
class Light3D
{
public:
GLenum nLightID; // Light source ID number
fVector3D position; // Light position
fRGBA ambient, diffuse, specular; // Color of individual light parameters
int shininess; // Specular exponent
// Constructor, destructor
Light3D();
~Light3D();
// Shortcuts to set light values
void setLight(float fAmbient, float fDiffuse,
float fSpecular, int nShininess,
fRGBA color=fwhite);
static void setSceneAmbient(fRGBA &); // Set the scene ambient light
// Turn light on/off
void on();
void off();
void executeLight(); // Execute opengl commands to setup the light
private:
// Static members for generating light ID
// numbers since openGL didn't bother
static int nMaxLights; // Maximum # of lights
static int nLightBits; // Track openGL light IDs currently in use
static int getLightID(); // Obtain a new light ID
static void freeLightID(int nID); // Remove a light ID from use
};