Skip to content

Commit 90fc8d8

Browse files
committed
Add workaround for troika-three-text
fixes #660
1 parent 433965a commit 90fc8d8

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/passes/GeometryPass.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,11 +379,18 @@ export class GeometryPass extends Pass implements Selective {
379379
}
380380

381381
this.registeredMaterials.add(material);
382-
const onBeforeCompile = material.onBeforeCompile.bind(this);
382+
383+
/* eslint-disable @typescript-eslint/unbound-method */
384+
const onBeforeCompile = material.onBeforeCompile;
383385

384386
material.onBeforeCompile = (shader: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer) => {
385387

386-
onBeforeCompile(shader, renderer);
388+
// Workaround for troika-three-text, see #660.
389+
if(material.onBeforeCompile !== onBeforeCompile) {
390+
391+
onBeforeCompile.call(material, shader, renderer);
392+
393+
}
387394

388395
if(this.gBuffer === null) {
389396

0 commit comments

Comments
 (0)