reze-engine 0.57.0 → 0.57.2
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/dist/engine.d.ts +140 -9
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +417 -94
- package/dist/shaders/cast-api.d.ts +16 -1
- package/dist/shaders/cast-api.d.ts.map +1 -1
- package/dist/shaders/cast-api.js +80 -14
- package/dist/shaders/lights.d.ts.map +1 -1
- package/dist/shaders/lights.js +13 -9
- package/dist/shaders/passes/cast-distance.d.ts +8 -0
- package/dist/shaders/passes/cast-distance.d.ts.map +1 -1
- package/dist/shaders/passes/cast-distance.js +13 -1
- package/dist/shaders/passes/composite.d.ts +1 -1
- package/dist/shaders/passes/composite.d.ts.map +1 -1
- package/dist/shaders/passes/composite.js +22 -6
- package/dist/shaders/passes/grid.d.ts.map +1 -1
- package/dist/shaders/passes/grid.js +9 -0
- package/dist/shaders/passes/particles.d.ts.map +1 -1
- package/dist/shaders/passes/particles.js +8 -6
- package/dist/shaders/passes/trails.d.ts.map +1 -1
- package/dist/shaders/passes/trails.js +16 -11
- package/package.json +1 -1
- package/src/engine.ts +485 -95
- package/src/shaders/cast-api.ts +82 -14
- package/src/shaders/lights.ts +13 -9
- package/src/shaders/passes/cast-distance.ts +13 -1
- package/src/shaders/passes/composite.ts +22 -6
- package/src/shaders/passes/grid.ts +9 -0
- package/src/shaders/passes/particles.ts +8 -6
- package/src/shaders/passes/trails.ts +15 -10
|
@@ -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 (
|
|
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
|
|
82
|
-
//
|
|
83
|
-
// decoded by it here, and the two must use the same number or the
|
|
84
|
-
// [ribbon][subject][segment] index lands on the wrong ribbon. It is
|
|
85
|
-
// rather than the RZ_SUBJECTS constant precisely because it changes
|
|
86
|
-
// model is added
|
|
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
|
-
|
|
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
|
|
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; }
|