-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
55 lines (45 loc) · 1.48 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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Cubes vertex/pixel shaders</title>
<link rel="stylesheet" href="css/style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/three.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/scene.js"></script>
<script type="text/javascript" src="js/camera.js"></script>
<script type="text/javascript" src="js/cube.js"></script>
<script type="text/javascript" src="js/light.js"></script>
<script type="text/javascript" src="js/engine.js"></script>
<script type="text/javascript" src="lib/OrbitControls.js"></script>
</head>
<body>
<script id="vertexShader" type="x-shader/x-vertex">
uniform float amplitude;
attribute vec3 displacement;
varying vec3 vNormal;
void main(){
vNormal = normal;
vec3 newPosition = position+ vec3(displacement * amplitude);
gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );
}
</script>
<script id="fragmentShader" type="x-shader/x-fragment">
// same name and type as VS
varying vec3 vNormal;
void main() {
vec3 light = vec3(0.5, 0.2, 1.0);
light = normalize(light);
float dProd = max(0.0,dot(vNormal, light));
gl_FragColor = vec4(dProd, // R
dProd, // G
dProd, // B
1.0); // A
}
</script>
<script>
app.init();
</script>
</body>
</html>