reze-engine 0.68.24 → 0.68.25

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.
@@ -45,6 +45,13 @@ type ParticleSource = {
45
45
  * stretched particle stretches along its velocity projected into it. `id`
46
46
  * is the particle's slot, so the axes can come from its emitter. */
47
47
  orient?: boolean;
48
+ /** The effect defines `particleCorner(p: Particle, id: u32, corner: u32) ->
49
+ * vec3f`: where each corner of the quad stands in world space, 0 and 1 along
50
+ * the bottom, 2 and 3 along the top, replacing the card entirely. Corners 2
51
+ * and 3 at one point make a true triangle with uv as its barycentrics, so a
52
+ * pool can draw a mesh: the positions are read in the vertex stage, after
53
+ * the step, where every corner of a frame sees the same state of the pool. */
54
+ corner?: boolean;
48
55
  /** The effect defines `particleCount() -> u32`: how many of the pool are
49
56
  * live this frame, as a function of its dials. The step is dispatched and
50
57
  * the quads drawn for that many slots and no more, through indirect
@@ -1 +1 @@
1
- {"version":3,"file":"particles.d.ts","sourceRoot":"","sources":["../../../src/shaders/passes/particles.ts"],"names":[],"mappings":"AAgCA,sEAAsE;AACtE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,iFAAiF;IACjF,KAAK,EAAE,MAAM,CAAA;IACb;;mFAE+E;IAC/E,UAAU,EAAE,MAAM,CAAA;IAClB,+EAA+E;IAC/E,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB,CAAA;AAkCD,qDAAqD;AACrD;0EAC0E;AAC1E,KAAK,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,CAAA;AAEpD,KAAK,cAAc,GAAG;IACpB,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,qFAAqF;IACrF,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,aAAa,CAAA;IACpB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BAAuB,KAAK,CAAA;AACzC;uCACuC;AACvC,eAAO,MAAM,wBAAwB,KAAK,CAAA;AAC1C,eAAO,MAAM,gCAAgC,KAAK,CAAA;AAClD,eAAO,MAAM,6BAA6B,KAAK,CAAA;AAE/C,oEAAoE;AACpE,eAAO,MAAM,eAAe,KAAK,CAAA;AAwDjC;;2EAE2E;AAC3E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CASnJ;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CA6ExF;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAyMvF"}
@@ -313,8 +313,10 @@ ${src.orient ? ` // the author's own plane (particleOrient): a card on a surfac
313
313
  r = vec2f(d.y, -d.x) * cp.x + d * (cp.y * p.stretch);
314
314
  }
315
315
  }
316
- let world = p.pos + (right * r.x + up * r.y) * p.size;
317
- out.clip = cam.proj * cam.view * vec4f(world, 1.0);
316
+ ${/\bfn\s+particleCorner\s*\(/.test(src.wgsl) ? ` let corners = array<u32, 6>(0u, 1u, 2u, 2u, 1u, 3u);
317
+ let world = particleCorner(p, ii, corners[vi]);
318
+ ` : ` let world = p.pos + (right * r.x + up * r.y) * p.size;
319
+ `} out.clip = cam.proj * cam.view * vec4f(world, 1.0);
318
320
  return out;
319
321
  }
320
322
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reze-engine",
3
- "version": "0.68.24",
3
+ "version": "0.68.25",
4
4
  "description": "A lightweight WebGPU engine for real-time 3D MMD/PMX model rendering",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -111,6 +111,13 @@ type ParticleSource = {
111
111
  * stretched particle stretches along its velocity projected into it. `id`
112
112
  * is the particle's slot, so the axes can come from its emitter. */
113
113
  orient?: boolean
114
+ /** The effect defines `particleCorner(p: Particle, id: u32, corner: u32) ->
115
+ * vec3f`: where each corner of the quad stands in world space, 0 and 1 along
116
+ * the bottom, 2 and 3 along the top, replacing the card entirely. Corners 2
117
+ * and 3 at one point make a true triangle with uv as its barycentrics, so a
118
+ * pool can draw a mesh: the positions are read in the vertex stage, after
119
+ * the step, where every corner of a frame sees the same state of the pool. */
120
+ corner?: boolean
114
121
  /** The effect defines `particleCount() -> u32`: how many of the pool are
115
122
  * live this frame, as a function of its dials. The step is dispatched and
116
123
  * the quads drawn for that many slots and no more, through indirect
@@ -411,8 +418,10 @@ ${src.orient ? ` // the author's own plane (particleOrient): a card on a surfac
411
418
  r = vec2f(d.y, -d.x) * cp.x + d * (cp.y * p.stretch);
412
419
  }
413
420
  }
414
- let world = p.pos + (right * r.x + up * r.y) * p.size;
415
- out.clip = cam.proj * cam.view * vec4f(world, 1.0);
421
+ ${/\bfn\s+particleCorner\s*\(/.test(src.wgsl) ? ` let corners = array<u32, 6>(0u, 1u, 2u, 2u, 1u, 3u);
422
+ let world = particleCorner(p, ii, corners[vi]);
423
+ ` : ` let world = p.pos + (right * r.x + up * r.y) * p.size;
424
+ `} out.clip = cam.proj * cam.view * vec4f(world, 1.0);
416
425
  return out;
417
426
  }
418
427