reze-engine 0.69.7 → 0.69.9

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.
@@ -209,6 +209,13 @@ fn rzProject(p: vec3f) -> vec3f {
209
209
  fn rzCamPos() -> vec3f { return cam.camPos; }
210
210
  `
211
211
 
212
+ /** `fn particleStep(p, dt, id: u32)`: the step is told the particle's slot, as
213
+ * particleInit is, so it can read the slot's emitter. Two parameters is the
214
+ * usual step and is called as before. */
215
+ function stepTakesId(wgsl: string): boolean {
216
+ return /\bfn\s+particleStep\s*\([^)]*,[^)]*,[^)]*\)/.test(wgsl)
217
+ }
218
+
212
219
  /** Does the source define the particle contract? All three are required
213
220
  * together; `cover` is optional and only means anything to a cutout, and
214
221
  * `count` is optional and bounds the frame's work — see particleCount. */
@@ -302,7 +309,7 @@ fn main(@builtin(global_invocation_id) gid: vec3u) {
302
309
  // its life staggers the pool, which is the difference between snow and a
303
310
  // pulse of snow arriving all at once every few seconds.
304
311
  } else {
305
- p = particleStep(p, pu.dt);
312
+ p = particleStep(p, pu.dt${stepTakesId(src.wgsl) ? ", i" : ""});
306
313
  p.age = p.age + pu.dt;
307
314
  }
308
315
  particles[i] = p;
@@ -376,7 +383,12 @@ struct VSOut {
376
383
  fn vs(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VSOut {
377
384
  var out: VSOut;
378
385
  out.id = ii;
379
- let p = particles[ii];
386
+ ${/\bfn\s+particleWorld\s*\(/.test(src.wgsl) ? ` // the effect keeps the pool in its emitters' own frames (Unity's Local
387
+ // simulation space: a beam riding a moving head); particleWorld puts this
388
+ // one in the world as its emitter stands now, before the card is built
389
+ let p = particleWorld(particles[ii], ii);
390
+ ` : ` let p = particles[ii];
391
+ `}
380
392
  // Two triangles, corners in the order 0,1,2, 2,1,3.
381
393
  let quad = array<vec2f, 6>(
382
394
  vec2f(-1.0, -1.0), vec2f(1.0, -1.0), vec2f(-1.0, 1.0),