     const in float lightCosSpotCutoff,
     const in float lightSpotBlend)
 {
-    // compute distance
+    // compute dist
     Vec3 lightVector = lightSpotPosition - vertexPosition;
     float dist = length(lightVector);
     // compute attenuation
-    float attenuation = getLightAttenuation(distance, lightAttenuation.x, lightAttenuation.y, lightAttenuation.z);
+    float attenuation = getLightAttenuation(dist, lightAttenuation.x, lightAttenuation.y, lightAttenuation.z);
     if (attenuation <= 0.0)
     {
         // compute direction

///////////////////////

/// for each light
//direction, distance, NDL, attenuation, compute diffuse, compute specular

vec4 computeSpotLightShading(
    const in vec3 normal,
    const in vec3 eyeVector,
    const in vec3 vertexPosition,

    const in vec4 materialAmbient,
    const in vec4 materialDiffuse,
    const in vec4 materialSpecular,
    const in float materialShininess,

    const in vec4 lightAmbient,
    const in vec4 lightDiffuse,



vec4 computeSunLightShading(

                            const in vec3 normal,
                            const in vec3 eyeVector,

                            //const in vec4 u_materialAmbient,
                            //const in vec4 u_materialDiffuse,
                            //const in vec4 u_materialSpecular,
                            //const in float u_materialShininess,

                            const in vec4 lightAmbient,
                            const in vec4 lightDiffuse,
                            const in vec4 lightSpecular,

                            const in vec3 lightDirection)
{
  // compute dist
  // compute NdL   // compute NdL
  float NdotL = dot(lightDirection, normal);
  if (NdotL > 0.0)
    {
      bool isShadowed = false;
      // compute shadowing term here.
      // isShadowed = computeShadow(shadowContrib)
      if (!isShadowed)
        {
          vec3 diffuseContrib;
          lambert(NdotL, u_materialDiffuse.rgb, lightDiffuse.rgb, diffuseContrib);
          vec3 specularContrib;
          specularCookTorrance(normal, lightDirection, eyeVector, u_materialShininess, u_materialSpecular.rgb, lightSpecular.rgb, specularContrib)
            return lightAmbient*u_materialAmbient + diffuseContrib*specularContrib*shadowContrib;
        }
    }
  return vec4(0.0);
}

vec4 computePointLightShading(
                              vec3 normal,
                              vec3 eyeVector,

                              // const in vec4 u_materialAmbient,
                              // const in vec4 u_materialDiffuse,
                              // const in vec4 u_materialSpecular,
                              // const in float u_materialShininess,

                              vec4 lightAmbient,
                              vec4 lightDiffuse,
                              vec4 lightSpecular,

                              vec3 lightDirection)
{
  // compute dist
  Vec3 lightVector = lightSpotPosition - vertexPosition;
  float dist = length(lightVector);
  // compute attenuation
  float attenuation = getLightAttenuation(dist, lightAttenuation.x, lightAttenuation.y, lightAttenuation.z);
  if (attenuation <= 0.0)
    {
      // compute direction
      vector3 lightDirection = dist > 0.0 ? lightVector / dist :  vec3( 0.0, 1.0, 0.0 );
      // compute NdL
      float NdotL = dot(lightDirection, normal);
      if (NdotL > 0.0)
        {
          bool isShadowed = false;
          // compute shadowing term here.
          // isShadowed = computeShadow(shadowContrib)
          if (!isShadowed){
            vec3 diffuseContrib;
            lambert(NdotL, u_materialDiffuse.rgb, lightDiffuse.rgb, diffuseContrib);
            vec3 specularContrib;
            specularCookTorrance(normal, lightDirection, eyeVector, u_materialShininess, u_materialSpecular.rgb, lightSpecular.rgb, specularContrib)
              return lightAmbient*u_materialAmbient + attenuation*spotblend*diffuseContrib*specularContrib*shadowContrib;
          }
        }
    }
  return vec4(0.0);
}
