BlueGit

timfa raytracer

Files

raytracer / build / editor.html

editor.html

editor.html 5.0 KiB Download Raw
1<!DOCTYPE html>
2<html lang="nl">
3<head>
4<meta charset="utf-8">
5<title>Raytracer level-editor</title>
6<style>
7 body { margin: 0; font: 14px/1.4 system-ui, sans-serif; background: #1a1a1e; color: #eee; display: flex; height: 100vh; }
8 aside { width: 280px; padding: 12px; overflow: auto; border-right: 1px solid #333; background: #121216; }
9 main { flex: 1; overflow: auto; padding: 12px; }
10 h1 { font-size: 16px; margin: 0 0 12px; }
11 h2 { font-size: 13px; margin: 16px 0 6px; color: #aaa; text-transform: uppercase; letter-spacing: .04em; }
12 button, select, input { font: inherit; margin: 2px 0; }
13 button { background: #2a2a32; color: #eee; border: 1px solid #555; padding: 4px 8px; cursor: pointer; border-radius: 4px; }
14 button.active, button:hover { background: #3a5a8a; }
15 .row { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
16 #grid { image-rendering: pixelated; background: #000; cursor: crosshair; }
17 .swatch { width: 36px; height: 36px; border: 2px solid #444; padding: 0; background-size: cover; }
18 .swatch.active { border-color: #8af; }
19 ul { list-style: none; padding: 0; margin: 0; }
20 li { padding: 4px 6px; border-radius: 3px; }
21 a { color: #9cf; }
22</style>
23</head>
24<body>
25<aside>
26 <h1>Level-editor</h1>
27 <div class="row"><a href="index.html">← Spel</a></div>
28 <h2>Levels</h2>
29 <select id="level-select" style="width:100%"></select>
30 <div class="row">
31 <button type="button" id="btn-add-level">+</button>
32 <button type="button" id="btn-dup-level">Dupliceer</button>
33 <button type="button" id="btn-del-level">Verwijder</button>
34 </div>
35 <label>Naam <input id="level-name" style="width:100%"></label>
36 <div class="row">
37 W <input id="level-w" type="number" min="3" max="128" style="width:4em">
38 H <input id="level-h" type="number" min="3" max="128" style="width:4em">
39 <button type="button" id="btn-resize">Resize</button>
40 </div>
41 <h2>Gereedschap</h2>
42 <div class="row">
43 <button type="button" data-tool="wall" class="active">Muur</button>
44 <button type="button" data-tool="floor">Vloer</button>
45 <button type="button" data-tool="ceiling">Plafond</button>
46 <button type="button" data-tool="spawn">Spawn</button>
47 <button type="button" data-tool="npc">NPC</button>
48 <button type="button" data-tool="light">Lamp</button>
49 </div>
50 <h2>Muurtypes</h2>
51 <div class="row">
52 <button type="button" data-wall="0">Leeg</button>
53 <button type="button" data-wall="1" class="swatch" style="background-image:url(images/stone.png)" title="stone"></button>
54 <button type="button" data-wall="3" class="swatch" style="background-image:url(images/wood.png)" title="wood"></button>
55 <button type="button" data-wall="2">Finish</button>
56 </div>
57 <h2>Textuur (vloer/plafond)</h2>
58 <div class="row">
59 <button type="button" data-tex="none">Geen</button>
60 <button type="button" data-tex="stone" class="swatch" style="background-image:url(images/stone.png)"></button>
61 <button type="button" data-tex="wood" class="swatch" style="background-image:url(images/wood.png)"></button>
62 </div>
63 <h2>Spawn / NPC</h2>
64 <label>Spawn yaw ° <input id="spawn-yaw" type="number" value="0" style="width:5em"></label>
65 <label>NPC yaw ° <input id="npc-yaw" type="number" value="180" style="width:5em"></label>
66 <label>Clip
67 <select id="npc-clip"><option>walk</option><option>attack</option></select>
68 </label>
69 <label><input type="checkbox" id="npc-anim" checked> Animeren</label>
70 <button type="button" id="btn-del-npc">Verwijder NPC</button>
71 <ul id="npc-list"></ul>
72 <h2>Ambient / lampen</h2>
73 <label>Ambient <input id="level-ambient" type="number" min="0" max="1" step="0.05" value="0.38" style="width:5em"></label>
74 <div class="row">
75 Z <input id="light-z" type="number" value="20" style="width:3.5em">
76 I <input id="light-intensity" type="number" value="1.2" step="0.1" style="width:3.5em">
77 R <input id="light-range" type="number" value="96" style="width:4em">
78 </div>
79 <div class="row">
80 RGB
81 <input id="light-cr" type="number" min="0" max="1" step="0.05" value="1" style="width:3.2em">
82 <input id="light-cg" type="number" min="0" max="1" step="0.05" value="0.9" style="width:3.2em">
83 <input id="light-cb" type="number" min="0" max="1" step="0.05" value="0.7" style="width:3.2em">
84 </div>
85 <button type="button" id="btn-del-light">Verwijder lamp</button>
86 <ul id="light-list"></ul>
87 <h2>Bestand</h2>
88 <div class="row">
89 <button type="button" id="btn-download">Download JSON</button>
90 <label class="button">Upload <input type="file" id="file-upload" accept="application/json,.json" style="display:none"></label>
91 </div>
92 <div class="row">
93 <button type="button" id="btn-play">Speel dit level</button>
94 <button type="button" id="btn-reload-repo">Herlaad repo</button>
95 </div>
96 <p style="color:#888;font-size:12px">Opslag ook in localStorage. Lights-lijst staat klaar in het formaat (nog niet bewerkbaar).</p>
97</aside>
98<main>
99 <canvas id="grid"></canvas>
100</main>
101<script src="editor.js"></script>
102<script>EditorApp.start();</script>
103</body>
104</html>