-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
42 lines (39 loc) · 1.25 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<title>SwarmSim 2016</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<canvas id="swarm-canvas"></canvas>
<script src="gl-matrix.js" type="text/javascript"></script>
<script src="script.js" type="text/javascript"></script>
<script id="shader-frag" type="x-shader/x-fragment">
precision mediump float;
void main(void) {
float r = 0.0, delta = 0.0, alpha = 1.0;
vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
vec2 cxy = 2.0 * gl_PointCoord - 1.0;
r = dot(cxy, cxy);
if (r > 1.0) {
discard;
}
gl_FragColor = color * (alpha);
}
</script>
<script id="shader-vert" type="x-shader/x-vertex">
attribute vec2 a_Position;
uniform vec2 u_Resolution;
uniform float u_PointSize;
void main(void) {
vec2 zeroToOne = a_Position / u_Resolution;
vec2 zeroToTwo = zeroToOne * 2.0;
vec2 clipSpace = zeroToTwo - 1.0;
gl_PointSize = u_PointSize;
gl_Position = vec4(clipSpace, 0, 1);
}
</script>
</body>
</html>