reze-engine 0.61.6 → 0.61.7

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.
Files changed (75) hide show
  1. package/dist/_dbg-loader.mjs +1100 -0
  2. package/dist/engine.d.ts.map +1 -1
  3. package/dist/engine.js +9 -2
  4. package/dist/graph/presets/cloth_rough.d.ts.map +1 -1
  5. package/dist/graph/presets/cloth_rough.js +5 -3
  6. package/dist/graph/schema.d.ts +1 -1
  7. package/dist/graph/schema.d.ts.map +1 -1
  8. package/dist/graph/schema.js +3 -1
  9. package/dist/physics-debug.d.ts +30 -0
  10. package/dist/physics-debug.d.ts.map +1 -0
  11. package/dist/physics-debug.js +526 -0
  12. package/dist/shaders/materials/body.d.ts +2 -0
  13. package/dist/shaders/materials/body.d.ts.map +1 -0
  14. package/dist/shaders/materials/body.js +95 -0
  15. package/dist/shaders/materials/cloth_rough.d.ts +2 -0
  16. package/dist/shaders/materials/cloth_rough.d.ts.map +1 -0
  17. package/dist/shaders/materials/cloth_rough.js +69 -0
  18. package/dist/shaders/materials/cloth_smooth.d.ts +2 -0
  19. package/dist/shaders/materials/cloth_smooth.d.ts.map +1 -0
  20. package/dist/shaders/materials/cloth_smooth.js +61 -0
  21. package/dist/shaders/materials/default.d.ts +2 -0
  22. package/dist/shaders/materials/default.d.ts.map +1 -0
  23. package/dist/shaders/materials/default.js +43 -0
  24. package/dist/shaders/materials/eye.d.ts +2 -0
  25. package/dist/shaders/materials/eye.d.ts.map +1 -0
  26. package/dist/shaders/materials/eye.js +60 -0
  27. package/dist/shaders/materials/face.d.ts +2 -0
  28. package/dist/shaders/materials/face.d.ts.map +1 -0
  29. package/dist/shaders/materials/face.js +95 -0
  30. package/dist/shaders/materials/hair.d.ts +2 -0
  31. package/dist/shaders/materials/hair.d.ts.map +1 -0
  32. package/dist/shaders/materials/hair.js +90 -0
  33. package/dist/shaders/materials/metal.d.ts +2 -0
  34. package/dist/shaders/materials/metal.d.ts.map +1 -0
  35. package/dist/shaders/materials/metal.js +77 -0
  36. package/dist/shaders/materials/mmd_classic.d.ts +2 -0
  37. package/dist/shaders/materials/mmd_classic.d.ts.map +1 -0
  38. package/dist/shaders/materials/mmd_classic.js +66 -0
  39. package/dist/shaders/materials/stockings.d.ts +2 -0
  40. package/dist/shaders/materials/stockings.d.ts.map +1 -0
  41. package/dist/shaders/materials/stockings.js +122 -0
  42. package/dist/shaders/passes/physics-debug.d.ts +2 -0
  43. package/dist/shaders/passes/physics-debug.d.ts.map +1 -0
  44. package/dist/shaders/passes/physics-debug.js +69 -0
  45. package/package.json +1 -1
  46. package/src/engine.ts +9 -2
  47. package/src/graph/presets/cloth_rough.ts +5 -3
  48. package/src/graph/schema.ts +3 -1
  49. package/dist/graph/presets/pool_floor.d.ts +0 -3
  50. package/dist/graph/presets/pool_floor.d.ts.map +0 -1
  51. package/dist/graph/presets/pool_floor.js +0 -42
  52. package/dist/graph/presets/water.d.ts +0 -3
  53. package/dist/graph/presets/water.d.ts.map +0 -1
  54. package/dist/graph/presets/water.js +0 -31
  55. package/dist/physics/autofit.d.ts +0 -147
  56. package/dist/physics/autofit.d.ts.map +0 -1
  57. package/dist/physics/autofit.js +0 -501
  58. package/dist/shaders/passes/field-blit.d.ts +0 -26
  59. package/dist/shaders/passes/field-blit.d.ts.map +0 -1
  60. package/dist/shaders/passes/field-blit.js +0 -65
  61. package/dist/shaders/passes/ghosts.d.ts +0 -22
  62. package/dist/shaders/passes/ghosts.d.ts.map +0 -1
  63. package/dist/shaders/passes/ghosts.js +0 -75
  64. package/dist/shaders/passes/ground-noise.d.ts +0 -7
  65. package/dist/shaders/passes/ground-noise.d.ts.map +0 -1
  66. package/dist/shaders/passes/ground-noise.js +0 -88
  67. package/dist/shaders/passes/sim.d.ts +0 -34
  68. package/dist/shaders/passes/sim.d.ts.map +0 -1
  69. package/dist/shaders/passes/sim.js +0 -169
  70. package/dist/shaders/score-api.d.ts +0 -10
  71. package/dist/shaders/score-api.d.ts.map +0 -1
  72. package/dist/shaders/score-api.js +0 -114
  73. package/dist/shaders/shadow-api.d.ts +0 -29
  74. package/dist/shaders/shadow-api.d.ts.map +0 -1
  75. package/dist/shaders/shadow-api.js +0 -112
