bucciafico-lib 1.0.6 → 1.0.7
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.
package/package.json
CHANGED
|
@@ -12,10 +12,18 @@ import { OutlinePass } from 'three/examples/jsm/postprocessing/OutlinePass.js';
|
|
|
12
12
|
export class PostProcessingManager {
|
|
13
13
|
constructor(renderer, scene, camera, width, height) {
|
|
14
14
|
this.scene = scene;
|
|
15
|
+
this.renderer = renderer;
|
|
16
|
+
|
|
17
|
+
this.INTERNAL_HEIGHT = 1080;
|
|
18
|
+
|
|
19
|
+
const ratio = width / height;
|
|
20
|
+
const virtualW = this.INTERNAL_HEIGHT * ratio;
|
|
21
|
+
const virtualH = this.INTERNAL_HEIGHT;
|
|
15
22
|
|
|
16
23
|
// 1. BLOOM COMPOSER (Renders glow map)
|
|
17
24
|
this.bloomComposer = new EffectComposer(renderer);
|
|
18
25
|
this.bloomComposer.renderToScreen = false;
|
|
26
|
+
this.bloomComposer.setSize(virtualW, virtualH);
|
|
19
27
|
this.bloomComposer.addPass(new RenderPass(scene, camera));
|
|
20
28
|
|
|
21
29
|
this.bloomPass = new UnrealBloomPass(new THREE.Vector2(width, height), 1.5, 0.4, 0.85);
|
|
@@ -23,6 +31,7 @@ export class PostProcessingManager {
|
|
|
23
31
|
|
|
24
32
|
// 2. FINAL COMPOSER
|
|
25
33
|
this.finalComposer = new EffectComposer(renderer);
|
|
34
|
+
this.finalComposer.setSize(width, height);
|
|
26
35
|
this.finalComposer.addPass(new RenderPass(scene, camera));
|
|
27
36
|
|
|
28
37
|
// 3. OUTLINE PASS (Selection highlight)
|
|
@@ -82,9 +91,14 @@ export class PostProcessingManager {
|
|
|
82
91
|
}
|
|
83
92
|
|
|
84
93
|
resize(width, height) {
|
|
85
|
-
|
|
94
|
+
const ratio = width / height;
|
|
95
|
+
|
|
96
|
+
const virtualH = this.INTERNAL_HEIGHT;
|
|
97
|
+
const virtualW = virtualH * ratio;
|
|
98
|
+
|
|
99
|
+
this.bloomComposer.setSize(virtualW, virtualH);
|
|
86
100
|
this.finalComposer.setSize(width, height);
|
|
87
|
-
this.bloomPass.resolution.set(
|
|
101
|
+
this.bloomPass.resolution.set(virtualW, virtualH);
|
|
88
102
|
this.outlinePass.setSize(width, height);
|
|
89
103
|
}
|
|
90
104
|
|