@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,11 +1,19 @@
1
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';
@@ -38,9 +38,38 @@ export declare class VRMLookAt {
38
38
  * You usually don't want to touch this.
39
39
  */
40
40
  faceFront: THREE.Vector3;
41
- protected _euler: THREE.Euler;
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;
42
56
  /*
43
- * Its current euler direction.
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.
44
73
  */
45
74
  readonly euler: THREE.Euler;
46
75
  /**
@@ -50,6 +79,13 @@ export declare class VRMLookAt {
50
79
  * @param applier A {@link VRMLookAtApplier}
51
80
  */
52
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;
53
89
  /**
54
90
  * Copy the given {@link VRMLookAt} into this one.
55
91
  * {@link humanoid} must be same as the source one.
@@ -75,11 +111,18 @@ export declare class VRMLookAt {
75
111
  */
76
112
  getLookAtWorldPosition(target: THREE.Vector3): THREE.Vector3;
77
113
  /**
78
- * Get its LookAt orientation in world coordinate.
114
+ * Get its head rotation in world coordinate.
115
+ * Does NOT consider {@link faceFront}.
79
116
  *
80
- * @param target A target `THREE.Vector3`
117
+ * @param target A target `THREE.Quaternion`
81
118
  */
82
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;
83
126
  /**
84
127
  * Get its LookAt direction in world coordinate.
85
128
  *
@@ -90,7 +133,7 @@ export declare class VRMLookAt {
90
133
  * Set its LookAt position.
91
134
  * Note that its result will be instantly overwritten if {@link VRMLookAtHead.autoUpdate} is enabled.
92
135
  *
93
- * @param position A target position
136
+ * @param position A target position, in world space
94
137
  */
95
138
  lookAt(position: THREE.Vector3): void;
96
139
  /**
@@ -100,5 +143,4 @@ export declare class VRMLookAt {
100
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}.
101
144
  */
102
145
  update(delta: number): void;
103
- protected _calcEuler(target: THREE.Euler, position: THREE.Vector3): THREE.Euler;
104
146
  }
@@ -1,12 +1,18 @@
1
+ import * as THREE from 'three';
1
2
  /**
2
- * This class is used by {@link VRMLookAtHead}, applies look at direction.
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 euler `THREE.Euler` object that represents the look at direction
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 angle An input angle
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
- lookAt(angle: THREE.Euler): void;
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 angle An input angle
48
+ * @param yaw Rotation around Y axis, in degree
49
+ * @param pitch Rotation around X axis, in degree
49
50
  */
50
- lookAt(angle: THREE.Euler): void;
51
+ applyYawPitch(yaw: number, pitch: number): void;
52
+ /**
53
+ * @deprecated Use {@link applyYawPitch} instead.
54
+ */
55
+ lookAt(euler: THREE.Euler): void;
51
56
  }
