Skip to content

Commit 5752fe9

Browse files
committed
Attempting to display nodes with gl.POINTS and anti-alias
1 parent afde257 commit 5752fe9

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/renderers/webgl/sigma.webgl.nodes.fast.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,20 @@
149149
'varying vec4 color;',
150150

151151
'void main(void) {',
152-
'gl_FragColor = color;',
152+
'float border = 0.01;',
153+
'float radius = 0.5;',
154+
155+
'vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);',
156+
'vec2 m = gl_PointCoord - vec2(0.5, 0.5);',
157+
'float dist = radius - sqrt(m.x * m.x + m.y * m.y);',
158+
159+
'float t = 0.0;',
160+
'if (dist > border)',
161+
't = 1.0;',
162+
'else if (dist > 0.0)',
163+
't = dist / border;',
164+
165+
'gl_FragColor = mix(color0, color, t);',
153166
'}'
154167
].join('\n'),
155168
gl.FRAGMENT_SHADER

0 commit comments

Comments
 (0)