// Texture Information from Oolite.
   uniform sampler2D      uColorMap; // Difuse and Illumination map
    
// Uniforms from Oolite
   uniform float  uTime; //Time from game clock

// Information from Vetrex Shader
   varying vec2  vTexCoord;
   
//Set the Lamp color for the hull spotlights
const vec4 LampColor = vec4(0.9926, 0.9686, 0.7325, 1.0);

// Irregular flickering function
   #ifdef OO_REDUCED_COMPLEXITY 
   #define Pulse(v, ts) ((v) * 0.95) 
   #define Blink_on_off(value) (1.0)
   #else

     float Pulse(float value, float timeScale)
     {
        float t = uTime * timeScale;   

        float s0 = t;
        s0 -= floor(s0);
        float sum = abs( s0 - 0.5);
   
        float s1 = t * 0.7 - 0.05;
        s1 -= floor(s1);
        sum += abs(s1 - 0.5) - 0.25;
   
        float s2 = t * 1.3 - 0.3;
        s2 -= floor(s2);
        sum += abs(s2 - 0.5) - 0.25;
   
        float s3 = t * 5.09 - 0.6;
        s3 -= floor(s3);
        sum += abs(s3 - 0.5) - 0.25;

        return (sum * 0.1 + 0.9) * value;

      }
   #endif
   
   void main(void)
   {
 
// Load texture data
   vec4 diffuseMap = texture2D(uColorMap, vTexCoord);
   
 // Add in the glow effects for simple shader mode  
  vec4 color = diffuseMap * diffuseMap.a * 3.0 * LampColor * 5.0 *  Pulse(min(1.0, 1.0), 1.0);
// Output final color
   gl_FragColor = vec4(color.rgb, 1.0);
   }
