<commit_before>//#define emissiveColorFlag
//#define specularColorFlag
//#define diffuseColorFlag
//#define lightmapTextureFlag
//#define diffuseTextureFlag
//#define specularTextureFlag
//#define translucentFlag

#define normalsFlag

#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define MED
#define LOWP
#endif

#ifdef diffuseColorFlag
uniform vec4 diffuseColor;
#endif

#ifdef emissiveColorFlag
uniform vec4 emissiveColor;
#endif

#ifdef specularColorFlag
uniform vec4 specularColor;
#endif

uniform vec3 ambient;
const float shininessFactor = 15.0;

#ifdef diffuseTextureFlag
uniform sampler2D diffuseTexture;
#endif

#ifdef lightmapTextureFlag
uniform sampler2D lightmapTexture;
#endif

#ifdef specularTextureFlag
uniform sampler2D specularTexture;
#endif

varying MED vec2 v_texCoords;
varying vec3 v_normal;
varying vec3 v_eye;
varying vec3 v_pos;
varying float v_intensity;

varying vec3 v_lightDir;
varying vec3 v_lightColor;

//wrap light. this is fastest light model
float wrapLight(vec3 nor, vec3 direction){
	return dot(nor, direction) * 0.5 + 0.5;
}	
void main()
{	
	
	float alpha = 1.0;
	
	#ifdef diffuseTextureFlag
		vec4 difTex = texture2D(diffuseTexture, v_texCoords);
		vec3 diffuse = difTex.rgb;	
		#ifdef translucentFlag
			alpha = difTex.a;
		#endif
	#else 
		vec3 diffuse = vec3(1.0);
	#endif
	
	
	#ifdef diffuseColorFlag
		diffuse *= diffuseColor.rgb;
		#ifdef translucentFlag
			alpha *= diffuseColor.a;
		#endif
	#endif 	
		
	//fastest way to calculate inverse of length
  	float invLength = clamp(inversesqrt( dot(v_lightDir, v_lightDir)),0.0, 1.0 );
  	vec3 intensity =  v_lightColor * ( v_intensity * invLength);	
	
	#ifdef normalsFlag
		vec3 lightDirection = v_lightDir * invLength;	
	
		vec3 surfaceNormal = normalize( v_normal );
		//lambert phong
    	float lambert = wrapLight(surfaceNormal, lightDirection);
   	
		//specular blinn
		vec3 fromEye   = normalize(v_eye);	
		vec3 halfAngle = normalize(lightDirection + fromEye);
		float specular = pow( clamp( dot(halfAngle, surfaceNormal), 0.0, 1.0), shininessFactor);
	
		//specular = (lambert > 0.0) ? specular : 0.0;
		float tmp  = specular * (lambert * 2.0);
		specular = (lambert > 0.5)  ? specular : tmp;
			
		vec3 diffuseLight = intensity * lambert;
	
		vec3 specularLight = intensity * specular;
		#ifdef specularColorFlag
			specularLight *= specularColor.rgb;
			#ifdef translucentFlag
				alpha += specular * specularColor.a; 
			#endif
		#endif
	
		#ifdef specularTextureFlag
			specularLight *= texture2D(specularTexture, v_texCoords).rgb;
		#endif

		
		//combine lights
		vec3 light = specularLight + diffuseLight * diffuse;
	#else
		vec3 light = intensity * diffuse ;
	#endif
	
	#ifdef lightmapTextureFlag
		light *= texture2D(lightmapTexture, v_texCoords).rgb;
	#endif
	
	#ifdef emissiveColorFlag
		light += emissiveColor.rgb;
	#endif
	
	light += ambient * diffuse;
	
	gl_FragColor = vec4(light, alpha);
	
}<commit_msg>precision was wrong for exponent<commit_after>//#define emissiveColorFlag
//#define specularColorFlag
//#define diffuseColorFlag
//#define lightmapTextureFlag
//#define diffuseTextureFlag
//#define specularTextureFlag
//#define translucentFlag

