@pixiv/three-vrm-core 2.1.0-beta.3 → 2.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 +22 -0
- package/lib/three-vrm-core.js +1 -1
- package/lib/three-vrm-core.module.js +1 -1
- package/package.json +5 -4
- package/ts3.4/types/VRMCore.d.ts +58 -0
- package/ts3.4/types/VRMCoreLoaderPlugin.d.ts +18 -0
- package/ts3.4/types/VRMCoreLoaderPluginOptions.d.ts +19 -0
- package/ts3.4/types/VRMCoreParameters.d.ts +16 -0
- package/ts3.4/types/expressions/VRMExpression.d.ts +65 -0
- package/ts3.4/types/expressions/VRMExpressionBind.d.ts +11 -0
- package/ts3.4/types/expressions/VRMExpressionLoaderPlugin.d.ts +23 -0
- package/ts3.4/types/expressions/VRMExpressionManager.d.ts +124 -0
- package/ts3.4/types/expressions/VRMExpressionMaterialColorBind.d.ts +58 -0
- package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +12 -0
- package/ts3.4/types/expressions/VRMExpressionMorphTargetBind.d.ts +35 -0
- package/ts3.4/types/expressions/VRMExpressionOverrideType.d.ts +6 -0
- package/ts3.4/types/expressions/VRMExpressionPresetName.d.ts +21 -0
- package/ts3.4/types/expressions/VRMExpressionTextureTransformBind.d.ts +40 -0
- package/ts3.4/types/expressions/index.d.ts +10 -0
- package/ts3.4/types/firstPerson/VRMFirstPerson.d.ts +84 -0
- package/ts3.4/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +20 -0
- package/ts3.4/types/firstPerson/VRMFirstPersonMeshAnnotation.d.ts +5 -0
- package/ts3.4/types/firstPerson/VRMFirstPersonMeshAnnotationType.d.ts +7 -0
- package/ts3.4/types/firstPerson/index.d.ts +4 -0
- package/ts3.4/types/humanoid/VRMHumanBone.d.ts +10 -0
- package/ts3.4/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/ts3.4/types/humanoid/VRMHumanBoneName.d.ts +63 -0
- package/ts3.4/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/ts3.4/types/humanoid/VRMHumanBones.d.ts +11 -0
- package/ts3.4/types/humanoid/VRMHumanoid.d.ts +182 -0
- package/ts3.4/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +32 -0
- package/ts3.4/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
- package/ts3.4/types/humanoid/VRMHumanoidRig.d.ts +31 -0
- package/ts3.4/types/humanoid/VRMPose.d.ts +24 -0
- package/ts3.4/types/humanoid/VRMPoseTransform.d.ts +24 -0
- package/ts3.4/types/humanoid/VRMRequiredHumanBoneName.d.ts +18 -0
- package/ts3.4/types/humanoid/VRMRig.d.ts +62 -0
- package/ts3.4/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
- package/ts3.4/types/humanoid/helpers/index.d.ts +1 -0
- package/ts3.4/types/humanoid/index.d.ts +12 -0
- package/ts3.4/types/index.d.ts +9 -0
- package/ts3.4/types/lookAt/VRMLookAt.d.ts +149 -0
- package/ts3.4/types/lookAt/VRMLookAtApplier.d.ts +18 -0
- package/ts3.4/types/lookAt/VRMLookAtBoneApplier.d.ts +83 -0
- package/ts3.4/types/lookAt/VRMLookAtExpressionApplier.d.ts +56 -0
- package/ts3.4/types/lookAt/VRMLookAtLoaderPlugin.d.ts +30 -0
- package/ts3.4/types/lookAt/VRMLookAtLoaderPluginOptions.d.ts +8 -0
- package/ts3.4/types/lookAt/VRMLookAtRangeMap.d.ts +23 -0
- package/ts3.4/types/lookAt/VRMLookAtTypeName.d.ts +8 -0
- package/ts3.4/types/lookAt/helpers/VRMLookAtHelper.d.ts +11 -0
- package/ts3.4/types/lookAt/helpers/index.d.ts +1 -0
- package/ts3.4/types/lookAt/helpers/utils/FanBufferGeometry.d.ts +13 -0
- package/ts3.4/types/lookAt/helpers/utils/LineAndSphereBufferGeometry.d.ts +13 -0
- package/ts3.4/types/lookAt/index.d.ts +8 -0
- package/ts3.4/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
- package/ts3.4/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
- package/ts3.4/types/lookAt/utils/calcAzimuthAltitude.d.ts +16 -0
- package/ts3.4/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
- package/ts3.4/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
- package/ts3.4/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
- package/ts3.4/types/meta/VRM0Meta.d.ts +62 -0
- package/ts3.4/types/meta/VRM1Meta.d.ts +86 -0
- package/ts3.4/types/meta/VRMMeta.d.ts +6 -0
- package/ts3.4/types/meta/VRMMetaLoaderPlugin.d.ts +32 -0
- package/ts3.4/types/meta/VRMMetaLoaderPluginOptions.d.ts +22 -0
- package/ts3.4/types/meta/index.d.ts +5 -0
- package/ts3.4/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
- package/ts3.4/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
- package/ts3.4/types/utils/getWorldQuaternionLite.d.ts +10 -0
- package/ts3.4/types/utils/gltfExtractPrimitivesFromNode.d.ts +21 -0
- package/ts3.4/types/utils/gltfGetAssociatedMaterialIndex.d.ts +10 -0
- package/ts3.4/types/utils/quatInvertCompat.d.ts +8 -0
- package/ts3.4/types/utils/renameMaterialProperty.d.ts +1 -0
- package/ts3.4/types/utils/resolveURL.d.ts +4 -0
- package/ts3.4/types/utils/saturate.d.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright (c) 2019-2024 pixiv Inc.
|
|
2
|
+
|
|
3
|
+
MIT License
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/lib/three-vrm-core.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixiv/three-vrm-core",
|
|
3
|
-
"version": "2.1.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "The implementation of core features of VRM, for @pixiv/three-vrm",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "pixiv",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@pixiv/types-vrm-0.0": "2.1.0
|
|
54
|
-
"@pixiv/types-vrmc-vrm-1.0": "2.1.0
|
|
53
|
+
"@pixiv/types-vrm-0.0": "2.1.0",
|
|
54
|
+
"@pixiv/types-vrmc-vrm-1.0": "2.1.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@types/three": "^0.160.0",
|
|
@@ -60,5 +60,6 @@
|
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@types/three": "^0.160.0",
|
|
62
62
|
"three": "^0.160.0"
|
|
63
|
-
}
|
|
63
|
+
},
|
|
64
|
+
"gitHead": "0d96aeaa6e20baa8158658652179df20a162d8a3"
|
|
64
65
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMExpressionManager } from './expressions/VRMExpressionManager';
|
|
3
|
+
import { VRMFirstPerson } from './firstPerson/VRMFirstPerson';
|
|
4
|
+
import { VRMHumanoid } from './humanoid/VRMHumanoid';
|
|
5
|
+
import { VRMLookAt } from './lookAt/VRMLookAt';
|
|
6
|
+
import { VRMMeta } from './meta/VRMMeta';
|
|
7
|
+
import { VRMCoreParameters } from './VRMCoreParameters';
|
|
8
|
+
/**
|
|
9
|
+
* A class that represents a single VRM model.
|
|
10
|
+
* This class only includes core spec of the VRM (`VRMC_vrm`).
|
|
11
|
+
*/
|
|
12
|
+
export declare class VRMCore {
|
|
13
|
+
/**
|
|
14
|
+
* `THREE.Group` that contains the entire VRM.
|
|
15
|
+
*/
|
|
16
|
+
readonly scene: THREE.Group;
|
|
17
|
+
/**
|
|
18
|
+
* Contains meta fields of the VRM.
|
|
19
|
+
* You might want to refer these license fields before use your VRMs.
|
|
20
|
+
*/
|
|
21
|
+
readonly meta: VRMMeta;
|
|
22
|
+
/**
|
|
23
|
+
* Contains {@link VRMHumanoid} of the VRM.
|
|
24
|
+
* You can control each bones using {@link VRMHumanoid.getNormalizedBoneNode} or {@link VRMHumanoid.getRawBoneNode}.
|
|
25
|
+
*
|
|
26
|
+
* @TODO Add a link to VRM spec
|
|
27
|
+
*/
|
|
28
|
+
readonly humanoid: VRMHumanoid;
|
|
29
|
+
/**
|
|
30
|
+
* Contains {@link VRMExpressionManager} of the VRM.
|
|
31
|
+
* You might want to control these facial expressions via {@link VRMExpressionManager.setValue}.
|
|
32
|
+
*/
|
|
33
|
+
readonly expressionManager?: VRMExpressionManager;
|
|
34
|
+
/**
|
|
35
|
+
* Contains {@link VRMFirstPerson} of the VRM.
|
|
36
|
+
* VRMFirstPerson is mostly used for mesh culling for first person view.
|
|
37
|
+
*/
|
|
38
|
+
readonly firstPerson?: VRMFirstPerson;
|
|
39
|
+
/**
|
|
40
|
+
* Contains {@link VRMLookAt} of the VRM.
|
|
41
|
+
* You might want to use {@link VRMLookAt.target} to control the eye direction of your VRMs.
|
|
42
|
+
*/
|
|
43
|
+
readonly lookAt?: VRMLookAt;
|
|
44
|
+
/**
|
|
45
|
+
* Create a new VRM instance.
|
|
46
|
+
*
|
|
47
|
+
* @param params [[VRMParameters]] that represents components of the VRM
|
|
48
|
+
*/
|
|
49
|
+
constructor(params: VRMCoreParameters);
|
|
50
|
+
/**
|
|
51
|
+
* **You need to call this on your update loop.**
|
|
52
|
+
*
|
|
53
|
+
* This function updates every VRM components.
|
|
54
|
+
*
|
|
55
|
+
* @param delta deltaTime
|
|
56
|
+
*/
|
|
57
|
+
update(delta: number): void;
|
|
58
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
+
import { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
|
|
3
|
+
import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
|
|
4
|
+
import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
|
|
5
|
+
import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
|
|
6
|
+
import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
|
|
7
|
+
import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
|
|
8
|
+
export declare class VRMCoreLoaderPlugin implements GLTFLoaderPlugin {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly parser: GLTFParser;
|
|
11
|
+
readonly expressionPlugin: VRMExpressionLoaderPlugin;
|
|
12
|
+
readonly firstPersonPlugin: VRMFirstPersonLoaderPlugin;
|
|
13
|
+
readonly humanoidPlugin: VRMHumanoidLoaderPlugin;
|
|
14
|
+
readonly lookAtPlugin: VRMLookAtLoaderPlugin;
|
|
15
|
+
readonly metaPlugin: VRMMetaLoaderPlugin;
|
|
16
|
+
constructor(parser: GLTFParser, options?: VRMCoreLoaderPluginOptions);
|
|
17
|
+
afterRoot(gltf: GLTF): Promise<void>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
|
|
2
|
+
import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
|
|
3
|
+
import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
|
|
4
|
+
import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
|
|
5
|
+
import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
|
|
6
|
+
export interface VRMCoreLoaderPluginOptions {
|
|
7
|
+
expressionPlugin?: VRMExpressionLoaderPlugin;
|
|
8
|
+
firstPersonPlugin?: VRMFirstPersonLoaderPlugin;
|
|
9
|
+
humanoidPlugin?: VRMHumanoidLoaderPlugin;
|
|
10
|
+
lookAtPlugin?: VRMLookAtLoaderPlugin;
|
|
11
|
+
metaPlugin?: VRMMetaLoaderPlugin;
|
|
12
|
+
/**
|
|
13
|
+
* If assigned, the object will be used as a helper root of every component.
|
|
14
|
+
* Useful for debug.
|
|
15
|
+
* Will be overwritten if you use custom loader plugins for each components.
|
|
16
|
+
*/
|
|
17
|
+
helperRoot?: THREE.Object3D;
|
|
18
|
+
autoUpdateHumanBones?: boolean;
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { VRMExpressionManager } from './expressions/VRMExpressionManager';
|
|
2
|
+
import { VRMFirstPerson } from './firstPerson/VRMFirstPerson';
|
|
3
|
+
import { VRMHumanoid } from './humanoid/VRMHumanoid';
|
|
4
|
+
import { VRMLookAt } from './lookAt/VRMLookAt';
|
|
5
|
+
import { VRMMeta } from './meta/VRMMeta';
|
|
6
|
+
/**
|
|
7
|
+
* Parameters for a {@link VRMCore} class.
|
|
8
|
+
*/
|
|
9
|
+
export interface VRMCoreParameters {
|
|
10
|
+
scene: THREE.Group;
|
|
11
|
+
meta: VRMMeta;
|
|
12
|
+
humanoid: VRMHumanoid;
|
|
13
|
+
expressionManager?: VRMExpressionManager;
|
|
14
|
+
firstPerson?: VRMFirstPerson;
|
|
15
|
+
lookAt?: VRMLookAt;
|
|
16
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMExpressionBind } from './VRMExpressionBind';
|
|
3
|
+
import { VRMExpressionOverrideType } from './VRMExpressionOverrideType';
|
|
4
|
+
export declare class VRMExpression extends THREE.Object3D {
|
|
5
|
+
/**
|
|
6
|
+
* Name of this expression.
|
|
7
|
+
* Distinguished with `name` since `name` will be conflicted with Object3D.
|
|
8
|
+
*/
|
|
9
|
+
expressionName: string;
|
|
10
|
+
/**
|
|
11
|
+
* The current weight of the expression.
|
|
12
|
+
*/
|
|
13
|
+
weight: number;
|
|
14
|
+
/**
|
|
15
|
+
* Interpret values greater than 0.5 as 1.0, ortherwise 0.0.
|
|
16
|
+
*/
|
|
17
|
+
isBinary: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Specify how the expression overrides blink expressions.
|
|
20
|
+
*/
|
|
21
|
+
overrideBlink: VRMExpressionOverrideType;
|
|
22
|
+
/**
|
|
23
|
+
* Specify how the expression overrides lookAt expressions.
|
|
24
|
+
*/
|
|
25
|
+
overrideLookAt: VRMExpressionOverrideType;
|
|
26
|
+
/**
|
|
27
|
+
* Specify how the expression overrides mouth expressions.
|
|
28
|
+
*/
|
|
29
|
+
overrideMouth: VRMExpressionOverrideType;
|
|
30
|
+
private _binds;
|
|
31
|
+
readonly type: string | 'VRMExpression';
|
|
32
|
+
/*
|
|
33
|
+
* A value represents how much it should override blink expressions.
|
|
34
|
+
* `0.0` == no override at all, `1.0` == completely block the expressions.
|
|
35
|
+
*/
|
|
36
|
+
readonly overrideBlinkAmount: number;
|
|
37
|
+
/*
|
|
38
|
+
* A value represents how much it should override lookAt expressions.
|
|
39
|
+
* `0.0` == no override at all, `1.0` == completely block the expressions.
|
|
40
|
+
*/
|
|
41
|
+
readonly overrideLookAtAmount: number;
|
|
42
|
+
/*
|
|
43
|
+
* A value represents how much it should override mouth expressions.
|
|
44
|
+
* `0.0` == no override at all, `1.0` == completely block the expressions.
|
|
45
|
+
*/
|
|
46
|
+
readonly overrideMouthAmount: number;
|
|
47
|
+
constructor(expressionName: string);
|
|
48
|
+
addBind(bind: VRMExpressionBind): void;
|
|
49
|
+
/**
|
|
50
|
+
* Apply weight to every assigned blend shapes.
|
|
51
|
+
* Should be called every frame.
|
|
52
|
+
*/
|
|
53
|
+
applyWeight(options?: {
|
|
54
|
+
/**
|
|
55
|
+
* Multiplies a value to its weight to apply.
|
|
56
|
+
* Intended to be used for overriding an expression weight by another expression.
|
|
57
|
+
* See also: {@link overrideBlink}, {@link overrideLookAt}, {@link overrideMouth}
|
|
58
|
+
*/
|
|
59
|
+
multiplier?: number;
|
|
60
|
+
}): void;
|
|
61
|
+
/**
|
|
62
|
+
* Clear previously assigned blend shapes.
|
|
63
|
+
*/
|
|
64
|
+
clearAppliedWeight(): void;
|
|
65
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface VRMExpressionBind {
|
|
2
|
+
/**
|
|
3
|
+
* Apply a weight to this bind.
|
|
4
|
+
* Applied weights will be accumulated until {@link clearAppliedWeight} is called.
|
|
5
|
+
*/
|
|
6
|
+
applyWeight(weight: number): void;
|
|
7
|
+
/**
|
|
8
|
+
* Clear previously applied weights.
|
|
9
|
+
*/
|
|
10
|
+
clearAppliedWeight(): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as V0VRM from '@pixiv/types-vrm-0.0';
|
|
2
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
|
+
import { VRMExpressionPresetName } from './VRMExpressionPresetName';
|
|
4
|
+
/**
|
|
5
|
+
* A plugin of GLTFLoader that imports a {@link VRMExpressionManager} from a VRM extension of a GLTF.
|
|
6
|
+
*/
|
|
7
|
+
export declare class VRMExpressionLoaderPlugin implements GLTFLoaderPlugin {
|
|
8
|
+
static readonly v0v1PresetNameMap: {
|
|
9
|
+
[v0Name in V0VRM.BlendShapePresetName]?: VRMExpressionPresetName;
|
|
10
|
+
};
|
|
11
|
+
readonly parser: GLTFParser;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
constructor(parser: GLTFParser);
|
|
14
|
+
afterRoot(gltf: GLTF): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Import a {@link VRMExpressionManager} from a VRM.
|
|
17
|
+
*
|
|
18
|
+
* @param gltf A parsed result of GLTF taken from GLTFLoader
|
|
19
|
+
*/
|
|
20
|
+
private _import;
|
|
21
|
+
private _v1Import;
|
|
22
|
+
private _v0Import;
|
|
23
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { VRMExpressionPresetName } from './VRMExpressionPresetName';
|
|
2
|
+
import { VRMExpression } from './VRMExpression';
|
|
3
|
+
export declare class VRMExpressionManager {
|
|
4
|
+
/**
|
|
5
|
+
* A set of name or preset name of expressions that will be overridden by {@link VRMExpression.overrideBlink}.
|
|
6
|
+
*/
|
|
7
|
+
blinkExpressionNames: string[];
|
|
8
|
+
/**
|
|
9
|
+
* A set of name or preset name of expressions that will be overridden by {@link VRMExpression.overrideLookAt}.
|
|
10
|
+
*/
|
|
11
|
+
lookAtExpressionNames: string[];
|
|
12
|
+
/**
|
|
13
|
+
* A set of name or preset name of expressions that will be overridden by {@link VRMExpression.overrideMouth}.
|
|
14
|
+
*/
|
|
15
|
+
mouthExpressionNames: string[];
|
|
16
|
+
/**
|
|
17
|
+
* A set of {@link VRMExpression}.
|
|
18
|
+
* When you want to register expressions, use {@link registerExpression}
|
|
19
|
+
*/
|
|
20
|
+
private _expressions;
|
|
21
|
+
readonly expressions: VRMExpression[];
|
|
22
|
+
/**
|
|
23
|
+
* A map from name to expression.
|
|
24
|
+
*/
|
|
25
|
+
private _expressionMap;
|
|
26
|
+
readonly expressionMap: {
|
|
27
|
+
[name: string]: VRMExpression;
|
|
28
|
+
};
|
|
29
|
+
/*
|
|
30
|
+
* A map from name to expression, but excluding custom expressions.
|
|
31
|
+
*/
|
|
32
|
+
readonly presetExpressionMap: {
|
|
33
|
+
[name in VRMExpressionPresetName]?: VRMExpression;
|
|
34
|
+
};
|
|
35
|
+
/*
|
|
36
|
+
* A map from name to expression, but excluding preset expressions.
|
|
37
|
+
*/
|
|
38
|
+
readonly customExpressionMap: {
|
|
39
|
+
[name: string]: VRMExpression;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Create a new {@link VRMExpressionManager}.
|
|
43
|
+
*/
|
|
44
|
+
constructor();
|
|
45
|
+
/**
|
|
46
|
+
* Copy the given {@link VRMExpressionManager} into this one.
|
|
47
|
+
* @param source The {@link VRMExpressionManager} you want to copy
|
|
48
|
+
* @returns this
|
|
49
|
+
*/
|
|
50
|
+
copy(source: VRMExpressionManager): this;
|
|
51
|
+
/**
|
|
52
|
+
* Returns a clone of this {@link VRMExpressionManager}.
|
|
53
|
+
* @returns Copied {@link VRMExpressionManager}
|
|
54
|
+
*/
|
|
55
|
+
clone(): VRMExpressionManager;
|
|
56
|
+
/**
|
|
57
|
+
* Return a registered expression.
|
|
58
|
+
* If it cannot find an expression, it will return `null` instead.
|
|
59
|
+
*
|
|
60
|
+
* @param name Name or preset name of the expression
|
|
61
|
+
*/
|
|
62
|
+
getExpression(name: VRMExpressionPresetName | string): VRMExpression | null;
|
|
63
|
+
/**
|
|
64
|
+
* Register an expression.
|
|
65
|
+
*
|
|
66
|
+
* @param expression {@link VRMExpression} that describes the expression
|
|
67
|
+
*/
|
|
68
|
+
registerExpression(expression: VRMExpression): void;
|
|
69
|
+
/**
|
|
70
|
+
* Unregister an expression.
|
|
71
|
+
*
|
|
72
|
+
* @param expression The expression you want to unregister
|
|
73
|
+
*/
|
|
74
|
+
unregisterExpression(expression: VRMExpression): void;
|
|
75
|
+
/**
|
|
76
|
+
* Get the current weight of the specified expression.
|
|
77
|
+
* If it doesn't have an expression of given name, it will return `null` instead.
|
|
78
|
+
*
|
|
79
|
+
* @param name Name of the expression
|
|
80
|
+
*/
|
|
81
|
+
getValue(name: VRMExpressionPresetName | string): number | null;
|
|
82
|
+
/**
|
|
83
|
+
* Set a weight to the specified expression.
|
|
84
|
+
*
|
|
85
|
+
* @param name Name of the expression
|
|
86
|
+
* @param weight Weight
|
|
87
|
+
*/
|
|
88
|
+
setValue(name: VRMExpressionPresetName | string, weight: number): void;
|
|
89
|
+
/**
|
|
90
|
+
* Get a track name of specified expression.
|
|
91
|
+
* This track name is needed to manipulate its expression via keyframe animations.
|
|
92
|
+
*
|
|
93
|
+
* @example Manipulate an expression using keyframe animation
|
|
94
|
+
* ```js
|
|
95
|
+
* const trackName = vrm.expressionManager.getExpressionTrackName( 'blink' );
|
|
96
|
+
* const track = new THREE.NumberKeyframeTrack(
|
|
97
|
+
* name,
|
|
98
|
+
* [ 0.0, 0.5, 1.0 ], // times
|
|
99
|
+
* [ 0.0, 1.0, 0.0 ] // values
|
|
100
|
+
* );
|
|
101
|
+
*
|
|
102
|
+
* const clip = new THREE.AnimationClip(
|
|
103
|
+
* 'blink', // name
|
|
104
|
+
* 1.0, // duration
|
|
105
|
+
* [ track ] // tracks
|
|
106
|
+
* );
|
|
107
|
+
*
|
|
108
|
+
* const mixer = new THREE.AnimationMixer( vrm.scene );
|
|
109
|
+
* const action = mixer.clipAction( clip );
|
|
110
|
+
* action.play();
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* @param name Name of the expression
|
|
114
|
+
*/
|
|
115
|
+
getExpressionTrackName(name: VRMExpressionPresetName | string): string | null;
|
|
116
|
+
/**
|
|
117
|
+
* Update every expressions.
|
|
118
|
+
*/
|
|
119
|
+
update(): void;
|
|
120
|
+
/**
|
|
121
|
+
* Calculate sum of override amounts to see how much we should multiply weights of certain expressions.
|
|
122
|
+
*/
|
|
123
|
+
private _calculateWeightMultipliers;
|
|
124
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMExpressionBind } from './VRMExpressionBind';
|
|
3
|
+
import { VRMExpressionMaterialColorType } from './VRMExpressionMaterialColorType';
|
|
4
|
+
/**
|
|
5
|
+
* A bind of expression influences to a material color.
|
|
6
|
+
*/
|
|
7
|
+
export declare class VRMExpressionMaterialColorBind implements VRMExpressionBind {
|
|
8
|
+
/**
|
|
9
|
+
* Mapping of property names from VRMC/materialColorBinds.type to three.js/Material.
|
|
10
|
+
* The first element stands for color channels, the second element stands for the alpha channel.
|
|
11
|
+
* The second element can be null if the target property doesn't exist.
|
|
12
|
+
*/
|
|
13
|
+
private static _propertyNameMapMap;
|
|
14
|
+
/**
|
|
15
|
+
* The target material.
|
|
16
|
+
*/
|
|
17
|
+
readonly material: THREE.Material;
|
|
18
|
+
/**
|
|
19
|
+
* The type of the target property of the material.
|
|
20
|
+
*/
|
|
21
|
+
readonly type: VRMExpressionMaterialColorType;
|
|
22
|
+
/**
|
|
23
|
+
* The target color.
|
|
24
|
+
*/
|
|
25
|
+
readonly targetValue: THREE.Color;
|
|
26
|
+
/**
|
|
27
|
+
* The target alpha.
|
|
28
|
+
*/
|
|
29
|
+
readonly targetAlpha: number;
|
|
30
|
+
/**
|
|
31
|
+
* Its binding state.
|
|
32
|
+
* If it cannot find the target property in the constructor, each property will be null instead.
|
|
33
|
+
*/
|
|
34
|
+
private _state;
|
|
35
|
+
constructor({ material, type, targetValue, targetAlpha, }: {
|
|
36
|
+
/**
|
|
37
|
+
* The target material.
|
|
38
|
+
*/
|
|
39
|
+
material: THREE.Material;
|
|
40
|
+
/**
|
|
41
|
+
* The type of the target property of the material.
|
|
42
|
+
*/
|
|
43
|
+
type: VRMExpressionMaterialColorType;
|
|
44
|
+
/**
|
|
45
|
+
* The target color.
|
|
46
|
+
*/
|
|
47
|
+
targetValue: THREE.Color;
|
|
48
|
+
/**
|
|
49
|
+
* The target alpha.
|
|
50
|
+
*/
|
|
51
|
+
targetAlpha?: number;
|
|
52
|
+
});
|
|
53
|
+
applyWeight(weight: number): void;
|
|
54
|
+
clearAppliedWeight(): void;
|
|
55
|
+
private _initColorBindState;
|
|
56
|
+
private _initAlphaBindState;
|
|
57
|
+
private _getPropertyNameMap;
|
|
58
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const VRMExpressionMaterialColorType: {
|
|
2
|
+
readonly Color: "color";
|
|
3
|
+
readonly EmissionColor: "emissionColor";
|
|
4
|
+
readonly ShadeColor: "shadeColor";
|
|
5
|
+
readonly MatcapColor: "matcapColor";
|
|
6
|
+
readonly RimColor: "rimColor";
|
|
7
|
+
readonly OutlineColor: "outlineColor";
|
|
8
|
+
};
|
|
9
|
+
export type VRMExpressionMaterialColorType = typeof VRMExpressionMaterialColorType[keyof typeof VRMExpressionMaterialColorType];
|
|
10
|
+
export declare const v0ExpressionMaterialColorMap: {
|
|
11
|
+
[key: string]: VRMExpressionMaterialColorType | undefined;
|
|
12
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMExpressionBind } from './VRMExpressionBind';
|
|
3
|
+
/**
|
|
4
|
+
* A bind of {@link VRMExpression} influences to morph targets.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VRMExpressionMorphTargetBind implements VRMExpressionBind {
|
|
7
|
+
/**
|
|
8
|
+
* The mesh primitives that attached to target mesh.
|
|
9
|
+
*/
|
|
10
|
+
readonly primitives: THREE.Mesh[];
|
|
11
|
+
/**
|
|
12
|
+
* The index of the morph target in the mesh.
|
|
13
|
+
*/
|
|
14
|
+
readonly index: number;
|
|
15
|
+
/**
|
|
16
|
+
* The weight value of target morph target. Ranging in [0.0 - 1.0].
|
|
17
|
+
*/
|
|
18
|
+
readonly weight: number;
|
|
19
|
+
constructor({ primitives, index, weight, }: {
|
|
20
|
+
/**
|
|
21
|
+
* The mesh primitives that attached to target mesh.
|
|
22
|
+
*/
|
|
23
|
+
primitives: THREE.Mesh[];
|
|
24
|
+
/**
|
|
25
|
+
* The index of the morph target in the mesh.
|
|
26
|
+
*/
|
|
27
|
+
index: number;
|
|
28
|
+
/**
|
|
29
|
+
* The weight value of target morph target. Ranging in [0.0 - 1.0].
|
|
30
|
+
*/
|
|
31
|
+
weight: number;
|
|
32
|
+
});
|
|
33
|
+
applyWeight(weight: number): void;
|
|
34
|
+
clearAppliedWeight(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const VRMExpressionPresetName: {
|
|
2
|
+
readonly Aa: "aa";
|
|
3
|
+
readonly Ih: "ih";
|
|
4
|
+
readonly Ou: "ou";
|
|
5
|
+
readonly Ee: "ee";
|
|
6
|
+
readonly Oh: "oh";
|
|
7
|
+
readonly Blink: "blink";
|
|
8
|
+
readonly Happy: "happy";
|
|
9
|
+
readonly Angry: "angry";
|
|
10
|
+
readonly Sad: "sad";
|
|
11
|
+
readonly Relaxed: "relaxed";
|
|
12
|
+
readonly LookUp: "lookUp";
|
|
13
|
+
readonly Surprised: "surprised";
|
|
14
|
+
readonly LookDown: "lookDown";
|
|
15
|
+
readonly LookLeft: "lookLeft";
|
|
16
|
+
readonly LookRight: "lookRight";
|
|
17
|
+
readonly BlinkLeft: "blinkLeft";
|
|
18
|
+
readonly BlinkRight: "blinkRight";
|
|
19
|
+
readonly Neutral: "neutral";
|
|
20
|
+
};
|
|
21
|
+
export type VRMExpressionPresetName = typeof VRMExpressionPresetName[keyof typeof VRMExpressionPresetName];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMExpressionBind } from './VRMExpressionBind';
|
|
3
|
+
/**
|
|
4
|
+
* A bind of expression influences to texture transforms.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VRMExpressionTextureTransformBind implements VRMExpressionBind {
|
|
7
|
+
private static _propertyNamesMap;
|
|
8
|
+
/**
|
|
9
|
+
* The target material.
|
|
10
|
+
*/
|
|
11
|
+
readonly material: THREE.Material;
|
|
12
|
+
/**
|
|
13
|
+
* The uv scale of the texture.
|
|
14
|
+
*/
|
|
15
|
+
readonly scale: THREE.Vector2;
|
|
16
|
+
/**
|
|
17
|
+
* The uv offset of the texture.
|
|
18
|
+
*/
|
|
19
|
+
readonly offset: THREE.Vector2;
|
|
20
|
+
/**
|
|
21
|
+
* The list of texture names and its state that should be transformed by this bind.
|
|
22
|
+
*/
|
|
23
|
+
private _properties;
|
|
24
|
+
constructor({ material, scale, offset, }: {
|
|
25
|
+
/**
|
|
26
|
+
* The target material.
|
|
27
|
+
*/
|
|
28
|
+
material: THREE.Material;
|
|
29
|
+
/**
|
|
30
|
+
* The uv scale of the texture.
|
|
31
|
+
*/
|
|
32
|
+
scale: THREE.Vector2;
|
|
33
|
+
/**
|
|
34
|
+
* The uv offset of the texture.
|
|
35
|
+
*/
|
|
36
|
+
offset: THREE.Vector2;
|
|
37
|
+
});
|
|
38
|
+
applyWeight(weight: number): void;
|
|
39
|
+
clearAppliedWeight(): void;
|
|
40
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { VRMExpression } from './VRMExpression';
|
|
2
|
+
export { VRMExpressionBind } from './VRMExpressionBind';
|
|
3
|
+
export { VRMExpressionLoaderPlugin } from './VRMExpressionLoaderPlugin';
|
|
4
|
+
export { VRMExpressionManager } from './VRMExpressionManager';
|
|
5
|
+
export { VRMExpressionMaterialColorBind } from './VRMExpressionMaterialColorBind';
|
|
6
|
+
export { VRMExpressionMaterialColorType } from './VRMExpressionMaterialColorType';
|
|
7
|
+
export { VRMExpressionMorphTargetBind } from './VRMExpressionMorphTargetBind';
|
|
8
|
+
export { VRMExpressionOverrideType } from './VRMExpressionOverrideType';
|
|
9
|
+
export { VRMExpressionPresetName } from './VRMExpressionPresetName';
|
|
10
|
+
export { VRMExpressionTextureTransformBind } from './VRMExpressionTextureTransformBind';
|