diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-13 05:27:47 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-06-13 05:27:47 +0200 |
commit | 55ff3fddd8bee56fdec18612c7afd4863ac024e0 (patch) | |
tree | d2422898c42bdc263ca777ed19d26683b31020df /shaders/shader.frag | |
parent | b25f19d99a78099e10319983cb8230266a2c9870 (diff) |
shaders: wip
Diffstat (limited to 'shaders/shader.frag')
-rw-r--r-- | shaders/shader.frag | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/shaders/shader.frag b/shaders/shader.frag index 9e05d677..faea53fb 100644 --- a/shaders/shader.frag +++ b/shaders/shader.frag @@ -1,14 +1,22 @@ precision highp float; -uniform sampler2D sampler; -layout (location = 2) uniform vec4 tint = vec4(1, 1, 1, 1); +layout (location = 0) uniform vec2 scale; +layout (location = 1) uniform vec3 offset; +layout (location = 2) uniform vec4 tint; +layout (location = 3) uniform bool enable_lightmap; +layout (location = 4) uniform sampler2D sampler; +layout (location = 5) uniform sampler2D lightmap_sampler; -noperspective in vec2 frag_texcoords; +layout (location = 0) noperspective in vec2 frag_texcoords; +layout (location = 1) noperspective in vec2 frag_light_coord; out vec4 color; //layout (depth_greater) out float gl_FragDepth; void main() { - color = texture(sampler, frag_texcoords) * tint; + vec4 light = tint; + if (enable_lightmap) + light *= vec4(texture(lightmap_sampler, frag_light_coord).rgb, 1); + color = texture(sampler, frag_texcoords) * light; if (color.a == 0) discard; } |