dyna3/app-proto/src/point.frag

19 lines
506 B
GLSL
Raw Normal View History

#version 300 es
precision highp float;
in vec4 point_color;
in float point_highlight;
in float total_radius;
out vec4 outColor;
void main() {
float r = total_radius * length(2.*gl_PointCoord - vec2(1.));
const float POINT_RADIUS = 4.;
float border = smoothstep(POINT_RADIUS - 1., POINT_RADIUS, r);
float disk = 1. - smoothstep(total_radius - 1., total_radius, r);
vec4 color = mix(point_color, vec4(1.), border * point_highlight);
outColor = vec4(vec3(1.), disk) * color;
}