@pixiv/three-vrm 3.0.0-beta.2 → 3.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 +22 -50
- package/lib/nodes/index.cjs +2 -2
- package/lib/nodes/index.min.cjs +1 -1
- package/lib/nodes/index.module.js +2 -2
- package/lib/nodes/index.module.min.js +1 -1
- package/lib/three-vrm.cjs +7 -7
- package/lib/three-vrm.min.cjs +6 -6
- package/lib/three-vrm.module.js +7 -7
- package/lib/three-vrm.module.min.js +6 -6
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -20,15 +20,13 @@ Use [VRM](https://vrm.dev/) on [three.js](https://threejs.org/)
|
|
|
20
20
|
|
|
21
21
|
You will need:
|
|
22
22
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
23
|
+
- Three.js build
|
|
24
|
+
- GLTFLoader
|
|
25
|
+
- A build of @pixiv/three-vrm
|
|
26
26
|
- `.module` ones are ESM, otherwise it's UMD and injects its modules into global `THREE`
|
|
27
27
|
- `.min` ones are minified (for production), otherwise it's not minified and it comes with source maps
|
|
28
28
|
|
|
29
|
-
You can import all
|
|
30
|
-
|
|
31
|
-
Code like this:
|
|
29
|
+
You can import all the dependencies via CDN like [jsDelivr](https://www.jsdelivr.com/).
|
|
32
30
|
|
|
33
31
|
```html
|
|
34
32
|
<script type="importmap">
|
|
@@ -36,7 +34,7 @@ Code like this:
|
|
|
36
34
|
"imports": {
|
|
37
35
|
"three": "https://cdn.jsdelivr.net/npm/three@0.167.0/build/three.module.js",
|
|
38
36
|
"three/addons/": "https://cdn.jsdelivr.net/npm/three@0.167.0/examples/jsm/",
|
|
39
|
-
"@pixiv/three-vrm": "three-vrm.module.js"
|
|
37
|
+
"@pixiv/three-vrm": "https://cdn.jsdelivr.net/npm/@pixiv/three-vrm@3/lib/three-vrm.module.min.js"
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
</script>
|
|
@@ -46,11 +44,12 @@ Code like this:
|
|
|
46
44
|
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
|
|
47
45
|
import { VRMLoaderPlugin } from '@pixiv/three-vrm';
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
// ... Setup renderer, camera, scene ...
|
|
50
48
|
|
|
49
|
+
// Create a GLTFLoader - The loader for loading VRM models
|
|
51
50
|
const loader = new GLTFLoader();
|
|
52
51
|
|
|
53
|
-
// Install GLTFLoader plugin
|
|
52
|
+
// Install a GLTFLoader plugin that enables VRM support
|
|
54
53
|
loader.register((parser) => {
|
|
55
54
|
return new VRMLoaderPlugin(parser);
|
|
56
55
|
});
|
|
@@ -77,9 +76,15 @@ Code like this:
|
|
|
77
76
|
// called when loading has errors
|
|
78
77
|
(error) => console.error(error),
|
|
79
78
|
);
|
|
79
|
+
|
|
80
|
+
// ... Perform the render loop ...
|
|
80
81
|
</script>
|
|
81
82
|
```
|
|
82
83
|
|
|
84
|
+
See the Three.js document if you are not familiar with Three.js yet: https://threejs.org/docs/#manual/en/introduction/Creating-a-scene
|
|
85
|
+
|
|
86
|
+
See the example for the complete code: https://github.com/pixiv/three-vrm/blob/release/packages/three-vrm/examples/basic.html
|
|
87
|
+
|
|
83
88
|
### via npm
|
|
84
89
|
|
|
85
90
|
Install [`three`](https://www.npmjs.com/package/three) and [`@pixiv/three-vrm`](https://www.npmjs.com/package/@pixiv/three-vrm) :
|
|
@@ -88,46 +93,6 @@ Install [`three`](https://www.npmjs.com/package/three) and [`@pixiv/three-vrm`](
|
|
|
88
93
|
npm install three @pixiv/three-vrm
|
|
89
94
|
```
|
|
90
95
|
|
|
91
|
-
Code like this:
|
|
92
|
-
|
|
93
|
-
```javascript
|
|
94
|
-
import * as THREE from 'three';
|
|
95
|
-
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
96
|
-
import { VRMLoaderPlugin } from '@pixiv/three-vrm';
|
|
97
|
-
|
|
98
|
-
const scene = new THREE.Scene();
|
|
99
|
-
|
|
100
|
-
const loader = new GLTFLoader();
|
|
101
|
-
|
|
102
|
-
// Install GLTFLoader plugin
|
|
103
|
-
loader.register((parser) => {
|
|
104
|
-
return new VRMLoaderPlugin(parser);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
loader.load(
|
|
108
|
-
// URL of the VRM you want to load
|
|
109
|
-
'/models/VRM1_Constraint_Twist_Sample.vrm',
|
|
110
|
-
|
|
111
|
-
// called when the resource is loaded
|
|
112
|
-
(gltf) => {
|
|
113
|
-
// retrieve a VRM instance from gltf
|
|
114
|
-
const vrm = gltf.userData.vrm;
|
|
115
|
-
|
|
116
|
-
// add the loaded vrm to the scene
|
|
117
|
-
scene.add(vrm.scene);
|
|
118
|
-
|
|
119
|
-
// deal with vrm features
|
|
120
|
-
console.log(vrm);
|
|
121
|
-
},
|
|
122
|
-
|
|
123
|
-
// called while loading is progressing
|
|
124
|
-
(progress) => console.log('Loading model...', 100.0 * (progress.loaded / progress.total), '%'),
|
|
125
|
-
|
|
126
|
-
// called when loading has errors
|
|
127
|
-
(error) => console.error(error),
|
|
128
|
-
);
|
|
129
|
-
```
|
|
130
|
-
|
|
131
96
|
### Use with WebGPURenderer
|
|
132
97
|
|
|
133
98
|
Starting from v3, we provide [WebGPURenderer](https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/webgpu/WebGPURenderer.js) compatibility.
|
|
@@ -140,7 +105,10 @@ The NodeMaterial system of Three.js is still under development, so we may break
|
|
|
140
105
|
import { VRMLoaderPlugin } from '@pixiv/three-vrm';
|
|
141
106
|
import { MToonNodeMaterial } from '@pixiv/three-vrm/nodes';
|
|
142
107
|
|
|
143
|
-
// ...
|
|
108
|
+
// ... Setup renderer, camera, scene ...
|
|
109
|
+
|
|
110
|
+
// Create a GLTFLoader
|
|
111
|
+
const loader = new GLTFLoader();
|
|
144
112
|
|
|
145
113
|
// Register a VRMLoaderPlugin
|
|
146
114
|
loader.register((parser) => {
|
|
@@ -161,8 +129,12 @@ loader.register((parser) => {
|
|
|
161
129
|
});
|
|
162
130
|
|
|
163
131
|
});
|
|
132
|
+
|
|
133
|
+
// ... Load the VRM and perform the render loop ...
|
|
164
134
|
```
|
|
165
135
|
|
|
136
|
+
See the example for the complete code: https://github.com/pixiv/three-vrm/blob/release/packages/three-vrm/examples/webgpu-dnd.html
|
|
137
|
+
|
|
166
138
|
## Contributing
|
|
167
139
|
|
|
168
140
|
See: [CONTRIBUTING.md](CONTRIBUTING.md)
|
package/lib/nodes/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.0.0
|
|
2
|
+
* @pixiv/three-vrm v3.0.0
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -505,7 +505,7 @@ var MToonNodeMaterial = class extends THREE7.NodeMaterial {
|
|
|
505
505
|
}
|
|
506
506
|
};
|
|
507
507
|
/*!
|
|
508
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
508
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
509
509
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
510
510
|
*
|
|
511
511
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/nodes/index.min.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
|
|
2
2
|
"use strict";var X=Object.create;var T=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var B=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,q=Object.prototype.hasOwnProperty;var K=(t,e)=>{for(var o in e)T(t,o,{get:e[o],enumerable:!0})},A=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of B(e))!q.call(t,n)&&n!==o&&T(t,n,{get:()=>e[n],enumerable:!(a=z(e,n))||a.enumerable});return t};var d=(t,e,o)=>(o=t!=null?X(j(t)):{},A(e||!t||!t.__esModule?T(o,"default",{value:t,enumerable:!0}):o,t)),Z=t=>A(T({},"__esModule",{value:!0}),t);var Ft={};K(Ft,{MToonAnimatedUVNode:()=>b,MToonLightingModel:()=>Y,MToonNodeMaterial:()=>St});module.exports=Z(Ft);var U=d(require("three"),1),s=d(require("three/webgpu"),1),r=d(require("three/webgpu"),1),l=d(require("three/webgpu"),1),m=d(require("three/webgpu"),1),i=d(require("three/webgpu"),1),h=d(require("three/webgpu"),1);var V=parseInt(U.REVISION,10);V<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${V}). This would not work correctly.`);var $=r.materialReference("color","color"),G=r.materialReference("map","texture"),J=r.materialReference("normalMap","texture"),Q=r.materialReference("normalScale","vec2"),tt=r.materialReference("emissive","color"),et=r.materialReference("emissiveIntensity","float"),it=r.materialReference("emissiveMap","texture"),ot=r.materialReference("shadeColorFactor","color"),rt=r.materialReference("shadingShiftFactor","float"),W=r.materialReference("shadeMultiplyTexture","texture"),at=r.materialReference("shadeMultiplyTextureScale","float"),lt=r.materialReference("shadingToonyFactor","float"),nt=r.materialReference("rimLightingMixFactor","float"),st=r.materialReference("rimMultiplyTexture","texture"),mt=r.materialReference("matcapFactor","color"),ut=r.materialReference("matcapTexture","texture"),ht=r.materialReference("parametricRimColorFactor","color"),dt=r.materialReference("parametricRimLiftFactor","float"),ct=r.materialReference("parametricRimFresnelPowerFactor","float"),pt=r.materialReference("outlineWidthMultiplyTexture","texture"),Et=r.materialReference("outlineWidthFactor","float"),O=r.materialReference("outlineColorFactor","color"),ft=r.materialReference("outlineLightingMixFactor","float"),Rt=r.materialReference("uvAnimationMaskTexture","texture"),Tt=r.materialReference("uvAnimationScrollXOffset","float"),vt=r.materialReference("uvAnimationScrollYOffset","float"),Nt=r.materialReference("uvAnimationRotationPhase","float"),b=class extends s.TempNode{constructor(t){super("vec2"),this.hasMaskTexture=t}setup(){let t=1;this.hasMaskTexture&&(t=s.vec4(Rt).context({getUV:()=>s.uv()}).r);let e=s.uv(),o=Nt.mul(t),a=s.cos(o),n=s.sin(o);e=e.sub(s.vec2(.5,.5)),e=e.mul(s.mat2(a,n,n.negate(),a)),e=e.add(s.vec2(.5,.5));let u=s.vec2(Tt,vt).mul(t);return e=e.add(u),e.temp("AnimatedUV")}},I=m.nodeImmutable(m.PropertyNode,"vec3").temp("ShadeColor"),D=m.nodeImmutable(m.PropertyNode,"float").temp("ShadingShift"),k=m.nodeImmutable(m.PropertyNode,"float").temp("ShadingToony"),v=m.nodeImmutable(m.PropertyNode,"float").temp("RimLightingMix"),N=m.nodeImmutable(m.PropertyNode,"vec3").temp("RimMultiply"),g=m.nodeImmutable(m.PropertyNode,"vec3").temp("matcap"),H=m.nodeImmutable(m.PropertyNode,"vec3").temp("ParametricRim"),gt=l.tslFn(({a:t,b:e,t:o})=>{let a=o.sub(t),n=e.sub(t);return a.div(n).clamp()}),Ht=l.tslFn(({dotNL:t})=>{let o=l.float(1).sub(k),a=t.add(D);return a=gt({a:o.negate(),b:o,t:a}),a=a.mul(1),a}),Mt=l.tslFn(({shading:t,lightColor:e})=>{let o=l.mix(I,l.diffuseColor,t);return e.mul(l.BRDF_Lambert({diffuseColor:o}))}),Y=class extends l.LightingModel{constructor(){super()}direct({lightDirection:t,lightColor:e,reflectedLight:o}){let a=l.transformedNormalView.dot(t).clamp(-1,1),n=Ht({dotNL:a});o.directDiffuse.assign(o.directDiffuse.add(Mt({shading:n,lightColor:e}))),o.directSpecular.assign(o.directSpecular.add(H.add(g).mul(N).mul(l.mix(l.vec3(0),l.BRDF_Lambert({diffuseColor:e}),v))))}indirect(t){this.indirectDiffuse(t),this.indirectSpecular(t)}indirectDiffuse({irradiance:t,reflectedLight:e}){e.indirectDiffuse.assign(e.indirectDiffuse.add(t.mul(l.BRDF_Lambert({diffuseColor:l.diffuseColor}))))}indirectSpecular({reflectedLight:t}){t.indirectSpecular.assign(t.indirectSpecular.add(H.add(g).mul(N).mul(l.mix(l.vec3(1),l.vec3(0),v))))}},f={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},xt=h.tslFn(({parametricRimLift:t,parametricRimFresnelPower:e,parametricRimColor:o})=>{let a=h.modelViewPosition.normalize(),n=h.transformedNormalView.dot(a.negate());return h.float(1).sub(n).add(t).clamp().pow(e).mul(o)}),St=class extends i.NodeMaterial{customProgramCacheKey(){let t=super.customProgramCacheKey();return t+=`isOutline:${this.isOutline},`,t}get isMToonNodeMaterial(){return!0}constructor(t={}){super(),t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,delete t.giEqualizationFactor,delete t.v0CompatShade,delete t.debugMode,this.emissiveNode=null,this.lights=!0,this.color=new i.Color(1,1,1),this.map=null,this.emissive=new i.Color(0,0,0),this.emissiveIntensity=1,this.emissiveMap=null,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.shadeColorFactor=new i.Color(0,0,0),this.shadeMultiplyTexture=null,this.shadingShiftFactor=0,this.shadingShiftTexture=null,this.shadingShiftTextureScale=1,this.shadingToonyFactor=.9,this.rimLightingMixFactor=1,this.rimMultiplyTexture=null,this.matcapFactor=new i.Color(1,1,1),this.matcapTexture=null,this.parametricRimColorFactor=new i.Color(0,0,0),this.parametricRimLiftFactor=0,this.parametricRimFresnelPowerFactor=5,this.outlineWidthMode=f.None,this.outlineWidthMultiplyTexture=null,this.outlineWidthFactor=0,this.outlineColorFactor=new i.Color(0,0,0),this.outlineLightingMixFactor=1,this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.uvAnimationMaskTexture=null,this.shadeColorNode=null,this.shadingShiftNode=null,this.shadingToonyNode=null,this.rimLightingMixNode=null,this.rimMultiplyNode=null,this.matcapNode=null,this.parametricRimColorNode=null,this.parametricRimLiftNode=null,this.parametricRimFresnelPowerNode=null,this.uvAnimationScrollXOffset=0,this.uvAnimationScrollYOffset=0,this.uvAnimationRotationPhase=0,this.isOutline=!1,this._animatedUVNode=null,this.setValues(t)}setupLightingModel(){return new Y}setup(t){var e;this._animatedUVNode=new b((e=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?e:!1),super.setup(t)}setupDiffuseColor(t){let e=null;if(this.colorNode==null){if(e=$,this.map&&this.map.isTexture===!0){let o=G.context({getUV:()=>this._animatedUVNode});e=e.mul(o)}this.colorNode=e}this.vertexColors===!0&&t.geometry.hasAttribute("color")&&(console.warn("MToonNodeMaterial: MToon ignores vertex colors. Consider using a model without vertex colors instead."),this.vertexColors=!1),super.setupDiffuseColor(t),parseInt(i.REVISION,10)<166&&this.transparent===!1&&this.blending===i.NormalBlending&&this.alphaToCoverage===!1&&i.diffuseColor.a.assign(1),this.colorNode===e&&(this.colorNode=null)}setupVariants(){I.assign(this._setupShadeColorNode()),D.assign(this._setupShadingShiftNode()),k.assign(this._setupShadingToonyNode()),v.assign(this._setupRimLightingMixNode()),N.assign(this._setupRimMultiplyNode()),g.assign(this._setupMatcapNode()),H.assign(this._setupParametricRimNode())}setupNormal(t){let e=this.normalNode;if(this.normalNode==null){if(this.normalNode=i.materialNormal,this.normalMap&&this.normalMap.isTexture===!0){let o=J.context({getUV:()=>this._animatedUVNode});this.normalNode=o.normalMap(Q)}this.isOutline&&(this.normalNode=this.normalNode.negate())}super.setupNormal(t),this.normalNode=e}setupLighting(t){let e=null;if(this.emissiveNode==null){if(e=tt.mul(et),this.emissiveMap&&this.emissiveMap.isTexture===!0){let a=it.context({getUV:()=>this._animatedUVNode});e=e.mul(a)}this.emissiveNode=e}let o=super.setupLighting(t);return this.emissiveNode===e&&(this.emissiveNode=null),o}setupOutput(t,e){return this.isOutline&&this.outlineWidthMode!==f.None&&(e=i.vec4(i.mix(O,e.xyz.mul(O),ft),e.w)),super.setupOutput(t,e)}setupPosition(t){var e,o;let a=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==f.None){(e=this.positionNode)!=null||(this.positionNode=i.positionLocal);let u=i.normalLocal.normalize(),c=Et;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let p=pt.context({getUV:()=>this._animatedUVNode});c=c.mul(p)}let R=i.length(i.modelNormalMatrix.mul(u)),E=c.mul(R).mul(u);if(this.outlineWidthMode===f.WorldCoordinates)this.positionNode=this.positionNode.add(E);else if(this.outlineWidthMode===f.ScreenCoordinates){let p=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(E.div(p).mul(i.positionView.z.negate()))}(o=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let n=super.setupPosition(t);return n.z.add(n.w.mul(1e-6)),this.positionNode=a,n}copy(t){var e,o,a,n,u,c,R,E,p,M,x,S,F,y,C,_,L,w,P;return this.color.copy(t.color),this.map=(e=t.map)!=null?e:null,this.emissive.copy(t.emissive),this.emissiveIntensity=t.emissiveIntensity,this.emissiveMap=(o=t.emissiveMap)!=null?o:null,this.normalMap=(a=t.normalMap)!=null?a:null,this.normalScale.copy(t.normalScale),this.shadeColorFactor.copy(t.shadeColorFactor),this.shadeMultiplyTexture=(n=t.shadeMultiplyTexture)!=null?n:null,this.shadingShiftFactor=t.shadingShiftFactor,this.shadingShiftTexture=(u=t.shadingShiftTexture)!=null?u:null,this.shadingShiftTextureScale=t.shadingShiftTextureScale,this.shadingToonyFactor=t.shadingToonyFactor,this.rimLightingMixFactor=t.rimLightingMixFactor,this.rimMultiplyTexture=(c=t.rimMultiplyTexture)!=null?c:null,this.matcapFactor.copy(t.matcapFactor),this.matcapTexture=(R=t.matcapTexture)!=null?R:null,this.parametricRimColorFactor.copy(t.parametricRimColorFactor),this.parametricRimLiftFactor=t.parametricRimLiftFactor,this.parametricRimFresnelPowerFactor=t.parametricRimFresnelPowerFactor,this.outlineWidthMode=t.outlineWidthMode,this.outlineWidthMultiplyTexture=(E=t.outlineWidthMultiplyTexture)!=null?E:null,this.outlineWidthFactor=t.outlineWidthFactor,this.outlineColorFactor.copy(t.outlineColorFactor),this.outlineLightingMixFactor=t.outlineLightingMixFactor,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.uvAnimationMaskTexture=(p=t.uvAnimationMaskTexture)!=null?p:null,this.shadeColorNode=(M=t.shadeColorNode)!=null?M:null,this.shadingShiftNode=(x=t.shadingShiftNode)!=null?x:null,this.shadingToonyNode=(S=t.shadingToonyNode)!=null?S:null,this.rimLightingMixNode=(F=t.rimLightingMixNode)!=null?F:null,this.rimMultiplyNode=(y=t.rimMultiplyNode)!=null?y:null,this.matcapNode=(C=t.matcapNode)!=null?C:null,this.parametricRimColorNode=(_=t.parametricRimColorNode)!=null?_:null,this.parametricRimLiftNode=(L=t.parametricRimLiftNode)!=null?L:null,this.parametricRimFresnelPowerNode=(w=t.parametricRimFresnelPowerNode)!=null?w:null,this.isOutline=(P=t.isOutline)!=null?P:null,super.copy(t)}update(t){this.uvAnimationScrollXOffset+=t*this.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYOffset+=t*this.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationPhase+=t*this.uvAnimationRotationSpeedFactor}_setupShadeColorNode(){if(this.shadeColorNode!=null)return i.vec3(this.shadeColorNode);let t=ot;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let e=W.context({getUV:()=>this._animatedUVNode});t=t.mul(e)}return t}_setupShadingShiftNode(){if(this.shadingShiftNode!=null)return i.float(this.shadingShiftNode);let t=rt;if(this.shadingShiftTexture&&this.shadingShiftTexture.isTexture===!0){let e=W.context({getUV:()=>this._animatedUVNode});t=t.add(e.mul(at))}return t}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):lt}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):nt}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?st.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?ut.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(mt):i.vec3(0)}_setupParametricRimNode(){let t=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):ht,e=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):dt,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):ct;return xt({parametricRimLift:e,parametricRimFresnelPower:o,parametricRimColor:t})}};
|
|
3
3
|
/*!
|
|
4
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
4
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
5
5
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6
6
|
*
|
|
7
7
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.0.0
|
|
2
|
+
* @pixiv/three-vrm v3.0.0
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -473,7 +473,7 @@ export {
|
|
|
473
473
|
MToonNodeMaterial
|
|
474
474
|
};
|
|
475
475
|
/*!
|
|
476
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
476
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
477
477
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
478
478
|
*
|
|
479
479
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
|
|
2
2
|
import*as V from"three";import*as n from"three/webgpu";import*as r from"three/webgpu";import*as a from"three/webgpu";import*as s from"three/webgpu";import*as i from"three/webgpu";import*as h from"three/webgpu";var w=parseInt(V.REVISION,10);w<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${w}). This would not work correctly.`);var b=r.materialReference("color","color"),I=r.materialReference("map","texture"),D=r.materialReference("normalMap","texture"),k=r.materialReference("normalScale","vec2"),Y=r.materialReference("emissive","color"),X=r.materialReference("emissiveIntensity","float"),z=r.materialReference("emissiveMap","texture"),B=r.materialReference("shadeColorFactor","color"),j=r.materialReference("shadingShiftFactor","float"),P=r.materialReference("shadeMultiplyTexture","texture"),q=r.materialReference("shadeMultiplyTextureScale","float"),K=r.materialReference("shadingToonyFactor","float"),Z=r.materialReference("rimLightingMixFactor","float"),$=r.materialReference("rimMultiplyTexture","texture"),G=r.materialReference("matcapFactor","color"),J=r.materialReference("matcapTexture","texture"),Q=r.materialReference("parametricRimColorFactor","color"),tt=r.materialReference("parametricRimLiftFactor","float"),et=r.materialReference("parametricRimFresnelPowerFactor","float"),it=r.materialReference("outlineWidthMultiplyTexture","texture"),ot=r.materialReference("outlineWidthFactor","float"),A=r.materialReference("outlineColorFactor","color"),rt=r.materialReference("outlineLightingMixFactor","float"),at=r.materialReference("uvAnimationMaskTexture","texture"),lt=r.materialReference("uvAnimationScrollXOffset","float"),nt=r.materialReference("uvAnimationScrollYOffset","float"),st=r.materialReference("uvAnimationRotationPhase","float"),mt=class extends n.TempNode{constructor(t){super("vec2"),this.hasMaskTexture=t}setup(){let t=1;this.hasMaskTexture&&(t=n.vec4(at).context({getUV:()=>n.uv()}).r);let e=n.uv(),o=st.mul(t),l=n.cos(o),m=n.sin(o);e=e.sub(n.vec2(.5,.5)),e=e.mul(n.mat2(l,m,m.negate(),l)),e=e.add(n.vec2(.5,.5));let u=n.vec2(lt,nt).mul(t);return e=e.add(u),e.temp("AnimatedUV")}},W=s.nodeImmutable(s.PropertyNode,"vec3").temp("ShadeColor"),O=s.nodeImmutable(s.PropertyNode,"float").temp("ShadingShift"),U=s.nodeImmutable(s.PropertyNode,"float").temp("ShadingToony"),R=s.nodeImmutable(s.PropertyNode,"float").temp("RimLightingMix"),T=s.nodeImmutable(s.PropertyNode,"vec3").temp("RimMultiply"),v=s.nodeImmutable(s.PropertyNode,"vec3").temp("matcap"),N=s.nodeImmutable(s.PropertyNode,"vec3").temp("ParametricRim"),ut=a.tslFn(({a:t,b:e,t:o})=>{let l=o.sub(t),m=e.sub(t);return l.div(m).clamp()}),ht=a.tslFn(({dotNL:t})=>{let o=a.float(1).sub(U),l=t.add(O);return l=ut({a:o.negate(),b:o,t:l}),l=l.mul(1),l}),dt=a.tslFn(({shading:t,lightColor:e})=>{let o=a.mix(W,a.diffuseColor,t);return e.mul(a.BRDF_Lambert({diffuseColor:o}))}),ct=class extends a.LightingModel{constructor(){super()}direct({lightDirection:t,lightColor:e,reflectedLight:o}){let l=a.transformedNormalView.dot(t).clamp(-1,1),m=ht({dotNL:l});o.directDiffuse.assign(o.directDiffuse.add(dt({shading:m,lightColor:e}))),o.directSpecular.assign(o.directSpecular.add(N.add(v).mul(T).mul(a.mix(a.vec3(0),a.BRDF_Lambert({diffuseColor:e}),R))))}indirect(t){this.indirectDiffuse(t),this.indirectSpecular(t)}indirectDiffuse({irradiance:t,reflectedLight:e}){e.indirectDiffuse.assign(e.indirectDiffuse.add(t.mul(a.BRDF_Lambert({diffuseColor:a.diffuseColor}))))}indirectSpecular({reflectedLight:t}){t.indirectSpecular.assign(t.indirectSpecular.add(N.add(v).mul(T).mul(a.mix(a.vec3(1),a.vec3(0),R))))}},E={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},pt=h.tslFn(({parametricRimLift:t,parametricRimFresnelPower:e,parametricRimColor:o})=>{let l=h.modelViewPosition.normalize(),m=h.transformedNormalView.dot(l.negate());return h.float(1).sub(m).add(t).clamp().pow(e).mul(o)}),Et=class extends i.NodeMaterial{customProgramCacheKey(){let t=super.customProgramCacheKey();return t+=`isOutline:${this.isOutline},`,t}get isMToonNodeMaterial(){return!0}constructor(t={}){super(),t.transparentWithZWrite&&(t.depthWrite=!0),delete t.transparentWithZWrite,delete t.giEqualizationFactor,delete t.v0CompatShade,delete t.debugMode,this.emissiveNode=null,this.lights=!0,this.color=new i.Color(1,1,1),this.map=null,this.emissive=new i.Color(0,0,0),this.emissiveIntensity=1,this.emissiveMap=null,this.normalMap=null,this.normalScale=new i.Vector2(1,1),this.shadeColorFactor=new i.Color(0,0,0),this.shadeMultiplyTexture=null,this.shadingShiftFactor=0,this.shadingShiftTexture=null,this.shadingShiftTextureScale=1,this.shadingToonyFactor=.9,this.rimLightingMixFactor=1,this.rimMultiplyTexture=null,this.matcapFactor=new i.Color(1,1,1),this.matcapTexture=null,this.parametricRimColorFactor=new i.Color(0,0,0),this.parametricRimLiftFactor=0,this.parametricRimFresnelPowerFactor=5,this.outlineWidthMode=E.None,this.outlineWidthMultiplyTexture=null,this.outlineWidthFactor=0,this.outlineColorFactor=new i.Color(0,0,0),this.outlineLightingMixFactor=1,this.uvAnimationScrollXSpeedFactor=0,this.uvAnimationScrollYSpeedFactor=0,this.uvAnimationRotationSpeedFactor=0,this.uvAnimationMaskTexture=null,this.shadeColorNode=null,this.shadingShiftNode=null,this.shadingToonyNode=null,this.rimLightingMixNode=null,this.rimMultiplyNode=null,this.matcapNode=null,this.parametricRimColorNode=null,this.parametricRimLiftNode=null,this.parametricRimFresnelPowerNode=null,this.uvAnimationScrollXOffset=0,this.uvAnimationScrollYOffset=0,this.uvAnimationRotationPhase=0,this.isOutline=!1,this._animatedUVNode=null,this.setValues(t)}setupLightingModel(){return new ct}setup(t){var e;this._animatedUVNode=new mt((e=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?e:!1),super.setup(t)}setupDiffuseColor(t){let e=null;if(this.colorNode==null){if(e=b,this.map&&this.map.isTexture===!0){let o=I.context({getUV:()=>this._animatedUVNode});e=e.mul(o)}this.colorNode=e}this.vertexColors===!0&&t.geometry.hasAttribute("color")&&(console.warn("MToonNodeMaterial: MToon ignores vertex colors. Consider using a model without vertex colors instead."),this.vertexColors=!1),super.setupDiffuseColor(t),parseInt(i.REVISION,10)<166&&this.transparent===!1&&this.blending===i.NormalBlending&&this.alphaToCoverage===!1&&i.diffuseColor.a.assign(1),this.colorNode===e&&(this.colorNode=null)}setupVariants(){W.assign(this._setupShadeColorNode()),O.assign(this._setupShadingShiftNode()),U.assign(this._setupShadingToonyNode()),R.assign(this._setupRimLightingMixNode()),T.assign(this._setupRimMultiplyNode()),v.assign(this._setupMatcapNode()),N.assign(this._setupParametricRimNode())}setupNormal(t){let e=this.normalNode;if(this.normalNode==null){if(this.normalNode=i.materialNormal,this.normalMap&&this.normalMap.isTexture===!0){let o=D.context({getUV:()=>this._animatedUVNode});this.normalNode=o.normalMap(k)}this.isOutline&&(this.normalNode=this.normalNode.negate())}super.setupNormal(t),this.normalNode=e}setupLighting(t){let e=null;if(this.emissiveNode==null){if(e=Y.mul(X),this.emissiveMap&&this.emissiveMap.isTexture===!0){let l=z.context({getUV:()=>this._animatedUVNode});e=e.mul(l)}this.emissiveNode=e}let o=super.setupLighting(t);return this.emissiveNode===e&&(this.emissiveNode=null),o}setupOutput(t,e){return this.isOutline&&this.outlineWidthMode!==E.None&&(e=i.vec4(i.mix(A,e.xyz.mul(A),rt),e.w)),super.setupOutput(t,e)}setupPosition(t){var e,o;let l=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==E.None){(e=this.positionNode)!=null||(this.positionNode=i.positionLocal);let u=i.normalLocal.normalize(),d=ot;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let c=it.context({getUV:()=>this._animatedUVNode});d=d.mul(c)}let f=i.length(i.modelNormalMatrix.mul(u)),p=d.mul(f).mul(u);if(this.outlineWidthMode===E.WorldCoordinates)this.positionNode=this.positionNode.add(p);else if(this.outlineWidthMode===E.ScreenCoordinates){let c=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(p.div(c).mul(i.positionView.z.negate()))}(o=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let m=super.setupPosition(t);return m.z.add(m.w.mul(1e-6)),this.positionNode=l,m}copy(t){var e,o,l,m,u,d,f,p,c,g,H,M,x,S,F,y,C,_,L;return this.color.copy(t.color),this.map=(e=t.map)!=null?e:null,this.emissive.copy(t.emissive),this.emissiveIntensity=t.emissiveIntensity,this.emissiveMap=(o=t.emissiveMap)!=null?o:null,this.normalMap=(l=t.normalMap)!=null?l:null,this.normalScale.copy(t.normalScale),this.shadeColorFactor.copy(t.shadeColorFactor),this.shadeMultiplyTexture=(m=t.shadeMultiplyTexture)!=null?m:null,this.shadingShiftFactor=t.shadingShiftFactor,this.shadingShiftTexture=(u=t.shadingShiftTexture)!=null?u:null,this.shadingShiftTextureScale=t.shadingShiftTextureScale,this.shadingToonyFactor=t.shadingToonyFactor,this.rimLightingMixFactor=t.rimLightingMixFactor,this.rimMultiplyTexture=(d=t.rimMultiplyTexture)!=null?d:null,this.matcapFactor.copy(t.matcapFactor),this.matcapTexture=(f=t.matcapTexture)!=null?f:null,this.parametricRimColorFactor.copy(t.parametricRimColorFactor),this.parametricRimLiftFactor=t.parametricRimLiftFactor,this.parametricRimFresnelPowerFactor=t.parametricRimFresnelPowerFactor,this.outlineWidthMode=t.outlineWidthMode,this.outlineWidthMultiplyTexture=(p=t.outlineWidthMultiplyTexture)!=null?p:null,this.outlineWidthFactor=t.outlineWidthFactor,this.outlineColorFactor.copy(t.outlineColorFactor),this.outlineLightingMixFactor=t.outlineLightingMixFactor,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.uvAnimationMaskTexture=(c=t.uvAnimationMaskTexture)!=null?c:null,this.shadeColorNode=(g=t.shadeColorNode)!=null?g:null,this.shadingShiftNode=(H=t.shadingShiftNode)!=null?H:null,this.shadingToonyNode=(M=t.shadingToonyNode)!=null?M:null,this.rimLightingMixNode=(x=t.rimLightingMixNode)!=null?x:null,this.rimMultiplyNode=(S=t.rimMultiplyNode)!=null?S:null,this.matcapNode=(F=t.matcapNode)!=null?F:null,this.parametricRimColorNode=(y=t.parametricRimColorNode)!=null?y:null,this.parametricRimLiftNode=(C=t.parametricRimLiftNode)!=null?C:null,this.parametricRimFresnelPowerNode=(_=t.parametricRimFresnelPowerNode)!=null?_:null,this.isOutline=(L=t.isOutline)!=null?L:null,super.copy(t)}update(t){this.uvAnimationScrollXOffset+=t*this.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYOffset+=t*this.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationPhase+=t*this.uvAnimationRotationSpeedFactor}_setupShadeColorNode(){if(this.shadeColorNode!=null)return i.vec3(this.shadeColorNode);let t=B;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let e=P.context({getUV:()=>this._animatedUVNode});t=t.mul(e)}return t}_setupShadingShiftNode(){if(this.shadingShiftNode!=null)return i.float(this.shadingShiftNode);let t=j;if(this.shadingShiftTexture&&this.shadingShiftTexture.isTexture===!0){let e=P.context({getUV:()=>this._animatedUVNode});t=t.add(e.mul(q))}return t}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):K}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):Z}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?$.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?J.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(G):i.vec3(0)}_setupParametricRimNode(){let t=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):Q,e=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):tt,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):et;return pt({parametricRimLift:e,parametricRimFresnelPower:o,parametricRimColor:t})}};export{mt as MToonAnimatedUVNode,ct as MToonLightingModel,Et as MToonNodeMaterial};
|
|
3
3
|
/*!
|
|
4
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
4
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
5
5
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6
6
|
*
|
|
7
7
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/three-vrm.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.0.0
|
|
2
|
+
* @pixiv/three-vrm v3.0.0
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6133,7 +6133,7 @@ VRMUtils.removeUnnecessaryJoints = removeUnnecessaryJoints;
|
|
|
6133
6133
|
VRMUtils.removeUnnecessaryVertices = removeUnnecessaryVertices;
|
|
6134
6134
|
VRMUtils.rotateVRM0 = rotateVRM0;
|
|
6135
6135
|
/*!
|
|
6136
|
-
* @pixiv/three-vrm-core v3.0.0
|
|
6136
|
+
* @pixiv/three-vrm-core v3.0.0
|
|
6137
6137
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
6138
6138
|
*
|
|
6139
6139
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6141,7 +6141,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6141
6141
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6142
6142
|
*/
|
|
6143
6143
|
/*!
|
|
6144
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
6144
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
6145
6145
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6146
6146
|
*
|
|
6147
6147
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6149,7 +6149,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6149
6149
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6150
6150
|
*/
|
|
6151
6151
|
/*!
|
|
6152
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
6152
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
6153
6153
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
6154
6154
|
*
|
|
6155
6155
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6157,7 +6157,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6157
6157
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6158
6158
|
*/
|
|
6159
6159
|
/*!
|
|
6160
|
-
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
6160
|
+
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
6161
6161
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
6162
6162
|
*
|
|
6163
6163
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6165,7 +6165,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6165
6165
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6166
6166
|
*/
|
|
6167
6167
|
/*!
|
|
6168
|
-
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
6168
|
+
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
6169
6169
|
* Node constraint module for @pixiv/three-vrm
|
|
6170
6170
|
*
|
|
6171
6171
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6173,7 +6173,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6173
6173
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6174
6174
|
*/
|
|
6175
6175
|
/*!
|
|
6176
|
-
* @pixiv/three-vrm-springbone v3.0.0
|
|
6176
|
+
* @pixiv/three-vrm-springbone v3.0.0
|
|
6177
6177
|
* Spring bone module for @pixiv/three-vrm
|
|
6178
6178
|
*
|
|
6179
6179
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/three-vrm.min.cjs
CHANGED
|
@@ -928,7 +928,7 @@ void main() {
|
|
|
928
928
|
`)+`
|
|
929
929
|
`;n.vertexShader=r+n.vertexShader,n.fragmentShader=r+n.fragmentShader,i<154&&(n.fragmentShader=n.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){let t=parseInt(P.REVISION,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_WORLD:this._isOutline&&this._outlineWidthMode===ze.WorldCoordinates,OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===ze.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},ro=new Set(["1.0","1.0-beta"]),ai=class je{get name(){return je.EXTENSION_NAME}constructor(e,n={}){var i,r,s,a;this.parser=e,this.materialType=(i=n.materialType)!=null?i:si,this.renderOrderOffset=(r=n.renderOrderOffset)!=null?r:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ne(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ne(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){let i=this._getMToonExtension(e);return i?this._extendMaterialParams(i,n):null}loadMesh(e){return ne(this,null,function*(){var n;let i=this.parser,s=(n=i.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);let a=s.primitives,l=yield i.loadMesh(e);if(a.length===1){let o=l,u=a[0].material;u!=null&&this._setupPrimitive(o,u)}else{let o=l;for(let u=0;u<a.length;u++){let d=o.children[u],c=a[u].material;c!=null&&this._setupPrimitive(d,c)}}return l})}_removeUnlitExtensionIfMToonExists(){let i=this.parser.json.materials;i==null||i.map((r,s)=>{var a;this._getMToonExtension(s)&&((a=r.extensions)!=null&&a.KHR_materials_unlit)&&delete r.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,i;let a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}let l=(i=a.extensions)==null?void 0:i[je.EXTENSION_NAME];if(l==null)return;let o=l.specVersion;if(!ro.has(o)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${je.EXTENSION_NAME} specVersion "${o}"`);return}return l}_extendMaterialParams(e,n){return ne(this,null,function*(){var i;delete n.metalness,delete n.roughness;let r=new eo(this.parser,n);r.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),r.assignColor("shadeColorFactor",e.shadeColorFactor),r.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),r.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),r.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),r.assignPrimitive("shadingShiftTextureScale",(i=e.shadingShiftTexture)==null?void 0:i.scale),r.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),r.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),r.assignColor("matcapFactor",e.matcapFactor),r.assignTexture("matcapTexture",e.matcapTexture,!0),r.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),r.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),r.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),r.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),r.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),r.assignPrimitive("outlineWidthMode",e.outlineWidthMode),r.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),r.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),r.assignColor("outlineColorFactor",e.outlineColorFactor),r.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),r.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),r.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),r.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),r.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),r.assignPrimitive("v0CompatShade",this.v0CompatShade),r.assignPrimitive("debugMode",this.debugMode),yield r.pending})}_setupPrimitive(e,n){let i=this._getMToonExtension(n);if(i){let r=this._parseRenderOrder(i);e.renderOrder=r+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){let n=e.material;if(!(n instanceof Ge.Material)||!this._shouldGenerateOutline(n))return;e.material=[n];let i=n.clone();i.name+=" (Outline)",i.isOutline=!0,i.side=Ge.BackSide,e.material.push(i);let r=e.geometry,s=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,s,0),r.addGroup(0,s,1)}_addToMaterialSet(e){let n=e.material,i=new Set;Array.isArray(n)?n.forEach(r=>i.add(r)):i.add(n);for(let r of i)this._mToonMaterialSet.add(r)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};ai.EXTENSION_NAME="VRMC_materials_mtoon";var Mt=ai;var oo=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),li=class Rt{get name(){return Rt.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return oo(this,null,function*(){let i=this._getHDREmissiveMultiplierExtension(e);if(i==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");let r=i.emissiveMultiplier;n.emissiveIntensity=r})}_getHDREmissiveMultiplierExtension(e){var n,i;let a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}let l=(i=a.extensions)==null?void 0:i[Rt.EXTENSION_NAME];if(l!=null)return l}};li.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var ui=li;var pi=M(require("three"),1);var so=Object.defineProperty,ao=Object.defineProperties,lo=Object.getOwnPropertyDescriptors,di=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,ho=Object.prototype.propertyIsEnumerable,hi=(t,e,n)=>e in t?so(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,W=(t,e)=>{for(var n in e||(e={}))uo.call(e,n)&&hi(t,n,e[n]);if(di)for(var n of di(e))ho.call(e,n)&&hi(t,n,e[n]);return t},ci=(t,e)=>ao(t,lo(e)),co=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())});function ce(t){return Math.pow(t,2.2)}var mi=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;let n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return co(this,null,function*(){var t;let e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,i=n==null?void 0:n.materialProperties;i&&(this._populateRenderQueueMap(i),i.forEach((r,s)=>{var a,l;let o=(a=e.materials)==null?void 0:a[s];if(o==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(r.shader==="VRM/MToon"){let u=this._parseV0MToonProperties(r,o);e.materials[s]=u}else if((l=r.shader)!=null&&l.startsWith("VRM/Unlit")){let u=this._parseV0UnlitProperties(r,o);e.materials[s]=u}else r.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${r.shader}`)}))})}_parseV0MToonProperties(t,e){var n,i,r,s,a,l,o,u,d,c,f,p,m,h,_,g,y,x,v,T,E,R,L,U,H,b,C,fe,Vt,It,Ut,Ct,Ot,Nt,Dt,Bt,Ft,Wt,kt,zt,jt,Gt,Qt,qt,Xt,Yt,$t,Zt,Jt,Kt,en,tn,nn,rn,on;let sn=(i=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?i:!1,Bi=((r=t.floatProperties)==null?void 0:r._ZWrite)===1&&sn,Fi=this._v0ParseRenderQueue(t),an=(a=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?a:!1,Wi=sn?"BLEND":an?"MASK":"OPAQUE",ki=an?(o=(l=t.floatProperties)==null?void 0:l._Cutoff)!=null?o:.5:void 0,zi=((d=(u=t.floatProperties)==null?void 0:u._CullMode)!=null?d:2)===0,K=this._portTextureTransform(t),ji=((f=(c=t.vectorProperties)==null?void 0:c._Color)!=null?f:[1,1,1,1]).map((_n,mr)=>mr===3?_n:ce(_n)),ln=(p=t.textureProperties)==null?void 0:p._MainTex,Gi=ln!=null?{index:ln,extensions:W({},K)}:void 0,Qi=(h=(m=t.floatProperties)==null?void 0:m._BumpScale)!=null?h:1,un=(_=t.textureProperties)==null?void 0:_._BumpMap,qi=un!=null?{index:un,scale:Qi,extensions:W({},K)}:void 0,Xi=((y=(g=t.vectorProperties)==null?void 0:g._EmissionColor)!=null?y:[0,0,0,1]).map(ce),dn=(x=t.textureProperties)==null?void 0:x._EmissionMap,Yi=dn!=null?{index:dn,extensions:W({},K)}:void 0,$i=((T=(v=t.vectorProperties)==null?void 0:v._ShadeColor)!=null?T:[.97,.81,.86,1]).map(ce),hn=(E=t.textureProperties)==null?void 0:E._ShadeTexture,Zi=hn!=null?{index:hn,extensions:W({},K)}:void 0,Pe=(L=(R=t.floatProperties)==null?void 0:R._ShadeShift)!=null?L:0,Se=(H=(U=t.floatProperties)==null?void 0:U._ShadeToony)!=null?H:.9;Se=pi.MathUtils.lerp(Se,1,.5+.5*Pe),Pe=-Pe-(1-Se);let cn=(C=(b=t.floatProperties)==null?void 0:b._IndirectLightIntensity)!=null?C:.1,Ji=cn?1-cn:void 0,Ke=(fe=t.textureProperties)==null?void 0:fe._SphereAdd,Ki=Ke!=null?[1,1,1]:void 0,er=Ke!=null?{index:Ke}:void 0,tr=(It=(Vt=t.floatProperties)==null?void 0:Vt._RimLightingMix)!=null?It:0,pn=(Ut=t.textureProperties)==null?void 0:Ut._RimTexture,nr=pn!=null?{index:pn,extensions:W({},K)}:void 0,ir=((Ot=(Ct=t.vectorProperties)==null?void 0:Ct._RimColor)!=null?Ot:[0,0,0,1]).map(ce),rr=(Dt=(Nt=t.floatProperties)==null?void 0:Nt._RimFresnelPower)!=null?Dt:1,or=(Ft=(Bt=t.floatProperties)==null?void 0:Bt._RimLift)!=null?Ft:0,sr=["none","worldCoordinates","screenCoordinates"][(kt=(Wt=t.floatProperties)==null?void 0:Wt._OutlineWidthMode)!=null?kt:0],et=(jt=(zt=t.floatProperties)==null?void 0:zt._OutlineWidth)!=null?jt:0;et=.01*et;let mn=(Gt=t.textureProperties)==null?void 0:Gt._OutlineWidthTexture,ar=mn!=null?{index:mn,extensions:W({},K)}:void 0,lr=((qt=(Qt=t.vectorProperties)==null?void 0:Qt._OutlineColor)!=null?qt:[0,0,0]).map(ce),ur=((Yt=(Xt=t.floatProperties)==null?void 0:Xt._OutlineColorMode)!=null?Yt:0)===1?(Zt=($t=t.floatProperties)==null?void 0:$t._OutlineLightingMix)!=null?Zt:1:0,fn=(Jt=t.textureProperties)==null?void 0:Jt._UvAnimMaskTexture,dr=fn!=null?{index:fn,extensions:W({},K)}:void 0,hr=(en=(Kt=t.floatProperties)==null?void 0:Kt._UvAnimScrollX)!=null?en:0,Ae=(nn=(tn=t.floatProperties)==null?void 0:tn._UvAnimScrollY)!=null?nn:0;Ae!=null&&(Ae=-Ae);let cr=(on=(rn=t.floatProperties)==null?void 0:rn._UvAnimRotation)!=null?on:0,pr={specVersion:"1.0",transparentWithZWrite:Bi,renderQueueOffsetNumber:Fi,shadeColorFactor:$i,shadeMultiplyTexture:Zi,shadingShiftFactor:Pe,shadingToonyFactor:Se,giEqualizationFactor:Ji,matcapFactor:Ki,matcapTexture:er,rimLightingMixFactor:tr,rimMultiplyTexture:nr,parametricRimColorFactor:ir,parametricRimFresnelPowerFactor:rr,parametricRimLiftFactor:or,outlineWidthMode:sr,outlineWidthFactor:et,outlineWidthMultiplyTexture:ar,outlineColorFactor:lr,outlineLightingMixFactor:ur,uvAnimationMaskTexture:dr,uvAnimationScrollXSpeedFactor:hr,uvAnimationScrollYSpeedFactor:Ae,uvAnimationRotationSpeedFactor:cr};return ci(W({},e),{pbrMetallicRoughness:{baseColorFactor:ji,baseColorTexture:Gi},normalTexture:qi,emissiveTexture:Yi,emissiveFactor:Xi,alphaMode:Wi,alphaCutoff:ki,doubleSided:zi,extensions:{VRMC_materials_mtoon:pr}})}_parseV0UnlitProperties(t,e){var n,i,r,s,a;let l=t.shader==="VRM/UnlitTransparentZWrite",o=t.shader==="VRM/UnlitTransparent"||l,u=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",c=o?"BLEND":d?"MASK":"OPAQUE",f=d?(i=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?i:.5:void 0,p=this._portTextureTransform(t),m=((s=(r=t.vectorProperties)==null?void 0:r._Color)!=null?s:[1,1,1,1]).map(ce),h=(a=t.textureProperties)==null?void 0:a._MainTex,_=h!=null?{index:h,extensions:W({},p)}:void 0,g={specVersion:"1.0",transparentWithZWrite:l,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:_};return ci(W({},e),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:_},alphaMode:c,alphaCutoff:f,extensions:{VRMC_materials_mtoon:g}})}_portTextureTransform(t){var e,n,i,r,s;let a=(e=t.vectorProperties)==null?void 0:e._MainTex;if(a==null)return{};let l=[(n=a==null?void 0:a[0])!=null?n:0,(i=a==null?void 0:a[1])!=null?i:0],o=[(r=a==null?void 0:a[2])!=null?r:1,(s=a==null?void 0:a[3])!=null?s:1];return l[1]=1-o[1]-l[1],{KHR_texture_transform:{offset:l,scale:o}}}_v0ParseRenderQueue(t){var e,n,i;let r=(n=(e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null?n:!1,s=((i=t.floatProperties)==null?void 0:i._ZWrite)===1,a=0;if(r){let l=t.renderQueue;l!=null&&(s?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(t){let e=new Set,n=new Set;t.forEach(i=>{var r,s,a;let l=(s=(r=i.keywordMap)==null?void 0:r._ALPHABLEND_ON)!=null?s:!1,o=((a=i.floatProperties)==null?void 0:a._ZWrite)===1;if(l){let u=i.renderQueue;u!=null&&(o?n.add(u):e.add(u))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((i,r)=>{let s=Math.min(Math.max(r-e.size+1,-9),0);this._renderQueueMapTransparent.set(i,s)}),Array.from(n).sort().forEach((i,r)=>{let s=Math.min(Math.max(r,0),9);this._renderQueueMapTransparentZWrite.set(i,s)})}};var O=M(require("three"),1),k=M(require("three"),1),Tt=M(require("three"),1),Re=M(require("three"),1),G=M(require("three"),1);var fi=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),$=new O.Vector3,Qe=class extends O.Group{constructor(t){super(),this._attrPosition=new O.BufferAttribute(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(O.DynamicDrawUsage);let e=new O.BufferGeometry;e.setAttribute("position",this._attrPosition);let n=new O.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new O.Line(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){$.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,$.x,$.y,$.z),this.constraint.source&&$.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,$.x,$.y,$.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function _i(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var po=new Tt.Vector3,mo=new Tt.Vector3;function fo(t,e){return t.decompose(po,e,mo),e}function qe(t){return t.invert?t.invert():t.inverse(),t}var Xe=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},_o=new k.Vector3,go=new k.Vector3,vo=new k.Vector3,Eo=new k.Quaternion,Mo=new k.Quaternion,Ro=new k.Quaternion,gi=class extends Xe{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){let t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new k.Vector3(1,0,0),this._dstRestQuat=new k.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);let t=Eo.identity(),e=Mo.identity();this.destination.parent&&(fo(this.destination.parent.matrixWorld,t),qe(e.copy(t)));let n=_o.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),i=_i(this.source.matrixWorld,go).sub(_i(this.destination.matrixWorld,vo)).normalize(),r=Ro.setFromUnitVectors(n,i).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}};function To(t,e){let n=[t],i=t.parent;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}var vi=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){let t=new Set,e=new Set;for(let n of this._constraints)this._processConstraint(n,t,e,i=>i.setInitState())}update(){let t=new Set,e=new Set;for(let n of this._constraints)this._processConstraint(n,t,e,i=>i.update())}_processConstraint(t,e,n,i){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);let r=t.dependencies;for(let s of r)To(s,a=>{let l=this._objectConstraintsMap.get(a);if(l)for(let o of l)this._processConstraint(o,e,n,i)});i(t),n.add(t)}},xo=new Re.Quaternion,yo=new Re.Quaternion,Ei=class extends Xe{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Re.Quaternion,this._invSrcRestQuat=new Re.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),qe(this._invSrcRestQuat.copy(this.source.quaternion))}update(){let t=xo.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=yo.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},wo=new G.Vector3,Po=new G.Quaternion,So=new G.Quaternion,Mi=class extends Xe{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new G.Vector3(1,0,0),this._dstRestQuat=new G.Quaternion,this._invDstRestQuat=new G.Quaternion,this._invSrcRestQuatMulDstRestQuat=new G.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),qe(this._invDstRestQuat.copy(this._dstRestQuat)),qe(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){let t=Po.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=wo.copy(this._v3RollAxis).applyQuaternion(t),i=So.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}},Ao=new Set(["1.0","1.0-beta"]),Ri=class Me{get name(){return Me.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return fi(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return fi(this,null,function*(){var n;let i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf(Me.EXTENSION_NAME))!==-1))return null;let s=new vi,a=yield this.parser.getDependencies("node");return a.forEach((l,o)=>{var u;let d=i.nodes[o],c=(u=d==null?void 0:d.extensions)==null?void 0:u[Me.EXTENSION_NAME];if(c==null)return;let f=c.specVersion;if(!Ao.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Me.EXTENSION_NAME} specVersion "${f}"`);return}let p=c.constraint;if(p.roll!=null){let m=this._importRollConstraint(l,a,p.roll);s.addConstraint(m)}else if(p.aim!=null){let m=this._importAimConstraint(l,a,p.aim);s.addConstraint(m)}else if(p.rotation!=null){let m=this._importRotationConstraint(l,a,p.rotation);s.addConstraint(m)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,i){let{source:r,rollAxis:s,weight:a}=i,l=n[r],o=new Mi(e,l);if(s!=null&&(o.rollAxis=s),a!=null&&(o.weight=a),this.helperRoot){let u=new Qe(o);this.helperRoot.add(u)}return o}_importAimConstraint(e,n,i){let{source:r,aimAxis:s,weight:a}=i,l=n[r],o=new gi(e,l);if(s!=null&&(o.aimAxis=s),a!=null&&(o.weight=a),this.helperRoot){let u=new Qe(o);this.helperRoot.add(u)}return o}_importRotationConstraint(e,n,i){let{source:r,weight:s}=i,a=n[r],l=new Ei(e,a);if(s!=null&&(l.weight=s),this.helperRoot){let o=new Qe(l);this.helperRoot.add(o)}return l}};Ri.EXTENSION_NAME="VRMC_node_constraint";var xt=Ri;var Z=M(require("three"),1),we=M(require("three"),1),yi=M(require("three"),1),q=M(require("three"),1),oe=M(require("three"),1),J=M(require("three"),1),se=M(require("three"),1),Pi=M(require("three"),1),I=M(require("three"),1),Si=M(require("three"),1),Li=M(require("three"),1),re=M(require("three"),1);var Ye=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),At=class{},yt=new we.Vector3,ie=new we.Vector3,Lt=class extends At{get type(){return"capsule"}constructor(t){var e,n,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new we.Vector3(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new we.Vector3(0,0,0),this.radius=(i=t==null?void 0:t.radius)!=null?i:0}calculateCollision(t,e,n,i){yt.copy(this.offset).applyMatrix4(t),ie.copy(this.tail).applyMatrix4(t),ie.sub(yt);let r=ie.lengthSq();i.copy(e).sub(yt);let s=ie.dot(i);s<=0||(r<=s||ie.multiplyScalar(s/r),i.sub(ie));let a=n+this.radius,l=i.length()-a;return i.normalize(),l}},Ht=class extends At{get type(){return"sphere"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new yi.Vector3(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e);let r=n+this.radius,s=i.length()-r;return i.normalize(),s}},z=new q.Vector3,Lo=class extends q.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new q.Vector3,this._currentTail=new q.Vector3,this._shape=t,this._attrPos=new q.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new q.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);let n=z.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){z.copy(this._currentTail).sub(this._currentOffset);let t=z.length()/this._currentRadius;for(let i=0;i<=16;i++){let r=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(r),-Math.cos(r),0),this._attrPos.setXYZ(17+i,t+Math.sin(r),Math.cos(r),0),this._attrPos.setXYZ(34+i,-Math.sin(r),0,-Math.cos(r)),this._attrPos.setXYZ(51+i,t+Math.sin(r),0,Math.cos(r))}for(let i=0;i<32;i++){let r=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(r),Math.cos(r)),this._attrPos.setXYZ(100+i,t,Math.sin(r),Math.cos(r))}let e=Math.atan2(z.y,Math.sqrt(z.x*z.x+z.z*z.z)),n=-Math.atan2(z.z,z.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){let e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},Ho=class extends oe.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new oe.Vector3,this._shape=t,this._attrPos=new oe.BufferAttribute(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new oe.BufferAttribute(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){let e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},bo=new Z.Vector3,wt=class extends Z.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof Ht)this._geometry=new Ho(this.collider.shape);else if(this.collider.shape instanceof Lt)this._geometry=new Lo(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");let e=new Z.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new Z.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);let e=this.matrix.elements;this._geometry.worldScale=bo.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},Vo=class extends se.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new se.Vector3,this._springBone=t,this._attrPos=new se.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new se.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){let e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},Io=new J.Vector3,wi=class extends J.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new Vo(this.springBone);let e=new J.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new J.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);let e=this.matrix.elements;this._geometry.worldScale=Io.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},Pt=class extends Pi.Object3D{constructor(t){super(),this.shape=t}},Uo=new Si.Matrix4;function Ai(t){return t.invert?t.invert():t.getInverse(Uo.copy(t)),t}var Co=class{constructor(t){this._inverseCache=new Li.Matrix4,this._shouldUpdateInverse=!0,this.matrix=t;let e={set:(n,i,r)=>(this._shouldUpdateInverse=!0,n[i]=r,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(Ai(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},Oo=new I.Matrix4,Q=new I.Vector3,Te=new I.Vector3,No=new I.Vector3,pe=new I.Vector3,Ti=new I.Vector3,xe=new I.Vector3,xi=new I.Quaternion,me=new I.Matrix4,Do=new I.Matrix4,Hi=class{constructor(t,e,n={},i=[]){this._currentTail=new I.Vector3,this._prevTail=new I.Vector3,this._boneAxis=new I.Vector3,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new I.Matrix4,this._initialLocalRotation=new I.Quaternion,this._initialLocalChildPosition=new I.Vector3;var r,s,a,l,o,u;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(r=n.hitRadius)!=null?r:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(a=n.gravityPower)!=null?a:0,gravityDir:(o=(l=n.gravityDir)==null?void 0:l.clone())!=null?o:new I.Vector3(0,-1,0),dragForce:(u=n.dragForce)!=null?u:.4},this.colliderGroups=i}get center(){return this._center}set center(t){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Co(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Oo}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);let t=this._getMatrixWorldToCenter(me);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);let t=this._getMatrixWorldToCenter(me);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength(),pe.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(me);Ti.copy(pe).applyMatrix4(e);let n=xi.setFromRotationMatrix(e),i=Do.copy(e).multiply(this._parentMatrixWorld),r=Te.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(Ti).normalize(),s=No.copy(this.settings.gravityDir).applyQuaternion(n).normalize(),a=this._getMatrixCenterToWorld(me);xe.copy(this._currentTail).add(Q.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Q.copy(r).multiplyScalar(this.settings.stiffness*t)).add(Q.copy(s).multiplyScalar(this.settings.gravityPower*t)).applyMatrix4(a),xe.sub(pe).normalize().multiplyScalar(this._worldSpaceBoneLength).add(pe),this._collision(xe),e=this._getMatrixWorldToCenter(me),this._prevTail.copy(this._currentTail),this._currentTail.copy(Q.copy(xe).applyMatrix4(e));let l=Ai(me.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),o=xi.setFromUnitVectors(this._boneAxis,Q.copy(xe).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(o),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(t){this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{let i=n.shape.calculateCollision(n.matrixWorld,t,this.settings.hitRadius,Q);i<0&&(t.add(Q.multiplyScalar(-i)),t.sub(pe).normalize().multiplyScalar(this._worldSpaceBoneLength).add(pe))})})}_calcWorldSpaceBoneLength(){Q.setFromMatrixPosition(this.bone.matrixWorld),this.child?Te.setFromMatrixPosition(this.child.matrixWorld):(Te.copy(this._initialLocalChildPosition),Te.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Q.sub(Te).length()}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}};function Bo(t,e){let n=[],i=t;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}function bi(t,e){t.children.forEach(n=>{e(n)||bi(n,e)})}var St=class{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){let t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){let t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t)}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){let t=new Set,e=new Set,n=new Set;for(let i of this._joints)this._processSpringBone(i,t,e,n,r=>r.setInitState())}reset(){let t=new Set,e=new Set,n=new Set;for(let i of this._joints)this._processSpringBone(i,t,e,n,r=>r.reset())}update(t){let e=new Set,n=new Set,i=new Set;for(let r of this._joints)this._processSpringBone(r,e,n,i,s=>s.update(t)),bi(r.bone,s=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(s))==null?void 0:a.size)!=null?l:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(t,e,n,i,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");e.add(t);let s=this._getDependencies(t);for(let a of s)Bo(a,l=>{let o=this._objectSpringBonesMap.get(l);if(o)for(let u of o)this._processSpringBone(u,e,n,i,r);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});t.bone.updateMatrix(),t.bone.updateWorldMatrix(!1,!1),r(t),i.add(t.bone),n.add(t)}_getDependencies(t){let e=new Set,n=t.bone.parent;return n&&e.add(n),t.colliderGroups.forEach(i=>{i.colliders.forEach(r=>{e.add(r)})}),e}},Fo=new Set(["1.0","1.0-beta"]),Vi=class ye{get name(){return ye.EXTENSION_NAME}constructor(e,n){this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot}afterRoot(e){return Ye(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return Ye(this,null,function*(){let n=yield this._v1Import(e);if(n!=null)return n;let i=yield this._v0Import(e);return i!=null?i:null})}_v1Import(e){return Ye(this,null,function*(){var n,i,r,s,a;let l=e.parser.json;if(!(((n=l.extensionsUsed)==null?void 0:n.indexOf(ye.EXTENSION_NAME))!==-1))return null;let u=new St,d=yield e.parser.getDependencies("node"),c=(i=l.extensions)==null?void 0:i[ye.EXTENSION_NAME];if(!c)return null;let f=c.specVersion;if(!Fo.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${ye.EXTENSION_NAME} specVersion "${f}"`),null;let p=(r=c.colliders)==null?void 0:r.map((h,_)=>{var g,y,x,v,T;let E=d[h.node],R=h.shape;if(R.sphere)return this._importSphereCollider(E,{offset:new re.Vector3().fromArray((g=R.sphere.offset)!=null?g:[0,0,0]),radius:(y=R.sphere.radius)!=null?y:0});if(R.capsule)return this._importCapsuleCollider(E,{offset:new re.Vector3().fromArray((x=R.capsule.offset)!=null?x:[0,0,0]),radius:(v=R.capsule.radius)!=null?v:0,tail:new re.Vector3().fromArray((T=R.capsule.tail)!=null?T:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape`)}),m=(s=c.colliderGroups)==null?void 0:s.map((h,_)=>{var g;return{colliders:((g=h.colliders)!=null?g:[]).map(x=>{let v=p==null?void 0:p[x];if(v==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${_} attempted to use a collider #${x} but not found`);return v}),name:h.name}});return(a=c.springs)==null||a.forEach((h,_)=>{var g;let y=h.joints,x=(g=h.colliderGroups)==null?void 0:g.map(E=>{let R=m==null?void 0:m[E];if(R==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to use a colliderGroup ${E} but not found`);return R}),v=h.center!=null?d[h.center]:void 0,T;y.forEach(E=>{if(T){let R=T.node,L=d[R],U=E.node,H=d[U],b={hitRadius:T.hitRadius,dragForce:T.dragForce,gravityPower:T.gravityPower,stiffness:T.stiffness,gravityDir:T.gravityDir!=null?new re.Vector3().fromArray(T.gravityDir):void 0},C=this._importJoint(L,H,b,x);v&&(C.center=v),u.addJoint(C)}T=E})}),u.setInitState(),u})}_v0Import(e){return Ye(this,null,function*(){var n,i,r;let s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;let l=(i=s.extensions)==null?void 0:i.VRM,o=l==null?void 0:l.secondaryAnimation;if(!o)return null;let u=o==null?void 0:o.boneGroups;if(!u)return null;let d=new St,c=yield e.parser.getDependencies("node"),f=(r=o.colliderGroups)==null?void 0:r.map(p=>{var m;let h=c[p.node];return{colliders:((m=p.colliders)!=null?m:[]).map((g,y)=>{var x,v,T;let E=new re.Vector3(0,0,0);return g.offset&&E.set((x=g.offset.x)!=null?x:0,(v=g.offset.y)!=null?v:0,g.offset.z?-g.offset.z:0),this._importSphereCollider(h,{offset:E,radius:(T=g.radius)!=null?T:0})})}});return u==null||u.forEach((p,m)=>{let h=p.bones;h&&h.forEach(_=>{var g,y,x,v;let T=c[_],E=new re.Vector3;p.gravityDir?E.set((g=p.gravityDir.x)!=null?g:0,(y=p.gravityDir.y)!=null?y:0,(x=p.gravityDir.z)!=null?x:0):E.set(0,-1,0);let R=p.center!=null?c[p.center]:void 0,L={hitRadius:p.hitRadius,dragForce:p.dragForce,gravityPower:p.gravityPower,stiffness:p.stiffiness,gravityDir:E},U=(v=p.colliderGroups)==null?void 0:v.map(H=>{let b=f==null?void 0:f[H];if(b==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${H} but not found`);return b});T.traverse(H=>{var b;let C=(b=H.children[0])!=null?b:null,fe=this._importJoint(H,C,L,U);R&&(fe.center=R),d.addJoint(fe)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,i,r){let s=new Hi(e,n,i,r);if(this.jointHelperRoot){let a=new wi(s);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){let{offset:i,radius:r}=n,s=new Ht({offset:i,radius:r}),a=new Pt(s);if(e.add(a),this.colliderHelperRoot){let l=new wt(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}_importCapsuleCollider(e,n){let{offset:i,radius:r,tail:s}=n,a=new Lt({offset:i,radius:r,tail:s}),l=new Pt(a);if(e.add(l),this.colliderHelperRoot){let o=new wt(l);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return l}};Vi.EXTENSION_NAME="VRMC_springBone";var bt=Vi;var $e=class{get name(){return"VRMLoaderPlugin"}constructor(e,n){var s,a,l,o,u,d,c,f,p,m;this.parser=e;let i=n==null?void 0:n.helperRoot,r=n==null?void 0:n.autoUpdateHumanBones;this.expressionPlugin=(s=n==null?void 0:n.expressionPlugin)!=null?s:new Oe(e),this.firstPersonPlugin=(a=n==null?void 0:n.firstPersonPlugin)!=null?a:new Ne(e),this.humanoidPlugin=(l=n==null?void 0:n.humanoidPlugin)!=null?l:new Be(e,{helperRoot:i,autoUpdateHumanBones:r}),this.lookAtPlugin=(o=n==null?void 0:n.lookAtPlugin)!=null?o:new Fe(e,{helperRoot:i}),this.metaPlugin=(u=n==null?void 0:n.metaPlugin)!=null?u:new We(e),this.mtoonMaterialPlugin=(d=n==null?void 0:n.mtoonMaterialPlugin)!=null?d:new Mt(e),this.materialsHDREmissiveMultiplierPlugin=(c=n==null?void 0:n.materialsHDREmissiveMultiplierPlugin)!=null?c:new ui(e),this.materialsV0CompatPlugin=(f=n==null?void 0:n.materialsV0CompatPlugin)!=null?f:new mi(e),this.springBonePlugin=(p=n==null?void 0:n.springBonePlugin)!=null?p:new bt(e,{colliderHelperRoot:i,jointHelperRoot:i}),this.nodeConstraintPlugin=(m=n==null?void 0:n.nodeConstraintPlugin)!=null?m:new xt(e,{helperRoot:i})}beforeRoot(){return _e(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return _e(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){let n=this.mtoonMaterialPlugin.getMaterialType(e);return n!=null?n:null}extendMaterialParams(e,n){return _e(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,n),yield this.mtoonMaterialPlugin.extendMaterialParams(e,n)})}afterRoot(e){return _e(this,null,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);let n=e.userData.vrmMeta,i=e.userData.vrmHumanoid;if(n&&i){let r=new he({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:i,lookAt:e.userData.vrmLookAt,meta:n,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=r}})}};function Ii(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){let e=t.uniforms;e&&Object.values(e).forEach(n=>{let i=n.value;i!=null&&i.isTexture&&i.dispose()})}t.dispose()}function Wo(t){let e=t.geometry;e&&e.dispose();let n=t.skeleton;n&&n.dispose();let i=t.material;i&&(Array.isArray(i)?i.forEach(r=>Ii(r)):i&&Ii(i))}function Ui(t){t.traverse(Wo)}var Ze=M(require("three"),1);function Ci(t,e){var a;let n=(a=e==null?void 0:e.experimentalSameBoneCounts)!=null?a:!1,i=[];t.traverse(l=>{l.type==="SkinnedMesh"&&i.push(l)});let r=new Map,s=0;for(let l of i){let u=l.geometry.getAttribute("skinIndex"),d=[],c=[],f={},p=u.array;for(let m=0;m<p.length;m++){let h=p[m];f[h]==null&&(f[h]=d.length,d.push(l.skeleton.bones[h]),c.push(l.skeleton.boneInverses[h])),p[m]=f[h]}u.copyArray(p),u.needsUpdate=!0,r.set(l,{bones:d,boneInverses:c}),s=Math.max(s,d.length)}for(let l of i){let{bones:o,boneInverses:u}=r.get(l);if(n)for(let c=o.length;c<s;c++)o[c]=o[0],u[c]=u[0];let d=new Ze.Skeleton(o,u);l.bind(d,new Ze.Matrix4)}}var Oi=M(require("three"),1),Je=require("three");function Ni(t){let e=new Map;t.traverse(n=>{var c,f,p,m;if(!n.isMesh)return;let i=n,r=i.geometry,s=r.index;if(s==null)return;let a=e.get(r);if(a!=null){i.geometry=a;return}let l=new Oi.BufferGeometry;l.name=r.name,l.morphTargetsRelative=r.morphTargetsRelative,r.groups.forEach(h=>{l.addGroup(h.start,h.count,h.materialIndex)}),l.boundingBox=(f=(c=r.boundingBox)==null?void 0:c.clone())!=null?f:null,l.boundingSphere=(m=(p=r.boundingSphere)==null?void 0:p.clone())!=null?m:null,l.setDrawRange(r.drawRange.start,r.drawRange.count),l.userData=r.userData,e.set(r,l);let o=[],u=[];{let h=s.array,_=new h.constructor(h.length),g=0;for(let y=0;y<h.length;y++){let x=h[y],v=o[x];v==null&&(o[x]=g,u[g]=x,v=g,g++),_[y]=v}l.setIndex(new Je.BufferAttribute(_,1,!1))}Object.keys(r.attributes).forEach(h=>{let _=r.attributes[h];if(_.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");let g=_.array,{itemSize:y,normalized:x}=_,v=new g.constructor(u.length*y);u.forEach((T,E)=>{for(let R=0;R<y;R++)v[E*y+R]=g[T*y+R]}),l.setAttribute(h,new Je.BufferAttribute(v,y,x))});let d=!0;Object.keys(r.morphAttributes).forEach(h=>{l.morphAttributes[h]=[];let _=r.morphAttributes[h];for(let g=0;g<_.length;g++){let y=_[g];if(y.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");let x=y.array,{itemSize:v,normalized:T}=y,E=new x.constructor(u.length*v);u.forEach((R,L)=>{for(let U=0;U<v;U++)E[L*v+U]=x[R*v+U]}),d=d&&E.every(R=>R===0),l.morphAttributes[h][g]=new Je.BufferAttribute(E,v,T)}}),d&&(l.morphAttributes={}),i.geometry=l}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function Di(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var ae=class{constructor(){}};ae.deepDispose=Ui,ae.removeUnnecessaryJoints=Ci,ae.removeUnnecessaryVertices=Ni,ae.rotateVRM0=Di;
|
|
930
930
|
/*!
|
|
931
|
-
* @pixiv/three-vrm-core v3.0.0
|
|
931
|
+
* @pixiv/three-vrm-core v3.0.0
|
|
932
932
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
933
933
|
*
|
|
934
934
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -936,7 +936,7 @@ void main() {
|
|
|
936
936
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
937
937
|
*/
|
|
938
938
|
/*!
|
|
939
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
939
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
940
940
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
941
941
|
*
|
|
942
942
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -944,7 +944,7 @@ void main() {
|
|
|
944
944
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
945
945
|
*/
|
|
946
946
|
/*!
|
|
947
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
947
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
948
948
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
949
949
|
*
|
|
950
950
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -952,7 +952,7 @@ void main() {
|
|
|
952
952
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
953
953
|
*/
|
|
954
954
|
/*!
|
|
955
|
-
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
955
|
+
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
956
956
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
957
957
|
*
|
|
958
958
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -960,7 +960,7 @@ void main() {
|
|
|
960
960
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
961
961
|
*/
|
|
962
962
|
/*!
|
|
963
|
-
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
963
|
+
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
964
964
|
* Node constraint module for @pixiv/three-vrm
|
|
965
965
|
*
|
|
966
966
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -968,7 +968,7 @@ void main() {
|
|
|
968
968
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
969
969
|
*/
|
|
970
970
|
/*!
|
|
971
|
-
* @pixiv/three-vrm-springbone v3.0.0
|
|
971
|
+
* @pixiv/three-vrm-springbone v3.0.0
|
|
972
972
|
* Spring bone module for @pixiv/three-vrm
|
|
973
973
|
*
|
|
974
974
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/three-vrm.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.0.0
|
|
2
|
+
* @pixiv/three-vrm v3.0.0
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6101,7 +6101,7 @@ export {
|
|
|
6101
6101
|
VRMUtils
|
|
6102
6102
|
};
|
|
6103
6103
|
/*!
|
|
6104
|
-
* @pixiv/three-vrm-core v3.0.0
|
|
6104
|
+
* @pixiv/three-vrm-core v3.0.0
|
|
6105
6105
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
6106
6106
|
*
|
|
6107
6107
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6109,7 +6109,7 @@ export {
|
|
|
6109
6109
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6110
6110
|
*/
|
|
6111
6111
|
/*!
|
|
6112
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
6112
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
6113
6113
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6114
6114
|
*
|
|
6115
6115
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6117,7 +6117,7 @@ export {
|
|
|
6117
6117
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6118
6118
|
*/
|
|
6119
6119
|
/*!
|
|
6120
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
6120
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
6121
6121
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
6122
6122
|
*
|
|
6123
6123
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6125,7 +6125,7 @@ export {
|
|
|
6125
6125
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6126
6126
|
*/
|
|
6127
6127
|
/*!
|
|
6128
|
-
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
6128
|
+
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
6129
6129
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
6130
6130
|
*
|
|
6131
6131
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6133,7 +6133,7 @@ export {
|
|
|
6133
6133
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6134
6134
|
*/
|
|
6135
6135
|
/*!
|
|
6136
|
-
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
6136
|
+
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
6137
6137
|
* Node constraint module for @pixiv/three-vrm
|
|
6138
6138
|
*
|
|
6139
6139
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6141,7 +6141,7 @@ export {
|
|
|
6141
6141
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6142
6142
|
*/
|
|
6143
6143
|
/*!
|
|
6144
|
-
* @pixiv/three-vrm-springbone v3.0.0
|
|
6144
|
+
* @pixiv/three-vrm-springbone v3.0.0
|
|
6145
6145
|
* Spring bone module for @pixiv/three-vrm
|
|
6146
6146
|
*
|
|
6147
6147
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -928,7 +928,7 @@ void main() {
|
|
|
928
928
|
`)+`
|
|
929
929
|
`;n.vertexShader=r+n.vertexShader,n.fragmentShader=r+n.fragmentShader,i<154&&(n.fragmentShader=n.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}get color(){return this.uniforms.litFactor.value}set color(t){this.uniforms.litFactor.value=t}get map(){return this.uniforms.map.value}set map(t){this.uniforms.map.value=t}get normalMap(){return this.uniforms.normalMap.value}set normalMap(t){this.uniforms.normalMap.value=t}get normalScale(){return this.uniforms.normalScale.value}set normalScale(t){this.uniforms.normalScale.value=t}get emissive(){return this.uniforms.emissive.value}set emissive(t){this.uniforms.emissive.value=t}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(t){this.uniforms.emissiveIntensity.value=t}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(t){this.uniforms.emissiveMap.value=t}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(t){this.uniforms.shadeColorFactor.value=t}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(t){this.uniforms.shadeMultiplyTexture.value=t}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(t){this.uniforms.shadingShiftFactor.value=t}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(t){this.uniforms.shadingShiftTexture.value=t}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(t){this.uniforms.shadingShiftTextureScale.value=t}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(t){this.uniforms.shadingToonyFactor.value=t}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(t){this.uniforms.giEqualizationFactor.value=t}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(t){this.uniforms.matcapFactor.value=t}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(t){this.uniforms.matcapTexture.value=t}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(t){this.uniforms.parametricRimColorFactor.value=t}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(t){this.uniforms.rimMultiplyTexture.value=t}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(t){this.uniforms.rimLightingMixFactor.value=t}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(t){this.uniforms.parametricRimFresnelPowerFactor.value=t}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(t){this.uniforms.parametricRimLiftFactor.value=t}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(t){this.uniforms.outlineWidthMultiplyTexture.value=t}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(t){this.uniforms.outlineWidthFactor.value=t}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(t){this.uniforms.outlineColorFactor.value=t}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(t){this.uniforms.outlineLightingMixFactor.value=t}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(t){this.uniforms.uvAnimationMaskTexture.value=t}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(t){this.uniforms.uvAnimationScrollXOffset.value=t}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(t){this.uniforms.uvAnimationScrollYOffset.value=t}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(t){this.uniforms.uvAnimationRotationPhase.value=t}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(t){this._ignoreVertexColor=t,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(t){this._v0CompatShade=t,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(t){this._debugMode=t,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(t){this._outlineWidthMode=t,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(t){this._isOutline=t,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(t){this._uploadUniformsWorkaround(),this._updateUVAnimation(t)}copy(t){return super.copy(t),this.map=t.map,this.normalMap=t.normalMap,this.emissiveMap=t.emissiveMap,this.shadeMultiplyTexture=t.shadeMultiplyTexture,this.shadingShiftTexture=t.shadingShiftTexture,this.matcapTexture=t.matcapTexture,this.rimMultiplyTexture=t.rimMultiplyTexture,this.outlineWidthMultiplyTexture=t.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=t.uvAnimationMaskTexture,this.normalMapType=t.normalMapType,this.uvAnimationScrollXSpeedFactor=t.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=t.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=t.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=t.ignoreVertexColor,this.v0CompatShade=t.v0CompatShade,this.debugMode=t.debugMode,this.outlineWidthMode=t.outlineWidthMode,this.isOutline=t.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(t){this.uniforms.uvAnimationScrollXOffset.value+=t*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=t*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=t*this.uvAnimationRotationSpeedFactor,this.uniforms.alphaTest.value=this.alphaTest,this.uniformsNeedUpdate=!0}_uploadUniformsWorkaround(){this.uniforms.opacity.value=this.opacity,this._updateTextureMatrix(this.uniforms.map,this.uniforms.mapUvTransform),this._updateTextureMatrix(this.uniforms.normalMap,this.uniforms.normalMapUvTransform),this._updateTextureMatrix(this.uniforms.emissiveMap,this.uniforms.emissiveMapUvTransform),this._updateTextureMatrix(this.uniforms.shadeMultiplyTexture,this.uniforms.shadeMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.shadingShiftTexture,this.uniforms.shadingShiftTextureUvTransform),this._updateTextureMatrix(this.uniforms.matcapTexture,this.uniforms.matcapTextureUvTransform),this._updateTextureMatrix(this.uniforms.rimMultiplyTexture,this.uniforms.rimMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.outlineWidthMultiplyTexture,this.uniforms.outlineWidthMultiplyTextureUvTransform),this._updateTextureMatrix(this.uniforms.uvAnimationMaskTexture,this.uniforms.uvAnimationMaskTextureUvTransform),this.uniformsNeedUpdate=!0}_generateDefines(){let t=parseInt(w.REVISION,10),e=this.outlineWidthMultiplyTexture!==null,n=this.map!==null||this.normalMap!==null||this.emissiveMap!==null||this.shadeMultiplyTexture!==null||this.shadingShiftTexture!==null||this.rimMultiplyTexture!==null||this.uvAnimationMaskTexture!==null;return{THREE_VRM_THREE_REVISION:t,OUTLINE:this._isOutline,MTOON_USE_UV:e||n,MTOON_UVS_VERTEX_ONLY:e&&!n,V0_COMPAT_SHADE:this._v0CompatShade,USE_SHADEMULTIPLYTEXTURE:this.shadeMultiplyTexture!==null,USE_SHADINGSHIFTTEXTURE:this.shadingShiftTexture!==null,USE_MATCAPTEXTURE:this.matcapTexture!==null,USE_RIMMULTIPLYTEXTURE:this.rimMultiplyTexture!==null,USE_OUTLINEWIDTHMULTIPLYTEXTURE:this._isOutline&&this.outlineWidthMultiplyTexture!==null,USE_UVANIMATIONMASKTEXTURE:this.uvAnimationMaskTexture!==null,IGNORE_VERTEX_COLOR:this._ignoreVertexColor===!0,DEBUG_NORMAL:this._debugMode==="normal",DEBUG_LITSHADERATE:this._debugMode==="litShadeRate",DEBUG_UV:this._debugMode==="uv",OUTLINE_WIDTH_WORLD:this._isOutline&&this._outlineWidthMode===it.WorldCoordinates,OUTLINE_WIDTH_SCREEN:this._isOutline&&this._outlineWidthMode===it.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},Nr=new Set(["1.0","1.0-beta"]),zn=class Ve{get name(){return Ve.EXTENSION_NAME}constructor(e,n={}){var i,r,s,a;this.parser=e,this.materialType=(i=n.materialType)!=null?i:Or,this.renderOrderOffset=(r=n.renderOrderOffset)!=null?r:0,this.v0CompatShade=(s=n.v0CompatShade)!=null?s:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return te(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return te(this,null,function*(){e.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(e){return this._getMToonExtension(e)?this.materialType:null}extendMaterialParams(e,n){let i=this._getMToonExtension(e);return i?this._extendMaterialParams(i,n):null}loadMesh(e){return te(this,null,function*(){var n;let i=this.parser,s=(n=i.json.meshes)==null?void 0:n[e];if(s==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);let a=s.primitives,l=yield i.loadMesh(e);if(a.length===1){let o=l,u=a[0].material;u!=null&&this._setupPrimitive(o,u)}else{let o=l;for(let u=0;u<a.length;u++){let d=o.children[u],c=a[u].material;c!=null&&this._setupPrimitive(d,c)}}return l})}_removeUnlitExtensionIfMToonExists(){let i=this.parser.json.materials;i==null||i.map((r,s)=>{var a;this._getMToonExtension(s)&&((a=r.extensions)!=null&&a.KHR_materials_unlit)&&delete r.extensions.KHR_materials_unlit})}_getMToonExtension(e){var n,i;let a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}let l=(i=a.extensions)==null?void 0:i[Ve.EXTENSION_NAME];if(l==null)return;let o=l.specVersion;if(!Nr.has(o)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Ve.EXTENSION_NAME} specVersion "${o}"`);return}return l}_extendMaterialParams(e,n){return te(this,null,function*(){var i;delete n.metalness,delete n.roughness;let r=new br(this.parser,n);r.assignPrimitive("transparentWithZWrite",e.transparentWithZWrite),r.assignColor("shadeColorFactor",e.shadeColorFactor),r.assignTexture("shadeMultiplyTexture",e.shadeMultiplyTexture,!0),r.assignPrimitive("shadingShiftFactor",e.shadingShiftFactor),r.assignTexture("shadingShiftTexture",e.shadingShiftTexture,!0),r.assignPrimitive("shadingShiftTextureScale",(i=e.shadingShiftTexture)==null?void 0:i.scale),r.assignPrimitive("shadingToonyFactor",e.shadingToonyFactor),r.assignPrimitive("giEqualizationFactor",e.giEqualizationFactor),r.assignColor("matcapFactor",e.matcapFactor),r.assignTexture("matcapTexture",e.matcapTexture,!0),r.assignColor("parametricRimColorFactor",e.parametricRimColorFactor),r.assignTexture("rimMultiplyTexture",e.rimMultiplyTexture,!0),r.assignPrimitive("rimLightingMixFactor",e.rimLightingMixFactor),r.assignPrimitive("parametricRimFresnelPowerFactor",e.parametricRimFresnelPowerFactor),r.assignPrimitive("parametricRimLiftFactor",e.parametricRimLiftFactor),r.assignPrimitive("outlineWidthMode",e.outlineWidthMode),r.assignPrimitive("outlineWidthFactor",e.outlineWidthFactor),r.assignTexture("outlineWidthMultiplyTexture",e.outlineWidthMultiplyTexture,!1),r.assignColor("outlineColorFactor",e.outlineColorFactor),r.assignPrimitive("outlineLightingMixFactor",e.outlineLightingMixFactor),r.assignTexture("uvAnimationMaskTexture",e.uvAnimationMaskTexture,!1),r.assignPrimitive("uvAnimationScrollXSpeedFactor",e.uvAnimationScrollXSpeedFactor),r.assignPrimitive("uvAnimationScrollYSpeedFactor",e.uvAnimationScrollYSpeedFactor),r.assignPrimitive("uvAnimationRotationSpeedFactor",e.uvAnimationRotationSpeedFactor),r.assignPrimitive("v0CompatShade",this.v0CompatShade),r.assignPrimitive("debugMode",this.debugMode),yield r.pending})}_setupPrimitive(e,n){let i=this._getMToonExtension(n);if(i){let r=this._parseRenderOrder(i);e.renderOrder=r+this.renderOrderOffset,this._generateOutline(e),this._addToMaterialSet(e);return}}_shouldGenerateOutline(e){return typeof e.outlineWidthMode=="string"&&e.outlineWidthMode!=="none"&&typeof e.outlineWidthFactor=="number"&&e.outlineWidthFactor>0}_generateOutline(e){let n=e.material;if(!(n instanceof Ie.Material)||!this._shouldGenerateOutline(n))return;e.material=[n];let i=n.clone();i.name+=" (Outline)",i.isOutline=!0,i.side=Ie.BackSide,e.material.push(i);let r=e.geometry,s=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,s,0),r.addGroup(0,s,1)}_addToMaterialSet(e){let n=e.material,i=new Set;Array.isArray(n)?n.forEach(r=>i.add(r)):i.add(n);for(let r of i)this._mToonMaterialSet.add(r)}_parseRenderOrder(e){var n;return(e.transparentWithZWrite?0:19)+((n=e.renderQueueOffsetNumber)!=null?n:0)}};zn.EXTENSION_NAME="VRMC_materials_mtoon";var jn=zn;var Dr=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),Gn=class ot{get name(){return ot.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Dr(this,null,function*(){let i=this._getHDREmissiveMultiplierExtension(e);if(i==null)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");let r=i.emissiveMultiplier;n.emissiveIntensity=r})}_getHDREmissiveMultiplierExtension(e){var n,i;let a=(n=this.parser.json.materials)==null?void 0:n[e];if(a==null){console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);return}let l=(i=a.extensions)==null?void 0:i[ot.EXTENSION_NAME];if(l!=null)return l}};Gn.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Qn=Gn;import*as $n from"three";var Br=Object.defineProperty,Fr=Object.defineProperties,Wr=Object.getOwnPropertyDescriptors,qn=Object.getOwnPropertySymbols,kr=Object.prototype.hasOwnProperty,zr=Object.prototype.propertyIsEnumerable,Xn=(t,e,n)=>e in t?Br(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,F=(t,e)=>{for(var n in e||(e={}))kr.call(e,n)&&Xn(t,n,e[n]);if(qn)for(var n of qn(e))zr.call(e,n)&&Xn(t,n,e[n]);return t},Yn=(t,e)=>Fr(t,Wr(e)),jr=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())});function le(t){return Math.pow(t,2.2)}var Zn=class{get name(){return"VRMMaterialsV0CompatPlugin"}constructor(t){var e;this.parser=t,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;let n=this.parser.json;n.extensionsUsed=(e=n.extensionsUsed)!=null?e:[],n.extensionsUsed.indexOf("KHR_texture_transform")===-1&&n.extensionsUsed.push("KHR_texture_transform")}beforeRoot(){return jr(this,null,function*(){var t;let e=this.parser.json,n=(t=e.extensions)==null?void 0:t.VRM,i=n==null?void 0:n.materialProperties;i&&(this._populateRenderQueueMap(i),i.forEach((r,s)=>{var a,l;let o=(a=e.materials)==null?void 0:a[s];if(o==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${s}] of glTF but the material doesn't exist`);return}if(r.shader==="VRM/MToon"){let u=this._parseV0MToonProperties(r,o);e.materials[s]=u}else if((l=r.shader)!=null&&l.startsWith("VRM/Unlit")){let u=this._parseV0UnlitProperties(r,o);e.materials[s]=u}else r.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${r.shader}`)}))})}_parseV0MToonProperties(t,e){var n,i,r,s,a,l,o,u,d,c,f,p,m,h,_,g,x,T,v,R,E,M,A,I,L,H,U,ce,ct,pt,mt,ft,_t,gt,vt,Et,Mt,Rt,Tt,xt,yt,wt,Pt,St,At,Lt,Ht,bt,Vt,It,Ut,Ct,Ot,Nt,Dt;let Bt=(i=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?i:!1,yi=((r=t.floatProperties)==null?void 0:r._ZWrite)===1&&Bt,wi=this._v0ParseRenderQueue(t),Ft=(a=(s=t.keywordMap)==null?void 0:s._ALPHATEST_ON)!=null?a:!1,Pi=Bt?"BLEND":Ft?"MASK":"OPAQUE",Si=Ft?(o=(l=t.floatProperties)==null?void 0:l._Cutoff)!=null?o:.5:void 0,Ai=((d=(u=t.floatProperties)==null?void 0:u._CullMode)!=null?d:2)===0,J=this._portTextureTransform(t),Li=((f=(c=t.vectorProperties)==null?void 0:c._Color)!=null?f:[1,1,1,1]).map((Yt,Ki)=>Ki===3?Yt:le(Yt)),Wt=(p=t.textureProperties)==null?void 0:p._MainTex,Hi=Wt!=null?{index:Wt,extensions:F({},J)}:void 0,bi=(h=(m=t.floatProperties)==null?void 0:m._BumpScale)!=null?h:1,kt=(_=t.textureProperties)==null?void 0:_._BumpMap,Vi=kt!=null?{index:kt,scale:bi,extensions:F({},J)}:void 0,Ii=((x=(g=t.vectorProperties)==null?void 0:g._EmissionColor)!=null?x:[0,0,0,1]).map(le),zt=(T=t.textureProperties)==null?void 0:T._EmissionMap,Ui=zt!=null?{index:zt,extensions:F({},J)}:void 0,Ci=((R=(v=t.vectorProperties)==null?void 0:v._ShadeColor)!=null?R:[.97,.81,.86,1]).map(le),jt=(E=t.textureProperties)==null?void 0:E._ShadeTexture,Oi=jt!=null?{index:jt,extensions:F({},J)}:void 0,ye=(A=(M=t.floatProperties)==null?void 0:M._ShadeShift)!=null?A:0,we=(L=(I=t.floatProperties)==null?void 0:I._ShadeToony)!=null?L:.9;we=$n.MathUtils.lerp(we,1,.5+.5*ye),ye=-ye-(1-we);let Gt=(U=(H=t.floatProperties)==null?void 0:H._IndirectLightIntensity)!=null?U:.1,Ni=Gt?1-Gt:void 0,Ne=(ce=t.textureProperties)==null?void 0:ce._SphereAdd,Di=Ne!=null?[1,1,1]:void 0,Bi=Ne!=null?{index:Ne}:void 0,Fi=(pt=(ct=t.floatProperties)==null?void 0:ct._RimLightingMix)!=null?pt:0,Qt=(mt=t.textureProperties)==null?void 0:mt._RimTexture,Wi=Qt!=null?{index:Qt,extensions:F({},J)}:void 0,ki=((_t=(ft=t.vectorProperties)==null?void 0:ft._RimColor)!=null?_t:[0,0,0,1]).map(le),zi=(vt=(gt=t.floatProperties)==null?void 0:gt._RimFresnelPower)!=null?vt:1,ji=(Mt=(Et=t.floatProperties)==null?void 0:Et._RimLift)!=null?Mt:0,Gi=["none","worldCoordinates","screenCoordinates"][(Tt=(Rt=t.floatProperties)==null?void 0:Rt._OutlineWidthMode)!=null?Tt:0],De=(yt=(xt=t.floatProperties)==null?void 0:xt._OutlineWidth)!=null?yt:0;De=.01*De;let qt=(wt=t.textureProperties)==null?void 0:wt._OutlineWidthTexture,Qi=qt!=null?{index:qt,extensions:F({},J)}:void 0,qi=((St=(Pt=t.vectorProperties)==null?void 0:Pt._OutlineColor)!=null?St:[0,0,0]).map(le),Xi=((Lt=(At=t.floatProperties)==null?void 0:At._OutlineColorMode)!=null?Lt:0)===1?(bt=(Ht=t.floatProperties)==null?void 0:Ht._OutlineLightingMix)!=null?bt:1:0,Xt=(Vt=t.textureProperties)==null?void 0:Vt._UvAnimMaskTexture,Yi=Xt!=null?{index:Xt,extensions:F({},J)}:void 0,$i=(Ut=(It=t.floatProperties)==null?void 0:It._UvAnimScrollX)!=null?Ut:0,Pe=(Ot=(Ct=t.floatProperties)==null?void 0:Ct._UvAnimScrollY)!=null?Ot:0;Pe!=null&&(Pe=-Pe);let Zi=(Dt=(Nt=t.floatProperties)==null?void 0:Nt._UvAnimRotation)!=null?Dt:0,Ji={specVersion:"1.0",transparentWithZWrite:yi,renderQueueOffsetNumber:wi,shadeColorFactor:Ci,shadeMultiplyTexture:Oi,shadingShiftFactor:ye,shadingToonyFactor:we,giEqualizationFactor:Ni,matcapFactor:Di,matcapTexture:Bi,rimLightingMixFactor:Fi,rimMultiplyTexture:Wi,parametricRimColorFactor:ki,parametricRimFresnelPowerFactor:zi,parametricRimLiftFactor:ji,outlineWidthMode:Gi,outlineWidthFactor:De,outlineWidthMultiplyTexture:Qi,outlineColorFactor:qi,outlineLightingMixFactor:Xi,uvAnimationMaskTexture:Yi,uvAnimationScrollXSpeedFactor:$i,uvAnimationScrollYSpeedFactor:Pe,uvAnimationRotationSpeedFactor:Zi};return Yn(F({},e),{pbrMetallicRoughness:{baseColorFactor:Li,baseColorTexture:Hi},normalTexture:Vi,emissiveTexture:Ui,emissiveFactor:Ii,alphaMode:Pi,alphaCutoff:Si,doubleSided:Ai,extensions:{VRMC_materials_mtoon:Ji}})}_parseV0UnlitProperties(t,e){var n,i,r,s,a;let l=t.shader==="VRM/UnlitTransparentZWrite",o=t.shader==="VRM/UnlitTransparent"||l,u=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",c=o?"BLEND":d?"MASK":"OPAQUE",f=d?(i=(n=t.floatProperties)==null?void 0:n._Cutoff)!=null?i:.5:void 0,p=this._portTextureTransform(t),m=((s=(r=t.vectorProperties)==null?void 0:r._Color)!=null?s:[1,1,1,1]).map(le),h=(a=t.textureProperties)==null?void 0:a._MainTex,_=h!=null?{index:h,extensions:F({},p)}:void 0,g={specVersion:"1.0",transparentWithZWrite:l,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:_};return Yn(F({},e),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:_},alphaMode:c,alphaCutoff:f,extensions:{VRMC_materials_mtoon:g}})}_portTextureTransform(t){var e,n,i,r,s;let a=(e=t.vectorProperties)==null?void 0:e._MainTex;if(a==null)return{};let l=[(n=a==null?void 0:a[0])!=null?n:0,(i=a==null?void 0:a[1])!=null?i:0],o=[(r=a==null?void 0:a[2])!=null?r:1,(s=a==null?void 0:a[3])!=null?s:1];return l[1]=1-o[1]-l[1],{KHR_texture_transform:{offset:l,scale:o}}}_v0ParseRenderQueue(t){var e,n,i;let r=(n=(e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null?n:!1,s=((i=t.floatProperties)==null?void 0:i._ZWrite)===1,a=0;if(r){let l=t.renderQueue;l!=null&&(s?a=this._renderQueueMapTransparentZWrite.get(l):a=this._renderQueueMapTransparent.get(l))}return a}_populateRenderQueueMap(t){let e=new Set,n=new Set;t.forEach(i=>{var r,s,a;let l=(s=(r=i.keywordMap)==null?void 0:r._ALPHABLEND_ON)!=null?s:!1,o=((a=i.floatProperties)==null?void 0:a._ZWrite)===1;if(l){let u=i.renderQueue;u!=null&&(o?n.add(u):e.add(u))}}),e.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${e.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),n.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${n.size} render queues for TransparentZWrite materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),Array.from(e).sort().forEach((i,r)=>{let s=Math.min(Math.max(r-e.size+1,-9),0);this._renderQueueMapTransparent.set(i,s)}),Array.from(n).sort().forEach((i,r)=>{let s=Math.min(Math.max(r,0),9);this._renderQueueMapTransparentZWrite.set(i,s)})}};import*as C from"three";import*as W from"three";import*as at from"three";import*as Ee from"three";import*as j from"three";var Jn=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),Y=new C.Vector3,st=class extends C.Group{constructor(t){super(),this._attrPosition=new C.BufferAttribute(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(C.DynamicDrawUsage);let e=new C.BufferGeometry;e.setAttribute("position",this._attrPosition);let n=new C.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new C.Line(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){Y.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,Y.x,Y.y,Y.z),this.constraint.source&&Y.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,Y.x,Y.y,Y.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Kn(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Gr=new at.Vector3,Qr=new at.Vector3;function qr(t,e){return t.decompose(Gr,e,Qr),e}function Ue(t){return t.invert?t.invert():t.inverse(),t}var lt=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},Xr=new W.Vector3,Yr=new W.Vector3,$r=new W.Vector3,Zr=new W.Quaternion,Jr=new W.Quaternion,Kr=new W.Quaternion,eo=class extends lt{get aimAxis(){return this._aimAxis}set aimAxis(t){this._aimAxis=t,this._v3AimAxis.set(t==="PositiveX"?1:t==="NegativeX"?-1:0,t==="PositiveY"?1:t==="NegativeY"?-1:0,t==="PositiveZ"?1:t==="NegativeZ"?-1:0)}get dependencies(){let t=new Set([this.source]);return this.destination.parent&&t.add(this.destination.parent),t}constructor(t,e){super(t,e),this._aimAxis="PositiveX",this._v3AimAxis=new W.Vector3(1,0,0),this._dstRestQuat=new W.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);let t=Zr.identity(),e=Jr.identity();this.destination.parent&&(qr(this.destination.parent.matrixWorld,t),Ue(e.copy(t)));let n=Xr.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),i=Kn(this.source.matrixWorld,Yr).sub(Kn(this.destination.matrixWorld,$r)).normalize(),r=Kr.setFromUnitVectors(n,i).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}};function to(t,e){let n=[t],i=t.parent;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}var no=class{constructor(){this._constraints=new Set,this._objectConstraintsMap=new Map}get constraints(){return this._constraints}addConstraint(t){this._constraints.add(t);let e=this._objectConstraintsMap.get(t.destination);e==null&&(e=new Set,this._objectConstraintsMap.set(t.destination,e)),e.add(t)}deleteConstraint(t){this._constraints.delete(t),this._objectConstraintsMap.get(t.destination).delete(t)}setInitState(){let t=new Set,e=new Set;for(let n of this._constraints)this._processConstraint(n,t,e,i=>i.setInitState())}update(){let t=new Set,e=new Set;for(let n of this._constraints)this._processConstraint(n,t,e,i=>i.update())}_processConstraint(t,e,n,i){if(n.has(t))return;if(e.has(t))throw new Error("VRMNodeConstraintManager: Circular dependency detected while updating constraints");e.add(t);let r=t.dependencies;for(let s of r)to(s,a=>{let l=this._objectConstraintsMap.get(a);if(l)for(let o of l)this._processConstraint(o,e,n,i)});i(t),n.add(t)}},io=new Ee.Quaternion,ro=new Ee.Quaternion,oo=class extends lt{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Ee.Quaternion,this._invSrcRestQuat=new Ee.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Ue(this._invSrcRestQuat.copy(this.source.quaternion))}update(){let t=io.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=ro.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},so=new j.Vector3,ao=new j.Quaternion,lo=new j.Quaternion,uo=class extends lt{get rollAxis(){return this._rollAxis}set rollAxis(t){this._rollAxis=t,this._v3RollAxis.set(t==="X"?1:0,t==="Y"?1:0,t==="Z"?1:0)}get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._rollAxis="X",this._v3RollAxis=new j.Vector3(1,0,0),this._dstRestQuat=new j.Quaternion,this._invDstRestQuat=new j.Quaternion,this._invSrcRestQuatMulDstRestQuat=new j.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),Ue(this._invDstRestQuat.copy(this._dstRestQuat)),Ue(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){let t=ao.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=so.copy(this._v3RollAxis).applyQuaternion(t),i=lo.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}},ho=new Set(["1.0","1.0-beta"]),ei=class ve{get name(){return ve.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return Jn(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return Jn(this,null,function*(){var n;let i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf(ve.EXTENSION_NAME))!==-1))return null;let s=new no,a=yield this.parser.getDependencies("node");return a.forEach((l,o)=>{var u;let d=i.nodes[o],c=(u=d==null?void 0:d.extensions)==null?void 0:u[ve.EXTENSION_NAME];if(c==null)return;let f=c.specVersion;if(!ho.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${ve.EXTENSION_NAME} specVersion "${f}"`);return}let p=c.constraint;if(p.roll!=null){let m=this._importRollConstraint(l,a,p.roll);s.addConstraint(m)}else if(p.aim!=null){let m=this._importAimConstraint(l,a,p.aim);s.addConstraint(m)}else if(p.rotation!=null){let m=this._importRotationConstraint(l,a,p.rotation);s.addConstraint(m)}}),e.scene.updateMatrixWorld(),s.setInitState(),s})}_importRollConstraint(e,n,i){let{source:r,rollAxis:s,weight:a}=i,l=n[r],o=new uo(e,l);if(s!=null&&(o.rollAxis=s),a!=null&&(o.weight=a),this.helperRoot){let u=new st(o);this.helperRoot.add(u)}return o}_importAimConstraint(e,n,i){let{source:r,aimAxis:s,weight:a}=i,l=n[r],o=new eo(e,l);if(s!=null&&(o.aimAxis=s),a!=null&&(o.weight=a),this.helperRoot){let u=new st(o);this.helperRoot.add(u)}return o}_importRotationConstraint(e,n,i){let{source:r,weight:s}=i,a=n[r],l=new oo(e,a);if(s!=null&&(l.weight=s),this.helperRoot){let o=new st(l);this.helperRoot.add(o)}return l}};ei.EXTENSION_NAME="VRMC_node_constraint";var ti=ei;import*as $ from"three";import*as xe from"three";import*as ui from"three";import*as Q from"three";import*as re from"three";import*as Z from"three";import*as oe from"three";import*as hi from"three";import*as V from"three";import*as ci from"three";import*as mi from"three";import*as ie from"three";var Ce=(t,e,n)=>new Promise((i,r)=>{var s=o=>{try{l(n.next(o))}catch(u){r(u)}},a=o=>{try{l(n.throw(o))}catch(u){r(u)}},l=o=>o.done?i(o.value):Promise.resolve(o.value).then(s,a);l((n=n.apply(t,e)).next())}),ai=class{},ut=new xe.Vector3,ne=new xe.Vector3,li=class extends ai{get type(){return"capsule"}constructor(t){var e,n,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new xe.Vector3(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new xe.Vector3(0,0,0),this.radius=(i=t==null?void 0:t.radius)!=null?i:0}calculateCollision(t,e,n,i){ut.copy(this.offset).applyMatrix4(t),ne.copy(this.tail).applyMatrix4(t),ne.sub(ut);let r=ne.lengthSq();i.copy(e).sub(ut);let s=ne.dot(i);s<=0||(r<=s||ne.multiplyScalar(s/r),i.sub(ne));let a=n+this.radius,l=i.length()-a;return i.normalize(),l}},di=class extends ai{get type(){return"sphere"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new ui.Vector3(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e);let r=n+this.radius,s=i.length()-r;return i.normalize(),s}},k=new Q.Vector3,co=class extends Q.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Q.Vector3,this._currentTail=new Q.Vector3,this._shape=t,this._attrPos=new Q.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Q.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0);let n=k.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){k.copy(this._currentTail).sub(this._currentOffset);let t=k.length()/this._currentRadius;for(let i=0;i<=16;i++){let r=i/16*Math.PI;this._attrPos.setXYZ(i,-Math.sin(r),-Math.cos(r),0),this._attrPos.setXYZ(17+i,t+Math.sin(r),Math.cos(r),0),this._attrPos.setXYZ(34+i,-Math.sin(r),0,-Math.cos(r)),this._attrPos.setXYZ(51+i,t+Math.sin(r),0,Math.cos(r))}for(let i=0;i<32;i++){let r=i/16*Math.PI;this._attrPos.setXYZ(68+i,0,Math.sin(r),Math.cos(r)),this._attrPos.setXYZ(100+i,t,Math.sin(r),Math.cos(r))}let e=Math.atan2(k.y,Math.sqrt(k.x*k.x+k.z*k.z)),n=-Math.atan2(k.z,k.x);this.rotateZ(e),this.rotateY(n),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){let e=(t+1)%34;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(68+t*2,34+t,34+e)}for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(136+t*2,68+t,68+e),this._attrIndex.setXY(200+t*2,100+t,100+e)}this._attrIndex.needsUpdate=!0}},po=class extends re.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new re.Vector3,this._shape=t,this._attrPos=new re.BufferAttribute(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new re.BufferAttribute(new Uint16Array(64*3),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._shape.radius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){let e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.needsUpdate=!0}},mo=new $.Vector3,ni=class extends $.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof di)this._geometry=new po(this.collider.shape);else if(this.collider.shape instanceof li)this._geometry=new co(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");let e=new $.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new $.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld);let e=this.matrix.elements;this._geometry.worldScale=mo.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},fo=class extends oe.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new oe.Vector3,this._springBone=t,this._attrPos=new oe.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new oe.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1,e=this._springBone.settings.hitRadius/this.worldScale;this._currentRadius!==e&&(this._currentRadius=e,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){let e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){let e=(t+1)%32;this._attrIndex.setXY(t*2,t,e),this._attrIndex.setXY(64+t*2,32+t,32+e),this._attrIndex.setXY(128+t*2,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}},_o=new Z.Vector3,go=class extends Z.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new fo(this.springBone);let e=new Z.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new Z.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld);let e=this.matrix.elements;this._geometry.worldScale=_o.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},ii=class extends hi.Object3D{constructor(t){super(),this.shape=t}},vo=new ci.Matrix4;function pi(t){return t.invert?t.invert():t.getInverse(vo.copy(t)),t}var Eo=class{constructor(t){this._inverseCache=new mi.Matrix4,this._shouldUpdateInverse=!0,this.matrix=t;let e={set:(n,i,r)=>(this._shouldUpdateInverse=!0,n[i]=r,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(pi(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},Mo=new V.Matrix4,G=new V.Vector3,Me=new V.Vector3,Ro=new V.Vector3,ue=new V.Vector3,ri=new V.Vector3,Re=new V.Vector3,oi=new V.Quaternion,de=new V.Matrix4,To=new V.Matrix4,xo=class{constructor(t,e,n={},i=[]){this._currentTail=new V.Vector3,this._prevTail=new V.Vector3,this._boneAxis=new V.Vector3,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new V.Matrix4,this._initialLocalRotation=new V.Quaternion,this._initialLocalChildPosition=new V.Vector3;var r,s,a,l,o,u;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(r=n.hitRadius)!=null?r:0,stiffness:(s=n.stiffness)!=null?s:1,gravityPower:(a=n.gravityPower)!=null?a:0,gravityDir:(o=(l=n.gravityDir)==null?void 0:l.clone())!=null?o:new V.Vector3(0,-1,0),dragForce:(u=n.dragForce)!=null?u:.4},this.colliderGroups=i}get center(){return this._center}set center(t){var e;(e=this._center)!=null&&e.userData.inverseCacheProxy&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new Eo(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:Mo}setInitState(){this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07);let t=this._getMatrixWorldToCenter(de);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix);let t=this._getMatrixWorldToCenter(de);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength(),ue.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(de);ri.copy(ue).applyMatrix4(e);let n=oi.setFromRotationMatrix(e),i=To.copy(e).multiply(this._parentMatrixWorld),r=Me.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(ri).normalize(),s=Ro.copy(this.settings.gravityDir).applyQuaternion(n).normalize(),a=this._getMatrixCenterToWorld(de);Re.copy(this._currentTail).add(G.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(G.copy(r).multiplyScalar(this.settings.stiffness*t)).add(G.copy(s).multiplyScalar(this.settings.gravityPower*t)).applyMatrix4(a),Re.sub(ue).normalize().multiplyScalar(this._worldSpaceBoneLength).add(ue),this._collision(Re),e=this._getMatrixWorldToCenter(de),this._prevTail.copy(this._currentTail),this._currentTail.copy(G.copy(Re).applyMatrix4(e));let l=pi(de.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),o=oi.setFromUnitVectors(this._boneAxis,G.copy(Re).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(o),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._parentMatrixWorld,this.bone.matrix)}_collision(t){this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{let i=n.shape.calculateCollision(n.matrixWorld,t,this.settings.hitRadius,G);i<0&&(t.add(G.multiplyScalar(-i)),t.sub(ue).normalize().multiplyScalar(this._worldSpaceBoneLength).add(ue))})})}_calcWorldSpaceBoneLength(){G.setFromMatrixPosition(this.bone.matrixWorld),this.child?Me.setFromMatrixPosition(this.child.matrixWorld):(Me.copy(this._initialLocalChildPosition),Me.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=G.sub(Me).length()}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}};function yo(t,e){let n=[],i=t;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}function fi(t,e){t.children.forEach(n=>{e(n)||fi(n,e)})}var si=class{constructor(){this._joints=new Set,this._objectSpringBonesMap=new Map}get joints(){return this._joints}get springBones(){return console.warn("VRMSpringBoneManager: springBones is deprecated. use joints instead."),this._joints}get colliderGroups(){let t=new Set;return this._joints.forEach(e=>{e.colliderGroups.forEach(n=>{t.add(n)})}),Array.from(t)}get colliders(){let t=new Set;return this.colliderGroups.forEach(e=>{e.colliders.forEach(n=>{t.add(n)})}),Array.from(t)}addJoint(t){this._joints.add(t);let e=this._objectSpringBonesMap.get(t.bone);e==null&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}addSpringBone(t){console.warn("VRMSpringBoneManager: addSpringBone() is deprecated. use addJoint() instead."),this.addJoint(t)}deleteJoint(t){this._joints.delete(t),this._objectSpringBonesMap.get(t.bone).delete(t)}deleteSpringBone(t){console.warn("VRMSpringBoneManager: deleteSpringBone() is deprecated. use deleteJoint() instead."),this.deleteJoint(t)}setInitState(){let t=new Set,e=new Set,n=new Set;for(let i of this._joints)this._processSpringBone(i,t,e,n,r=>r.setInitState())}reset(){let t=new Set,e=new Set,n=new Set;for(let i of this._joints)this._processSpringBone(i,t,e,n,r=>r.reset())}update(t){let e=new Set,n=new Set,i=new Set;for(let r of this._joints)this._processSpringBone(r,e,n,i,s=>s.update(t)),fi(r.bone,s=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(s))==null?void 0:a.size)!=null?l:0)>0?!0:(s.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(t,e,n,i,r){if(n.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating springbones");e.add(t);let s=this._getDependencies(t);for(let a of s)yo(a,l=>{let o=this._objectSpringBonesMap.get(l);if(o)for(let u of o)this._processSpringBone(u,e,n,i,r);else i.has(l)||(l.updateWorldMatrix(!1,!1),i.add(l))});t.bone.updateMatrix(),t.bone.updateWorldMatrix(!1,!1),r(t),i.add(t.bone),n.add(t)}_getDependencies(t){let e=new Set,n=t.bone.parent;return n&&e.add(n),t.colliderGroups.forEach(i=>{i.colliders.forEach(r=>{e.add(r)})}),e}},wo=new Set(["1.0","1.0-beta"]),_i=class Te{get name(){return Te.EXTENSION_NAME}constructor(e,n){this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot}afterRoot(e){return Ce(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return Ce(this,null,function*(){let n=yield this._v1Import(e);if(n!=null)return n;let i=yield this._v0Import(e);return i!=null?i:null})}_v1Import(e){return Ce(this,null,function*(){var n,i,r,s,a;let l=e.parser.json;if(!(((n=l.extensionsUsed)==null?void 0:n.indexOf(Te.EXTENSION_NAME))!==-1))return null;let u=new si,d=yield e.parser.getDependencies("node"),c=(i=l.extensions)==null?void 0:i[Te.EXTENSION_NAME];if(!c)return null;let f=c.specVersion;if(!wo.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Te.EXTENSION_NAME} specVersion "${f}"`),null;let p=(r=c.colliders)==null?void 0:r.map((h,_)=>{var g,x,T,v,R;let E=d[h.node],M=h.shape;if(M.sphere)return this._importSphereCollider(E,{offset:new ie.Vector3().fromArray((g=M.sphere.offset)!=null?g:[0,0,0]),radius:(x=M.sphere.radius)!=null?x:0});if(M.capsule)return this._importCapsuleCollider(E,{offset:new ie.Vector3().fromArray((T=M.capsule.offset)!=null?T:[0,0,0]),radius:(v=M.capsule.radius)!=null?v:0,tail:new ie.Vector3().fromArray((R=M.capsule.tail)!=null?R:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape`)}),m=(s=c.colliderGroups)==null?void 0:s.map((h,_)=>{var g;return{colliders:((g=h.colliders)!=null?g:[]).map(T=>{let v=p==null?void 0:p[T];if(v==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${_} attempted to use a collider #${T} but not found`);return v}),name:h.name}});return(a=c.springs)==null||a.forEach((h,_)=>{var g;let x=h.joints,T=(g=h.colliderGroups)==null?void 0:g.map(E=>{let M=m==null?void 0:m[E];if(M==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to use a colliderGroup ${E} but not found`);return M}),v=h.center!=null?d[h.center]:void 0,R;x.forEach(E=>{if(R){let M=R.node,A=d[M],I=E.node,L=d[I],H={hitRadius:R.hitRadius,dragForce:R.dragForce,gravityPower:R.gravityPower,stiffness:R.stiffness,gravityDir:R.gravityDir!=null?new ie.Vector3().fromArray(R.gravityDir):void 0},U=this._importJoint(A,L,H,T);v&&(U.center=v),u.addJoint(U)}R=E})}),u.setInitState(),u})}_v0Import(e){return Ce(this,null,function*(){var n,i,r;let s=e.parser.json;if(!(((n=s.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;let l=(i=s.extensions)==null?void 0:i.VRM,o=l==null?void 0:l.secondaryAnimation;if(!o)return null;let u=o==null?void 0:o.boneGroups;if(!u)return null;let d=new si,c=yield e.parser.getDependencies("node"),f=(r=o.colliderGroups)==null?void 0:r.map(p=>{var m;let h=c[p.node];return{colliders:((m=p.colliders)!=null?m:[]).map((g,x)=>{var T,v,R;let E=new ie.Vector3(0,0,0);return g.offset&&E.set((T=g.offset.x)!=null?T:0,(v=g.offset.y)!=null?v:0,g.offset.z?-g.offset.z:0),this._importSphereCollider(h,{offset:E,radius:(R=g.radius)!=null?R:0})})}});return u==null||u.forEach((p,m)=>{let h=p.bones;h&&h.forEach(_=>{var g,x,T,v;let R=c[_],E=new ie.Vector3;p.gravityDir?E.set((g=p.gravityDir.x)!=null?g:0,(x=p.gravityDir.y)!=null?x:0,(T=p.gravityDir.z)!=null?T:0):E.set(0,-1,0);let M=p.center!=null?c[p.center]:void 0,A={hitRadius:p.hitRadius,dragForce:p.dragForce,gravityPower:p.gravityPower,stiffness:p.stiffiness,gravityDir:E},I=(v=p.colliderGroups)==null?void 0:v.map(L=>{let H=f==null?void 0:f[L];if(H==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${L} but not found`);return H});R.traverse(L=>{var H;let U=(H=L.children[0])!=null?H:null,ce=this._importJoint(L,U,A,I);M&&(ce.center=M),d.addJoint(ce)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,i,r){let s=new xo(e,n,i,r);if(this.jointHelperRoot){let a=new go(s);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(e,n){let{offset:i,radius:r}=n,s=new di({offset:i,radius:r}),a=new ii(s);if(e.add(a),this.colliderHelperRoot){let l=new ni(a);this.colliderHelperRoot.add(l),l.renderOrder=this.colliderHelperRoot.renderOrder}return a}_importCapsuleCollider(e,n){let{offset:i,radius:r,tail:s}=n,a=new li({offset:i,radius:r,tail:s}),l=new ii(a);if(e.add(l),this.colliderHelperRoot){let o=new ni(l);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return l}};_i.EXTENSION_NAME="VRMC_springBone";var gi=_i;var dt=class{get name(){return"VRMLoaderPlugin"}constructor(e,n){var s,a,l,o,u,d,c,f,p,m;this.parser=e;let i=n==null?void 0:n.helperRoot,r=n==null?void 0:n.autoUpdateHumanBones;this.expressionPlugin=(s=n==null?void 0:n.expressionPlugin)!=null?s:new Ye(e),this.firstPersonPlugin=(a=n==null?void 0:n.firstPersonPlugin)!=null?a:new Ze(e),this.humanoidPlugin=(l=n==null?void 0:n.humanoidPlugin)!=null?l:new Je(e,{helperRoot:i,autoUpdateHumanBones:r}),this.lookAtPlugin=(o=n==null?void 0:n.lookAtPlugin)!=null?o:new et(e,{helperRoot:i}),this.metaPlugin=(u=n==null?void 0:n.metaPlugin)!=null?u:new tt(e),this.mtoonMaterialPlugin=(d=n==null?void 0:n.mtoonMaterialPlugin)!=null?d:new jn(e),this.materialsHDREmissiveMultiplierPlugin=(c=n==null?void 0:n.materialsHDREmissiveMultiplierPlugin)!=null?c:new Qn(e),this.materialsV0CompatPlugin=(f=n==null?void 0:n.materialsV0CompatPlugin)!=null?f:new Zn(e),this.springBonePlugin=(p=n==null?void 0:n.springBonePlugin)!=null?p:new gi(e,{colliderHelperRoot:i,jointHelperRoot:i}),this.nodeConstraintPlugin=(m=n==null?void 0:n.nodeConstraintPlugin)!=null?m:new ti(e,{helperRoot:i})}beforeRoot(){return pe(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return pe(this,null,function*(){return yield this.mtoonMaterialPlugin.loadMesh(e)})}getMaterialType(e){let n=this.mtoonMaterialPlugin.getMaterialType(e);return n!=null?n:null}extendMaterialParams(e,n){return pe(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,n),yield this.mtoonMaterialPlugin.extendMaterialParams(e,n)})}afterRoot(e){return pe(this,null,function*(){yield this.metaPlugin.afterRoot(e),yield this.humanoidPlugin.afterRoot(e),yield this.expressionPlugin.afterRoot(e),yield this.lookAtPlugin.afterRoot(e),yield this.firstPersonPlugin.afterRoot(e),yield this.springBonePlugin.afterRoot(e),yield this.nodeConstraintPlugin.afterRoot(e),yield this.mtoonMaterialPlugin.afterRoot(e);let n=e.userData.vrmMeta,i=e.userData.vrmHumanoid;if(n&&i){let r=new ge({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:i,lookAt:e.userData.vrmLookAt,meta:n,materials:e.userData.vrmMToonMaterials,springBoneManager:e.userData.vrmSpringBoneManager,nodeConstraintManager:e.userData.vrmNodeConstraintManager});e.userData.vrm=r}})}};function vi(t){if(Object.values(t).forEach(e=>{e!=null&&e.isTexture&&e.dispose()}),t.isShaderMaterial){let e=t.uniforms;e&&Object.values(e).forEach(n=>{let i=n.value;i!=null&&i.isTexture&&i.dispose()})}t.dispose()}function Po(t){let e=t.geometry;e&&e.dispose();let n=t.skeleton;n&&n.dispose();let i=t.material;i&&(Array.isArray(i)?i.forEach(r=>vi(r)):i&&vi(i))}function Ei(t){t.traverse(Po)}import*as Oe from"three";function Mi(t,e){var a;let n=(a=e==null?void 0:e.experimentalSameBoneCounts)!=null?a:!1,i=[];t.traverse(l=>{l.type==="SkinnedMesh"&&i.push(l)});let r=new Map,s=0;for(let l of i){let u=l.geometry.getAttribute("skinIndex"),d=[],c=[],f={},p=u.array;for(let m=0;m<p.length;m++){let h=p[m];f[h]==null&&(f[h]=d.length,d.push(l.skeleton.bones[h]),c.push(l.skeleton.boneInverses[h])),p[m]=f[h]}u.copyArray(p),u.needsUpdate=!0,r.set(l,{bones:d,boneInverses:c}),s=Math.max(s,d.length)}for(let l of i){let{bones:o,boneInverses:u}=r.get(l);if(n)for(let c=o.length;c<s;c++)o[c]=o[0],u[c]=u[0];let d=new Oe.Skeleton(o,u);l.bind(d,new Oe.Matrix4)}}import*as Ri from"three";import{BufferAttribute as ht}from"three";function Ti(t){let e=new Map;t.traverse(n=>{var c,f,p,m;if(!n.isMesh)return;let i=n,r=i.geometry,s=r.index;if(s==null)return;let a=e.get(r);if(a!=null){i.geometry=a;return}let l=new Ri.BufferGeometry;l.name=r.name,l.morphTargetsRelative=r.morphTargetsRelative,r.groups.forEach(h=>{l.addGroup(h.start,h.count,h.materialIndex)}),l.boundingBox=(f=(c=r.boundingBox)==null?void 0:c.clone())!=null?f:null,l.boundingSphere=(m=(p=r.boundingSphere)==null?void 0:p.clone())!=null?m:null,l.setDrawRange(r.drawRange.start,r.drawRange.count),l.userData=r.userData,e.set(r,l);let o=[],u=[];{let h=s.array,_=new h.constructor(h.length),g=0;for(let x=0;x<h.length;x++){let T=h[x],v=o[T];v==null&&(o[T]=g,u[g]=T,v=g,g++),_[x]=v}l.setIndex(new ht(_,1,!1))}Object.keys(r.attributes).forEach(h=>{let _=r.attributes[h];if(_.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");let g=_.array,{itemSize:x,normalized:T}=_,v=new g.constructor(u.length*x);u.forEach((R,E)=>{for(let M=0;M<x;M++)v[E*x+M]=g[R*x+M]}),l.setAttribute(h,new ht(v,x,T))});let d=!0;Object.keys(r.morphAttributes).forEach(h=>{l.morphAttributes[h]=[];let _=r.morphAttributes[h];for(let g=0;g<_.length;g++){let x=_[g];if(x.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");let T=x.array,{itemSize:v,normalized:R}=x,E=new T.constructor(u.length*v);u.forEach((M,A)=>{for(let I=0;I<v;I++)E[A*v+I]=T[M*v+I]}),d=d&&E.every(M=>M===0),l.morphAttributes[h][g]=new ht(E,v,R)}}),d&&(l.morphAttributes={}),i.geometry=l}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function xi(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var he=class{constructor(){}};he.deepDispose=Ei,he.removeUnnecessaryJoints=Mi,he.removeUnnecessaryVertices=Ti,he.rotateVRM0=xi;export{Or as MToonMaterial,Ur as MToonMaterialDebugMode,jn as MToonMaterialLoaderPlugin,it as MToonMaterialOutlineWidthMode,ge as VRM,eo as VRMAimConstraint,nt as VRMCore,Co as VRMCoreLoaderPlugin,$t as VRMExpression,Ye as VRMExpressionLoaderPlugin,Kt as VRMExpressionManager,en as VRMExpressionMaterialColorBind,me as VRMExpressionMaterialColorType,tn as VRMExpressionMorphTargetBind,bo as VRMExpressionOverrideType,ze as VRMExpressionPresetName,rn as VRMExpressionTextureTransformBind,on as VRMFirstPerson,Ze as VRMFirstPersonLoaderPlugin,Vo as VRMFirstPersonMeshAnnotationType,Be as VRMHumanBoneList,Io as VRMHumanBoneName,or as VRMHumanBoneParentMap,dn as VRMHumanoid,ln as VRMHumanoidHelper,Je as VRMHumanoidLoaderPlugin,dt as VRMLoaderPlugin,Rr as VRMLookAt,He as VRMLookAtBoneApplier,qe as VRMLookAtExpressionApplier,pr as VRMLookAtHelper,et as VRMLookAtLoaderPlugin,En as VRMLookAtRangeMap,Uo as VRMLookAtTypeName,tt as VRMMetaLoaderPlugin,lt as VRMNodeConstraint,st as VRMNodeConstraintHelper,ti as VRMNodeConstraintLoaderPlugin,no as VRMNodeConstraintManager,lr as VRMRequiredHumanBoneName,uo as VRMRollConstraint,oo as VRMRotationConstraint,ii as VRMSpringBoneCollider,ni as VRMSpringBoneColliderHelper,ai as VRMSpringBoneColliderShape,li as VRMSpringBoneColliderShapeCapsule,di as VRMSpringBoneColliderShapeSphere,xo as VRMSpringBoneJoint,go as VRMSpringBoneJointHelper,gi as VRMSpringBoneLoaderPlugin,si as VRMSpringBoneManager,he as VRMUtils};
|
|
930
930
|
/*!
|
|
931
|
-
* @pixiv/three-vrm-core v3.0.0
|
|
931
|
+
* @pixiv/three-vrm-core v3.0.0
|
|
932
932
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
933
933
|
*
|
|
934
934
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -936,7 +936,7 @@ void main() {
|
|
|
936
936
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
937
937
|
*/
|
|
938
938
|
/*!
|
|
939
|
-
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
939
|
+
* @pixiv/three-vrm-materials-mtoon v3.0.0
|
|
940
940
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
941
941
|
*
|
|
942
942
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -944,7 +944,7 @@ void main() {
|
|
|
944
944
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
945
945
|
*/
|
|
946
946
|
/*!
|
|
947
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
947
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.0.0
|
|
948
948
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
949
949
|
*
|
|
950
950
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -952,7 +952,7 @@ void main() {
|
|
|
952
952
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
953
953
|
*/
|
|
954
954
|
/*!
|
|
955
|
-
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
955
|
+
* @pixiv/three-vrm-materials-v0compat v3.0.0
|
|
956
956
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
957
957
|
*
|
|
958
958
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -960,7 +960,7 @@ void main() {
|
|
|
960
960
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
961
961
|
*/
|
|
962
962
|
/*!
|
|
963
|
-
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
963
|
+
* @pixiv/three-vrm-node-constraint v3.0.0
|
|
964
964
|
* Node constraint module for @pixiv/three-vrm
|
|
965
965
|
*
|
|
966
966
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -968,7 +968,7 @@ void main() {
|
|
|
968
968
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
969
969
|
*/
|
|
970
970
|
/*!
|
|
971
|
-
* @pixiv/three-vrm-springbone v3.0.0
|
|
971
|
+
* @pixiv/three-vrm-springbone v3.0.0
|
|
972
972
|
* Spring bone module for @pixiv/three-vrm
|
|
973
973
|
*
|
|
974
974
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixiv/three-vrm",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "VRM file loader for three.js.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "pixiv",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@pixiv/three-vrm-core": "3.0.0
|
|
60
|
-
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "3.0.0
|
|
61
|
-
"@pixiv/three-vrm-materials-mtoon": "3.0.0
|
|
62
|
-
"@pixiv/three-vrm-materials-v0compat": "3.0.0
|
|
63
|
-
"@pixiv/three-vrm-node-constraint": "3.0.0
|
|
64
|
-
"@pixiv/three-vrm-springbone": "3.0.0
|
|
59
|
+
"@pixiv/three-vrm-core": "3.0.0",
|
|
60
|
+
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "3.0.0",
|
|
61
|
+
"@pixiv/three-vrm-materials-mtoon": "3.0.0",
|
|
62
|
+
"@pixiv/three-vrm-materials-v0compat": "3.0.0",
|
|
63
|
+
"@pixiv/three-vrm-node-constraint": "3.0.0",
|
|
64
|
+
"@pixiv/three-vrm-springbone": "3.0.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/three": "^0.167.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"three": ">=0.137"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "56deda5955201e83e3380f40e44d3d8afd941e05"
|
|
74
74
|
}
|