@base2datadesign/viewer-kit 0.2.12 → 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.
|
@@ -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;
|
|
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;IAkHlC,MAAM,IAAI,IAAI;IAoBd,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA2B3C,OAAO,CAAC,oBAAoB;IAS5B,OAAO,IAAI,IAAI;IAaf,UAAU,IAAI,IAAI;IAqBlB,QAAQ,IAAI;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,CAAC;QAAC,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.
|
|
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
|
-
|
|
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.
|
|
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({
|
|
@@ -131,6 +134,15 @@ export class PostFxSystem {
|
|
|
131
134
|
// EffectComposer disables autoClear; force a clean frame on the default framebuffer.
|
|
132
135
|
this.renderer.setRenderTarget(null);
|
|
133
136
|
this.renderer.clear(true, true, true);
|
|
137
|
+
if (this.aoPass) {
|
|
138
|
+
const aoPassAny = this.aoPass;
|
|
139
|
+
if (aoPassAny.accumulationRenderTarget) {
|
|
140
|
+
const prevTarget = this.renderer.getRenderTarget();
|
|
141
|
+
this.renderer.setRenderTarget(aoPassAny.accumulationRenderTarget);
|
|
142
|
+
this.renderer.clear(true, true, true);
|
|
143
|
+
this.renderer.setRenderTarget(prevTarget);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
134
146
|
this.composer.render();
|
|
135
147
|
return;
|
|
136
148
|
}
|
|
@@ -148,6 +160,9 @@ export class PostFxSystem {
|
|
|
148
160
|
this.effectPass = null;
|
|
149
161
|
this.enabled = false;
|
|
150
162
|
}
|
|
163
|
+
const buffer = this.getDrawingBufferSize();
|
|
164
|
+
this.lastWidth = buffer.width;
|
|
165
|
+
this.lastHeight = buffer.height;
|
|
151
166
|
if (this.currentConfig) {
|
|
152
167
|
const config = this.currentConfig;
|
|
153
168
|
this.currentConfig = null;
|
|
@@ -159,6 +174,14 @@ export class PostFxSystem {
|
|
|
159
174
|
this.apply(pending);
|
|
160
175
|
}
|
|
161
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
|
+
}
|
|
162
185
|
dispose() {
|
|
163
186
|
if (this.composer) {
|
|
164
187
|
this.composer.dispose();
|