2026-03-24 19:58:25 +00:00
|
|
|
// === THE NEXUS — Main Entry Point ===
|
2026-03-24 03:58:50 +00:00
|
|
|
import * as THREE from 'three';
|
2026-03-24 19:41:43 +00:00
|
|
|
import { S, Broadcaster } from './modules/state.js';
|
refactor: split app.js (5416 lines) into 21 modules — hard cap 1000 lines/file
app.js: 5416 → 528 lines (entry point, animation loop, event wiring)
modules/state.js: shared mutable state object
modules/constants.js: color palette
modules/matrix-rain.js: matrix rain canvas effect
modules/scene-setup.js: scene, camera, renderer, lighting, stars
modules/platform.js: glass platform, perlin noise, floating island, clouds
modules/heatmap.js: commit heatmap
modules/sigil.js: Timmy sigil
modules/controls.js: mouse, overview, zoom, photo mode
modules/effects.js: energy beam, sovereignty meter, rune ring
modules/earth.js: holographic earth
modules/warp.js: warp tunnel, crystals, lightning
modules/dual-brain.js: dual-brain holographic panel
modules/audio.js: Web Audio, spatial, portal hums
modules/debug.js: debug mode, websocket, session export
modules/celebrations.js: easter egg, shockwave, fireworks
modules/portals.js: portal loading
modules/bookshelves.js: floating bookshelves, spine textures
modules/oath.js: The Oath interactive SOUL.md
modules/panels.js: agent status board, LoRA panel
modules/weather.js: weather system, portal health
modules/extras.js: gravity zones, speech, timelapse, bitcoin
Largest file: 528 lines (app.js). No file exceeds 1000.
All files pass node --check. No refactoring — mechanical split only.
2026-03-24 15:12:15 -04:00
|
|
|
import { NEXUS } from './modules/constants.js';
|
2026-03-24 19:41:43 +00:00
|
|
|
import { scene, camera, renderer, composer } from './modules/scene-setup.js';
|
2026-03-24 19:58:25 +00:00
|
|
|
import { clock, warpPass } from './modules/warp.js';
|
|
|
|
|
import { nostr } from './modules/nostr.js';
|
|
|
|
|
import { createNostrPanelTexture } from './modules/nostr-panel.js';
|
|
|
|
|
|
|
|
|
|
// === NOSTR INIT ===
|
|
|
|
|
nostr.connect();
|
|
|
|
|
const { canvas: nostrCanvas, update: updateNostrUI } = createNostrPanelTexture();
|
|
|
|
|
const nostrTexture = new THREE.CanvasTexture(nostrCanvas);
|
|
|
|
|
const nostrMat = new THREE.MeshBasicMaterial({ map: nostrTexture, transparent: true, side: THREE.DoubleSide });
|
|
|
|
|
const nostrPanel = new THREE.Mesh(new THREE.PlaneGeometry(3, 3), nostrMat);
|
|
|
|
|
nostrPanel.position.set(-6, 3.5, -7.5);
|
|
|
|
|
nostrPanel.rotation.y = 0.4;
|
|
|
|
|
scene.add(nostrPanel);
|
2026-03-24 05:14:30 +00:00
|
|
|
|
2026-03-24 19:41:43 +00:00
|
|
|
// === MAIN ANIMATION LOOP ===
|
|
|
|
|
function animate() {
|
|
|
|
|
requestAnimationFrame(animate);
|
|
|
|
|
const delta = clock.getDelta();
|
|
|
|
|
const elapsed = clock.elapsedTime;
|
2026-03-24 05:14:30 +00:00
|
|
|
|
2026-03-24 19:58:25 +00:00
|
|
|
// Update Nostr UI periodically or on event
|
|
|
|
|
if (Math.random() > 0.95) {
|
|
|
|
|
updateNostrUI();
|
|
|
|
|
nostrTexture.needsUpdate = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Visual pulse on energy beam
|
|
|
|
|
if (S.energyBeamPulse > 0) {
|
|
|
|
|
S.energyBeamPulse -= delta * 2;
|
|
|
|
|
if (S.energyBeamPulse < 0) S.energyBeamPulse = 0;
|
2026-03-24 05:14:30 +00:00
|
|
|
}
|
|
|
|
|
|
refactor: split app.js (5416 lines) into 21 modules — hard cap 1000 lines/file
app.js: 5416 → 528 lines (entry point, animation loop, event wiring)
modules/state.js: shared mutable state object
modules/constants.js: color palette
modules/matrix-rain.js: matrix rain canvas effect
modules/scene-setup.js: scene, camera, renderer, lighting, stars
modules/platform.js: glass platform, perlin noise, floating island, clouds
modules/heatmap.js: commit heatmap
modules/sigil.js: Timmy sigil
modules/controls.js: mouse, overview, zoom, photo mode
modules/effects.js: energy beam, sovereignty meter, rune ring
modules/earth.js: holographic earth
modules/warp.js: warp tunnel, crystals, lightning
modules/dual-brain.js: dual-brain holographic panel
modules/audio.js: Web Audio, spatial, portal hums
modules/debug.js: debug mode, websocket, session export
modules/celebrations.js: easter egg, shockwave, fireworks
modules/portals.js: portal loading
modules/bookshelves.js: floating bookshelves, spine textures
modules/oath.js: The Oath interactive SOUL.md
modules/panels.js: agent status board, LoRA panel
modules/weather.js: weather system, portal health
modules/extras.js: gravity zones, speech, timelapse, bitcoin
Largest file: 528 lines (app.js). No file exceeds 1000.
All files pass node --check. No refactoring — mechanical split only.
2026-03-24 15:12:15 -04:00
|
|
|
composer.render();
|
2026-03-24 05:14:30 +00:00
|
|
|
}
|
|
|
|
|
|
refactor: split app.js (5416 lines) into 21 modules — hard cap 1000 lines/file
app.js: 5416 → 528 lines (entry point, animation loop, event wiring)
modules/state.js: shared mutable state object
modules/constants.js: color palette
modules/matrix-rain.js: matrix rain canvas effect
modules/scene-setup.js: scene, camera, renderer, lighting, stars
modules/platform.js: glass platform, perlin noise, floating island, clouds
modules/heatmap.js: commit heatmap
modules/sigil.js: Timmy sigil
modules/controls.js: mouse, overview, zoom, photo mode
modules/effects.js: energy beam, sovereignty meter, rune ring
modules/earth.js: holographic earth
modules/warp.js: warp tunnel, crystals, lightning
modules/dual-brain.js: dual-brain holographic panel
modules/audio.js: Web Audio, spatial, portal hums
modules/debug.js: debug mode, websocket, session export
modules/celebrations.js: easter egg, shockwave, fireworks
modules/portals.js: portal loading
modules/bookshelves.js: floating bookshelves, spine textures
modules/oath.js: The Oath interactive SOUL.md
modules/panels.js: agent status board, LoRA panel
modules/weather.js: weather system, portal health
modules/extras.js: gravity zones, speech, timelapse, bitcoin
Largest file: 528 lines (app.js). No file exceeds 1000.
All files pass node --check. No refactoring — mechanical split only.
2026-03-24 15:12:15 -04:00
|
|
|
animate();
|
2026-03-24 19:58:25 +00:00
|
|
|
console.log('Nexus Sovereign Node: NOSTR CONNECTED.');
|