aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/particles/defaultshaders/tabledfragment.shader
blob: e92d8050eb918a7ed355d10f70e41c089099ec36 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
uniform sampler2D texture;
uniform sampler2D colortable;
uniform sampler2D opacitytable;
uniform sampler2D sizetable;
uniform lowp float qt_Opacity;

varying highp vec2 fTex;
varying lowp vec4 fColor;
varying lowp float tt;

void main() {
    highp vec2 tex = (((fTex - 0.5) / texture2D(sizetable, vec2(tt, 0.5)).w) + 0.5);
    lowp vec4 color;
    if(tex.x < 1.0 && tex.x > 0.0 && tex.y < 1.0 && tex.y > 0.0){//No CLAMP_TO_BORDER in ES2, so have to do it ourselves
        color = texture2D(texture, tex);
    }else{
        color = vec4(0.,0.,0.,0.);
    }
    gl_FragColor = color
            * fColor
            * texture2D(colortable, vec2(tt, 0.5))
            * (texture2D(opacitytable, vec2(tt, 0.5)).w * qt_Opacity);
}