-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
79 lines (64 loc) · 2.75 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<title>Chaos Equations | Saggre</title>
<link href="https://fonts.googleapis.com/css?family=Karla|Montserrat&display=swap" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/style.css"/>
</head>
<body>
<div class="chaos-ui">
<span class="chaos-ui--text" id="chaos-ui--x-equation"></span>
<span class="chaos-ui--text" id="chaos-ui--y-equation"></span>
<span class="chaos-ui--text" id="chaos-ui--time"></span>
<span class="chaos-ui--text" id="chaos-ui--code"></span>
</div>
<script id="vertexShader" type="x-shader/x-vertex">
varying vec3 vColor;
uniform float iters;
uniform float steps;
uniform mat3 px;
uniform mat3 py;
uniform float cpuTime;
uniform float deltaTime;
uniform float pixelRatio;
uniform sampler2D colorTexture;
const int MAX_ITERATIONS = 2048;
void main() {
int thisIter = int(position.x);
float t = cpuTime + deltaTime * position.y;
vec3 pos = vec3(t, t, t);
for (int iter = 0; iter < MAX_ITERATIONS; iter++) {
if (iter > thisIter){
break;
}
vec3 xxyytt = pos * pos; // x*x, y*y, t*t combinations
vec3 xyxzyz = pos.xxy * pos.yzz; // x*y, x*z, y*z combinations
pos.xy = vec2(
xxyytt.x * px[0][0] + xxyytt.y * px[1][0] + xxyytt.z * px[2][0] + xyxzyz.x * px[0][1] + xyxzyz.y * px[1][1] + xyxzyz.z * px[2][1] + pos.x * px[0][2] + pos.y * px[1][2] + pos.z * px[2][2],
xxyytt.x * py[0][0] + xxyytt.y * py[1][0] + xxyytt.z * py[2][0] + xyxzyz.x * py[0][1] + xyxzyz.y * py[1][1] + xyxzyz.z * py[2][1] + pos.x * py[0][2] + pos.y * py[1][2] + pos.z * py[2][2]
);
}
gl_PointSize = 1.8 * pixelRatio;
vec4 modelViewPosition = modelViewMatrix * vec4(pos.xy, 0., 1.);
gl_Position = projectionMatrix * modelViewPosition;
if (position.x > 1.0 && position.y > 1.0){
vColor = texture2D(colorTexture, position.xy / vec2(iters, steps)).rgb;
} else {
vColor = vec3(1., 1., 1.);
}
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
varying vec3 vColor;
void main() {
gl_FragColor = vec4(vColor, 1.);
}
</script>
<script src="js/three.min.js" type="text/javascript"></script>
<script src="js/dat.gui.min.js" type="text/javascript"></script>
<script src="js/chanse.min.js" type="text/javascript"></script>
<script src="js/stats.min.js" type="text/javascript"></script>
<script src="js/chaos.js" type="text/javascript"></script>
</body>
</html>