-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
91 lines (87 loc) · 2.72 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
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>raytracing</title>
<style>
canvas {
border: 1px solid black;
}
pre {
background-color: rgb(211, 211, 211);
border-radius: 5px;
padding: 5px;
font-family: 'Courier New', Courier, monospace;
}
.color {
display: inline-block;
width: 12px;
height: 12px;
border: 1px solid black;
}
button {
background-color: lightgrey;
border: 0.5px solid dimgrey;
border-radius: 5px;
padding: 7px;
margin: 2px;
font-size: 12pt;
cursor: pointer;
}
button:hover {
background-color: rgb(185, 185, 185);
}
button:active {
background-color: rgb(149, 147, 153);
}
</style>
</head>
<body>
<h1>raytracing</h1>
<canvas tabindex="1" id="screen"></canvas>
<canvas id="debug-screen"></canvas>
<hr>
<details id="editor">
<summary>Material editor (WIP)</summary>
<p id="noTarget">No target is selected</p>
<input type="color" name="color" id="matColor">
<br>
<input type="color" name="emission color" id="matEmissionColor">
<br>
<input type="range" name="emission strength" id="matEmissionStrength" min="0" max="5" step="0.01">
</details>
<hr>
<button onclick="draw()">draw</button>
<button onclick="clearInterval(sampleInterval)">STOP!!</button>
<br>
<button onclick="alert('data: '+cam.saveCam())">save camera data</button>
<button onclick="cam.loadCam(prompt('data:').trim());draw()">load camera data</button>
<br>
<button onclick="cam.fov+=10;draw()">fov+</button>
<button onclick="cam.fov-=10;draw()">fov-</button>
<pre id="debug"></pre>
<script>
// let oldSin=Math.sin;
// let oldCos=Math.cos;
// Math.sin=Math.tanh;
// Math.cos=Math.sinh;
// Math.tan=Math.cosh;
</script>
<script src="math.js"></script>
<script src="vector.js"></script>
<script src="transform.js"></script>
<script src="camera.js"></script>
<script src="ray.js"></script>
<script src="consts.js"></script>
<script src="material.js"></script>
<script src="objects.js"></script>
<script src="scene.js"></script>
<script src="gfx.js"></script>
<script src="mouse.js"></script>
<script src="debug.js"></script>
<script src="index.js"></script>
<script src="editor.js"></script>
</body>
</html>