@@ -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,11 @@
1
+ /**
2
+ * Make sure the angle is within -PI to PI.
3
+ *
4
+ * @example
5
+ * ```js
6
+ * sanitizeAngle(1.5 * Math.PI) // -0.5 * PI
7
+ * ```
8
+ *
9
+ * @param angle An input angle
10
+ */
11
+ export declare function sanitizeAngle(angle: number): number;
@@ -17,7 +17,7 @@ export declare class VRMMetaLoaderPlugin implements GLTFLoaderPlugin {
17
17
  */
18
18
  acceptLicenseUrls: string[];
19
19
  /**
20
- * Whether it should accept VRM0.X meta or not.
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.X meta or not.
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
+ }
@@ -0,0 +1 @@
1
+ export declare function renameMaterialProperty(name: string): string;
@@ -1,58 +1,58 @@
1
- import * as THREE from 'three';
2
- import { VRMExpressionManager } from './expressions/VRMExpressionManager';
3
- import { VRMFirstPerson } from './firstPerson/VRMFirstPerson';
4
- import { VRMHumanoid } from './humanoid/VRMHumanoid';
5
- import { VRMLookAt } from './lookAt/VRMLookAt';
6
- import { VRMMeta } from './meta/VRMMeta';
7
- import { VRMCoreParameters } from './VRMCoreParameters';
8
- /**
9
- * A class that represents a single VRM model.
10
- * This class only includes core spec of the VRM (`VRMC_vrm`).
11
- */
12
- export declare class VRMCore {
13
- /**
14
- * `THREE.Group` that contains the entire VRM.
15
- */
16
- readonly scene: THREE.Group;
17
- /**
18
- * Contains {@link VRMHumanoid} of the VRM.
19
- * You can control each bones using {@link VRMHumanoid.getBoneNode}.
20
- *
21
- * @TODO Add a link to VRM spec
22
- */
23
- readonly humanoid?: VRMHumanoid;
24
- /**
25
- * Contains {@link VRMExpressionManager} of the VRM.
26
- * You might want to control these facial expressions via {@link VRMExpressionManager.setValue}.
27
- */
28
- readonly expressionManager?: VRMExpressionManager;
29
- /**
30
- * Contains {@link VRMFirstPerson} of the VRM.
31
- * VRMFirstPerson is mostly used for mesh culling for first person view.
32
- */
33
- readonly firstPerson?: VRMFirstPerson;
34
- /**
35
- * Contains {@link VRMLookAt} of the VRM.
36
- * You might want to use {@link VRMLookAt.target} to control the eye direction of your VRMs.
37
- */
38
- 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
- /**
45
- * Create a new VRM instance.
46
- *
47
- * @param params [[VRMParameters]] that represents components of the VRM
48
- */
49
- constructor(params: VRMCoreParameters);
50
- /**
51
- * **You need to call this on your update loop.**
52
- *
53
- * This function updates every VRM components.
54
- *
55
- * @param delta deltaTime
56
- */
57
- update(delta: number): void;
58
- }
1
+ import * as THREE from 'three';
2
+ import { VRMExpressionManager } from './expressions/VRMExpressionManager';
3
+ import { VRMFirstPerson } from './firstPerson/VRMFirstPerson';
4
+ import { VRMHumanoid } from './humanoid/VRMHumanoid';
5
+ import { VRMLookAt } from './lookAt/VRMLookAt';
6
+ import { VRMMeta } from './meta/VRMMeta';
7
+ import { VRMCoreParameters } from './VRMCoreParameters';
8
+ /**
9
+ * A class that represents a single VRM model.
10
+ * This class only includes core spec of the VRM (`VRMC_vrm`).
11
+ */
12
+ export declare class VRMCore {
13
+ /**
14
+ * `THREE.Group` that contains the entire VRM.
15
+ */
16
+ readonly scene: THREE.Group;
17
+ /**
18
+ * Contains meta fields of the VRM.
19
+ * You might want to refer these license fields before use your VRMs.
20
+ */
21
+ readonly meta: VRMMeta;
22
+ /**
23
+ * Contains {@link VRMHumanoid} of the VRM.
24
+ * You can control each bones using {@link VRMHumanoid.getNormalizedBoneNode} or {@link VRMHumanoid.getRawBoneNode}.
25
+ *
26
+ * @TODO Add a link to VRM spec
27
+ */
28
+ readonly humanoid: VRMHumanoid;
29
+ /**
30
+ * Contains {@link VRMExpressionManager} of the VRM.
31
+ * You might want to control these facial expressions via {@link VRMExpressionManager.setValue}.
32
+ */
33
+ readonly expressionManager?: VRMExpressionManager;
34
+ /**
35
+ * Contains {@link VRMFirstPerson} of the VRM.
36
+ * VRMFirstPerson is mostly used for mesh culling for first person view.
37
+ */
38
+ readonly firstPerson?: VRMFirstPerson;
39
+ /**
40
+ * Contains {@link VRMLookAt} of the VRM.
41
+ * You might want to use {@link VRMLookAt.target} to control the eye direction of your VRMs.
42
+ */
43
+ readonly lookAt?: VRMLookAt;
44
+ /**
45
+ * Create a new VRM instance.
46
+ *
47
+ * @param params [[VRMParameters]] that represents components of the VRM
48
+ */
49
+ constructor(params: VRMCoreParameters);
50
+ /**
51
+ * **You need to call this on your update loop.**
52
+ *
53
+ * This function updates every VRM components.
54
+ *
55
+ * @param delta deltaTime
56
+ */
57
+ update(delta: number): void;
58
+ }
@@ -1,18 +1,18 @@
1
- import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
2
- import { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
3
- import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
4
- import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
5
- import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
6
- import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
7
- import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
8
- export declare class VRMCoreLoaderPlugin implements GLTFLoaderPlugin {
9
- get name(): string;
10
- readonly parser: GLTFParser;
11
- readonly expressionPlugin: VRMExpressionLoaderPlugin;
12
- readonly firstPersonPlugin: VRMFirstPersonLoaderPlugin;
13
- readonly humanoidPlugin: VRMHumanoidLoaderPlugin;
14
- readonly lookAtPlugin: VRMLookAtLoaderPlugin;
15
- readonly metaPlugin: VRMMetaLoaderPlugin;
16
- constructor(parser: GLTFParser, options?: VRMCoreLoaderPluginOptions);
17
- afterRoot(gltf: GLTF): Promise<void>;
18
- }
1
+ import { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
2
+ import { VRMCoreLoaderPluginOptions } from './VRMCoreLoaderPluginOptions';
3
+ import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
4
+ import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
5
+ import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
6
+ import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
7
+ import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
8
+ export declare class VRMCoreLoaderPlugin implements GLTFLoaderPlugin {
9
+ get name(): string;
10
+ readonly parser: GLTFParser;
11
+ readonly expressionPlugin: VRMExpressionLoaderPlugin;
12
+ readonly firstPersonPlugin: VRMFirstPersonLoaderPlugin;
13
+ readonly humanoidPlugin: VRMHumanoidLoaderPlugin;
14
+ readonly lookAtPlugin: VRMLookAtLoaderPlugin;
15
+ readonly metaPlugin: VRMMetaLoaderPlugin;
16
+ constructor(parser: GLTFParser, options?: VRMCoreLoaderPluginOptions);
17
+ afterRoot(gltf: GLTF): Promise<void>;
18
+ }
@@ -1,18 +1,19 @@
1
- import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
2
- import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
3
- import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
4
- import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
5
- import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
6
- export interface VRMCoreLoaderPluginOptions {
7
- expressionPlugin?: VRMExpressionLoaderPlugin;
8
- firstPersonPlugin?: VRMFirstPersonLoaderPlugin;
9
- humanoidPlugin?: VRMHumanoidLoaderPlugin;
10
- lookAtPlugin?: VRMLookAtLoaderPlugin;
11
- metaPlugin?: VRMMetaLoaderPlugin;
12
- /**
13
- * If assigned, the object will be used as a helper root of every component.
14
- * Useful for debug.
15
- * Will be overwritten if you use custom loader plugins for each components.
16
- */
17
- helperRoot?: THREE.Object3D;
18
- }
1
+ import { VRMExpressionLoaderPlugin } from './expressions/VRMExpressionLoaderPlugin';
2
+ import { VRMFirstPersonLoaderPlugin } from './firstPerson/VRMFirstPersonLoaderPlugin';
3
+ import { VRMHumanoidLoaderPlugin } from './humanoid/VRMHumanoidLoaderPlugin';
4
+ import { VRMLookAtLoaderPlugin } from './lookAt/VRMLookAtLoaderPlugin';
5
+ import { VRMMetaLoaderPlugin } from './meta/VRMMetaLoaderPlugin';
6
+ export interface VRMCoreLoaderPluginOptions {
7
+ expressionPlugin?: VRMExpressionLoaderPlugin;
8
+ firstPersonPlugin?: VRMFirstPersonLoaderPlugin;
9
+ humanoidPlugin?: VRMHumanoidLoaderPlugin;
10
+ lookAtPlugin?: VRMLookAtLoaderPlugin;
11
+ metaPlugin?: VRMMetaLoaderPlugin;
12
+ /**
13
+ * If assigned, the object will be used as a helper root of every component.
14
+ * Useful for debug.
15
+ * Will be overwritten if you use custom loader plugins for each components.
16
+ */
17
+ helperRoot?: THREE.Object3D;
18
+ autoUpdateHumanBones?: boolean;
19
+ }