-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
72 lines (62 loc) · 1.56 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
<!DOCTYPE html>
<html>
<head>
<title>Jundo</title>
<script id="fragment-shader" type="x-shader/x-fragment">
precision mediump float;
varying vec3 transformedNormal;
uniform vec3 materialColour;
uniform vec3 ambientColour;
uniform vec3 directionalColour;
uniform vec3 lightingDirection;
void main(void) {
float directionalCoefficient = max(-dot(transformedNormal, lightingDirection), 0.0);
gl_FragColor = vec4((ambientColour + directionalCoefficient * directionalColour) * materialColour, 1.0);
}
</script>
<script id="vertex-shader" type="x-shader/x-vertex">
attribute vec3 vertexPosition;
attribute vec3 vertexColour;
attribute vec3 vertexNormal;
varying vec3 transformedNormal;
uniform mat4 mvMatrix;
uniform mat4 pMatrix;
uniform mat4 nMatrix;
void main(void) {
transformedNormal = normalize(vec3(nMatrix * vec4(vertexNormal, 0.0)));
gl_Position = pMatrix * mvMatrix * vec4(vertexPosition, 1.0);
}
</script>
<script defer src="app.js"></script>
<style>
html, body {
padding: 0;
margin: 0;
overflow: hidden;
height: 100%;
width: 100%;
}
#easel {
height: 100%;
width: 100%;
}
.clickable {
cursor: pointer;
}
.no-select {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.no-tap-highlight {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
}
</style>
</head>
<body>
<canvas id="easel" class="clickable no-select no-tap-highlight"></canvas>
</body>
</html>