Skip to content

Commit

Permalink
[Fix] Particle system handle different IB formats of incoming mesh (#…
Browse files Browse the repository at this point in the history
…6662)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky committed Jun 5, 2024
1 parent 18bca3f commit 9bc3ec0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/scene/particle-system/particle-emitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ import {
PIXELFORMAT_RGBA8, PIXELFORMAT_RGBA32F,
PRIMITIVE_TRIANGLES,
SEMANTIC_ATTR0, SEMANTIC_ATTR1, SEMANTIC_ATTR2, SEMANTIC_ATTR3, SEMANTIC_ATTR4, SEMANTIC_TEXCOORD0,
TYPE_FLOAT32
TYPE_FLOAT32,
typedArrayIndexFormats
} from '../../platform/graphics/constants.js';
import { DeviceCache } from '../../platform/graphics/device-cache.js';
import { IndexBuffer } from '../../platform/graphics/index-buffer.js';
Expand Down Expand Up @@ -1057,7 +1058,12 @@ class ParticleEmitter {
// Fill the index buffer
let dst = 0;
const indices = new Uint32Array(this.indexBuffer.lock());
if (this.useMesh) meshData = new Uint32Array(this.mesh.indexBuffer[0].lock());

if (this.useMesh) {
const ib = this.mesh.indexBuffer[0];
meshData = new typedArrayIndexFormats[ib.format](ib.lock());
}

for (let i = 0; i < numParticles; i++) {
if (!this.useMesh) {
const baseIndex = i * 4;
Expand Down

0 comments on commit 9bc3ec0

Please sign in to comment.