cg1-visualisations/src/index.html

143 lines
2.8 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>CG1 MDI</title>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<script src="matrix-math.js"></script>
<script src="shader.js"></script>
<script src="script.js"></script>
<style>
:root {
font-size: 20px;
}
html, body {
margin: 0;
height: 100%;
}
body {
padding: 1vw;
box-sizing: border-box;
background-color: #1e1e2e;
color: #cdd6f4;
font-family: monospace;
overflow: hidden;
}
#display {
position: relative;
overflow: hidden;
box-sizing: border-box;
border-radius: 20px;
height: 100%;
width: 100%;
border: solid 2px #11111b;
}
#cv {
position: relative;
max-width: 100%;
max-height: 100%;
width: 100%;
height: 100%;
display: block;
background-color: #181825;
}
#stats, #controls {
position: absolute;
top: 20px;
padding: 20px;
display: block;
border: solid 2px #11111b;
background-color: #31324480;
border-radius: 20px;
}
#stats {
right: 20px;
}
#controls {
left: 20px;
}
#interpolate {
width: 100%;
}
</style>
</head>
<body>
<div id="display">
<canvas id="cv"></canvas>
<div id="stats">
<div>
FPS: <span id="fps"></span> - <span id="ms"></span>
</div>
<div>
Use virtual camera: <input type="checkbox" id="displayMatricesVirtually" checked autocomplete="off">
</div>
<div>
Backface Culling: <input type="checkbox" id="backfaceCulling" autocomplete="off">
</div>
</div>
<div id="controls">
<div>
$$
\color{red}
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & -1 & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
\frac{2}{r-l} & 0 & 0 & 0 \\
0 & \frac{2}{t-b} & 0 & 0 \\
0 & 0 & \frac{2}{f-n} & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
1 & 0 & 0 & - \frac{r+l}{2} \\
0 & 1 & 0 & - \frac{t+b}{2} \\
0 & 0 & 1 & \frac{n+f}{2} \\
0 & 0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
1 & 0 & 0 & 0 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 + \frac{f}{n} & f \\
0 & 0 & - \frac{1}{n} & 0
\end{pmatrix}
\color{green}
\begin{pmatrix}
u_x & u_y & u_z & 0 \\
v_x & v_y & v_z & 0 \\
n_x & n_y & n_z & 0 \\
0 & 0 & 0 & 1
\end{pmatrix}
\begin{pmatrix}
1 & 0 & 0 & -e_x \\
0 & 1 & 0 & -e_y \\
0 & 0 & 1 & -e_z \\
0 & 0 & 0 & 1
\end{pmatrix}
$$
<input id="interpolate" type="range" min="0" max="6" step="0.05" value="6" autocomplete="off" list="steplist">
<datalist id="steplist">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</datalist>
</div>
<div>
</div>
</div>
</div>
</body>
</html>