@pixiv/three-vrm-core 1.0.0-beta.8 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/three-vrm-core.js +976 -159
- package/lib/three-vrm-core.min.js +2 -2
- package/lib/three-vrm-core.module.js +974 -160
- package/lib/three-vrm-core.module.min.js +2 -2
- package/package.json +12 -12
- package/ts3.4/types/VRMCore.d.ts +7 -7
- package/ts3.4/types/VRMCoreLoaderPlugin.d.ts +1 -1
- package/ts3.4/types/VRMCoreLoaderPluginOptions.d.ts +1 -0
- package/ts3.4/types/VRMCoreParameters.d.ts +2 -2
- package/ts3.4/types/expressions/VRMExpression.d.ts +1 -1
- package/ts3.4/types/expressions/VRMExpressionLoaderPlugin.d.ts +1 -1
- package/ts3.4/types/expressions/VRMExpressionMaterialColorBind.d.ts +3 -0
- package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +4 -0
- package/ts3.4/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +1 -1
- package/ts3.4/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/ts3.4/types/humanoid/VRMHumanBoneName.d.ts +7 -2
- package/ts3.4/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/ts3.4/types/humanoid/VRMHumanoid.d.ts +130 -21
- package/ts3.4/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +10 -2
- 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/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 +4 -0
- package/ts3.4/types/lookAt/VRMLookAt.d.ts +50 -7
- package/ts3.4/types/lookAt/VRMLookAtApplier.d.ts +8 -2
- package/ts3.4/types/lookAt/VRMLookAtBoneApplier.d.ts +35 -2
- package/ts3.4/types/lookAt/VRMLookAtExpressionApplier.d.ts +7 -2
- package/ts3.4/types/lookAt/VRMLookAtLoaderPlugin.d.ts +1 -1
- 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/VRMMetaLoaderPlugin.d.ts +2 -2
- package/ts3.4/types/meta/VRMMetaLoaderPluginOptions.d.ts +1 -1
- 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/gltfExtractPrimitivesFromNode.d.ts +1 -1
- package/ts3.4/types/utils/gltfGetAssociatedMaterialIndex.d.ts +1 -1
- package/ts3.4/types/utils/renameMaterialProperty.d.ts +1 -0
- package/types/VRMCore.d.ts +7 -7
- package/types/VRMCoreLoaderPlugin.d.ts +1 -1
- package/types/VRMCoreLoaderPluginOptions.d.ts +1 -0
- package/types/VRMCoreParameters.d.ts +2 -2
- package/types/expressions/VRMExpression.d.ts +1 -1
- package/types/expressions/VRMExpressionLoaderPlugin.d.ts +1 -1
- package/types/expressions/VRMExpressionMaterialColorBind.d.ts +3 -0
- package/types/expressions/VRMExpressionMaterialColorType.d.ts +4 -0
- package/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +1 -1
- package/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/types/humanoid/VRMHumanBoneName.d.ts +7 -2
- package/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/types/humanoid/VRMHumanoid.d.ts +130 -21
- package/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +10 -2
- package/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
- package/types/humanoid/VRMHumanoidRig.d.ts +31 -0
- package/types/humanoid/VRMRig.d.ts +62 -0
- package/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
- package/types/humanoid/helpers/index.d.ts +1 -0
- package/types/humanoid/index.d.ts +4 -0
- package/types/lookAt/VRMLookAt.d.ts +52 -7
- package/types/lookAt/VRMLookAtApplier.d.ts +8 -2
- package/types/lookAt/VRMLookAtBoneApplier.d.ts +35 -2
- package/types/lookAt/VRMLookAtExpressionApplier.d.ts +7 -2
- package/types/lookAt/VRMLookAtLoaderPlugin.d.ts +1 -1
- package/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
- package/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
- package/types/lookAt/utils/calcAzimuthAltitude.d.ts +13 -0
- package/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
- package/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
- package/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
- package/types/meta/VRMMetaLoaderPlugin.d.ts +2 -2
- package/types/meta/VRMMetaLoaderPluginOptions.d.ts +1 -1
- package/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
- package/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
- package/types/utils/gltfExtractPrimitivesFromNode.d.ts +1 -1
- package/types/utils/gltfGetAssociatedMaterialIndex.d.ts +1 -1
- package/types/utils/renameMaterialProperty.d.ts +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function renameMaterialProperty(name: string): string;
|
package/types/VRMCore.d.ts
CHANGED
|
@@ -14,13 +14,18 @@ export declare class VRMCore {
|
|
|
14
14
|
* `THREE.Group` that contains the entire VRM.
|
|
15
15
|
*/
|
|
16
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;
|
|
17
22
|
/**
|
|
18
23
|
* Contains {@link VRMHumanoid} of the VRM.
|
|
19
|
-
* You can control each bones using {@link VRMHumanoid.
|
|
24
|
+
* You can control each bones using {@link VRMHumanoid.getNormalizedBoneNode} or {@link VRMHumanoid.getRawBoneNode}.
|
|
20
25
|
*
|
|
21
26
|
* @TODO Add a link to VRM spec
|
|
22
27
|
*/
|
|
23
|
-
readonly humanoid
|
|
28
|
+
readonly humanoid: VRMHumanoid;
|
|
24
29
|
/**
|
|
25
30
|
* Contains {@link VRMExpressionManager} of the VRM.
|
|
26
31
|
* You might want to control these facial expressions via {@link VRMExpressionManager.setValue}.
|
|
@@ -36,11 +41,6 @@ export declare class VRMCore {
|
|
|
36
41
|
* You might want to use {@link VRMLookAt.target} to control the eye direction of your VRMs.
|
|
37
42
|
*/
|
|
38
43
|
readonly lookAt?: VRMLookAt;
|
|
39
|
-
/**
|
|
40
|
-
* Contains meta fields of the VRM.
|
|
41
|
-
* You might want to refer these license fields before use your VRMs.
|
|
42
|
-
*/
|
|
43
|
-
readonly meta?: VRMMeta;
|
|
44
44
|
/**
|
|
45
45
|
* Create a new VRM instance.
|
|
46
46
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
1
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
2
|
import { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
|
|
3
3
|
import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
|
|
4
4
|
import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
|
|
@@ -8,9 +8,9 @@ import type { VRMMeta } from './meta/VRMMeta';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface VRMCoreParameters {
|
|
10
10
|
scene: THREE.Group;
|
|
11
|
-
|
|
11
|
+
meta: VRMMeta;
|
|
12
|
+
humanoid: VRMHumanoid;
|
|
12
13
|
expressionManager?: VRMExpressionManager;
|
|
13
14
|
firstPerson?: VRMFirstPerson;
|
|
14
15
|
lookAt?: VRMLookAt;
|
|
15
|
-
meta?: VRMMeta;
|
|
16
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as V0VRM from '@pixiv/types-vrm-0.0';
|
|
2
|
-
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
2
|
+
import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
3
|
import { VRMExpressionPresetName } from './VRMExpressionPresetName';
|
|
4
4
|
/**
|
|
5
5
|
* A plugin of GLTFLoader that imports a {@link VRMExpressionManager} from a VRM extension of a GLTF.
|
|
@@ -5,6 +5,9 @@ import type { VRMExpressionMaterialColorType } from './VRMExpressionMaterialColo
|
|
|
5
5
|
* A bind of expression influences to a material color.
|
|
6
6
|
*/
|
|
7
7
|
export declare class VRMExpressionMaterialColorBind implements VRMExpressionBind {
|
|
8
|
+
/**
|
|
9
|
+
* Mapping of property names from VRMC/materialColorBinds.type to three.js/Material.
|
|
10
|
+
*/
|
|
8
11
|
private static _propertyNameMapMap;
|
|
9
12
|
/**
|
|
10
13
|
* The target material.
|
|
@@ -2,7 +2,11 @@ export declare const VRMExpressionMaterialColorType: {
|
|
|
2
2
|
readonly Color: "color";
|
|
3
3
|
readonly EmissionColor: "emissionColor";
|
|
4
4
|
readonly ShadeColor: "shadeColor";
|
|
5
|
+
readonly MatcapColor: "matcapColor";
|
|
5
6
|
readonly RimColor: "rimColor";
|
|
6
7
|
readonly OutlineColor: "outlineColor";
|
|
7
8
|
};
|
|
8
9
|
export declare type VRMExpressionMaterialColorType = typeof VRMExpressionMaterialColorType[keyof typeof VRMExpressionMaterialColorType];
|
|
10
|
+
export declare const v0ExpressionMaterialColorMap: {
|
|
11
|
+
[key: string]: VRMExpressionMaterialColorType | undefined;
|
|
12
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
1
|
+
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
2
|
/**
|
|
3
3
|
* A plugin of GLTFLoader that imports a {@link VRMFirstPerson} from a VRM extension of a GLTF.
|
|
4
4
|
*/
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names of {@link VRMHumanoid} bone names.
|
|
3
|
+
*
|
|
4
|
+
* Ref: https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0/humanoid.md
|
|
5
|
+
*/
|
|
1
6
|
export declare const VRMHumanBoneName: {
|
|
2
7
|
readonly Hips: "hips";
|
|
3
8
|
readonly Spine: "spine";
|
|
@@ -24,8 +29,8 @@ export declare const VRMHumanBoneName: {
|
|
|
24
29
|
readonly RightUpperArm: "rightUpperArm";
|
|
25
30
|
readonly RightLowerArm: "rightLowerArm";
|
|
26
31
|
readonly RightHand: "rightHand";
|
|
32
|
+
readonly LeftThumbMetacarpal: "leftThumbMetacarpal";
|
|
27
33
|
readonly LeftThumbProximal: "leftThumbProximal";
|
|
28
|
-
readonly LeftThumbIntermediate: "leftThumbIntermediate";
|
|
29
34
|
readonly LeftThumbDistal: "leftThumbDistal";
|
|
30
35
|
readonly LeftIndexProximal: "leftIndexProximal";
|
|
31
36
|
readonly LeftIndexIntermediate: "leftIndexIntermediate";
|
|
@@ -39,8 +44,8 @@ export declare const VRMHumanBoneName: {
|
|
|
39
44
|
readonly LeftLittleProximal: "leftLittleProximal";
|
|
40
45
|
readonly LeftLittleIntermediate: "leftLittleIntermediate";
|
|
41
46
|
readonly LeftLittleDistal: "leftLittleDistal";
|
|
47
|
+
readonly RightThumbMetacarpal: "rightThumbMetacarpal";
|
|
42
48
|
readonly RightThumbProximal: "rightThumbProximal";
|
|
43
|
-
readonly RightThumbIntermediate: "rightThumbIntermediate";
|
|
44
49
|
readonly RightThumbDistal: "rightThumbDistal";
|
|
45
50
|
readonly RightIndexProximal: "rightIndexProximal";
|
|
46
51
|
readonly RightIndexIntermediate: "rightIndexIntermediate";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VRMHumanBoneName } from './VRMHumanBoneName';
|
|
2
|
+
/**
|
|
3
|
+
* An object that maps from {@link VRMHumanBoneName} to its parent {@link VRMHumanBoneName}.
|
|
4
|
+
*
|
|
5
|
+
* Ref: https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0/humanoid.md
|
|
6
|
+
*/
|
|
7
|
+
export declare const VRMHumanBoneParentMap: {
|
|
8
|
+
[bone in VRMHumanBoneName]: VRMHumanBoneName | null;
|
|
9
|
+
};
|
|
@@ -8,20 +8,58 @@ import type { VRMPose } from './VRMPose';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class VRMHumanoid {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Whether it copies pose from normalizedHumanBones to rawHumanBones on {@link update}.
|
|
12
|
+
* `true` by default.
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
autoUpdateHumanBones: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A raw rig of the VRM.
|
|
19
|
+
*/
|
|
20
|
+
private _rawHumanBones;
|
|
21
|
+
/**
|
|
22
|
+
* A normalized rig of the VRM.
|
|
23
|
+
*/
|
|
24
|
+
private _normalizedHumanBones;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated Deprecated. Use either {@link rawRestPose} or {@link normalizedRestPose} instead.
|
|
27
|
+
*/
|
|
28
|
+
get restPose(): VRMPose;
|
|
29
|
+
/**
|
|
30
|
+
* A {@link VRMPose} of its raw human bones that is its default state.
|
|
31
|
+
* Note that it's not compatible with {@link setRawPose} and {@link getRawPose}, since it contains non-relative values of each local transforms.
|
|
32
|
+
*/
|
|
33
|
+
get rawRestPose(): VRMPose;
|
|
34
|
+
/**
|
|
35
|
+
* A {@link VRMPose} of its normalized human bones that is its default state.
|
|
36
|
+
* Note that it's not compatible with {@link setNormalizedPose} and {@link getNormalizedPose}, since it contains non-relative values of each local transforms.
|
|
37
|
+
*/
|
|
38
|
+
get normalizedRestPose(): VRMPose;
|
|
39
|
+
/**
|
|
40
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
41
|
+
*/
|
|
42
|
+
get humanBones(): VRMHumanBones;
|
|
43
|
+
/**
|
|
44
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
45
|
+
*/
|
|
46
|
+
get rawHumanBones(): VRMHumanBones;
|
|
47
|
+
/**
|
|
48
|
+
* A map from {@link VRMHumanBoneName} to normalized {@link VRMHumanBone}s.
|
|
13
49
|
*/
|
|
14
|
-
|
|
50
|
+
get normalizedHumanBones(): VRMHumanBones;
|
|
15
51
|
/**
|
|
16
|
-
*
|
|
17
|
-
* Note that it's not compatible with {@link setPose} and {@link getPose}, since it contains non-relative values of each local transforms.
|
|
52
|
+
* The root of normalized {@link VRMHumanBone}s.
|
|
18
53
|
*/
|
|
19
|
-
|
|
54
|
+
get normalizedHumanBonesRoot(): THREE.Object3D;
|
|
20
55
|
/**
|
|
21
56
|
* Create a new {@link VRMHumanoid}.
|
|
22
|
-
* @param
|
|
57
|
+
* @param humanBones A {@link VRMHumanBones} contains all the bones of the new humanoid
|
|
58
|
+
* @param autoUpdateHumanBones Whether it copies pose from normalizedHumanBones to rawHumanBones on {@link update}. `true` by default.
|
|
23
59
|
*/
|
|
24
|
-
constructor(humanBones: VRMHumanBones
|
|
60
|
+
constructor(humanBones: VRMHumanBones, options?: {
|
|
61
|
+
autoUpdateHumanBones?: boolean;
|
|
62
|
+
});
|
|
25
63
|
/**
|
|
26
64
|
* Copy the given {@link VRMHumanoid} into this one.
|
|
27
65
|
* @param source The {@link VRMHumanoid} you want to copy
|
|
@@ -34,40 +72,111 @@ export declare class VRMHumanoid {
|
|
|
34
72
|
*/
|
|
35
73
|
clone(): VRMHumanoid;
|
|
36
74
|
/**
|
|
37
|
-
*
|
|
38
|
-
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
39
|
-
* You might want to use {@link getPose} instead.
|
|
75
|
+
* @deprecated Deprecated. Use either {@link getRawAbsolutePose} or {@link getNormalizedAbsolutePose} instead.
|
|
40
76
|
*/
|
|
41
77
|
getAbsolutePose(): VRMPose;
|
|
42
78
|
/**
|
|
43
|
-
* Return the current pose of this
|
|
79
|
+
* Return the current absolute pose of this raw human bones as a {@link VRMPose}.
|
|
80
|
+
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
81
|
+
* You might want to use {@link getRawPose} instead.
|
|
82
|
+
*/
|
|
83
|
+
getRawAbsolutePose(): VRMPose;
|
|
84
|
+
/**
|
|
85
|
+
* Return the current absolute pose of this normalized human bones as a {@link VRMPose}.
|
|
86
|
+
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
87
|
+
* You might want to use {@link getNormalizedPose} instead.
|
|
88
|
+
*/
|
|
89
|
+
getNormalizedAbsolutePose(): VRMPose;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Deprecated. Use either {@link getRawPose} or {@link getNormalizedPose} instead.
|
|
92
|
+
*/
|
|
93
|
+
getPose(): VRMPose;
|
|
94
|
+
/**
|
|
95
|
+
* Return the current pose of raw human bones as a {@link VRMPose}.
|
|
44
96
|
*
|
|
45
97
|
* Each transform is a local transform relative from rest pose (T-pose).
|
|
46
98
|
*/
|
|
47
|
-
|
|
99
|
+
getRawPose(): VRMPose;
|
|
100
|
+
/**
|
|
101
|
+
* Return the current pose of normalized human bones as a {@link VRMPose}.
|
|
102
|
+
*
|
|
103
|
+
* Each transform is a local transform relative from rest pose (T-pose).
|
|
104
|
+
*/
|
|
105
|
+
getNormalizedPose(): VRMPose;
|
|
48
106
|
/**
|
|
49
|
-
*
|
|
107
|
+
* @deprecated Deprecated. Use either {@link setRawPose} or {@link setNormalizedPose} instead.
|
|
108
|
+
*/
|
|
109
|
+
setPose(poseObject: VRMPose): void;
|
|
110
|
+
/**
|
|
111
|
+
* Let the raw human bones do a specified pose.
|
|
50
112
|
*
|
|
51
113
|
* Each transform have to be a local transform relative from rest pose (T-pose).
|
|
52
|
-
* You can pass what you got from {@link
|
|
114
|
+
* You can pass what you got from {@link getRawPose}.
|
|
115
|
+
*
|
|
116
|
+
* If you are using {@link autoUpdateHumanBones}, you might want to use {@link setNormalizedPose} instead.
|
|
53
117
|
*
|
|
54
|
-
* @param poseObject A
|
|
118
|
+
* @param poseObject A {@link VRMPose} that represents a single pose
|
|
55
119
|
*/
|
|
56
|
-
|
|
120
|
+
setRawPose(poseObject: VRMPose): void;
|
|
121
|
+
/**
|
|
122
|
+
* Let the normalized human bones do a specified pose.
|
|
123
|
+
*
|
|
124
|
+
* Each transform have to be a local transform relative from rest pose (T-pose).
|
|
125
|
+
* You can pass what you got from {@link getNormalizedPose}.
|
|
126
|
+
*
|
|
127
|
+
* @param poseObject A {@link VRMPose} that represents a single pose
|
|
128
|
+
*/
|
|
129
|
+
setNormalizedPose(poseObject: VRMPose): void;
|
|
57
130
|
/**
|
|
58
|
-
*
|
|
131
|
+
* @deprecated Deprecated. Use either {@link resetRawPose} or {@link resetNormalizedPose} instead.
|
|
59
132
|
*/
|
|
60
133
|
resetPose(): void;
|
|
61
134
|
/**
|
|
62
|
-
*
|
|
135
|
+
* Reset the raw humanoid to its rest pose.
|
|
63
136
|
*
|
|
64
|
-
*
|
|
137
|
+
* If you are using {@link autoUpdateHumanBones}, you might want to use {@link resetNormalizedPose} instead.
|
|
138
|
+
*/
|
|
139
|
+
resetRawPose(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Reset the normalized humanoid to its rest pose.
|
|
142
|
+
*/
|
|
143
|
+
resetNormalizedPose(): void;
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated Deprecated. Use either {@link getRawBone} or {@link getNormalizedBone} instead.
|
|
65
146
|
*/
|
|
66
147
|
getBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
67
148
|
/**
|
|
68
|
-
* Return a
|
|
149
|
+
* Return a raw {@link VRMHumanBone} bound to a specified {@link VRMHumanBoneName}.
|
|
150
|
+
*
|
|
151
|
+
* @param name Name of the bone you want
|
|
152
|
+
*/
|
|
153
|
+
getRawBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Return a normalized {@link VRMHumanBone} bound to a specified {@link VRMHumanBoneName}.
|
|
69
156
|
*
|
|
70
157
|
* @param name Name of the bone you want
|
|
71
158
|
*/
|
|
159
|
+
getNormalizedBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Deprecated. Use either {@link getRawBoneNode} or {@link getNormalizedBoneNode} instead.
|
|
162
|
+
*/
|
|
72
163
|
getBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
164
|
+
/**
|
|
165
|
+
* Return a raw bone as a `THREE.Object3D` bound to a specified {@link VRMHumanBoneName}.
|
|
166
|
+
*
|
|
167
|
+
* @param name Name of the bone you want
|
|
168
|
+
*/
|
|
169
|
+
getRawBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
170
|
+
/**
|
|
171
|
+
* Return a normalized bone as a `THREE.Object3D` bound to a specified {@link VRMHumanBoneName}.
|
|
172
|
+
*
|
|
173
|
+
* @param name Name of the bone you want
|
|
174
|
+
*/
|
|
175
|
+
getNormalizedBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
176
|
+
/**
|
|
177
|
+
* Update the humanoid component.
|
|
178
|
+
*
|
|
179
|
+
* If {@link autoUpdateHumanBones} is `true`, it transfers the pose of normalized human bones to raw human bones.
|
|
180
|
+
*/
|
|
181
|
+
update(): void;
|
|
73
182
|
}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
1
|
+
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
+
import { VRMHumanoidLoaderPluginOptions } from './VRMHumanoidLoaderPluginOptions';
|
|
2
3
|
/**
|
|
3
4
|
* A plugin of GLTFLoader that imports a {@link VRMHumanoid} from a VRM extension of a GLTF.
|
|
4
5
|
*/
|
|
5
6
|
export declare class VRMHumanoidLoaderPlugin implements GLTFLoaderPlugin {
|
|
7
|
+
/**
|
|
8
|
+
* Specify an Object3D to add {@link VRMHumanoidHelper}.
|
|
9
|
+
* If not specified, helper will not be created.
|
|
10
|
+
* If `renderOrder` is set to the root, the helper will copy the same `renderOrder` .
|
|
11
|
+
*/
|
|
12
|
+
helperRoot?: THREE.Object3D;
|
|
13
|
+
autoUpdateHumanBones?: boolean;
|
|
6
14
|
readonly parser: GLTFParser;
|
|
7
15
|
get name(): string;
|
|
8
|
-
constructor(parser: GLTFParser);
|
|
16
|
+
constructor(parser: GLTFParser, options?: VRMHumanoidLoaderPluginOptions);
|
|
9
17
|
afterRoot(gltf: GLTF): Promise<void>;
|
|
10
18
|
/**
|
|
11
19
|
* Import a {@link VRMHumanoid} from a VRM.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface VRMHumanoidLoaderPluginOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Specify an Object3D to add {@link VRMHumanoidHelper}.
|
|
4
|
+
* If not specified, helper will not be created.
|
|
5
|
+
* If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
|
|
6
|
+
*/
|
|
7
|
+
helperRoot?: THREE.Object3D;
|
|
8
|
+
/**
|
|
9
|
+
* Whether it copies pose from normalizedHumanBones to rawHumanBones on {@link update}.
|
|
10
|
+
* `true` by default.
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
*/
|
|
14
|
+
autoUpdateHumanBones?: boolean;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMHumanBoneName, VRMHumanBones } from '.';
|
|
3
|
+
import { VRMRig } from './VRMRig';
|
|
4
|
+
/**
|
|
5
|
+
* A class represents the normalized Rig of a VRM.
|
|
6
|
+
*/
|
|
7
|
+
export declare class VRMHumanoidRig extends VRMRig {
|
|
8
|
+
protected static _setupTransforms(modelRig: VRMRig): {
|
|
9
|
+
rigBones: VRMHumanBones;
|
|
10
|
+
root: THREE.Object3D;
|
|
11
|
+
parentWorldRotations: {
|
|
12
|
+
[boneName in VRMHumanBoneName]?: THREE.Quaternion;
|
|
13
|
+
};
|
|
14
|
+
boneRotations: {
|
|
15
|
+
[boneName in VRMHumanBoneName]?: THREE.Quaternion;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly original: VRMRig;
|
|
19
|
+
readonly root: THREE.Object3D;
|
|
20
|
+
protected readonly _parentWorldRotations: {
|
|
21
|
+
[boneName in VRMHumanBoneName]?: THREE.Quaternion;
|
|
22
|
+
};
|
|
23
|
+
protected readonly _boneRotations: {
|
|
24
|
+
[boneName in VRMHumanBoneName]?: THREE.Quaternion;
|
|
25
|
+
};
|
|
26
|
+
constructor(humanoid: VRMRig);
|
|
27
|
+
/**
|
|
28
|
+
* Update this humanoid rig.
|
|
29
|
+
*/
|
|
30
|
+
update(): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { VRMHumanBone } from './VRMHumanBone';
|
|
3
|
+
import type { VRMHumanBones } from './VRMHumanBones';
|
|
4
|
+
import type { VRMHumanBoneName } from './VRMHumanBoneName';
|
|
5
|
+
import type { VRMPose } from './VRMPose';
|
|
6
|
+
/**
|
|
7
|
+
* A class represents the Rig of a VRM.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VRMRig {
|
|
10
|
+
/**
|
|
11
|
+
* A {@link VRMHumanBones} that contains all the human bones of the VRM.
|
|
12
|
+
* You might want to get these bones using {@link VRMHumanoid.getBone}.
|
|
13
|
+
*/
|
|
14
|
+
humanBones: VRMHumanBones;
|
|
15
|
+
/**
|
|
16
|
+
* A {@link VRMPose} that is its default state.
|
|
17
|
+
* Note that it's not compatible with {@link setPose} and {@link getPose}, since it contains non-relative values of each local transforms.
|
|
18
|
+
*/
|
|
19
|
+
restPose: VRMPose;
|
|
20
|
+
/**
|
|
21
|
+
* Create a new {@link VRMHumanoid}.
|
|
22
|
+
* @param humanBones A {@link VRMHumanBones} contains all the bones of the new humanoid
|
|
23
|
+
*/
|
|
24
|
+
constructor(humanBones: VRMHumanBones);
|
|
25
|
+
/**
|
|
26
|
+
* Return the current absolute pose of this humanoid as a {@link VRMPose}.
|
|
27
|
+
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
28
|
+
* You might want to use {@link getPose} instead.
|
|
29
|
+
*/
|
|
30
|
+
getAbsolutePose(): VRMPose;
|
|
31
|
+
/**
|
|
32
|
+
* Return the current pose of this humanoid as a {@link VRMPose}.
|
|
33
|
+
*
|
|
34
|
+
* Each transform is a local transform relative from rest pose (T-pose).
|
|
35
|
+
*/
|
|
36
|
+
getPose(): VRMPose;
|
|
37
|
+
/**
|
|
38
|
+
* Let the humanoid do a specified pose.
|
|
39
|
+
*
|
|
40
|
+
* Each transform have to be a local transform relative from rest pose (T-pose).
|
|
41
|
+
* You can pass what you got from {@link getPose}.
|
|
42
|
+
*
|
|
43
|
+
* @param poseObject A [[VRMPose]] that represents a single pose
|
|
44
|
+
*/
|
|
45
|
+
setPose(poseObject: VRMPose): void;
|
|
46
|
+
/**
|
|
47
|
+
* Reset the humanoid to its rest pose.
|
|
48
|
+
*/
|
|
49
|
+
resetPose(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Return a bone bound to a specified {@link VRMHumanBoneName}, as a {@link VRMHumanBone}.
|
|
52
|
+
*
|
|
53
|
+
* @param name Name of the bone you want
|
|
54
|
+
*/
|
|
55
|
+
getBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Return a bone bound to a specified {@link VRMHumanBoneName}, as a `THREE.Object3D`.
|
|
58
|
+
*
|
|
59
|
+
* @param name Name of the bone you want
|
|
60
|
+
*/
|
|
61
|
+
getBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
62
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMHumanoid } from '../VRMHumanoid';
|
|
3
|
+
export declare class VRMHumanoidHelper extends THREE.Group {
|
|
4
|
+
readonly vrmHumanoid: VRMHumanoid;
|
|
5
|
+
private _boneAxesMap;
|
|
6
|
+
constructor(humanoid: VRMHumanoid);
|
|
7
|
+
dispose(): void;
|
|
8
|
+
updateMatrixWorld(force: boolean): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { VRMHumanoidHelper } from './VRMHumanoidHelper';
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
export * from './helpers';
|
|
1
2
|
export { VRMHumanBone } from './VRMHumanBone';
|
|
3
|
+
export { VRMHumanBoneList } from './VRMHumanBoneList';
|
|
2
4
|
export { VRMHumanBoneName } from './VRMHumanBoneName';
|
|
5
|
+
export { VRMHumanBoneParentMap } from './VRMHumanBoneParentMap';
|
|
3
6
|
export type { VRMHumanBones } from './VRMHumanBones';
|
|
4
7
|
export { VRMHumanoid } from './VRMHumanoid';
|
|
5
8
|
export { VRMHumanoidLoaderPlugin } from './VRMHumanoidLoaderPlugin';
|
|
9
|
+
export { VRMHumanoidLoaderPluginOptions } from './VRMHumanoidLoaderPluginOptions';
|
|
6
10
|
export type { VRMPose } from './VRMPose';
|
|
7
11
|
export type { VRMPoseTransform } from './VRMPoseTransform';
|
|
8
12
|
export { VRMRequiredHumanBoneName } from './VRMRequiredHumanBoneName';
|
|
@@ -20,6 +20,7 @@ export declare class VRMLookAt {
|
|
|
20
20
|
applier: VRMLookAtApplier;
|
|
21
21
|
/**
|
|
22
22
|
* If this is true, the LookAt will be updated automatically by calling {@link update}, towarding the direction to the {@link target}.
|
|
23
|
+
* `true` by default.
|
|
23
24
|
*
|
|
24
25
|
* See also: {@link target}
|
|
25
26
|
*/
|
|
@@ -30,16 +31,47 @@ export declare class VRMLookAt {
|
|
|
30
31
|
*
|
|
31
32
|
* See also: {@link autoUpdate}
|
|
32
33
|
*/
|
|
33
|
-
target?: THREE.Object3D;
|
|
34
|
+
target?: THREE.Object3D | null;
|
|
34
35
|
/**
|
|
35
36
|
* The front direction of the face.
|
|
36
37
|
* Intended to be used for VRM 0.0 compat (VRM 0.0 models are facing Z- instead of Z+).
|
|
37
38
|
* You usually don't want to touch this.
|
|
38
39
|
*/
|
|
39
40
|
faceFront: THREE.Vector3;
|
|
40
|
-
protected _euler: THREE.Euler;
|
|
41
41
|
/**
|
|
42
|
-
* Its current
|
|
42
|
+
* Its current angle around Y axis, in degree.
|
|
43
|
+
*/
|
|
44
|
+
protected _yaw: number;
|
|
45
|
+
/**
|
|
46
|
+
* Its current angle around Y axis, in degree.
|
|
47
|
+
*/
|
|
48
|
+
get yaw(): number;
|
|
49
|
+
/**
|
|
50
|
+
* Its current angle around Y axis, in degree.
|
|
51
|
+
*/
|
|
52
|
+
set yaw(value: number);
|
|
53
|
+
/**
|
|
54
|
+
* Its current angle around X axis, in degree.
|
|
55
|
+
*/
|
|
56
|
+
protected _pitch: number;
|
|
57
|
+
/**
|
|
58
|
+
* Its current angle around X axis, in degree.
|
|
59
|
+
*/
|
|
60
|
+
get pitch(): number;
|
|
61
|
+
/**
|
|
62
|
+
* Its current angle around X axis, in degree.
|
|
63
|
+
*/
|
|
64
|
+
set pitch(value: number);
|
|
65
|
+
/**
|
|
66
|
+
* Specifies that angles need to be applied to its [@link applier].
|
|
67
|
+
*/
|
|
68
|
+
protected _needsUpdate: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* World rotation of the head in its rest pose.
|
|
71
|
+
*/
|
|
72
|
+
private _restHeadWorldQuaternion;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Use {@link getEuler} instead.
|
|
43
75
|
*/
|
|
44
76
|
get euler(): THREE.Euler;
|
|
45
77
|
/**
|
|
@@ -49,6 +81,13 @@ export declare class VRMLookAt {
|
|
|
49
81
|
* @param applier A {@link VRMLookAtApplier}
|
|
50
82
|
*/
|
|
51
83
|
constructor(humanoid: VRMHumanoid, applier: VRMLookAtApplier);
|
|
84
|
+
/**
|
|
85
|
+
* Get its yaw-pitch angles as an `Euler`.
|
|
86
|
+
* Does NOT consider {@link faceFront}.
|
|
87
|
+
*
|
|
88
|
+
* @param target The target euler
|
|
89
|
+
*/
|
|
90
|
+
getEuler(target: THREE.Euler): THREE.Euler;
|
|
52
91
|
/**
|
|
53
92
|
* Copy the given {@link VRMLookAt} into this one.
|
|
54
93
|
* {@link humanoid} must be same as the source one.
|
|
@@ -74,11 +113,18 @@ export declare class VRMLookAt {
|
|
|
74
113
|
*/
|
|
75
114
|
getLookAtWorldPosition(target: THREE.Vector3): THREE.Vector3;
|
|
76
115
|
/**
|
|
77
|
-
* Get its
|
|
116
|
+
* Get its head rotation in world coordinate.
|
|
117
|
+
* Does NOT consider {@link faceFront}.
|
|
78
118
|
*
|
|
79
|
-
* @param target A target `THREE.
|
|
119
|
+
* @param target A target `THREE.Quaternion`
|
|
80
120
|
*/
|
|
81
121
|
getLookAtWorldQuaternion(target: THREE.Quaternion): THREE.Quaternion;
|
|
122
|
+
/**
|
|
123
|
+
* Get a quaternion that rotates the +Z unit vector of the humanoid Head to the {@link faceFront} direction.
|
|
124
|
+
*
|
|
125
|
+
* @param target A target `THREE.Quaternion`
|
|
126
|
+
*/
|
|
127
|
+
getFaceFrontQuaternion(target: THREE.Quaternion): THREE.Quaternion;
|
|
82
128
|
/**
|
|
83
129
|
* Get its LookAt direction in world coordinate.
|
|
84
130
|
*
|
|
@@ -89,7 +135,7 @@ export declare class VRMLookAt {
|
|
|
89
135
|
* Set its LookAt position.
|
|
90
136
|
* Note that its result will be instantly overwritten if {@link VRMLookAtHead.autoUpdate} is enabled.
|
|
91
137
|
*
|
|
92
|
-
* @param position A target position
|
|
138
|
+
* @param position A target position, in world space
|
|
93
139
|
*/
|
|
94
140
|
lookAt(position: THREE.Vector3): void;
|
|
95
141
|
/**
|
|
@@ -99,5 +145,4 @@ export declare class VRMLookAt {
|
|
|
99
145
|
* @param delta deltaTime, it isn't used though. You can use the parameter if you want to use this in your own extended {@link VRMLookAt}.
|
|
100
146
|
*/
|
|
101
147
|
update(delta: number): void;
|
|
102
|
-
protected _calcEuler(target: THREE.Euler, position: THREE.Vector3): THREE.Euler;
|
|
103
148
|
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
1
2
|
/**
|
|
2
|
-
* This class is used by {@link
|
|
3
|
+
* This class is used by {@link VRMLookAt}, applies look at direction.
|
|
3
4
|
* There are currently two variant of applier: {@link VRMLookAtBoneApplier} and {@link VRMLookAtExpressionApplier}.
|
|
4
5
|
*/
|
|
5
6
|
export interface VRMLookAtApplier {
|
|
6
7
|
/**
|
|
7
8
|
* Apply look at direction to its associated VRM model.
|
|
8
9
|
*
|
|
9
|
-
* @param
|
|
10
|
+
* @param yaw Rotation around Y axis, in degree
|
|
11
|
+
* @param pitch Rotation around X axis, in degree
|
|
12
|
+
*/
|
|
13
|
+
applyYawPitch: (yaw: number, pitch: number) => void;
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use {@link applyYawPitch} instead.
|
|
10
16
|
*/
|
|
11
17
|
lookAt: (euler: THREE.Euler) => void;
|
|
12
18
|
}
|