#ifndef _dmsLight_h_
#define _dmsLight_h_

#include <GL/gl.h>
#include <dms/Vector3.h>
#include <dms/Vector4.h>

namespace dms
{

class Light
    {
    public:
        Light(void);
        void apply(void);
        void enable(void);
        void disable(void);
        
        void setAmbient(const Vector4& color);
        void setDiffuse(const Vector4& color);
        void setSpecular(const Vector4& color);
        void setPosition(const Vector4& position);
        void setInfinitePosition(const Vector3& position);
        void setLocalPosition(const Vector3& position);
        void setPosition(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
        void setInfinitePosition(GLfloat x, GLfloat y, GLfloat z);
        void setLocalPosition(GLfloat x, GLfloat y, GLfloat z);
        void setAttenuation(GLfloat constant,GLfloat linear,GLfloat quadratic);
        void setSpotDirection(const Vector3& direction);
        void setSpotCutoff(GLfloat cutoff);
        void setSpotExponent(GLfloat exponent);
    
        Vector4& ambient(void) { return ambient_; }
        Vector4& diffuse(void) { return diffuse_; }
        Vector4& specular(void) { return specular_; }
        Vector4& position(void) { return position_; }
        GLfloat attenuationConstant(void) { return attenuationConstant_; }
        GLfloat attenuationLinear(void) { return attenuationLinear_; }
        GLfloat attenuationQuadratic(void) { return attenuationQuadratic_; }
        GLfloat spotCutoff(void) { return spotCutoff_; }
        Vector3& spotDirection(void) { return spotDirection_; }
        GLfloat spotExponent(void) { return spotExponent_; }

    private:
        GLenum lightNumber_;
        Vector4 ambient_, diffuse_, specular_;
        Vector4 position_;
        GLfloat attenuationConstant_, attenuationLinear_,
                attenuationQuadratic_;
        Vector3 spotDirection_;
        GLfloat spotCutoff_, spotExponent_;
        
        static int nextLightNum_;
    };

}

#endif
