reze-engine 0.56.9 → 0.56.11

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.
@@ -81,7 +81,11 @@ fn vs(@builtin(vertex_index) i: u32) -> VSOut {
81
81
  *
82
82
  * The ground, a stage and a media plane all write ids exactly as she does, so
83
83
  * seeding "anything drawn" would grow a border around the floor: a rectangle
84
- * round the frame rather than a sticker. Only the subject ids seed.
84
+ * round the frame rather than a sticker. The subject ids seed, and so do the
85
+ * props': a sword in her hand is part of her silhouette. A prop left out is a
86
+ * HOLE in the seeds wherever it covers her, and the field grows into it from
87
+ * her side, so the border ran round the inside of the prop instead of the
88
+ * outside.
85
89
  */
86
90
  export function buildCastSeedShader(samples: number): string {
87
91
  return (
@@ -92,6 +96,9 @@ const RZ_ID_SAMPLES: i32 = ${samples};
92
96
 
93
97
  @group(0) @binding(0) var _rzIdTex: texture_multisampled_2d<u32>;
94
98
  @group(0) @binding(1) var<storage, read> _rzCast: array<vec4f>;
99
+ /** The visible props' object ids, count first. Props are not subjects, so the
100
+ * cast buffer does not carry them. */
101
+ @group(0) @binding(2) var<storage, read> _rzSeedProps: array<u32>;
95
102
 
96
103
  // The two cast accessors this pass needs, spelled out rather than pulled in.
97
104
  // CAST_API brings subjects, trails, anchors and their aliases with it, and a
@@ -107,6 +114,17 @@ fn rzSubjectId(i: i32) -> u32 {
107
114
  if (i < 0 || i >= rzSubjectCount()) { return 0u; }
108
115
  return u32(_rzCast[i * ${EFFECT_SUBJECT_VEC4S} + 1].w);
109
116
  }
117
+ /** Does this object seed the field: a subject, or a prop. */
118
+ fn rzSeeds(o: u32, subjects: i32) -> bool {
119
+ for (var i = 0; i < subjects; i++) {
120
+ if (o == rzSubjectId(i)) { return true; }
121
+ }
122
+ let props = min(_rzSeedProps[0], arrayLength(&_rzSeedProps) - 1u);
123
+ for (var j = 1u; j <= props; j++) {
124
+ if (o == _rzSeedProps[j]) { return true; }
125
+ }
126
+ return false;
127
+ }
110
128
 
111
129
  ${FULLSCREEN_VS}
112
130
 
@@ -140,9 +158,7 @@ fn fs(@builtin(position) pos: vec4f) -> SeedOut {
140
158
  for (var sample = 0; sample < RZ_ID_SAMPLES; sample++) {
141
159
  let o = textureLoad(_rzIdTex, p, sample).y;
142
160
  if (o == 0u) { continue; }
143
- for (var i = 0; i < n; i++) {
144
- if (o == rzSubjectId(i)) { covered += 1.0; break; }
145
- }
161
+ if (rzSeeds(o, n)) { covered += 1.0; }
146
162
  }
147
163
  var out: SeedOut;
148
164
  out.coverage = covered / f32(RZ_ID_SAMPLES);
@@ -265,7 +281,7 @@ export function castDistanceApi(group: number, tex: number, samp: number, scale:
265
281
  *
266
282
  * There is no ceiling. A pixel on the far side of the frame gets the real
267
283
  * number. The ground, a stage and a media plane are not the cast and do not
268
- * seed it.
284
+ * seed it. A prop does: what she holds is inside her border.
269
285
  *
270
286
  * Screen pixels whatever the field's own resolution is, so an author writes the
271
287
  * width they mean and never has to know how this is built. uv is the effect's