reze-engine 0.57.0 → 0.57.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.
@@ -4,7 +4,7 @@ import { audioApi } from "../audio-api";
4
4
  import { lyricsApi } from "../lyrics-api";
5
5
  import { anchorAliasWgsl, ribbonSlotWgsl } from "../anchor-table";
6
6
  import { midiApi } from "../midi-api";
7
- import { CAST_API } from "../cast-api";
7
+ import { CAST_API, subjectMaskApi } from "../cast-api";
8
8
  import { EFFECT_SUBJECT_VEC4S } from "../cast-layout";
9
9
  import { clockApi, EFFECT_MATH_API, PARTICLE_STRUCT_WGSL, trailSlotsApi, viewportApi } from "./hosted-api";
10
10
  import { sceneIdFieldWgsl, sceneIdPadWgsl } from "./scene-contract";
@@ -43,7 +43,8 @@ export function trailEntryPoints(wgsl) {
43
43
  * of vanishing edge-on where it turns.
44
44
  */
45
45
  export function buildTrailShader(src, cast) {
46
- return (CAST_API +
46
+ return (subjectMaskApi("u32(tu.mask)") +
47
+ CAST_API +
47
48
  trailSlotsApi(src.slots) +
48
49
  EFFECT_MATH_API +
49
50
  PARTICLE_STRUCT_WGSL +
@@ -78,17 +79,21 @@ struct CameraU {
78
79
  }
79
80
  struct TrailU {
80
81
  time: f32,
81
- // How many subjects the cast ACTUALLY holds this frame, not the four the
82
- // layout has room for. The instance count is sized by this on the CPU and
83
- // decoded by it here, and the two must use the same number or the flattened
84
- // [ribbon][subject][segment] index lands on the wrong ribbon. It is a uniform
85
- // rather than the RZ_SUBJECTS constant precisely because it changes when a
86
- // model is added or removed, and recompiling every trail shader for that
87
- // would be absurd.
82
+ // How many subjects THIS EFFECT ribbons this frame, not the four the layout
83
+ // has room for and not the whole cast. The instance count is sized by this on
84
+ // the CPU and decoded by it here, and the two must use the same number or the
85
+ // flattened [ribbon][subject][segment] index lands on the wrong ribbon. It is
86
+ // a uniform rather than the RZ_SUBJECTS constant precisely because it changes
87
+ // when a model is added, removed, hidden or taken off this effect's list, and
88
+ // recompiling every trail shader for that would be absurd.
89
+ //
90
+ // The subject it decodes is the effect's OWN index, which is what rzTrail
91
+ // takes — so a ribbon aimed at one dancer draws one ribbon, on her.
88
92
  subjects: f32,
89
93
  /** The effect's evaluated influence, applied at the one output site below. */
90
94
  weight: f32,
91
- _pad2: f32,
95
+ /** Which cast slots this effect is on, one bit each — see subjectMaskApi. */
96
+ mask: f32,
92
97
  }
93
98
  ${src.paramsDecl}
94
99
  @group(0) @binding(0) var<storage, read> _rzCast: array<vec4f>;
@@ -112,7 +117,7 @@ fn rzProject(p: vec3f) -> vec3f {
112
117
  return vec3f(clip.xy / w * 0.5 + 0.5, clip.w);
113
118
  }
114
119
  fn rzCamPos() -> vec3f { return cam.camPos; }
115
- fn rzSubjectCount() -> i32 {
120
+ fn _rzCastLive() -> i32 {
116
121
  var n = 0;
117
122
  for (var i = 0; i < RZ_SUBJECTS; i++) {
118
123
  if (_rzCast[i * ${EFFECT_SUBJECT_VEC4S} + 2].w > 0.0) { n = i + 1; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reze-engine",
3
- "version": "0.57.0",
3
+ "version": "0.57.1",
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",