@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.
- package/lib/three-vrm-core.js +3367 -2551
- package/lib/three-vrm-core.min.js +2 -2
- package/lib/three-vrm-core.module.js +3365 -2552
- 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/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/VRMExpressionMaterialColorBind.d.ts +3 -0
- package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +4 -0
- 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 +9 -1
- 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 +48 -6
- 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/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 +1 -1
- 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/renameMaterialProperty.d.ts +1 -0
- package/types/VRMCore.d.ts +58 -58
- package/types/VRMCoreLoaderPlugin.d.ts +18 -18
- package/types/VRMCoreLoaderPluginOptions.d.ts +19 -18
- package/types/VRMCoreParameters.d.ts +16 -16
- package/types/expressions/VRMExpression.d.ts +64 -64
- package/types/expressions/VRMExpressionBind.d.ts +11 -11
- package/types/expressions/VRMExpressionLoaderPlugin.d.ts +23 -23
- package/types/expressions/VRMExpressionManager.d.ts +124 -124
- package/types/expressions/VRMExpressionMaterialColorBind.d.ts +45 -42
- package/types/expressions/VRMExpressionMaterialColorType.d.ts +12 -8
- package/types/expressions/VRMExpressionMorphTargetBind.d.ts +35 -35
- package/types/expressions/VRMExpressionOverrideType.d.ts +6 -6
- package/types/expressions/VRMExpressionPresetName.d.ts +21 -21
- package/types/expressions/VRMExpressionTextureTransformBind.d.ts +40 -40
- package/types/expressions/index.d.ts +10 -10
- package/types/firstPerson/VRMFirstPerson.d.ts +84 -84
- package/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +20 -20
- package/types/firstPerson/VRMFirstPersonMeshAnnotation.d.ts +5 -5
- package/types/firstPerson/VRMFirstPersonMeshAnnotationType.d.ts +7 -7
- package/types/firstPerson/index.d.ts +4 -4
- package/types/humanoid/VRMHumanBone.d.ts +10 -10
- package/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/types/humanoid/VRMHumanBoneName.d.ts +63 -58
- package/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/types/humanoid/VRMHumanBones.d.ts +11 -11
- package/types/humanoid/VRMHumanoid.d.ts +182 -73
- package/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +32 -24
- package/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
- package/types/humanoid/VRMHumanoidRig.d.ts +31 -0
- package/types/humanoid/VRMPose.d.ts +24 -24
- package/types/humanoid/VRMPoseTransform.d.ts +15 -15
- package/types/humanoid/VRMRequiredHumanBoneName.d.ts +18 -18
- 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 +12 -8
- package/types/index.d.ts +9 -9
- package/types/lookAt/VRMLookAt.d.ts +148 -104
- package/types/lookAt/VRMLookAtApplier.d.ts +18 -12
- package/types/lookAt/VRMLookAtBoneApplier.d.ts +83 -50
- package/types/lookAt/VRMLookAtExpressionApplier.d.ts +56 -51
- package/types/lookAt/VRMLookAtLoaderPlugin.d.ts +30 -30
- package/types/lookAt/VRMLookAtLoaderPluginOptions.d.ts +8 -8
- package/types/lookAt/VRMLookAtRangeMap.d.ts +23 -23
- package/types/lookAt/VRMLookAtTypeName.d.ts +8 -8
- package/types/lookAt/helpers/VRMLookAtHelper.d.ts +11 -11
- package/types/lookAt/helpers/index.d.ts +1 -1
- package/types/lookAt/helpers/utils/FanBufferGeometry.d.ts +13 -13
- package/types/lookAt/helpers/utils/LineAndSphereBufferGeometry.d.ts +13 -13
- package/types/lookAt/index.d.ts +8 -8
- 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/VRM0Meta.d.ts +62 -62
- package/types/meta/VRM1Meta.d.ts +86 -86
- package/types/meta/VRMMeta.d.ts +6 -6
- package/types/meta/VRMMetaLoaderPlugin.d.ts +32 -32
- package/types/meta/VRMMetaLoaderPluginOptions.d.ts +22 -22
- package/types/meta/index.d.ts +5 -5
- package/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
- package/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
- package/types/utils/getWorldQuaternionLite.d.ts +8 -8
- package/types/utils/gltfExtractPrimitivesFromNode.d.ts +21 -21
- package/types/utils/gltfGetAssociatedMaterialIndex.d.ts +10 -10
- package/types/utils/quatInvertCompat.d.ts +8 -8
- package/types/utils/renameMaterialProperty.d.ts +1 -0
- package/types/utils/resolveURL.d.ts +4 -4
- package/types/utils/saturate.d.ts +6 -6
|
@@ -1,104 +1,148 @@
|
|
|
1
|
-
import * as THREE from 'three';
|
|
2
|
-
import { VRMHumanoid } from '../humanoid';
|
|
3
|
-
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
-
/**
|
|
5
|
-
* A class controls eye gaze movements of a VRM.
|
|
6
|
-
*/
|
|
7
|
-
export declare class VRMLookAt {
|
|
8
|
-
static readonly EULER_ORDER = "YXZ";
|
|
9
|
-
/**
|
|
10
|
-
* The origin of LookAt. Position offset from the head bone.
|
|
11
|
-
*/
|
|
12
|
-
offsetFromHeadBone: THREE.Vector3;
|
|
13
|
-
/**
|
|
14
|
-
* Its associated {@link VRMHumanoid}.
|
|
15
|
-
*/
|
|
16
|
-
readonly humanoid: VRMHumanoid;
|
|
17
|
-
/**
|
|
18
|
-
* The {@link VRMLookAtApplier} of the LookAt.
|
|
19
|
-
*/
|
|
20
|
-
applier: VRMLookAtApplier;
|
|
21
|
-
/**
|
|
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.
|
|
24
|
-
*
|
|
25
|
-
* See also: {@link target}
|
|
26
|
-
*/
|
|
27
|
-
autoUpdate: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* The target object of the LookAt.
|
|
30
|
-
* Note that it does not make any sense if {@link autoUpdate} is disabled.
|
|
31
|
-
*
|
|
32
|
-
* See also: {@link autoUpdate}
|
|
33
|
-
*/
|
|
34
|
-
target?: THREE.Object3D | null;
|
|
35
|
-
/**
|
|
36
|
-
* The front direction of the face.
|
|
37
|
-
* Intended to be used for VRM 0.0 compat (VRM 0.0 models are facing Z- instead of Z+).
|
|
38
|
-
* You usually don't want to touch this.
|
|
39
|
-
*/
|
|
40
|
-
faceFront: THREE.Vector3;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
*
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
* @
|
|
75
|
-
*/
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
*
|
|
93
|
-
* @
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
*
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { VRMHumanoid } from '../humanoid';
|
|
3
|
+
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
+
/**
|
|
5
|
+
* A class controls eye gaze movements of a VRM.
|
|
6
|
+
*/
|
|
7
|
+
export declare class VRMLookAt {
|
|
8
|
+
static readonly EULER_ORDER = "YXZ";
|
|
9
|
+
/**
|
|
10
|
+
* The origin of LookAt. Position offset from the head bone.
|
|
11
|
+
*/
|
|
12
|
+
offsetFromHeadBone: THREE.Vector3;
|
|
13
|
+
/**
|
|
14
|
+
* Its associated {@link VRMHumanoid}.
|
|
15
|
+
*/
|
|
16
|
+
readonly humanoid: VRMHumanoid;
|
|
17
|
+
/**
|
|
18
|
+
* The {@link VRMLookAtApplier} of the LookAt.
|
|
19
|
+
*/
|
|
20
|
+
applier: VRMLookAtApplier;
|
|
21
|
+
/**
|
|
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.
|
|
24
|
+
*
|
|
25
|
+
* See also: {@link target}
|
|
26
|
+
*/
|
|
27
|
+
autoUpdate: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The target object of the LookAt.
|
|
30
|
+
* Note that it does not make any sense if {@link autoUpdate} is disabled.
|
|
31
|
+
*
|
|
32
|
+
* See also: {@link autoUpdate}
|
|
33
|
+
*/
|
|
34
|
+
target?: THREE.Object3D | null;
|
|
35
|
+
/**
|
|
36
|
+
* The front direction of the face.
|
|
37
|
+
* Intended to be used for VRM 0.0 compat (VRM 0.0 models are facing Z- instead of Z+).
|
|
38
|
+
* You usually don't want to touch this.
|
|
39
|
+
*/
|
|
40
|
+
faceFront: THREE.Vector3;
|
|
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
|
+
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.
|
|
75
|
+
*/
|
|
76
|
+
get euler(): THREE.Euler;
|
|
77
|
+
/**
|
|
78
|
+
* Create a new {@link VRMLookAt}.
|
|
79
|
+
*
|
|
80
|
+
* @param humanoid A {@link VRMHumanoid}
|
|
81
|
+
* @param applier A {@link VRMLookAtApplier}
|
|
82
|
+
*/
|
|
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;
|
|
91
|
+
/**
|
|
92
|
+
* Copy the given {@link VRMLookAt} into this one.
|
|
93
|
+
* {@link humanoid} must be same as the source one.
|
|
94
|
+
* {@link applier} will reference the same instance as the source one.
|
|
95
|
+
* @param source The {@link VRMLookAt} you want to copy
|
|
96
|
+
* @returns this
|
|
97
|
+
*/
|
|
98
|
+
copy(source: VRMLookAt): this;
|
|
99
|
+
/**
|
|
100
|
+
* Returns a clone of this {@link VRMLookAt}.
|
|
101
|
+
* Note that {@link humanoid} and {@link applier} will reference the same instance as this one.
|
|
102
|
+
* @returns Copied {@link VRMLookAt}
|
|
103
|
+
*/
|
|
104
|
+
clone(): VRMLookAt;
|
|
105
|
+
/**
|
|
106
|
+
* Reset the lookAt direction to initial direction.
|
|
107
|
+
*/
|
|
108
|
+
reset(): void;
|
|
109
|
+
/**
|
|
110
|
+
* Get its head position in world coordinate.
|
|
111
|
+
*
|
|
112
|
+
* @param target A target `THREE.Vector3`
|
|
113
|
+
*/
|
|
114
|
+
getLookAtWorldPosition(target: THREE.Vector3): THREE.Vector3;
|
|
115
|
+
/**
|
|
116
|
+
* Get its head rotation in world coordinate.
|
|
117
|
+
* Does NOT consider {@link faceFront}.
|
|
118
|
+
*
|
|
119
|
+
* @param target A target `THREE.Quaternion`
|
|
120
|
+
*/
|
|
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;
|
|
128
|
+
/**
|
|
129
|
+
* Get its LookAt direction in world coordinate.
|
|
130
|
+
*
|
|
131
|
+
* @param target A target `THREE.Vector3`
|
|
132
|
+
*/
|
|
133
|
+
getLookAtWorldDirection(target: THREE.Vector3): THREE.Vector3;
|
|
134
|
+
/**
|
|
135
|
+
* Set its LookAt position.
|
|
136
|
+
* Note that its result will be instantly overwritten if {@link VRMLookAtHead.autoUpdate} is enabled.
|
|
137
|
+
*
|
|
138
|
+
* @param position A target position, in world space
|
|
139
|
+
*/
|
|
140
|
+
lookAt(position: THREE.Vector3): void;
|
|
141
|
+
/**
|
|
142
|
+
* Update the VRMLookAtHead.
|
|
143
|
+
* If {@link VRMLookAtHead.autoUpdate} is disabled, it will do nothing.
|
|
144
|
+
*
|
|
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}.
|
|
146
|
+
*/
|
|
147
|
+
update(delta: number): void;
|
|
148
|
+
}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* This class is used by {@link VRMLookAt}, applies look at direction.
|
|
4
|
+
* There are currently two variant of applier: {@link VRMLookAtBoneApplier} and {@link VRMLookAtExpressionApplier}.
|
|
5
|
+
*/
|
|
6
|
+
export interface VRMLookAtApplier {
|
|
7
|
+
/**
|
|
8
|
+
* Apply look at direction to its associated VRM model.
|
|
9
|
+
*
|
|
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.
|
|
16
|
+
*/
|
|
17
|
+
lookAt: (euler: THREE.Euler) => void;
|
|
18
|
+
}
|
|
@@ -1,50 +1,83 @@
|
|
|
1
|
-
import { VRMHumanoid } from '../humanoid';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
-
import { VRMLookAtRangeMap } from './VRMLookAtRangeMap';
|
|
5
|
-
/**
|
|
6
|
-
* A class that applies eye gaze directions to a VRM.
|
|
7
|
-
* It will be used by {@link VRMLookAt}.
|
|
8
|
-
*/
|
|
9
|
-
export declare class VRMLookAtBoneApplier implements VRMLookAtApplier {
|
|
10
|
-
/**
|
|
11
|
-
* Represent its type of applier.
|
|
12
|
-
*/
|
|
13
|
-
static readonly type = "bone";
|
|
14
|
-
/**
|
|
15
|
-
* Its associated {@link VRMHumanoid}.
|
|
16
|
-
*/
|
|
17
|
-
readonly humanoid: VRMHumanoid;
|
|
18
|
-
/**
|
|
19
|
-
* A {@link VRMLookAtRangeMap} for horizontal inward movement. The left eye moves right. The right eye moves left.
|
|
20
|
-
*/
|
|
21
|
-
rangeMapHorizontalInner: VRMLookAtRangeMap;
|
|
22
|
-
/**
|
|
23
|
-
* A {@link VRMLookAtRangeMap} for horizontal outward movement. The left eye moves left. The right eye moves right.
|
|
24
|
-
*/
|
|
25
|
-
rangeMapHorizontalOuter: VRMLookAtRangeMap;
|
|
26
|
-
/**
|
|
27
|
-
* A {@link VRMLookAtRangeMap} for vertical downward movement. Both eyes move upwards.
|
|
28
|
-
*/
|
|
29
|
-
rangeMapVerticalDown: VRMLookAtRangeMap;
|
|
30
|
-
/**
|
|
31
|
-
* A {@link VRMLookAtRangeMap} for vertical upward movement. Both eyes move downwards.
|
|
32
|
-
*/
|
|
33
|
-
rangeMapVerticalUp: VRMLookAtRangeMap;
|
|
34
|
-
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
1
|
+
import { VRMHumanoid } from '../humanoid';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
+
import { VRMLookAtRangeMap } from './VRMLookAtRangeMap';
|
|
5
|
+
/**
|
|
6
|
+
* A class that applies eye gaze directions to a VRM.
|
|
7
|
+
* It will be used by {@link VRMLookAt}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VRMLookAtBoneApplier implements VRMLookAtApplier {
|
|
10
|
+
/**
|
|
11
|
+
* Represent its type of applier.
|
|
12
|
+
*/
|
|
13
|
+
static readonly type = "bone";
|
|
14
|
+
/**
|
|
15
|
+
* Its associated {@link VRMHumanoid}.
|
|
16
|
+
*/
|
|
17
|
+
readonly humanoid: VRMHumanoid;
|
|
18
|
+
/**
|
|
19
|
+
* A {@link VRMLookAtRangeMap} for horizontal inward movement. The left eye moves right. The right eye moves left.
|
|
20
|
+
*/
|
|
21
|
+
rangeMapHorizontalInner: VRMLookAtRangeMap;
|
|
22
|
+
/**
|
|
23
|
+
* A {@link VRMLookAtRangeMap} for horizontal outward movement. The left eye moves left. The right eye moves right.
|
|
24
|
+
*/
|
|
25
|
+
rangeMapHorizontalOuter: VRMLookAtRangeMap;
|
|
26
|
+
/**
|
|
27
|
+
* A {@link VRMLookAtRangeMap} for vertical downward movement. Both eyes move upwards.
|
|
28
|
+
*/
|
|
29
|
+
rangeMapVerticalDown: VRMLookAtRangeMap;
|
|
30
|
+
/**
|
|
31
|
+
* A {@link VRMLookAtRangeMap} for vertical upward movement. Both eyes move downwards.
|
|
32
|
+
*/
|
|
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;
|
|
56
|
+
/**
|
|
57
|
+
* Create a new {@link VRMLookAtBoneApplier}.
|
|
58
|
+
*
|
|
59
|
+
* @param humanoid A {@link VRMHumanoid}
|
|
60
|
+
* @param rangeMapHorizontalInner A {@link VRMLookAtRangeMap} used for inner transverse direction
|
|
61
|
+
* @param rangeMapHorizontalOuter A {@link VRMLookAtRangeMap} used for outer transverse direction
|
|
62
|
+
* @param rangeMapVerticalDown A {@link VRMLookAtRangeMap} used for down direction
|
|
63
|
+
* @param rangeMapVerticalUp A {@link VRMLookAtRangeMap} used for up direction
|
|
64
|
+
*/
|
|
65
|
+
constructor(humanoid: VRMHumanoid, rangeMapHorizontalInner: VRMLookAtRangeMap, rangeMapHorizontalOuter: VRMLookAtRangeMap, rangeMapVerticalDown: VRMLookAtRangeMap, rangeMapVerticalUp: VRMLookAtRangeMap);
|
|
66
|
+
/**
|
|
67
|
+
* Apply the input angle to its associated VRM model.
|
|
68
|
+
*
|
|
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`
|
|
81
|
+
*/
|
|
82
|
+
private _getWorldFaceFrontQuat;
|
|
83
|
+
}
|
|
@@ -1,51 +1,56 @@
|
|
|
1
|
-
import { VRMExpressionManager } from '../expressions';
|
|
2
|
-
import * as THREE from 'three';
|
|
3
|
-
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
-
import { VRMLookAtRangeMap } from './VRMLookAtRangeMap';
|
|
5
|
-
/**
|
|
6
|
-
* A class that applies eye gaze directions to a VRM.
|
|
7
|
-
* It will be used by {@link VRMLookAt}.
|
|
8
|
-
*/
|
|
9
|
-
export declare class VRMLookAtExpressionApplier implements VRMLookAtApplier {
|
|
10
|
-
/**
|
|
11
|
-
* Represent its type of applier.
|
|
12
|
-
*/
|
|
13
|
-
static readonly type = "expression";
|
|
14
|
-
/**
|
|
15
|
-
* Its associated {@link VRMExpressionManager}.
|
|
16
|
-
*/
|
|
17
|
-
readonly expressions: VRMExpressionManager;
|
|
18
|
-
/**
|
|
19
|
-
* It won't be used in expression applier.
|
|
20
|
-
* See also: {@link rangeMapHorizontalOuter}
|
|
21
|
-
*/
|
|
22
|
-
rangeMapHorizontalInner: VRMLookAtRangeMap;
|
|
23
|
-
/**
|
|
24
|
-
* A {@link VRMLookAtRangeMap} for horizontal movement. Both eyes move left or right.
|
|
25
|
-
*/
|
|
26
|
-
rangeMapHorizontalOuter: VRMLookAtRangeMap;
|
|
27
|
-
/**
|
|
28
|
-
* A {@link VRMLookAtRangeMap} for vertical downward movement. Both eyes move upwards.
|
|
29
|
-
*/
|
|
30
|
-
rangeMapVerticalDown: VRMLookAtRangeMap;
|
|
31
|
-
/**
|
|
32
|
-
* A {@link VRMLookAtRangeMap} for vertical upward movement. Both eyes move downwards.
|
|
33
|
-
*/
|
|
34
|
-
rangeMapVerticalUp: VRMLookAtRangeMap;
|
|
35
|
-
/**
|
|
36
|
-
* Create a new {@link VRMLookAtExpressionApplier}.
|
|
37
|
-
*
|
|
38
|
-
* @param expressions A {@link VRMExpressionManager}
|
|
39
|
-
* @param rangeMapHorizontalInner A {@link VRMLookAtRangeMap} used for inner transverse direction
|
|
40
|
-
* @param rangeMapHorizontalOuter A {@link VRMLookAtRangeMap} used for outer transverse direction
|
|
41
|
-
* @param rangeMapVerticalDown A {@link VRMLookAtRangeMap} used for down direction
|
|
42
|
-
* @param rangeMapVerticalUp A {@link VRMLookAtRangeMap} used for up direction
|
|
43
|
-
*/
|
|
44
|
-
constructor(expressions: VRMExpressionManager, rangeMapHorizontalInner: VRMLookAtRangeMap, rangeMapHorizontalOuter: VRMLookAtRangeMap, rangeMapVerticalDown: VRMLookAtRangeMap, rangeMapVerticalUp: VRMLookAtRangeMap);
|
|
45
|
-
/**
|
|
46
|
-
* Apply the input angle to its associated VRM model.
|
|
47
|
-
*
|
|
48
|
-
* @param
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import { VRMExpressionManager } from '../expressions';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import type { VRMLookAtApplier } from './VRMLookAtApplier';
|
|
4
|
+
import { VRMLookAtRangeMap } from './VRMLookAtRangeMap';
|
|
5
|
+
/**
|
|
6
|
+
* A class that applies eye gaze directions to a VRM.
|
|
7
|
+
* It will be used by {@link VRMLookAt}.
|
|
8
|
+
*/
|
|
9
|
+
export declare class VRMLookAtExpressionApplier implements VRMLookAtApplier {
|
|
10
|
+
/**
|
|
11
|
+
* Represent its type of applier.
|
|
12
|
+
*/
|
|
13
|
+
static readonly type = "expression";
|
|
14
|
+
/**
|
|
15
|
+
* Its associated {@link VRMExpressionManager}.
|
|
16
|
+
*/
|
|
17
|
+
readonly expressions: VRMExpressionManager;
|
|
18
|
+
/**
|
|
19
|
+
* It won't be used in expression applier.
|
|
20
|
+
* See also: {@link rangeMapHorizontalOuter}
|
|
21
|
+
*/
|
|
22
|
+
rangeMapHorizontalInner: VRMLookAtRangeMap;
|
|
23
|
+
/**
|
|
24
|
+
* A {@link VRMLookAtRangeMap} for horizontal movement. Both eyes move left or right.
|
|
25
|
+
*/
|
|
26
|
+
rangeMapHorizontalOuter: VRMLookAtRangeMap;
|
|
27
|
+
/**
|
|
28
|
+
* A {@link VRMLookAtRangeMap} for vertical downward movement. Both eyes move upwards.
|
|
29
|
+
*/
|
|
30
|
+
rangeMapVerticalDown: VRMLookAtRangeMap;
|
|
31
|
+
/**
|
|
32
|
+
* A {@link VRMLookAtRangeMap} for vertical upward movement. Both eyes move downwards.
|
|
33
|
+
*/
|
|
34
|
+
rangeMapVerticalUp: VRMLookAtRangeMap;
|
|
35
|
+
/**
|
|
36
|
+
* Create a new {@link VRMLookAtExpressionApplier}.
|
|
37
|
+
*
|
|
38
|
+
* @param expressions A {@link VRMExpressionManager}
|
|
39
|
+
* @param rangeMapHorizontalInner A {@link VRMLookAtRangeMap} used for inner transverse direction
|
|
40
|
+
* @param rangeMapHorizontalOuter A {@link VRMLookAtRangeMap} used for outer transverse direction
|
|
41
|
+
* @param rangeMapVerticalDown A {@link VRMLookAtRangeMap} used for down direction
|
|
42
|
+
* @param rangeMapVerticalUp A {@link VRMLookAtRangeMap} used for up direction
|
|
43
|
+
*/
|
|
44
|
+
constructor(expressions: VRMExpressionManager, rangeMapHorizontalInner: VRMLookAtRangeMap, rangeMapHorizontalOuter: VRMLookAtRangeMap, rangeMapVerticalDown: VRMLookAtRangeMap, rangeMapVerticalUp: VRMLookAtRangeMap);
|
|
45
|
+
/**
|
|
46
|
+
* Apply the input angle to its associated VRM model.
|
|
47
|
+
*
|
|
48
|
+
* @param yaw Rotation around Y axis, in degree
|
|
49
|
+
* @param pitch Rotation around X axis, in degree
|
|
50
|
+
*/
|
|
51
|
+
applyYawPitch(yaw: number, pitch: number): void;
|
|
52
|
+
/**
|
|
53
|
+
* @deprecated Use {@link applyYawPitch} instead.
|
|
54
|
+
*/
|
|
55
|
+
lookAt(euler: THREE.Euler): void;
|
|
56
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
-
import type { VRMLookAtLoaderPluginOptions } from './VRMLookAtLoaderPluginOptions';
|
|
3
|
-
/**
|
|
4
|
-
* A plugin of GLTFLoader that imports a {@link VRMLookAt} from a VRM extension of a GLTF.
|
|
5
|
-
*/
|
|
6
|
-
export declare class VRMLookAtLoaderPlugin implements GLTFLoaderPlugin {
|
|
7
|
-
/**
|
|
8
|
-
* Specify an Object3D to add {@link VRMLookAtHelper} s.
|
|
9
|
-
* If not specified, helper will not be created.
|
|
10
|
-
* If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
|
|
11
|
-
*/
|
|
12
|
-
helperRoot?: THREE.Object3D;
|
|
13
|
-
readonly parser: GLTFParser;
|
|
14
|
-
get name(): string;
|
|
15
|
-
constructor(parser: GLTFParser, options?: VRMLookAtLoaderPluginOptions);
|
|
16
|
-
afterRoot(gltf: GLTF): Promise<void>;
|
|
17
|
-
/**
|
|
18
|
-
* Import a {@link VRMLookAt} from a VRM.
|
|
19
|
-
*
|
|
20
|
-
* @param gltf A parsed result of GLTF taken from GLTFLoader
|
|
21
|
-
* @param humanoid A {@link VRMHumanoid} instance that represents the VRM
|
|
22
|
-
* @param expressions A {@link VRMExpressionManager} instance that represents the VRM
|
|
23
|
-
*/
|
|
24
|
-
private _import;
|
|
25
|
-
private _v1Import;
|
|
26
|
-
private _v1ImportRangeMap;
|
|
27
|
-
private _v0Import;
|
|
28
|
-
private _v0ImportDegreeMap;
|
|
29
|
-
private _importLookAt;
|
|
30
|
-
}
|
|
1
|
+
import type { GLTF, GLTFLoaderPlugin, GLTFParser } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
2
|
+
import type { VRMLookAtLoaderPluginOptions } from './VRMLookAtLoaderPluginOptions';
|
|
3
|
+
/**
|
|
4
|
+
* A plugin of GLTFLoader that imports a {@link VRMLookAt} from a VRM extension of a GLTF.
|
|
5
|
+
*/
|
|
6
|
+
export declare class VRMLookAtLoaderPlugin implements GLTFLoaderPlugin {
|
|
7
|
+
/**
|
|
8
|
+
* Specify an Object3D to add {@link VRMLookAtHelper} s.
|
|
9
|
+
* If not specified, helper will not be created.
|
|
10
|
+
* If `renderOrder` is set to the root, helpers will copy the same `renderOrder` .
|
|
11
|
+
*/
|
|
12
|
+
helperRoot?: THREE.Object3D;
|
|
13
|
+
readonly parser: GLTFParser;
|
|
14
|
+
get name(): string;
|
|
15
|
+
constructor(parser: GLTFParser, options?: VRMLookAtLoaderPluginOptions);
|
|
16
|
+
afterRoot(gltf: GLTF): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Import a {@link VRMLookAt} from a VRM.
|
|
19
|
+
*
|
|
20
|
+
* @param gltf A parsed result of GLTF taken from GLTFLoader
|
|
21
|
+
* @param humanoid A {@link VRMHumanoid} instance that represents the VRM
|
|
22
|
+
* @param expressions A {@link VRMExpressionManager} instance that represents the VRM
|
|
23
|
+
*/
|
|
24
|
+
private _import;
|
|
25
|
+
private _v1Import;
|
|
26
|
+
private _v1ImportRangeMap;
|
|
27
|
+
private _v0Import;
|
|
28
|
+
private _v0ImportDegreeMap;
|
|
29
|
+
private _importLookAt;
|
|
30
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export interface VRMLookAtLoaderPluginOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Specify an Object3D to add {@link VRMLookAtHelper} s.
|
|
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
|
-
}
|
|
1
|
+
export interface VRMLookAtLoaderPluginOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Specify an Object3D to add {@link VRMLookAtHelper} s.
|
|
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
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export declare class VRMLookAtRangeMap {
|
|
2
|
-
/**
|
|
3
|
-
* Limits the maximum angle of the input angle of the LookAt vector from the front of the head (the positive z axis).
|
|
4
|
-
*/
|
|
5
|
-
inputMaxValue: number;
|
|
6
|
-
/**
|
|
7
|
-
* Represents an angle (in degrees) for bone type of LookAt appliers, or a weight for expression type of LookAt appliers.
|
|
8
|
-
* The input value will take `1.0` when the input angle equals (or greater) to {@link inputMaxValue}.
|
|
9
|
-
*/
|
|
10
|
-
outputScale: number;
|
|
11
|
-
/**
|
|
12
|
-
* Create a new {@link VRMLookAtRangeMap}.
|
|
13
|
-
*
|
|
14
|
-
* @param inputMaxValue The {@link inputMaxValue} of the map
|
|
15
|
-
* @param outputScale The {@link outputScale} of the map
|
|
16
|
-
*/
|
|
17
|
-
constructor(inputMaxValue: number, outputScale: number);
|
|
18
|
-
/**
|
|
19
|
-
* Evaluate an input value and output a mapped value.
|
|
20
|
-
* @param src The input value
|
|
21
|
-
*/
|
|
22
|
-
map(src: number): number;
|
|
23
|
-
}
|
|
1
|
+
export declare class VRMLookAtRangeMap {
|
|
2
|
+
/**
|
|
3
|
+
* Limits the maximum angle of the input angle of the LookAt vector from the front of the head (the positive z axis).
|
|
4
|
+
*/
|
|
5
|
+
inputMaxValue: number;
|
|
6
|
+
/**
|
|
7
|
+
* Represents an angle (in degrees) for bone type of LookAt appliers, or a weight for expression type of LookAt appliers.
|
|
8
|
+
* The input value will take `1.0` when the input angle equals (or greater) to {@link inputMaxValue}.
|
|
9
|
+
*/
|
|
10
|
+
outputScale: number;
|
|
11
|
+
/**
|
|
12
|
+
* Create a new {@link VRMLookAtRangeMap}.
|
|
13
|
+
*
|
|
14
|
+
* @param inputMaxValue The {@link inputMaxValue} of the map
|
|
15
|
+
* @param outputScale The {@link outputScale} of the map
|
|
16
|
+
*/
|
|
17
|
+
constructor(inputMaxValue: number, outputScale: number);
|
|
18
|
+
/**
|
|
19
|
+
* Evaluate an input value and output a mapped value.
|
|
20
|
+
* @param src The input value
|
|
21
|
+
*/
|
|
22
|
+
map(src: number): number;
|
|
23
|
+
}
|