#pragma once
#include <GL/glew.h>
#include "Shader.h"

class PhongShader : public Shader {
public:
    PhongShader () { init ("shader.vert", "shader.frag"); }
    inline virtual ~PhongShader () {}

    void setDiffuseRef (float s) {
        glUniform1f (diffuseRefLocation, s);
    }

    void setSpecRef (float s) {
        glUniform1f (specRefLocation, s);
    }

    void setShininess (float s) {
        glUniform1f (shininessLocation, s);
    }
    
private:
    void init (const std::string & vertexShaderFilename,
               const std::string & fragmentShaderFilename) {
        loadFromFile (vertexShaderFilename, fragmentShaderFilename);
        bind ();
        diffuseRefLocation = getUniLoc ("diffuseRef");
        specRefLocation = getUniLoc ("specRef");
        shininessLocation = getUniLoc ("shininess");
    }
    GLint diffuseRefLocation;
    GLint specRefLocation;
    GLint shininessLocation;
};
