@pixiv/three-vrm-core 1.0.0-beta.9 → 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.
Files changed (108) hide show
  1. package/lib/three-vrm-core.js +3367 -2551
  2. package/lib/three-vrm-core.min.js +2 -2
  3. package/lib/three-vrm-core.module.js +3365 -2552
  4. package/lib/three-vrm-core.module.min.js +2 -2
  5. package/package.json +12 -12
  6. package/ts3.4/types/VRMCore.d.ts +7 -7
  7. package/ts3.4/types/VRMCoreLoaderPluginOptions.d.ts +1 -0
  8. package/ts3.4/types/VRMCoreParameters.d.ts +2 -2
  9. package/ts3.4/types/expressions/VRMExpression.d.ts +1 -1
  10. package/ts3.4/types/expressions/VRMExpressionMaterialColorBind.d.ts +3 -0
  11. package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +4 -0
  12. package/ts3.4/types/humanoid/VRMHumanBoneList.d.ts +5 -0
  13. package/ts3.4/types/humanoid/VRMHumanBoneName.d.ts +7 -2
  14. package/ts3.4/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
  15. package/ts3.4/types/humanoid/VRMHumanoid.d.ts +130 -21
  16. package/ts3.4/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +9 -1
  17. package/ts3.4/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
  18. package/ts3.4/types/humanoid/VRMHumanoidRig.d.ts +31 -0
  19. package/ts3.4/types/humanoid/VRMRig.d.ts +62 -0
  20. package/ts3.4/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
  21. package/ts3.4/types/humanoid/helpers/index.d.ts +1 -0
  22. package/ts3.4/types/humanoid/index.d.ts +4 -0
  23. package/ts3.4/types/lookAt/VRMLookAt.d.ts +48 -6
  24. package/ts3.4/types/lookAt/VRMLookAtApplier.d.ts +8 -2
  25. package/ts3.4/types/lookAt/VRMLookAtBoneApplier.d.ts +35 -2
  26. package/ts3.4/types/lookAt/VRMLookAtExpressionApplier.d.ts +7 -2
  27. package/ts3.4/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
  28. package/ts3.4/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
  29. package/ts3.4/types/lookAt/utils/calcAzimuthAltitude.d.ts +16 -0
  30. package/ts3.4/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
  31. package/ts3.4/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
  32. package/ts3.4/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
  33. package/ts3.4/types/meta/VRMMetaLoaderPlugin.d.ts +1 -1
  34. package/ts3.4/types/meta/VRMMetaLoaderPluginOptions.d.ts +1 -1
  35. package/ts3.4/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
  36. package/ts3.4/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
  37. package/ts3.4/types/utils/renameMaterialProperty.d.ts +1 -0
  38. package/types/VRMCore.d.ts +58 -58
  39. package/types/VRMCoreLoaderPlugin.d.ts +18 -18
  40. package/types/VRMCoreLoaderPluginOptions.d.ts +19 -18
  41. package/types/VRMCoreParameters.d.ts +16 -16
  42. package/types/expressions/VRMExpression.d.ts +64 -64
  43. package/types/expressions/VRMExpressionBind.d.ts +11 -11
  44. package/types/expressions/VRMExpressionLoaderPlugin.d.ts +23 -23
  45. package/types/expressions/VRMExpressionManager.d.ts +124 -124
  46. package/types/expressions/VRMExpressionMaterialColorBind.d.ts +45 -42
  47. package/types/expressions/VRMExpressionMaterialColorType.d.ts +12 -8
  48. package/types/expressions/VRMExpressionMorphTargetBind.d.ts +35 -35
  49. package/types/expressions/VRMExpressionOverrideType.d.ts +6 -6
  50. package/types/expressions/VRMExpressionPresetName.d.ts +21 -21
  51. package/types/expressions/VRMExpressionTextureTransformBind.d.ts +40 -40
  52. package/types/expressions/index.d.ts +10 -10
  53. package/types/firstPerson/VRMFirstPerson.d.ts +84 -84
  54. package/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +20 -20
  55. package/types/firstPerson/VRMFirstPersonMeshAnnotation.d.ts +5 -5
  56. package/types/firstPerson/VRMFirstPersonMeshAnnotationType.d.ts +7 -7
  57. package/types/firstPerson/index.d.ts +4 -4
  58. package/types/humanoid/VRMHumanBone.d.ts +10 -10
  59. package/types/humanoid/VRMHumanBoneList.d.ts +5 -0
  60. package/types/humanoid/VRMHumanBoneName.d.ts +63 -58
  61. package/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
  62. package/types/humanoid/VRMHumanBones.d.ts +11 -11
  63. package/types/humanoid/VRMHumanoid.d.ts +182 -73
  64. package/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +32 -24
  65. package/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
  66. package/types/humanoid/VRMHumanoidRig.d.ts +31 -0
  67. package/types/humanoid/VRMPose.d.ts +24 -24
  68. package/types/humanoid/VRMPoseTransform.d.ts +15 -15
  69. package/types/humanoid/VRMRequiredHumanBoneName.d.ts +18 -18
  70. package/types/humanoid/VRMRig.d.ts +62 -0
  71. package/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
  72. package/types/humanoid/helpers/index.d.ts +1 -0
  73. package/types/humanoid/index.d.ts +12 -8
  74. package/types/index.d.ts +9 -9
  75. package/types/lookAt/VRMLookAt.d.ts +148 -104
  76. package/types/lookAt/VRMLookAtApplier.d.ts +18 -12
  77. package/types/lookAt/VRMLookAtBoneApplier.d.ts +83 -50
  78. package/types/lookAt/VRMLookAtExpressionApplier.d.ts +56 -51
  79. package/types/lookAt/VRMLookAtLoaderPlugin.d.ts +30 -30
  80. package/types/lookAt/VRMLookAtLoaderPluginOptions.d.ts +8 -8
  81. package/types/lookAt/VRMLookAtRangeMap.d.ts +23 -23
  82. package/types/lookAt/VRMLookAtTypeName.d.ts +8 -8
  83. package/types/lookAt/helpers/VRMLookAtHelper.d.ts +11 -11
  84. package/types/lookAt/helpers/index.d.ts +1 -1
  85. package/types/lookAt/helpers/utils/FanBufferGeometry.d.ts +13 -13
  86. package/types/lookAt/helpers/utils/LineAndSphereBufferGeometry.d.ts +13 -13
  87. package/types/lookAt/index.d.ts +8 -8
  88. package/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
  89. package/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
  90. package/types/lookAt/utils/calcAzimuthAltitude.d.ts +13 -0
  91. package/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
  92. package/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
  93. package/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
  94. package/types/meta/VRM0Meta.d.ts +62 -62
  95. package/types/meta/VRM1Meta.d.ts +86 -86
  96. package/types/meta/VRMMeta.d.ts +6 -6
  97. package/types/meta/VRMMetaLoaderPlugin.d.ts +32 -32
  98. package/types/meta/VRMMetaLoaderPluginOptions.d.ts +22 -22
  99. package/types/meta/index.d.ts +5 -5
  100. package/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
  101. package/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
  102. package/types/utils/getWorldQuaternionLite.d.ts +8 -8
  103. package/types/utils/gltfExtractPrimitivesFromNode.d.ts +21 -21
  104. package/types/utils/gltfGetAssociatedMaterialIndex.d.ts +10 -10
  105. package/types/utils/quatInvertCompat.d.ts +8 -8
  106. package/types/utils/renameMaterialProperty.d.ts +1 -0
  107. package/types/utils/resolveURL.d.ts +4 -4
  108. package/types/utils/saturate.d.ts +6 -6
