1 in vec3 fragmentNormal;
2 in float fragmentTextureIndex;
3 in vec2 fragmentTextureCoords;
8 uniform float daylight;
10 uniform sampler2D textures[MAX_TEXTURE_UNITS];
14 vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
15 vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
16 return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
21 vec3 lightColor = vec3(1.0);
23 vec3 ambient = mix(0.2, 0.8, daylight) * lightColor;
24 vec3 diffuse = 0.2 * daylight * clamp(dot(normalize(fragmentNormal), normalize(lightDir)), 0.0, 1.0) * lightColor;
26 vec3 light = ambient + diffuse;
28 outColor = texture(textures[int(fragmentTextureIndex + 0.5)], fragmentTextureCoords) * vec4(hsv2rgb(vec3(fragmentColor)), 1.0) * vec4(light, 1.0);