2Btainment commited on
Commit
9591b1d
·
verified ·
1 Parent(s): 2243bf9

STUDIUS v2: premium HUD design, SVG icon set, bloom, smooth camera focus, cinematic intro, minimap

Browse files
.gitattributes CHANGED
@@ -33,5 +33,3 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
- assets/einswarm-logo.webp filter=lfs diff=lfs merge=lfs -text
37
- assets/retro82-bg.webp filter=lfs diff=lfs merge=lfs -text
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
app.js CHANGED
@@ -1,5 +1,10 @@
1
  import * as THREE from './vendor/three.module.min.js';
2
- import { STUDIOS, stopLoops } from './widgets.js?v=2';
 
 
 
 
 
3
 
4
  const $ = (s) => document.querySelector(s);
5
  const isMobile = matchMedia('(pointer:coarse)').matches || innerWidth < 700;
@@ -16,39 +21,44 @@ function beep(f = 440, d = .06, type = 'square', v = .04) {
16
  o.connect(g).connect(ac.destination); o.start(); o.stop(ac.currentTime + d);
17
  } catch (e) {}
18
  }
19
- function toggleSound() { soundOn = !soundOn; $('#snd').textContent = soundOn ? '🔊' : '🔇'; beep(880, .1); }
20
- $('#snd').onclick = toggleSound;
21
 
22
  /* ---------- three setup ---------- */
23
- let renderer = null, gl3d = true;
24
  try {
25
  renderer = new THREE.WebGLRenderer({ canvas: $('#gl'), antialias: !isMobile, powerPreference: 'high-performance' });
26
  } catch (e) { gl3d = false; console.warn('WebGL unavailable, 2D fallback'); }
 
27
  const scene = new THREE.Scene(); scene.fog = new THREE.FogExp2(0x020c17, 0.028);
28
  const camera = new THREE.PerspectiveCamera(55, innerWidth / innerHeight, .1, 200);
29
- const cam = { r: isMobile ? 26 : 21, th: 0.4, ph: 1.15, tr: 21, tth: .4, tph: 1.15 };
30
  function applyQuality() {
31
  if (!renderer) return;
32
  renderer.setPixelRatio(quality === 'high' ? Math.min(devicePixelRatio, 2) : Math.min(devicePixelRatio, 1));
33
  renderer.setSize(innerWidth, innerHeight, false);
 
34
  if (swarm) swarm.count = quality === 'high' ? SW_MAX : SW_MAX / 3 | 0;
35
  if (dust) dust.geometry.setDrawRange(0, quality === 'high' ? DUST : DUST / 3 | 0);
36
  $('#q').textContent = 'Q:' + (qMode === 'AUTO' ? 'AUTO·' + quality[0].toUpperCase() : quality.toUpperCase());
37
  }
 
 
38
  scene.add(new THREE.AmbientLight(0x334455, 1.2));
39
  const coreLight = new THREE.PointLight(GOLD, 60, 40, 1.6); scene.add(coreLight);
 
40
  const rim = new THREE.DirectionalLight(ORANGE, 1.2); rim.position.set(-10, 8, -6); scene.add(rim);
41
 
42
  /* core */
43
  const core = new THREE.Group(); scene.add(core);
44
- const coreMat = new THREE.MeshStandardMaterial({ color: 0x1a1205, emissive: GOLD, emissiveIntensity: 1.2, metalness: .9, roughness: .25, flatShading: true });
45
  const coreMesh = new THREE.Mesh(new THREE.IcosahedronGeometry(2.2, 1), coreMat); core.add(coreMesh);
46
  const shell = new THREE.Mesh(new THREE.IcosahedronGeometry(3.1, 1), new THREE.MeshBasicMaterial({ color: ORANGE, wireframe: true, transparent: true, opacity: .35 })); core.add(shell);
47
- const shell2 = new THREE.Mesh(new THREE.IcosahedronGeometry(3.8, 2), new THREE.MeshBasicMaterial({ color: TEAL, wireframe: true, transparent: true, opacity: .12 })); core.add(shell2);
48
  const glowTex = (() => { const c = document.createElement('canvas'); c.width = c.height = 128; const x = c.getContext('2d'); const g = x.createRadialGradient(64, 64, 0, 64, 64, 64); g.addColorStop(0, 'rgba(255,230,150,1)'); g.addColorStop(.3, 'rgba(242,201,76,.5)'); g.addColorStop(1, 'rgba(0,0,0,0)'); x.fillStyle = g; x.fillRect(0, 0, 128, 128); return new THREE.CanvasTexture(c); })();
49
  const glow = new THREE.Sprite(new THREE.SpriteMaterial({ map: glowTex, blending: THREE.AdditiveBlending, depthWrite: false, transparent: true })); glow.scale.set(14, 14, 1); core.add(glow);
50
  // orbit rings
51
- for (let i = 0; i < 3; i++) { const ring = new THREE.Mesh(new THREE.TorusGeometry(5 + i * 1.1, .025, 6, 120), new THREE.MeshBasicMaterial({ color: [GOLD, ORANGE, CYAN][i], transparent: true, opacity: .5 })); ring.rotation.x = Math.PI / 2 + i * .35; ring.rotation.y = i * .6; ring.userData.spin = .2 + i * .15; core.add(ring); }
52
  // hex floor grid
53
  {
54
  const pts = []; const R = .9, W = R * Math.sqrt(3);
@@ -57,22 +67,22 @@ for (let i = 0; i < 3; i++) { const ring = new THREE.Mesh(new THREE.TorusGeometr
57
  for (let k = 0; k < 6; k++) { const a = Math.PI / 6 + k * Math.PI / 3, b = a + Math.PI / 3; pts.push(cx + R * Math.cos(a), 0, cz + R * Math.sin(a), cx + R * Math.cos(b), 0, cz + R * Math.sin(b)); }
58
  }
59
  const g = new THREE.BufferGeometry(); g.setAttribute('position', new THREE.Float32BufferAttribute(pts, 3));
60
- const floor = new THREE.LineSegments(g, new THREE.LineBasicMaterial({ color: 0xd4a63a, transparent: true, opacity: .22 })); floor.position.y = -6; scene.add(floor);
61
  }
62
  // hex swarm (instanced)
63
- const SW_MAX = isMobile ? 360 : 900;
64
- const hexGeo = new THREE.CylinderGeometry(.16, .16, .06, 6);
65
  const swarm = new THREE.InstancedMesh(hexGeo, new THREE.MeshStandardMaterial({ color: GOLD, emissive: 0x6b4a10, metalness: .8, roughness: .3 }), SW_MAX);
66
  const swData = [...Array(SW_MAX)].map(() => ({ r: 4.5 + Math.random() * 9, a: Math.random() * 6.28, y: (Math.random() - .5) * 7, s: (.1 + Math.random() * .4) * (Math.random() < .5 ? -1 : 1), w: Math.random() * 6 }));
67
  const tmp = new THREE.Object3D(), tmpC = new THREE.Color();
68
- swData.forEach((d, i) => swarm.setColorAt(i, tmpC.set([GOLD, ORANGE, GOLD, CYAN][i % 4])));
69
  scene.add(swarm);
70
  // dust / burst particles
71
  const DUST = isMobile ? 1500 : 4000;
72
  const dpos = new Float32Array(DUST * 3), dvel = new Float32Array(DUST * 3);
73
  for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(10 + Math.random() * 40); dpos.set([v.x, v.y, v.z], i * 3); }
74
  const dGeo = new THREE.BufferGeometry(); dGeo.setAttribute('position', new THREE.BufferAttribute(dpos, 3));
75
- const dust = new THREE.Points(dGeo, new THREE.PointsMaterial({ color: ORANGE, size: .09, transparent: true, opacity: .8, blending: THREE.AdditiveBlending, depthWrite: false })); scene.add(dust);
76
  function burst() { for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(.3 + Math.random() * 1.2); dpos.set([0, 0, 0], i * 3); dvel.set([v.x, v.y, v.z], i * 3); } bursting = 1; }
77
  let bursting = 0;
78
 
@@ -82,9 +92,9 @@ const nodes = []; const nodeGeo = new THREE.CylinderGeometry(.75, .75, .35, 6);
82
  const streamPts = [];
