Stage WebGL scene loading
This commit is contained in:
@@ -10,7 +10,7 @@ const DEFAULT_BOOK_PROGRESS = 0.5;
|
||||
class WebGLBookSceneModule extends BaseModule {
|
||||
constructor() {
|
||||
super('webgl-book-scene', 'WebGL Book Scene');
|
||||
this.dependencies = ['persistence-manager', 'localization'];
|
||||
this.dependencies = ['persistence-manager', 'localization', 'book-texture-renderer'];
|
||||
this.persistenceManager = null;
|
||||
this.localization = null;
|
||||
this.mode = '2d';
|
||||
@@ -73,6 +73,8 @@ class WebGLBookSceneModule extends BaseModule {
|
||||
this.reportProgress(35, 'Creating WebGL host');
|
||||
this.ensureShell();
|
||||
this.installPreferenceBridge();
|
||||
this.reportProgress(45, 'Loading WebGL scene modules');
|
||||
await this.initializeScene();
|
||||
|
||||
this.reportProgress(100, 'WebGL book host ready');
|
||||
return true;
|
||||
@@ -173,7 +175,10 @@ class WebGLBookSceneModule extends BaseModule {
|
||||
window.WebGLBookInitialState = {
|
||||
appMode: true,
|
||||
pageCount,
|
||||
progress
|
||||
progress,
|
||||
reportProgress: (percent, message) => {
|
||||
this.reportProgress(percent, message);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -293,6 +298,10 @@ class WebGLBookSceneModule extends BaseModule {
|
||||
const cacheBuster = window.MODULE_CACHE_BUSTER || Date.now();
|
||||
this.labImportPromise = import(`/js/webgl-book-lab.js?v=${encodeURIComponent(cacheBuster)}`);
|
||||
await this.labImportPromise;
|
||||
this.reportProgress(94, 'Uploading initial book page textures');
|
||||
window.BookTextureRenderer?.publishSpread?.();
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
this.reportProgress(96, 'Binding WebGL page controls');
|
||||
this.installTextureEventBridge();
|
||||
this.triggerTextureRefresh();
|
||||
return this.labImportPromise;
|
||||
@@ -459,11 +468,7 @@ class WebGLBookSceneModule extends BaseModule {
|
||||
if (this.mode === '3d') {
|
||||
this.createLabHost();
|
||||
this.installPreferenceBridge();
|
||||
this.initializeScene()
|
||||
.then(() => this.triggerTextureRefresh())
|
||||
.catch((error) => {
|
||||
console.error('WebGLBookScene: Failed to initialize procedural scene', error);
|
||||
});
|
||||
if (this.labImportPromise) this.triggerTextureRefresh();
|
||||
}
|
||||
const title = document.getElementById('game_title')?.textContent?.trim();
|
||||
const label = document.getElementById('lab_title');
|
||||
|
||||
Reference in New Issue
Block a user