Co-authored-by: manus <manus@noreply.143.198.27.163> Co-committed-by: manus <manus@noreply.143.198.27.163>
43 lines
1.4 KiB
JavaScript
43 lines
1.4 KiB
JavaScript
// === THE NEXUS — Main Entry Point ===
|
|
import * as THREE from 'three';
|
|
import { S, Broadcaster } from './modules/state.js';
|
|
import { NEXUS } from './modules/constants.js';
|
|
import { scene, camera, renderer, composer } from './modules/scene-setup.js';
|
|
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);
|
|
|
|
// === MAIN ANIMATION LOOP ===
|
|
function animate() {
|
|
requestAnimationFrame(animate);
|
|
const delta = clock.getDelta();
|
|
const elapsed = clock.elapsedTime;
|
|
|
|
// 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;
|
|
}
|
|
|
|
composer.render();
|
|
}
|
|
|
|
animate();
|
|
console.log('Nexus Sovereign Node: NOSTR CONNECTED.');
|