pathfinder/demo2/cover.fs.glsl

27 lines
701 B
Plaintext
Raw Normal View History

2018-11-14 16:56:45 -05:00
#version 300 es
// pathfinder/demo2/cover.fs.glsl
//
// Copyright © 2018 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
precision highp float;
2018-11-15 17:37:32 -05:00
uniform sampler2D uStencilTexture;
in vec2 vTexCoord;
2018-12-18 17:00:46 -05:00
in float vBackdrop;
2018-11-15 21:06:19 -05:00
in vec4 vColor;
2018-11-15 17:37:32 -05:00
2018-11-14 16:56:45 -05:00
out vec4 oFragColor;
void main() {
2018-12-18 17:00:46 -05:00
float coverage = abs(texture(uStencilTexture, vTexCoord).r + vBackdrop);
2018-11-15 22:23:42 -05:00
oFragColor = vec4(vColor.rgb, vColor.a * coverage);
2018-11-14 16:56:45 -05:00
}