@base2datadesign/viewer-kit 0.2.13 → 0.2.14

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.
@@ -19,6 +19,7 @@ export declare class PostFxSystem {
19
19
  apply(config?: PostFxConfig): void;
20
20
  render(): void;
21
21
  resize(width: number, height: number): void;
22
+ private getDrawingBufferSize;
22
23
  dispose(): void;
23
24
  invalidate(): void;
24
25
  getState(): {
@@ -1 +1 @@
1
- {"version":3,"file":"postfxSystem.d.ts","sourceRoot":"","sources":["../../src/systems/postfxSystem.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,KAAK,CAAc;IAC3B,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,QAAQ,CAA+B;IAC/C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,WAAW,CAA4B;IAC/C,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,aAAa,CAA6B;gBAEtC,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,iBAAiB;IAM9F,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,GAAG,IAAI;IA+GlC,MAAM,IAAI,IAAI;IAoBd,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAwB3C,OAAO,IAAI,IA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AC,eAAe,EAAE,OAAO,CAAA;KAAE;CAOpF"}
@@ -46,15 +46,18 @@ export class PostFxSystem {
46
46
  this.renderPass = new RenderPass(this.scene, this.camera);
47
47
  this.renderPass.clearPass && (this.renderPass.clearPass.overrideClearAlpha = 1);
48
48
  this.composer.addPass(this.renderPass);
49
- this.composer.setSize(this.lastWidth, this.lastHeight);
49
+ const buffer = this.getDrawingBufferSize();
50
+ this.composer.setSize(buffer.width, buffer.height);
50
51
  }
51
52
  this.composer.autoRenderToScreen = false;
52
53
  if (!this.aoPass) {
53
- this.aoPass = new N8AOPostPass(this.scene, this.camera, this.lastWidth, this.lastHeight);
54
+ const buffer = this.getDrawingBufferSize();
55
+ this.aoPass = new N8AOPostPass(this.scene, this.camera, buffer.width, buffer.height);
54
56
  this.composer.addPass(this.aoPass);
55
57
  }
56
58
  else {
57
- this.aoPass.setSize(this.lastWidth, this.lastHeight);
59
+ const buffer = this.getDrawingBufferSize();
60
+ this.aoPass.setSize(buffer.width, buffer.height);
58
61
  }
59
62
  if (!this.bloomEffect) {
60
63
  this.bloomEffect = new BloomEffect({
@@ -157,6 +160,9 @@ export class PostFxSystem {
157
160
  this.effectPass = null;
158
161
  this.enabled = false;
159
162
  }
163
+ const buffer = this.getDrawingBufferSize();
164
+ this.lastWidth = buffer.width;
165
+ this.lastHeight = buffer.height;
160
166
  if (this.currentConfig) {
161
167
  const config = this.currentConfig;
162
168
  this.currentConfig = null;
@@ -168,6 +174,14 @@ export class PostFxSystem {
168
174
  this.apply(pending);
169
175
  }
170
176
  }
177
+ getDrawingBufferSize() {
178
+ const size = new THREE.Vector2();
179
+ this.renderer.getDrawingBufferSize(size);
180
+ return {
181
+ width: Math.max(1, Math.round(size.x)),
182
+ height: Math.max(1, Math.round(size.y)),
183
+ };
184
+ }
171
185
  dispose() {
172
186
  if (this.composer) {
173
187
  this.composer.dispose();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base2datadesign/viewer-kit",
3
- "version": "0.2.13",
3
+ "version": "0.2.14",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "main": "./dist/index.js",