25 lines
635 B
GLSL
25 lines
635 B
GLSL
#version 430 core
|
|
|
|
float AMBIENT = 0.1;
|
|
|
|
uniform vec3 color;
|
|
uniform vec3 lightPos;
|
|
uniform sampler2D colorTexture;
|
|
uniform sampler2D clouds;
|
|
|
|
in vec3 vecNormal;
|
|
in vec3 worldPos;
|
|
in vec2 vertTexCoord;
|
|
|
|
out vec4 outColor;
|
|
void main()
|
|
{
|
|
vec4 cloudsColor = texture2D(clouds, vec2(vertTexCoord.x, -vertTexCoord.y));
|
|
vec4 textureColor = texture2D(colorTexture, vec2(vertTexCoord.x, -vertTexCoord.y));
|
|
|
|
vec3 lightDir = normalize(lightPos-worldPos);
|
|
vec3 normal = normalize(vecNormal);
|
|
float diffuse=max(0,dot(normal,lightDir));
|
|
outColor = vec4(mix(textureColor.xyz, vec3(1.0, 1.0, 1.0), cloudsColor.r)*min(1,AMBIENT+diffuse), 1.0);
|
|
}
|