mirror of
https://codeberg.org/comaps/comaps
synced 2026-01-04 03:43:46 +00:00
committed by
Konstantin Pastbin
parent
c9cbb64f12
commit
76ffc99abd
31
libs/shaders/GL/route_marker.fsh.glsl
Normal file
31
libs/shaders/GL/route_marker.fsh.glsl
Normal file
@@ -0,0 +1,31 @@
|
||||
// Warning! Beware to use this shader. "discard" command may significally reduce performance.
|
||||
// Unfortunately some CG algorithms cannot be implemented on OpenGL ES 2.0 without discarding
|
||||
// fragments from depth buffer.
|
||||
|
||||
#ifdef SAMSUNG_GOOGLE_NEXUS
|
||||
uniform sampler2D u_colorTex;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_routeParams;
|
||||
uniform vec4 u_maskColor;
|
||||
uniform float u_opacity;
|
||||
|
||||
varying vec4 v_radius;
|
||||
varying vec4 v_color;
|
||||
|
||||
const float kAntialiasingPixelsCount = 2.5;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 finalColor = v_color;
|
||||
|
||||
float aaRadius = max(v_radius.z - kAntialiasingPixelsCount, 0.0);
|
||||
float stepValue = smoothstep(aaRadius * aaRadius, v_radius.z * v_radius.z,
|
||||
dot(v_radius.xy, v_radius.xy));
|
||||
finalColor.a = finalColor.a * u_opacity * (1.0 - stepValue);
|
||||
if (finalColor.a < 0.01 || u_routeParams.y > v_radius.w)
|
||||
discard;
|
||||
|
||||
finalColor = vec4(mix(finalColor.rgb, u_maskColor.rgb, u_maskColor.a), finalColor.a);
|
||||
gl_FragColor = samsungGoogleNexusWorkaround(finalColor);
|
||||
}
|
||||
Reference in New Issue
Block a user