Stage WebGL scene loading

This commit is contained in:
2026-06-07 12:08:13 +02:00
parent 1b593c8c7b
commit de81a7c5c5
7 changed files with 73 additions and 16 deletions
+9 -2
View File
@@ -3,7 +3,9 @@
* Defines the canonical page geometry used by the WebGL book renderer.
*/
import { BaseModule } from './base-module.js';
import { calculateProceduralBookThickness, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-physical-stack-quality';
import { calculateProceduralBookThickness, snapProceduralPageCount } from './procedural-book-model.js?v=20260607-webgl-loader-quality-fix';
export const BOOK_TEXTURE_WIDTH = 3072;
class BookPageFormatModule extends BaseModule {
constructor() {
@@ -39,6 +41,7 @@ class BookPageFormatModule extends BaseModule {
this.bindMethods([
'getFormat',
'getAspectRatio',
'getTextureWidth',
'getTextureMetrics',
'setPageCount',
'getPageCount',
@@ -67,6 +70,10 @@ class BookPageFormatModule extends BaseModule {
return this.format.trim.widthIn / this.format.trim.heightIn;
}
getTextureWidth() {
return BOOK_TEXTURE_WIDTH;
}
inchesToTexture(valueIn, textureHeight) {
return (Number(valueIn) / this.format.trim.heightIn) * textureHeight;
}
@@ -105,7 +112,7 @@ class BookPageFormatModule extends BaseModule {
};
}
getTextureMetrics(textureWidth = 1280, pageCount = this.pageCount) {
getTextureMetrics(textureWidth = BOOK_TEXTURE_WIDTH, pageCount = this.pageCount) {
const width = Math.max(1, Math.round(Number(textureWidth) || 1280));
const height = Math.round(width / this.getAspectRatio());
const dynamicMargins = this.getDynamicMargins(pageCount);