@threenative/metahuman 0.1.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/LICENSE +21 -0
- package/README.md +92 -0
- package/dist/asset-contract-bodYITUR.d.ts +314 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.js +1466 -0
- package/dist/native/index.d.ts +90 -0
- package/dist/native/index.js +879 -0
- package/package.json +67 -0
- package/wasm/checksums.json +8 -0
- package/wasm/riglogic.d.mts +3 -0
- package/wasm/riglogic.mjs +2 -0
- package/wasm/riglogic.wasm +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { s as IRigEvaluator, t as IRigEvaluatorCounts, x as RigEvaluatorKind, I as ILoadMetaHumanOptions, a as IMetaHuman } from '../asset-contract-bodYITUR.js';
|
|
2
|
+
export { c as IMetaHumanAssetInput, d as IMetaHumanAssets, f as IMetaHumanBindings, g as IMetaHumanControl, i as IMetaHumanDiagnostics, j as IMetaHumanGltfFacts, p as IMetaHumanModel, r as IMetaHumanRigFacts, M as METAHUMAN_BINDINGS_SCHEMA_VERSION, u as MetaHumanAssetError, v as MetaHumanErrorCode, y as assertAssetPath, z as validateMetaHumanAssets } from '../asset-contract-bodYITUR.js';
|
|
3
|
+
import 'three';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The native MetaHuman resident, and the one fail-closed door into it.
|
|
7
|
+
*
|
|
8
|
+
* Shape of the object the C++ host installs on `globalThis.__THREENATIVE_NATIVE__.metahuman`
|
|
9
|
+
* (`packages/runtime-native/src/metahuman/native_bindings.cpp`). It mirrors
|
|
10
|
+
* `packages/physics/src/native/host.ts` exactly: a raw host object typed here, validated here,
|
|
11
|
+
* and a single accessor that throws a named code when the runtime did not install it.
|
|
12
|
+
*/
|
|
13
|
+
interface INativeMetaHumanHost {
|
|
14
|
+
/** `tn_metahuman/1 OpenRigLogic <40-hex revision>` — the backend and the pin it was built from. */
|
|
15
|
+
readonly version: string;
|
|
16
|
+
create(dna: ArrayBuffer | Uint8Array): number;
|
|
17
|
+
count(id: number, kind: number): number;
|
|
18
|
+
name(id: number, kind: number, index: number): string;
|
|
19
|
+
setLod(id: number, lod: number): void;
|
|
20
|
+
setGui(id: number, values: Float32Array): void;
|
|
21
|
+
setRaw(id: number, values: Float32Array): void;
|
|
22
|
+
evaluate(id: number, useGui: boolean): void;
|
|
23
|
+
jointOutputs(id: number): Float32Array;
|
|
24
|
+
blendShapeOutputs(id: number): Float32Array;
|
|
25
|
+
animatedMapOutputs(id: number): Float32Array;
|
|
26
|
+
neutralJoints(id: number): Float32Array;
|
|
27
|
+
destroy(id: number): void;
|
|
28
|
+
lastError(): string;
|
|
29
|
+
/** Live rig handles in the host process, so a create/dispose cycle can be proved leak-free. */
|
|
30
|
+
liveCount(): number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The installed host, or a rejection naming the missing capability.
|
|
34
|
+
*
|
|
35
|
+
* A native build without `TN_ENABLE_METAHUMAN` has no metahuman resident. That is a build the
|
|
36
|
+
* game cannot run on, so it says so; it never falls back to the WASM module, which is not in
|
|
37
|
+
* the native bundle at all.
|
|
38
|
+
*/
|
|
39
|
+
declare function nativeMetaHumanHost(): INativeMetaHumanHost;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* One rig instance over the C++ OpenRigLogic build the native host compiled.
|
|
43
|
+
*
|
|
44
|
+
* The same `packages/metahuman/cpp` ABI the browser WASM module exports, so this class and
|
|
45
|
+
* `RigEvaluator` are interchangeable: the checks, the error codes and the copied outputs are
|
|
46
|
+
* identical, and only the crossing differs.
|
|
47
|
+
*/
|
|
48
|
+
declare class NativeRigEvaluator implements IRigEvaluator {
|
|
49
|
+
#private;
|
|
50
|
+
private constructor();
|
|
51
|
+
/** Parse a DNA blob. The host copies the bytes, so the caller keeps its buffer. */
|
|
52
|
+
static create(dna: ArrayBuffer | Uint8Array, host?: INativeMetaHumanHost): NativeRigEvaluator;
|
|
53
|
+
/** The backend and pinned OpenRigLogic revision the host was built from. */
|
|
54
|
+
backend(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Live evaluator handles in the host process, across every instance of this class.
|
|
57
|
+
*
|
|
58
|
+
* The count a create/dispose cycle must return to, read from the ABI's own registry.
|
|
59
|
+
*/
|
|
60
|
+
static liveHandleCount(host?: INativeMetaHumanHost): number;
|
|
61
|
+
counts(): IRigEvaluatorCounts;
|
|
62
|
+
names(kind: RigEvaluatorKind): readonly string[];
|
|
63
|
+
setLod(lod: number): void;
|
|
64
|
+
setGuiControls(values: Float32Array): void;
|
|
65
|
+
setRawControls(values: Float32Array): void;
|
|
66
|
+
evaluate(useGui: boolean): void;
|
|
67
|
+
jointOutputs(): Float32Array;
|
|
68
|
+
blendShapeOutputs(): Float32Array;
|
|
69
|
+
animatedMapOutputs(): Float32Array;
|
|
70
|
+
neutralJoints(): Float32Array;
|
|
71
|
+
dispose(): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Load a prepared MetaHuman head and drive its expression from the native C++ evaluator: the same
|
|
76
|
+
* handle, the same controls, the same error codes as the browser entry, over the resident the
|
|
77
|
+
* runtime installed.
|
|
78
|
+
* @situation put a MetaHuman head in a Linux native game
|
|
79
|
+
* @constraint never falls back to the WASM module, which this bundle does not carry; a runtime
|
|
80
|
+
* built without `TN_ENABLE_METAHUMAN` fails with `TN_NATIVE_METAHUMAN_MISSING`
|
|
81
|
+
* @constraint the model is loaded through the game's own asset loader and cloned per instance, so
|
|
82
|
+
* two characters never write each other's face and nothing is disposed that `ctx.assets` still owns
|
|
83
|
+
* @requires npm i @threenative/metahuman
|
|
84
|
+
* @example const human = await loadMetaHuman({ assets: ctx.assets, model: "metahuman/head.glb",
|
|
85
|
+
* dna: "metahuman/head.dna", bindings: "metahuman/bindings.json" });
|
|
86
|
+
* human.setControls({ jawOpen: 0.4 });
|
|
87
|
+
*/
|
|
88
|
+
declare const loadMetaHuman: (options: ILoadMetaHumanOptions) => Promise<IMetaHuman>;
|
|
89
|
+
|
|
90
|
+
export { ILoadMetaHumanOptions, IMetaHuman, type INativeMetaHumanHost, IRigEvaluator, IRigEvaluatorCounts, NativeRigEvaluator, RigEvaluatorKind, loadMetaHuman, nativeMetaHumanHost };
|