TextureLitMaterial::TextureLitMaterial(Texture * pDiffuseTexture, float pSmoothness, float pShininess, float pAmbient,
                                       Texture * pNormalMapTexture, Texture * pSpecularMapTexture,glm::vec4 pColor)
{
    _diffuseTexture=pDiffuseTexture;
    _ambient=pAmbient;
    _smoothness=pSmoothness;
    _shininess=pShininess;
    _normalMapTexture=pNormalMapTexture;
    _specularMapTexture=pSpecularMapTexture;

    color = pColor;

    _lazyInitializeShader();

    if (!_specularMapTexture)
        specularMap = false;
    else
        specularMap = true;

    if (!_normalMapTexture)
        normalMap = false;
    else
        normalMap = true;
}
TextureLitMaterial::TextureLitMaterial(Texture * pDiffuseTexture, float pShininess):
    _diffuseTexture(pDiffuseTexture),_shininess(pShininess),specMapOn(false)
{
    _lazyInitializeShader();
}
ShadowMaterial::ShadowMaterial() {
    _lazyInitializeShader();
}
DepthMapper::DepthMapper(GLuint pDepthMapFBO, GLuint pDepthMap, int pShadowWidth, int pShadowHeight)
                : _depthMapFBO(pDepthMapFBO), _depthMap(pDepthMap), _shadowWidth(pShadowWidth), _shadowHeight(pShadowHeight)
{
    _lazyInitializeShader();
}
PointLightAttenuationMaterial::PointLightAttenuationMaterial(glm::vec3 pDiffuseColor):_diffuseColor (pDiffuseColor)
{
    //every time we create an instance of colormaterial we check if the corresponding shader has already been loaded
    _lazyInitializeShader();
}
LitColorMaterial::LitColorMaterial(glm::vec3 pDiffuseColor, Texture * pDiffuseTexture)
{
    _diffuseColor = pDiffuseColor;
    _diffuseTexture = pDiffuseTexture;
    _lazyInitializeShader();
}