reze-engine 0.65.0 → 0.66.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.
- package/dist/engine.d.ts +156 -42
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +876 -186
- package/dist/graph/compile.d.ts.map +1 -1
- package/dist/graph/compile.js +5 -0
- package/dist/graph/presets/body.d.ts.map +1 -1
- package/dist/graph/presets/body.js +26 -24
- package/dist/graph/presets/cloth_rough.js +8 -8
- package/dist/graph/presets/cloth_smooth.js +8 -8
- package/dist/graph/presets/default.js +4 -4
- package/dist/graph/presets/eye.js +10 -10
- package/dist/graph/presets/face.d.ts.map +1 -1
- package/dist/graph/presets/face.js +28 -26
- package/dist/graph/presets/hair.js +6 -6
- package/dist/graph/presets/metal.js +8 -8
- package/dist/graph/presets/stockings.d.ts.map +1 -1
- package/dist/graph/presets/stockings.js +4 -11
- package/dist/graph/presets/unlit.d.ts.map +1 -1
- package/dist/graph/presets/unlit.js +9 -13
- package/dist/graph/registry.d.ts.map +1 -1
- package/dist/graph/registry.js +128 -157
- package/dist/graph/render-class.d.ts +5 -2
- package/dist/graph/render-class.d.ts.map +1 -1
- package/dist/graph/slots.d.ts.map +1 -1
- package/dist/graph/slots.js +5 -1
- package/dist/model.d.ts +14 -1
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +27 -1
- package/dist/pmx-loader.d.ts +4 -0
- package/dist/pmx-loader.d.ts.map +1 -1
- package/dist/pmx-loader.js +11 -2
- package/dist/shaders/anchor-table.d.ts +11 -0
- package/dist/shaders/anchor-table.d.ts.map +1 -1
- package/dist/shaders/anchor-table.js +9 -3
- package/dist/shaders/directives.d.ts +42 -5
- package/dist/shaders/directives.d.ts.map +1 -1
- package/dist/shaders/directives.js +51 -4
- package/dist/shaders/lights.d.ts +11 -7
- package/dist/shaders/lights.d.ts.map +1 -1
- package/dist/shaders/lights.js +315 -271
- package/dist/shaders/materials/common.d.ts.map +1 -1
- package/dist/shaders/materials/common.js +26 -3
- package/dist/shaders/materials/nodes.d.ts +1 -1
- package/dist/shaders/materials/nodes.d.ts.map +1 -1
- package/dist/shaders/materials/nodes.js +191 -271
- 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 +3 -5
- package/dist/shaders/passes/ground.js +1 -1
- package/dist/shaders/passes/particles.d.ts.map +1 -1
- package/dist/shaders/passes/particles.js +9 -3
- package/dist/shaders/passes/probe.d.ts +45 -0
- package/dist/shaders/passes/probe.d.ts.map +1 -0
- package/dist/shaders/passes/probe.js +230 -0
- package/dist/shaders/passes/scene-contract.d.ts +13 -0
- package/dist/shaders/passes/scene-contract.d.ts.map +1 -1
- package/dist/shaders/passes/scene-contract.js +4 -0
- package/dist/shaders/scene-light-api.d.ts.map +1 -1
- package/dist/shaders/scene-light-api.js +1 -0
- package/dist/unity/globals.d.ts +7 -0
- package/dist/unity/globals.d.ts.map +1 -1
- package/dist/unity/globals.js +4 -3
- package/dist/unity/host.d.ts +3 -0
- package/dist/unity/host.d.ts.map +1 -1
- package/dist/unity/host.js +41 -7
- package/dist/unity/looks.d.ts +42 -0
- package/dist/unity/looks.d.ts.map +1 -1
- package/dist/unity/looks.js +131 -4
- package/dist/unity/stage.d.ts +17 -0
- package/dist/unity/stage.d.ts.map +1 -1
- package/dist/unity/stage.js +22 -5
- package/package.json +1 -1
- package/src/engine.ts +949 -215
- package/src/graph/compile.ts +4 -0
- package/src/graph/presets/body.ts +26 -24
- package/src/graph/presets/cloth_rough.ts +8 -8
- package/src/graph/presets/cloth_smooth.ts +8 -8
- package/src/graph/presets/default.ts +4 -4
- package/src/graph/presets/eye.ts +10 -10
- package/src/graph/presets/face.ts +28 -26
- package/src/graph/presets/hair.ts +6 -6
- package/src/graph/presets/metal.ts +8 -8
- package/src/graph/presets/stockings.ts +4 -11
- package/src/graph/presets/unlit.ts +9 -13
- package/src/graph/registry.ts +133 -158
- package/src/graph/render-class.ts +5 -2
- package/src/graph/slots.ts +5 -1
- package/src/model.ts +33 -1
- package/src/pmx-loader.ts +11 -2
- package/src/shaders/anchor-table.ts +15 -3
- package/src/shaders/directives.ts +88 -6
- package/src/shaders/lights.ts +464 -415
- package/src/shaders/materials/common.ts +26 -3
- package/src/shaders/materials/nodes.ts +191 -271
- package/src/shaders/passes/composite.ts +3 -5
- package/src/shaders/passes/ground.ts +1 -1
- package/src/shaders/passes/particles.ts +9 -3
- package/src/shaders/passes/probe.ts +240 -0
- package/src/shaders/passes/scene-contract.ts +17 -0
- package/src/shaders/scene-light-api.ts +1 -0
- package/src/unity/globals.ts +7 -3
- package/src/unity/host.ts +36 -6
- package/src/unity/looks.ts +161 -7
- package/src/unity/stage.ts +28 -5
- package/dist/physics-debug.d.ts +0 -30
- package/dist/physics-debug.d.ts.map +0 -1
- package/dist/physics-debug.js +0 -526
- package/dist/shaders/agx-lut.d.ts +0 -11
- package/dist/shaders/agx-lut.d.ts.map +0 -1
- package/dist/shaders/agx-lut.js +0 -29
- package/dist/shaders/dfg_lut.d.ts +0 -3
- package/dist/shaders/dfg_lut.d.ts.map +0 -1
- package/dist/shaders/dfg_lut.js +0 -129
- package/dist/shaders/ltc_mag_lut.d.ts +0 -3
- package/dist/shaders/ltc_mag_lut.d.ts.map +0 -1
- package/dist/shaders/ltc_mag_lut.js +0 -1033
- package/dist/shaders/materials/body.d.ts +0 -2
- package/dist/shaders/materials/body.d.ts.map +0 -1
- package/dist/shaders/materials/body.js +0 -95
- package/dist/shaders/materials/cloth_rough.d.ts +0 -2
- package/dist/shaders/materials/cloth_rough.d.ts.map +0 -1
- package/dist/shaders/materials/cloth_rough.js +0 -69
- package/dist/shaders/materials/cloth_smooth.d.ts +0 -2
- package/dist/shaders/materials/cloth_smooth.d.ts.map +0 -1
- package/dist/shaders/materials/cloth_smooth.js +0 -61
- package/dist/shaders/materials/default.d.ts +0 -2
- package/dist/shaders/materials/default.d.ts.map +0 -1
- package/dist/shaders/materials/default.js +0 -43
- package/dist/shaders/materials/eye.d.ts +0 -2
- package/dist/shaders/materials/eye.d.ts.map +0 -1
- package/dist/shaders/materials/eye.js +0 -60
- package/dist/shaders/materials/face.d.ts +0 -2
- package/dist/shaders/materials/face.d.ts.map +0 -1
- package/dist/shaders/materials/face.js +0 -95
- package/dist/shaders/materials/hair.d.ts +0 -2
- package/dist/shaders/materials/hair.d.ts.map +0 -1
- package/dist/shaders/materials/hair.js +0 -90
- package/dist/shaders/materials/metal.d.ts +0 -2
- package/dist/shaders/materials/metal.d.ts.map +0 -1
- package/dist/shaders/materials/metal.js +0 -77
- package/dist/shaders/materials/mmd_classic.d.ts +0 -2
- package/dist/shaders/materials/mmd_classic.d.ts.map +0 -1
- package/dist/shaders/materials/mmd_classic.js +0 -66
- package/dist/shaders/materials/stockings.d.ts +0 -2
- package/dist/shaders/materials/stockings.d.ts.map +0 -1
- package/dist/shaders/materials/stockings.js +0 -122
- package/dist/shaders/passes/physics-debug.d.ts +0 -2
- package/dist/shaders/passes/physics-debug.d.ts.map +0 -1
- package/dist/shaders/passes/physics-debug.js +0 -69
- package/src/shaders/dfg_lut.ts +0 -131
- package/src/shaders/ltc_mag_lut.ts +0 -1035
|
@@ -28,6 +28,30 @@
|
|
|
28
28
|
// each directive was, so every diagnostic's line number still points at the
|
|
29
29
|
// line the author is looking at.
|
|
30
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A bone an effect follows: `#anchor <bone> [trail] [along <d>]`.
|
|
33
|
+
*
|
|
34
|
+
* `along` is for an effect that comes off a point ON the bone rather than at its
|
|
35
|
+
* joint — threads leaving the knuckles, not the wrist; a flame at a sword's tip.
|
|
36
|
+
* The point is `d` model units down the bone's own axis: the direction a PMX
|
|
37
|
+
* editor draws the bone pointing (its tail, as an offset or as the bone it
|
|
38
|
+
* points at), turned by the bone's pose, scaled with the model. A left and a
|
|
39
|
+
* right wrist point opposite ways, so one number mirrors itself. A bone with no
|
|
40
|
+
* tail has no axis, and the point stays at the joint.
|
|
41
|
+
*
|
|
42
|
+
* Everything the anchor feeds reads the moved point: rzAnchor, the trail, the
|
|
43
|
+
* ribbon. Two effects naming the same bone at different `along` are two anchors.
|
|
44
|
+
*
|
|
45
|
+
* `trail step d` records the path the way a game's trail does (Unity's
|
|
46
|
+
* minVertexDistance): the newest point follows the bone every frame, and a
|
|
47
|
+
* point is only LEFT BEHIND once the bone is `d` world units from the last one.
|
|
48
|
+
* Sampled on the clock alone, a slowing hand leaves a knot of tiny segments
|
|
49
|
+
* whose directions jitter, and a wide ribbon fans across them into a starburst;
|
|
50
|
+
* a stepped path has no segment shorter than `d`. Ages stay true — each point
|
|
51
|
+
* keeps the time it was left. Different steps are different anchors.
|
|
52
|
+
*/
|
|
53
|
+
export type EffectAnchor = { bone: string; trail: boolean; along?: number; step?: number }
|
|
54
|
+
|
|
31
55
|
/** A knob an effect exposes, for a host to build a control from. */
|
|
32
56
|
export type EffectParamDecl = {
|
|
33
57
|
name: string
|
|
@@ -40,8 +64,10 @@ export type EffectParamDecl = {
|
|
|
40
64
|
}
|
|
41
65
|
|
|
42
66
|
export type EffectDirectives = {
|
|
43
|
-
/** Bones this effect follows, in declaration order — slot 0 is the first.
|
|
44
|
-
|
|
67
|
+
/** Bones this effect follows, in declaration order — slot 0 is the first.
|
|
68
|
+
* `along` (model units, absent = 0) moves the point down the bone's own
|
|
69
|
+
* axis, its rest tail direction posed with it: see EffectAnchor. */
|
|
70
|
+
anchors: EffectAnchor[]
|
|
45
71
|
params: EffectParamDecl[]
|
|
46
72
|
/** Field layer: 0 full, 1 half. Full unless `#halfres` says otherwise. */
|
|
47
73
|
fieldLayer: 0 | 1
|
|
@@ -54,6 +80,16 @@ export type EffectDirectives = {
|
|
|
54
80
|
* every real grass renderer does, and the only thing that bounds a dense
|
|
55
81
|
* lawn's cost by the pixels it covers rather than by how deep it stacks. */
|
|
56
82
|
particleBlend: "alpha" | "additive" | "cutout"
|
|
83
|
+
/** How RIBBONS land, a separate axis from the particles': additive unless
|
|
84
|
+
* the file says `#blend over`. Ribbons ignored #blend until that keyword,
|
|
85
|
+
* and every shipped ribbon was tuned additive — so the default stays, and
|
|
86
|
+
* `over` is the opt-in. The same line sets particles to plain alpha, which
|
|
87
|
+
* already IS premultiplied over for them. */
|
|
88
|
+
trailBlend: "additive" | "over"
|
|
89
|
+
/** `#depth always`: the particles are drawn over the scene, not depth
|
|
90
|
+
* tested — a game glow its material draws with ZTest Always (a moon's halo
|
|
91
|
+
* in front of the sky dome it sits behind). Depth tested otherwise. */
|
|
92
|
+
depthAlways: boolean
|
|
57
93
|
particles: number
|
|
58
94
|
lights: number
|
|
59
95
|
grid: number
|
|
@@ -130,6 +166,7 @@ const SPEC = {
|
|
|
130
166
|
halfres: 0,
|
|
131
167
|
layer: 1,
|
|
132
168
|
blend: 1,
|
|
169
|
+
depth: 1,
|
|
133
170
|
particles: 1,
|
|
134
171
|
lights: 1,
|
|
135
172
|
grid: 1,
|
|
@@ -190,6 +227,8 @@ export function parseDirectives(wgsl: string): DirectiveResult {
|
|
|
190
227
|
fieldLayer: 0,
|
|
191
228
|
additiveLayer: false,
|
|
192
229
|
particleBlend: "alpha",
|
|
230
|
+
trailBlend: "additive",
|
|
231
|
+
depthAlways: false,
|
|
193
232
|
particles: 0,
|
|
194
233
|
lights: 0,
|
|
195
234
|
grid: 0,
|
|
@@ -223,11 +262,40 @@ export function parseDirectives(wgsl: string): DirectiveResult {
|
|
|
223
262
|
|
|
224
263
|
switch (tag) {
|
|
225
264
|
case "anchor": {
|
|
226
|
-
|
|
227
|
-
|
|
265
|
+
// <bone> [trail [step <d>]] [along <d>], in that order.
|
|
266
|
+
const usage = `${at}: #anchor takes a bone name, optionally "trail" (and "step" with a distance), then optionally "along" and a distance`
|
|
267
|
+
if (args.length < 1) {
|
|
268
|
+
errors.push(usage)
|
|
269
|
+
return
|
|
270
|
+
}
|
|
271
|
+
let k = 1
|
|
272
|
+
const trail = args[k] === "trail"
|
|
273
|
+
if (trail) k++
|
|
274
|
+
let step: number | undefined
|
|
275
|
+
if (trail && args[k] === "step") {
|
|
276
|
+
const v = num(args[k + 1])
|
|
277
|
+
if (v === null || v <= 0) {
|
|
278
|
+
errors.push(`${at}: #anchor ... trail step needs a positive distance in world units, like "step 0.24"`)
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
step = v
|
|
282
|
+
k += 2
|
|
283
|
+
}
|
|
284
|
+
let along: number | undefined
|
|
285
|
+
if (args[k] === "along") {
|
|
286
|
+
const v = num(args[k + 1])
|
|
287
|
+
if (v === null) {
|
|
288
|
+
errors.push(`${at}: #anchor ... along needs a distance in model units, like "along 0.9"`)
|
|
289
|
+
return
|
|
290
|
+
}
|
|
291
|
+
along = v
|
|
292
|
+
k += 2
|
|
293
|
+
}
|
|
294
|
+
if (k !== args.length) {
|
|
295
|
+
errors.push(usage)
|
|
228
296
|
return
|
|
229
297
|
}
|
|
230
|
-
d.anchors.push({ bone: args[0], trail:
|
|
298
|
+
d.anchors.push({ bone: args[0], trail, ...(step ? { step } : {}), ...(along ? { along } : {}) })
|
|
231
299
|
return
|
|
232
300
|
}
|
|
233
301
|
case "param": {
|
|
@@ -284,8 +352,15 @@ export function parseDirectives(wgsl: string): DirectiveResult {
|
|
|
284
352
|
d.additiveLayer = true
|
|
285
353
|
return
|
|
286
354
|
case "blend":
|
|
355
|
+
// `over` is for ribbons: laid over the scene by their alpha instead of
|
|
356
|
+
// added. For particles it is the default alpha, which is already over.
|
|
357
|
+
if (args[0] === "over") {
|
|
358
|
+
d.trailBlend = "over"
|
|
359
|
+
d.particleBlend = "alpha"
|
|
360
|
+
return
|
|
361
|
+
}
|
|
287
362
|
if (args[0] !== "additive" && args[0] !== "cutout") {
|
|
288
|
-
errors.push(`${at}: #blend takes "additive" or "
|
|
363
|
+
errors.push(`${at}: #blend takes "additive", "cutout" or "over" — alpha is the default`)
|
|
289
364
|
return
|
|
290
365
|
}
|
|
291
366
|
d.particleBlend = args[0]
|
|
@@ -293,6 +368,13 @@ export function parseDirectives(wgsl: string): DirectiveResult {
|
|
|
293
368
|
case "bloom":
|
|
294
369
|
d.bloom = true
|
|
295
370
|
return
|
|
371
|
+
case "depth":
|
|
372
|
+
if (args[0] !== "always") {
|
|
373
|
+
errors.push(`${at}: #depth takes "always" — depth tested is the default`)
|
|
374
|
+
return
|
|
375
|
+
}
|
|
376
|
+
d.depthAlways = true
|
|
377
|
+
return
|
|
296
378
|
case "ground": {
|
|
297
379
|
const m = /^#([0-9a-fA-F]{6})$/.exec(args[0] ?? "")
|
|
298
380
|
const noise = args[1] === undefined ? 0 : num(args[1])
|