
#ifdef VERTEX

out vec2 VlightmapCoord;
out vec2 vTexcoord;
out vec4 Albedo;
out vec3 vpNormal;


void main() {
	gl_Position = ftransform();
	vTexcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
	VlightmapCoord  = (gl_TextureMatrix[1] * gl_MultiTexCoord1).xy;
	Albedo = gl_Color;
    vpNormal = gl_Normal;

}
#endif



#ifdef FRAGMENT

uniform sampler2D lightmap;
uniform sampler2D texture;
uniform vec4 entityColor;

in vec2 VlightmapCoord;
in vec2 vTexcoord;
in vec4 Albedo;
in vec3 vpNormal;


//>>Matrice<<//
uniform mat4 gbufferModelViewInverse;

//>>UNIFORM VEC3<<//

uniform vec3 shadowLightPosition;


uniform int entityId;

uniform float frameTimeCounter;


//>>Include<<//
#include "/lib/Conf/Lighting_conf.glsl"
#include "/lib/Lighting/DiffuseLighting.glsl"
#include "/lib/Conf/RGB_LINE_AND_ORB_CONF.glsl"
#include "/lib/Animations/GamingSelection.glsl"


void main() {
	vec4 VColor = texture2D(texture, vTexcoord) * Albedo; // Main Color
	VColor.rgb = mix(VColor.rgb, entityColor.rgb, entityColor.a);
	VColor *= texture2D(lightmap, VlightmapCoord);

	float vpLambertDiffuseLighting = VPdiffuseLighting();

	#ifdef Diffuse_Light
	VColor.rgb *= vpLambertDiffuseLighting;
	#endif	

	#ifdef RAINBOW_ORB
	if(entityId == 1){
		float vpHue = fract(frameTimeCounter * RGB_VELOCITY +gl_FragCoord.x * 0.0005);
		VColor.rgb =Gaming_Line(vec3(vpHue, 0.85, 1.5));
	}
	#endif


/* DRAWBUFFERS:0 */
	gl_FragData[0] = VColor; //gcolor
}

#endif