83
  STUDIOS.forEach((s, i) => {
84
  const a = i / STUDIOS.length * Math.PI * 2, R = 10 + (i % 2) * 1.6;
85
- const col = s.id === 'merge' ? RED : [GOLD, ORANGE, CYAN, TEAL][CATS.indexOf(s.cat) % 4];
86
  const m = new THREE.Mesh(nodeGeo, new THREE.MeshStandardMaterial({ color: 0x0a0a0a, emissive: col, emissiveIntensity: .45, metalness: .9, roughness: .3 }));
87
- const edge = new THREE.LineSegments(new THREE.EdgesGeometry(nodeGeo), new THREE.LineBasicMaterial({ color: GOLD })); m.add(edge);
88
  m.rotation.x = Math.PI / 2; m.userData = { s, a, R, y: Math.sin(i * 1.7) * 2.2, i, col };
89
  scene.add(m); nodes.push(m);
90
  // data stream line node→core
@@ -101,21 +111,25 @@ const cats = $('#cats');
101
  CATS.forEach(c => { const b = document.createElement('button'); b.textContent = c.toUpperCase(); b.onclick = () => setCat(c); cats.append(b); });
102
  function setCat(c) { cat = c; [...cats.children].forEach(b => b.classList.toggle('on', b.textContent === c.toUpperCase())); beep(520); const v = visible(); if (!v.includes(sel)) select(v[0]); }
103
  function visible() { return nodes.map((n, i) => i).filter(i => cat === 'Alle' || nodes[i].userData.s.cat === cat || nodes[i].userData.s.id === 'merge'); }
104
- const labels = STUDIOS.map((s, i) => { const d = document.createElement('div'); d.className = 'lbl'; d.innerHTML = `<i>${s.icon}</i>${s.name}`; d.title = s.cat + ' · ' + s.like;
105
  d.onmouseenter = () => select(i); d.onclick = (e) => { e.stopPropagation(); select(i); open(i); }; $('#labels').append(d); return d; });
106
  function select(i) { if (i == null) return; if (sel !== i) beep(660, .03); sel = i; labels.forEach((l, k) => l.classList.toggle('sel', k === i)); }
107
  const pop = $('#pop');
108
  function open(i) {
109
  stopLoops(); openId = i; const s = STUDIOS[i]; beep(990, .08, 'triangle');
110
- pop.innerHTML = `<div class="ph">${s.icon} ${s.name.toUpperCase()}<small>${s.cat} · ${s.like}</small><button aria-label="schließen">✕</button></div><div class="pb"></div>`;
 
111
  pop.hidden = false; pop.querySelector('.ph button').onclick = close; s.build(pop.querySelector('.pb')); placePop(); $('#wire').classList.add('on');
112
  }
113
- function close() { stopLoops(); openId = null; pop.hidden = true; $('#wire').classList.remove('on'); beep(300); }
114
  function placePop() {
115
  if (openId == null || isMobile && innerWidth < 700) return; const p = screenPos(nodes[openId]);
116
  const W = pop.offsetWidth, H = pop.offsetHeight; let x = p.x + (p.x < innerWidth / 2 ? 90 : -90 - W), y = Math.max(60, Math.min(innerHeight - H - 50, p.y - H / 2));
117
  pop.style.left = x + 'px'; pop.style.top = y + 'px';
118
  }
 
 
 
119
  function screenPos(o) { const v = o.getWorldPosition(new THREE.Vector3()).project(camera); return { x: (v.x + 1) / 2 * innerWidth, y: (1 - v.y) / 2 * innerHeight, z: v.z }; }
120
  window.addEventListener('studius-merge', () => { burst(); beep(200, .3, 'sawtooth'); });
121
 
@@ -162,15 +176,15 @@ const BOOT = [
162
  async function bootSeq() {
163
  const pre = $('#boot');
164
  for (const [t, s] of BOOT) { if (started) return; const line = document.createElement('div'); pre.append(line);
165
- for (let i = 0; i <= t.length; i += 3) { if (started) return; line.textContent = t.slice(0, i); await new Promise(r => setTimeout(r, 8)); }
166
- line.innerHTML = t.replace(/</g, '&lt;') + (s ? ` <span class="${s}">[${s === 'w' ? ' WARN ' : ' OK '}]</span>` : ''); beep(1200, .015); await new Promise(r => setTimeout(r, 110)); }
167
- $('#reveal').classList.add('on'); beep(220, .4, 'sawtooth', .05);
168
- setTimeout(() => $('#press').classList.add('on'), 900);
169
  }
170
  function start() {
171
  if (started) return; started = true; beep(110, .5, 'sawtooth', .08); burst();
172
  $('#intro').classList.add('gone'); setTimeout(() => $('#intro').remove(), 1000);
173
- ['#hud', '#hint', '#core-stats'].forEach(s => $(s).hidden = false); cam.tr = isMobile ? 26 : 21; setCat('Alle'); select(0);
174
  }
175
  $('#skip').onclick = (e) => { e.stopPropagation(); start(); };
176
  $('#intro').addEventListener('pointerdown', (e) => { if (e.target.id !== 'skip') start(); });
@@ -178,7 +192,11 @@ cam.r = 60; cam.tr = 40;
178
  bootSeq();
179
 
180
  /* ---------- loop ---------- */
181
- const clock = new THREE.Clock(); let frames = 0, fpsT = 0, lowStreak = 0, statT = 0;
 
 
 
 
182
  const stats = $('#core-stats');
183
  function frame() {
184
  requestAnimationFrame(frame);
@@ -187,16 +205,17 @@ function frame() {
187
  if (qMode === 'AUTO' && quality === 'high') { lowStreak = fps < 40 ? lowStreak + 1 : 0; if (lowStreak >= 3) { quality = 'low'; applyQuality(); } } }
188
  pollPad();
189
  // camera (intro: slow fly; mouse parallax)
190
- cam.th += (cam.tth - cam.th) * .06 + (started ? dt * .03 : dt * .15); cam.tth += started ? dt * .03 : dt * .15;
191
- cam.ph += (cam.tph - cam.ph) * .06; cam.r += (cam.tr - cam.r) * .04;
 
192
  const mx = mouse.x < 5 ? mouse.x : 0, my = mouse.y < 5 ? mouse.y : 0;
193
  camera.position.set(cam.r * Math.sin(cam.ph) * Math.cos(cam.th) + mx * 1.5, cam.r * Math.cos(cam.ph) + my * 1.5, cam.r * Math.sin(cam.ph) * Math.sin(cam.th)); camera.lookAt(0, 0, 0);
194
  // core pulse
195
  const pulse = 1 + Math.sin(t * 2.4) * .06 + (bursting * .5);
196
- coreMesh.scale.setScalar(pulse); coreMesh.rotation.y += dt * .4; coreMesh.rotation.x += dt * .15; coreMat.emissiveIntensity = 1 + Math.sin(t * 2.4) * .4;
197
- shell.rotation.y -= dt * .25; shell2.rotation.x += dt * .1; glow.scale.setScalar(12 + Math.sin(t * 2.4) * 1.5 + bursting * 10);
198
  core.children.forEach(c => { if (c.userData.spin) c.rotation.z += dt * c.userData.spin; });
199
- coreLight.intensity = 50 + Math.sin(t * 2.4) * 15;
200
  // swarm
201
  const sc = swarm.count;
202
  for (let i = 0; i < sc; i++) { const d = swData[i]; d.a += d.s * dt * (1 + bursting * 4);
@@ -209,22 +228,30 @@ function frame() {
209
  dust.rotation.y += dt * .02;
210
  // nodes
211
  const v = visible();
212
- nodes.forEach((n, i) => { const u = n.userData; const a = u.a + t * .04; n.position.set(Math.cos(a) * u.R, u.y + Math.sin(t + i) * .3, Math.sin(a) * u.R);
213
  n.rotation.z += dt * (i === sel ? 1.5 : .3); const on = v.includes(i); const s = (i === sel ? 1.35 : 1) * (on ? 1 : .6); n.scale.lerp(new THREE.Vector3(s, s, s), .15);
214
- n.material.emissiveIntensity = i === sel ? 1.2 + Math.sin(t * 6) * .3 : on ? .45 : .1;
215
  const p = u.line.geometry.attributes.position; p.setXYZ(1, n.position.x, n.position.y, n.position.z); p.needsUpdate = true; u.line.material.opacity = on ? (i === sel ? .8 : .25) : .05; });
216
  streamPts.forEach((s, k) => { s.t = (s.t + dt * .35) % 1; const p = s.n.position; spPos[k * 3] = p.x * (1 - s.t); spPos[k * 3 + 1] = p.y * (1 - s.t); spPos[k * 3 + 2] = p.z * (1 - s.t); });
217
  spGeo.attributes.position.needsUpdate = true;
218
  // hover raycast
219
  if (started && !drag && mouse.x < 5) { ray.setFromCamera(mouse, camera); const h = ray.intersectObjects(nodes, false)[0]; cv.style.cursor = h ? 'pointer' : 'grab'; if (h && h.object.userData.i !== sel) select(h.object.userData.i); }
220
- if (renderer) renderer.render(scene, camera);
221
  // labels + wire
222
  if (started) {
223
- nodes.forEach((n, i) => { const p = screenPos(n); const l = labels[i]; l.style.display = p.z < 1 ? '' : 'none'; l.style.left = p.x + 'px'; l.style.top = (p.y + 30) + 'px'; l.classList.toggle('dim', !v.includes(i)); });
 
 
 
 
 
 
 
 
224
  if (openId != null && !pop.hidden) { const p = screenPos(nodes[openId]); const r = pop.getBoundingClientRect(); const wl = $('#wl');
225
  const tx = p.x < r.left ? r.left : r.right; wl.setAttribute('x1', p.x); wl.setAttribute('y1', p.y); wl.setAttribute('x2', tx); wl.setAttribute('y2', r.top + 14);
226
  }
227
- if ((statT += dt) > .5) { statT = 0; stats.innerHTML = `<b>META-ENGINE CORE</b><br>Agenten: ${120 + (Math.sin(t) * 8 | 0)} aktiv<br>Tokens/s: ${(4200 + Math.random() * 900) | 0}<br>Studios: ${STUDIOS.length - 1} + merge<br>Last: ${(55 + Math.sin(t * .7) * 20) | 0}% · <span style="color:#028391">SIMULATION</span>`; }
228
  }
229
  }
230
  applyQuality();
@@ -232,6 +259,6 @@ if (gl3d) frame(); else {
232
  document.body.insertAdjacentHTML('beforeend', '<div style="position:fixed;left:14px;top:60px;z-index:16;color:#faa968;font-size:11px">⚠ WebGL nicht verfügbar – 2D-Modus</div>');
233
  // minimal 2D loop to keep labels in a ring
234
  const tick = () => { requestAnimationFrame(tick); const t = performance.now() / 1000; nodes.forEach((n, i) => { const u = n.userData; const a = u.a + t * .04; n.position.set(Math.cos(a) * u.R, u.y, Math.sin(a) * u.R); });
235
- camera.position.set(0, 18, 18); camera.lookAt(0, 0, 0); camera.updateMatrixWorld(); if (started) nodes.forEach((n, i) => { n.updateMatrixWorld(); const p = screenPos(n); labels[i].style.left = p.x + 'px'; labels[i].style.top = p.y + 'px'; }); };
236
  tick();
237
  }
 
1
  import * as THREE from './vendor/three.module.min.js';
2
+ import { STUDIOS, stopLoops } from './widgets.js?v=3';
3
+ import { icon } from './icons.js?v=1';
4
+ import { EffectComposer } from './vendor/addons/postprocessing/EffectComposer.js';
5
+ import { RenderPass } from './vendor/addons/postprocessing/RenderPass.js';
6
+ import { UnrealBloomPass } from './vendor/addons/postprocessing/UnrealBloomPass.js';
7
+ import { OutputPass } from './vendor/addons/postprocessing/OutputPass.js';
8
 
9
  const $ = (s) => document.querySelector(s);
10
  const isMobile = matchMedia('(pointer:coarse)').matches || innerWidth < 700;
 
21
  o.connect(g).connect(ac.destination); o.start(); o.stop(ac.currentTime + d);
22
  } catch (e) {}
23
  }
24
+ function toggleSound() { soundOn = !soundOn; $('#snd').innerHTML = icon(soundOn ? 'sound' : 'mute'); beep(880, .1); }
25
+ $('#snd').onclick = toggleSound; $('#snd').innerHTML = icon('mute');
26
 
27
  /* ---------- three setup ---------- */
28
+ let renderer = null, gl3d = true, composer = null, bloom = null;
29
  try {
30
  renderer = new THREE.WebGLRenderer({ canvas: $('#gl'), antialias: !isMobile, powerPreference: 'high-performance' });
31
  } catch (e) { gl3d = false; console.warn('WebGL unavailable, 2D fallback'); }
32
+ if (renderer) { renderer.toneMapping = THREE.ACESFilmicToneMapping; renderer.toneMappingExposure = 1.05; }
33
  const scene = new THREE.Scene(); scene.fog = new THREE.FogExp2(0x020c17, 0.028);
34
  const camera = new THREE.PerspectiveCamera(55, innerWidth / innerHeight, .1, 200);
35
+ const cam = { base: isMobile ? 26 : 21, r: isMobile ? 26 : 21, th: 0.4, ph: 1.15, tr: 21, tth: .4, tph: 1.15 };
36
  function applyQuality() {
37
  if (!renderer) return;
38
  renderer.setPixelRatio(quality === 'high' ? Math.min(devicePixelRatio, 2) : Math.min(devicePixelRatio, 1));
39
  renderer.setSize(innerWidth, innerHeight, false);
40
+ if (composer) { composer.setPixelRatio(renderer.getPixelRatio()); composer.setSize(innerWidth, innerHeight); }
41
  if (swarm) swarm.count = quality === 'high' ? SW_MAX : SW_MAX / 3 | 0;
42
  if (dust) dust.geometry.setDrawRange(0, quality === 'high' ? DUST : DUST / 3 | 0);
43
  $('#q').textContent = 'Q:' + (qMode === 'AUTO' ? 'AUTO·' + quality[0].toUpperCase() : quality.toUpperCase());
44
  }
45
+ if (renderer) { try { composer = new EffectComposer(renderer); composer.addPass(new RenderPass(scene, camera));
46
+ bloom = new UnrealBloomPass(new THREE.Vector2(innerWidth, innerHeight), .6, .5, .42); composer.addPass(bloom); composer.addPass(new OutputPass()); } catch (e) { composer = null; } }
47
  scene.add(new THREE.AmbientLight(0x334455, 1.2));
48
  const coreLight = new THREE.PointLight(GOLD, 60, 40, 1.6); scene.add(coreLight);
49
+ const key = new THREE.DirectionalLight(0xfff1c8, 2.2); key.position.set(8, 12, 10); scene.add(key);
50
  const rim = new THREE.DirectionalLight(ORANGE, 1.2); rim.position.set(-10, 8, -6); scene.add(rim);
51
 
52
  /* core */
53
  const core = new THREE.Group(); scene.add(core);
54
+ const coreMat = new THREE.MeshStandardMaterial({ color: 0x6b4c12, emissive: 0xc9962a, emissiveIntensity: .45, metalness: .55, roughness: .32, flatShading: true });
55
  const coreMesh = new THREE.Mesh(new THREE.IcosahedronGeometry(2.2, 1), coreMat); core.add(coreMesh);
56
  const shell = new THREE.Mesh(new THREE.IcosahedronGeometry(3.1, 1), new THREE.MeshBasicMaterial({ color: ORANGE, wireframe: true, transparent: true, opacity: .35 })); core.add(shell);
57
+ const shell2 = new THREE.Mesh(new THREE.IcosahedronGeometry(3.8, 2), new THREE.MeshBasicMaterial({ color: GOLD, wireframe: true, transparent: true, opacity: .07 })); core.add(shell2);
58
  const glowTex = (() => { const c = document.createElement('canvas'); c.width = c.height = 128; const x = c.getContext('2d'); const g = x.createRadialGradient(64, 64, 0, 64, 64, 64); g.addColorStop(0, 'rgba(255,230,150,1)'); g.addColorStop(.3, 'rgba(242,201,76,.5)'); g.addColorStop(1, 'rgba(0,0,0,0)'); x.fillStyle = g; x.fillRect(0, 0, 128, 128); return new THREE.CanvasTexture(c); })();
59
  const glow = new THREE.Sprite(new THREE.SpriteMaterial({ map: glowTex, blending: THREE.AdditiveBlending, depthWrite: false, transparent: true })); glow.scale.set(14, 14, 1); core.add(glow);
60
  // orbit rings
61
+ for (let i = 0; i < 3; i++) { const ring = new THREE.Mesh(new THREE.TorusGeometry(5 + i * 1.1, .025, 6, 120), new THREE.MeshBasicMaterial({ color: [GOLD, GOLD, CYAN][i], transparent: true, opacity: i === 2 ? .22 : .45 })); ring.rotation.x = Math.PI / 2 + i * .35; ring.rotation.y = i * .6; ring.userData.spin = .2 + i * .15; core.add(ring); }
62
  // hex floor grid
63
  {
64
  const pts = []; const R = .9, W = R * Math.sqrt(3);
 
67
  for (let k = 0; k < 6; k++) { const a = Math.PI / 6 + k * Math.PI / 3, b = a + Math.PI / 3; pts.push(cx + R * Math.cos(a), 0, cz + R * Math.sin(a), cx + R * Math.cos(b), 0, cz + R * Math.sin(b)); }
68
  }
69
  const g = new THREE.BufferGeometry(); g.setAttribute('position', new THREE.Float32BufferAttribute(pts, 3));
70
+ const floor = new THREE.LineSegments(g, new THREE.LineBasicMaterial({ color: 0xd4a63a, transparent: true, opacity: .13 })); floor.position.y = -6; scene.add(floor);
71
  }
72
  // hex swarm (instanced)
73
+ const SW_MAX = isMobile ? 260 : 620;
74
+ const hexGeo = new THREE.CylinderGeometry(.11, .11, .04, 6);
75
  const swarm = new THREE.InstancedMesh(hexGeo, new THREE.MeshStandardMaterial({ color: GOLD, emissive: 0x6b4a10, metalness: .8, roughness: .3 }), SW_MAX);
76
  const swData = [...Array(SW_MAX)].map(() => ({ r: 4.5 + Math.random() * 9, a: Math.random() * 6.28, y: (Math.random() - .5) * 7, s: (.1 + Math.random() * .4) * (Math.random() < .5 ? -1 : 1), w: Math.random() * 6 }));
77
  const tmp = new THREE.Object3D(), tmpC = new THREE.Color();
78
+ swData.forEach((d, i) => swarm.setColorAt(i, tmpC.set([GOLD, GOLD, 0xd4a63a, GOLD, ORANGE, CYAN][i % 6])));
79
  scene.add(swarm);
80
  // dust / burst particles
81
  const DUST = isMobile ? 1500 : 4000;
82
  const dpos = new Float32Array(DUST * 3), dvel = new Float32Array(DUST * 3);
83
  for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(10 + Math.random() * 40); dpos.set([v.x, v.y, v.z], i * 3); }
84
  const dGeo = new THREE.BufferGeometry(); dGeo.setAttribute('position', new THREE.BufferAttribute(dpos, 3));
85
+ const dust = new THREE.Points(dGeo, new THREE.PointsMaterial({ color: 0xf6dcac, size: .07, transparent: true, opacity: .55, blending: THREE.AdditiveBlending, depthWrite: false })); scene.add(dust);
86
  function burst() { for (let i = 0; i < DUST; i++) { const v = new THREE.Vector3().randomDirection().multiplyScalar(.3 + Math.random() * 1.2); dpos.set([0, 0, 0], i * 3); dvel.set([v.x, v.y, v.z], i * 3); } bursting = 1; }
87
  let bursting = 0;
88
 
 
92
  const streamPts = [];
93
  STUDIOS.forEach((s, i) => {
94
  const a = i / STUDIOS.length * Math.PI * 2, R = 10 + (i % 2) * 1.6;
95
+ const col = s.id === 'merge' ? RED : [GOLD, GOLD, ORANGE, GOLD, CYAN][CATS.indexOf(s.cat) % 5];
96
  const m = new THREE.Mesh(nodeGeo, new THREE.MeshStandardMaterial({ color: 0x0a0a0a, emissive: col, emissiveIntensity: .45, metalness: .9, roughness: .3 }));
97
+ const edge = new THREE.LineSegments(new THREE.EdgesGeometry(nodeGeo), new THREE.LineBasicMaterial({ color: GOLD, transparent: true, opacity: .9 })); m.add(edge);
98
  m.rotation.x = Math.PI / 2; m.userData = { s, a, R, y: Math.sin(i * 1.7) * 2.2, i, col };
99
  scene.add(m); nodes.push(m);
100
  // data stream line node→core
 
111
  CATS.forEach(c => { const b = document.createElement('button'); b.textContent = c.toUpperCase(); b.onclick = () => setCat(c); cats.append(b); });
112
  function setCat(c) { cat = c; [...cats.children].forEach(b => b.classList.toggle('on', b.textContent === c.toUpperCase())); beep(520); const v = visible(); if (!v.includes(sel)) select(v[0]); }
113
  function visible() { return nodes.map((n, i) => i).filter(i => cat === 'Alle' || nodes[i].userData.s.cat === cat || nodes[i].userData.s.id === 'merge'); }
114
+ const labels = STUDIOS.map((s, i) => { const d = document.createElement('div'); d.className = 'lbl'; d.innerHTML = `${icon(s.id)}<span>${s.name}</span>`; d.dataset.cat = s.cat; d.title = s.cat + ' · ' + s.like;
115
  d.onmouseenter = () => select(i); d.onclick = (e) => { e.stopPropagation(); select(i); open(i); }; $('#labels').append(d); return d; });
116
  function select(i) { if (i == null) return; if (sel !== i) beep(660, .03); sel = i; labels.forEach((l, k) => l.classList.toggle('sel', k === i)); }
117
  const pop = $('#pop');
118
  function open(i) {
119
  stopLoops(); openId = i; const s = STUDIOS[i]; beep(990, .08, 'triangle');
120
+ pop.innerHTML = `<div class="ph"><span class="pi">${icon(s.id)}</span><span class="pt"><b>${s.name}</b><small>${s.cat === '+' ? 'Modul' : s.cat} · ${s.like}</small></span><button aria-label="schließen">${icon('close')}</button></div><div class="pb"></div><div class="pf"><span>STUDIO ${String(i + 1).padStart(2, '0')}/${STUDIOS.length}</span><span>● SIMULATION</span></div>`;
121
+ pop.classList.remove('in'); void pop.offsetWidth; pop.classList.add('in'); focusNode(i);
122
  pop.hidden = false; pop.querySelector('.ph button').onclick = close; s.build(pop.querySelector('.pb')); placePop(); $('#wire').classList.add('on');
123
  }
124
+ function close() { stopLoops(); if (openId != null) cam.tr = cam.base; openId = null; pop.hidden = true; $('#wire').classList.remove('on'); beep(300); }
125
  function placePop() {
126
  if (openId == null || isMobile && innerWidth < 700) return; const p = screenPos(nodes[openId]);
127
  const W = pop.offsetWidth, H = pop.offsetHeight; let x = p.x + (p.x < innerWidth / 2 ? 90 : -90 - W), y = Math.max(60, Math.min(innerHeight - H - 50, p.y - H / 2));
128
  pop.style.left = x + 'px'; pop.style.top = y + 'px';
129
  }
130
+ // smooth camera focus: swing the orbit so the node faces the camera
131
+ function focusNode(i) { if (!started) return; const n = nodes[i]; const a = Math.atan2(n.position.z, n.position.x);
132
+ let d = a - cam.tth; d = Math.atan2(Math.sin(d), Math.cos(d)); cam.tth += d; cam.tr = Math.max(14, cam.base - 4); cam.tph = 1.12; }
133
  function screenPos(o) { const v = o.getWorldPosition(new THREE.Vector3()).project(camera); return { x: (v.x + 1) / 2 * innerWidth, y: (1 - v.y) / 2 * innerHeight, z: v.z }; }
134
  window.addEventListener('studius-merge', () => { burst(); beep(200, .3, 'sawtooth'); });
135
 
 
176
  async function bootSeq() {
177
  const pre = $('#boot');
178
  for (const [t, s] of BOOT) { if (started) return; const line = document.createElement('div'); pre.append(line);
179
+ for (let i = 0; i <= t.length; i += 2) { if (started) return; line.textContent = t.slice(0, i) + '▌'; await new Promise(r => setTimeout(r, 7)); }
180
+ line.innerHTML = t.replace(/</g, '&lt;') + (s ? ` <span class="${s}">[${s === 'w' ? ' WARN ' : ' OK '}]</span>` : ''); beep(1200, .015); await new Promise(r => setTimeout(r, 90)); }
181
+ await new Promise(r => setTimeout(r, 250)); if (started) return; $('#intro').classList.add('rev'); $('#reveal').classList.add('on'); beep(220, .4, 'sawtooth', .05);
182
+ setTimeout(() => $('#press')?.classList.add('on'), 1500);
183
  }
184
  function start() {
185
  if (started) return; started = true; beep(110, .5, 'sawtooth', .08); burst();
186
  $('#intro').classList.add('gone'); setTimeout(() => $('#intro').remove(), 1000);
187
+ ['#hud', '#hint', '#core-stats', '#frame', '#mm'].forEach(s => $(s).hidden = false); document.body.classList.add('live'); cam.tr = cam.base; setCat('Alle'); select(0);
188
  }
189
  $('#skip').onclick = (e) => { e.stopPropagation(); start(); };
190
  $('#intro').addEventListener('pointerdown', (e) => { if (e.target.id !== 'skip') start(); });
 
192
  bootSeq();
193
 
194
  /* ---------- loop ---------- */
195
+ const clock = new THREE.Clock(); let frames = 0, fpsT = 0, lowStreak = 0, statT = 0, mmT = 0;
196
+ const mm = $('#mm'); const mmDots = STUDIOS.map((s, i) => { const c = document.createElementNS('http://www.w3.org/2000/svg', 'circle'); c.setAttribute('r', 2.6); mm.querySelector('#mmd').append(c); return c; });
197
+ function drawMinimap(v) { const vw = mm.querySelector('#mmv'); nodes.forEach((n, i) => { const c = mmDots[i]; c.setAttribute('cx', 50 + n.position.x * 3.4); c.setAttribute('cy', 50 + n.position.z * 3.4);
198
+ c.setAttribute('class', i === sel ? 'sel' : v.includes(i) ? 'on' : 'off'); });
199
+ const a = Math.atan2(camera.position.z, camera.position.x) * 180 / Math.PI; vw.setAttribute('transform', `rotate(${a} 50 50)`); }
200
  const stats = $('#core-stats');
201
  function frame() {
202
  requestAnimationFrame(frame);
 
205
  if (qMode === 'AUTO' && quality === 'high') { lowStreak = fps < 40 ? lowStreak + 1 : 0; if (lowStreak >= 3) { quality = 'low'; applyQuality(); } } }
206
  pollPad();
207
  // camera (intro: slow fly; mouse parallax)
208
+ const kE = 1 - Math.exp(-dt * 2.6), kR = 1 - Math.exp(-dt * (started ? 2.2 : .9)); const drift = openId != null ? 0 : started ? dt * .03 : dt * .12;
209
+ cam.th += (cam.tth - cam.th) * kE + drift; cam.tth += drift;
210
+ cam.ph += (cam.tph - cam.ph) * kE; cam.r += (cam.tr - cam.r) * kR;
211
  const mx = mouse.x < 5 ? mouse.x : 0, my = mouse.y < 5 ? mouse.y : 0;
212
  camera.position.set(cam.r * Math.sin(cam.ph) * Math.cos(cam.th) + mx * 1.5, cam.r * Math.cos(cam.ph) + my * 1.5, cam.r * Math.sin(cam.ph) * Math.sin(cam.th)); camera.lookAt(0, 0, 0);
213
  // core pulse
214
  const pulse = 1 + Math.sin(t * 2.4) * .06 + (bursting * .5);
215
+ coreMesh.scale.setScalar(pulse); coreMesh.rotation.y += dt * .4; coreMesh.rotation.x += dt * .15; coreMat.emissiveIntensity = .4 + Math.sin(t * 2.4) * .15;
216
+ shell.rotation.y -= dt * .25; shell2.rotation.x += dt * .1; glow.scale.setScalar(9 + Math.sin(t * 2.4) * 1 + bursting * 10);
217
  core.children.forEach(c => { if (c.userData.spin) c.rotation.z += dt * c.userData.spin; });
218
+ coreLight.intensity = 35 + Math.sin(t * 2.4) * 10;
219
  // swarm
220
  const sc = swarm.count;
221
  for (let i = 0; i < sc; i++) { const d = swData[i]; d.a += d.s * dt * (1 + bursting * 4);
 
228
  dust.rotation.y += dt * .02;
229
  // nodes
230
  const v = visible();
231
+ nodes.forEach((n, i) => { const u = n.userData; u.ph = (u.ph || 0) + (openId != null ? 0 : dt * .04); const a = u.a + u.ph; n.position.set(Math.cos(a) * u.R, u.y + Math.sin(t + i) * .3, Math.sin(a) * u.R);
232
  n.rotation.z += dt * (i === sel ? 1.5 : .3); const on = v.includes(i); const s = (i === sel ? 1.35 : 1) * (on ? 1 : .6); n.scale.lerp(new THREE.Vector3(s, s, s), .15);
233
+ n.material.emissiveIntensity = i === sel ? .9 + Math.sin(t * 4) * .2 : on ? .32 : .08;
234
  const p = u.line.geometry.attributes.position; p.setXYZ(1, n.position.x, n.position.y, n.position.z); p.needsUpdate = true; u.line.material.opacity = on ? (i === sel ? .8 : .25) : .05; });
235
  streamPts.forEach((s, k) => { s.t = (s.t + dt * .35) % 1; const p = s.n.position; spPos[k * 3] = p.x * (1 - s.t); spPos[k * 3 + 1] = p.y * (1 - s.t); spPos[k * 3 + 2] = p.z * (1 - s.t); });
236
  spGeo.attributes.position.needsUpdate = true;
237
  // hover raycast
238
  if (started && !drag && mouse.x < 5) { ray.setFromCamera(mouse, camera); const h = ray.intersectObjects(nodes, false)[0]; cv.style.cursor = h ? 'pointer' : 'grab'; if (h && h.object.userData.i !== sel) select(h.object.userData.i); }
239
+ if (renderer) { if (composer && quality === 'high') composer.render(); else renderer.render(scene, camera); }
240
  // labels + wire
241
  if (started) {
242
+ const placed = []; const camP = camera.position;
243
+ nodes.map((n, i) => ({ n, i, d: n.position.distanceTo(camP) })).sort((a, b) => a.d - b.d).forEach(({ n, i, d }, rank) => {
244
+ const p = screenPos(n); const l = labels[i]; if (p.z >= 1) { l.style.display = 'none'; return; } l.style.display = '';
245
+ const far = rank > 9 && i !== sel && i !== openId; l.classList.toggle('far', far);
246
+ const w = far ? 30 : l.offsetWidth || 110, h = 26; let y = p.y + 34;
247
+ for (let k = 0; k < 6; k++) { const hit = placed.find(r => Math.abs(r.x - p.x) < (r.w + w) / 2 + 4 && Math.abs(r.y - y) < h); if (!hit) break; y = hit.y + (y >= hit.y ? h : -h); }
248
+ placed.push({ x: p.x, y, w }); l.style.transform = `translate(${p.x}px,${y}px) translate(-50%,-50%)`; l.style.zIndex = 100 - rank;
249
+ l.classList.toggle('dim', !v.includes(i)); });
250
+ if ((mmT += dt) > .1) { mmT = 0; drawMinimap(v); }
251
  if (openId != null && !pop.hidden) { const p = screenPos(nodes[openId]); const r = pop.getBoundingClientRect(); const wl = $('#wl');
252
  const tx = p.x < r.left ? r.left : r.right; wl.setAttribute('x1', p.x); wl.setAttribute('y1', p.y); wl.setAttribute('x2', tx); wl.setAttribute('y2', r.top + 14);
253
  }
254
+ if ((statT += dt) > .5) { statT = 0; const ld = (55 + Math.sin(t * .7) * 20) | 0; stats.innerHTML = `<h4>META-ENGINE CORE</h4><dl><dt>Agenten</dt><dd>${120 + (Math.sin(t) * 8 | 0)}</dd><dt>Tokens/s</dt><dd>${(4200 + Math.random() * 900) | 0}</dd><dt>Studios</dt><dd>${STUDIOS.length - 1}+1</dd><dt>Last</dt><dd>${ld}%</dd></dl><div class="bar"><i style="width:${ld}%"></i></div><p>● SIMULATION</p>`; }
255
  }
256
  }
257
  applyQuality();
 
259
  document.body.insertAdjacentHTML('beforeend', '<div style="position:fixed;left:14px;top:60px;z-index:16;color:#faa968;font-size:11px">⚠ WebGL nicht verfügbar – 2D-Modus</div>');
260
  // minimal 2D loop to keep labels in a ring
261
  const tick = () => { requestAnimationFrame(tick); const t = performance.now() / 1000; nodes.forEach((n, i) => { const u = n.userData; const a = u.a + t * .04; n.position.set(Math.cos(a) * u.R, u.y, Math.sin(a) * u.R); });
262
+ camera.position.set(0, 18, 18); camera.lookAt(0, 0, 0); camera.updateMatrixWorld(); if (started) nodes.forEach((n, i) => { n.updateMatrixWorld(); const p = screenPos(n); labels[i].style.transform = `translate(${p.x}px,${p.y}px) translate(-50%,-50%)`; }); };
263
  tick();
264
  }
icons.js ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // STUDIUS icon set — bundled, consistent 24px line icons (stroke=currentColor).
2
+ const P = {
3
+ chat:'<path d="M4 5h16v10H9l-5 4z"/><path d="M8 9h8M8 12h5"/>',
4
+ image:'<rect x="3" y="4" width="18" height="16" rx="1"/><circle cx="9" cy="10" r="2"/><path d="M3 18l6-5 4 3 3-2 5 4"/>',
5
+ videogen:'<rect x="3" y="6" width="13" height="12" rx="1"/><path d="M16 10l5-3v10l-5-3"/><path d="M8 9.5l3 2.5-3 2.5z"/>',
6
+ videoedit:'<circle cx="6" cy="7" r="2.5"/><circle cx="6" cy="17" r="2.5"/><path d="M8 8.5L20 17M8 15.5L20 7"/>',
7
+ audio:'<path d="M2 12h3l2-6 3 12 3-9 2 6 2-3h5"/>',
8
+ stems:'<path d="M5 4v16M12 4v16M19 4v16"/><rect x="3" y="7" width="4" height="3"/><rect x="10" y="13" width="4" height="3"/><rect x="17" y="9" width="4" height="3"/>',
9
+ music:'<path d="M9 18V5l11-2v13"/><circle cx="6.5" cy="18" r="2.5"/><circle cx="17.5" cy="16" r="2.5"/>',
10
+ auto:'<rect x="2" y="9" width="6" height="6"/><rect x="16" y="3" width="6" height="6"/><rect x="16" y="15" width="6" height="6"/><path d="M8 12h4M12 6v12M12 6h4M12 18h4"/>',
11
+ agent:'<rect x="5" y="8" width="14" height="11" rx="2"/><path d="M12 8V4M9 13h.01M15 13h.01M9 16h6M2 13h3M19 13h3"/><circle cx="12" cy="3.5" r="1"/>',
12
+ code:'<path d="M8 7l-5 5 5 5M16 7l5 5-5 5M14 4l-4 16"/>',
13
+ community:'<circle cx="12" cy="12" r="9"/><path d="M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18"/>',
14
+ sandbox:'<path d="M9 3h6M10 3v6l-5 9a2 2 0 002 3h10a2 2 0 002-3l-5-9V3"/><path d="M7 15h10"/>',
15
+ design:'<path d="M3 21L21 3M3 21h7M3 21v-7"/><path d="M14 4l6 6M8 10l2 2M11 7l2 2"/>',
16
+ canvas:'<path d="M12 3a9 9 0 100 18c1.5 0 2-1 2-2s-1-1.5-1-2.5 1-1.5 2-1.5h2a4 4 0 004-4c0-4.5-4-8-9-8z"/><circle cx="7.5" cy="11" r="1"/><circle cx="10" cy="7" r="1"/><circle cx="15" cy="7" r="1"/>',
17
+ merge:'<path d="M6 3v6a6 6 0 006 6h0a6 6 0 006-6V3"/><path d="M12 15v6M9 18l3 3 3-3"/>',
18
+ sound:'<path d="M4 9h4l5-4v14l-5-4H4z"/><path d="M16 9a4 4 0 010 6M18.5 6.5a8 8 0 010 11"/>',
19
+ mute:'<path d="M4 9h4l5-4v14l-5-4H4z"/><path d="M16 9l5 6M21 9l-5 6"/>',
20
+ close:'<path d="M6 6l12 12M18 6L6 18"/>',
21
+ };
22
+ export const icon = (id, cls = 'ic') => `<svg class="${cls}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${P[id] || P.merge}</svg>`;
index.html CHANGED
@@ -7,7 +7,7 @@
7
  <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
8
  <title>STUDIUS · DAS Studio — Einswarm</title>
9
  <link rel="icon" href="assets/einswarm-mascot.webp">
10
- <link rel="stylesheet" href="style.css?v=1">
11
  </head>
12
  <body>
13
  <canvas id="gl"></canvas>
@@ -23,27 +23,29 @@
23
  <p class="sub">DAS STUDIO · META-ENGINE v0.82</p>
24
  </div>
25
  <div id="press">▶ PRESS ANY KEY / TAP TO IGNITE</div>
26
- <button id="skip" type="button">SKIP ⏭</button>
27
  </section>
28
 
29
  <!-- HUD -->
30
  <header id="hud" hidden>
31
- <div class="brand"><img src="assets/einswarm-mascot.webp" alt=""><b>STUDIUS</b><span>by EINSWARM</span></div>
32
  <nav id="cats"></nav>
33
  <div class="hudr">
34
  <span id="fps">-- fps</span>
35
  <button id="q" type="button" title="Qualität (Q)">Q:AUTO</button>
36
- <button id="snd" type="button" title="Sound (M)">🔇</button>
37
  </div>
38
  </header>
39
  <div id="core-stats" hidden></div>
 
 
40
  <div id="labels"></div>
41
  <svg id="wire"><line id="wl" x1="0" y1="0" x2="0" y2="0"/></svg>
42
  <div id="pop" hidden></div>
43
- <footer id="hint" hidden>←→ / WASD wählen · ENTER öffnen · ESC zurück · Maus/Touch: Hover & Klick · Ziehen = Orbit</footer>
44
 
45
  <a id="bmc" href="https://www.buymeacoffee.com/2btainment" target="_blank" rel="noopener noreferrer">Buy me a coffee</a>
46
  <noscript><p style="color:#f2c94c;padding:2em">STUDIUS braucht JavaScript.</p></noscript>
47
- <script type="module" src="app.js?v=3"></script>
48
  </body>
49
  </html>
 
7
  <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
8
  <title>STUDIUS · DAS Studio — Einswarm</title>
9
  <link rel="icon" href="assets/einswarm-mascot.webp">
10
+ <link rel="stylesheet" href="style.css?v=2">
11
  </head>
12
  <body>
13
  <canvas id="gl"></canvas>
 
23
  <p class="sub">DAS STUDIO · META-ENGINE v0.82</p>
24
  </div>
25
  <div id="press">▶ PRESS ANY KEY / TAP TO IGNITE</div>
26
+ <button id="skip" type="button">SKIP ›</button>
27
  </section>
28
 
29
  <!-- HUD -->
30
  <header id="hud" hidden>
31
+ <div class="brand"><img src="assets/einswarm-mascot.webp" alt=""><b>STUDIUS</b><span>by EINSWARM</span><em>META-STUDIO</em></div>
32
  <nav id="cats"></nav>
33
  <div class="hudr">
34
  <span id="fps">-- fps</span>
35
  <button id="q" type="button" title="Qualität (Q)">Q:AUTO</button>
36
+ <button id="snd" type="button" title="Sound (M)" aria-label="Sound"></button>
37
  </div>
38
  </header>
39
  <div id="core-stats" hidden></div>
40
+ <div id="frame" hidden><i class="c tl"></i><i class="c tr"></i><i class="c bl"></i><i class="c br"></i></div>
41
+ <svg id="mm" hidden viewBox="0 0 100 100" aria-label="Minimap"><circle cx="50" cy="50" r="46" class="r1"/><circle cx="50" cy="50" r="34" class="r2"/><circle cx="50" cy="50" r="4" class="core"/><g id="mmv"><path d="M50 50 L96 38 A47 47 0 0 1 96 62 Z" class="cone"/></g><g id="mmd"></g></svg>
42
  <div id="labels"></div>
43
  <svg id="wire"><line id="wl" x1="0" y1="0" x2="0" y2="0"/></svg>
44
  <div id="pop" hidden></div>
45
+ <footer id="hint" hidden><kbd>←→</kbd><kbd>WASD</kbd> wählen <kbd>ENTER</kbd> öffnen <kbd>ESC</kbd> zurück <kbd>TAB</kbd> Kategorie <kbd>Q</kbd> Qualität · Ziehen = Orbit</footer>
46
 
47
  <a id="bmc" href="https://www.buymeacoffee.com/2btainment" target="_blank" rel="noopener noreferrer">Buy me a coffee</a>
48
  <noscript><p style="color:#f2c94c;padding:2em">STUDIUS braucht JavaScript.</p></noscript>
49
+ <script type="module" src="app.js?v=4"></script>
50
  </body>
51
  </html>
style.css CHANGED
@@ -1,84 +1,147 @@
1
  @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2");font-weight:400;font-display:swap}
2
  @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2");font-weight:700;font-display:swap}
3
  :root{
 
4
  /* Einswarm */ --bk:#050505;--gold:#f2c94c;--gold2:#d4a63a;--golddim:#7a5d1c;
5
  /* Omarchy Retro-82 */ --r-bg:#05182e;--r-bg2:#020c17;--r-acc:#faa968;--r-or:#e97b3c;--r-red:#f85525;--r-teal:#028391;--r-cy:#8cbfb8;--r-fg:#f6dcac;--r-mut:#2a6b78;
6
  }
7
  *{box-sizing:border-box}
8
  html,body{margin:0;height:100%;overflow:hidden;background:var(--bk);color:var(--r-fg);font-family:JBM,ui-monospace,Menlo,monospace;-webkit-tap-highlight-color:transparent}
9
  #gl{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0}
10
- #hexbg{position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.22;
11
  background:radial-gradient(ellipse at 50% 120%,rgba(250,169,104,.25),transparent 60%),
12
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97'%3E%3Cpath d='M28 0L56 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='%23d4a63a' stroke-width='1'/%3E%3C/svg%3E");}
13
- body::after{content:"";position:fixed;inset:0;pointer-events:none;z-index:50;background:repeating-linear-gradient(0deg,rgba(0,0,0,.18) 0 1px,transparent 1px 3px);mix-blend-mode:multiply}
14
  button{font:inherit;color:inherit;cursor:pointer}
15
- /* intro */
 
 
 
16
  #intro{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;flex-direction:column;
17
- background:radial-gradient(circle at 50% 50%,rgba(5,24,46,.85),rgba(2,12,23,.97) 70%);transition:opacity .9s}
18
- #intro.gone{opacity:0;pointer-events:none}
19
- #boot{position:absolute;left:4vw;top:4vh;margin:0;font-size:clamp(10px,1.4vw,14px);line-height:1.45;color:var(--r-cy);text-shadow:0 0 6px var(--r-teal);white-space:pre-wrap;max-width:92vw}
 
20
  #boot .ok{color:var(--gold)} #boot .w{color:var(--r-acc)}
21
- #reveal{display:flex;flex-direction:column;align-items:center;opacity:0;transform:scale(.6);transition:all 1.2s cubic-bezier(.2,1.4,.3,1)}
22
- #reveal.on{opacity:1;transform:none}
 
 
23
  #mascot{display:none}
24
- #logo{width:min(70vw,340px);filter:drop-shadow(0 0 30px rgba(242,201,76,.55));animation:hover 3s ease-in-out infinite}
25
- @keyframes hover{50%{transform:translateY(-10px) rotate(-2deg)}}
26
- .glitch{font-size:clamp(40px,9vw,110px);letter-spacing:.18em;margin:.1em 0 0;color:var(--gold);position:relative;
27
- text-shadow:0 0 18px rgba(242,201,76,.7),3px 0 var(--r-red),-3px 0 var(--r-teal)}
28
- .glitch::after{content:attr(data-t);position:absolute;left:0;top:0;color:var(--r-acc);clip-path:inset(40% 0 45% 0);animation:gl 2.2s steps(2) infinite;opacity:.8}
29
- @keyframes gl{0%,90%{transform:none}92%{transform:translateX(6px)}95%{transform:translateX(-5px)}}
30
- .sub{letter-spacing:.4em;color:var(--r-cy);font-size:clamp(9px,1.3vw,13px)}
31
- #press{position:absolute;bottom:14vh;color:var(--r-acc);letter-spacing:.3em;font-size:clamp(11px,1.6vw,16px);opacity:0;animation:blink 1.1s steps(2) infinite}
32
- #press.on{opacity:1}
33
- @keyframes blink{50%{visibility:hidden}}
34
- #skip{position:absolute;top:16px;right:16px;background:rgba(0,0,0,.5);border:1px solid var(--gold2);padding:6px 14px;letter-spacing:.2em;color:var(--gold)}
35
- /* hud */
36
- #hud{position:fixed;top:0;left:0;right:0;z-index:20;display:flex;align-items:center;gap:12px;padding:10px 14px;
37
- background:linear-gradient(180deg,rgba(0,0,0,.85),transparent);border-bottom:1px solid rgba(212,166,58,.35)}
38
- .brand{display:flex;align-items:center;gap:8px}.brand img{width:34px}.brand b{color:var(--gold);letter-spacing:.2em}.brand span{font-size:10px;color:var(--r-cy)}
39
- #cats{display:flex;gap:4px;flex:1;overflow-x:auto;scrollbar-width:none}
40
- #cats button{background:rgba(5,24,46,.6);border:1px solid var(--golddim);padding:5px 10px;font-size:11px;letter-spacing:.12em;white-space:nowrap;
41
- clip-path:polygon(8px 0,100% 0,calc(100% - 8px) 100%,0 100%)}
42
- #cats button.on{background:var(--gold);color:#000;border-color:var(--gold)}
43
- .hudr{display:flex;gap:6px;align-items:center;font-size:11px}
44
- .hudr button{background:#000;border:1px solid var(--gold2);padding:4px 8px;color:var(--gold)}
45
- #fps{color:var(--r-teal);min-width:48px}
46
- #core-stats{position:fixed;left:14px;bottom:44px;z-index:15;font-size:11px;line-height:1.6;color:var(--r-cy);border-left:2px solid var(--gold);padding:6px 10px;background:rgba(0,0,0,.45)}
47
- #core-stats b{color:var(--gold)}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  #labels{position:fixed;inset:0;z-index:10;pointer-events:none}
49
- .lbl{position:absolute;transform:translate(-50%,-50%);pointer-events:auto;cursor:pointer;font-size:11px;letter-spacing:.1em;padding:4px 8px;white-space:nowrap;
50
- background:rgba(0,0,0,.72);border:1px solid var(--golddim);color:var(--r-fg);transition:background .15s,transform .15s}
51
- .lbl i{font-style:normal;color:var(--r-acc);margin-right:4px}
52
- .lbl.sel{border-color:var(--gold);background:rgba(242,201,76,.16);color:var(--gold);box-shadow:0 0 14px rgba(242,201,76,.5);transform:translate(-50%,-50%) scale(1.12)}
53
- .lbl.dim{opacity:.25}
 
 
 
54
  #wire{position:fixed;inset:0;width:100%;height:100%;z-index:11;pointer-events:none}
55
- #wl{stroke:var(--gold);stroke-width:1;stroke-dasharray:3 3;opacity:0}
56
- #wire.on #wl{opacity:.9}
 
57
  /* popup */
58
- #pop{position:fixed;z-index:30;width:min(320px,92vw);background:rgba(3,10,18,.94);border:1px solid var(--gold);color:var(--r-fg);
59
- box-shadow:0 0 0 1px #000,0 0 30px rgba(242,201,76,.25);font-size:12px;animation:pin .18s ease-out;
60
- clip-path:polygon(14px 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%,0 14px)}
61
- @keyframes pin{from{transform:scale(.85);opacity:0}}
62
- #pop .ph{display:flex;align-items:center;gap:6px;padding:6px 10px;background:linear-gradient(90deg,var(--gold2),var(--r-acc));color:#000;font-weight:700;letter-spacing:.1em}
63
- #pop .ph small{font-weight:400;opacity:.7;margin-left:auto}
64
- #pop .ph button{background:#000;color:var(--gold);border:0;padding:0 6px}
65
- #pop .pb{padding:10px}
66
- #pop input,#pop textarea{width:100%;background:#000;border:1px solid var(--r-mut);color:var(--r-fg);font:inherit;padding:5px}
67
- #pop .row{display:flex;gap:6px;align-items:center;margin-top:6px;flex-wrap:wrap}
68
- #pop .btn{background:var(--gold);color:#000;border:0;padding:4px 10px;font-weight:700}
69
- #pop .btn.alt{background:transparent;color:var(--gold);border:1px solid var(--gold2)}
70
- #pop canvas{width:100%;display:block;background:#000;border:1px solid var(--r-mut);touch-action:none}
71
- .chat{height:110px;overflow:auto;background:#000;border:1px solid var(--r-mut);padding:6px;margin-bottom:6px}
72
- .chat p{margin:0 0 5px}.chat .u{color:var(--r-acc)}.chat .a{color:var(--r-cy)}
73
- .prog{height:6px;background:#000;border:1px solid var(--r-mut)}.prog i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--r-teal),var(--gold));transition:width .2s}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  .track{position:relative;height:18px;background:#000;border:1px solid #222;margin-top:3px}
75
  .clip{position:absolute;top:1px;bottom:1px;cursor:grab;font-size:9px;color:#000;padding-left:3px;overflow:hidden}
76
  .grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
77
- .grid div{aspect-ratio:1;border:1px solid var(--golddim);display:flex;align-items:flex-end;padding:3px;font-size:9px;cursor:pointer}
78
- .code{background:#000;border:1px solid var(--r-mut);padding:6px;font-size:11px;min-height:70px;white-space:pre;overflow:auto;color:var(--r-cy)}
 
79
  .k{color:var(--r-red)}.s{color:var(--gold)}
80
  input[type=range]{accent-color:var(--gold);flex:1}
81
- #hint{position:fixed;bottom:0;left:0;right:0;z-index:15;text-align:center;font-size:10px;padding:8px 150px 8px 8px;color:var(--r-mut);letter-spacing:.1em}
 
 
82
  #bmc{position:fixed;right:14px;bottom:12px;z-index:60;background:#FFDD00;color:#000;font:700 13px/1 system-ui,sans-serif;padding:10px 14px;border-radius:8px;text-decoration:none;box-shadow:0 2px 10px rgba(0,0,0,.5)}
83
- @media (max-width:700px){.brand span,#hint{display:none}#core-stats{bottom:60px;font-size:10px}#hud{flex-wrap:wrap}#cats{order:3;flex-basis:100%}
84
- #pop{left:4vw!important;right:4vw;width:auto;bottom:60px;top:auto!important}}
 
 
 
 
 
 
 
 
 
 
 
1
  @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-400-normal.woff2) format("woff2");font-weight:400;font-display:swap}
2
  @font-face{font-family:JBM;src:url(fonts/jetbrains-mono-latin-700-normal.woff2) format("woff2");font-weight:700;font-display:swap}
3
  :root{
4
+ --glass:rgba(8,7,4,.62);--line:rgba(242,201,76,.28);--line2:rgba(242,201,76,.55);--txt:#efe6cf;--mut:#9a8f78;--ease:cubic-bezier(.16,1,.3,1);
5
  /* Einswarm */ --bk:#050505;--gold:#f2c94c;--gold2:#d4a63a;--golddim:#7a5d1c;
6
  /* Omarchy Retro-82 */ --r-bg:#05182e;--r-bg2:#020c17;--r-acc:#faa968;--r-or:#e97b3c;--r-red:#f85525;--r-teal:#028391;--r-cy:#8cbfb8;--r-fg:#f6dcac;--r-mut:#2a6b78;
7
  }
8
  *{box-sizing:border-box}
9
  html,body{margin:0;height:100%;overflow:hidden;background:var(--bk);color:var(--r-fg);font-family:JBM,ui-monospace,Menlo,monospace;-webkit-tap-highlight-color:transparent}
10
  #gl{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0}
11
+ #hexbg{position:fixed;inset:0;z-index:0;pointer-events:none;opacity:.12;
12
  background:radial-gradient(ellipse at 50% 120%,rgba(250,169,104,.25),transparent 60%),
13
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97'%3E%3Cpath d='M28 0L56 16v32L28 64 0 48V16zM28 64v33' fill='none' stroke='%23d4a63a' stroke-width='1'/%3E%3C/svg%3E");}
14
+ body::after{content:"";position:fixed;inset:0;pointer-events:none;z-index:50;background:repeating-linear-gradient(0deg,rgba(0,0,0,.10) 0 1px,transparent 1px 3px);mix-blend-mode:multiply}
15
  button{font:inherit;color:inherit;cursor:pointer}
16
+
17
+ body::before{content:"";position:fixed;inset:0;pointer-events:none;z-index:1;background:radial-gradient(ellipse at 50% 45%,transparent 45%,rgba(0,0,0,.75) 100%)}
18
+ .ic{width:1.15em;height:1.15em;flex:none;display:block}
19
+ /* ---------- intro ---------- */
20
  #intro{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;flex-direction:column;
21
+ background:radial-gradient(circle at 50% 50%,#0b0a06 0,#030303 70%);transition:opacity 1.2s var(--ease),transform 1.2s var(--ease)}
22
+ #intro.gone{opacity:0;transform:scale(1.08);pointer-events:none}
23
+ #boot{position:absolute;left:5vw;top:6vh;margin:0;font-size:clamp(10px,1.2vw,13px);line-height:1.7;color:var(--r-cy);opacity:.85;white-space:pre-wrap;max-width:90vw;transition:opacity 1s,filter 1s}
24
+ #intro.rev #boot{opacity:.18;filter:blur(1px)}
25
  #boot .ok{color:var(--gold)} #boot .w{color:var(--r-acc)}
26
+ #reveal{display:flex;flex-direction:column;align-items:center;opacity:0;transform:scale(.92) translateY(14px);filter:blur(8px);transition:opacity 1.6s var(--ease),transform 1.8s var(--ease),filter 1.4s var(--ease)}
27
+ #reveal.on{opacity:1;transform:none;filter:none}
28
+ #reveal::before{content:"";position:absolute;width:min(80vw,620px);aspect-ratio:1;border-radius:50%;z-index:-1;background:radial-gradient(circle,rgba(242,201,76,.18),transparent 62%);animation:breath 4s ease-in-out infinite}
29
+ @keyframes breath{50%{transform:scale(1.08);opacity:.7}}
30
  #mascot{display:none}
31
+ #logo{width:min(64vw,300px);filter:drop-shadow(0 0 28px rgba(242,201,76,.45));animation:hover 5s ease-in-out infinite}
32
+ @keyframes hover{50%{transform:translateY(-6px)}}
33
+ .glitch{font-size:clamp(40px,8vw,96px);font-weight:700;letter-spacing:.32em;margin:.15em 0 0 .32em;position:relative;
34
+ background:linear-gradient(180deg,#fff3c4 0%,var(--gold) 45%,#a87a1f 100%);-webkit-background-clip:text;background-clip:text;color:transparent;
35
+ filter:drop-shadow(0 0 22px rgba(242,201,76,.45))}
36
+ .glitch::after{content:attr(data-t);position:absolute;left:0;top:0;color:var(--r-acc);-webkit-text-fill-color:var(--r-acc);clip-path:inset(42% 0 46% 0);animation:gl 3.2s steps(2) infinite;opacity:.55}
37
+ @keyframes gl{0%,93%{transform:none;opacity:0}94%{transform:translateX(5px);opacity:.6}97%{transform:translateX(-4px)}}
38
+ .sub{letter-spacing:.55em;color:var(--mut);font-size:clamp(9px,1.1vw,12px);margin:.4em 0 0 .55em}
39
+ .sub::before,.sub::after{content:"";display:inline-block;width:40px;height:1px;background:var(--line2);vertical-align:middle;margin:0 14px}
40
+ #press{position:absolute;bottom:13vh;color:var(--gold);letter-spacing:.42em;font-size:clamp(10px,1.3vw,13px);opacity:0;transition:opacity 1s}
41
+ #press.on{opacity:1;animation:pulse 2.2s ease-in-out 1s infinite}
42
+ @keyframes pulse{50%{opacity:.35}}
43
+ #skip{position:absolute;top:20px;right:20px;background:var(--glass);backdrop-filter:blur(6px);border:1px solid var(--line2);padding:8px 16px;letter-spacing:.3em;font-size:11px;color:var(--gold);transition:background .2s}
44
+ #skip:hover{background:rgba(242,201,76,.15)}
45
+ /* ---------- HUD frame ---------- */
46
+ #frame{position:fixed;inset:10px;z-index:12;pointer-events:none}
47
+ #frame .c{position:absolute;width:22px;height:22px;border:solid var(--line2);border-width:0}
48
+ #frame .tl{left:0;top:58px;border-left-width:1px;border-top-width:1px}#frame .tr{right:0;top:58px;border-right-width:1px;border-top-width:1px}
49
+ #frame .bl{left:0;bottom:0;border-left-width:1px;border-bottom-width:1px}#frame .br{right:0;bottom:0;border-right-width:1px;border-bottom-width:1px}
50
+ #hud{position:fixed;top:0;left:0;right:0;z-index:20;display:flex;align-items:center;gap:18px;height:56px;padding:0 18px;
51
+ background:linear-gradient(180deg,rgba(6,5,3,.92),rgba(6,5,3,.7));backdrop-filter:blur(10px);border-bottom:1px solid var(--line)}
52
+ #hud::after{content:"";position:absolute;left:18px;right:18px;bottom:-1px;height:1px;background:linear-gradient(90deg,transparent,var(--gold),transparent);opacity:.6}
53
+ .brand{display:flex;align-items:center;gap:10px;flex:none}.brand img{width:30px;filter:drop-shadow(0 0 6px rgba(242,201,76,.4))}
54
+ .brand b{color:var(--gold);letter-spacing:.3em;font-size:15px}
55
+ .brand span{font-size:9px;color:var(--mut);letter-spacing:.2em;display:flex;flex-direction:column;line-height:1.3}
56
+ .brand em{font-style:normal;font-size:9px;color:var(--mut);letter-spacing:.2em;border-left:1px solid var(--line);padding-left:10px;display:none}
57
+ #cats{display:flex;gap:2px;flex:1;justify-content:center;overflow-x:auto;scrollbar-width:none}
58
+ #cats button{background:transparent;border:0;border-bottom:2px solid transparent;padding:18px 11px 16px;font-size:10.5px;letter-spacing:.18em;white-space:nowrap;color:var(--mut);transition:color .2s,border-color .2s,background .2s}
59
+ #cats button:hover{color:var(--txt);background:rgba(242,201,76,.05)}
60
+ #cats button.on{color:var(--gold);border-bottom-color:var(--gold);background:linear-gradient(0deg,rgba(242,201,76,.14),transparent);text-shadow:0 0 10px rgba(242,201,76,.5)}
61
+ .hudr{display:flex;gap:8px;align-items:center;font-size:10px;letter-spacing:.12em;flex:none}
62
+ .hudr button{display:flex;align-items:center;height:30px;background:var(--glass);border:1px solid var(--line);padding:0 10px;color:var(--gold);transition:border-color .2s}
63
+ .hudr button:hover{border-color:var(--gold)}
64
+ #fps{color:var(--mut);min-width:44px;text-align:right;font-variant-numeric:tabular-nums}
65
+ /* panels */
66
+ #core-stats,#pop{background:linear-gradient(160deg,rgba(20,16,6,.78),rgba(5,5,4,.86));backdrop-filter:blur(12px);border:1px solid var(--line)}
67
+ #core-stats{position:fixed;left:22px;bottom:48px;z-index:15;width:178px;font-size:10.5px;color:var(--txt);padding:12px 14px;
68
+ clip-path:polygon(0 0,calc(100% - 12px) 0,100% 12px,100% 100%,0 100%)}
69
+ #core-stats::before{content:"";position:absolute;left:0;top:0;width:3px;height:22px;background:var(--gold)}
70
+ #core-stats h4{margin:0 0 8px;font-size:10px;letter-spacing:.22em;color:var(--gold)}
71
+ #core-stats dl{display:grid;grid-template-columns:1fr auto;gap:3px 8px;margin:0}
72
+ #core-stats dt{color:var(--mut)}#core-stats dd{margin:0;text-align:right;font-variant-numeric:tabular-nums}
73
+ #core-stats .bar{height:3px;background:rgba(255,255,255,.07);margin-top:8px}#core-stats .bar i{display:block;height:100%;background:linear-gradient(90deg,var(--gold2),var(--gold));transition:width .5s}
74
+ #core-stats p{margin:8px 0 0;font-size:9px;letter-spacing:.2em;color:var(--r-cy)}
75
+ #mm{position:fixed;right:22px;bottom:62px;z-index:15;width:116px;height:116px;filter:drop-shadow(0 0 8px rgba(0,0,0,.8))}
76
+ #mm .r1{fill:rgba(8,7,4,.7);stroke:var(--line2);stroke-width:.8}#mm .r2{fill:none;stroke:var(--line);stroke-width:.5;stroke-dasharray:2 2}
77
+ #mm .core{fill:var(--gold);filter:drop-shadow(0 0 3px var(--gold))}#mm .cone{fill:rgba(242,201,76,.10);stroke:none}
78
+ #mm circle.on{fill:var(--txt)}#mm circle.off{fill:#4a4433}#mm circle.sel{fill:var(--gold);r:4}
79
+ /* labels */
80
  #labels{position:fixed;inset:0;z-index:10;pointer-events:none}
81
+ .lbl{position:absolute;left:0;top:0;display:flex;align-items:center;gap:7px;pointer-events:auto;cursor:pointer;font-size:10.5px;letter-spacing:.12em;padding:5px 10px 5px 8px;white-space:nowrap;
82
+ background:rgba(6,5,3,.78);border:1px solid var(--line);color:var(--txt);transition:background .2s,border-color .2s,color .2s,opacity .3s,padding .2s;will-change:transform}
83
+ .lbl .ic{color:var(--gold);width:14px;height:14px}
84
+ .lbl.far{padding:5px;opacity:.75}.lbl.far span{display:none}
85
+ .lbl:hover,.lbl.sel{border-color:var(--gold);background:rgba(36,28,8,.92);color:#fff;box-shadow:0 0 18px rgba(242,201,76,.35),inset 0 0 0 1px rgba(242,201,76,.2)}
86
+ .lbl.sel::before{content:"";position:absolute;left:-1px;top:-1px;bottom:-1px;width:3px;background:var(--gold)}
87
+ .lbl.dim{opacity:.22}
88
+ .lbl[data-cat="+"] .ic{color:var(--r-red)}
89
  #wire{position:fixed;inset:0;width:100%;height:100%;z-index:11;pointer-events:none}
90
+ #wl{stroke:var(--gold);stroke-width:1;stroke-dasharray:4 4;opacity:0;transition:opacity .3s;animation:dash 1s linear infinite}
91
+ @keyframes dash{to{stroke-dashoffset:-8}}
92
+ #wire.on #wl{opacity:.75}
93
  /* popup */
94
+ #pop{position:fixed;z-index:30;width:min(340px,92vw);color:var(--txt);font-size:11.5px;
95
+ box-shadow:0 20px 60px rgba(0,0,0,.6),0 0 0 1px rgba(0,0,0,.6),0 0 40px rgba(242,201,76,.12);
96
+ clip-path:polygon(16px 0,100% 0,100% calc(100% - 16px),calc(100% - 16px) 100%,0 100%,0 16px)}
97
+ #pop.in{animation:pin .45s var(--ease)}
98
+ @keyframes pin{from{transform:translateY(10px) scale(.96);opacity:0;filter:blur(4px)}}
99
+ #pop::before{content:"";position:absolute;left:0;top:0;width:16px;height:16px;background:linear-gradient(135deg,var(--gold) 50%,transparent 50%)}
100
+ #pop .ph{display:flex;align-items:center;gap:10px;padding:12px 12px 10px 18px;border-bottom:1px solid var(--line);background:linear-gradient(90deg,rgba(242,201,76,.10),transparent)}
101
+ #pop .pi{display:grid;place-items:center;width:30px;height:30px;border:1px solid var(--line2);color:var(--gold);background:rgba(242,201,76,.08);flex:none}
102
+ #pop .pi .ic{width:17px;height:17px}
103
+ #pop .pt{display:flex;flex-direction:column;min-width:0;flex:1}
104
+ #pop .pt b{color:var(--gold);letter-spacing:.2em;font-size:12px;text-transform:uppercase}
105
+ #pop .pt small{color:var(--mut);font-size:9.5px;letter-spacing:.12em;margin-top:2px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
106
+ #pop .ph button{background:transparent;color:var(--mut);border:1px solid transparent;width:26px;height:26px;display:grid;place-items:center;padding:0;transition:color .2s,border-color .2s}
107
+ #pop .ph button:hover{color:var(--gold);border-color:var(--line2)}
108
+ #pop .pb{padding:12px 14px;animation:fadein .5s .1s var(--ease) backwards}
109
+ @keyframes fadein{from{opacity:0;transform:translateY(4px)}}
110
+ #pop .pf{display:flex;justify-content:space-between;padding:6px 14px 8px;border-top:1px solid rgba(242,201,76,.12);font-size:8.5px;letter-spacing:.2em;color:var(--mut)}
111
+ #pop .pf span:last-child{color:var(--r-cy)}
112
+ #pop input,#pop textarea{width:100%;background:rgba(0,0,0,.55);border:1px solid rgba(242,201,76,.2);color:var(--txt);font:inherit;padding:6px 8px;outline:none;transition:border-color .2s}
113
+ #pop input:focus,#pop textarea:focus{border-color:var(--gold)}
114
+ #pop input[type=range]{padding:0;border:0;background:none}
115
+ #pop .row{display:flex;gap:6px;align-items:center;margin-top:8px;flex-wrap:wrap}
116
+ #pop .btn{background:linear-gradient(180deg,#f7d871,var(--gold2));color:#000;border:0;padding:6px 12px;font-weight:700;font-size:10.5px;letter-spacing:.08em;transition:filter .2s,transform .1s}
117
+ #pop .btn:hover{filter:brightness(1.12)}#pop .btn:active{transform:translateY(1px)}
118
+ #pop .btn.alt{background:transparent;color:var(--gold);border:1px solid var(--line2)}
119
+ #pop .btn.alt:hover{background:rgba(242,201,76,.1)}
120
+ #pop canvas{width:100%;display:block;background:#000;border:1px solid rgba(242,201,76,.2);touch-action:none}
121
+ .chat{height:120px;overflow:auto;background:rgba(0,0,0,.55);border:1px solid rgba(242,201,76,.2);padding:8px;margin-bottom:6px}
122
+ .chat p{margin:0 0 6px;line-height:1.45}.chat .u{color:var(--r-acc)}.chat .a{color:var(--txt)}
123
+ .prog{height:4px;background:rgba(255,255,255,.06)}.prog i{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--gold2),var(--gold));box-shadow:0 0 8px var(--gold);transition:width .2s}
124
  .track{position:relative;height:18px;background:#000;border:1px solid #222;margin-top:3px}
125
  .clip{position:absolute;top:1px;bottom:1px;cursor:grab;font-size:9px;color:#000;padding-left:3px;overflow:hidden}
126
  .grid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px}
127
+ .grid div{aspect-ratio:1;border:1px solid rgba(242,201,76,.25);display:flex;align-items:flex-end;padding:3px;font-size:9px;cursor:pointer;transition:border-color .2s}
128
+ .grid div:hover{border-color:var(--gold)}
129
+ .code{background:rgba(0,0,0,.6);border:1px solid rgba(242,201,76,.2);padding:8px;font-size:11px;min-height:70px;white-space:pre;overflow:auto;color:var(--r-cy)}
130
  .k{color:var(--r-red)}.s{color:var(--gold)}
131
  input[type=range]{accent-color:var(--gold);flex:1}
132
+ #hint{position:fixed;bottom:16px;left:50%;transform:translateX(-50%);z-index:15;font-size:9.5px;letter-spacing:.14em;color:var(--mut);white-space:nowrap;display:flex;gap:6px;align-items:center}
133
+ #hint[hidden]{display:none}
134
+ kbd{font:inherit;font-size:9px;color:var(--gold);border:1px solid var(--line);padding:2px 5px;background:rgba(0,0,0,.5)}
135
  #bmc{position:fixed;right:14px;bottom:12px;z-index:60;background:#FFDD00;color:#000;font:700 13px/1 system-ui,sans-serif;padding:10px 14px;border-radius:8px;text-decoration:none;box-shadow:0 2px 10px rgba(0,0,0,.5)}
136
+ @media (min-width:1500px){.brand em{display:block}}
137
+ @media (max-width:1120px){#hint{display:none!important}}
138
+ @media (max-width:1000px){#cats{justify-content:flex-start}}
139
+ @media (max-width:700px){
140
+ #hud{height:auto;flex-wrap:wrap;padding:8px 12px 0;gap:8px}.brand span{display:none}#cats{order:3;flex-basis:100%;margin:0 -12px;padding:0 6px}
141
+ #cats button{padding:10px 9px}
142
+ #frame,#mm{display:none!important}
143
+ #core-stats{left:10px;bottom:62px;width:150px;font-size:9.5px;padding:8px 10px}
144
+ #core-stats p,#core-stats .bar{display:none}
145
+ #pop{left:3vw!important;right:3vw;width:auto;bottom:62px;top:auto!important;max-height:62vh;overflow:auto}
146
+ .lbl{font-size:9.5px;padding:4px 7px}
147
+ }
vendor/addons/postprocessing/EffectComposer.js ADDED
@@ -0,0 +1,231 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ Clock,
3
+ HalfFloatType,
4
+ NoBlending,
5
+ Vector2,
6
+ WebGLRenderTarget
7
+ } from '../../three.module.min.js';
8
+ import { CopyShader } from '../shaders/CopyShader.js';
9
+ import { ShaderPass } from './ShaderPass.js';
10
+ import { MaskPass } from './MaskPass.js';
11
+ import { ClearMaskPass } from './MaskPass.js';
12
+
13
+ class EffectComposer {
14
+
15
+ constructor( renderer, renderTarget ) {
16
+
17
+ this.renderer = renderer;
18
+
19
+ this._pixelRatio = renderer.getPixelRatio();
20
+
21
+ if ( renderTarget === undefined ) {
22
+
23
+ const size = renderer.getSize( new Vector2() );
24
+ this._width = size.width;
25
+ this._height = size.height;
26
+
27
+ renderTarget = new WebGLRenderTarget( this._width * this._pixelRatio, this._height * this._pixelRatio, { type: HalfFloatType } );
28
+ renderTarget.texture.name = 'EffectComposer.rt1';
29
+
30
+ } else {
31
+
32
+ this._width = renderTarget.width;
33
+ this._height = renderTarget.height;
34
+
35
+ }
36
+
37
+ this.renderTarget1 = renderTarget;
38
+ this.renderTarget2 = renderTarget.clone();
39
+ this.renderTarget2.texture.name = 'EffectComposer.rt2';
40
+
41
+ this.writeBuffer = this.renderTarget1;
42
+ this.readBuffer = this.renderTarget2;
43
+
44
+ this.renderToScreen = true;
45
+
46
+ this.passes = [];
47
+
48
+ this.copyPass = new ShaderPass( CopyShader );
49
+ this.copyPass.material.blending = NoBlending;
50
+
51
+ this.clock = new Clock();
52
+
53
+ }
54
+
55
+ swapBuffers() {
56
+
57
+ const tmp = this.readBuffer;
58
+ this.readBuffer = this.writeBuffer;
59
+ this.writeBuffer = tmp;
60
+
61
+ }
62
+
63
+ addPass( pass ) {
64
+
65
+ this.passes.push( pass );
66
+ pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
67
+
68
+ }
69
+
70
+ insertPass( pass, index ) {
71
+
72
+ this.passes.splice( index, 0, pass );
73
+ pass.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
74
+
75
+ }
76
+
77
+ removePass( pass ) {
78
+
79
+ const index = this.passes.indexOf( pass );
80
+
81
+ if ( index !== - 1 ) {
82
+
83
+ this.passes.splice( index, 1 );
84
+
85
+ }
86
+
87
+ }
88
+
89
+ isLastEnabledPass( passIndex ) {
90
+
91
+ for ( let i = passIndex + 1; i < this.passes.length; i ++ ) {
92
+
93
+ if ( this.passes[ i ].enabled ) {
94
+
95
+ return false;
96
+
97
+ }
98
+
99
+ }
100
+
101
+ return true;
102
+
103
+ }
104
+
105
+ render( deltaTime ) {
106
+
107
+ // deltaTime value is in seconds
108
+
109
+ if ( deltaTime === undefined ) {
110
+
111
+ deltaTime = this.clock.getDelta();
112
+
113
+ }
114
+
115
+ const currentRenderTarget = this.renderer.getRenderTarget();
116
+
117
+ let maskActive = false;
118
+
119
+ for ( let i = 0, il = this.passes.length; i < il; i ++ ) {
120
+
121
+ const pass = this.passes[ i ];
122
+
123
+ if ( pass.enabled === false ) continue;
124
+
125
+ pass.renderToScreen = ( this.renderToScreen && this.isLastEnabledPass( i ) );
126
+ pass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime, maskActive );
127
+
128
+ if ( pass.needsSwap ) {
129
+
130
+ if ( maskActive ) {
131
+
132
+ const context = this.renderer.getContext();
133
+ const stencil = this.renderer.state.buffers.stencil;
134
+
135
+ //context.stencilFunc( context.NOTEQUAL, 1, 0xffffffff );
136
+ stencil.setFunc( context.NOTEQUAL, 1, 0xffffffff );
137
+
138
+ this.copyPass.render( this.renderer, this.writeBuffer, this.readBuffer, deltaTime );
139
+
140
+ //context.stencilFunc( context.EQUAL, 1, 0xffffffff );
141
+ stencil.setFunc( context.EQUAL, 1, 0xffffffff );
142
+
143
+ }
144
+
145
+ this.swapBuffers();
146
+
147
+ }
148
+
149
+ if ( MaskPass !== undefined ) {
150
+
151
+ if ( pass instanceof MaskPass ) {
152
+
153
+ maskActive = true;
154
+
155
+ } else if ( pass instanceof ClearMaskPass ) {
156
+
157
+ maskActive = false;
158
+
159
+ }
160
+
161
+ }
162
+
163
+ }
164
+
165
+ this.renderer.setRenderTarget( currentRenderTarget );
166
+
167
+ }
168
+
169
+ reset( renderTarget ) {
170
+
171
+ if ( renderTarget === undefined ) {
172
+
173
+ const size = this.renderer.getSize( new Vector2() );
174
+ this._pixelRatio = this.renderer.getPixelRatio();
175
+ this._width = size.width;
176
+ this._height = size.height;
177
+
178
+ renderTarget = this.renderTarget1.clone();
179
+ renderTarget.setSize( this._width * this._pixelRatio, this._height * this._pixelRatio );
180
+
181
+ }
182
+
183
+ this.renderTarget1.dispose();
184
+ this.renderTarget2.dispose();
185
+ this.renderTarget1 = renderTarget;
186
+ this.renderTarget2 = renderTarget.clone();
187
+
188
+ this.writeBuffer = this.renderTarget1;
189
+ this.readBuffer = this.renderTarget2;
190
+
191
+ }
192
+
193
+ setSize( width, height ) {
194
+
195
+ this._width = width;
196
+ this._height = height;
197
+
198
+ const effectiveWidth = this._width * this._pixelRatio;
199
+ const effectiveHeight = this._height * this._pixelRatio;
200
+
201
+ this.renderTarget1.setSize( effectiveWidth, effectiveHeight );
202
+ this.renderTarget2.setSize( effectiveWidth, effectiveHeight );
203
+
204
+ for ( let i = 0; i < this.passes.length; i ++ ) {
205
+
206
+ this.passes[ i ].setSize( effectiveWidth, effectiveHeight );
207
+
208
+ }
209
+
210
+ }
211
+
212
+ setPixelRatio( pixelRatio ) {
213
+
214
+ this._pixelRatio = pixelRatio;
215
+
216
+ this.setSize( this._width, this._height );
217
+
218
+ }
219
+
220
+ dispose() {
221
+
222
+ this.renderTarget1.dispose();
223
+ this.renderTarget2.dispose();
224
+
225
+ this.copyPass.dispose();
226
+
227
+ }
228
+
229
+ }
230
+
231
+ export { EffectComposer };
vendor/addons/postprocessing/MaskPass.js ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { Pass } from './Pass.js';
2
+
3
+ class MaskPass extends Pass {
4
+
5
+ constructor( scene, camera ) {
6
+
7
+ super();
8
+
9
+ this.scene = scene;
10
+ this.camera = camera;
11
+
12
+ this.clear = true;
13
+ this.needsSwap = false;
14
+
15
+ this.inverse = false;
16
+
17
+ }
18
+
19
+ render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
20
+
21
+ const context = renderer.getContext();
22
+ const state = renderer.state;
23
+
24
+ // don't update color or depth
25
+
26
+ state.buffers.color.setMask( false );
27
+ state.buffers.depth.setMask( false );
28
+
29
+ // lock buffers
30
+
31
+ state.buffers.color.setLocked( true );
32
+ state.buffers.depth.setLocked( true );
33
+
34
+ // set up stencil
35
+
36
+ let writeValue, clearValue;
37
+
38
+ if ( this.inverse ) {
39
+
40
+ writeValue = 0;
41
+ clearValue = 1;
42
+
43
+ } else {
44
+
45
+ writeValue = 1;
46
+ clearValue = 0;
47
+
48
+ }
49
+
50
+ state.buffers.stencil.setTest( true );
51
+ state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE );
52
+ state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff );
53
+ state.buffers.stencil.setClear( clearValue );
54
+ state.buffers.stencil.setLocked( true );
55
+
56
+ // draw into the stencil buffer
57
+
58
+ renderer.setRenderTarget( readBuffer );
59
+ if ( this.clear ) renderer.clear();
60
+ renderer.render( this.scene, this.camera );
61
+
62
+ renderer.setRenderTarget( writeBuffer );
63
+ if ( this.clear ) renderer.clear();
64
+ renderer.render( this.scene, this.camera );
65
+
66
+ // unlock color and depth buffer and make them writable for subsequent rendering/clearing
67
+
68
+ state.buffers.color.setLocked( false );
69
+ state.buffers.depth.setLocked( false );
70
+
71
+ state.buffers.color.setMask( true );
72
+ state.buffers.depth.setMask( true );
73
+
74
+ // only render where stencil is set to 1
75
+
76
+ state.buffers.stencil.setLocked( false );
77
+ state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1
78
+ state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP );
79
+ state.buffers.stencil.setLocked( true );
80
+
81
+ }
82
+
83
+ }
84
+
85
+ class ClearMaskPass extends Pass {
86
+
87
+ constructor() {
88
+
89
+ super();
90
+
91
+ this.needsSwap = false;
92
+
93
+ }
94
+
95
+ render( renderer /*, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
96
+
97
+ renderer.state.buffers.stencil.setLocked( false );
98
+ renderer.state.buffers.stencil.setTest( false );
99
+
100
+ }
101
+
102
+ }
103
+
104
+ export { MaskPass, ClearMaskPass };
vendor/addons/postprocessing/OutputPass.js ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ ColorManagement,
3
+ RawShaderMaterial,
4
+ UniformsUtils,
5
+ LinearToneMapping,
6
+ ReinhardToneMapping,
7
+ CineonToneMapping,
8
+ AgXToneMapping,
9
+ ACESFilmicToneMapping,
10
+ NeutralToneMapping,
11
+ SRGBTransfer
12
+ } from '../../three.module.min.js';
13
+ import { Pass, FullScreenQuad } from './Pass.js';
14
+ import { OutputShader } from '../shaders/OutputShader.js';
15
+
16
+ class OutputPass extends Pass {
17
+
18
+ constructor() {
19
+
20
+ super();
21
+
22
+ //
23
+
24
+ const shader = OutputShader;
25
+
26
+ this.uniforms = UniformsUtils.clone( shader.uniforms );
27
+
28
+ this.material = new RawShaderMaterial( {
29
+ name: shader.name,
30
+ uniforms: this.uniforms,
31
+ vertexShader: shader.vertexShader,
32
+ fragmentShader: shader.fragmentShader
33
+ } );
34
+
35
+ this.fsQuad = new FullScreenQuad( this.material );
36
+
37
+ // internal cache
38
+
39
+ this._outputColorSpace = null;
40
+ this._toneMapping = null;
41
+
42
+ }
43
+
44
+ render( renderer, writeBuffer, readBuffer/*, deltaTime, maskActive */ ) {
45
+
46
+ this.uniforms[ 'tDiffuse' ].value = readBuffer.texture;
47
+ this.uniforms[ 'toneMappingExposure' ].value = renderer.toneMappingExposure;
48
+
49
+ // rebuild defines if required
50
+
51
+ if ( this._outputColorSpace !== renderer.outputColorSpace || this._toneMapping !== renderer.toneMapping ) {
52
+
53
+ this._outputColorSpace = renderer.outputColorSpace;
54
+ this._toneMapping = renderer.toneMapping;
55
+
56
+ this.material.defines = {};
57
+
58
+ if ( ColorManagement.getTransfer( this._outputColorSpace ) === SRGBTransfer ) this.material.defines.SRGB_TRANSFER = '';
59
+
60
+ if ( this._toneMapping === LinearToneMapping ) this.material.defines.LINEAR_TONE_MAPPING = '';
61
+ else if ( this._toneMapping === ReinhardToneMapping ) this.material.defines.REINHARD_TONE_MAPPING = '';
62
+ else if ( this._toneMapping === CineonToneMapping ) this.material.defines.CINEON_TONE_MAPPING = '';
63
+ else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = '';
64
+ else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = '';
65
+ else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = '';
66
+
67
+ this.material.needsUpdate = true;
68
+
69
+ }
70
+
71
+ //
72
+
73
+ if ( this.renderToScreen === true ) {
74
+
75
+ renderer.setRenderTarget( null );
76
+ this.fsQuad.render( renderer );
77
+
78
+ } else {
79
+
80
+ renderer.setRenderTarget( writeBuffer );
81
+ if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
82
+ this.fsQuad.render( renderer );
83
+
84
+ }
85
+
86
+ }
87
+
88
+ dispose() {
89
+
90
+ this.material.dispose();
91
+ this.fsQuad.dispose();
92
+
93
+ }
94
+
95
+ }
96
+
97
+ export { OutputPass };
vendor/addons/postprocessing/Pass.js ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ BufferGeometry,
3
+ Float32BufferAttribute,
4
+ OrthographicCamera,
5
+ Mesh
6
+ } from '../../three.module.min.js';
7
+
8
+ class Pass {
9
+
10
+ constructor() {
11
+
12
+ this.isPass = true;
13
+
14
+ // if set to true, the pass is processed by the composer
15
+ this.enabled = true;
16
+
17
+ // if set to true, the pass indicates to swap read and write buffer after rendering
18
+ this.needsSwap = true;
19
+
20
+ // if set to true, the pass clears its buffer before rendering
21
+ this.clear = false;
22
+
23
+ // if set to true, the result of the pass is rendered to screen. This is set automatically by EffectComposer.
24
+ this.renderToScreen = false;
25
+
26
+ }
27
+
28
+ setSize( /* width, height */ ) {}
29
+
30
+ render( /* renderer, writeBuffer, readBuffer, deltaTime, maskActive */ ) {
31
+
32
+ console.error( 'THREE.Pass: .render() must be implemented in derived pass.' );
33
+
34
+ }
35
+
36
+ dispose() {}
37
+
38
+ }
39
+
40
+ // Helper for passes that need to fill the viewport with a single quad.
41
+
42
+ const _camera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
43
+
44
+ // https://github.com/mrdoob/three.js/pull/21358
45
+
46
+ class FullscreenTriangleGeometry extends BufferGeometry {
47
+
48
+ constructor() {
49
+
50
+ super();
51
+
52
+ this.setAttribute( 'position', new Float32BufferAttribute( [ - 1, 3, 0, - 1, - 1, 0, 3, - 1, 0 ], 3 ) );
53
+ this.setAttribute( 'uv', new Float32BufferAttribute( [ 0, 2, 0, 0, 2, 0 ], 2 ) );
54
+
55
+ }
56
+
57
+ }
58
+
59
+ const _geometry = new FullscreenTriangleGeometry();
60
+
61
+ class FullScreenQuad {
62
+
63
+ constructor( material ) {
64
+
65
+ this._mesh = new Mesh( _geometry, material );
66
+
67
+ }
68
+
69
+ dispose() {
70
+
71
+ this._mesh.geometry.dispose();
72
+
73
+ }
74
+
75
+ render( renderer ) {
76
+
77
+ renderer.render( this._mesh, _camera );
78
+
79
+ }
80
+
81
+ get material() {
82
+
83
+ return this._mesh.material;
84
+
85
+ }
86
+
87
+ set material( value ) {
88
+
89
+ this._mesh.material = value;
90
+
91
+ }
92
+
93
+ }
94
+
95
+ export { Pass, FullScreenQuad };
vendor/addons/postprocessing/RenderPass.js ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ Color
3
+ } from '../../three.module.min.js';
4
+ import { Pass } from './Pass.js';
5
+
6
+ class RenderPass extends Pass {
7
+
8
+ constructor( scene, camera, overrideMaterial = null, clearColor = null, clearAlpha = null ) {
9
+
10
+ super();
11
+
12
+ this.scene = scene;
13
+ this.camera = camera;
14
+
15
+ this.overrideMaterial = overrideMaterial;
16
+
17
+ this.clearColor = clearColor;
18
+ this.clearAlpha = clearAlpha;
19
+
20
+ this.clear = true;
21
+ this.clearDepth = false;
22
+ this.needsSwap = false;
23
+ this._oldClearColor = new Color();
24
+
25
+ }
26
+
27
+ render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
28
+
29
+ const oldAutoClear = renderer.autoClear;
30
+ renderer.autoClear = false;
31
+
32
+ let oldClearAlpha, oldOverrideMaterial;
33
+
34
+ if ( this.overrideMaterial !== null ) {
35
+
36
+ oldOverrideMaterial = this.scene.overrideMaterial;
37
+
38
+ this.scene.overrideMaterial = this.overrideMaterial;
39
+
40
+ }
41
+
42
+ if ( this.clearColor !== null ) {
43
+
44
+ renderer.getClearColor( this._oldClearColor );
45
+ renderer.setClearColor( this.clearColor, renderer.getClearAlpha() );
46
+
47
+ }
48
+
49
+ if ( this.clearAlpha !== null ) {
50
+
51
+ oldClearAlpha = renderer.getClearAlpha();
52
+ renderer.setClearAlpha( this.clearAlpha );
53
+
54
+ }
55
+
56
+ if ( this.clearDepth == true ) {
57
+
58
+ renderer.clearDepth();
59
+
60
+ }
61
+
62
+ renderer.setRenderTarget( this.renderToScreen ? null : readBuffer );
63
+
64
+ if ( this.clear === true ) {
65
+
66
+ // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
67
+ renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
68
+
69
+ }
70
+
71
+ renderer.render( this.scene, this.camera );
72
+
73
+ // restore
74
+
75
+ if ( this.clearColor !== null ) {
76
+
77
+ renderer.setClearColor( this._oldClearColor );
78
+
79
+ }
80
+
81
+ if ( this.clearAlpha !== null ) {
82
+
83
+ renderer.setClearAlpha( oldClearAlpha );
84
+
85
+ }
86
+
87
+ if ( this.overrideMaterial !== null ) {
88
+
89
+ this.scene.overrideMaterial = oldOverrideMaterial;
90
+
91
+ }
92
+
93
+ renderer.autoClear = oldAutoClear;
94
+
95
+ }
96
+
97
+ }
98
+
99
+ export { RenderPass };
vendor/addons/postprocessing/ShaderPass.js ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ ShaderMaterial,
3
+ UniformsUtils
4
+ } from '../../three.module.min.js';
5
+ import { Pass, FullScreenQuad } from './Pass.js';
6
+
7
+ class ShaderPass extends Pass {
8
+
9
+ constructor( shader, textureID ) {
10
+
11
+ super();
12
+
13
+ this.textureID = ( textureID !== undefined ) ? textureID : 'tDiffuse';
14
+
15
+ if ( shader instanceof ShaderMaterial ) {
16
+
17
+ this.uniforms = shader.uniforms;
18
+
19
+ this.material = shader;
20
+
21
+ } else if ( shader ) {
22
+
23
+ this.uniforms = UniformsUtils.clone( shader.uniforms );
24
+
25
+ this.material = new ShaderMaterial( {
26
+
27
+ name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
28
+ defines: Object.assign( {}, shader.defines ),
29
+ uniforms: this.uniforms,
30
+ vertexShader: shader.vertexShader,
31
+ fragmentShader: shader.fragmentShader
32
+
33
+ } );
34
+
35
+ }
36
+
37
+ this.fsQuad = new FullScreenQuad( this.material );
38
+
39
+ }
40
+
41
+ render( renderer, writeBuffer, readBuffer /*, deltaTime, maskActive */ ) {
42
+
43
+ if ( this.uniforms[ this.textureID ] ) {
44
+
45
+ this.uniforms[ this.textureID ].value = readBuffer.texture;
46
+
47
+ }
48
+
49
+ this.fsQuad.material = this.material;
50
+
51
+ if ( this.renderToScreen ) {
52
+
53
+ renderer.setRenderTarget( null );
54
+ this.fsQuad.render( renderer );
55
+
56
+ } else {
57
+
58
+ renderer.setRenderTarget( writeBuffer );
59
+ // TODO: Avoid using autoClear properties, see https://github.com/mrdoob/three.js/pull/15571#issuecomment-465669600
60
+ if ( this.clear ) renderer.clear( renderer.autoClearColor, renderer.autoClearDepth, renderer.autoClearStencil );
61
+ this.fsQuad.render( renderer );
62
+
63
+ }
64
+
65
+ }
66
+
67
+ dispose() {
68
+
69
+ this.material.dispose();
70
+
71
+ this.fsQuad.dispose();
72
+
73
+ }
74
+
75
+ }
76
+
77
+ export { ShaderPass };
vendor/addons/postprocessing/UnrealBloomPass.js ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ AdditiveBlending,
3
+ Color,
4
+ HalfFloatType,
5
+ MeshBasicMaterial,
6
+ ShaderMaterial,
7
+ UniformsUtils,
8
+ Vector2,
9
+ Vector3,
10
+ WebGLRenderTarget
11
+ } from '../../three.module.min.js';
12
+ import { Pass, FullScreenQuad } from './Pass.js';
13
+ import { CopyShader } from '../shaders/CopyShader.js';
14
+ import { LuminosityHighPassShader } from '../shaders/LuminosityHighPassShader.js';
15
+
16
+ /**
17
+ * UnrealBloomPass is inspired by the bloom pass of Unreal Engine. It creates a
18
+ * mip map chain of bloom textures and blurs them with different radii. Because
19
+ * of the weighted combination of mips, and because larger blurs are done on
20
+ * higher mips, this effect provides good quality and performance.
21
+ *
22
+ * Reference:
23
+ * - https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/
24
+ */
25
+ class UnrealBloomPass extends Pass {
26
+
27
+ constructor( resolution, strength, radius, threshold ) {
28
+
29
+ super();
30
+
31
+ this.strength = ( strength !== undefined ) ? strength : 1;
32
+ this.radius = radius;
33
+ this.threshold = threshold;
34
+ this.resolution = ( resolution !== undefined ) ? new Vector2( resolution.x, resolution.y ) : new Vector2( 256, 256 );
35
+
36
+ // create color only once here, reuse it later inside the render function
37
+ this.clearColor = new Color( 0, 0, 0 );
38
+
39
+ // render targets
40
+ this.renderTargetsHorizontal = [];
41
+ this.renderTargetsVertical = [];
42
+ this.nMips = 5;
43
+ let resx = Math.round( this.resolution.x / 2 );
44
+ let resy = Math.round( this.resolution.y / 2 );
45
+
46
+ this.renderTargetBright = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } );
47
+ this.renderTargetBright.texture.name = 'UnrealBloomPass.bright';
48
+ this.renderTargetBright.texture.generateMipmaps = false;
49
+
50
+ for ( let i = 0; i < this.nMips; i ++ ) {
51
+
52
+ const renderTargetHorizontal = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } );
53
+
54
+ renderTargetHorizontal.texture.name = 'UnrealBloomPass.h' + i;
55
+ renderTargetHorizontal.texture.generateMipmaps = false;
56
+
57
+ this.renderTargetsHorizontal.push( renderTargetHorizontal );
58
+
59
+ const renderTargetVertical = new WebGLRenderTarget( resx, resy, { type: HalfFloatType } );
60
+
61
+ renderTargetVertical.texture.name = 'UnrealBloomPass.v' + i;
62
+ renderTargetVertical.texture.generateMipmaps = false;
63
+
64
+ this.renderTargetsVertical.push( renderTargetVertical );
65
+
66
+ resx = Math.round( resx / 2 );
67
+
68
+ resy = Math.round( resy / 2 );
69
+
70
+ }
71
+
72
+ // luminosity high pass material
73
+
74
+ const highPassShader = LuminosityHighPassShader;
75
+ this.highPassUniforms = UniformsUtils.clone( highPassShader.uniforms );
76
+
77
+ this.highPassUniforms[ 'luminosityThreshold' ].value = threshold;
78
+ this.highPassUniforms[ 'smoothWidth' ].value = 0.01;
79
+
80
+ this.materialHighPassFilter = new ShaderMaterial( {
81
+ uniforms: this.highPassUniforms,
82
+ vertexShader: highPassShader.vertexShader,
83
+ fragmentShader: highPassShader.fragmentShader
84
+ } );
85
+
86
+ // gaussian blur materials
87
+
88
+ this.separableBlurMaterials = [];
89
+ const kernelSizeArray = [ 3, 5, 7, 9, 11 ];
90
+ resx = Math.round( this.resolution.x / 2 );
91
+ resy = Math.round( this.resolution.y / 2 );
92
+
93
+ for ( let i = 0; i < this.nMips; i ++ ) {
94
+
95
+ this.separableBlurMaterials.push( this.getSeperableBlurMaterial( kernelSizeArray[ i ] ) );
96
+
97
+ this.separableBlurMaterials[ i ].uniforms[ 'invSize' ].value = new Vector2( 1 / resx, 1 / resy );
98
+
99
+ resx = Math.round( resx / 2 );
100
+
101
+ resy = Math.round( resy / 2 );
102
+
103
+ }
104
+
105
+ // composite material
106
+
107
+ this.compositeMaterial = this.getCompositeMaterial( this.nMips );
108
+ this.compositeMaterial.uniforms[ 'blurTexture1' ].value = this.renderTargetsVertical[ 0 ].texture;
109
+ this.compositeMaterial.uniforms[ 'blurTexture2' ].value = this.renderTargetsVertical[ 1 ].texture;
110
+ this.compositeMaterial.uniforms[ 'blurTexture3' ].value = this.renderTargetsVertical[ 2 ].texture;
111
+ this.compositeMaterial.uniforms[ 'blurTexture4' ].value = this.renderTargetsVertical[ 3 ].texture;
112
+ this.compositeMaterial.uniforms[ 'blurTexture5' ].value = this.renderTargetsVertical[ 4 ].texture;
113
+ this.compositeMaterial.uniforms[ 'bloomStrength' ].value = strength;
114
+ this.compositeMaterial.uniforms[ 'bloomRadius' ].value = 0.1;
115
+
116
+ const bloomFactors = [ 1.0, 0.8, 0.6, 0.4, 0.2 ];
117
+ this.compositeMaterial.uniforms[ 'bloomFactors' ].value = bloomFactors;
118
+ this.bloomTintColors = [ new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ), new Vector3( 1, 1, 1 ) ];
119
+ this.compositeMaterial.uniforms[ 'bloomTintColors' ].value = this.bloomTintColors;
120
+
121
+ // blend material
122
+
123
+ const copyShader = CopyShader;
124
+
125
+ this.copyUniforms = UniformsUtils.clone( copyShader.uniforms );
126
+
127
+ this.blendMaterial = new ShaderMaterial( {
128
+ uniforms: this.copyUniforms,
129
+ vertexShader: copyShader.vertexShader,
130
+ fragmentShader: copyShader.fragmentShader,
131
+ blending: AdditiveBlending,
132
+ depthTest: false,
133
+ depthWrite: false,
134
+ transparent: true
135
+ } );
136
+
137
+ this.enabled = true;
138
+ this.needsSwap = false;
139
+
140
+ this._oldClearColor = new Color();
141
+ this.oldClearAlpha = 1;
142
+
143
+ this.basic = new MeshBasicMaterial();
144
+
145
+ this.fsQuad = new FullScreenQuad( null );
146
+
147
+ }
148
+
149
+ dispose() {
150
+
151
+ for ( let i = 0; i < this.renderTargetsHorizontal.length; i ++ ) {
152
+
153
+ this.renderTargetsHorizontal[ i ].dispose();
154
+
155
+ }
156
+
157
+ for ( let i = 0; i < this.renderTargetsVertical.length; i ++ ) {
158
+
159
+ this.renderTargetsVertical[ i ].dispose();
160
+
161
+ }
162
+
163
+ this.renderTargetBright.dispose();
164
+
165
+ //
166
+
167
+ for ( let i = 0; i < this.separableBlurMaterials.length; i ++ ) {
168
+
169
+ this.separableBlurMaterials[ i ].dispose();
170
+
171
+ }
172
+
173
+ this.compositeMaterial.dispose();
174
+ this.blendMaterial.dispose();
175
+ this.basic.dispose();
176
+
177
+ //
178
+
179
+ this.fsQuad.dispose();
180
+
181
+ }
182
+
183
+ setSize( width, height ) {
184
+
185
+ let resx = Math.round( width / 2 );
186
+ let resy = Math.round( height / 2 );
187
+
188
+ this.renderTargetBright.setSize( resx, resy );
189
+
190
+ for ( let i = 0; i < this.nMips; i ++ ) {
191
+
192
+ this.renderTargetsHorizontal[ i ].setSize( resx, resy );
193
+ this.renderTargetsVertical[ i ].setSize( resx, resy );
194
+
195
+ this.separableBlurMaterials[ i ].uniforms[ 'invSize' ].value = new Vector2( 1 / resx, 1 / resy );
196
+
197
+ resx = Math.round( resx / 2 );
198
+ resy = Math.round( resy / 2 );
199
+
200
+ }
201
+
202
+ }
203
+
204
+ render( renderer, writeBuffer, readBuffer, deltaTime, maskActive ) {
205
+
206
+ renderer.getClearColor( this._oldClearColor );
207
+ this.oldClearAlpha = renderer.getClearAlpha();
208
+ const oldAutoClear = renderer.autoClear;
209
+ renderer.autoClear = false;
210
+
211
+ renderer.setClearColor( this.clearColor, 0 );
212
+
213
+ if ( maskActive ) renderer.state.buffers.stencil.setTest( false );
214
+
215
+ // Render input to screen
216
+
217
+ if ( this.renderToScreen ) {
218
+
219
+ this.fsQuad.material = this.basic;
220
+ this.basic.map = readBuffer.texture;
221
+
222
+ renderer.setRenderTarget( null );
223
+ renderer.clear();
224
+ this.fsQuad.render( renderer );
225
+
226
+ }
227
+
228
+ // 1. Extract Bright Areas
229
+
230
+ this.highPassUniforms[ 'tDiffuse' ].value = readBuffer.texture;
231
+ this.highPassUniforms[ 'luminosityThreshold' ].value = this.threshold;
232
+ this.fsQuad.material = this.materialHighPassFilter;
233
+
234
+ renderer.setRenderTarget( this.renderTargetBright );
235
+ renderer.clear();
236
+ this.fsQuad.render( renderer );
237
+
238
+ // 2. Blur All the mips progressively
239
+
240
+ let inputRenderTarget = this.renderTargetBright;
241
+
242
+ for ( let i = 0; i < this.nMips; i ++ ) {
243
+
244
+ this.fsQuad.material = this.separableBlurMaterials[ i ];
245
+
246
+ this.separableBlurMaterials[ i ].uniforms[ 'colorTexture' ].value = inputRenderTarget.texture;
247
+ this.separableBlurMaterials[ i ].uniforms[ 'direction' ].value = UnrealBloomPass.BlurDirectionX;
248
+ renderer.setRenderTarget( this.renderTargetsHorizontal[ i ] );
249
+ renderer.clear();
250
+ this.fsQuad.render( renderer );
251
+
252
+ this.separableBlurMaterials[ i ].uniforms[ 'colorTexture' ].value = this.renderTargetsHorizontal[ i ].texture;
253
+ this.separableBlurMaterials[ i ].uniforms[ 'direction' ].value = UnrealBloomPass.BlurDirectionY;
254
+ renderer.setRenderTarget( this.renderTargetsVertical[ i ] );
255
+ renderer.clear();
256
+ this.fsQuad.render( renderer );
257
+
258
+ inputRenderTarget = this.renderTargetsVertical[ i ];
259
+
260
+ }
261
+
262
+ // Composite All the mips
263
+
264
+ this.fsQuad.material = this.compositeMaterial;
265
+ this.compositeMaterial.uniforms[ 'bloomStrength' ].value = this.strength;
266
+ this.compositeMaterial.uniforms[ 'bloomRadius' ].value = this.radius;
267
+ this.compositeMaterial.uniforms[ 'bloomTintColors' ].value = this.bloomTintColors;
268
+
269
+ renderer.setRenderTarget( this.renderTargetsHorizontal[ 0 ] );
270
+ renderer.clear();
271
+ this.fsQuad.render( renderer );
272
+
273
+ // Blend it additively over the input texture
274
+
275
+ this.fsQuad.material = this.blendMaterial;
276
+ this.copyUniforms[ 'tDiffuse' ].value = this.renderTargetsHorizontal[ 0 ].texture;
277
+
278
+ if ( maskActive ) renderer.state.buffers.stencil.setTest( true );
279
+
280
+ if ( this.renderToScreen ) {
281
+
282
+ renderer.setRenderTarget( null );
283
+ this.fsQuad.render( renderer );
284
+
285
+ } else {
286
+
287
+ renderer.setRenderTarget( readBuffer );
288
+ this.fsQuad.render( renderer );
289
+
290
+ }
291
+
292
+ // Restore renderer settings
293
+
294
+ renderer.setClearColor( this._oldClearColor, this.oldClearAlpha );
295
+ renderer.autoClear = oldAutoClear;
296
+
297
+ }
298
+
299
+ getSeperableBlurMaterial( kernelRadius ) {
300
+
301
+ const coefficients = [];
302
+
303
+ for ( let i = 0; i < kernelRadius; i ++ ) {
304
+
305
+ coefficients.push( 0.39894 * Math.exp( - 0.5 * i * i / ( kernelRadius * kernelRadius ) ) / kernelRadius );
306
+
307
+ }
308
+
309
+ return new ShaderMaterial( {
310
+
311
+ defines: {
312
+ 'KERNEL_RADIUS': kernelRadius
313
+ },
314
+
315
+ uniforms: {
316
+ 'colorTexture': { value: null },
317
+ 'invSize': { value: new Vector2( 0.5, 0.5 ) }, // inverse texture size
318
+ 'direction': { value: new Vector2( 0.5, 0.5 ) },
319
+ 'gaussianCoefficients': { value: coefficients } // precomputed Gaussian coefficients
320
+ },
321
+
322
+ vertexShader:
323
+ `varying vec2 vUv;
324
+ void main() {
325
+ vUv = uv;
326
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
327
+ }`,
328
+
329
+ fragmentShader:
330
+ `#include <common>
331
+ varying vec2 vUv;
332
+ uniform sampler2D colorTexture;
333
+ uniform vec2 invSize;
334
+ uniform vec2 direction;
335
+ uniform float gaussianCoefficients[KERNEL_RADIUS];
336
+
337
+ void main() {
338
+ float weightSum = gaussianCoefficients[0];
339
+ vec3 diffuseSum = texture2D( colorTexture, vUv ).rgb * weightSum;
340
+ for( int i = 1; i < KERNEL_RADIUS; i ++ ) {
341
+ float x = float(i);
342
+ float w = gaussianCoefficients[i];
343
+ vec2 uvOffset = direction * invSize * x;
344
+ vec3 sample1 = texture2D( colorTexture, vUv + uvOffset ).rgb;
345
+ vec3 sample2 = texture2D( colorTexture, vUv - uvOffset ).rgb;
346
+ diffuseSum += (sample1 + sample2) * w;
347
+ weightSum += 2.0 * w;
348
+ }
349
+ gl_FragColor = vec4(diffuseSum/weightSum, 1.0);
350
+ }`
351
+ } );
352
+
353
+ }
354
+
355
+ getCompositeMaterial( nMips ) {
356
+
357
+ return new ShaderMaterial( {
358
+
359
+ defines: {
360
+ 'NUM_MIPS': nMips
361
+ },
362
+
363
+ uniforms: {
364
+ 'blurTexture1': { value: null },
365
+ 'blurTexture2': { value: null },
366
+ 'blurTexture3': { value: null },
367
+ 'blurTexture4': { value: null },
368
+ 'blurTexture5': { value: null },
369
+ 'bloomStrength': { value: 1.0 },
370
+ 'bloomFactors': { value: null },
371
+ 'bloomTintColors': { value: null },
372
+ 'bloomRadius': { value: 0.0 }
373
+ },
374
+
375
+ vertexShader:
376
+ `varying vec2 vUv;
377
+ void main() {
378
+ vUv = uv;
379
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
380
+ }`,
381
+
382
+ fragmentShader:
383
+ `varying vec2 vUv;
384
+ uniform sampler2D blurTexture1;
385
+ uniform sampler2D blurTexture2;
386
+ uniform sampler2D blurTexture3;
387
+ uniform sampler2D blurTexture4;
388
+ uniform sampler2D blurTexture5;
389
+ uniform float bloomStrength;
390
+ uniform float bloomRadius;
391
+ uniform float bloomFactors[NUM_MIPS];
392
+ uniform vec3 bloomTintColors[NUM_MIPS];
393
+
394
+ float lerpBloomFactor(const in float factor) {
395
+ float mirrorFactor = 1.2 - factor;
396
+ return mix(factor, mirrorFactor, bloomRadius);
397
+ }
398
+
399
+ void main() {
400
+ gl_FragColor = bloomStrength * ( lerpBloomFactor(bloomFactors[0]) * vec4(bloomTintColors[0], 1.0) * texture2D(blurTexture1, vUv) +
401
+ lerpBloomFactor(bloomFactors[1]) * vec4(bloomTintColors[1], 1.0) * texture2D(blurTexture2, vUv) +
402
+ lerpBloomFactor(bloomFactors[2]) * vec4(bloomTintColors[2], 1.0) * texture2D(blurTexture3, vUv) +
403
+ lerpBloomFactor(bloomFactors[3]) * vec4(bloomTintColors[3], 1.0) * texture2D(blurTexture4, vUv) +
404
+ lerpBloomFactor(bloomFactors[4]) * vec4(bloomTintColors[4], 1.0) * texture2D(blurTexture5, vUv) );
405
+ }`
406
+ } );
407
+
408
+ }
409
+
410
+ }
411
+
412
+ UnrealBloomPass.BlurDirectionX = new Vector2( 1.0, 0.0 );
413
+ UnrealBloomPass.BlurDirectionY = new Vector2( 0.0, 1.0 );
414
+
415
+ export { UnrealBloomPass };
vendor/addons/shaders/CopyShader.js ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Full-screen textured quad shader
3
+ */
4
+
5
+ const CopyShader = {
6
+
7
+ name: 'CopyShader',
8
+
9
+ uniforms: {
10
+
11
+ 'tDiffuse': { value: null },
12
+ 'opacity': { value: 1.0 }
13
+
14
+ },
15
+
16
+ vertexShader: /* glsl */`
17
+
18
+ varying vec2 vUv;
19
+
20
+ void main() {
21
+
22
+ vUv = uv;
23
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
24
+
25
+ }`,
26
+
27
+ fragmentShader: /* glsl */`
28
+
29
+ uniform float opacity;
30
+
31
+ uniform sampler2D tDiffuse;
32
+
33
+ varying vec2 vUv;
34
+
35
+ void main() {
36
+
37
+ vec4 texel = texture2D( tDiffuse, vUv );
38
+ gl_FragColor = opacity * texel;
39
+
40
+
41
+ }`
42
+
43
+ };
44
+
45
+ export { CopyShader };
vendor/addons/shaders/LuminosityHighPassShader.js ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import {
2
+ Color
3
+ } from '../../three.module.min.js';
4
+
5
+ /**
6
+ * Luminosity
7
+ * http://en.wikipedia.org/wiki/Luminosity
8
+ */
9
+
10
+ const LuminosityHighPassShader = {
11
+
12
+ name: 'LuminosityHighPassShader',
13
+
14
+ shaderID: 'luminosityHighPass',
15
+
16
+ uniforms: {
17
+
18
+ 'tDiffuse': { value: null },
19
+ 'luminosityThreshold': { value: 1.0 },
20
+ 'smoothWidth': { value: 1.0 },
21
+ 'defaultColor': { value: new Color( 0x000000 ) },
22
+ 'defaultOpacity': { value: 0.0 }
23
+
24
+ },
25
+
26
+ vertexShader: /* glsl */`
27
+
28
+ varying vec2 vUv;
29
+
30
+ void main() {
31
+
32
+ vUv = uv;
33
+
34
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
35
+
36
+ }`,
37
+
38
+ fragmentShader: /* glsl */`
39
+
40
+ uniform sampler2D tDiffuse;
41
+ uniform vec3 defaultColor;
42
+ uniform float defaultOpacity;
43
+ uniform float luminosityThreshold;
44
+ uniform float smoothWidth;
45
+
46
+ varying vec2 vUv;
47
+
48
+ void main() {
49
+
50
+ vec4 texel = texture2D( tDiffuse, vUv );
51
+
52
+ float v = luminance( texel.xyz );
53
+
54
+ vec4 outputColor = vec4( defaultColor.rgb, defaultOpacity );
55
+
56
+ float alpha = smoothstep( luminosityThreshold, luminosityThreshold + smoothWidth, v );
57
+
58
+ gl_FragColor = mix( outputColor, texel, alpha );
59
+
60
+ }`
61
+
62
+ };
63
+
64
+ export { LuminosityHighPassShader };
vendor/addons/shaders/OutputShader.js ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const OutputShader = {
2
+
3
+ name: 'OutputShader',
4
+
5
+ uniforms: {
6
+
7
+ 'tDiffuse': { value: null },
8
+ 'toneMappingExposure': { value: 1 }
9
+
10
+ },
11
+
12
+ vertexShader: /* glsl */`
13
+ precision highp float;
14
+
15
+ uniform mat4 modelViewMatrix;
16
+ uniform mat4 projectionMatrix;
17
+
18
+ attribute vec3 position;
19
+ attribute vec2 uv;
20
+
21
+ varying vec2 vUv;
22
+
23
+ void main() {
24
+
25
+ vUv = uv;
26
+ gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
27
+
28
+ }`,
29
+
30
+ fragmentShader: /* glsl */`
31
+
32
+ precision highp float;
33
+
34
+ uniform sampler2D tDiffuse;
35
+
36
+ #include <tonemapping_pars_fragment>
37
+ #include <colorspace_pars_fragment>
38
+
39
+ varying vec2 vUv;
40
+
41
+ void main() {
42
+
43
+ gl_FragColor = texture2D( tDiffuse, vUv );
44
+
45
+ // tone mapping
46
+
47
+ #ifdef LINEAR_TONE_MAPPING
48
+
49
+ gl_FragColor.rgb = LinearToneMapping( gl_FragColor.rgb );
50
+
51
+ #elif defined( REINHARD_TONE_MAPPING )
52
+
53
+ gl_FragColor.rgb = ReinhardToneMapping( gl_FragColor.rgb );
54
+
55
+ #elif defined( CINEON_TONE_MAPPING )
56
+
57
+ gl_FragColor.rgb = CineonToneMapping( gl_FragColor.rgb );
58
+
59
+ #elif defined( ACES_FILMIC_TONE_MAPPING )
60
+
61
+ gl_FragColor.rgb = ACESFilmicToneMapping( gl_FragColor.rgb );
62
+
63
+ #elif defined( AGX_TONE_MAPPING )
64
+
65
+ gl_FragColor.rgb = AgXToneMapping( gl_FragColor.rgb );
66
+
67
+ #elif defined( NEUTRAL_TONE_MAPPING )
68
+
69
+ gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
70
+
71
+ #endif
72
+
73
+ // color space
74
+
75
+ #ifdef SRGB_TRANSFER
76
+
77
+ gl_FragColor = sRGBTransferOETF( gl_FragColor );
78
+
79
+ #endif
80
+
81
+ }`
82
+
83
+ };
84
+
85
+ export { OutputShader };