ara3d 0.1.0 → 0.3.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 (123) hide show
  1. package/README.md +38 -8
  2. package/dist/cli.js +5 -5
  3. package/dist/embed.js +16579 -0
  4. package/dist/index.js +1877 -0
  5. package/dist/types/packages/cli/src/embed.d.ts +43 -0
  6. package/dist/types/packages/cli/src/index.d.ts +109 -0
  7. package/dist/types/packages/cli/src/library/colors.d.ts +9 -0
  8. package/dist/types/packages/cli/src/library/generate.d.ts +40 -0
  9. package/dist/types/packages/cli/src/library/sequence.d.ts +14 -0
  10. package/dist/types/packages/cli/src/library/worker.d.ts +22 -0
  11. package/dist/types/src/app/character-assist.d.ts +73 -0
  12. package/dist/types/src/app/share.d.ts +19 -0
  13. package/dist/types/src/core/anim/boarding.d.ts +4 -0
  14. package/dist/types/src/core/anim/clips/actions.d.ts +9 -0
  15. package/dist/types/src/core/anim/clips/aerial.d.ts +7 -0
  16. package/dist/types/src/core/anim/clips/basic.d.ts +4 -0
  17. package/dist/types/src/core/anim/clips/climbing.d.ts +37 -0
  18. package/dist/types/src/core/anim/clips/combat.d.ts +6 -0
  19. package/dist/types/src/core/anim/clips/cover.d.ts +19 -0
  20. package/dist/types/src/core/anim/clips/dodge.d.ts +8 -0
  21. package/dist/types/src/core/anim/clips/emotes.d.ts +21 -0
  22. package/dist/types/src/core/anim/clips/everyday.d.ts +15 -0
  23. package/dist/types/src/core/anim/clips/faces.d.ts +11 -0
  24. package/dist/types/src/core/anim/clips/gait.d.ts +17 -0
  25. package/dist/types/src/core/anim/clips/gunshot.d.ts +8 -0
  26. package/dist/types/src/core/anim/clips/helpers.d.ts +26 -0
  27. package/dist/types/src/core/anim/clips/index.d.ts +8 -0
  28. package/dist/types/src/core/anim/clips/interaction.d.ts +18 -0
  29. package/dist/types/src/core/anim/clips/lying.d.ts +8 -0
  30. package/dist/types/src/core/anim/clips/melee.d.ts +3 -0
  31. package/dist/types/src/core/anim/clips/mocap-data.d.ts +6 -0
  32. package/dist/types/src/core/anim/clips/reactions.d.ts +34 -0
  33. package/dist/types/src/core/anim/clips/recorded.d.ts +12 -0
  34. package/dist/types/src/core/anim/clips/runner.d.ts +10 -0
  35. package/dist/types/src/core/anim/clips/shooter.d.ts +15 -0
  36. package/dist/types/src/core/anim/clips/speech.d.ts +10 -0
  37. package/dist/types/src/core/anim/clips/swimming.d.ts +17 -0
  38. package/dist/types/src/core/anim/clips/types.d.ts +152 -0
  39. package/dist/types/src/core/anim/clips/vehicles.d.ts +28 -0
  40. package/dist/types/src/core/anim/evaluate.d.ts +188 -0
  41. package/dist/types/src/core/anim/mocap.d.ts +120 -0
  42. package/dist/types/src/core/anim/quat.d.ts +14 -0
  43. package/dist/types/src/core/anim/riding-weapons.d.ts +13 -0
  44. package/dist/types/src/core/anim/stage.d.ts +5 -0
  45. package/dist/types/src/core/assets.d.ts +114 -0
  46. package/dist/types/src/core/face.d.ts +56 -0
  47. package/dist/types/src/core/garments/bags.d.ts +2 -0
  48. package/dist/types/src/core/garments/beach.d.ts +9 -0
  49. package/dist/types/src/core/garments/body.d.ts +70 -0
  50. package/dist/types/src/core/garments/catalog.d.ts +8 -0
  51. package/dist/types/src/core/garments/drape.d.ts +86 -0
  52. package/dist/types/src/core/garments/dress-shoes.d.ts +7 -0
  53. package/dist/types/src/core/garments/earpiece.d.ts +2 -0
  54. package/dist/types/src/core/garments/gowns.d.ts +2 -0
  55. package/dist/types/src/core/garments/gulf.d.ts +2 -0
  56. package/dist/types/src/core/garments/heels.d.ts +8 -0
  57. package/dist/types/src/core/garments/index.d.ts +36 -0
  58. package/dist/types/src/core/garments/kit.d.ts +173 -0
  59. package/dist/types/src/core/garments/last.d.ts +78 -0
  60. package/dist/types/src/core/garments/layering.d.ts +4 -0
  61. package/dist/types/src/core/garments/necklaces.d.ts +2 -0
  62. package/dist/types/src/core/garments/outfit-cut.d.ts +30 -0
  63. package/dist/types/src/core/garments/prison.d.ts +2 -0
  64. package/dist/types/src/core/garments/project.d.ts +61 -0
  65. package/dist/types/src/core/garments/ring.d.ts +100 -0
  66. package/dist/types/src/core/garments/sets.d.ts +41 -0
  67. package/dist/types/src/core/garments/shell.d.ts +37 -0
  68. package/dist/types/src/core/garments/sheriff.d.ts +2 -0
  69. package/dist/types/src/core/garments/shirts.d.ts +31 -0
  70. package/dist/types/src/core/garments/sneakers.d.ts +7 -0
  71. package/dist/types/src/core/garments/street.d.ts +2 -0
  72. package/dist/types/src/core/garments/suit.d.ts +2 -0
  73. package/dist/types/src/core/garments/swimwear.d.ts +2 -0
  74. package/dist/types/src/core/garments/textures.d.ts +53 -0
  75. package/dist/types/src/core/garments/wrist.d.ts +2 -0
  76. package/dist/types/src/core/garments/yoruba.d.ts +2 -0
  77. package/dist/types/src/core/geometry.d.ts +31 -0
  78. package/dist/types/src/core/human.d.ts +42 -0
  79. package/dist/types/src/core/looks/hair.d.ts +64 -0
  80. package/dist/types/src/core/looks/index.d.ts +38 -0
  81. package/dist/types/src/core/looks/jewelry.d.ts +20 -0
  82. package/dist/types/src/core/looks/mouth.d.ts +12 -0
  83. package/dist/types/src/core/looks/overlay.d.ts +42 -0
  84. package/dist/types/src/core/looks/tattoos.d.ts +11 -0
  85. package/dist/types/src/core/looks/textures.d.ts +8 -0
  86. package/dist/types/src/core/math.d.ts +29 -0
  87. package/dist/types/src/core/mesh.d.ts +75 -0
  88. package/dist/types/src/core/morph.d.ts +11 -0
  89. package/dist/types/src/core/pack.d.ts +7 -0
  90. package/dist/types/src/core/params.d.ts +103 -0
  91. package/dist/types/src/core/props/bicycle.d.ts +26 -0
  92. package/dist/types/src/core/props/carry.d.ts +67 -0
  93. package/dist/types/src/core/props/helicopter-layout.d.ts +11 -0
  94. package/dist/types/src/core/props/horse-gait.d.ts +11 -0
  95. package/dist/types/src/core/props/parachute.d.ts +14 -0
  96. package/dist/types/src/core/props/stage-props.d.ts +23 -0
  97. package/dist/types/src/core/props/vehicle-actions.d.ts +23 -0
  98. package/dist/types/src/core/props/vehicle-bodies.d.ts +5 -0
  99. package/dist/types/src/core/props/vehicle-car.d.ts +2 -0
  100. package/dist/types/src/core/props/vehicle-doors.d.ts +2 -0
  101. package/dist/types/src/core/props/vehicle-helicopter.d.ts +2 -0
  102. package/dist/types/src/core/props/vehicle-horse.d.ts +2 -0
  103. package/dist/types/src/core/props/vehicle-kit.d.ts +61 -0
  104. package/dist/types/src/core/props/vehicle-land.d.ts +3 -0
  105. package/dist/types/src/core/props/vehicle-merge.d.ts +3 -0
  106. package/dist/types/src/core/props/vehicle-motion.d.ts +104 -0
  107. package/dist/types/src/core/props/vehicle-special.d.ts +3 -0
  108. package/dist/types/src/core/props/vehicle-stunt.d.ts +16 -0
  109. package/dist/types/src/core/props/vehicle-water.d.ts +2 -0
  110. package/dist/types/src/core/props/vehicle.d.ts +49 -0
  111. package/dist/types/src/core/props/vehicles.d.ts +60 -0
  112. package/dist/types/src/core/props/weapons.d.ts +21 -0
  113. package/dist/types/src/core/rig/poses.d.ts +7 -0
  114. package/dist/types/src/core/rig/rig.d.ts +75 -0
  115. package/dist/types/src/core/rig/skeletons.d.ts +33 -0
  116. package/dist/types/src/core/rig/socket.d.ts +21 -0
  117. package/dist/types/src/core/skin-rough.d.ts +11 -0
  118. package/dist/types/src/export/fbx.d.ts +10 -0
  119. package/dist/types/src/export/glb.d.ts +9 -0
  120. package/dist/types/src/export/index.d.ts +22 -0
  121. package/dist/types/src/export/obj.d.ts +6 -0
  122. package/dist/types/src/export/plan.d.ts +63 -0
  123. package/package.json +13 -4
