2019-06-05 20:20:12 -04:00
|
|
|
#version {{version}}
|
2019-06-05 17:35:46 -04:00
|
|
|
// Automatically generated from files in pathfinder/shaders/. Do not edit!
|
|
|
|
|
2019-06-05 20:20:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 21:00:52 -04:00
|
|
|
#extension GL_GOOGLE_include_directive : enable
|
|
|
|
|
2019-06-05 20:20:12 -04:00
|
|
|
precision highp float;
|
2020-05-08 19:59:01 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-06-05 20:20:12 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-23 21:00:52 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-05-04 16:26:40 -04:00
|
|
|
vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT){
|
2020-04-23 21:00:52 -04:00
|
|
|
|
2019-06-05 20:20:12 -04:00
|
|
|
vec2 left = from . x < to . x ? from : to, right = from . x < to . x ? to : from;
|
|
|
|
|
|
|
|
|
|
|
|
vec2 window = clamp(vec2(from . x, to . x), - 0.5, 0.5);
|
|
|
|
float offset = mix(window . x, window . y, 0.5)- left . x;
|
|
|
|
float t = offset /(right . x - left . x);
|
|
|
|
|
|
|
|
|
|
|
|
float y = mix(left . y, right . y, t);
|
|
|
|
float d =(right . y - left . y)/(right . x - left . x);
|
|
|
|
|
|
|
|
|
|
|
|
float dX = window . x - window . y;
|
2020-05-04 16:26:40 -04:00
|
|
|
return texture(areaLUT, vec2(y + 8.0, abs(d * dX))/ 16.0)* dX;
|
2020-04-23 21:00:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
uniform sampler2D uAreaLUT;
|
|
|
|
|
|
|
|
in vec2 vFrom;
|
|
|
|
in vec2 vTo;
|
|
|
|
|
|
|
|
out vec4 oFragColor;
|
|
|
|
|
|
|
|
void main(){
|
2020-05-04 16:26:40 -04:00
|
|
|
oFragColor = computeCoverage(vFrom, vTo, uAreaLUT);
|
2019-06-05 20:20:12 -04:00
|
|
|
}
|
|
|
|
|