Skip to content

Commit

Permalink
Add workaround for troika-three-text
Browse files Browse the repository at this point in the history
fixes #660
  • Loading branch information
vanruesc committed Oct 31, 2024
1 parent 433965a commit 90fc8d8
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/passes/GeometryPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,11 +379,18 @@ export class GeometryPass extends Pass implements Selective {
}

this.registeredMaterials.add(material);
const onBeforeCompile = material.onBeforeCompile.bind(this);

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

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

onBeforeCompile(shader, renderer);
// Workaround for troika-three-text, see #660.
if(material.onBeforeCompile !== onBeforeCompile) {

onBeforeCompile.call(material, shader, renderer);

}

if(this.gBuffer === null) {

Expand Down

0 comments on commit 90fc8d8

Please sign in to comment.