Skip to content

Commit

Permalink
feat(EffectComposer): add dispose (#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored Sep 12, 2024
1 parent 0d281ea commit 9d656b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/postprocessing/EffectComposer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ class EffectComposer<TRenderTarget extends WebGLRenderTarget = WebGLRenderTarget

this.setSize(this._width, this._height)
}

public dispose() {
this.renderTarget1.dispose()
this.renderTarget2.dispose()

this.copyPass.dispose()
}
}

export { EffectComposer }
2 changes: 2 additions & 0 deletions src/postprocessing/Pass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class Pass {
): void {
console.error('THREE.Pass: .render() must be implemented in derived pass.')
}

public dispose() {}
}

// Helper for passes that need to fill the viewport with a single quad.
Expand Down
5 changes: 5 additions & 0 deletions src/postprocessing/ShaderPass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ class ShaderPass extends Pass {
this.fsQuad.render(renderer)
}
}

public dispose() {
this.fsQuad.dispose()
this.material.dispose()
}
}

export { ShaderPass }

0 comments on commit 9d656b2

Please sign in to comment.