Co-authored-by: manus <manus@noreply.143.198.27.163> Co-committed-by: manus <manus@noreply.143.198.27.163>
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
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 } from './modules/warp.js';
|
|
import { SovOS } from './modules/SovOS.js';
|
|
import { globalTicker } from './modules/core/ticker.js';
|
|
|
|
// === INITIALIZE SovOS ===
|
|
const sovos = new SovOS(scene);
|
|
|
|
// Register Core Apps
|
|
sovos.registerApp('command', {
|
|
title: 'SOV_OS',
|
|
color: NEXUS.colors.accent,
|
|
x: -6, rot: -0.4,
|
|
renderBody: (ctx, s) => {
|
|
ctx.fillText(`> KERNEL: SOVEREIGN`, 30, 130);
|
|
ctx.fillText(`> STATUS: NOMINAL`, 30, 175);
|
|
ctx.fillText(`> UPTIME: ${s.metrics.uptime.toFixed(1)}s`, 30, 220);
|
|
}
|
|
});
|
|
|
|
sovos.registerApp('metrics', {
|
|
title: 'METRICS',
|
|
color: 0x7b5cff,
|
|
x: -3, rot: -0.2,
|
|
renderBody: (ctx, s) => {
|
|
ctx.fillText(`> CPU: ${s.metrics.cpu}%`, 30, 130);
|
|
ctx.fillText(`> MEM: ${s.metrics.mem}GB`, 30, 175);
|
|
ctx.fillText(`> FPS: ${s.metrics.fps}`, 30, 220);
|
|
}
|
|
});
|
|
|
|
sovos.registerApp('cognition', {
|
|
title: 'COGNITION',
|
|
color: 0x4af0c0,
|
|
x: 0, rot: 0,
|
|
renderBody: (ctx, s) => {
|
|
s.thoughts.forEach((t, i) => ctx.fillText(`> ${t}`, 30, 130 + i * 45));
|
|
}
|
|
});
|
|
|
|
// === MAIN ANIMATION LOOP ===
|
|
function animate() {
|
|
requestAnimationFrame(animate);
|
|
const delta = clock.getDelta();
|
|
const elapsed = clock.elapsedTime;
|
|
|
|
// Global Subsystems
|
|
globalTicker.tick(delta, elapsed);
|
|
|
|
// Simulation Heartbeat
|
|
if (Math.random() > 0.98) {
|
|
S.metrics.fps = Math.floor(60 + Math.random() * 5);
|
|
Broadcaster.broadcast();
|
|
}
|
|
|
|
composer.render();
|
|
}
|
|
|
|
animate();
|
|
console.log('Nexus SovOS: Modular. Beautiful. Functional.');
|