feat(epic222): Workshop — Timmy as wizard presence, world state, WS bootstrap (#31)
This commit is contained in:
@@ -12,15 +12,6 @@ import { initPaymentPanel } from './payment.js';
|
||||
let running = false;
|
||||
let canvas = null;
|
||||
|
||||
/**
|
||||
* Build (or rebuild) the Three.js world.
|
||||
*
|
||||
* @param {boolean} firstInit
|
||||
* true — first page load: also starts UI and WebSocket
|
||||
* false — context-restore reinit: skips UI/WS (they survive context loss)
|
||||
* @param {Object.<string,string>|null} stateSnapshot
|
||||
* Agent state map captured just before teardown; reapplied after initAgents.
|
||||
*/
|
||||
function buildWorld(firstInit, stateSnapshot) {
|
||||
const { scene, camera, renderer } = initWorld(canvas);
|
||||
canvas = renderer.domElement;
|
||||
@@ -28,9 +19,7 @@ function buildWorld(firstInit, stateSnapshot) {
|
||||
initEffects(scene);
|
||||
initAgents(scene);
|
||||
|
||||
if (stateSnapshot) {
|
||||
applyAgentStates(stateSnapshot);
|
||||
}
|
||||
if (stateSnapshot) applyAgentStates(stateSnapshot);
|
||||
|
||||
initInteraction(camera, renderer);
|
||||
|
||||
@@ -74,7 +63,6 @@ function buildWorld(firstInit, stateSnapshot) {
|
||||
}
|
||||
|
||||
animate();
|
||||
|
||||
return { scene, renderer, ac };
|
||||
}
|
||||
|
||||
@@ -89,7 +77,6 @@ function teardown({ scene, renderer, ac }) {
|
||||
|
||||
function main() {
|
||||
const $overlay = document.getElementById('webgl-recovery-overlay');
|
||||
|
||||
let handle = buildWorld(true, null);
|
||||
|
||||
canvas.addEventListener('webglcontextlost', event => {
|
||||
|
||||
Reference in New Issue
Block a user