@margoengine/rigging 0.0.0-stage → 1.0.0

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 (84) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +1443 -2
  4. package/dist/anatomy-data-ansur2.d.ts +63 -0
  5. package/dist/anatomy-data-cdc.d.ts +16 -0
  6. package/dist/anatomy-data-deleva.d.ts +86 -0
  7. package/dist/anatomy-human.d.ts +67 -0
  8. package/dist/anatomy-human.js +2229 -0
  9. package/dist/anatomy.d.ts +638 -0
  10. package/dist/anatomy.js +1112 -0
  11. package/dist/autorig.d.ts +50 -0
  12. package/dist/autorig.js +663 -0
  13. package/dist/bar-grip.d.ts +7 -0
  14. package/dist/body-volumes-DTym0RVY.js +56 -0
  15. package/dist/body-volumes.d.ts +19 -0
  16. package/dist/checks.d.ts +50 -0
  17. package/dist/contact.d.ts +186 -0
  18. package/dist/contact.js +746 -0
  19. package/dist/correctives.d.ts +92 -0
  20. package/dist/correctives.js +162 -0
  21. package/dist/coupling.d.ts +57 -0
  22. package/dist/coupling.js +330 -0
  23. package/dist/errors-D8rc8kzg.js +7 -0
  24. package/dist/face.d.ts +93 -0
  25. package/dist/face.js +144 -0
  26. package/dist/hands.d.ts +209 -0
  27. package/dist/hands.js +510 -0
  28. package/dist/heat.d.ts +38 -0
  29. package/dist/hinged-contact.d.ts +7 -0
  30. package/dist/hulls.d.ts +54 -0
  31. package/dist/hulls.js +134 -0
  32. package/dist/ik.d.ts +162 -0
  33. package/dist/ik.js +561 -0
  34. package/dist/index.d.ts +6 -0
  35. package/dist/index.js +390 -0
  36. package/dist/joint-limits.d.ts +44 -0
  37. package/dist/joint-limits.js +74 -0
  38. package/dist/limb-collision.d.ts +99 -0
  39. package/dist/loading-CZaYr1N7.js +67 -0
  40. package/dist/mesh-CyvLHNp0.js +142 -0
  41. package/dist/mesh.d.ts +47 -0
  42. package/dist/mtoon-data.d.ts +118 -0
  43. package/dist/mtoon-legacy.d.ts +17 -0
  44. package/dist/mtoon-shader.d.ts +4 -0
  45. package/dist/mtoon.d.ts +84 -0
  46. package/dist/mtoon.js +990 -0
  47. package/dist/paint.d.ts +82 -0
  48. package/dist/pose-tracking.d.ts +117 -0
  49. package/dist/pose-tracking.js +488 -0
  50. package/dist/retarget.d.ts +78 -0
  51. package/dist/retarget.js +375 -0
  52. package/dist/rig-BawZ5OLb.js +127 -0
  53. package/dist/rig.d.ts +65 -0
  54. package/dist/shared/gltf.d.ts +257 -0
  55. package/dist/shared/layers.d.ts +16 -0
  56. package/dist/springs.d.ts +180 -0
  57. package/dist/springs.js +458 -0
  58. package/dist/strand-springs.d.ts +46 -0
  59. package/dist/strand-springs.js +168 -0
  60. package/dist/swim.d.ts +55 -0
  61. package/dist/swim.js +167 -0
  62. package/dist/transfer.d.ts +41 -0
  63. package/dist/transfer.js +136 -0
  64. package/dist/validate.d.ts +188 -0
  65. package/dist/validate.js +440 -0
  66. package/dist/voxel-weights-48ok-Dax.js +255 -0
  67. package/dist/voxel-weights.d.ts +42 -0
  68. package/dist/voxel-weights.js +1 -0
  69. package/dist/voxels.d.ts +36 -0
  70. package/dist/vrm-constraints.d.ts +60 -0
  71. package/dist/vrm-constraints.js +261 -0
  72. package/dist/vrm-first-person.d.ts +115 -0
  73. package/dist/vrm-first-person.js +618 -0
  74. package/dist/vrm-presets-CU4V4yq6.js +47 -0
  75. package/dist/vrm-presets.d.ts +1 -0
  76. package/dist/vrm.d.ts +303 -0
  77. package/dist/vrm.js +574 -0
  78. package/dist/vrm0.d.ts +134 -0
  79. package/dist/vrm0.js +377 -0
  80. package/dist/vrma.d.ts +90 -0
  81. package/dist/vrma.js +315 -0
  82. package/dist/weight-map-D8cAONQQ.js +92 -0
  83. package/dist/weight-map.d.ts +58 -0
  84. package/package.json +189 -4
