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.
- package/README.md +7 -3
- package/dist/engine.d.ts +39 -9
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +93 -10
- package/dist/graph/registry.d.ts.map +1 -1
- package/dist/graph/registry.js +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/reflection.d.ts.map +1 -1
- package/dist/reflection.js +3 -0
- package/dist/shaders/lights.d.ts +7 -6
- package/dist/shaders/lights.d.ts.map +1 -1
- package/dist/shaders/lights.js +59 -16
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +10 -1
- package/dist/shaders/passes/cast-distance.d.ts +5 -1
- package/dist/shaders/passes/cast-distance.d.ts.map +1 -1
- package/dist/shaders/passes/cast-distance.js +21 -5
- package/package.json +1 -1
- package/src/engine.ts +113 -14
- package/src/graph/registry.ts +10 -0
- package/src/index.ts +1 -0
- package/src/reflection.ts +3 -0
- package/src/shaders/lights.ts +59 -16
- package/src/shaders/materials/common.ts +10 -1
- package/src/shaders/passes/cast-distance.ts +21 -5
|
@@ -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.
|
|
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
|
-
|
|
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
|