-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (70 loc) · 2.16 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<div class="outer">
<div id="container" class="container">
<canvas class="canvas" id="cnvs" width="640" height="640"></canvas>
</div>
<div class="controls">
<form class="form">
<fieldset class="fieldset">
<legend>Maze Parameters</legend>
<p>
<label for="maze_width">Width</label>
<input id="maze_width" type="text" value="30" />
</p>
<p>
<label for="maze_height">Height</label>
<input id="maze_height" type="text" value="30" />
</p>
<p>
<label for="maze_seed">Seed</label>
<input id="maze_seed" type="text" value="1" />
</p>
<p>
<input id="maze_animate" type="checkbox" checked="checked" />
<label for="maze_animate">Animate?</label>
</p>
</fieldset>
<input id="generate" type="button" value="Generate Maze"/>
<input id="solve" type="button" value="Solve Maze" />
</form>
</div>
</div>
<script id="2d-vertex-shader" type="x-shader/x-vertex">
attribute vec2 a_position;
attribute vec2 a_texCoord;
uniform vec2 u_resolution;
varying vec2 v_texCoord;
void main() {
// convert the rectangle from pixels to 0.0 to 1.0
vec2 zeroToOne = a_position / u_resolution;
// convert from 0->1 to 0->2
vec2 zeroToTwo = zeroToOne * 2.0;
// convert from 0->2 to -1->+1 (clipspace)
vec2 clipSpace = zeroToTwo - 1.0;
gl_Position = vec4(clipSpace * vec2(1, -1), 0, 1);
// pass the texCoord to the fragment shader
// The GPU will interpolate this value between points.
v_texCoord = a_texCoord;
}
</script>
<script id="2d-fragment-shader" type="x-shader/x-fragment">
precision mediump float;
// our texture
uniform sampler2D u_image;
// the texCoords passed in from the vertex shader.
varying vec2 v_texCoord;
void main() {
gl_FragColor = texture2D(u_image, v_texCoord);
}
</script>
<script src="resources/webgl-utils.js"></script>
<script src="js/main.js"></script>
</body>
</html>