@@ -1,29 +0,0 @@
1
- /**
2
- * 3×3 PCF over one cascade's map, for a point already in that cascade's NDC.
3
- *
4
- * Shared with the materials, so an effect's shadow and her own shadow soften
5
- * alike. The sampler is linear-filtered, which makes each tap a 2×2 bilinear
6
- * compare. Unrolled — Safari's Metal backend doesn't unroll nested shadow
7
- * loops reliably. The body expects `ndc` in scope and returns.
8
- */
9
- export declare const pcf9: (map: string, ts: string, sampler?: string) => string;
10
- /** Bindings the real accessor takes, from `binding` upward. */
11
- export declare const SHADOW_API_BINDINGS = 5;
12
- /**
13
- * `rzShadow(p)`: how much of the sun reaches world point `p` — 1 lit, 0 in a
14
- * caster's shadow, soft in between.
15
- *
16
- * With `on`, declares five bindings from `binding`:
17
- * +0 the light uniform (the sun's direction, and in .w the shadow switch)
18
- * +1 the cascade view-projections, then the caster sphere
19
- * +2 the near cascade's map +3 the far cascade's map
20
- * +4 the comparison sampler
21
- *
22
- * It takes a POINT and no normal. The materials' sampleShadow also rejects a
23
- * surface facing away from the sun, which is right for skin and wrong for a
24
- * blade of grass or a petal: those are thin, lit through, and shaded by their
25
- * own N·L. The point is nudged toward the sun instead, which lifts a blade's
26
- * root off a stage floor that casts into the same map.
27
- */
28
- export declare function shadowApi(on: boolean, group: number, binding: number): string;
29
- //# sourceMappingURL=shadow-api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shadow-api.d.ts","sourceRoot":"","sources":["../../src/shaders/shadow-api.ts"],"names":[],"mappings":"AAcA;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,GAAI,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,gBAAyB,WActE,CAAA;AAED,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAyD7E"}
@@ -1,112 +0,0 @@
1
- import { SHADOW_CASCADES } from "../shadow-cascades";
2
- // The sun's shadow, as an effect author sees it.
3
- //
4
- // A lawn standing in a character's shadow has to darken where the floor under
5
- // it does, or the figure floats: the ground catcher draws her shadow, and the
6
- // blades drawn over it hide it. The map is already there — the materials and
7
- // the ground read it every frame — so this hands the same lookup to effects.
8
- //
9
- // Bound for real in the particle SHADING stage only. That is where geometry an
10
- // effect draws inside the scene pass is shaded, and the shadow pass has already
11
- // run by then. Every other module that compiles the author's file gets the
12
- // stub, which answers 1: lit is what a point with no occlusion information is,
13
- // the same answer sampleShadow gives outside every cascade.
14
- /**
15
- * 3×3 PCF over one cascade's map, for a point already in that cascade's NDC.
16
- *
17
- * Shared with the materials, so an effect's shadow and her own shadow soften
18
- * alike. The sampler is linear-filtered, which makes each tap a 2×2 bilinear
19
- * compare. Unrolled — Safari's Metal backend doesn't unroll nested shadow
20
- * loops reliably. The body expects `ndc` in scope and returns.
21
- */
22
- export const pcf9 = (map, ts, sampler = "shadowSampler") => /* wgsl */ `
23
- let suv = vec2f(ndc.x * 0.5 + 0.5, 0.5 - ndc.y * 0.5);
24
- let cmpZ = ndc.z - 0.001;
25
- let ts = ${ts};
26
- let s00 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f(-ts, -ts), cmpZ);
27
- let s10 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f(0.0, -ts), cmpZ);
28
- let s20 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f( ts, -ts), cmpZ);
29
- let s01 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f(-ts, 0.0), cmpZ);
30
- let s11 = textureSampleCompareLevel(${map}, ${sampler}, suv, cmpZ);
31
- let s21 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f( ts, 0.0), cmpZ);
32
- let s02 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f(-ts, ts), cmpZ);
33
- let s12 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f(0.0, ts), cmpZ);
34
- let s22 = textureSampleCompareLevel(${map}, ${sampler}, suv + vec2f( ts, ts), cmpZ);
35
- return (s00 + s10 + s20 + s01 + s11 + s21 + s02 + s12 + s22) * (1.0 / 9.0);
36
- `;
37
- /** Bindings the real accessor takes, from `binding` upward. */
38
- export const SHADOW_API_BINDINGS = 5;
39
- /**
40
- * `rzShadow(p)`: how much of the sun reaches world point `p` — 1 lit, 0 in a
41
- * caster's shadow, soft in between.
42
- *
43
- * With `on`, declares five bindings from `binding`:
44
- * +0 the light uniform (the sun's direction, and in .w the shadow switch)
45
- * +1 the cascade view-projections, then the caster sphere
46
- * +2 the near cascade's map +3 the far cascade's map
47
- * +4 the comparison sampler
48
- *
49
- * It takes a POINT and no normal. The materials' sampleShadow also rejects a
50
- * surface facing away from the sun, which is right for skin and wrong for a
51
- * blade of grass or a petal: those are thin, lit through, and shaded by their
52
- * own N·L. The point is nudged toward the sun instead, which lifts a blade's
53
- * root off a stage floor that casts into the same map.
54
- */
55
- export function shadowApi(on, group, binding) {
56
- if (!on) {
57
- return /* wgsl */ `
58
- fn rzShadow(p: vec3f) -> f32 { return 1.0; }
59
- `;
60
- }
61
- const n = SHADOW_CASCADES.length;
62
- return /* wgsl */ `
63
- // The first two vec4s of the light uniform: world ambient, then the sun.
64
- struct _RzShadowSun { ambient: vec4f, direction: vec4f, }
65
- // The cascades' matrices, inner to outer, then every caster in one sphere
66
- // (x, y, z, radius): radius 0 = nothing casts, negative = do not test.
67
- struct _RzShadowBlock { viewProj: array<mat4x4f, ${n}>, casters: vec4f, }
68
- @group(${group}) @binding(${binding}) var<uniform> _rzShadowSun: _RzShadowSun;
69
- @group(${group}) @binding(${binding + 1}) var<uniform> _rzShadowVP: _RzShadowBlock;
70
- @group(${group}) @binding(${binding + 2}) var _rzShadowNear: texture_depth_2d;
71
- @group(${group}) @binding(${binding + 3}) var _rzShadowFar: texture_depth_2d;
72
- @group(${group}) @binding(${binding + 4}) var _rzShadowCmp: sampler_comparison;
73
-
74
- fn _rzShadowNearTaps(ndc: vec3f) -> f32 {
75
- ${pcf9("_rzShadowNear", `1.0 / ${SHADOW_CASCADES[0].mapSize}.0`, "_rzShadowCmp")}
76
- }
77
-
78
- fn _rzShadowFarTaps(ndc: vec3f) -> f32 {
79
- ${pcf9("_rzShadowFar", `1.0 / ${SHADOW_CASCADES[n - 1].mapSize}.0`, "_rzShadowCmp")}
80
- }
81
-
82
- fn rzShadow(p: vec3f) -> f32 {
83
- // The scene's one shadow switch, on the sun — see sampleShadow.
84
- let castAmt = _rzShadowSun.direction.w;
85
- if (castAmt <= 0.0) { return 1.0; }
86
- let toSun = normalize(-_rzShadowSun.direction.xyz);
87
- // Can anything cast onto this point at all? The ground's test, for the same
88
- // two reasons: most of a lawn is nowhere near her, and a scene with no
89
- // models never renders the map, whose untouched zeroes compare as shadowed.
90
- let cs = _rzShadowVP.casters;
91
- if (cs.w == 0.0) { return 1.0; }
92
- if (cs.w > 0.0) {
93
- let toCaster = cs.xyz - p;
94
- let along = dot(toCaster, toSun);
95
- let perp = length(toCaster - toSun * along);
96
- if (along <= -cs.w || perp > cs.w) { return 1.0; }
97
- }
98
- let q = p + toSun * 0.08;
99
- let c0 = _rzShadowVP.viewProj[0] * vec4f(q, 1.0);
100
- let n0 = c0.xyz / max(c0.w, 1e-6);
101
- if (all(abs(n0.xy) < vec2f(0.98)) && n0.z > 0.0 && n0.z < 1.0) {
102
- return mix(1.0, _rzShadowNearTaps(n0), castAmt);
103
- }
104
- let c1 = _rzShadowVP.viewProj[${n - 1}] * vec4f(q, 1.0);
105
- let n1 = c1.xyz / max(c1.w, 1e-6);
106
- if (all(abs(n1.xy) < vec2f(0.98)) && n1.z > 0.0 && n1.z < 1.0) {
107
- return mix(1.0, _rzShadowFarTaps(n1), castAmt);
108
- }
109
- return 1.0;
110
- }
111
- `;
112
- }