mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
24 lines
544 B
GLSL
24 lines
544 B
GLSL
#ifdef GL_ES
|
|
precision mediump float;
|
|
#endif
|
|
|
|
in vec4 v_color;
|
|
in vec2 v_texCoords;
|
|
|
|
uniform sampler2D u_texture; // world texture, has alpha value that is meaningful
|
|
|
|
uniform sampler2D tex1; // lightmap texture
|
|
uniform vec2 tex1Offset;
|
|
uniform vec2 tex1Resolution;
|
|
|
|
out vec4 fragColor;
|
|
|
|
void main() {
|
|
vec4 colorTex0 = texture(u_texture, v_texCoords + vec2(0.5, 0.5)); // world texture
|
|
vec4 colorTex1 = texture(tex1, v_texCoords); // lightmap (RGBA)
|
|
|
|
colorTex1 = vec4(colorTex1.xyz, 1.0);
|
|
|
|
fragColor = colorTex0 * colorTex1;
|
|
}
|