forked from google/swissgl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
95 lines (91 loc) · 3.66 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
92
93
94
95
<!DOCTYPE html>
<title>SwissGL demos</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="demo/style.css">
<script src='swissgl.js'></script>
<script src='audio.js'></script>
<script src="demo/dat.gui.min.js"> </script>
<script src='demo/NeuralCA.js'></script>
<script src='demo/BitField.js'></script>
<script src='demo/GameOfLife.js'></script>
<script src='demo/ParticleLife.js'></script>
<script src='demo/ParticleLenia.js'></script>
<script src='demo/FancyLenia.js'></script>
<script src='demo/Spectrogram.js'></script>
<script src='demo/Physarum.js'></script>
<script src='demo/SurfaceNormals.js'></script>
<script src='demo/MeshGrid.js'></script>
<script src='demo/CubeDeform.js'></script>
<script src='demo/ColorCube.js'></script>
<script src='demo/Shadowmap.js'></script>
<script src='demo/ParticleLife3d.js'></script>
<script src='demo/Torus4d.js'></script>
<script src='demo/DeferredShading.js'></script>
<script src='demo/Springs.js'></script>
<script src='demo/ReactionDiffusion.js'></script>
<script src='demo/DotCamera.js'></script>
<script src='demo/Physarum3d.js'></script>
<script src='demo/TextureSamplers.js'></script>
<script src='demo/LargeLenia.js'></script>
<script src='demo/FireflySync.js'></script>
<script src='demo/main.js'></script>
<details id="panel" open>
<summary><a href="https://github.com/google/swissgl">SwissGL</a> demos</summary>
<div id="cards"></div>
</details>
<div id="demo">
<canvas id="c" width="640" height="360"></canvas>
<div id="buttons">
<button title="VR" onclick="toggleVR()" id="vrButton">VR</button>
<button title="AR" onclick="toggleAR()" id="arButton">AR</button>
<button title="settings" onclick="toggleGui()" id="settingButton" style="font-size: 180%;">⛯</button>
<button title="source code"><a id='sourceLink' href="" target="_blank"><></a></button>
<button title="fullscreen" onclick="fullscreen()"">⛶</button>
</div>
</div>
<button title="about" id="aboutButton" onclick="showAbout()">?</button>
<div id="about">
<p>
<a href="https://github.com/google/swissgl"><b>SwissGL</b></a>
is a prototype of a minimal yet expressive GPU library built on
WebGL2. A single <nobr>"glsl()"</nobr> function runs GLSL code
snippets on the GPU and manages the resulting texture buffers.
</p>
<p>
This page contains a few demos built using the library. Click
the <nobr>"<>"</nobr> button to see the source of the current example.
</p>
<button style="font-size: 20px; margin: auto;" onclick="hideAbout()">hide</button>
</div>
<script>
'use strict';
const app = new DemoApp([
NeuralCA, DotCamera, MeshGrid, ParticleLife, ParticleLife3d, FireflySync, BitField, TextureSamplers, GameOfLife,
ParticleLenia, FancyLenia, LargeLenia, Spectrogram, Physarum, Physarum3d, SurfaceNormals, CubeDeform,
ColorCube, Shadowmap, Torus4d, DeferredShading, Springs, ReactionDiffusion,
]);
function fullscreen() {
app.fullscreen();
}
function toggleGui() {
app.toggleGui();
}
function toggleVR() {
app.toggleXR('vr');
}
function toggleAR() {
app.toggleXR('ar');
}
const showAbout = ()=>{$('#about').style.display = 'block';}
const hideAbout = ()=>{$('#about').style.display = 'none';}
//hideAbout();
$('#demo').addEventListener('pointerdown', ()=>{
hideAbout();
if (window.innerWidth < 500) {
// close menu on small screens
$('#panel').removeAttribute("open");
}
})
$('#panel').addEventListener('click', hideAbout);
</script>