@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
|
@@ -8,20 +8,58 @@ import { 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.
|
|
13
19
|
*/
|
|
14
|
-
|
|
20
|
+
private _rawHumanBones;
|
|
15
21
|
/**
|
|
16
|
-
* A
|
|
17
|
-
* Note that it's not compatible with {@link setPose} and {@link getPose}, since it contains non-relative values of each local transforms.
|
|
22
|
+
* A normalized rig of the VRM.
|
|
18
23
|
*/
|
|
19
|
-
|
|
24
|
+
private _normalizedHumanBones;
|
|
25
|
+
/*
|
|
26
|
+
* @deprecated Deprecated. Use either {@link rawRestPose} or {@link normalizedRestPose} instead.
|
|
27
|
+
*/
|
|
28
|
+
readonly 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
|
+
readonly 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
|
+
readonly normalizedRestPose: VRMPose;
|
|
39
|
+
/*
|
|
40
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
41
|
+
*/
|
|
42
|
+
readonly humanBones: VRMHumanBones;
|
|
43
|
+
/*
|
|
44
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
45
|
+
*/
|
|
46
|
+
readonly rawHumanBones: VRMHumanBones;
|
|
47
|
+
/*
|
|
48
|
+
* A map from {@link VRMHumanBoneName} to normalized {@link VRMHumanBone}s.
|
|
49
|
+
*/
|
|
50
|
+
readonly normalizedHumanBones: VRMHumanBones;
|
|
51
|
+
/*
|
|
52
|
+
* The root of normalized {@link VRMHumanBone}s.
|
|
53
|
+
*/
|
|
54
|
+
readonly 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;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated Deprecated. Use either {@link setRawPose} or {@link setNormalizedPose} instead.
|
|
108
|
+
*/
|
|
109
|
+
setPose(poseObject: VRMPose): void;
|
|
48
110
|
/**
|
|
49
|
-
* Let the
|
|
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 { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
1
|
+
import { 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
|
readonly 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 { VRMHumanBone } from './VRMHumanBone';
|
|
3
|
+
import { VRMHumanBones } from './VRMHumanBones';
|
|
4
|
+
import { VRMHumanBoneName } from './VRMHumanBoneName';
|
|
5
|
+
import { 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 { VRMHumanBones } from './VRMHumanBones';
|
|
4
7
|
export { VRMHumanoid } from './VRMHumanoid';
|
|
5
8
|
export { VRMHumanoidLoaderPlugin } from './VRMHumanoidLoaderPlugin';
|
|
9
|
+
export { VRMHumanoidLoaderPluginOptions } from './VRMHumanoidLoaderPluginOptions';
|
|
6
10
|
export { VRMPose } from './VRMPose';
|
|
7
11
|
export { 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,45 @@ 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
|
-
|
|
41
|
+
/**
|
|
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
|
+
|
|
49
|
+
* Its current angle around Y axis, in degree.
|
|
50
|
+
*/
|
|
51
|
+
yaw: number;
|
|
52
|
+
/**
|
|
53
|
+
* Its current angle around X axis, in degree.
|
|
54
|
+
*/
|
|
55
|
+
protected _pitch: number;
|
|
41
56
|
/*
|
|
42
|
-
* Its current
|
|
57
|
+
* Its current angle around X axis, in degree.
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
* Its current angle around X axis, in degree.
|
|
61
|
+
*/
|
|
62
|
+
pitch: number;
|
|
63
|
+
/**
|
|
64
|
+
* Specifies that angles need to be applied to its [@link applier].
|
|
65
|
+
*/
|
|
66
|
+
protected _needsUpdate: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* World rotation of the head in its rest pose.
|
|
69
|
+
*/
|
|
70
|
+
private _restHeadWorldQuaternion;
|
|
71
|
+
/*
|
|
72
|
+
* @deprecated Use {@link getEuler} instead.
|
|
43
73
|
*/
|
|
44
74
|
readonly euler: THREE.Euler;
|
|
45
75
|
/**
|
|
@@ -49,6 +79,13 @@ export declare class VRMLookAt {
|
|
|
49
79
|
* @param applier A {@link VRMLookAtApplier}
|
|
50
80
|
*/
|
|
51
81
|
constructor(humanoid: VRMHumanoid, applier: VRMLookAtApplier);
|
|
82
|
+
/**
|
|
83
|
+
* Get its yaw-pitch angles as an `Euler`.
|
|
84
|
+
* Does NOT consider {@link faceFront}.
|
|
85
|
+
*
|
|
86
|
+
* @param target The target euler
|
|
87
|
+
*/
|
|
88
|
+
getEuler(target: THREE.Euler): THREE.Euler;
|
|
52
89
|
/**
|
|
53
90
|
* Copy the given {@link VRMLookAt} into this one.
|
|
54
91
|
* {@link humanoid} must be same as the source one.
|
|
@@ -74,11 +111,18 @@ export declare class VRMLookAt {
|
|
|
74
111
|
*/
|
|
75
112
|
getLookAtWorldPosition(target: THREE.Vector3): THREE.Vector3;
|
|
76
113
|
/**
|
|
77
|
-
* Get its
|
|
114
|
+
* Get its head rotation in world coordinate.
|
|
115
|
+
* Does NOT consider {@link faceFront}.
|
|
78
116
|
*
|
|
79
|
-
* @param target A target `THREE.
|
|
117
|
+
* @param target A target `THREE.Quaternion`
|
|
80
118
|
*/
|
|
81
119
|
getLookAtWorldQuaternion(target: THREE.Quaternion): THREE.Quaternion;
|
|
120
|
+
/**
|
|
121
|
+
* Get a quaternion that rotates the +Z unit vector of the humanoid Head to the {@link faceFront} direction.
|
|
122
|
+
*
|
|
123
|
+
* @param target A target `THREE.Quaternion`
|
|
124
|
+
*/
|
|
125
|
+
getFaceFrontQuaternion(target: THREE.Quaternion): THREE.Quaternion;
|
|
82
126
|
/**
|
|
83
127
|
* Get its LookAt direction in world coordinate.
|
|
84
128
|
*
|
|
@@ -89,7 +133,7 @@ export declare class VRMLookAt {
|
|
|
89
133
|
* Set its LookAt position.
|
|
90
134
|
* Note that its result will be instantly overwritten if {@link VRMLookAtHead.autoUpdate} is enabled.
|
|
91
135
|
*
|
|
92
|
-
* @param position A target position
|
|
136
|
+
* @param position A target position, in world space
|
|
93
137
|
*/
|
|
94
138
|
lookAt(position: THREE.Vector3): void;
|
|
95
139
|
/**
|
|
@@ -99,5 +143,4 @@ export declare class VRMLookAt {
|
|
|
99
143
|
* @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
144
|
*/
|
|
101
145
|
update(delta: number): void;
|
|
102
|
-
protected _calcEuler(target: THREE.Euler, position: THREE.Vector3): THREE.Euler;
|
|
103
146
|
}
|
|
@@ -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
|
}
|
|
@@ -31,6 +31,28 @@ export declare class VRMLookAtBoneApplier implements VRMLookAtApplier {
|
|
|
31
31
|
* A {@link VRMLookAtRangeMap} for vertical upward movement. Both eyes move downwards.
|
|
32
32
|
*/
|
|
33
33
|
rangeMapVerticalUp: VRMLookAtRangeMap;
|
|
34
|
+
/**
|
|
35
|
+
* The front direction of the face.
|
|
36
|
+
* Intended to be used for VRM 0.0 compat (VRM 0.0 models are facing Z- instead of Z+).
|
|
37
|
+
* You usually don't want to touch this.
|
|
38
|
+
*/
|
|
39
|
+
faceFront: THREE.Vector3;
|
|
40
|
+
/**
|
|
41
|
+
* The rest quaternion of LeftEye bone.
|
|
42
|
+
*/
|
|
43
|
+
private _restQuatLeftEye;
|
|
44
|
+
/**
|
|
45
|
+
* The rest quaternion of RightEye bone.
|
|
46
|
+
*/
|
|
47
|
+
private _restQuatRightEye;
|
|
48
|
+
/**
|
|
49
|
+
* The world-space rest quaternion of the parent of the humanoid LeftEye.
|
|
50
|
+
*/
|
|
51
|
+
private _restLeftEyeParentWorldQuat;
|
|
52
|
+
/**
|
|
53
|
+
* The world-space rest quaternion of the parent of the humanoid RightEye.
|
|
54
|
+
*/
|
|
55
|
+
private _restRightEyeParentWorldQuat;
|
|
34
56
|
/**
|
|
35
57
|
* Create a new {@link VRMLookAtBoneApplier}.
|
|
36
58
|
*
|
|
@@ -44,7 +66,18 @@ export declare class VRMLookAtBoneApplier implements VRMLookAtApplier {
|
|
|
44
66
|
/**
|
|
45
67
|
* Apply the input angle to its associated VRM model.
|
|
46
68
|
*
|
|
47
|
-
* @param
|
|
69
|
+
* @param yaw Rotation around Y axis, in degree
|
|
70
|
+
* @param pitch Rotation around X axis, in degree
|
|
71
|
+
*/
|
|
72
|
+
applyYawPitch(yaw: number, pitch: number): void;
|
|
73
|
+
/**
|
|
74
|
+
* @deprecated Use {@link applyYawPitch} instead.
|
|
75
|
+
*/
|
|
76
|
+
lookAt(euler: THREE.Euler): void;
|
|
77
|
+
/**
|
|
78
|
+
* Get a quaternion that rotates the world-space +Z unit vector to the {@link faceFront} direction.
|
|
79
|
+
*
|
|
80
|
+
* @param target A target `THREE.Quaternion`
|
|
48
81
|
*/
|
|
49
|
-
|
|
82
|
+
private _getWorldFaceFrontQuat;
|
|
50
83
|
}
|
|
@@ -45,7 +45,12 @@ export declare class VRMLookAtExpressionApplier implements VRMLookAtApplier {
|
|
|
45
45
|
/**
|
|
46
46
|
* Apply the input angle to its associated VRM model.
|
|
47
47
|
*
|
|
48
|
-
* @param
|
|
48
|
+
* @param yaw Rotation around Y axis, in degree
|
|
49
|
+
* @param pitch Rotation around X axis, in degree
|
|
49
50
|
*/
|
|
50
|
-
|
|
51
|
+
applyYawPitch(yaw: number, pitch: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use {@link applyYawPitch} instead.
|
|
54
|
+
*/
|
|
55
|
+
lookAt(euler: THREE.Euler): void;
|
|
51
56
|
}
|
|
@@ -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 { VRMLookAtLoaderPluginOptions } from './VRMLookAtLoaderPluginOptions';
|
|
3
3
|
/**
|
|
4
4
|
* A plugin of GLTFLoader that imports a {@link VRMLookAt} from a VRM extension of a GLTF.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Calculate azimuth / altitude angles from a vector.
|
|
4
|
+
*
|
|
5
|
+
* This returns a difference of angles from (1, 0, 0).
|
|
6
|
+
* Azimuth represents an angle around Y axis.
|
|
7
|
+
* Altitude represents an angle around Z axis.
|
|
8
|
+
* It is rotated in intrinsic Y-Z order.
|
|
9
|
+
*
|
|
10
|
+
* @param vector The vector
|
|
11
|
+
* @returns A tuple contains two angles, `[ azimuth, altitude ]`
|
|
12
|
+
*/
|
|
13
|
+
export declare function calcAzimuthAltitude(vector: THREE.Vector3): [
|
|
14
|
+
/*azimuth*/ number,
|
|
15
|
+
/*altitude*/ number
|
|
16
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 { VRMMetaLoaderPluginOptions } from './VRMMetaLoaderPluginOptions';
|
|
3
3
|
/**
|
|
4
4
|
* A plugin of GLTFLoader that imports a {@link VRM1Meta} from a VRM extension of a GLTF.
|
|
@@ -17,7 +17,7 @@ export declare class VRMMetaLoaderPlugin implements GLTFLoaderPlugin {
|
|
|
17
17
|
*/
|
|
18
18
|
acceptLicenseUrls: string[];
|
|
19
19
|
/**
|
|
20
|
-
* Whether it should accept VRM0.
|
|
20
|
+
* Whether it should accept VRM0.0 meta or not.
|
|
21
21
|
* Note that it might load {@link VRM0Meta} instead of {@link VRM1Meta} when this is `true`.
|
|
22
22
|
* `true` by default.
|
|
23
23
|
*/
|
|
@@ -14,7 +14,7 @@ export interface VRMMetaLoaderPluginOptions {
|
|
|
14
14
|
*/
|
|
15
15
|
acceptLicenseUrls?: string[];
|
|
16
16
|
/**
|
|
17
|
-
* Whether it should accept VRM0.
|
|
17
|
+
* Whether it should accept VRM0.0 meta or not.
|
|
18
18
|
* Note that it might load {@link VRM0Meta} instead of {@link VRM1Meta} when this is `true`.
|
|
19
19
|
* `true` by default.
|
|
20
20
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
export declare function toBeCloseToQuaternion(received: THREE.Quaternion, expected: THREE.Quaternion, precision?: number): jest.CustomMatcherResult;
|
|
4
|
+
declare global {
|
|
5
|
+
namespace jest {
|
|
6
|
+
interface Matchers<R> {
|
|
7
|
+
toBeCloseToQuaternion(expected: THREE.Quaternion, precision?: number): R;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="jest" />
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
export declare function toBeCloseToVector3(received: THREE.Vector3, expected: THREE.Vector3, precision?: number): jest.CustomMatcherResult;
|
|
4
|
+
declare global {
|
|
5
|
+
namespace jest {
|
|
6
|
+
interface Matchers<R> {
|
|
7
|
+
toBeCloseToVector3(expected: THREE.Vector3, precision?: number): R;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
1
|
+
import { GLTF } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
2
|
/**
|
|
3
3
|
* Extract primitives ( `THREE.Mesh[]` ) of a node from a loaded GLTF.
|
|
4
4
|
* The main purpose of this function is to distinguish primitives and children from a node that has both meshes and children.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
|
-
import { GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader';
|
|
2
|
+
import { GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
3
3
|
/**
|
|
4
4
|
* Get a material definition index of glTF from associated material.
|
|
5
5
|
* It's basically a comat code between Three.js r133 or above and previous versions.
|