@@ -0,0 +1,142 @@
1
+ //#region src/mesh.ts
2
+ var e = 1 << 24;
3
+ function t(t, n = 1e-6) {
4
+ let r = t?.positions, i = r?.length;
5
+ if (!Number.isSafeInteger(i) || i % 3 || i < 9 || i / 3 > e) throw TypeError(`Mesh positions need xyz per vertex: 3 to ${e} vertices`);
6
+ if (!(n >= 0 && n < 1)) throw RangeError("Weld tolerance must be from 0 to below 1");
7
+ let a = i / 3, o = [
8
+ Infinity,
9
+ Infinity,
10
+ Infinity
11
+ ], s = [
12
+ -Infinity,
13
+ -Infinity,
14
+ -Infinity
15
+ ];
16
+ for (let e = 0; e < i; e++) {
17
+ let t = r[e];
18
+ if (!Number.isFinite(t)) throw RangeError(`Mesh position ${e} is not finite; repair the mesh`);
19
+ t < o[e % 3] && (o[e % 3] = t), t > s[e % 3] && (s[e % 3] = t);
20
+ }
21
+ let c = Math.hypot(s[0] - o[0], s[1] - o[1], s[2] - o[2]), l = n * c, u = /* @__PURE__ */ new Map(), d = new Int32Array(a), f = [], p = 2 * l, m = l * l;
22
+ for (let e = 0; e < a; e++) {
23
+ let t = r[e * 3], n = r[e * 3 + 1], i = r[e * 3 + 2], a = -1;
24
+ if (p > 0) {
25
+ let e = t / p, r = n / p, o = i / p, s = Math.floor(e), c = Math.floor(r), l = Math.floor(o), d = e - s < .5 ? -1 : 1, h = r - c < .5 ? -1 : 1, g = o - l < .5 ? -1 : 1;
26
+ for (let e = 0; e < 8; e++) {
27
+ let r = u.get(`${s + (e & 1 ? d : 0)},${c + (e & 2 ? h : 0)},${l + (e & 4 ? g : 0)}`);
28
+ if (r) for (let e of r) {
29
+ let r = f[e * 3] - t, o = f[e * 3 + 1] - n, s = f[e * 3 + 2] - i;
30
+ r * r + o * o + s * s <= m && (a < 0 || e < a) && (a = e);
31
+ }
32
+ }
33
+ if (a < 0) {
34
+ a = f.length / 3, f.push(t, n, i);
35
+ let e = `${s},${c},${l}`, r = u.get(e);
36
+ r ? r.push(a) : u.set(e, [a]);
37
+ }
38
+ } else {
39
+ let e = `${t},${n},${i}`, r = u.get(e);
40
+ r ? a = r[0] : (a = f.length / 3, u.set(e, [a]), f.push(t, n, i));
41
+ }
42
+ d[e] = a;
43
+ }
44
+ let h = t.indices, g = h ? h.length : a;
45
+ if (g % 3) throw TypeError("Mesh indices need three per triangle");
46
+ let _ = [];
47
+ for (let e = 0; e < g; e += 3) {
48
+ let t = h ? h[e] : e, n = h ? h[e + 1] : e + 1, r = h ? h[e + 2] : e + 2;
49
+ for (let e of [
50
+ t,
51
+ n,
52
+ r
53
+ ]) if (!Number.isInteger(e) || e < 0 || e >= a) throw RangeError(`Mesh index ${e} is outside the ${a} vertices; repair the index buffer`);
54
+ let i = d[t], o = d[n], s = d[r];
55
+ i !== o && o !== s && i !== s && _.push(i, o, s);
56
+ }
57
+ return {
58
+ vertexCount: a,
59
+ point: d,
60
+ positions: Float64Array.from(f),
61
+ triangles: Uint32Array.from(_),
62
+ size: c
63
+ };
64
+ }
65
+ function n(e) {
66
+ let t = e.positions.length / 3, n = Array.from({ length: t }, () => /* @__PURE__ */ new Set()), r = e.triangles;
67
+ for (let e = 0; e < r.length; e += 3) for (let t = 0; t < 3; t++) {
68
+ let i = r[e + t], a = r[e + (t + 1) % 3];
69
+ n[i].add(a), n[a].add(i);
70
+ }
71
+ let i = new Int32Array(t + 1);
72
+ for (let e = 0; e < t; e++) i[e + 1] = i[e] + n[e].size;
73
+ let a = new Int32Array(i[t]);
74
+ return n.forEach((e, t) => a.set([...e].sort((e, t) => e - t), i[t])), {
75
+ offsets: i,
76
+ columns: a
77
+ };
78
+ }
79
+ function r(e) {
80
+ let t = e.positions, r = e.triangles, i = t.length / 3, { offsets: a, columns: o } = n(e), s = new Float64Array(o.length), c = new Float64Array(i), l = new Float64Array(i), u = (e, t) => {
81
+ let n = a[e], r = a[e + 1] - 1;
82
+ for (; n <= r;) {
83
+ let e = n + r >> 1;
84
+ if (o[e] === t) return e;
85
+ o[e] < t ? n = e + 1 : r = e - 1;
86
+ }
87
+ return -1;
88
+ };
89
+ for (let n = 0; n < r.length; n += 3) {
90
+ let i = [
91
+ r[n],
92
+ r[n + 1],
93
+ r[n + 2]
94
+ ], a = [
95
+ 0,
96
+ 0,
97
+ 0
98
+ ], o = [
99
+ 0,
100
+ 1,
101
+ 2
102
+ ].map((e) => t[i[1] * 3 + e] - t[i[0] * 3 + e]), d = [
103
+ 0,
104
+ 1,
105
+ 2
106
+ ].map((e) => t[i[2] * 3 + e] - t[i[0] * 3 + e]);
107
+ a[0] = o[1] * d[2] - o[2] * d[1], a[1] = o[2] * d[0] - o[0] * d[2], a[2] = o[0] * d[1] - o[1] * d[0];
108
+ let f = Math.hypot(a[0], a[1], a[2]);
109
+ if (f > 1e-14 * e.size * e.size) {
110
+ for (let e of i) l[e] += f / 6;
111
+ for (let e = 0; e < 3; e++) {
112
+ let n = i[e], r = i[(e + 1) % 3], a = i[(e + 2) % 3], o = 0;
113
+ for (let e = 0; e < 3; e++) o += (t[r * 3 + e] - t[n * 3 + e]) * (t[a * 3 + e] - t[n * 3 + e]);
114
+ let l = .5 * o / f;
115
+ s[u(r, a)] -= l, s[u(a, r)] -= l, c[r] += l, c[a] += l;
116
+ }
117
+ }
118
+ }
119
+ return {
120
+ matrix: {
121
+ offsets: a,
122
+ columns: o,
123
+ values: s,
124
+ diagonal: c
125
+ },
126
+ area: l
127
+ };
128
+ }
129
+ function i(e) {
130
+ let t = e.positions.length / 3, n = Int32Array.from({ length: t }, (e, t) => t), r = (e) => {
131
+ for (; n[e] !== e;) e = n[e] = n[n[e]];
132
+ return e;
133
+ }, i = e.triangles;
134
+ for (let e = 0; e < i.length; e += 3) {
135
+ let t = r(i[e]);
136
+ n[r(i[e + 1])] = t, n[r(i[e + 2])] = t;
137
+ }
138
+ for (let e = 0; e < t; e++) n[e] = r(e);
139
+ return n;
140
+ }
141
+ //#endregion
142
+ export { t as i, r as n, n as r, i as t };
package/dist/mesh.d.ts ADDED
@@ -0,0 +1,47 @@
1
+ /** Triangle mesh input: xyz per vertex, and three vertex indices per triangle (omit for an unindexed list). */
2
+ export interface WeightMesh {
3
+ readonly positions: ArrayLike<number>;
4
+ readonly indices?: ArrayLike<number> | null;
5
+ }
6
+ /** A welded mesh: unique points, the point each input vertex became, and triangles over the points. */
7
+ export interface Welded {
8
+ /** Input vertex count. */
9
+ readonly vertexCount: number;
10
+ /** Unique point per input vertex. */
11
+ readonly point: Int32Array;
12
+ /** xyz per unique point. */
13
+ readonly positions: Float64Array;
14
+ /** Three points per triangle; triangles that collapse under welding are dropped. */
15
+ readonly triangles: Uint32Array;
16
+ /** Bounding-box diagonal of the points. */
17
+ readonly size: number;
18
+ }
19
+ /**
20
+ * Welds vertices closer than `tolerance` times the bounding-box diagonal (default 1e-6: only coincident points).
21
+ * @throws TypeError for malformed input, RangeError for non-finite positions or out-of-range indices.
22
+ */
23
+ export declare function weld(mesh: WeightMesh, tolerance?: number): Welded;
24
+ /** Compressed sparse rows of a symmetric matrix over the welded points. */
25
+ export interface Sparse {
26
+ readonly offsets: Int32Array;
27
+ readonly columns: Int32Array;
28
+ readonly values: Float64Array;
29
+ readonly diagonal: Float64Array;
30
+ }
31
+ /** Neighbour lists (CSR offsets and columns) of the welded points, from the triangles' edges. */
32
+ export declare function neighbours(welded: Welded): {
33
+ offsets: Int32Array;
34
+ columns: Int32Array;
35
+ };
36
+ /**
37
+ * The cotangent stiffness matrix L of the welded mesh (U. Pinkall and K. Polthier 1993; M. Meyer, M. Desbrun,
38
+ * P. Schroder and A. H. Barr 2003): L_ij = -(cot a_ij + cot b_ij) / 2 over each edge's two opposite angles, L_ii = -sum
39
+ * of the row. It is the finite-element Dirichlet energy of piecewise-linear functions, so it is symmetric and
40
+ * positive semi-definite for any triangles. Also returns each point's barycentric area (a third of its triangles').
41
+ */
42
+ export declare function cotangentLaplacian(welded: Welded): {
43
+ matrix: Sparse;
44
+ area: Float64Array;
45
+ };
46
+ /** Connected component per welded point (union-find over the triangles). */
47
+ export declare function components(welded: Welded): Int32Array;
@@ -0,0 +1,118 @@
1
+ import type { GLTFTextureInfo } from './shared/gltf.js';
2
+ /** Linear RGB components, each from zero through one. */
3
+ export type MToonColor = readonly [number, number, number];
4
+ /** glTF texture lookup with a per-map UV transform and optional shading-shift scale. */
5
+ export interface MToonTextureInfo extends GLTFTextureInfo {
6
+ index: number;
7
+ texCoord?: number;
8
+ scale?: number;
9
+ extensions?: {
10
+ KHR_texture_transform?: {
11
+ offset?: readonly [number, number];
12
+ scale?: readonly [number, number];
13
+ rotation?: number;
14
+ texCoord?: number;
15
+ };
16
+ };
17
+ }
18
+ /** Authored VRMC_materials_mtoon 1.0 fields. Texture ownership stays with the loaded model. */
19
+ export interface MToonDefinition {
20
+ specVersion: '1.0';
21
+ transparentWithZWrite?: boolean;
22
+ renderQueueOffsetNumber?: number;
23
+ shadeColorFactor?: MToonColor;
24
+ shadeMultiplyTexture?: MToonTextureInfo;
25
+ shadingShiftFactor?: number;
26
+ shadingShiftTexture?: MToonTextureInfo;
27
+ shadingToonyFactor?: number;
28
+ giEqualizationFactor?: number;
29
+ matcapFactor?: MToonColor;
30
+ matcapTexture?: MToonTextureInfo;
31
+ parametricRimColorFactor?: MToonColor;
32
+ parametricRimFresnelPowerFactor?: number;
33
+ parametricRimLiftFactor?: number;
34
+ rimMultiplyTexture?: MToonTextureInfo;
35
+ rimLightingMixFactor?: number;
36
+ outlineWidthMode?: 'none' | 'worldCoordinates' | 'screenCoordinates';
37
+ outlineWidthFactor?: number;
38
+ outlineWidthMultiplyTexture?: MToonTextureInfo;
39
+ outlineColorFactor?: MToonColor;
40
+ outlineLightingMixFactor?: number;
41
+ uvAnimationMaskTexture?: MToonTextureInfo;
42
+ uvAnimationScrollXSpeedFactor?: number;
43
+ uvAnimationScrollYSpeedFactor?: number;
44
+ uvAnimationRotationSpeedFactor?: number;
45
+ }
46
+ declare const scalarDefaults: {
47
+ readonly shadingShiftFactor: 0;
48
+ readonly shadingToonyFactor: 0.9;
49
+ readonly giEqualizationFactor: 0.9;
50
+ readonly parametricRimFresnelPowerFactor: 5;
51
+ readonly parametricRimLiftFactor: 0;
52
+ readonly rimLightingMixFactor: 1;
53
+ readonly outlineWidthFactor: 0;
54
+ readonly outlineLightingMixFactor: 1;
55
+ readonly uvAnimationScrollXSpeedFactor: 0;
56
+ readonly uvAnimationScrollYSpeedFactor: 0;
57
+ readonly uvAnimationRotationSpeedFactor: 0;
58
+ readonly renderQueueOffsetNumber: 0;
59
+ };
60
+ declare const colorDefaults: {
61
+ readonly shadeColorFactor: readonly [0, 0, 0];
62
+ readonly matcapFactor: readonly [1, 1, 1];
63
+ readonly parametricRimColorFactor: readonly [0, 0, 0];
64
+ readonly outlineColorFactor: readonly [0, 0, 0];
65
+ };
66
+ type Normalized = MToonDefinition & Required<Pick<MToonDefinition, keyof typeof scalarDefaults | keyof typeof colorDefaults | 'outlineWidthMode' | 'transparentWithZWrite'>>;
67
+ /** Validate before allocating GPU resources; return independent factor arrays. */
68
+ export declare function normalizeMToon(input: MToonDefinition): Normalized;
69
+ /** Independent scalar oracle for the specification's direct-light transition. */
70
+ export declare function mtoonShading(cosine: number, shift?: number, toony?: number): number;
71
+ /** The six MToon maps in uniform and binding order. */
72
+ export declare const MTOON_MAP_FIELDS: readonly ['shadeMultiplyTexture', 'shadingShiftTexture', 'matcapTexture', 'rimMultiplyTexture', 'outlineWidthMultiplyTexture', 'uvAnimationMaskTexture'];
73
+ type MapField = (typeof MTOON_MAP_FIELDS)[number];
74
+ /**
75
+ * The 1x1 RGBA8 texel a map samples while it has no image (absent, or streamed and not yet arrived). VRMC_materials_mtoon
76
+ * 1.0: an undefined matcapTexture "must be sampled as having 0.0 in RGB components", and an undefined shading shift adds
77
+ * nothing, so both are black; the multiply maps and the UV animation mask are white (no change).
78
+ */
79
+ export declare function fallbackTexel(field: MapField): Uint8Array;
80
+ /** One map's three uniform rows: its KHR_texture_transform with expression moves blended in, texCoord, scale, presence. */
81
+ export declare function textureRows(v: Float32Array, row: number, map: MToonTextureInfo | undefined, moves: readonly {
82
+ scale: readonly number[];
83
+ offset: readonly number[];
84
+ value: number;
85
+ }[]): void;
86
+ /**
87
+ * Writes every map's rows into the uniform `v` from row 8. VRM 1.0 expressions.md: a textureTransformBind applies to
88
+ * the material's UV-accessed textures, and "the texture that does not have UV access is MToon's matcap", so the
89
+ * matcap keeps its own transform and takes no expression move.
90
+ */
91
+ export declare function mapRows(v: Float32Array, definition: Partial<Record<MapField, MToonTextureInfo | undefined>>, moves: readonly {
92
+ scale: readonly number[];
93
+ offset: readonly number[];
94
+ value: number;
95
+ }[]): void;
96
+ /**
97
+ * Whether the UV animation's scroll along `axis` (0 for x, 1 for y) may be taken modulo 2 without changing what `map`
98
+ * samples. VRMC_materials_mtoon 1.0 animates before KHR_texture_transform and leaves the UV unclamped and unrepeated,
99
+ * assuming REPEAT or MIRRORED_REPEAT wrapping; a whole number step of the transform's column through a repeating axis
100
+ * of the sampler then moves the sampled UV by an even whole number, which samples the same texel under both. A
101
+ * fractional column (a scale such as 0.5, a rotation) or a clamped axis it reaches keeps the full scroll.
102
+ */
103
+ export declare function scrollWraps(map: MToonTextureInfo | undefined, wrap: readonly [number | undefined, number | undefined], axis: 0 | 1, moves?: readonly {
104
+ scale: readonly number[];
105
+ offset: readonly number[];
106
+ value: number;
107
+ }[]): boolean;
108
+ /**
109
+ * The UV animation's phases at `time` seconds, in float64, as the MToon shaders read them: scroll x and y in UV units
110
+ * and rotation in turns, each split into a whole count `k` and a phase so the shader forms phase x mask +
111
+ * period x fract(k x mask) with small numbers. Scroll uses period 2 where `wrapX` / `wrapY` allow it (`scrollWraps`)
112
+ * and keeps the whole scroll as its phase otherwise; rotation always uses period 1 turn. Writes
113
+ * [phaseX, phaseY, phaseTurns, kX, kY, kTurns] to `out`.
114
+ */
115
+ export declare function uvAnimationPhases(out: {
116
+ [index: number]: number;
117
+ }, speeds: readonly [number, number, number], time: number, wrapX: boolean, wrapY: boolean): void;
118
+ export {};
@@ -0,0 +1,17 @@
1
+ import type { VRM0Material } from './vrm0.js';
2
+ import type { MToonDefinition, MToonTextureInfo } from './mtoon-data.js';
3
+ export interface LegacyMToon {
4
+ definition: MToonDefinition;
5
+ queue: number;
6
+ mode: number;
7
+ side: 'front' | 'back' | 'double';
8
+ base: number[];
9
+ emission: number[];
10
+ baseTexture?: MToonTextureInfo;
11
+ normalTexture?: MToonTextureInfo;
12
+ emissionTexture?: MToonTextureInfo;
13
+ normalScale: number;
14
+ cutoff: number;
15
+ }
16
+ /** Consortium runtime migration, checked against public latest-loader values for all Alicia materials. */
17
+ export declare function legacyMToon(material: VRM0Material): LegacyMToon | undefined;
@@ -0,0 +1,4 @@
1
+ /** Internal standard PBR shader adapter; optional material, no renderer replacement. */
2
+ export declare function mtoonShader(code: string, group: number, outline?: boolean): string;
3
+ /** Final lighting composition, including IBL, local lights, rim and outlines. */
4
+ export declare function mtoonLit(code: string, outline?: boolean): string;
@@ -0,0 +1,84 @@
1
+ // @ts-ignore optional peer: its types apply when it is installed
2
+ import type { PBRModel } from '@margoengine/gltf/pbr';
3
+ // @ts-ignore optional peer: its types apply when it is installed
4
+ import type { Engine, EnginePlugin, FrameGraph } from '@margoengine/core/extension';
5
+ import type { VRMExpressions } from './vrm.js';
6
+ import { type MToonDefinition } from './mtoon-data.js';
7
+ export type { MToonColor, MToonDefinition, MToonTextureInfo } from './mtoon-data.js';
8
+ /** Optional runtime expression input; when omitted, only authored material values apply. */
9
+ export interface MToonOptions {
10
+ expressions?: VRMExpressions;
11
+ }
12
+ /** Authored MToon materials on a loaded model; dispose restores exact material records. */
13
+ export declare class MToon implements EnginePlugin {
14
+ readonly model: PBRModel;
15
+ readonly options: MToonOptions;
16
+ /** Unique scene registration name, assigned at construction. */
17
+ readonly name: string;
18
+ /** Validated, independent definitions keyed by original glTF material index. */
19
+ private readonly definitions;
20
+ get materials(): ReadonlyMap<number, Readonly<MToonDefinition>>;
21
+ private dead;
22
+ /** True after disposal; the borrowed model remains caller-owned. */
23
+ get disposed(): boolean;
24
+ private clock;
25
+ private engine;
26
+ private scene;
27
+ private device?;
28
+ private context?;
29
+ private mode;
30
+ /** The one blended queue the scene's queue pass is drawing for this model, else undefined. */
31
+ private only?;
32
+ private readonly mipPipelines;
33
+ private readonly states;
34
+ private readonly parts;
35
+ private unsubscribe?;
36
+ private removeDraw?;
37
+ constructor(model: PBRModel, options?: MToonOptions);
38
+ /** Attach to the scene that owns the model. */
39
+ static attach(model: PBRModel, options?: MToonOptions): MToon;
40
+ setup(engine: Engine): void;
41
+ /**
42
+ * Models with blended MToon or BLEND materials draw their blended queues after every model, sorted by queue across
43
+ * models. Opaque and mask avatars register nothing, so their frames keep the models' render pass run unchanged.
44
+ */
45
+ registerPasses(graph: FrameGraph): void;
46
+ /** Draws the armed frame's blended MToon queues in ascending queue order, each queue in model draw order. */
47
+ private static drawQueues;
48
+ /** Draws this model's blended primitives of one queue (scene queue pass). */
49
+ private drawQueue;
50
+ /** Seconds on the MToon UV animation clock. */
51
+ get time(): number;
52
+ /**
53
+ * Moves the UV scroll and rotation clock by `delta` seconds without drawing (a delta of 0 or less moves nothing).
54
+ * Each frame update runs it, so `seek` from `@margoengine/cutscene/seek` replays it exactly.
55
+ */
56
+ advanceTime(delta: number): void;
57
+ onPreUpdate(delta: number): void;
58
+ /**
59
+ * Shadow cut-outs follow the UV animation (KB5289b). Each cut-out (MASK) material whose UVs move hands its casters
60
+ * (gltf/pbr `castAnimation`, read by shadows and clustered through shared/caster.js `animatedDepth`) an 80-byte uniform,
61
+ * written once per frame: scroll x, scroll y, rotation and time, the base map's affine rows and the mask's, and the
62
+ * mask view, so a shadow texel cuts where the colour pass cuts. Static or uncut materials hand nothing.
63
+ */
64
+ private moveCastCutouts;
65
+ /**
66
+ * The UV animation's float64 phases at the current time (`uvAnimationPhases`): scroll wraps by 2 on an axis only when
67
+ * every map the animation moves samples the same texel after it (`scrollWraps`), the MToon maps with their
68
+ * expression `moves` and the host material's maps as drawn.
69
+ */
70
+ private animationPhases;
71
+ /** The glTF wrapS and wrapT of a texture lookup's sampler (undefined is REPEAT). */
72
+ private wrapOf;
73
+ private draw;
74
+ private drawLayers;
75
+ private applyExpressions;
76
+ private coreUV;
77
+ private queue;
78
+ private bindings;
79
+ private resources;
80
+ onDeviceRestored(engine: Engine): void;
81
+ private release;
82
+ dispose(): void;
83
+ [Symbol.dispose](): void;
84
+ }