17 lines
490 B
GLSL
17 lines
490 B
GLSL
|
#version 410 core
|
||
|
|
||
|
uniform sampler2D textureSampler;
|
||
|
uniform vec3 lightDir;
|
||
|
|
||
|
in vec3 interpNormal;
|
||
|
in vec2 interpTexCoord;
|
||
|
|
||
|
void main()
|
||
|
{
|
||
|
vec2 modifiedTexCoord = vec2(interpTexCoord.x, 1.0 - interpTexCoord.y); // Poprawka dla tekstur Ziemi, ktore bez tego wyswietlaja sie 'do gory nogami'
|
||
|
vec3 color = texture2D(textureSampler, modifiedTexCoord).rgb;
|
||
|
vec3 normal = normalize(interpNormal);
|
||
|
float diffuse = max(dot(normal, -lightDir), 0.0);
|
||
|
gl_FragColor = vec4(color * diffuse, 1.0);
|
||
|
}
|