27 lines
589 B
GLSL
27 lines
589 B
GLSL
|
#version 430 core
|
|||
|
|
|||
|
uniform vec3 lightPos;
|
|||
|
uniform sampler2D colorTexture;
|
|||
|
|
|||
|
in vec3 vecNormal;
|
|||
|
in vec3 worldPos;
|
|||
|
in vec2 vecTex;
|
|||
|
|
|||
|
out vec4 outColor;
|
|||
|
|
|||
|
void main()
|
|||
|
{
|
|||
|
vec3 lightDir = normalize(lightPos - worldPos);
|
|||
|
vec3 normal = normalize(vecNormal);
|
|||
|
vec3 textureColor = texture(colorTexture, vecTex).rgb;
|
|||
|
float diffuse = max(0.1, dot(normal, lightDir));
|
|||
|
float ambientIntensity = 0.1;
|
|||
|
if (length(lightPos - worldPos) < 1) {
|
|||
|
ambientIntensity = 1.0;
|
|||
|
}
|
|||
|
|
|||
|
// Dodajemy warto<74><6F> ambientIntensity do diffuse
|
|||
|
outColor = vec4(textureColor*vec3(2.0f), 1.0);
|
|||
|
}
|
|||
|
|