@base2datadesign/viewer-kit 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewerEngine.d.ts","sourceRoot":"","sources":["../../src/engine/ViewerEngine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,WAAW,EAAiB,sBAAsB,EAAE,mBAAmB,EAAmB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQrK,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAE1D,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAc;IAE/B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAU;IAEnC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAuB;
|
|
1
|
+
{"version":3,"file":"ViewerEngine.d.ts","sourceRoot":"","sources":["../../src/engine/ViewerEngine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,WAAW,EAAiB,sBAAsB,EAAE,mBAAmB,EAAmB,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQrK,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAiB;IAE1D,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,QAAQ,CAAgB;IAChC,OAAO,CAAC,SAAS,CAAc;IAE/B,OAAO,CAAC,iBAAiB,CAAoB;IAC7C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,iBAAiB,CAAU;IAEnC,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,cAAc,CAAuB;IAC7C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,EAAE,mBAAmB;IAkDxC,SAAS,IAAI,YAAY;IAkBzB,KAAK,IAAI,IAAI;IAgBb,IAAI,IAAI,IAAI;IAQZ,MAAM,IAAI,IAAI;IAYd,OAAO,IAAI,IAAI;IAef,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAIjC,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,IAAI;IAStD,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAwBjC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAe5C,cAAc,IAAI,WAAW;IAQvB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAmCjC,WAAW,IAAI,cAAc;IAe7B,OAAO,CAAC,YAAY;IAuCpB,OAAO,CAAC,WAAW;IAuBnB,OAAO,CAAC,aAAa;CAKtB"}
|
|
@@ -23,6 +23,8 @@ export class ViewerEngine {
|
|
|
23
23
|
presetId;
|
|
24
24
|
running = false;
|
|
25
25
|
animationFrame = null;
|
|
26
|
+
lastWidth;
|
|
27
|
+
lastHeight;
|
|
26
28
|
constructor(options) {
|
|
27
29
|
this.container = options.container;
|
|
28
30
|
const basePresets = options.presets ?? DEFAULT_PRESETS;
|
|
@@ -55,6 +57,8 @@ export class ViewerEngine {
|
|
|
55
57
|
this.postFxSystem = new PostFxSystem(this.renderer, this.scene, this.camera);
|
|
56
58
|
this.debugSystem = new DebugSystem(this.scene);
|
|
57
59
|
this.usePostprocessing = options.usePostprocessing ?? true;
|
|
60
|
+
this.lastWidth = width;
|
|
61
|
+
this.lastHeight = height;
|
|
58
62
|
this.postFxSystem.resize(width, height);
|
|
59
63
|
this.applyPreset(this.presetId);
|
|
60
64
|
}
|
|
@@ -103,6 +107,8 @@ export class ViewerEngine {
|
|
|
103
107
|
resize() {
|
|
104
108
|
const width = this.container.clientWidth || 1;
|
|
105
109
|
const height = this.container.clientHeight || 1;
|
|
110
|
+
this.lastWidth = width;
|
|
111
|
+
this.lastHeight = height;
|
|
106
112
|
this.camera.aspect = width / height;
|
|
107
113
|
this.camera.updateProjectionMatrix();
|
|
108
114
|
this.renderer.setSize(width, height);
|
|
@@ -272,6 +278,9 @@ export class ViewerEngine {
|
|
|
272
278
|
? { ...preset.renderer, toneMappingExposure: exposureOverride }
|
|
273
279
|
: preset.renderer;
|
|
274
280
|
applyRendererConfig(this.renderer, rendererConfig);
|
|
281
|
+
// applyRendererConfig can change pixel ratio; keep drawing buffer in sync.
|
|
282
|
+
this.renderer.setSize(this.lastWidth, this.lastHeight);
|
|
283
|
+
this.postFxSystem.resize(this.lastWidth, this.lastHeight);
|
|
275
284
|
void this.environmentSystem.apply(preset);
|
|
276
285
|
this.lightingSystem.apply(preset);
|
|
277
286
|
this.postFxSystem.apply(this.usePostprocessing ? preset.postfx : undefined);
|