@@ -1,73 +1,182 @@
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 a humanoid of a VRM.
8
- */
9
- export declare class VRMHumanoid {
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 boneArray A {@link VRMHumanBones} contains all the bones of the new humanoid
23
- */
24
- constructor(humanBones: VRMHumanBones);
25
- /**
26
- * Copy the given {@link VRMHumanoid} into this one.
27
- * @param source The {@link VRMHumanoid} you want to copy
28
- * @returns this
29
- */
30
- copy(source: VRMHumanoid): this;
31
- /**
32
- * Returns a clone of this {@link VRMHumanoid}.
33
- * @returns Copied {@link VRMHumanoid}
34
- */
35
- clone(): VRMHumanoid;
36
- /**
37
- * Return the current absolute pose of this humanoid as a {@link VRMPose}.
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.
40
- */
41
- getAbsolutePose(): VRMPose;
42
- /**
43
- * Return the current pose of this humanoid as a {@link VRMPose}.
44
- *
45
- * Each transform is a local transform relative from rest pose (T-pose).
46
- */
47
- getPose(): VRMPose;
48
- /**
49
- * Let the humanoid do a specified pose.
50
- *
51
- * Each transform have to be a local transform relative from rest pose (T-pose).
52
- * You can pass what you got from {@link getPose}.
53
- *
54
- * @param poseObject A [[VRMPose]] that represents a single pose
55
- */
56
- setPose(poseObject: VRMPose): void;
57
- /**
58
- * Reset the humanoid to its rest pose.
59
- */
60
- resetPose(): void;
61
- /**
62
- * Return a bone bound to a specified {@link VRMHumanBoneName}, as a {@link VRMHumanBone}.
63
- *
64
- * @param name Name of the bone you want
65
- */
66
- getBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
67
- /**
68
- * Return a bone bound to a specified {@link VRMHumanBoneName}, as a `THREE.Object3D`.
69
- *
70
- * @param name Name of the bone you want
71
- */
72
- getBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
73
- }
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 a humanoid of a VRM.
8
+ */
9
+ export declare class VRMHumanoid {
10
+ /**
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.
49
+ */
50
+ get normalizedHumanBones(): VRMHumanBones;
51
+ /**
52
+ * The root of normalized {@link VRMHumanBone}s.
53
+ */
54
+ get normalizedHumanBonesRoot(): THREE.Object3D;
55
+ /**
56
+ * Create a new {@link VRMHumanoid}.
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.
59
+ */
60
+ constructor(humanBones: VRMHumanBones, options?: {
61
+ autoUpdateHumanBones?: boolean;
62
+ });
63
+ /**
64
+ * Copy the given {@link VRMHumanoid} into this one.
65
+ * @param source The {@link VRMHumanoid} you want to copy
66
+ * @returns this
67
+ */
68
+ copy(source: VRMHumanoid): this;
69
+ /**
70
+ * Returns a clone of this {@link VRMHumanoid}.
71
+ * @returns Copied {@link VRMHumanoid}
72
+ */
73
+ clone(): VRMHumanoid;
74
+ /**
75
+ * @deprecated Deprecated. Use either {@link getRawAbsolutePose} or {@link getNormalizedAbsolutePose} instead.
76
+ */
77
+ getAbsolutePose(): VRMPose;
78
+ /**
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}.
96
+ *
97
+ * Each transform is a local transform relative from rest pose (T-pose).
98
+ */
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;
110
+ /**
111
+ * Let the raw human bones do a specified pose.
112
+ *
113
+ * Each transform have to be a local transform relative from rest pose (T-pose).
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.
117
+ *
118
+ * @param poseObject A {@link VRMPose} that represents a single pose
119
+ */
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;
130
+ /**
131
+ * @deprecated Deprecated. Use either {@link resetRawPose} or {@link resetNormalizedPose} instead.
132
+ */
133
+ resetPose(): void;
134
+ /**
135
+ * Reset the raw humanoid to its rest pose.
136
+ *
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.
146
+ */
147
+ getBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
148
+ /**
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}.
156
+ *
157
+ * @param name Name of the bone you want
158
+ */
159
+ getNormalizedBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
160
+ /**
161
+ * @deprecated Deprecated. Use either {@link getRawBoneNode} or {@link getNormalizedBoneNode} instead.
162
+ */
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;
182
+ }
@@ -1,24 +1,32 @@
1
- import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
2
- /**
3
- * A plugin of GLTFLoader that imports a {@link VRMHumanoid} from a VRM extension of a GLTF.
4
- */
5
- export declare class VRMHumanoidLoaderPlugin implements GLTFLoaderPlugin {
6
- readonly parser: GLTFParser;
7
- get name(): string;
8
- constructor(parser: GLTFParser);
9
- afterRoot(gltf: GLTF): Promise<void>;
10
- /**
11
- * Import a {@link VRMHumanoid} from a VRM.
12
- *
13
- * @param gltf A parsed result of GLTF taken from GLTFLoader
14
- */
15
- private _import;
16
- private _v1Import;
17
- private _v0Import;
18
- /**
19
- * Ensure required bones exist in given human bones.
20
- * @param humanBones Human bones
21
- * @returns Human bones, no longer partial!
22
- */
23
- private _ensureRequiredBonesExist;
24
- }
1
+ import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
2
+ import { VRMHumanoidLoaderPluginOptions } from './VRMHumanoidLoaderPluginOptions';
3
+ /**
4
+ * A plugin of GLTFLoader that imports a {@link VRMHumanoid} from a VRM extension of a GLTF.
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;
14
+ readonly parser: GLTFParser;
15
+ get name(): string;
16
+ constructor(parser: GLTFParser, options?: VRMHumanoidLoaderPluginOptions);
17
+ afterRoot(gltf: GLTF): Promise<void>;
18
+ /**
19
+ * Import a {@link VRMHumanoid} from a VRM.
20
+ *
21
+ * @param gltf A parsed result of GLTF taken from GLTFLoader
22
+ */
23
+ private _import;
24
+ private _v1Import;
25
+ private _v0Import;
26
+ /**
27
+ * Ensure required bones exist in given human bones.
28
+ * @param humanBones Human bones
29
+ * @returns Human bones, no longer partial!
30
+ */
31
+ private _ensureRequiredBonesExist;
32
+ }
@@ -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
+ }
@@ -1,24 +1,24 @@
1
- import type { VRMHumanBoneName } from './VRMHumanBoneName';
2
- import type { VRMPoseTransform } from './VRMPoseTransform';
3
- /**
4
- * Represents a pose that VRM can do.
5
- *
6
- * See {@link VRMHumanBone} for complete list of bone names.
7
- * Note that certain VRM models might not have every bones defined in {@link VRMHumanBone}.
8
- *
9
- * @example An example of VRMPose interface
10
- * ```js
11
- * {
12
- * [HumanBone.LeftUpperLeg] : {
13
- * rotation: [ 0.000, 0.000, -0.454, 0.891 ],
14
- * position: [ 0.000, 0.000, 0.000 ] // position is not required though
15
- * },
16
- * [HumanBone.LeftLowerLeg] : {
17
- * rotation: [ -0.454, 0.000, 0.000, 0.891 ]
18
- * },
19
- * }
20
- * ```
21
- */
22
- export declare type VRMPose = {
23
- [boneName in VRMHumanBoneName]?: VRMPoseTransform;
24
- };
1
+ import type { VRMHumanBoneName } from './VRMHumanBoneName';
2
+ import type { VRMPoseTransform } from './VRMPoseTransform';
3
+ /**
4
+ * Represents a pose that VRM can do.
5
+ *
6
+ * See {@link VRMHumanBone} for complete list of bone names.
7
+ * Note that certain VRM models might not have every bones defined in {@link VRMHumanBone}.
8
+ *
9
+ * @example An example of VRMPose interface
10
+ * ```js
11
+ * {
12
+ * [HumanBone.LeftUpperLeg] : {
13
+ * rotation: [ 0.000, 0.000, -0.454, 0.891 ],
14
+ * position: [ 0.000, 0.000, 0.000 ] // position is not required though
15
+ * },
16
+ * [HumanBone.LeftLowerLeg] : {
17
+ * rotation: [ -0.454, 0.000, 0.000, 0.891 ]
18
+ * },
19
+ * }
20
+ * ```
21
+ */
22
+ export declare type VRMPose = {
23
+ [boneName in VRMHumanBoneName]?: VRMPoseTransform;
24
+ };
@@ -1,15 +1,15 @@
1
- /**
2
- * Represents a transform of a single bone of [[VRMPose]].
3
- * Both `position` and `rotation` are optional.
4
- */
5
- export interface VRMPoseTransform {
6
- /**
7
- * Position of the transform.
8
- */
9
- position?: [number, number, number];
10
- /**
11
- * Rotation of the transform.
12
- * Note that it's a quaternion.
13
- */
14
- rotation?: [number, number, number, number];
15
- }
1
+ /**
2
+ * Represents a transform of a single bone of [[VRMPose]].
3
+ * Both `position` and `rotation` are optional.
4
+ */
5
+ export interface VRMPoseTransform {
6
+ /**
7
+ * Position of the transform.
8
+ */
9
+ position?: [number, number, number];
10
+ /**
11
+ * Rotation of the transform.
12
+ * Note that it's a quaternion.
13
+ */
14
+ rotation?: [number, number, number, number];
15
+ }
@@ -1,18 +1,18 @@
1
- export declare const VRMRequiredHumanBoneName: {
2
- readonly Hips: "hips";
3
- readonly Spine: "spine";
4
- readonly Head: "head";
5
- readonly LeftUpperLeg: "leftUpperLeg";
6
- readonly LeftLowerLeg: "leftLowerLeg";
7
- readonly LeftFoot: "leftFoot";
8
- readonly RightUpperLeg: "rightUpperLeg";
9
- readonly RightLowerLeg: "rightLowerLeg";
10
- readonly RightFoot: "rightFoot";
11
- readonly LeftUpperArm: "leftUpperArm";
12
- readonly LeftLowerArm: "leftLowerArm";
13
- readonly LeftHand: "leftHand";
14
- readonly RightUpperArm: "rightUpperArm";
15
- readonly RightLowerArm: "rightLowerArm";
16
- readonly RightHand: "rightHand";
17
- };
18
- export declare type VRMRequiredHumanBoneName = typeof VRMRequiredHumanBoneName[keyof typeof VRMRequiredHumanBoneName];
1
+ export declare const VRMRequiredHumanBoneName: {
2
+ readonly Hips: "hips";
3
+ readonly Spine: "spine";
4
+ readonly Head: "head";
5
+ readonly LeftUpperLeg: "leftUpperLeg";
6
+ readonly LeftLowerLeg: "leftLowerLeg";
7
+ readonly LeftFoot: "leftFoot";
8
+ readonly RightUpperLeg: "rightUpperLeg";
9
+ readonly RightLowerLeg: "rightLowerLeg";
10
+ readonly RightFoot: "rightFoot";
11
+ readonly LeftUpperArm: "leftUpperArm";
12
+ readonly LeftLowerArm: "leftLowerArm";
13
+ readonly LeftHand: "leftHand";
14
+ readonly RightUpperArm: "rightUpperArm";
15
+ readonly RightLowerArm: "rightLowerArm";
16
+ readonly RightHand: "rightHand";
17
+ };
18
+ export declare type VRMRequiredHumanBoneName = typeof VRMRequiredHumanBoneName[keyof typeof VRMRequiredHumanBoneName];
@@ -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 { VRMHumanBone } from './VRMHumanBone';
2
- export { VRMHumanBoneName } from './VRMHumanBoneName';
3
- export type { VRMHumanBones } from './VRMHumanBones';
4
- export { VRMHumanoid } from './VRMHumanoid';
5
- export { VRMHumanoidLoaderPlugin } from './VRMHumanoidLoaderPlugin';
6
- export type { VRMPose } from './VRMPose';
7
- export type { VRMPoseTransform } from './VRMPoseTransform';
8
- export { VRMRequiredHumanBoneName } from './VRMRequiredHumanBoneName';
1
+ export * from './helpers';
2
+ export { VRMHumanBone } from './VRMHumanBone';
3
+ export { VRMHumanBoneList } from './VRMHumanBoneList';
4
+ export { VRMHumanBoneName } from './VRMHumanBoneName';
5
+ export { VRMHumanBoneParentMap } from './VRMHumanBoneParentMap';
6
+ export type { VRMHumanBones } from './VRMHumanBones';
7
+ export { VRMHumanoid } from './VRMHumanoid';
8
+ export { VRMHumanoidLoaderPlugin } from './VRMHumanoidLoaderPlugin';
9
+ export { VRMHumanoidLoaderPluginOptions } from './VRMHumanoidLoaderPluginOptions';
10
+ export type { VRMPose } from './VRMPose';
11
+ export type { VRMPoseTransform } from './VRMPoseTransform';
12
+ export { VRMRequiredHumanBoneName } from './VRMRequiredHumanBoneName';
package/types/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export * from './expressions';
2
- export * from './firstPerson';
3
- export * from './humanoid';
4
- export * from './lookAt';
5
- export * from './meta';
6
- export { VRMCore } from './VRMCore';
7
- export { VRMCoreLoaderPlugin } from './VRMCoreLoaderPlugin';
8
- export type { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
9
- export type { VRMCoreParameters } from './VRMCoreParameters';
1
+ export * from './expressions';
2
+ export * from './firstPerson';
3
+ export * from './humanoid';
4
+ export * from './lookAt';
5
+ export * from './meta';
6
+ export { VRMCore } from './VRMCore';
7
+ export { VRMCoreLoaderPlugin } from './VRMCoreLoaderPlugin';
8
+ export type { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
9
+ export type { VRMCoreParameters } from './VRMCoreParameters';