Skip to content

Commit 29885f4

Browse files
committed
Improve compilation of fullscreen materials
1 parent 5292a36 commit 29885f4

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/core/Pass.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
Camera,
66
Event,
77
EventDispatcher,
8+
Group,
89
Material,
910
Mesh,
1011
Object3D,
@@ -854,22 +855,17 @@ export abstract class Pass<TMaterial extends Material | null = null>
854855

855856
}
856857

857-
const currentMaterial = this.fullscreenMaterial;
858+
const group = new Group();
858859

859860
for(const material of this.materials) {
860861

861-
this.fullscreenMaterial = material;
862-
await this.renderer.compileAsync(this.fullscreenScene!, this.fullscreenCamera!);
862+
group.add(new Mesh(Pass.fullscreenGeometry, material!));
863863

864864
}
865865

866-
if(currentMaterial !== undefined) {
867-
868-
this.fullscreenMaterial = currentMaterial;
869-
870-
}
871-
872-
const promises: Promise<Object3D | void>[] = [];
866+
const promises: Promise<Object3D | void>[] = [
867+
this.renderer.compileAsync(group, this.fullscreenCamera!, this.fullscreenScene)
868+
];
873869

874870
for(const pass of this.subpasses) {
875871

0 commit comments

Comments
 (0)