ara3d 0.0.0-stage → 0.2.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.
- package/README.md +40 -2
- package/dist/cli.js +57 -0
- package/dist/index.js +1806 -0
- package/dist/types/packages/cli/src/index.d.ts +89 -0
- package/dist/types/packages/cli/src/library/colors.d.ts +9 -0
- package/dist/types/packages/cli/src/library/generate.d.ts +40 -0
- package/dist/types/packages/cli/src/library/worker.d.ts +22 -0
- package/dist/types/src/app/character-assist.d.ts +73 -0
- package/dist/types/src/app/share.d.ts +19 -0
- package/dist/types/src/core/anim/boarding.d.ts +4 -0
- package/dist/types/src/core/anim/clips/actions.d.ts +9 -0
- package/dist/types/src/core/anim/clips/aerial.d.ts +7 -0
- package/dist/types/src/core/anim/clips/basic.d.ts +4 -0
- package/dist/types/src/core/anim/clips/climbing.d.ts +37 -0
- package/dist/types/src/core/anim/clips/combat.d.ts +6 -0
- package/dist/types/src/core/anim/clips/cover.d.ts +19 -0
- package/dist/types/src/core/anim/clips/dodge.d.ts +8 -0
- package/dist/types/src/core/anim/clips/emotes.d.ts +21 -0
- package/dist/types/src/core/anim/clips/everyday.d.ts +15 -0
- package/dist/types/src/core/anim/clips/faces.d.ts +11 -0
- package/dist/types/src/core/anim/clips/gait.d.ts +17 -0
- package/dist/types/src/core/anim/clips/gunshot.d.ts +8 -0
- package/dist/types/src/core/anim/clips/helpers.d.ts +26 -0
- package/dist/types/src/core/anim/clips/index.d.ts +8 -0
- package/dist/types/src/core/anim/clips/interaction.d.ts +18 -0
- package/dist/types/src/core/anim/clips/lying.d.ts +8 -0
- package/dist/types/src/core/anim/clips/melee.d.ts +3 -0
- package/dist/types/src/core/anim/clips/mocap-data.d.ts +6 -0
- package/dist/types/src/core/anim/clips/reactions.d.ts +34 -0
- package/dist/types/src/core/anim/clips/recorded.d.ts +12 -0
- package/dist/types/src/core/anim/clips/runner.d.ts +10 -0
- package/dist/types/src/core/anim/clips/shooter.d.ts +15 -0
- package/dist/types/src/core/anim/clips/speech.d.ts +10 -0
- package/dist/types/src/core/anim/clips/swimming.d.ts +17 -0
- package/dist/types/src/core/anim/clips/types.d.ts +152 -0
- package/dist/types/src/core/anim/clips/vehicles.d.ts +28 -0
- package/dist/types/src/core/anim/evaluate.d.ts +188 -0
- package/dist/types/src/core/anim/mocap.d.ts +120 -0
- package/dist/types/src/core/anim/quat.d.ts +14 -0
- package/dist/types/src/core/anim/riding-weapons.d.ts +13 -0
- package/dist/types/src/core/anim/stage.d.ts +5 -0
- package/dist/types/src/core/assets.d.ts +114 -0
- package/dist/types/src/core/face.d.ts +56 -0
- package/dist/types/src/core/garments/bags.d.ts +2 -0
- package/dist/types/src/core/garments/beach.d.ts +9 -0
- package/dist/types/src/core/garments/body.d.ts +70 -0
- package/dist/types/src/core/garments/catalog.d.ts +8 -0
- package/dist/types/src/core/garments/drape.d.ts +86 -0
- package/dist/types/src/core/garments/dress-shoes.d.ts +7 -0
- package/dist/types/src/core/garments/earpiece.d.ts +2 -0
- package/dist/types/src/core/garments/gowns.d.ts +2 -0
- package/dist/types/src/core/garments/gulf.d.ts +2 -0
- package/dist/types/src/core/garments/heels.d.ts +8 -0
- package/dist/types/src/core/garments/index.d.ts +36 -0
- package/dist/types/src/core/garments/kit.d.ts +173 -0
- package/dist/types/src/core/garments/last.d.ts +78 -0
- package/dist/types/src/core/garments/layering.d.ts +4 -0
- package/dist/types/src/core/garments/necklaces.d.ts +2 -0
- package/dist/types/src/core/garments/outfit-cut.d.ts +30 -0
- package/dist/types/src/core/garments/prison.d.ts +2 -0
- package/dist/types/src/core/garments/project.d.ts +61 -0
- package/dist/types/src/core/garments/ring.d.ts +100 -0
- package/dist/types/src/core/garments/sets.d.ts +41 -0
- package/dist/types/src/core/garments/shell.d.ts +37 -0
- package/dist/types/src/core/garments/sheriff.d.ts +2 -0
- package/dist/types/src/core/garments/shirts.d.ts +31 -0
- package/dist/types/src/core/garments/sneakers.d.ts +7 -0
- package/dist/types/src/core/garments/street.d.ts +2 -0
- package/dist/types/src/core/garments/suit.d.ts +2 -0
- package/dist/types/src/core/garments/swimwear.d.ts +2 -0
- package/dist/types/src/core/garments/textures.d.ts +53 -0
- package/dist/types/src/core/garments/wrist.d.ts +2 -0
- package/dist/types/src/core/garments/yoruba.d.ts +2 -0
- package/dist/types/src/core/geometry.d.ts +31 -0
- package/dist/types/src/core/human.d.ts +42 -0
- package/dist/types/src/core/looks/hair.d.ts +64 -0
- package/dist/types/src/core/looks/index.d.ts +38 -0
- package/dist/types/src/core/looks/jewelry.d.ts +20 -0
- package/dist/types/src/core/looks/mouth.d.ts +12 -0
- package/dist/types/src/core/looks/overlay.d.ts +42 -0
- package/dist/types/src/core/looks/tattoos.d.ts +11 -0
- package/dist/types/src/core/looks/textures.d.ts +8 -0
- package/dist/types/src/core/math.d.ts +29 -0
- package/dist/types/src/core/mesh.d.ts +75 -0
- package/dist/types/src/core/morph.d.ts +11 -0
- package/dist/types/src/core/pack.d.ts +7 -0
- package/dist/types/src/core/params.d.ts +103 -0
- package/dist/types/src/core/props/bicycle.d.ts +26 -0
- package/dist/types/src/core/props/carry.d.ts +67 -0
- package/dist/types/src/core/props/helicopter-layout.d.ts +11 -0
- package/dist/types/src/core/props/horse-gait.d.ts +11 -0
- package/dist/types/src/core/props/parachute.d.ts +14 -0
- package/dist/types/src/core/props/stage-props.d.ts +23 -0
- package/dist/types/src/core/props/vehicle-actions.d.ts +23 -0
- package/dist/types/src/core/props/vehicle-bodies.d.ts +5 -0
- package/dist/types/src/core/props/vehicle-car.d.ts +2 -0
- package/dist/types/src/core/props/vehicle-doors.d.ts +2 -0
- package/dist/types/src/core/props/vehicle-helicopter.d.ts +2 -0
- package/dist/types/src/core/props/vehicle-horse.d.ts +2 -0
- package/dist/types/src/core/props/vehicle-kit.d.ts +61 -0
- package/dist/types/src/core/props/vehicle-land.d.ts +3 -0
- package/dist/types/src/core/props/vehicle-merge.d.ts +3 -0
- package/dist/types/src/core/props/vehicle-motion.d.ts +104 -0
- package/dist/types/src/core/props/vehicle-special.d.ts +3 -0
- package/dist/types/src/core/props/vehicle-stunt.d.ts +16 -0
- package/dist/types/src/core/props/vehicle-water.d.ts +2 -0
- package/dist/types/src/core/props/vehicle.d.ts +49 -0
- package/dist/types/src/core/props/vehicles.d.ts +60 -0
- package/dist/types/src/core/props/weapons.d.ts +21 -0
- package/dist/types/src/core/rig/poses.d.ts +7 -0
- package/dist/types/src/core/rig/rig.d.ts +75 -0
- package/dist/types/src/core/rig/skeletons.d.ts +33 -0
- package/dist/types/src/core/rig/socket.d.ts +21 -0
- package/dist/types/src/core/skin-rough.d.ts +11 -0
- package/dist/types/src/export/fbx.d.ts +10 -0
- package/dist/types/src/export/glb.d.ts +9 -0
- package/dist/types/src/export/index.d.ts +22 -0
- package/dist/types/src/export/obj.d.ts +6 -0
- package/dist/types/src/export/plan.d.ts +63 -0
- package/package.json +21 -4
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ara3d for the browser: generate realistic, rigged and animated characters as three.js objects.
|
|
3
|
+
*
|
|
4
|
+
* import { createCharacter } from 'ara3d';
|
|
5
|
+
* const hero = await createCharacter('The Soldier', { animations: ['walk', 'run', 'idle'] });
|
|
6
|
+
* scene.add(hero.scene);
|
|
7
|
+
* const mixer = new THREE.AnimationMixer(hero.scene);
|
|
8
|
+
* mixer.clipAction(hero.clip('walk')!).play();
|
|
9
|
+
*
|
|
10
|
+
* Characters are built in a background worker, so the page stays responsive, and exported with the same exporter as
|
|
11
|
+
* the Ara builder and the ara3d CLI. The character data loads from a free CDN by default.
|
|
12
|
+
*/
|
|
13
|
+
import type { AnimationClip, Group } from 'three';
|
|
14
|
+
import type { CharacterInput, GenerateOptions } from './library/generate';
|
|
15
|
+
import type { CharacterColors } from './library/colors';
|
|
16
|
+
import type { HumanParams } from '../../../src/core/params';
|
|
17
|
+
export type { CharacterColors, CharacterInput, GenerateOptions };
|
|
18
|
+
export type CharacterParams = Partial<HumanParams>;
|
|
19
|
+
/** The character data this version uses, served by jsDelivr from the ara3d-data npm package. */
|
|
20
|
+
export declare const DEFAULT_ASSETS_URL: string;
|
|
21
|
+
/** The preset character names. */
|
|
22
|
+
export declare const PRESET_NAMES: readonly string[];
|
|
23
|
+
/** Every animation clip: its ID, its name in exported files, its group, and whether it loops. */
|
|
24
|
+
export declare const ANIMATIONS: readonly {
|
|
25
|
+
id: string;
|
|
26
|
+
name: string;
|
|
27
|
+
group: string;
|
|
28
|
+
category: string;
|
|
29
|
+
loop: boolean;
|
|
30
|
+
}[];
|
|
31
|
+
/** Props for the weapon, carry and vehicle options. */
|
|
32
|
+
export declare const PROPS: {
|
|
33
|
+
weapons: readonly string[];
|
|
34
|
+
carried: readonly string[];
|
|
35
|
+
vehicles: readonly string[];
|
|
36
|
+
};
|
|
37
|
+
/** Facial expressions for setExpression(). */
|
|
38
|
+
export declare const EXPRESSIONS: readonly string[];
|
|
39
|
+
/** Mouth shapes for lip-sync (the Oculus viseme names that lip-sync tools use), for setMouth(). */
|
|
40
|
+
export declare const MOUTH_SHAPES: readonly string[];
|
|
41
|
+
/** Every face shape a character carries: ARKit-style names (eyeBlinkLeft, jawOpen, mouthSmile...) and the mouth shapes. */
|
|
42
|
+
export declare const FACE_SHAPES: readonly string[];
|
|
43
|
+
export interface CharacterOptions extends GenerateOptions {
|
|
44
|
+
/** Where the character data is served from; defaults to DEFAULT_ASSETS_URL. Copy node_modules/ara3d-data/assets to self-host. */
|
|
45
|
+
assetsUrl?: string;
|
|
46
|
+
/** Called while the character is built and exported, with a label and a fraction from 0 to 1. */
|
|
47
|
+
onProgress?: (label: string, fraction: number) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface AraCharacter {
|
|
50
|
+
/** The character, ready to add to a scene. */
|
|
51
|
+
scene: Group;
|
|
52
|
+
/** The animation clips, for THREE.AnimationMixer. */
|
|
53
|
+
animations: AnimationClip[];
|
|
54
|
+
/** The clip for an Ara clip ID, such as "walk". */
|
|
55
|
+
clip(id: string): AnimationClip | undefined;
|
|
56
|
+
/** Props exported beside the character, such as a vehicle, each placed at the character's origin. */
|
|
57
|
+
props: {
|
|
58
|
+
name: string;
|
|
59
|
+
scene: Group;
|
|
60
|
+
animations: AnimationClip[];
|
|
61
|
+
}[];
|
|
62
|
+
/** The character's settings, after presets and options were applied: save them to rebuild it. */
|
|
63
|
+
params: HumanParams;
|
|
64
|
+
/** The colour of each part that can be recoloured with the colors option, such as { top: '#4a5a3a', shoes: '#141414' }. */
|
|
65
|
+
colors: CharacterColors;
|
|
66
|
+
/** Standing height in metres. */
|
|
67
|
+
height: number;
|
|
68
|
+
/** The character as a GLB file, for downloading or uploading. */
|
|
69
|
+
glb: Uint8Array;
|
|
70
|
+
/** Changes the facial expression (see EXPRESSIONS), blended by `amount` from 0 to 1. */
|
|
71
|
+
setExpression(name: string, amount?: number): void;
|
|
72
|
+
/** Shows one mouth shape for lip-sync (see MOUTH_SHAPES), or none with null. */
|
|
73
|
+
setMouth(shape: string | null, weight?: number): void;
|
|
74
|
+
/** Sets face shapes directly by name (see FACE_SHAPES), such as { jawOpen: 0.4, mouthSmile: 1 }. */
|
|
75
|
+
setFace(weights: Record<string, number>): void;
|
|
76
|
+
/** Natural blinking, on by default; call update() every frame for it to run. */
|
|
77
|
+
blinking: boolean;
|
|
78
|
+
/** Runs blinking. Call it every frame, after mixer.update(), with the seconds since the last frame. */
|
|
79
|
+
update(delta: number): void;
|
|
80
|
+
/** Frees the GPU memory held by the character and its props. */
|
|
81
|
+
dispose(): void;
|
|
82
|
+
}
|
|
83
|
+
/** Builds a character and returns its GLB file, without needing three.js. */
|
|
84
|
+
export declare function createCharacterGLB(input: CharacterInput, options?: CharacterOptions): Promise<Uint8Array>;
|
|
85
|
+
/**
|
|
86
|
+
* Builds a character as three.js objects. `input` is a preset name ("The Soldier"), an "ara-character" object
|
|
87
|
+
* ({ preset, params }), or character settings such as a params.json from an export.
|
|
88
|
+
*/
|
|
89
|
+
export declare function createCharacter(input: CharacterInput, options?: CharacterOptions): Promise<AraCharacter>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { HumanParams } from '../../../../src/core/params';
|
|
2
|
+
export declare const COLOR_SLOTS: readonly ['outfit', 'top', 'jacket', 'bottom', 'shoes', 'carry', 'vehicle'];
|
|
3
|
+
export type ColorSlot = typeof COLOR_SLOTS[number];
|
|
4
|
+
/** A #rrggbb colour for each part to recolour. */
|
|
5
|
+
export type CharacterColors = Partial<Record<ColorSlot, string>>;
|
|
6
|
+
/** The current colour of every part of this character that can be recoloured. */
|
|
7
|
+
export declare function colorsOf(p: HumanParams): CharacterColors;
|
|
8
|
+
/** Applies `colors` to the parts this character has; parts it doesn't have (a jacket on a T-shirt) are skipped. */
|
|
9
|
+
export declare function applyColors(p: HumanParams, colors: CharacterColors): HumanParams;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AssetLibrary } from '../../../../src/core/assets';
|
|
2
|
+
import { type HumanParams } from '../../../../src/core/params';
|
|
3
|
+
import { type CharacterColors } from './colors';
|
|
4
|
+
/**
|
|
5
|
+
* What to build: a preset name, a share link from the Ara builder, { random: seed }, an "ara-character" object, or
|
|
6
|
+
* character settings (as in a params.json).
|
|
7
|
+
*/
|
|
8
|
+
export type CharacterInput = string | {
|
|
9
|
+
random: number;
|
|
10
|
+
name?: string;
|
|
11
|
+
} | Record<string, unknown>;
|
|
12
|
+
export interface GenerateOptions {
|
|
13
|
+
/** Clip IDs or groups (such as "locomotion"), "all" (the default) or "none". */
|
|
14
|
+
animations?: string[] | 'all' | 'none';
|
|
15
|
+
detail?: 'low' | 'medium' | 'high';
|
|
16
|
+
rootMotion?: boolean;
|
|
17
|
+
weapon?: HumanParams['weapon'];
|
|
18
|
+
carry?: HumanParams['carry'];
|
|
19
|
+
vehicle?: HumanParams['vehicle'];
|
|
20
|
+
/** New colours for the outfit, top, jacket, bottom, shoes, carried item or vehicle. */
|
|
21
|
+
colors?: CharacterColors;
|
|
22
|
+
}
|
|
23
|
+
export interface GeneratedFile {
|
|
24
|
+
name: string;
|
|
25
|
+
data: Uint8Array;
|
|
26
|
+
}
|
|
27
|
+
export interface Generated {
|
|
28
|
+
/** The character's GLB, then any prop GLBs (a vehicle, or a separate weapon). */
|
|
29
|
+
files: GeneratedFile[];
|
|
30
|
+
params: HumanParams;
|
|
31
|
+
/** The colour of each part that can be recoloured. */
|
|
32
|
+
colors: CharacterColors;
|
|
33
|
+
/** Standing height in metres. */
|
|
34
|
+
height: number;
|
|
35
|
+
/** Clip ID -> the animation's name inside the GLB. */
|
|
36
|
+
clipNames: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/** The character data at `assetsUrl`, loaded once and shared by every character built from it. */
|
|
39
|
+
export declare function libraryAt(assetsUrl: string): Promise<AssetLibrary>;
|
|
40
|
+
export declare function generate(lib: AssetLibrary, input: CharacterInput, options?: GenerateOptions, onProgress?: (label: string, fraction: number) => void): Promise<Generated>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The library's background worker: builds characters off the main thread and sends back GLB bytes. */
|
|
2
|
+
import { generate, type CharacterInput, type GenerateOptions } from './generate';
|
|
3
|
+
export type WorkerRequest = {
|
|
4
|
+
id: number;
|
|
5
|
+
assetsUrl: string;
|
|
6
|
+
input: CharacterInput;
|
|
7
|
+
options: GenerateOptions;
|
|
8
|
+
};
|
|
9
|
+
export type WorkerReply = {
|
|
10
|
+
id: number;
|
|
11
|
+
type: 'progress';
|
|
12
|
+
label: string;
|
|
13
|
+
fraction: number;
|
|
14
|
+
} | {
|
|
15
|
+
id: number;
|
|
16
|
+
type: 'done';
|
|
17
|
+
result: Awaited<ReturnType<typeof generate>>;
|
|
18
|
+
} | {
|
|
19
|
+
id: number;
|
|
20
|
+
type: 'error';
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/** Character-only LLM contract. IDs and ranges come from the installed builder catalogues. */
|
|
2
|
+
import type { Catalog } from '../core/assets';
|
|
3
|
+
import { type HumanParams } from '../core/params';
|
|
4
|
+
type Rule = {
|
|
5
|
+
type: string;
|
|
6
|
+
enum?: readonly string[];
|
|
7
|
+
minimum?: number;
|
|
8
|
+
maximum?: number;
|
|
9
|
+
maxLength?: number;
|
|
10
|
+
pattern?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
default?: unknown;
|
|
13
|
+
};
|
|
14
|
+
export declare function characterRules(cat: Catalog): Record<string, Rule>;
|
|
15
|
+
export declare function parseCharacterInput(source: string, cat: Catalog, initial?: HumanParams): HumanParams;
|
|
16
|
+
export declare function characterExample(): {
|
|
17
|
+
kind: string;
|
|
18
|
+
version: number;
|
|
19
|
+
preset: string;
|
|
20
|
+
params: {
|
|
21
|
+
name: string;
|
|
22
|
+
ageYears: number;
|
|
23
|
+
hair: string;
|
|
24
|
+
carry: string;
|
|
25
|
+
weapon: string;
|
|
26
|
+
expression: string;
|
|
27
|
+
garmentStyles: {
|
|
28
|
+
tank_top: {
|
|
29
|
+
pattern: string;
|
|
30
|
+
color: string;
|
|
31
|
+
};
|
|
32
|
+
cargo_shorts: {
|
|
33
|
+
pattern: string;
|
|
34
|
+
color: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare function characterSchema(cat: Catalog): {
|
|
40
|
+
$schema: string;
|
|
41
|
+
title: string;
|
|
42
|
+
type: string;
|
|
43
|
+
additionalProperties: boolean;
|
|
44
|
+
required: string[];
|
|
45
|
+
anyOf: {
|
|
46
|
+
required: string[];
|
|
47
|
+
}[];
|
|
48
|
+
properties: {
|
|
49
|
+
$schema: {
|
|
50
|
+
type: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
kind: {
|
|
54
|
+
const: string;
|
|
55
|
+
};
|
|
56
|
+
version: {
|
|
57
|
+
const: number;
|
|
58
|
+
};
|
|
59
|
+
preset: Rule;
|
|
60
|
+
params: {
|
|
61
|
+
type: string;
|
|
62
|
+
additionalProperties: boolean;
|
|
63
|
+
properties: Record<string, unknown>;
|
|
64
|
+
not: {
|
|
65
|
+
required: string[];
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
/** Shared appearance instructions and live assets, without an LLM task or output schema. */
|
|
71
|
+
export declare function characterReference(cat: Catalog): string;
|
|
72
|
+
export declare function generateCharacterGuide(cat: Catalog, brief?: string, current?: HumanParams): string;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HumanParams } from '../core/params';
|
|
2
|
+
export declare function encodeCharacter(p: HumanParams): string;
|
|
3
|
+
/** Character from a shared link's `c` value (sanitised: links are untrusted input), or null. */
|
|
4
|
+
export declare function decodeCharacter(code: string, detail: HumanParams['detail']): HumanParams | null;
|
|
5
|
+
export declare function shareLink(p: HumanParams): string;
|
|
6
|
+
/** 1200x675 branded card: the character as currently framed in the viewer, its name and the brand. */
|
|
7
|
+
export declare function shareCard(source: HTMLCanvasElement, rect: {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
w: number;
|
|
11
|
+
h: number;
|
|
12
|
+
} | null, name: string): Promise<Blob>;
|
|
13
|
+
export declare const defaultCaption: (name: string) => string;
|
|
14
|
+
/** Share URLs: websites can pass text and a link to these, but not an image. */
|
|
15
|
+
export declare const NETWORKS: {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
url: (caption: string, link: string) => string;
|
|
19
|
+
}[];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Rig-fitted entry choreography. Targets are in the parked vehicle's frame, never scaled limbs. */
|
|
2
|
+
import type { Animator, Frame } from './evaluate';
|
|
3
|
+
import type { Clip } from './clips';
|
|
4
|
+
export declare function boardingFrame(A: Animator, clip: Clip, time: number, idle: Clip, ride: Clip, lift: number, choreography?: string, stand?: [number, number]): Frame;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** One-shot actions: jump phases, running jump, fall, punch, hit reaction (Jump and Low punch are motion capture). */
|
|
2
|
+
import { type Clip } from './types';
|
|
3
|
+
export declare const fall: Clip;
|
|
4
|
+
export declare const jumpStart: Clip;
|
|
5
|
+
export declare const jumpAir: Clip;
|
|
6
|
+
export declare const jumpLand: Clip;
|
|
7
|
+
export declare const jumpRunning: Clip;
|
|
8
|
+
export declare const punch: Clip;
|
|
9
|
+
export declare const hit: Clip;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Authored aerial choreography. Studio supplies altitude; game engines supply their own motion. */
|
|
2
|
+
import type { Clip } from './types';
|
|
3
|
+
export declare const skydive: Clip;
|
|
4
|
+
export declare const parachuteGlide: Clip;
|
|
5
|
+
export declare const parachuteDeploy: Clip;
|
|
6
|
+
export declare const parachuteLand: Clip;
|
|
7
|
+
export declare const AERIAL: Clip[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Climbing: ladder up and down, a speed vault over a waist-high obstacle, hanging from a ledge and climbing up onto
|
|
3
|
+
* it. Every contact (rung, obstacle top, ledge edge, wall) is fixed in floor space and both hands and feet are
|
|
4
|
+
* solved onto it, so nothing slides while the body moves. Positions are metres at 1.8 m height from the character's
|
|
5
|
+
* starting origin, facing +Z. Clips that end somewhere else carry that offset in `travel`; their authored path and
|
|
6
|
+
* contacts are expressed relative to that even travel, so they line up exactly with root motion and stay close to
|
|
7
|
+
* place without it. Games supply the ladder, obstacle and ledge (dimensions below).
|
|
8
|
+
*/
|
|
9
|
+
import type { Clip } from './types';
|
|
10
|
+
/** Ladder geometry: rungs every 30 cm, the lowest 45 cm up, in a vertical plane 36 cm in front of the origin, 44 cm wide. */
|
|
11
|
+
export declare const LADDER: {
|
|
12
|
+
rung: number;
|
|
13
|
+
first: number;
|
|
14
|
+
plane: number;
|
|
15
|
+
width: number;
|
|
16
|
+
};
|
|
17
|
+
export declare const ladderUp: Clip;
|
|
18
|
+
export declare const ladderDown: Clip;
|
|
19
|
+
/**
|
|
20
|
+
* Speed vault over a 90 cm-high, 35 cm-deep obstacle whose near face is 1.1 m ahead: step in and take off from the
|
|
21
|
+
* left foot, plant the left hand on top, lift both feet over it beside the hand, land on the far side and stand
|
|
22
|
+
* (2.8 m forward). Both feet follow explicit paths, so they always clear the top.
|
|
23
|
+
*/
|
|
24
|
+
export declare const VAULT: {
|
|
25
|
+
near: number;
|
|
26
|
+
depth: number;
|
|
27
|
+
height: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const vaultOver: Clip;
|
|
30
|
+
/** Ledge: a wall whose face is 26 cm in front of the origin and whose top edge is 2.15 m up (just above the raised hands). */
|
|
31
|
+
export declare const LEDGE: {
|
|
32
|
+
face: number;
|
|
33
|
+
top: number;
|
|
34
|
+
};
|
|
35
|
+
export declare const ledgeHang: Clip;
|
|
36
|
+
export declare const ledgeClimb: Clip;
|
|
37
|
+
export declare const CLIMBING: Clip[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unarmed fighting: a guard stance, a jab-cross-hook combination, front and roundhouse kicks and a high block. Every
|
|
3
|
+
* move starts and ends in the guard, so they chain with Fighting stance and with each other.
|
|
4
|
+
*/
|
|
5
|
+
import type { Clip } from './types';
|
|
6
|
+
export declare const COMBAT: Clip[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rifle combat: taking cover behind a low wall, waiting in cover, popping up to fire over it, and hit and death
|
|
3
|
+
* reactions that keep hold of the rifle. Cover idle and Cover fire are built against a wall `COVER` (metres at 1.8 m
|
|
4
|
+
* height, from the character's position, facing forward); Take cover starts from Rifle idle and steps up to it.
|
|
5
|
+
*/
|
|
6
|
+
import type { Clip } from './types';
|
|
7
|
+
export declare const COVER: {
|
|
8
|
+
near: number;
|
|
9
|
+
depth: number;
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Take cover: two steps forward (left, then right) while the rifle comes up to the chest, then down into the crouch
|
|
15
|
+
* behind the wall. Starts from Rifle idle and ends in Cover idle, `TAKE_COVER_STEP` further forward. Each foot is
|
|
16
|
+
* planted on the floor (floor space, as residuals around the even travel) so nothing slides.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TAKE_COVER_STEP = 0.46;
|
|
19
|
+
export declare const RIFLE_COMBAT: Clip[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dodge and roll: a forward (shoulder) roll and quick side dodges. Root motion is carried by `travel`, so
|
|
3
|
+
* engines can play them in place or moving; the body stays above the floor through the roll.
|
|
4
|
+
*/
|
|
5
|
+
import type { Clip } from './types';
|
|
6
|
+
/** Crouch, hands to the floor, tuck the head and roll over the back, then come up through a crouch to stand. */
|
|
7
|
+
export declare const forwardRoll: Clip;
|
|
8
|
+
export declare const DODGES: Clip[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Emotes: wave, cheer, laugh, talk and social emotes (cry is motion capture: see mocap-data.ts). */
|
|
2
|
+
import { type Clip } from './types';
|
|
3
|
+
export declare const wave: Clip;
|
|
4
|
+
export declare const cheer: Clip;
|
|
5
|
+
/** Laughing: the body bounces with each "ha", the head tips back, a hand on the belly. */
|
|
6
|
+
export declare const laugh: Clip;
|
|
7
|
+
/** Talking: the idle stance with the head nodding and tilting on stressed syllables (the mouth is in faces.ts). */
|
|
8
|
+
export declare const talk: Clip;
|
|
9
|
+
/** Applause: palms meet in front of the chest twice a second. */
|
|
10
|
+
export declare const clap: Clip;
|
|
11
|
+
/** Point straight ahead with the right index finger, then hold. */
|
|
12
|
+
export declare const point: Clip;
|
|
13
|
+
/** Thumbs up in front of the chest, then hold. */
|
|
14
|
+
export declare const thumbsUp: Clip;
|
|
15
|
+
/** A respectful bow from the hips, hands at the sides, and back up. */
|
|
16
|
+
export declare const bow: Clip;
|
|
17
|
+
/** Groove: step-touch side to side on the beat (120 bpm), knees bouncing, arms swinging, head nodding. */
|
|
18
|
+
export declare const danceGroove: Clip;
|
|
19
|
+
/** Party bounce: quick knee bounce, shoulders shimmying and alternating hands raised. */
|
|
20
|
+
export declare const danceBounce: Clip;
|
|
21
|
+
export declare const SOCIAL_EMOTES: Clip[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Everyday NPCs: conversation gestures, a phone call, texting, leaning on a wall, looking around and sweeping.
|
|
3
|
+
* The phone is Carry: Mobile phone (left hand); sweeping uses Carry: Broom, laid through both hands.
|
|
4
|
+
*/
|
|
5
|
+
import type { Clip } from './types';
|
|
6
|
+
/** Explaining with open hands: beats of emphasis, palms up, a little head and shoulder movement. */
|
|
7
|
+
export declare const talkGestures: Clip;
|
|
8
|
+
export declare const phoneCall: Clip;
|
|
9
|
+
export declare const texting: Clip;
|
|
10
|
+
/** Leaning back against a wall, arms crossed, one foot flat against it. The wall is about 18 cm behind the heels. */
|
|
11
|
+
export declare const leanWall: Clip;
|
|
12
|
+
/** Looking around: head and upper body turn to scan left and right, a pause at each side. */
|
|
13
|
+
export declare const lookAround: Clip;
|
|
14
|
+
export declare const sweep: Clip;
|
|
15
|
+
export declare const EVERYDAY: Clip[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Facial animation layered onto the body clips: effort, pain, smiles and aiming. Weights are
|
|
3
|
+
* added to the character's expression (and clamped); blinking and eye glances come from the
|
|
4
|
+
* evaluator. Faces that chain (Knockdown -> Get up, Death (fall forward) -> Get up) match
|
|
5
|
+
* where the clips meet, like the body poses.
|
|
6
|
+
*/
|
|
7
|
+
import { type Clip } from './types';
|
|
8
|
+
/** Clips with their facial animation added (clips without an entry keep a resting face). */
|
|
9
|
+
export declare function withFaces(clips: Clip[]): Clip[];
|
|
10
|
+
/** Clip ids that have facial animation (for docs and tests). */
|
|
11
|
+
export declare const CLIPS_WITH_FACES: string[];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Procedural low gait for crouch locomotion; upright movement uses recorded.ts. */
|
|
2
|
+
import { type Sample } from './types';
|
|
3
|
+
export interface Gait {
|
|
4
|
+
thigh: number[];
|
|
5
|
+
knee: number[];
|
|
6
|
+
foot: number[];
|
|
7
|
+
arm: number[];
|
|
8
|
+
elbow: number[];
|
|
9
|
+
bob: number[];
|
|
10
|
+
pelvisYaw: number;
|
|
11
|
+
spineLean: number;
|
|
12
|
+
armOut: number;
|
|
13
|
+
legIn: number;
|
|
14
|
+
}
|
|
15
|
+
export declare const WALK: Gait;
|
|
16
|
+
export declare const RUN: Gait;
|
|
17
|
+
export declare function gait(g: Gait, p: number, reverse?: boolean): Sample;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gunshot reactions: shot in the head, chest, back or stomach (falling dead), in the leg (down on one knee) and in
|
|
3
|
+
* the arm (staying on the feet). Each clip lists its wounds, so a viewer can add blood where and when the bullet
|
|
4
|
+
* lands (see props/blood.ts). The deaths fall through the unarmed deaths and end in exactly their poses, so the
|
|
5
|
+
* matching Get up follows.
|
|
6
|
+
*/
|
|
7
|
+
import type { Clip } from './types';
|
|
8
|
+
export declare const GUNSHOT: Clip[];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Shared helpers for clip definitions: curves, left/right mirroring, finger poses, vectors. */
|
|
2
|
+
import { type Ch } from './types';
|
|
3
|
+
/** Periodic Catmull-Rom through evenly spaced keys over phase 0..1. */
|
|
4
|
+
export declare function cyc(keys: number[]): (p: number) => number;
|
|
5
|
+
/** Smooth (eased) interpolation through timed keys, clamped at the ends. */
|
|
6
|
+
export declare function track(times: number[], values: number[]): (t: number) => number;
|
|
7
|
+
export declare const smoother: (x: number) => number;
|
|
8
|
+
/** Left/right channels: right is the mirror (twist and side negated). */
|
|
9
|
+
export declare function side(out: Record<string, Ch>, bone: string, left: Ch, right: Ch): void;
|
|
10
|
+
/** Relaxed, slightly curled fingers (game rig). */
|
|
11
|
+
export declare function fingers(out: Record<string, Ch>, curl?: number): void;
|
|
12
|
+
/**
|
|
13
|
+
* Closed fists: fingers curl into the palm; the thumb is wrapped across the
|
|
14
|
+
* front of the index/middle fingers by the evaluator (sample.thumbs).
|
|
15
|
+
*/
|
|
16
|
+
export declare function fist(out: Record<string, Ch>, sides?: ('Left' | 'Right')[]): void;
|
|
17
|
+
export declare const FISTS: {
|
|
18
|
+
Left: number;
|
|
19
|
+
Right: number;
|
|
20
|
+
};
|
|
21
|
+
/** Grip on a rifle: trigger finger along the guard (right), wrapped fingers. */
|
|
22
|
+
export declare function grip(out: Record<string, Ch>, side: 'Left' | 'Right', trigger?: boolean, curl?: number): void;
|
|
23
|
+
export declare const v: (x: number, y: number, z: number) => [number, number, number];
|
|
24
|
+
export declare const lerp3: (a: [number, number, number], b: [number, number, number], t: number) => [number, number, number];
|
|
25
|
+
export declare const crossV: (a: [number, number, number], b: [number, number, number]) => [number, number, number];
|
|
26
|
+
export declare const normV: (a: [number, number, number]) => [number, number, number];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All animation clips, in the order the app and exporters list them.
|
|
3
|
+
* Each set lives in its own module; add new sets as new files and list them here.
|
|
4
|
+
*/
|
|
5
|
+
import { type Clip } from './types';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export declare const CLIPS: Clip[];
|
|
8
|
+
export declare const clipById: Map<string, Clip>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Everyday interactions. Targets are metres at 1.8 m; games supply the object and door. */
|
|
2
|
+
import type { Clip, Sample } from './types';
|
|
3
|
+
/** Equipped parcels use the same two-hand hold over ordinary movement and standing poses. */
|
|
4
|
+
export declare function carriesParcel(clip: Clip): boolean;
|
|
5
|
+
export declare function parcelHold(s: Sample): Sample;
|
|
6
|
+
export declare const carryIdle: Clip;
|
|
7
|
+
/** Keep the recorded footfalls, hip weight shifts and root travel; replace only the arm layer. */
|
|
8
|
+
export declare const carryWalk: Clip;
|
|
9
|
+
export declare const pickUp: Clip;
|
|
10
|
+
export declare const usePress: Clip;
|
|
11
|
+
export declare const openDoor: Clip;
|
|
12
|
+
export declare const push: Clip;
|
|
13
|
+
/** The matching controlled drop: lower the box, release it on the ground, then stand upright. */
|
|
14
|
+
export declare const putDown: Clip;
|
|
15
|
+
export declare const headLoadIdle: Clip;
|
|
16
|
+
/** The recorded walk at a steadier pace: hips and footfalls kept, head level, right hand on the load, left arm swinging. */
|
|
17
|
+
export declare const headLoadWalk: Clip;
|
|
18
|
+
export declare const INTERACTIONS: Clip[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lying down and sleeping on the back, built on Get up (from back): Lie down is that clip played
|
|
3
|
+
* in reverse, Sleep holds its first (lying) pose with slow breathing. They chain:
|
|
4
|
+
* Lie down -> Sleep -> Get up (from back).
|
|
5
|
+
*/
|
|
6
|
+
import { type Clip } from './types';
|
|
7
|
+
export declare const lieDown: Clip;
|
|
8
|
+
export declare const sleep: Clip;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion-capture clip data, generated by scripts/build-mocap.ts from the CMU Graphics Lab Motion
|
|
3
|
+
* Capture Database (mocap.cs.cmu.edu; created with funding from NSF EIA-0196217). Do not edit.
|
|
4
|
+
*/
|
|
5
|
+
import type { MocapData } from '../mocap';
|
|
6
|
+
export declare const MOCAP_DATA: Record<string, MocapData>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reactions: directional hit reactions, knockdown, death falling backward and getting up.
|
|
3
|
+
* Clips that chain share their poses where they meet: Knockdown ends lying face up exactly where
|
|
4
|
+
* Get up (face up) starts, and Get up (face down) starts from the face-down pose that
|
|
5
|
+
* Death (fall forward) ends in, so a game can play them back to back without a pop.
|
|
6
|
+
*/
|
|
7
|
+
import { type Clip } from './types';
|
|
8
|
+
type HitDir = 'front' | 'back' | 'left' | 'right';
|
|
9
|
+
/**
|
|
10
|
+
* A hit coming from `dir` (where the attacker is). The upper body is knocked away from the
|
|
11
|
+
* hit, the character takes a recovery step the same way, then settles back to neutral.
|
|
12
|
+
*/
|
|
13
|
+
export declare function hitFrom(dir: HitDir): Clip;
|
|
14
|
+
/** Lying on the back: the pose Knockdown and Death (fall backward) end in, and Get up (from back) starts from. */
|
|
15
|
+
export declare const ON_BACK: {
|
|
16
|
+
drop: number;
|
|
17
|
+
pitch: number;
|
|
18
|
+
z: number;
|
|
19
|
+
spine: number[];
|
|
20
|
+
upLeg: number[];
|
|
21
|
+
leg: number[];
|
|
22
|
+
foot: number[];
|
|
23
|
+
arm: number[];
|
|
24
|
+
armOut: number[];
|
|
25
|
+
foreArm: number[];
|
|
26
|
+
};
|
|
27
|
+
/** Collapse backward and stay down, limp. */
|
|
28
|
+
export declare const deathBackward: Clip;
|
|
29
|
+
/** Collapse forward, face down, and stay down. */
|
|
30
|
+
export declare const deathForward: Clip;
|
|
31
|
+
/** From lying on the back: sit up, tuck the feet in, push off the ground and stand. */
|
|
32
|
+
export declare const getUpFaceUp: Clip;
|
|
33
|
+
export declare const REACTIONS: Clip[];
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Clip, Sample } from './types';
|
|
2
|
+
export declare const recordedWalk: Clip;
|
|
3
|
+
export declare const recordedRun: Clip;
|
|
4
|
+
/** Reverse the complete recorded pose and root velocity together, without altering the gait. */
|
|
5
|
+
export declare const walkBack: Clip;
|
|
6
|
+
export declare function uprightStrafe(clip: Clip): Clip;
|
|
7
|
+
export declare const recordedStrafeLeft: Clip;
|
|
8
|
+
export declare const recordedStrafeRight: Clip;
|
|
9
|
+
/** Retiming changes cadence AND root velocity, keeping exactly the same distance per stride. */
|
|
10
|
+
export declare function pace(clip: Clip, factor: number): Clip;
|
|
11
|
+
/** A weapon hold replaces only the participating arm(s), not the captured lower body. */
|
|
12
|
+
export declare function armLayer(sample: Sample, sides?: readonly ('Left' | 'Right')[]): Sample;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runner moves: a running slide under low bars, a run leaning into a turn, and a stumble that trips forward and
|
|
3
|
+
* recovers into the run. The lean is the procedural run with the body banked toward the turn.
|
|
4
|
+
*/
|
|
5
|
+
import type { Clip } from './types';
|
|
6
|
+
/** Drop onto the hip with the lead leg straight, lean back under the bar, then push up into the run. */
|
|
7
|
+
export declare const runSlide: Clip;
|
|
8
|
+
/** Catch a foot, pitch forward with the arms thrown out, take a long catching step and settle back into the run. */
|
|
9
|
+
export declare const stumbleRecover: Clip;
|
|
10
|
+
export declare const RUNNER_MOVES: Clip[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Shooter set: rifle and pistol holds, firing, reload, grenade, death. */
|
|
2
|
+
import { type Ch, type Clip, type HandTarget, type Sample } from './types';
|
|
3
|
+
export type Hold = {
|
|
4
|
+
Left: HandTarget;
|
|
5
|
+
Right: HandTarget;
|
|
6
|
+
};
|
|
7
|
+
export declare const AIM: Hold;
|
|
8
|
+
export declare const READY: Hold;
|
|
9
|
+
/** Upper body for a rifle hold: shoulders square, head on the sights when aiming. */
|
|
10
|
+
export declare function rifleUpper(out: Record<string, Ch>, aiming: boolean, breathe?: number): void;
|
|
11
|
+
/** Bladed shooter stance (left foot forward). */
|
|
12
|
+
export declare function stance(out: Record<string, Ch>, crouch?: boolean): void;
|
|
13
|
+
export declare const hold: (h: Hold, recoil?: number) => Sample['ik'];
|
|
14
|
+
export declare const PISTOL: Clip[];
|
|
15
|
+
export declare const RIFLE: Clip[];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A fixed stretch of babble for the Talk clip: phrases of consonant + vowel syllables with pauses,
|
|
3
|
+
* as viseme events. The mouth (faces.ts) blends the events; the head (emotes.ts) nods on stressed
|
|
4
|
+
* syllables. Rest at both ends, so the loop closes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TALK_LEN = 6.4;
|
|
7
|
+
/** Viseme weights at time t. */
|
|
8
|
+
export declare function speechFace(t: number): Partial<Record<string, number>>;
|
|
9
|
+
/** 0..1 emphasis at time t (stressed syllables), with a longer tail for head nods and brows. */
|
|
10
|
+
export declare function speechStress(t: number): number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Swimming. The water surface is the floor plane (y = 0): swimmers float with the body below it and the head
|
|
3
|
+
* above, as Studio's water and the builder's water preview show. Strokes carry their speed in `travel`;
|
|
4
|
+
* the dive and climb-out author their own path around an even travel so engines can play them in place.
|
|
5
|
+
*/
|
|
6
|
+
import type { Clip } from './types';
|
|
7
|
+
/** Treading water: upright, eggbeater kick, hands sculling just below the surface, head clear. */
|
|
8
|
+
export declare const treadWater: Clip;
|
|
9
|
+
/** Front crawl: prone, rolling with the alternating arms, flutter kick, breathing to the right each cycle. */
|
|
10
|
+
export declare const swimFreestyle: Clip;
|
|
11
|
+
/** Backstroke: on the back, straight-arm windmill, flutter kick, face out of the water. */
|
|
12
|
+
export declare const swimBackstroke: Clip;
|
|
13
|
+
/** Breaststroke: glide, out-sweep, in-sweep lifting the head to breathe, frog kick, glide. */
|
|
14
|
+
export declare const swimBreaststroke: Clip;
|
|
15
|
+
export declare const diveIntoWater: Clip;
|
|
16
|
+
export declare const climbOutOfWater: Clip;
|
|
17
|
+
export declare const SWIMMING: Clip[];
|