#define normalsFlag

#ifdef GL_ES
#define LOWP lowp
#define MED mediump
precision lowp float;
#else
#define MED
#define LOWP
#endif

#ifdef diffuseColorFlag
uniform vec4 diffuseColor;
#endif

#ifdef emissiveColorFlag
uniform vec4 emissiveColor;
#endif

#ifdef specularColorFlag
uniform vec4 specularColor;
#endif

uniform vec3 ambient;
const MED float shininessFactor = 15.0;

#ifdef diffuseTextureFlag
uniform sampler2D diffuseTexture;
#endif

#ifdef lightmapTextureFlag
uniform sampler2D lightmapTexture;
#endif

#ifdef specularTextureFlag
uniform sampler2D specularTexture;
#endif

varying MED vec2 v_texCoords;
varying vec3 v_normal;
varying vec3 v_eye;
varying vec3 v_pos;
varying float v_intensity;

varying vec3 v_lightDir;
varying vec3 v_lightColor;

//wrap light. this is fastest light model
float wrapLight(vec3 nor, vec3 direction){
	return dot(nor, direction) * 0.5 + 0.5;
}	
void main()
{	
	
	float alpha = 1.0;
	
	#ifdef diffuseTextureFlag
		vec4 difTex = texture2D(diffuseTexture, v_texCoords);
		vec3 diffuse = difTex.rgb;	
		#ifdef translucentFlag
			alpha = difTex.a;
		#endif
	#else 
		vec3 diffuse = vec3(1.0);
	#endif
	
	
	#ifdef diffuseColorFlag
		diffuse *= diffuseColor.rgb;
		#ifdef translucentFlag
			alpha *= diffuseColor.a;
		#endif
	#endif 	
		
	//fastest way to calculate inverse of length
  	float invLength = clamp(inversesqrt( dot(v_lightDir, v_lightDir)),0.0, 1.0 );
  	vec3 intensity =  v_lightColor * ( v_intensity * invLength);	
	
	#ifdef normalsFlag
		vec3 lightDirection = v_lightDir * invLength;	
	
		vec3 surfaceNormal = normalize( v_normal );
		//lambert phong
    	float lambert = wrapLight(surfaceNormal, lightDirection);
   	
		//specular blinn
		vec3 fromEye   = normalize(v_eye);	
		vec3 halfAngle = normalize(lightDirection + fromEye);
		float specular = pow( clamp( dot(halfAngle, surfaceNormal), 0.0, 1.0), shininessFactor);
	
		//specular = (lambert > 0.0) ? specular : 0.0;
		float tmp  = specular * (lambert * 2.0);
		specular = (lambert > 0.5)  ? specular : tmp;
			
		vec3 diffuseLight = intensity * lambert;
	
		vec3 specularLight = intensity * specular;
		#ifdef specularColorFlag
			specularLight *= specularColor.rgb;
			#ifdef translucentFlag
				alpha += specular * specularColor.a; 
			#endif
		#endif
	
		#ifdef specularTextureFlag
			specularLight *= texture2D(specularTexture, v_texCoords).rgb;
		#endif

		
		//combine lights
		vec3 light = specularLight + diffuseLight * diffuse;
	#else
		vec3 light = intensity * diffuse ;
	#endif
	
	#ifdef lightmapTextureFlag
		light *= texture2D(lightmapTexture, v_texCoords).rgb;
	#endif
	
	#ifdef emissiveColorFlag
		light += emissiveColor.rgb;
	#endif
	
	light += ambient * diffuse;
	
	gl_FragColor = vec4(light, alpha);
	
}
{'fraction_non_alphanumeric': 0.09040310339011638, 'fraction_numerical': 0.01990217574633159, 'mean_word_length': 4.304114490161002, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4158162', 'n_tokens_mistral': 2264, 'n_tokens_neox': 1992, 'n_words': 547}