@@ -0,0 +1,38 @@
1
+ /**
2
+ * "Looks": tattoos, procedural hairstyles, facial hair and earrings. Returns
3
+ * mesh parts in morphed body space (decimetres); human.ts skins and places them.
4
+ */
5
+ import type { AssetLibrary } from '../assets';
6
+ import { type PolyMesh } from '../geometry';
7
+ import type { Material } from '../mesh';
8
+ import { type HumanParams } from '../params';
9
+ export { TATTOOS, TATTOO_LABELS, type TattooId } from './tattoos';
10
+ export { FACIAL_HAIR, FACIAL_HAIR_LABELS, HAIRSTYLES, isProceduralHair, type FacialHairId, type HairstyleId } from './hair';
11
+ export { EARRINGS, EARRING_LABELS, type EarringId, type Metal } from './jewelry';
12
+ export interface LooksInput {
13
+ p: HumanParams;
14
+ /** Morphed base mesh coordinates and vertex normals (decimetres). */
15
+ coords: Float32Array;
16
+ normals: Float32Array;
17
+ /** The full (skinned) base mesh with morphed positions. */
18
+ fullBody: PolyMesh;
19
+ /** Base faces hidden under clothes (the overlay skips them). */
20
+ hidden: Uint8Array;
21
+ /** Base faces under headwear (no hair cards grow there). */
22
+ underHat?: Uint8Array;
23
+ /** Neck base height (dm): box braids stop above the shoulders. */
24
+ neckY: number;
25
+ low: boolean;
26
+ onStage?: (stage: string) => void;
27
+ }
28
+ export interface Looks {
29
+ /** Skin overlay (tattoos, stubble, shaved scalp): already skinned via the body. */
30
+ overlay?: [PolyMesh, Material];
31
+ /** Scalp hair geometry (skin to the head). */
32
+ hair: [PolyMesh, Material][];
33
+ /** Beard / mustache cards (skin to head + neck, so the jaw moves them). */
34
+ beard: [PolyMesh, Material][];
35
+ /** Earrings (skin to the head). */
36
+ jewelry: [PolyMesh, Material][];
37
+ }
38
+ export declare function buildLooks(lib: AssetLibrary, i: LooksInput): Promise<Looks>;
@@ -0,0 +1,20 @@
1
+ /** Earrings: studs or hoops on both ear lobes (located on the base body, built on the morphed one). */
2
+ import type { Body } from '../garments/body';
3
+ import type { PolyMesh } from '../geometry';
4
+ import type { Material } from '../mesh';
5
+ export declare const EARRINGS: readonly ['none', 'studs', 'pearl_drops', 'small_hoops', 'big_hoops'];
6
+ export type EarringId = (typeof EARRINGS)[number];
7
+ export declare const EARRING_LABELS: Record<EarringId, string>;
8
+ export declare const METALS: {
9
+ readonly gold: '#e0b45a';
10
+ readonly silver: '#d9dbe0';
11
+ };
12
+ export type Metal = keyof typeof METALS;
13
+ export declare const metalMaterial: (m: Metal) => Material;
14
+ /**
15
+ * Pearls of the pearl drops (built apart from the metal): a teardrop pearl hanging straight down
16
+ * about a centimetre and a half below each lobe, narrow at the top where its cap holds it.
17
+ */
18
+ export declare function earringPearls(id: EarringId, base: Body, coords: Float32Array, normals: Float32Array): PolyMesh[];
19
+ /** Earring meshes (decimetres, morphed body space), or [] for none. */
20
+ export declare function earrings(id: EarringId, base: Body, coords: Float32Array, normals: Float32Array): PolyMesh[];
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Mouth shading painted into the skin overlay: the inner lips and the inside of the mouth are in
3
+ * shadow, so they don't glow when the mouth opens.
4
+ */
5
+ import { type Body } from '../garments/body';
6
+ import type { Layer } from './overlay';
7
+ /**
8
+ * Shade inside the lips and the mouth: real mouths are shadowed inside, but the inner lips and
9
+ * corners are otherwise lit like the outer face and glow when the mouth opens. Only surfaces that
10
+ * face into the mouth (normals pointing back or up/down into it) are shaded, never the outer skin.
11
+ */
12
+ export declare function mouthShadeLayer(base: Body): Layer;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Skin overlay: tattoos, stubble and shaved-scalp hair are painted into one
3
+ * RGBA texture in the base mesh's UV space and shown on a thin copy of the
4
+ * body faces that carry any paint. Designs are evaluated on the *unmorphed*
5
+ * base mesh, so they follow every body shape through the UVs and the texture
6
+ * can be cached across slider changes.
7
+ */
8
+ import type { AssetLibrary } from '../assets';
9
+ import { type Body } from '../garments/body';
10
+ import type { Vec3 } from '../math';
11
+ /** RGB 0..255 + alpha 0..1 (null / alpha 0 = no paint). */
12
+ export type Paint = [number, number, number, number] | null;
13
+ export interface Layer {
14
+ /** Identifies the layer's look (design + colours): its paint is cached under this key. */
15
+ key: string;
16
+ /** Body regions this layer can paint (limits the faces rasterised). */
17
+ regions: number[];
18
+ /** Optional box on the base body (min xyz, max xyz) outside which the layer never paints: faces outside are skipped. */
19
+ bounds?: [number, number, number, number, number, number];
20
+ /** Paint at a point on the base (unmorphed) body, in decimetres. */
21
+ paint(p: Vec3, region: number, side: number): Paint;
22
+ }
23
+ /** The unmorphed base body with its region coordinates (designs are defined on it). */
24
+ export declare function baseBody(lib: AssetLibrary): Body;
25
+ export interface Painted {
26
+ /** PNG (RGBA). */
27
+ png: Uint8Array;
28
+ /** Base-mesh faces of the overlay: those that carry paint plus two rings of (transparent) neighbours. */
29
+ faces: Uint8Array;
30
+ }
31
+ /**
32
+ * Composite layers (in order, "over") into a size x size RGBA texture. Each
33
+ * layer's paint is cached by its key, so changing one tattoo only repaints
34
+ * that tattoo.
35
+ */
36
+ export declare function paintOverlay(lib: AssetLibrary, layers: Layer[], size?: number): Promise<Painted>;
37
+ /**
38
+ * The overlay surface: painted faces plus two rings of neighbours (so that
39
+ * subdividing gives the same surface as the body underneath), minus faces
40
+ * hidden under clothes.
41
+ */
42
+ export declare function overlaySurface(faces: Uint8Array, hidden: Uint8Array): Uint8Array;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Tattoo designs, defined on the unmorphed base body (decimetres) and painted
3
+ * into the skin overlay (see overlay.ts). Body art is adult-only (18+).
4
+ */
5
+ import { type Body } from '../garments/body';
6
+ import type { Layer } from './overlay';
7
+ export declare const TATTOOS: readonly ['armband_l', 'sleeve_r', 'forearm_l', 'chest', 'back', 'face_marks'];
8
+ export type TattooId = (typeof TATTOOS)[number];
9
+ export declare const TATTOO_LABELS: Record<TattooId, string>;
10
+ /** Overlay layers for the chosen tattoos. */
11
+ export declare function tattooLayers(body: Body, ids: TattooId[], ink: string): Layer[];
@@ -0,0 +1,8 @@
1
+ /** Procedural textures for generated hair: hair cards, braids and gelled spikes (greyscale, tinted by the material colour). */
2
+ import { type TexOut } from '../garments/textures';
3
+ /** Hair card (alpha mask): ~7 tapered strands of varied length, root at v = 0 (bottom). */
4
+ export declare function hairCardTexture(): TexOut;
5
+ /** Braid relief: overlapping lobes slanting left and right along v; u wraps around the braid. */
6
+ export declare function braidTexture(): TexOut;
7
+ /** Gelled spike: fine lengthwise strands. */
8
+ export declare function spikeTexture(): TexOut;
@@ -0,0 +1,29 @@
1
+ export type Vec3 = [number, number, number];
2
+ export declare const vec: (x?: number, y?: number, z?: number) => Vec3;
3
+ export declare const add: (a: Vec3, b: Vec3) => Vec3;
4
+ export declare const sub: (a: Vec3, b: Vec3) => Vec3;
5
+ export declare const scale: (a: Vec3, s: number) => Vec3;
6
+ /** a + b * s */
7
+ export declare const madd: (a: Vec3, b: Vec3, s: number) => Vec3;
8
+ export declare const dot: (a: Vec3, b: Vec3) => number;
9
+ export declare const cross: (a: Vec3, b: Vec3) => Vec3;
10
+ export declare const length: (a: Vec3) => number;
11
+ export declare const lerpV: (a: Vec3, b: Vec3, t: number) => Vec3;
12
+ export declare function normalize(a: Vec3, fallback?: Vec3): Vec3;
13
+ export declare const lerp: (a: number, b: number, t: number) => number;
14
+ export declare const clamp: (x: number, lo: number, hi: number) => number;
15
+ export declare function smoothstep(e0: number, e1: number, x: number): number;
16
+ /** Rotate v around a unit axis by angle (Rodrigues). */
17
+ export declare function rotate(v: Vec3, axis: Vec3, angle: number): Vec3;
18
+ /**
19
+ * Monotone cubic (PCHIP) interpolation. Never overshoots the key values,
20
+ * which keeps radii positive and silhouettes free of ripples.
21
+ */
22
+ export declare function pchip(xs: number[], ys: number[]): (x: number) => number;
23
+ /** Deterministic PRNG (mulberry32). */
24
+ export declare function rng(seed: number): () => number;
25
+ export declare function hexToRgb(hex: string): Vec3;
26
+ export declare function rgbToHex(c: Vec3): string;
27
+ export declare const srgbToLinear: (c: number) => number;
28
+ /** Multiply an sRGB hex colour's brightness (in sRGB space). */
29
+ export declare function shade(hex: string, k: number): string;
@@ -0,0 +1,75 @@
1
+ import type { PolyMesh } from './geometry';
2
+ export interface Material {
3
+ name: string;
4
+ /** sRGB hex colour; multiplies the texture when there is one. */
5
+ color: string;
6
+ roughness: number;
7
+ metalness: number;
8
+ /** Texture file names (see AssetLibrary.texture). */
9
+ map?: string;
10
+ normalMap?: string;
11
+ /** glTF metallic-roughness texture (roughness in G). Where it's used, it replaces `roughness`, which stays as the average for formats without it. */
12
+ roughnessMap?: string;
13
+ alpha: 'opaque' | 'mask' | 'blend';
14
+ doubleSided: boolean;
15
+ /** sRGB hex glow colour (neon, visors). */
16
+ emissive?: string;
17
+ /** 0..1, for alpha 'blend' materials without a texture. */
18
+ opacity?: number;
19
+ }
20
+ export interface MeshGroup {
21
+ material: number;
22
+ /** Triangle list (for GLB / real-time rendering). */
23
+ indices: Uint32Array;
24
+ /** Original polygons (mostly quads) for FBX / OBJ: sizes + flattened vertex indices. */
25
+ polySizes: Uint8Array;
26
+ polyIndices: Uint32Array;
27
+ }
28
+ /**
29
+ * Format-neutral mesh. Units are metres, +Y up, character faces +Z, feet on y = 0.
30
+ * Vertices are split at UV seams, so every vertex has exactly one uv.
31
+ */
32
+ export interface MeshData {
33
+ positions: Float32Array;
34
+ normals: Float32Array;
35
+ uvs: Float32Array;
36
+ groups: MeshGroup[];
37
+ materials: Material[];
38
+ /** Skinning (present when rigged): 4 bone indices + 4 weights per vertex. */
39
+ joints?: Uint16Array;
40
+ weights?: Float32Array;
41
+ /** Facial blend shapes: names, per-vertex offsets (vertex count * 3 each) and resting weights. */
42
+ morphs?: {
43
+ names: string[];
44
+ deltas: Float32Array[];
45
+ defaults: number[];
46
+ };
47
+ }
48
+ /** Morph offsets moved by more than this (metres) count as changed (for sparse exports): 0.05 mm,
49
+ * far below anything visible, keeps the many barely-moved vertices out of the files. */
50
+ export declare const MORPH_EPSILON = 0.00005;
51
+ /** Positions with the morphs applied at the given weights (e.g. to bake an expression into an OBJ). */
52
+ export declare function morphedPositions(m: MeshData, weights?: number[]): Float32Array;
53
+ export declare function triangleCount(m: MeshData): number;
54
+ /** Accumulates parts (each a PolyMesh + material) into one MeshData. */
55
+ export declare class MeshAssembler {
56
+ private morphs?;
57
+ private pos;
58
+ private nrm;
59
+ private uv;
60
+ private jnt;
61
+ private wgt;
62
+ private skinned;
63
+ private groups;
64
+ private morph;
65
+ readonly materials: Material[];
66
+ /** `morphs`: blend-shape names and resting weights; parts without offsets get zeros. */
67
+ constructor(morphs?: {
68
+ names: string[];
69
+ defaults: number[];
70
+ } | undefined);
71
+ add(part: PolyMesh, material: Material): void;
72
+ build(): MeshData;
73
+ }
74
+ /** A copy of `m` with only the groups `keep` accepts (vertices compacted, materials renumbered). */
75
+ export declare function pickGroups(m: MeshData, keep: (group: number) => boolean): MeshData;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * MakeHuman-style morphing: macro parameters (gender, age, muscle, weight,
3
+ * height, proportions, ethnicity, breast) blend between a lattice of targets;
4
+ * detail sliders add individual targets on top.
5
+ */
6
+ import type { AssetLibrary, Slider } from './assets';
7
+ import type { HumanParams } from './params';
8
+ /** Target name -> weight for the given parameters. */
9
+ export declare function targetWeights(p: HumanParams, sliders: Map<string, Slider>): Map<string, number>;
10
+ /** Morphed copy of all base-mesh coordinates (decimetres, MakeHuman space). */
11
+ export declare function applyTargets(lib: AssetLibrary, weights: Map<string, number>): Float32Array;
@@ -0,0 +1,7 @@
1
+ export type TypedArray = Float32Array | Uint32Array | Uint16Array | Int16Array | Uint8Array;
2
+ export interface Pack<M = unknown> {
3
+ meta: M;
4
+ arrays: Record<string, TypedArray>;
5
+ }
6
+ export declare function encodePack(meta: unknown, arrays: Record<string, TypedArray>, gzip?: boolean): Uint8Array;
7
+ export declare function decodePack<M = unknown>(input: Uint8Array): Pack<M>;
@@ -0,0 +1,103 @@
1
+ import type { Catalog } from './assets';
2
+ import type { RigType } from './rig/skeletons';
3
+ import { type CarryId } from './props/carry';
4
+ import { type VehicleChoice, type VehicleStyle } from './props/vehicles';
5
+ import { type WeaponId } from './props/weapons';
6
+ import { type EarringId, type FacialHairId, type Metal, type TattooId } from './looks';
7
+ import { type ExpressionId } from './face';
8
+ export declare const DETAILS: readonly ['low', 'medium', 'high'];
9
+ export type Detail = (typeof DETAILS)[number];
10
+ export interface HumanParams {
11
+ name: string;
12
+ seed: number;
13
+ gender: number;
14
+ age: number;
15
+ muscle: number;
16
+ weight: number;
17
+ height: number;
18
+ proportions: number;
19
+ african: number;
20
+ asian: number;
21
+ caucasian: number;
22
+ breastSize: number;
23
+ breastFirmness: number;
24
+ /** Detail sliders: slider id -> value (-1..1 bipolar, 0..1 unipolar). */
25
+ modifiers: Record<string, number>;
26
+ skin: string;
27
+ skinTint: string;
28
+ eyes: string;
29
+ eyebrows: string;
30
+ eyelashes: string;
31
+ /** MakeHuman hair id, a procedural style ('buzz', 'mohawk', 'cornrows', 'box_braids') or 'none'. */
32
+ hair: string;
33
+ hairTint: string;
34
+ /** Colour of procedural hairstyles (buzz cut, spikes, braids). */
35
+ hairColor: string;
36
+ facialHair: FacialHairId;
37
+ beardColor: string;
38
+ /** Tattoo designs (adults 18+ only; ignored for younger characters). */
39
+ tattoos: TattooId[];
40
+ tattooInk: string;
41
+ earrings: EarringId;
42
+ earringMetal: Metal;
43
+ /** MakeHuman outfit id, or 'none' to dress with separate pieces below. */
44
+ outfit: string;
45
+ /** Procedural top / bottom garment ids or 'none' (used when outfit is 'none'). 'none' top = shirtless/topless. */
46
+ top: string;
47
+ /** Procedural jacket worn over the top (used with separate pieces or an outfit set), or 'none'. */
48
+ jacket: string;
49
+ bottom: string;
50
+ /**
51
+ * Briefs under (or instead of) bottoms. Can be switched off for adult (18+)
52
+ * characters only; under-18 characters always keep them.
53
+ */
54
+ underwear: boolean;
55
+ /** Procedural accessories (garment ids). */
56
+ accessories: string[];
57
+ /** Per-garment pattern / colour overrides. */
58
+ garmentStyles: Record<string, {
59
+ pattern?: string;
60
+ color?: string;
61
+ color2?: string;
62
+ }>;
63
+ /** MakeHuman shoes id, 'sandals', 'combat_boots' or 'none' (barefoot). */
64
+ shoes: string;
65
+ hat: string;
66
+ outfitTint: string;
67
+ detail: Detail;
68
+ rig: RigType;
69
+ /** Add jaw + eye bones (for facial animation). */
70
+ faceBones: boolean;
71
+ /** Bind pose: MakeHuman's natural A-pose, or a T-pose (Mixamo / Unity Humanoid style). */
72
+ restPose: 'A' | 'T';
73
+ /** Include the animation clips in GLB / FBX exports. */
74
+ animations: boolean;
75
+ /** Weapon held in the right hand (attached to the WeaponR socket). */
76
+ weapon: WeaponId;
77
+ /** A bag carried in the left hand. */
78
+ carry: CarryId;
79
+ /** Fitted vehicle prop, shown with compatible riding clips and exported separately. */
80
+ vehicle: VehicleChoice;
81
+ vehicleStyle: VehicleStyle;
82
+ /** Resting facial expression (applied in the viewer and in every exported clip). */
83
+ expression: ExpressionId;
84
+ /** Export facial blend shapes (expressions, blinking). Off: the expression is baked into the mesh. */
85
+ faceShapes: boolean;
86
+ /** With faceShapes: also export the speech mouth shapes (visemes) for lip-sync. */
87
+ speechShapes: boolean;
88
+ /** Teeth variant id or 'none'; the tongue sits behind them. */
89
+ teeth: string;
90
+ tongue: boolean;
91
+ }
92
+ export declare const DEFAULT_PARAMS: HumanParams;
93
+ /** MakeHuman age value <-> years. */
94
+ export declare function ageToYears(a: number): number;
95
+ export declare function yearsToAge(y: number): number;
96
+ export declare const PRESETS: Record<string, Partial<HumanParams>>;
97
+ /** Random but plausible human. Keeps output settings from `base`. */
98
+ export declare function randomParams(seed: number, cat: Catalog, base?: HumanParams): HumanParams;
99
+ /**
100
+ * Make untrusted params (e.g. from a shared link) safe to build: unknown keys are dropped,
101
+ * numbers are clamped, and enumerated options fall back to their defaults.
102
+ */
103
+ export declare function sanitizeParams(raw: unknown, base?: HumanParams): HumanParams;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * A bicycle for the Ride bicycle clip, built to fit the rider: the saddle sits under the hips, the
3
+ * grips under the hands and the crank at the centre of the pedalling circle, all measured from the
4
+ * clip on this character. Each frame the crank turns to follow the left foot and the wheels spin.
5
+ * Preview only (three.js); units are metres, the character faces +Z, +X is its left.
6
+ */
7
+ import * as THREE from 'three';
8
+ import type { Animator } from '../anim/evaluate';
9
+ import type { Clip } from '../anim/clips';
10
+ import type { Vec3 } from '../math';
11
+ import type { Rig } from '../rig/rig';
12
+ import { type VehicleStyle } from './vehicles';
13
+ export declare const BICYCLE_CLIP = "ride_bicycle";
14
+ export declare class Bicycle {
15
+ private rig;
16
+ readonly group: THREE.Group<THREE.Object3DEventMap>;
17
+ private crank;
18
+ private wheels;
19
+ private crankCentre;
20
+ private lastAngle;
21
+ private wheelAngle;
22
+ constructor(rig: Rig, animator: Animator, clip: Clip, style?: VehicleStyle);
23
+ /** Follow the rider. An absolute wheel angle lets offline renderers seek without accumulating turns. */
24
+ update(pos: Vec3[], absoluteWheelAngle?: number): void;
25
+ dispose(): void;
26
+ }
@@ -0,0 +1,67 @@
1
+ import { type Pattern, type TexOut } from '../garments/textures';
2
+ import type { PolyMesh } from '../geometry';
3
+ import type { Vec3 } from '../math';
4
+ import type { Material } from '../mesh';
5
+ /**
6
+ * Bags: carried in the hand (built here), or worn (the backpack, a garment with slot 'bag', built
7
+ * with the clothes).
8
+ */
9
+ export declare const CARRIED: readonly ['none', 'straw_tote', 'handbag', 'briefcase', 'backpack', 'parcel', 'parachute', 'head_load', 'phone', 'broom'];
10
+ export type CarryId = (typeof CARRIED)[number];
11
+ export declare const CARRY_LABELS: Record<CarryId, string>;
12
+ /** Bags worn on the body rather than carried in the hand. */
13
+ export declare const WORN_BAGS: readonly CarryId[];
14
+ export interface BagStyle {
15
+ pattern: Pattern;
16
+ color: string;
17
+ color2: string;
18
+ }
19
+ /**
20
+ * Finishes and colours offered for each bag carried in the hand (first finish = default), chosen
21
+ * like a garment's and kept in the params' `garmentStyles` under the bag's id.
22
+ */
23
+ export declare const CARRY_STYLES: Record<Exclude<CarryId, 'none' | 'backpack'>, {
24
+ patterns: Pattern[];
25
+ color: string;
26
+ color2: string;
27
+ colorLabels: [string, string];
28
+ }>;
29
+ /** A carried bag's style from the params' saved styles (falling back to its defaults). */
30
+ export declare function carryStyle(id: keyof typeof CARRY_STYLES, styles: Record<string, {
31
+ pattern?: string;
32
+ color?: string;
33
+ color2?: string;
34
+ }>): BagStyle;
35
+ export interface CarryPart {
36
+ mesh: PolyMesh;
37
+ material: Material;
38
+ }
39
+ /** Reference dimensions: matches the two-hand interaction grip (metres at 1.8 m height). */
40
+ export declare const PARCEL_SIZE: Vec3;
41
+ export declare const PARCEL_REST: Vec3;
42
+ /**
43
+ * Head load: an enamel basin heaped with round produce on a rolled cloth pad. Metres at 1.8 m height, origin at
44
+ * the crown of the head (+Y up). HEAD_LOAD_RIM is the rim the steadying hand rests on: [radius, height].
45
+ */
46
+ export declare const HEAD_LOAD_RIM: [number, number];
47
+ export declare function headLoad(st: BagStyle): CarryPart[];
48
+ /**
49
+ * Smartphone on its own prop joint, centred on the origin: screen facing +X, width along Y, top towards +Z.
50
+ * A rounded-rectangle body with a metal frame, black glass front with the display inset, and a camera module
51
+ * on the back near the top.
52
+ */
53
+ export declare const PHONE_SIZE: Vec3;
54
+ /**
55
+ * Broom on its own prop joint: origin at the bristle tips on the floor, handle rising along +Y. The animator
56
+ * lays it through both hands while sweeping.
57
+ */
58
+ export declare const BROOM_LENGTH = 1.42;
59
+ /** Rest scale of the phone and broom: packed out of sight inside the hips until a clip shows them (as the parachute canopy). */
60
+ export declare const PROP_REST = 0.001;
61
+ /** Registers a generated texture and returns its file name (see GCtx.texture). */
62
+ export type TextureFn = (key: string, make: () => TexOut) => {
63
+ map: string;
64
+ normalMap?: string;
65
+ alpha: boolean;
66
+ };
67
+ export declare function buildCarry(id: CarryId, texture: TextureFn, styles: Parameters<typeof carryStyle>[1]): CarryPart[];
@@ -0,0 +1,11 @@
1
+ /** Shared cabin coordinates in anatomical metres; +Z is the nose and +X the left side. */
2
+ export declare const HELICOPTER: {
3
+ readonly centerX: 0.43;
4
+ readonly width: 2.1;
5
+ readonly deck: 0.52;
6
+ readonly seatPitch: 0.94;
7
+ readonly seatWidth: 0.86;
8
+ readonly standRight: -1.3;
9
+ readonly standLeft: 2.16;
10
+ readonly rotorRadius: 3.45;
11
+ };
@@ -0,0 +1,11 @@
1
+ /** The horse's working trot. The rider clip and the horse share it so the saddle and seat rise and fall together. */
2
+ export declare const TROT: {
3
+ readonly duration: 0.8;
4
+ readonly duty: 0.42;
5
+ readonly speed: 1.6;
6
+ readonly bob: 0.026;
7
+ };
8
+ /** Height change of the horse's back (in rider-height units), zero at the start of the loop so mounting lines up. */
9
+ export declare function trotBob(time: number): number;
10
+ /** Nose-up pitch (radians) as each diagonal pushes off. */
11
+ export declare function trotPitch(time: number): number;
@@ -0,0 +1,14 @@
1
+ import type { CarryPart, BagStyle } from './carry';
2
+ import type { Vec3 } from '../math';
3
+ export declare const PACKED_CANOPY = 0.002;
4
+ export declare const CANOPY_WIDTH = 5.4;
5
+ export declare const canopyPoint: (x: number, z: number) => Vec3;
6
+ export declare const SUSPENSION_ANCHORS: Vec3[];
7
+ export declare function parachutePack(centre: Vec3, width: number, scale: number, style: BagStyle, harness?: Vec3[][]): CarryPart[];
8
+ /**
9
+ * Webbing paths fitted around the clothed torso (metres, bind pose): on each side a strap rises up
10
+ * the chest, arcs over the shoulder and runs down the back into the pack, plus a chest strap.
11
+ */
12
+ export declare function parachuteHarness(P: Float32Array, level: number, k: number): Vec3[][];
13
+ export declare function parachuteCanopy(style: BagStyle): CarryPart[];
14
+ export declare function parachuteLine(): CarryPart;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Stage props: a ladder, a vault obstacle, a ledge wall and low cover, built to the dimensions the clips are authored
3
+ * against (scaled to the character). The clips play the same with or without them; the builder and Studio can show
4
+ * them and the export can include them as separate prop files.
5
+ */
6
+ import * as T from 'three';
7
+ import { type StageProp } from '../anim/stage';
8
+ import type { MeshData } from '../mesh';
9
+ export { STAGE_PROP_LABELS, stagePropFor, type StageProp } from '../anim/stage';
10
+ /**
11
+ * The prop in the character's starting frame (metres). The preview ladder reaches below the floor so its rungs can
12
+ * scroll past a character climbing in place; the exported ladder stands on the floor.
13
+ */
14
+ export declare function stagePropModel(prop: StageProp, scale: number, preview?: boolean, ahead?: number): T.Group;
15
+ /** Preview prop for a clip, or undefined for clips without one. */
16
+ export declare function stageScenery(clipId: string, scale: number): T.Group | undefined;
17
+ /**
18
+ * Where the prop sits at clip time `t`. With root motion the body travels and the prop stays put; played in
19
+ * place, the prop moves the other way so every hand and foot stays on it. A ladder wraps every rung spacing.
20
+ */
21
+ export declare function placeStageProp(g: T.Group, travel: [number, number, number] | undefined, t: number, scale: number, rootMotion: boolean): void;
22
+ /** The prop as a static export mesh, origin at the character's position (for cover, where Cover idle plays). */
23
+ export declare function stagePropMesh(prop: StageProp, scale: number): MeshData;
@@ -0,0 +1,23 @@
1
+ import type { Rig } from '../rig/rig';
2
+ /** Anatomical height, excluding the game rig's extrapolated HeadTop_End tail. */
3
+ export declare function boardingScale(rig: Rig): number;
4
+ export declare const VEHICLE_TRANSITIONS: readonly [readonly ['bicycle', 'ride_bicycle', 'bicycle', 1.6], readonly ['car', 'drive_car', 'convertible (driver)', 1.8], readonly ['car_passenger', 'sit_passenger', 'convertible (passenger)', 1.8], readonly ['sports_car', 'drive_sports_car', 'sports car (driver)', 2], readonly ['sports_car_passenger', 'sit_sports_car_passenger', 'sports car (passenger)', 2], readonly ['suv', 'drive_suv', 'SUV (driver)', 2.1], readonly ['suv_passenger', 'sit_suv_passenger', 'SUV (passenger)', 2.1], readonly ['motorcycle', 'ride_motorcycle', 'motorcycle', 1.7], readonly ['horse', 'ride_horse', 'horse', 2.2], readonly ['canoe', 'paddle_canoe', 'canoe', 1.9], readonly ['kayak', 'paddle_kayak', 'kayak', 2.1], readonly ['rowboat', 'row_boat', 'rowing boat', 1.9], readonly ['motorboat', 'drive_boat', 'motorboat', 2], readonly ['pickup', 'drive_pickup', 'pickup (driver)', 2.1], readonly ['pickup_passenger', 'sit_pickup_passenger', 'pickup (passenger)', 2.1], readonly ['tank', 'drive_tank', 'tank', 4.2], readonly ['jet', 'fly_jet', 'jet cockpit', 2.8], readonly ['helicopter', 'fly_helicopter', 'helicopter', 2.2]];
5
+ export interface VehicleTransition {
6
+ ride: string;
7
+ direction: 'board' | 'alight';
8
+ }
9
+ export declare const TRANSITION_BY_CLIP: Readonly<Record<string, VehicleTransition>>;
10
+ export declare const VEHICLE_STUNTS: readonly [readonly ['bicycle', 'ride_bicycle'], readonly ['car', 'drive_car'], readonly ['sports_car', 'drive_sports_car'], readonly ['suv', 'drive_suv'], readonly ['pickup', 'drive_pickup'], readonly ['motorcycle', 'ride_motorcycle'], readonly ['tank', 'drive_tank'], readonly ['canoe', 'paddle_canoe'], readonly ['kayak', 'paddle_kayak'], readonly ['rowboat', 'row_boat'], readonly ['motorboat', 'drive_boat'], readonly ['helicopter', 'fly_helicopter'], readonly ['jet', 'fly_jet']];
11
+ export declare const STUNT_BY_CLIP: Readonly<Record<string, {
12
+ ride: string;
13
+ model: string;
14
+ }>>;
15
+ export declare const ridingClip: (id: string) => string;
16
+ /** Stand beside the appropriate door, saddle or gunwale, facing the vehicle's heading. */
17
+ export declare function boardingStand(ride: string): [number, number];
18
+ export declare const boardProgress: (transition: VehicleTransition, time: number, duration: number) => number;
19
+ export declare const doorOpenAt: (p: number) => number;
20
+ /** Roof height of the enclosed tank hull: just clear of the seated driver's head. */
21
+ export declare const tankRoof: (headTop: number, scale: number) => number;
22
+ /** The tank's roof hatch opens once the driver is on the hull and closes after they are seated inside. */
23
+ export declare const hatchOpenAt: (p: number) => number;
@@ -0,0 +1,5 @@
1
+ import { VehicleKit } from './vehicle-kit';
2
+ import { VEHICLE_BODIES, BODY_BASE, type VehicleBody } from './vehicles';
3
+ export { VEHICLE_BODIES, BODY_BASE, type VehicleBody };
4
+ /** Builders for each body; the saloon and muscle car are variants of the covered car. */
5
+ export declare function buildBody(k: VehicleKit, body: VehicleBody): void;
@@ -0,0 +1,2 @@
1
+ import { VehicleKit } from './vehicle-kit';
2
+ export declare function buildCoveredCar(k: VehicleKit, variant?: 'saloon' | 'muscle'): void;
@@ -0,0 +1,2 @@
1
+ import { VehicleKit } from './vehicle-kit';
2
+ export declare function articulateDoors(k: VehicleKit): void;
@@ -0,0 +1,2 @@
1
+ import { VehicleKit } from './vehicle-kit';
2
+ export declare function buildHelicopter(k: VehicleKit, minimumRoof?: number): void;
@@ -0,0 +1,2 @@
1
+ import { VehicleKit } from './vehicle-kit';
2
+ export declare function buildHorse(k: VehicleKit): void;
@@ -0,0 +1,61 @@
1
+ /** Geometry toolkit and measured rider contacts shared by every vehicle. No renderer or DOM. */
2
+ import * as T from 'three';
3
+ import { Animator, type Frame } from '../anim/evaluate';
4
+ import type { Clip } from '../anim/clips';
5
+ import type { Rig } from '../rig/rig';
6
+ import { type VehicleId, type VehicleStyle } from './vehicles';
7
+ export type V = T.Vector3;
8
+ export declare const v: (x?: number, y?: number, z?: number) => T.Vector3;
9
+ export interface Contacts {
10
+ headTop: V;
11
+ hip: V;
12
+ left: V;
13
+ right: V;
14
+ footLeft: V;
15
+ footRight: V;
16
+ kneeLeft: V;
17
+ kneeRight: V;
18
+ chest: T.Quaternion;
19
+ }
20
+ export declare class RiderFit {
21
+ readonly rig: Rig;
22
+ readonly animator: Animator;
23
+ readonly clip: Clip;
24
+ readonly id: VehicleId;
25
+ readonly scale: number;
26
+ readonly lift: number;
27
+ readonly samples: Contacts[];
28
+ constructor(rig: Rig, animator: Animator, clip: Clip, id: VehicleId);
29
+ at(time: number): Contacts;
30
+ fromFrame(f: Frame): Contacts;
31
+ average(key: 'hip' | 'left' | 'right' | 'footLeft' | 'footRight'): T.Vector3;
32
+ }
33
+ export declare class VehicleKit {
34
+ readonly style: VehicleStyle;
35
+ readonly fit: RiderFit;
36
+ readonly group: T.Group<T.Object3DEventMap>;
37
+ readonly paint: T.MeshStandardMaterial;
38
+ readonly trim: T.MeshStandardMaterial;
39
+ readonly seat: T.MeshStandardMaterial;
40
+ readonly rubber: T.MeshStandardMaterial;
41
+ readonly dark: T.MeshStandardMaterial;
42
+ readonly glass: T.MeshPhysicalMaterial;
43
+ readonly light: T.MeshStandardMaterial;
44
+ /** Shared tail and brake lamps; Vehicle.setLights brightens them under braking. */
45
+ readonly tail: T.MeshStandardMaterial;
46
+ readonly updates: ((c: Contacts, time: number) => void)[];
47
+ constructor(style: VehicleStyle, fit: RiderFit);
48
+ mesh(geo: T.BufferGeometry, mat: T.Material, parent?: T.Object3D): T.Mesh<T.BufferGeometry<T.NormalBufferAttributes, T.BufferGeometryEventMap>, T.Material<T.MaterialEventMap>, T.Object3DEventMap>;
49
+ box(p: V, size: V, mat: T.Material, parent?: T.Object3D): T.Mesh<T.BufferGeometry<T.NormalBufferAttributes, T.BufferGeometryEventMap>, T.Material<T.MaterialEventMap>, T.Object3DEventMap>;
50
+ ellipsoid(p: V, size: V, mat: T.Material, parent?: T.Object3D): T.Mesh<T.BufferGeometry<T.NormalBufferAttributes, T.BufferGeometryEventMap>, T.Material<T.MaterialEventMap>, T.Object3DEventMap>;
51
+ tube(a: V, b: V, r: number, mat: T.Material, parent?: T.Object3D): T.Mesh<T.BufferGeometry<T.NormalBufferAttributes, T.BufferGeometryEventMap>, T.Material<T.MaterialEventMap>, T.Object3DEventMap>;
52
+ component(name: string, position?: T.Vector3, parent?: T.Object3D): T.Group<T.Object3DEventMap>;
53
+ /** A tyre with a flat tread, rounded shoulders and bulging sidewalls, turned about the axle (X). */
54
+ tyre(r: number, width: number, parent: T.Object3D): T.Mesh<T.BufferGeometry<T.NormalBufferAttributes, T.BufferGeometryEventMap>, T.Material<T.MaterialEventMap>, T.Object3DEventMap>;
55
+ wheel(name: string, p: V, r: number, width: number, spokes?: boolean | 'alloy', parent?: T.Object3D): T.Group<T.Object3DEventMap>;
56
+ steering(radius: number, tilt: number, offset?: T.Vector3): T.Group<T.Object3DEventMap>;
57
+ /** A steering column from a fixed mount on the body to the hub of a steering wheel that follows the hands. */
58
+ column(anchor: V, steering: T.Object3D, r: number, mat: T.Material): T.Group<T.Object3DEventMap>;
59
+ dispose(): void;
60
+ }
61
+ export declare function raceNumber(k: VehicleKit, n: number, size: number, mat: T.Material): T.Group<T.Object3DEventMap>;