Skip to content

Commit

Permalink
fix: particle not render bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GuoLei1990 committed Nov 13, 2024
1 parent cfdcf88 commit f7e3b0e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packages/core/src/particle/ParticleRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ export class ParticleRenderer extends Renderer {
return;
}

// Don't need to render when no particles
if (!this.generator._getAliveParticleCount()) {
return;
}

super._prepareRender(context);
}

Expand Down Expand Up @@ -217,7 +212,14 @@ export class ParticleRenderer extends Renderer {

protected override _render(context: RenderContext): void {
const generator = this.generator;
generator._primitive.instanceCount = generator._getAliveParticleCount();
// Don't need to render when no particles

const aliveParticleCount = generator._getAliveParticleCount();
if (!aliveParticleCount) {
return;
}

generator._primitive.instanceCount = aliveParticleCount;

let material = this.getMaterial();
if (!material) {
Expand Down

0 comments on commit f7e3b0e

Please sign in to comment.