@neutrinoparticles/js-v1.1-phaser 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -601,8 +601,16 @@ void main() {
601
601
  // Texture coordinates with grid + atlas remap
602
602
  vec2 baseTexCoord = TEX_COORD[vertexIndex];
603
603
 
604
- float gx = mod(gridIndex, gridWidth);
604
+ // #283: gx must come from the SAME quotient as gy. GLSL mod(x,y) is
605
+ // x - y*floor(x/y), but the driver may evaluate its internal quotient
606
+ // differently from the floor() below (reciprocal-multiply / FMA). At exact
607
+ // multiples of gridWidth the two disagreed — mod(15,15) gave 15 while
608
+ // floor(15/15) gave 0 — addressing column 15 of a 15-column grid, whose U
609
+ // range starts at 1.0 (off the atlas), so the first cell of every row
610
+ // sampled the clamped transparent edge and vanished. The clamp keeps a
611
+ // rounding-induced gx == gridWidth inside the last column.
605
612
  float gy = floor(gridIndex / gridWidth);
613
+ float gx = clamp(gridIndex - gy * gridWidth, 0.0, gridWidth - 1.0);
606
614
  float cellW = 1.0 / gridWidth;
607
615
  float cellH = 1.0 / gridHeight;
608
616
 
@@ -688,6 +696,13 @@ void main() {
688
696
  else texColor = useGrad ? textureGrad(uTextures[7], atlasUV, gradX, gradY) : texture(uTextures[7], atlasUV);
689
697
 
690
698
  fragColor = texColor * vColor;
699
+ // Premultiply the per-particle alpha into RGB. texColor is premultiplied but
700
+ // vColor.a is not, and every blend func expects a premultiplied source:
701
+ // NORMAL (ONE, 1-src.a) would only reduce how much background shows through,
702
+ // ADD (ONE, ONE) would ignore alpha entirely, and MULTIPLY
703
+ // (DST_COLOR, 1-src.a) would brighten the destination as alpha drops instead
704
+ // of leaving it untouched.
705
+ fragColor.rgb *= vColor.a;
691
706
  // Apply host world alpha. texColor is premultiplied and the blend funcs use
692
707
  // a src factor of ONE (NORMAL) / ONE,ONE (ADD), so the whole RGBA must be
693
708
  // scaled — fading RGB, not just the alpha channel — to dim correctly in both
@@ -1227,8 +1242,12 @@ void main() {
1227
1242
  // Texture coordinates with grid + atlas remap
1228
1243
  vec2 baseTexCoord = texCoordOf(corner);
1229
1244
 
1230
- float gx = mod(gridIndex, gridWidth);
1245
+ // #283: gx must come from the SAME quotient as gy — see particle.vert.
1246
+ // mod(x,y) and a separate floor(x/y) can disagree at exact multiples of
1247
+ // gridWidth (mod(15,15) -> 15, floor(15/15) -> 0), which addressed a
1248
+ // column past the grid and blanked the first cell of every row.
1231
1249
  float gy = floor(gridIndex / gridWidth);
1250
+ float gx = clamp(gridIndex - gy * gridWidth, 0.0, gridWidth - 1.0);
1232
1251
  float cellW = 1.0 / gridWidth;
1233
1252
  float cellH = 1.0 / gridHeight;
1234
1253
 
@@ -1296,6 +1315,11 @@ void main() {
1296
1315
  // texColor is premultiplied and blend src factors are ONE-based, so the
1297
1316
  // world alpha scales the whole RGBA (mirror of the ES 3.00 shader).
1298
1317
  gl_FragColor = texColor * vColor * uWorldAlpha;
1318
+ // Premultiply the per-particle alpha into RGB: vColor.a is not premultiplied,
1319
+ // so without this ADD ignores alpha entirely, NORMAL only reduces background
1320
+ // show-through, and MULTIPLY brightens the destination as alpha drops.
1321
+ // Mirror of the ES 3.00 shader.
1322
+ gl_FragColor.rgb *= vColor.a;
1299
1323
  }
1300
1324
  `, A = class A {
1301
1325
  constructor(e, t) {
@@ -1413,12 +1437,12 @@ void main() {
1413
1437
  throw new Error(
1414
1438
  `NeutrinoParticles (js-v1.1): the effect needs 32-bit indices (${e} particles) but this WebGL1 context lacks OES_element_index_uint.`
1415
1439
  );
1416
- const c = l ? new Uint32Array(e * 6) : new Uint16Array(e * 6);
1440
+ const d = l ? new Uint32Array(e * 6) : new Uint16Array(e * 6);
1417
1441
  for (let i = 0; i < e; i++) {
1418
1442
  const u = i * 4, _ = i * 6;
1419
- c[_ + 0] = u + 0, c[_ + 1] = u + 1, c[_ + 2] = u + 2, c[_ + 3] = u + 0, c[_ + 4] = u + 2, c[_ + 5] = u + 3;
1443
+ d[_ + 0] = u + 0, d[_ + 1] = u + 1, d[_ + 2] = u + 2, d[_ + 3] = u + 0, d[_ + 4] = u + 2, d[_ + 5] = u + 3;
1420
1444
  }
1421
- if (this._indexBuffer = t.createBuffer(), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this._indexBuffer), t.bufferData(t.ELEMENT_ARRAY_BUFFER, c, t.STATIC_DRAW), this._isWebGL1) {
1445
+ if (this._indexBuffer = t.createBuffer(), t.bindBuffer(t.ELEMENT_ARRAY_BUFFER, this._indexBuffer), t.bufferData(t.ELEMENT_ARRAY_BUFFER, d, t.STATIC_DRAW), this._isWebGL1) {
1422
1446
  const i = new Float32Array(e * 4);
1423
1447
  for (let u = 0; u < i.length; u++) i[u] = u;
1424
1448
  this._aIdBuffer = t.createBuffer(), t.bindBuffer(t.ARRAY_BUFFER, this._aIdBuffer), t.bufferData(t.ARRAY_BUFFER, i, t.STATIC_DRAW);
@@ -1495,12 +1519,12 @@ void main() {
1495
1519
  `, a = `precision mediump float;
1496
1520
  varying vec4 vC;
1497
1521
  void main() { gl_FragColor = vC; }
1498
- `, r = e.getParameter(e.VIEWPORT), o = e.getParameter(e.CURRENT_PROGRAM), l = e.getParameter(e.ARRAY_BUFFER_BINDING), c = e.getParameter(e.FRAMEBUFFER_BINDING), i = e.getParameter(e.ACTIVE_TEXTURE);
1522
+ `, r = e.getParameter(e.VIEWPORT), o = e.getParameter(e.CURRENT_PROGRAM), l = e.getParameter(e.ARRAY_BUFFER_BINDING), d = e.getParameter(e.FRAMEBUFFER_BINDING), i = e.getParameter(e.ACTIVE_TEXTURE);
1499
1523
  e.activeTexture(e.TEXTURE0);
1500
1524
  const u = e.getParameter(e.TEXTURE_BINDING_2D);
1501
1525
  e.activeTexture(e.TEXTURE1);
1502
1526
  const _ = e.getParameter(e.TEXTURE_BINDING_2D), y = e.isEnabled(e.BLEND), E = e.isEnabled(e.DEPTH_TEST), I = e.isEnabled(e.SCISSOR_TEST);
1503
- let m = null, w = null, B = null, f = null, v = null, g = null, d = -1, b = !1, x = null, h = 4, U = 0, p = 0, R = 0, D = !1, S = !1;
1527
+ let m = null, w = null, U = null, f = null, v = null, g = null, c = -1, b = !1, x = null, h = 4, B = 0, p = 0, R = 0, D = !1, S = !1;
1504
1528
  const T = new Uint8Array(4);
1505
1529
  try {
1506
1530
  m = e.createProgram(), e.attachShader(m, this._compileShader(e.VERTEX_SHADER, t)), e.attachShader(m, this._compileShader(e.FRAGMENT_SHADER, a)), e.linkProgram(m);
@@ -1508,16 +1532,16 @@ void main() { gl_FragColor = vC; }
1508
1532
  const M = e.createTexture();
1509
1533
  return e.bindTexture(e.TEXTURE_2D, M), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, P, F), M;
1510
1534
  };
1511
- e.activeTexture(e.TEXTURE0), w = C(e.FLOAT, new Float32Array([1, 0.5, 0.25, 1])), B = C(e.UNSIGNED_BYTE, new Uint8Array([51, 102, 153, 255])), f = e.createTexture(), e.bindTexture(e.TEXTURE_2D, f), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, null), v = e.createFramebuffer(), e.bindFramebuffer(e.FRAMEBUFFER, v), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, f, 0), g = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, g), e.bufferData(e.ARRAY_BUFFER, new Float32Array([0]), e.STATIC_DRAW), S = e.getProgramParameter(m, e.LINK_STATUS), S && (e.useProgram(m), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, w), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, B), e.uniform1i(e.getUniformLocation(m, "uF"), 0), e.uniform1i(e.getUniformLocation(m, "uB"), 1), d = e.getAttribLocation(m, "aId"), b = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_ENABLED), x = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING), h = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_SIZE), U = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_TYPE), D = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_NORMALIZED), p = e.getVertexAttrib(d, e.VERTEX_ATTRIB_ARRAY_STRIDE), R = e.getVertexAttribOffset(d, e.VERTEX_ATTRIB_ARRAY_POINTER), e.enableVertexAttribArray(d), e.vertexAttribPointer(d, 1, e.FLOAT, !1, 0, 0), e.viewport(0, 0, 1, 1), e.disable(e.BLEND), e.disable(e.DEPTH_TEST), e.disable(e.SCISSOR_TEST), e.drawArrays(e.POINTS, 0, 1), e.readPixels(0, 0, 1, 1, e.RGBA, e.UNSIGNED_BYTE, T), S = Math.abs(T[0] - 51) <= 2 && Math.abs(T[1] - 51) <= 2 && Math.abs(T[2] - 38) <= 2);
1535
+ e.activeTexture(e.TEXTURE0), w = C(e.FLOAT, new Float32Array([1, 0.5, 0.25, 1])), U = C(e.UNSIGNED_BYTE, new Uint8Array([51, 102, 153, 255])), f = e.createTexture(), e.bindTexture(e.TEXTURE_2D, f), e.texImage2D(e.TEXTURE_2D, 0, e.RGBA, 1, 1, 0, e.RGBA, e.UNSIGNED_BYTE, null), v = e.createFramebuffer(), e.bindFramebuffer(e.FRAMEBUFFER, v), e.framebufferTexture2D(e.FRAMEBUFFER, e.COLOR_ATTACHMENT0, e.TEXTURE_2D, f, 0), g = e.createBuffer(), e.bindBuffer(e.ARRAY_BUFFER, g), e.bufferData(e.ARRAY_BUFFER, new Float32Array([0]), e.STATIC_DRAW), S = e.getProgramParameter(m, e.LINK_STATUS), S && (e.useProgram(m), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, w), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, U), e.uniform1i(e.getUniformLocation(m, "uF"), 0), e.uniform1i(e.getUniformLocation(m, "uB"), 1), c = e.getAttribLocation(m, "aId"), b = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_ENABLED), x = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING), h = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_SIZE), B = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_TYPE), D = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_NORMALIZED), p = e.getVertexAttrib(c, e.VERTEX_ATTRIB_ARRAY_STRIDE), R = e.getVertexAttribOffset(c, e.VERTEX_ATTRIB_ARRAY_POINTER), e.enableVertexAttribArray(c), e.vertexAttribPointer(c, 1, e.FLOAT, !1, 0, 0), e.viewport(0, 0, 1, 1), e.disable(e.BLEND), e.disable(e.DEPTH_TEST), e.disable(e.SCISSOR_TEST), e.drawArrays(e.POINTS, 0, 1), e.readPixels(0, 0, 1, 1, e.RGBA, e.UNSIGNED_BYTE, T), S = Math.abs(T[0] - 51) <= 2 && Math.abs(T[1] - 51) <= 2 && Math.abs(T[2] - 38) <= 2);
1512
1536
  } finally {
1513
- d >= 0 && (x && (e.bindBuffer(e.ARRAY_BUFFER, x), e.vertexAttribPointer(
1514
- d,
1537
+ c >= 0 && (x && (e.bindBuffer(e.ARRAY_BUFFER, x), e.vertexAttribPointer(
1538
+ c,
1515
1539
  h,
1516
- U,
1540
+ B,
1517
1541
  D,
1518
1542
  p,
1519
1543
  R
1520
- )), b ? e.enableVertexAttribArray(d) : e.disableVertexAttribArray(d)), v && e.deleteFramebuffer(v), f && e.deleteTexture(f), w && e.deleteTexture(w), B && e.deleteTexture(B), g && e.deleteBuffer(g), m && e.deleteProgram(m), e.bindFramebuffer(e.FRAMEBUFFER, c), e.bindBuffer(e.ARRAY_BUFFER, l), e.useProgram(o), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, u), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, _), e.activeTexture(i), y && e.enable(e.BLEND), E && e.enable(e.DEPTH_TEST), I && e.enable(e.SCISSOR_TEST), e.viewport(r[0], r[1], r[2], r[3]);
1544
+ )), b ? e.enableVertexAttribArray(c) : e.disableVertexAttribArray(c)), v && e.deleteFramebuffer(v), f && e.deleteTexture(f), w && e.deleteTexture(w), U && e.deleteTexture(U), g && e.deleteBuffer(g), m && e.deleteProgram(m), e.bindFramebuffer(e.FRAMEBUFFER, d), e.bindBuffer(e.ARRAY_BUFFER, l), e.useProgram(o), e.activeTexture(e.TEXTURE0), e.bindTexture(e.TEXTURE_2D, u), e.activeTexture(e.TEXTURE1), e.bindTexture(e.TEXTURE_2D, _), e.activeTexture(i), y && e.enable(e.BLEND), E && e.enable(e.DEPTH_TEST), I && e.enable(e.SCISSOR_TEST), e.viewport(r[0], r[1], r[2], r[3]);
1521
1545
  }
1522
1546
  if (!S)
1523
1547
  throw new Error(
@@ -1610,14 +1634,14 @@ return new NeutrinoEffect(ctx);
1610
1634
  const a = this.effectModel.textures[t], r = this.gamePlugin.texturesBasePath + a, o = noext(r);
1611
1635
  let l = this._findFrameInAtlases(s, a);
1612
1636
  if (l || (l = this._findFrameInAtlases(s, noext(a))), !l && this.scene.sys.textures.exists(o)) {
1613
- const c = this.scene.sys.textures.get(o);
1614
- l = c.get(c.firstFrame);
1637
+ const d = this.scene.sys.textures.get(o);
1638
+ l = d.get(d.firstFrame);
1615
1639
  }
1616
1640
  l ? this._onTextureLoaded(t, l) : (this.scene.load.once(
1617
1641
  "filecomplete-image-" + o,
1618
- /* @__PURE__ */ ((c, i) => () => {
1642
+ /* @__PURE__ */ ((d, i) => () => {
1619
1643
  const u = this.scene.sys.textures.get(i);
1620
- this._onTextureLoaded(c, u.get(u.firstFrame));
1644
+ this._onTextureLoaded(d, u.get(u.firstFrame));
1621
1645
  })(t, o)
1622
1646
  ), this.scene.load.image(o, r));
1623
1647
  }
@@ -1660,14 +1684,14 @@ return new NeutrinoEffect(ctx);
1660
1684
  }
1661
1685
  class NeutrinoFile extends Phaser.Loader.File {
1662
1686
  constructor(t, a) {
1663
- const { key: r, url: o, options: l, xhrSettings: c } = a;
1687
+ const { key: r, url: o, options: l, xhrSettings: d } = a;
1664
1688
  super(t, {
1665
1689
  type: "binary",
1666
1690
  extension: "js",
1667
1691
  responseType: "text",
1668
1692
  key: r,
1669
1693
  url: o,
1670
- xhrSettings: c
1694
+ xhrSettings: d
1671
1695
  });
1672
1696
  n(this, "_options");
1673
1697
  this.cache = t.cacheManager.binary, this._options = l;
@@ -1703,8 +1727,8 @@ class DataTextureManager {
1703
1727
  );
1704
1728
  this._gl = e, this.textureWidth = a, this.textureHeight = r, this._floatView = new Float32Array(t.buffer, t.byteOffset, t.length);
1705
1729
  for (let l = 0; l < RING_BUFFER_SIZE$1; l++) {
1706
- const c = e.createTexture();
1707
- e.bindTexture(e.TEXTURE_2D, c), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texImage2D(
1730
+ const d = e.createTexture();
1731
+ e.bindTexture(e.TEXTURE_2D, d), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MIN_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_MAG_FILTER, e.NEAREST), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_S, e.CLAMP_TO_EDGE), e.texParameteri(e.TEXTURE_2D, e.TEXTURE_WRAP_T, e.CLAMP_TO_EDGE), e.texImage2D(
1708
1732
  e.TEXTURE_2D,
1709
1733
  0,
1710
1734
  e.RGBA32F,
@@ -1714,7 +1738,7 @@ class DataTextureManager {
1714
1738
  e.RGBA,
1715
1739
  e.FLOAT,
1716
1740
  null
1717
- ), this._textures.push(c);
1741
+ ), this._textures.push(d);
1718
1742
  }
1719
1743
  e.bindTexture(e.TEXTURE_2D, null);
1720
1744
  }
@@ -1791,10 +1815,10 @@ class DataTextureManagerGL1 {
1791
1815
  this._gl = e, this.textureWidth = a, this.textureHeight = r, this._floatView = new Float32Array(t.buffer, t.byteOffset, t.length), this.meta = new MetaTextureManager(a, r);
1792
1816
  const l = e.getParameter(e.ACTIVE_TEXTURE);
1793
1817
  e.activeTexture(e.TEXTURE0);
1794
- const c = e.getParameter(e.TEXTURE_BINDING_2D);
1818
+ const d = e.getParameter(e.TEXTURE_BINDING_2D);
1795
1819
  for (let i = 0; i < RING_BUFFER_SIZE; i++)
1796
1820
  this._dataTextures.push(this._createTexture(e.FLOAT)), this._metaTextures.push(this._createTexture(e.UNSIGNED_BYTE));
1797
- e.bindTexture(e.TEXTURE_2D, c), e.activeTexture(l);
1821
+ e.bindTexture(e.TEXTURE_2D, d), e.activeTexture(l);
1798
1822
  }
1799
1823
  get currentDataTexture() {
1800
1824
  return this._dataTextures[this._currentIndex];
@@ -1810,7 +1834,7 @@ class DataTextureManagerGL1 {
1810
1834
  upload(e, t, a) {
1811
1835
  const r = this._gl, o = this.textureWidth, l = Math.min(this.textureHeight, Math.ceil(e * 4 / o));
1812
1836
  if (l === 0) return;
1813
- const c = l * o * 4;
1837
+ const d = l * o * 4;
1814
1838
  r.pixelStorei(r.UNPACK_FLIP_Y_WEBGL, !1), r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !1), r.pixelStorei(r.UNPACK_ALIGNMENT, 4), r.activeTexture(r.TEXTURE0 + t), r.bindTexture(r.TEXTURE_2D, this.currentDataTexture), r.texSubImage2D(
1815
1839
  r.TEXTURE_2D,
1816
1840
  0,
@@ -1820,7 +1844,7 @@ class DataTextureManagerGL1 {
1820
1844
  l,
1821
1845
  r.RGBA,
1822
1846
  r.FLOAT,
1823
- this._floatView.subarray(0, c)
1847
+ this._floatView.subarray(0, d)
1824
1848
  ), r.activeTexture(r.TEXTURE0 + a), r.bindTexture(r.TEXTURE_2D, this.currentMetaTexture), r.texSubImage2D(
1825
1849
  r.TEXTURE_2D,
1826
1850
  0,
@@ -1830,7 +1854,7 @@ class DataTextureManagerGL1 {
1830
1854
  l,
1831
1855
  r.RGBA,
1832
1856
  r.UNSIGNED_BYTE,
1833
- this.meta.bytes.subarray(0, c)
1857
+ this.meta.bytes.subarray(0, d)
1834
1858
  );
1835
1859
  }
1836
1860
  advance() {
@@ -1885,9 +1909,9 @@ class NeutrinoRenderer {
1885
1909
  for (let e = 0; e < MAX_BATCHES; e++)
1886
1910
  this._batchPool.push(new DrawBatch());
1887
1911
  }
1888
- render(e, t, a, r, o, l, c) {
1912
+ render(e, t, a, r, o, l, d) {
1889
1913
  if (l === 0) return;
1890
- const i = e.gl, u = e.isWebGL1, _ = e.maxBatchTextures, y = c.renderStyles, E = c.materials, I = u ? t.meta : null;
1914
+ const i = e.gl, u = e.isWebGL1, _ = e.maxBatchTextures, y = d.renderStyles, E = d.materials, I = u ? t.meta : null;
1891
1915
  I && I.build(r, l), this._batchCount = 0;
1892
1916
  const m = this._texSlotMap;
1893
1917
  for (; this._batchPool.length < o.length; )
@@ -1902,21 +1926,21 @@ class NeutrinoRenderer {
1902
1926
  if (!m.has(g)) {
1903
1927
  if (m.size >= _) break;
1904
1928
  const x = m.size;
1905
- m.set(g, x), f.glTextures[x] = c.glTextures[g] || null, f.remaps[x] = c.remaps[g] || null, f.numTextures = x + 1;
1929
+ m.set(g, x), f.glTextures[x] = d.glTextures[g] || null, f.remaps[x] = d.remaps[g] || null, f.numTextures = x + 1;
1906
1930
  }
1907
- const d = m.get(g), b = o[v];
1931
+ const c = m.get(g), b = o[v];
1908
1932
  if (I)
1909
- I.patchSlot(b.startParticleIndex, b.numParticles, d);
1910
- else if (d !== 0)
1933
+ I.patchSlot(b.startParticleIndex, b.numParticles, c);
1934
+ else if (c !== 0)
1911
1935
  for (let x = 0; x < b.numParticles; x++) {
1912
- const h = (b.startParticleIndex + x) * BYTES_PER_PARTICLE, U = a.getUint32(h, !0);
1913
- a.setUint32(h, U & 4294967040 | d, !0);
1936
+ const h = (b.startParticleIndex + x) * BYTES_PER_PARTICLE, B = a.getUint32(h, !0);
1937
+ a.setUint32(h, B & 4294967040 | c, !0);
1914
1938
  }
1915
1939
  f.numParticles += b.numParticles, v++;
1916
1940
  }
1917
1941
  this._batchCount++, w = v;
1918
1942
  }
1919
- const B = i.isEnabled(i.SCISSOR_TEST);
1943
+ const U = i.isEnabled(i.SCISSOR_TEST);
1920
1944
  try {
1921
1945
  if (i.disable(i.DEPTH_TEST), i.disable(i.STENCIL_TEST), i.disable(i.SCISSOR_TEST), i.disable(i.CULL_FACE), i.depthMask(!1), i.colorMask(!0, !0, !0, !0), i.useProgram(e.shaderProgram), u) {
1922
1946
  const p = t;
@@ -1926,23 +1950,23 @@ class NeutrinoRenderer {
1926
1950
  p.uploadAndBind(DATA_TEXTURE_UNIT), i.uniform1i(e.uDataTexture, DATA_TEXTURE_UNIT), i.uniform1i(e.uDataTextureWidth, p.textureWidth);
1927
1951
  }
1928
1952
  i.uniform3f(e.uCameraRight, 1, 0, 0), i.uniform3f(e.uCameraUp, 0, -1, 0), i.uniform3f(e.uCameraDir, 0, 0, -1);
1929
- const f = c.viewportWidth, v = c.viewportHeight, g = c.zoom || 1, d = this._orthoMatrix;
1930
- if (d.fill(0), d[0] = 2 / f * g, d[5] = -2 / v * g, d[10] = 0, d[15] = 1, d[12] = -1 - 2 / f * g * c.scrollX, d[13] = 1 + 2 / v * g * c.scrollY, c.projection) {
1953
+ const f = d.viewportWidth, v = d.viewportHeight, g = d.zoom || 1, c = this._orthoMatrix;
1954
+ if (c.fill(0), c[0] = 2 / f * g, c[5] = -2 / v * g, c[10] = 0, c[15] = 1, c[12] = -1 - 2 / f * g * d.scrollX, c[13] = 1 + 2 / v * g * d.scrollY, d.projection) {
1931
1955
  const p = this._projFrame;
1932
- p.x = 0, p.y = 0, p.width = f, p.height = v, c.projection.setScreenFrame(p), c.projection.writeMatrix(this._perspMatrix), this._mulMatrix(this._vpMatrix, d, this._perspMatrix), i.uniformMatrix4fv(e.uViewProjMatrix, !1, this._vpMatrix);
1956
+ p.x = 0, p.y = 0, p.width = f, p.height = v, d.projection.setScreenFrame(p), d.projection.writeMatrix(this._perspMatrix), this._mulMatrix(this._vpMatrix, c, this._perspMatrix), i.uniformMatrix4fv(e.uViewProjMatrix, !1, this._vpMatrix);
1933
1957
  } else
1934
- i.uniformMatrix4fv(e.uViewProjMatrix, !1, d);
1958
+ i.uniformMatrix4fv(e.uViewProjMatrix, !1, c);
1935
1959
  const b = v > 0 ? f / v : 1;
1936
- e.uViewportAspect && i.uniform1f(e.uViewportAspect, b), e.uWorldAlpha && i.uniform1f(e.uWorldAlpha, c.worldAlpha);
1937
- const x = c.model, h = this._modelMatrix;
1960
+ e.uViewportAspect && i.uniform1f(e.uViewportAspect, b), e.uWorldAlpha && i.uniform1f(e.uWorldAlpha, d.worldAlpha);
1961
+ const x = d.model, h = this._modelMatrix;
1938
1962
  h[0] = x.a, h[1] = x.b, h[2] = 0, h[3] = 0, h[4] = x.c, h[5] = x.d, h[6] = 0, h[7] = 0, h[8] = 0, h[9] = 0, h[10] = 1, h[11] = 0, h[12] = x.tx, h[13] = x.ty, h[14] = 0, h[15] = 1, i.uniformMatrix4fv(e.uModelMatrix, !1, h), u ? (e.unbindVao(), i.bindBuffer(i.ARRAY_BUFFER, e.aIdBuffer), i.enableVertexAttribArray(e.aIdLocation), i.vertexAttribPointer(e.aIdLocation, 1, i.FLOAT, !1, 0, 0), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, e.indexBuffer)) : i.bindVertexArray(e.vao);
1939
- const U = u ? PARTICLE_TEXTURE_START_UNIT_GL1 : PARTICLE_TEXTURE_START_UNIT;
1963
+ const B = u ? PARTICLE_TEXTURE_START_UNIT_GL1 : PARTICLE_TEXTURE_START_UNIT;
1940
1964
  i.enable(i.BLEND);
1941
1965
  for (let p = 0; p < this._batchCount; p++) {
1942
1966
  const R = this._batchPool[p];
1943
1967
  this._applyBlendMode(i, R.blendMode);
1944
1968
  for (let T = 0; T < R.numTextures; T++) {
1945
- const C = U + T;
1969
+ const C = B + T;
1946
1970
  i.activeTexture(i.TEXTURE0 + C), i.bindTexture(i.TEXTURE_2D, R.glTextures[T]), i.uniform1i(e.uTextures[T], C);
1947
1971
  const P = R.remaps[T];
1948
1972
  P ? i.uniform4f(e.uTexRemaps[T], P.x, P.y, P.width, P.height) : i.uniform4f(e.uTexRemaps[T], 0, 0, 1, 1);
@@ -1956,7 +1980,7 @@ class NeutrinoRenderer {
1956
1980
  );
1957
1981
  }
1958
1982
  } finally {
1959
- u ? (i.disableVertexAttribArray(e.aIdLocation), i.bindBuffer(i.ARRAY_BUFFER, null), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null)) : i.bindVertexArray(null), i.useProgram(null), B && i.enable(i.SCISSOR_TEST);
1983
+ u ? (i.disableVertexAttribArray(e.aIdLocation), i.bindBuffer(i.ARRAY_BUFFER, null), i.bindBuffer(i.ELEMENT_ARRAY_BUFFER, null)) : i.bindVertexArray(null), i.useProgram(null), U && i.enable(i.SCISSOR_TEST);
1960
1984
  }
1961
1985
  }
1962
1986
  // Resolve a renderStyle's compacted material INDEX to the real blend enum (0=Normal/
@@ -1968,8 +1992,8 @@ class NeutrinoRenderer {
1968
1992
  // Column-major 4x4 multiply: out = a * b. Preallocated outputs only.
1969
1993
  _mulMatrix(e, t, a) {
1970
1994
  for (let r = 0; r < 16; r += 4) {
1971
- const o = a[r], l = a[r + 1], c = a[r + 2], i = a[r + 3];
1972
- e[r] = t[0] * o + t[4] * l + t[8] * c + t[12] * i, e[r + 1] = t[1] * o + t[5] * l + t[9] * c + t[13] * i, e[r + 2] = t[2] * o + t[6] * l + t[10] * c + t[14] * i, e[r + 3] = t[3] * o + t[7] * l + t[11] * c + t[15] * i;
1995
+ const o = a[r], l = a[r + 1], d = a[r + 2], i = a[r + 3];
1996
+ e[r] = t[0] * o + t[4] * l + t[8] * d + t[12] * i, e[r + 1] = t[1] * o + t[5] * l + t[9] * d + t[13] * i, e[r + 2] = t[2] * o + t[6] * l + t[10] * d + t[14] * i, e[r + 3] = t[3] * o + t[7] * l + t[11] * d + t[15] * i;
1973
1997
  }
1974
1998
  }
1975
1999
  _resolveBlend(e, t) {
@@ -2060,7 +2084,7 @@ class Effect extends Phaser.GameObjects.GameObject {
2060
2084
  this._checkUnpauseOnUpdateRender();
2061
2085
  const o = this.gamePlugin.ctx, l = this._dataTextureManager;
2062
2086
  this.effect.construct([0, 0, -1]);
2063
- const c = this.effect.renderInstructions, i = c._totalParticles;
2087
+ const d = this.effect.renderInstructions, i = d._totalParticles;
2064
2088
  if (i === 0) return;
2065
2089
  t.flush();
2066
2090
  const u = this.effectModel.effectModel.textures.length, _ = this._glTexturesScratch;
@@ -2074,7 +2098,7 @@ class Effect extends Phaser.GameObjects.GameObject {
2074
2098
  l,
2075
2099
  this.effect.particleDataView,
2076
2100
  this.effect.particleDataUint32,
2077
- c,
2101
+ d,
2078
2102
  i,
2079
2103
  {
2080
2104
  model: { a: y, b: 0, c: 0, d: y, tx: 0, ty: 0 },
@@ -2156,8 +2180,8 @@ class Effect extends Phaser.GameObjects.GameObject {
2156
2180
  _updateWorldTransform() {
2157
2181
  const t = (o, l) => {
2158
2182
  if (!o) return;
2159
- const c = this._tempMatrix2;
2160
- c.applyITRS(o.x, o.y, o.rotation, o.scaleX, o.scaleY), c.multiply(l.matrix, l.matrix), l.angle += o.angle, l.scale *= (o.scaleX + o.scaleY) * 0.5, t(o.parentContainer, l);
2183
+ const d = this._tempMatrix2;
2184
+ d.applyITRS(o.x, o.y, o.rotation, o.scaleX, o.scaleY), d.multiply(l.matrix, l.matrix), l.angle += o.angle, l.scale *= (o.scaleX + o.scaleY) * 0.5, t(o.parentContainer, l);
2161
2185
  }, a = {
2162
2186
  matrix: this._tempMatrix1.loadIdentity(),
2163
2187
  angle: this.angle,