share/hedgewars/Data/Shaders/default.fs
author Wuzzy <Wuzzy2@mail.ru>
Fri, 09 Mar 2018 22:23:57 +0100
changeset 13155 2f7c25bf4201
parent 12891 a089326f0e16
child 15298 042a5e8d9c59
permissions -rw-r--r--
When using seduction, only show “CENSORED” text in English locale
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12884
286e170f4f6b apparently this is GLES2 only
nemo
parents: 11800
diff changeset
     1
#ifdef GL_ES
11800
2028bd2a6c5b Set medium floating precision to shaders
frd
parents: 11317
diff changeset
     2
precision mediump float;
12884
286e170f4f6b apparently this is GLES2 only
nemo
parents: 11800
diff changeset
     3
#endif
11800
2028bd2a6c5b Set medium floating precision to shaders
frd
parents: 11317
diff changeset
     4
8334
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
     5
uniform sampler2D tex0;
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
     6
uniform vec4 tint;
12891
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
     7
uniform bool tintAdd;
8334
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
     8
uniform bool enableTexture;
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
     9
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    10
varying vec2 tex;
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    11
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    12
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    13
void main()
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    14
{
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    15
    if(enableTexture){
12891
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    16
        if (tintAdd){
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    17
            tint.a = 0.0;
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    18
            gl_FragColor = clamp(texture2D(tex0, tex) + tint, 0.0, 1.1);
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    19
        }else{
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    20
            gl_FragColor = texture2D(tex0, tex) * tint;
a089326f0e16 fix crosshair rendering in GL2 mode
sheepluva
parents: 12884
diff changeset
    21
        }
8334
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    22
    }else{
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    23
        gl_FragColor = tint;
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    24
    }
abb48dd39e26 Added shaders and -GL2 option
Michael Hartman <omh1280@gmail.com>
parents:
diff changeset
    25
}