@pixiv/three-vrm 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/README.md +58 -56
- package/lib/three-vrm.js +1580 -920
- package/lib/three-vrm.min.js +16 -17
- package/lib/three-vrm.module.js +1577 -919
- package/lib/three-vrm.module.min.js +17 -16
- package/package.json +15 -15
- package/ts3.4/types/VRMLoaderPlugin.d.ts +1 -1
- package/ts3.4/types/VRMLoaderPluginOptions.d.ts +7 -0
- package/ts3.4/types/VRMUtils/rotateVRM0.d.ts +5 -0
- package/types/VRMLoaderPlugin.d.ts +1 -1
- package/types/VRMLoaderPluginOptions.d.ts +7 -0
- package/types/VRMUtils/rotateVRM0.d.ts +5 -0
- package/ts3.4/types/utils/renameMaterialProperty.d.ts +0 -1
- package/types/utils/renameMaterialProperty.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# `@pixiv/three-vrm`
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@pixiv/three-vrm)
|
|
4
|
+
|
|
3
5
|
Use [VRM](https://vrm.dev/) on [three.js](https://threejs.org/)
|
|
4
6
|
|
|
5
7
|

|
|
@@ -8,7 +10,19 @@ Use [VRM](https://vrm.dev/) on [three.js](https://threejs.org/)
|
|
|
8
10
|
|
|
9
11
|
[Examples](https://pixiv.github.io/three-vrm/packages/three-vrm/examples)
|
|
10
12
|
|
|
11
|
-
[
|
|
13
|
+
[Documentations](https://github.com/pixiv/three-vrm/tree/dev/docs/README.md)
|
|
14
|
+
|
|
15
|
+
[API Reference](https://pixiv.github.io/three-vrm/packages/three-vrm/docs)
|
|
16
|
+
|
|
17
|
+
## v1
|
|
18
|
+
|
|
19
|
+
**three-vrm v1 has been released!**
|
|
20
|
+
|
|
21
|
+
three-vrm v1 supports [VRM1.0](https://vrm.dev/vrm1/), which is a new version of VRM format (the previous version of VRM is also supported, don't worry!).
|
|
22
|
+
It also adopts the GLTFLoader plugin system which is a relatively new feature of GLTFLoader.
|
|
23
|
+
|
|
24
|
+
There are a lot of breaking changes!
|
|
25
|
+
See [the migration guide](https://github.com/pixiv/three-vrm/blob/dev/docs/migration-guide-1.0.md) for more info.
|
|
12
26
|
|
|
13
27
|
## How to Use
|
|
14
28
|
|
|
@@ -19,8 +33,8 @@ You will need:
|
|
|
19
33
|
- [Three.js build](https://github.com/mrdoob/three.js/blob/master/build/three.js)
|
|
20
34
|
- [GLTFLoader](https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/GLTFLoader.js)
|
|
21
35
|
- [A build of @pixiv/three-vrm](https://unpkg.com/browse/@pixiv/three-vrm/lib/)
|
|
22
|
-
|
|
23
|
-
|
|
36
|
+
- `.module` ones are ESM, otherwise it's UMD and injects its modules into global `THREE`
|
|
37
|
+
- `.min` ones are minified (for production), otherwise it's not minified and it comes with source maps
|
|
24
38
|
|
|
25
39
|
Code like this:
|
|
26
40
|
|
|
@@ -30,43 +44,37 @@ Code like this:
|
|
|
30
44
|
<script src="three-vrm.js"></script>
|
|
31
45
|
|
|
32
46
|
<script>
|
|
33
|
-
const scene = new THREE.Scene();
|
|
34
|
-
|
|
35
|
-
const loader = new THREE.GLTFLoader();
|
|
36
|
-
|
|
37
|
-
// Install GLTFLoader plugin
|
|
38
|
-
loader.register( ( parser ) => {
|
|
39
|
-
|
|
40
|
-
return new THREE_VRM.VRMLoaderPlugin( parser );
|
|
47
|
+
const scene = new THREE.Scene();
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
const loader = new THREE.GLTFLoader();
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// called when the resource is loaded
|
|
50
|
-
( gltf ) => {
|
|
51
|
+
// Install GLTFLoader plugin
|
|
52
|
+
loader.register((parser) => {
|
|
53
|
+
return new THREE_VRM.VRMLoaderPlugin(parser);
|
|
54
|
+
});
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
loader.load(
|
|
57
|
+
// URL of the VRM you want to load
|
|
58
|
+
'/models/VRM1_Constraint_Twist_Sample.vrm',
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
60
|
+
// called when the resource is loaded
|
|
61
|
+
(gltf) => {
|
|
62
|
+
// retrieve a VRM instance from gltf
|
|
63
|
+
const vrm = gltf.userData.vrm;
|
|
57
64
|
|
|
58
|
-
|
|
59
|
-
|
|
65
|
+
// add the loaded vrm to the scene
|
|
66
|
+
scene.add(vrm.scene);
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
// deal with vrm features
|
|
69
|
+
console.log(vrm);
|
|
70
|
+
},
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
// called while loading is progressing
|
|
73
|
+
(progress) => console.log('Loading model...', 100.0 * (progress.loaded / progress.total), '%'),
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
);
|
|
75
|
+
// called when loading has errors
|
|
76
|
+
(error) => console.error(error),
|
|
77
|
+
);
|
|
70
78
|
</script>
|
|
71
79
|
```
|
|
72
80
|
|
|
@@ -90,37 +98,31 @@ const scene = new THREE.Scene();
|
|
|
90
98
|
const loader = new GLTFLoader();
|
|
91
99
|
|
|
92
100
|
// Install GLTFLoader plugin
|
|
93
|
-
loader.register(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} );
|
|
101
|
+
loader.register((parser) => {
|
|
102
|
+
return new VRMLoaderPlugin(parser);
|
|
103
|
+
});
|
|
98
104
|
|
|
99
105
|
loader.load(
|
|
106
|
+
// URL of the VRM you want to load
|
|
107
|
+
'/models/VRM1_Constraint_Twist_Sample.vrm',
|
|
100
108
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
( gltf ) => {
|
|
106
|
-
|
|
107
|
-
// retrieve a VRM instance from gltf
|
|
108
|
-
const vrm = gltf.userData.vrm;
|
|
109
|
-
|
|
110
|
-
// add the loaded vrm to the scene
|
|
111
|
-
scene.add( vrm.scene );
|
|
112
|
-
|
|
113
|
-
// deal with vrm features
|
|
114
|
-
console.log( vrm );
|
|
109
|
+
// called when the resource is loaded
|
|
110
|
+
(gltf) => {
|
|
111
|
+
// retrieve a VRM instance from gltf
|
|
112
|
+
const vrm = gltf.userData.vrm;
|
|
115
113
|
|
|
116
|
-
|
|
114
|
+
// add the loaded vrm to the scene
|
|
115
|
+
scene.add(vrm.scene);
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
// deal with vrm features
|
|
118
|
+
console.log(vrm);
|
|
119
|
+
},
|
|
120
120
|
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
// called while loading is progressing
|
|
122
|
+
(progress) => console.log('Loading model...', 100.0 * (progress.loaded / progress.total), '%'),
|
|
123
123
|
|
|
124
|
+
// called when loading has errors
|
|
125
|
+
(error) => console.error(error),
|
|
124
126
|
);
|
|
125
127
|
```
|
|
126
128
|
|