64 lines
886 B
GLSL
64 lines
886 B
GLSL
#version {{version}}
|
|
// Automatically generated from files in pathfinder/shaders/. Do not edit!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#extension GL_GOOGLE_include_directive : enable
|
|
|
|
precision highp float;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vec4 computeCoverage(vec2 from, vec2 to, sampler2D areaLUT){
|
|
|
|
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;
|
|
return texture(areaLUT, vec2(y + 8.0, abs(d * dX))/ 16.0)* dX;
|
|
}
|
|
|
|
|
|
uniform sampler2D uAreaLUT;
|
|
|
|
in vec2 vFrom;
|
|
in vec2 vTo;
|
|
|
|
out vec4 oFragColor;
|
|
|
|
void main(){
|
|
oFragColor = computeCoverage(vFrom, vTo, uAreaLUT);
|
|
}
|
|
|