-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraytrace.html
61 lines (58 loc) · 2.02 KB
/
raytrace.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
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="renderer.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/controls.js"></script>
<script type="text/javascript" charset="utf-8" src="lib/gl-matrix-min.js"></script>
<style type="text/css">
body {text-align: center;}
table {margin:0 auto;}
table td, th {text-align: left;padding:2px 10px;}
table th {text-align: right;}
canvas {border: 2px solid black;}
input {width:160px;}
div{float: right;}
</style>
</head>
<body>
<canvas id="canvas"></canvas>
<div>
<h3>Controls</h3>
<table>
<tr>
<th>Left Mouse:</th><td>Pan</td>
</tr><tr>
<th>Right Mouse:</th><td>Rotate</td>
</tr><tr>
<th>Spacebar:</th><td>Reset Cam Position</td>
</tr><tr>
<th>Resolution:</th><td><button onclick="renderer.updateSize(600,600);">600x600</button> <button onclick="renderer.updateSize(600,1200);">1200x600</button></td>
</tr><tr>
<th>Focal Length:</th><td><input id="iFocalLength" type="number" oninput="renderer.update();"/></td>
</tr><tr>
<th>Epsilon:</th><td><input id="iEpsilon" type="number" oninput="renderer.update();"/></td>
</tr><tr>
<th colspan="2"><button onclick="renderer.resetCameraParameters();">Reset Cam Parameters</button></th>
</tr>
</table>
</div>
<script id="vertexShader" type="x-shader/x-vertex">
attribute vec2 aVertexPosition;
varying vec2 vPixelCoord;
void main(void) {
gl_Position = vec4(aVertexPosition, 0, 1);
}
</script>
<script type="text/javascript">
// Create Renderer Object
var renderer = new Renderer(
document.getElementById('canvas'), // Canvas element
600, // height
1200, // width
document.getElementById('iFocalLength'), // FocalLength input element
document.getElementById('iEpsilon') // Epsilon input element
);
</script>
</body>
</html>