Skip to content

Commit 33c5bd2

Browse files
committed
Track registered materials across instances
1 parent 29885f4 commit 33c5bd2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/passes/GeometryPass.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export class GeometryPass extends Pass implements GeometryPassOptions, Selective
112112
* A collection of materials that have been modified with `onBeforeCompile`.
113113
*/
114114

115-
private readonly registeredMaterials: WeakSet<Material>;
115+
private static readonly registeredMaterials = new WeakSet<Material>();
116116

117117
/**
118118
* A pass that copies the default input buffer to the output color buffer.
@@ -180,7 +180,6 @@ export class GeometryPass extends Pass implements GeometryPassOptions, Selective
180180
this.selection = new Selection();
181181
this.selection.enabled = false;
182182
this.gBufferConfig = gBufferConfig;
183-
this.registeredMaterials = new WeakSet<Material>();
184183
this.copyPass = new CopyPass();
185184
this.copyPass.enabled = false;
186185
this.subpasses = [this.copyPass];
@@ -345,13 +344,13 @@ export class GeometryPass extends Pass implements GeometryPassOptions, Selective
345344

346345
for(const material of materials) {
347346

348-
if(this.registeredMaterials.has(material)) {
347+
if(GeometryPass.registeredMaterials.has(material)) {
349348

350349
return;
351350

352351
}
353352

354-
this.registeredMaterials.add(material);
353+
GeometryPass.registeredMaterials.add(material);
355354

356355
/* eslint-disable @typescript-eslint/unbound-method */
357356
const onBeforeCompile = material.onBeforeCompile;

0 commit comments

Comments
 (0)