 		}
 	}
 	
-	
 	if(gfFogEnabled)
 		fragColor = fragColor * gfFogFactor + vec4(gfFogColor, zero_float) * (one_float - gfFogFactor);
 	

 //NOTE: if there is a #version directive (e.g. #version 100), it must occur before anything else in the program (including other directives)
 #version 100	//it is set the same time as the flags
*/
 //For other GL versions compatibility
 #ifdef GL_FRAGMENT_PRECISION_HIGH
	precision highp float;	//Desktop (or ES2.0 supporting highp)
#elif GL_ES
	precision mediump float;	//Default

#define CLIPS_MAX 		8

//Light Structure
struct gfLight{
	int type;
	vec4 position;
	vec4 direction;
	vec3 attenuation;
	vec4 color;
	float ambientIntensity;	//it is not used - we calculate it inside the shader
	float intensity;
	float beamWidth;	//it is not used - we calculate it inside the shader
	float cutOffAngle;
};

//Generic (Scene) Uniforms
uniform int gfNumLights;
uniform bool gfLightTwoSide;
uniform int gfNumTextures;
uniform gfLight lights[LIGHTS_MAX];
uniform bool hasClip;
uniform bool hasMeshColor;

//Material and Lighting Properties	
uniform vec4 gfAmbientColor;
uniform vec4 gfDiffuseColor; 
uniform vec4 gfSpecularColor; 
uniform vec4 gfEmissionColor;
uniform float gfShininess;	//a.k.a. specular exponent
uniform vec4 gfLightDiffuse;
uniform vec4 gfLightAmbient; 
uniform vec4 gfLightSpecular;

//Fog
uniform bool gfFogEnabled; 
uniform vec3 gfFogColor;

//Color Matrix
uniform mat4 gfColorMatrix;
uniform bool hasColorMatrix;
uniform vec4 gfTranslationVector;
	
//Color Key
uniform vec3 gfKeyColor;
uniform float gfKeyAlpha;
uniform float gfKeyLow;
uniform float gfKeyHigh;
uniform bool hasColorKey;

//Texture samplers
uniform sampler2D y_plane;
uniform sampler2D u_plane;
uniform sampler2D v_plane;

//Texture other
uniform float alpha;
const vec3 offset = vec3(-0.0625, -0.5, -0.5);
const vec3 R_mul = vec3(1.164,  0.000,  1.596);
const vec3 G_mul = vec3(1.164, -0.391, -0.813);
const vec3 B_mul = vec3(1.164,  2.018,  0.000);

//Varyings
varying vec3 n;
varying vec4 gfEye;
varying vec2 TexCoord;
