Skip to content

Commit

Permalink
MassTagView to use MassTag for data, and cleanup disposal, phetsims/b…
Browse files Browse the repository at this point in the history
…uoyancy#102

Signed-off-by: Michael Kauzmann <[email protected]>
  • Loading branch information
zepumph committed Mar 4, 2024
1 parent 31069ae commit 22edfdb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions js/TextureQuad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import merge from '../../phet-core/js/merge.js';
import mobius from './mobius.js';
import Quad from './Quad.js';
import Disposable from '../../axon/js/Disposable.js';
import TEmitter from '../../axon/js/TEmitter.js';

export default class TextureQuad extends THREE.Mesh {

Expand All @@ -18,6 +20,9 @@ export default class TextureQuad extends THREE.Mesh {
private textureQuadWidth: number;
private textureQuadHeight: number;

private disposable = new Disposable();
public disposeEmitter: TEmitter;

public constructor( texture: THREE.Texture, width: number, height: number, materialOptions?: THREE.MaterialParameters ) {

const quadGeometry = new Quad(
Expand All @@ -41,6 +46,7 @@ export default class TextureQuad extends THREE.Mesh {
this.basicMaterial = basicMaterial;
this.textureQuadWidth = width;
this.textureQuadHeight = height;
this.disposeEmitter = this.disposable.disposeEmitter;
}

public updateTexture( texture: THREE.Texture, width: number = this.textureQuadWidth, height: number = this.textureQuadHeight ): void {
Expand All @@ -66,6 +72,7 @@ export default class TextureQuad extends THREE.Mesh {
public dispose(): void {
this.quadGeometry.dispose();
this.basicMaterial.dispose();
this.disposable.dispose();

// @ts-expect-error
super.dispose && super.dispose();
Expand Down

0 comments on commit 22edfdb

Please sign in to comment.