Skip to content

Commit

Permalink
wow: fix ParticleEmitter texture leak
Browse files Browse the repository at this point in the history
  • Loading branch information
wgreenberg committed Nov 18, 2024
1 parent f3c8d65 commit f351583
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/WorldOfWarcraft/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,11 @@ export class ParticleEmitter {
public numParticles(): number {
return this.emitter.num_particles();
}

public destroy(device: GfxDevice) {
if (this.dataTexture)
device.destroyTexture(this.dataTexture);
}
}

export class ModelData {
Expand Down Expand Up @@ -730,9 +735,10 @@ export class ModelData {
return [1, 1, 1, 1];
}

public destroy() {
public destroy(device: GfxDevice) {
this.animationManager.free();
this.boneData.forEach((bone) => bone.destroy());
this.particleEmitters.forEach(emitter => emitter.destroy(device));
}
}

Expand Down
1 change: 1 addition & 0 deletions src/WorldOfWarcraft/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ export class ModelRenderer {
}
device.destroyBuffer(this.particleQuadIndices.buffer);
this.boneTexture.destroy(device);
this.model.destroy(device);
}
}

Expand Down

0 comments on commit f351583

Please sign in to comment.