@pixiv/three-vrm 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/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/lib/nodes/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.1.
|
|
2
|
+
* @pixiv/three-vrm v3.1.3
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -522,7 +522,7 @@ var MToonNodeMaterial = class extends THREE8.NodeMaterial {
|
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
524
|
/*!
|
|
525
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
525
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
526
526
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
527
527
|
*
|
|
528
528
|
* 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 B=Object.create;var v=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,Z=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var o in t)v(e,o,{get:t[o],enumerable:!0})},O=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of K(t))!Z.call(e,l)&&l!==o&&v(e,l,{get:()=>t[l],enumerable:!(r=q(t,l))||r.enumerable});return e};var h=(e,t,o)=>(o=e!=null?B(j(e)):{},O(t||!e||!e.__esModule?v(o,"default",{value:e,enumerable:!0}):o,e)),G=e=>O(v({},"__esModule",{value:!0}),e);var Ce={};$(Ce,{MToonAnimatedUVNode:()=>D,MToonLightingModel:()=>z,MToonNodeMaterial:()=>ye});module.exports=G(Ce);var b=h(require("three"),1),s=h(require("three/webgpu"),1),a=h(require("three/webgpu"),1),n=h(require("three/webgpu"),1),m=h(require("three/webgpu"),1),p=h(require("three/webgpu"),1),i=h(require("three/webgpu"),1),E=h(require("three/webgpu"),1);var W=parseInt(b.REVISION,10);W<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${W}). This would not work correctly.`);var J=a.materialReference("color","color"),Q=a.materialReference("map","texture"),ee=a.materialReference("normalMap","texture"),te=a.materialReference("normalScale","vec2"),ie=a.materialReference("emissive","color"),oe=a.materialReference("emissiveIntensity","float"),re=a.materialReference("emissiveMap","texture"),ae=a.materialReference("shadeColorFactor","color"),le=a.materialReference("shadingShiftFactor","float"),U=a.materialReference("shadeMultiplyTexture","texture"),ne=a.materialReference("shadeMultiplyTextureScale","float"),se=a.materialReference("shadingToonyFactor","float"),me=a.materialReference("rimLightingMixFactor","float"),ue=a.materialReference("rimMultiplyTexture","texture"),he=a.materialReference("matcapFactor","color"),de=a.materialReference("matcapTexture","texture"),ce=a.materialReference("parametricRimColorFactor","color"),pe=a.materialReference("parametricRimLiftFactor","float"),Ee=a.materialReference("parametricRimFresnelPowerFactor","float"),Re=a.materialReference("outlineWidthMultiplyTexture","texture"),fe=a.materialReference("outlineWidthFactor","float"),I=a.materialReference("outlineColorFactor","color"),Te=a.materialReference("outlineLightingMixFactor","float"),ve=a.materialReference("uvAnimationMaskTexture","texture"),Ne=a.materialReference("uvAnimationScrollXOffset","float"),ge=a.materialReference("uvAnimationScrollYOffset","float"),He=a.materialReference("uvAnimationRotationPhase","float"),D=class extends s.TempNode{constructor(e){super("vec2"),this.hasMaskTexture=e}setup(){let e=1;this.hasMaskTexture&&(e=s.vec4(ve).context({getUV:()=>s.uv()}).r);let t=s.uv(),o=He.mul(e),r=s.cos(o),l=s.sin(o);t=t.sub(s.vec2(.5,.5)),t=t.mul(s.mat2(r,l,l.negate(),r)),t=t.add(s.vec2(.5,.5));let u=s.vec2(Ne,ge).mul(e);return t=t.add(u),t.temp("AnimatedUV")}},k=m.nodeImmutable(m.PropertyNode,"vec3").temp("ShadeColor"),Y=m.nodeImmutable(m.PropertyNode,"float").temp("ShadingShift"),X=m.nodeImmutable(m.PropertyNode,"float").temp("ShadingToony"),g=m.nodeImmutable(m.PropertyNode,"float").temp("RimLightingMix"),H=m.nodeImmutable(m.PropertyNode,"vec3").temp("RimMultiply"),M=m.nodeImmutable(m.PropertyNode,"vec3").temp("matcap"),x=m.nodeImmutable(m.PropertyNode,"vec3").temp("ParametricRim"),N=e=>parseInt(p.REVISION,10)>=168?p.Fn(e):p.tslFn(e),Me=N(({a:e,b:t,t:o})=>{let r=o.sub(e),l=t.sub(e);return r.div(l).clamp()}),xe=N(({dotNL:e})=>{let o=n.float(1).sub(X),r=e.add(Y);return r=Me({a:o.negate(),b:o,t:r}),r=r.mul(1),r}),Se=N(({shading:e,lightColor:t})=>{let o=n.mix(k,n.diffuseColor,e);return t.mul(n.BRDF_Lambert({diffuseColor:o}))}),z=class extends n.LightingModel{constructor(){super()}direct({lightDirection:e,lightColor:t,reflectedLight:o}){let r=n.transformedNormalView.dot(e).clamp(-1,1),l=xe({dotNL:r});o.directDiffuse.assign(o.directDiffuse.add(Se({shading:l,lightColor:t}))),o.directSpecular.assign(o.directSpecular.add(x.add(M).mul(H).mul(n.mix(n.vec3(0),n.BRDF_Lambert({diffuseColor:t}),g))))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.assign(t.indirectDiffuse.add(e.mul(n.BRDF_Lambert({diffuseColor:n.diffuseColor}))))}indirectSpecular({reflectedLight:e}){e.indirectSpecular.assign(e.indirectSpecular.add(x.add(M).mul(H).mul(n.mix(n.vec3(1),n.vec3(0),g))))}},f={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},Fe=N(({parametricRimLift:e,parametricRimFresnelPower:t,parametricRimColor:o})=>{let r=E.modelViewPosition.normalize(),l=E.transformedNormalView.dot(r.negate());return E.float(1).sub(l).add(e).clamp().pow(t).mul(o)}),ye=class extends i.NodeMaterial{customProgramCacheKey(){let e=super.customProgramCacheKey();return e+=`isOutline:${this.isOutline},`,e}get isMToonNodeMaterial(){return!0}constructor(e={}){super(),e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,delete e.giEqualizationFactor,delete e.v0CompatShade,delete e.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(e)}setupLightingModel(){return new z}setup(e){var t;this._animatedUVNode=new D((t=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?t:!1),super.setup(e)}setupDiffuseColor(e){let t=null;if(this.colorNode==null){if(t=J,this.map&&this.map.isTexture===!0){let o=Q.context({getUV:()=>this._animatedUVNode});t=t.mul(o)}this.colorNode=t}this.vertexColors===!0&&e.geometry.hasAttribute("color")&&(console.warn("MToonNodeMaterial: MToon ignores vertex colors. Consider using a model without vertex colors instead."),this.vertexColors=!1),super.setupDiffuseColor(e),parseInt(i.REVISION,10)<166&&this.transparent===!1&&this.blending===i.NormalBlending&&this.alphaToCoverage===!1&&i.diffuseColor.a.assign(1),this.colorNode===t&&(this.colorNode=null)}setupVariants(){k.assign(this._setupShadeColorNode()),Y.assign(this._setupShadingShiftNode()),X.assign(this._setupShadingToonyNode()),g.assign(this._setupRimLightingMixNode()),H.assign(this._setupRimMultiplyNode()),M.assign(this._setupMatcapNode()),x.assign(this._setupParametricRimNode())}setupNormal(e){let t=this.normalNode;if(this.normalNode==null){if(this.normalNode=i.materialNormal,this.normalMap&&this.normalMap.isTexture===!0){let r=ee.context({getUV:()=>this._animatedUVNode});this.normalNode=i.normalMap(r,te)}this.isOutline&&(this.normalNode=this.normalNode.negate())}if(parseInt(i.REVISION,10)>=168){let r=this.normalNode;return this.normalNode=t,r}else{super.setupNormal(e),this.normalNode=t;return}}setupLighting(e){let t=null;if(this.emissiveNode==null){if(t=ie.mul(oe),this.emissiveMap&&this.emissiveMap.isTexture===!0){let r=re.context({getUV:()=>this._animatedUVNode});t=t.mul(r)}this.emissiveNode=t}let o=super.setupLighting(e);return this.emissiveNode===t&&(this.emissiveNode=null),o}setupOutput(e,t){return this.isOutline&&this.outlineWidthMode!==f.None&&(t=i.vec4(i.mix(I,t.xyz.mul(I),Te),t.w)),super.setupOutput(e,t)}setupPosition(e){var t,o;let r=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==f.None){(t=this.positionNode)!=null||(this.positionNode=i.positionLocal);let u=i.normalLocal.normalize(),d=fe;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let c=Re.context({getUV:()=>this._animatedUVNode});d=d.mul(c)}let T=i.length(i.modelNormalMatrix.mul(u)),R=d.mul(T).mul(u);if(this.outlineWidthMode===f.WorldCoordinates)this.positionNode=this.positionNode.add(R);else if(this.outlineWidthMode===f.ScreenCoordinates){let c=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(R.div(c).mul(i.positionView.z.negate()))}(o=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let l=super.setupPosition(e);return l.z.add(l.w.mul(1e-6)),this.positionNode=r,l}copy(e){var t,o,r,l,u,d,T,R,c,S,F,y,C,_,L,w,V,P,A;return this.color.copy(e.color),this.map=(t=e.map)!=null?t:null,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.emissiveMap=(o=e.emissiveMap)!=null?o:null,this.normalMap=(r=e.normalMap)!=null?r:null,this.normalScale.copy(e.normalScale),this.shadeColorFactor.copy(e.shadeColorFactor),this.shadeMultiplyTexture=(l=e.shadeMultiplyTexture)!=null?l:null,this.shadingShiftFactor=e.shadingShiftFactor,this.shadingShiftTexture=(u=e.shadingShiftTexture)!=null?u:null,this.shadingShiftTextureScale=e.shadingShiftTextureScale,this.shadingToonyFactor=e.shadingToonyFactor,this.rimLightingMixFactor=e.rimLightingMixFactor,this.rimMultiplyTexture=(d=e.rimMultiplyTexture)!=null?d:null,this.matcapFactor.copy(e.matcapFactor),this.matcapTexture=(T=e.matcapTexture)!=null?T:null,this.parametricRimColorFactor.copy(e.parametricRimColorFactor),this.parametricRimLiftFactor=e.parametricRimLiftFactor,this.parametricRimFresnelPowerFactor=e.parametricRimFresnelPowerFactor,this.outlineWidthMode=e.outlineWidthMode,this.outlineWidthMultiplyTexture=(R=e.outlineWidthMultiplyTexture)!=null?R:null,this.outlineWidthFactor=e.outlineWidthFactor,this.outlineColorFactor.copy(e.outlineColorFactor),this.outlineLightingMixFactor=e.outlineLightingMixFactor,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.uvAnimationMaskTexture=(c=e.uvAnimationMaskTexture)!=null?c:null,this.shadeColorNode=(S=e.shadeColorNode)!=null?S:null,this.shadingShiftNode=(F=e.shadingShiftNode)!=null?F:null,this.shadingToonyNode=(y=e.shadingToonyNode)!=null?y:null,this.rimLightingMixNode=(C=e.rimLightingMixNode)!=null?C:null,this.rimMultiplyNode=(_=e.rimMultiplyNode)!=null?_:null,this.matcapNode=(L=e.matcapNode)!=null?L:null,this.parametricRimColorNode=(w=e.parametricRimColorNode)!=null?w:null,this.parametricRimLiftNode=(V=e.parametricRimLiftNode)!=null?V:null,this.parametricRimFresnelPowerNode=(P=e.parametricRimFresnelPowerNode)!=null?P:null,this.isOutline=(A=e.isOutline)!=null?A:null,super.copy(e)}update(e){this.uvAnimationScrollXOffset+=e*this.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYOffset+=e*this.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationPhase+=e*this.uvAnimationRotationSpeedFactor}_setupShadeColorNode(){if(this.shadeColorNode!=null)return i.vec3(this.shadeColorNode);let e=ae;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let t=U.context({getUV:()=>this._animatedUVNode});e=e.mul(t)}return e}_setupShadingShiftNode(){if(this.shadingShiftNode!=null)return i.float(this.shadingShiftNode);let e=le;if(this.shadingShiftTexture&&this.shadingShiftTexture.isTexture===!0){let t=U.context({getUV:()=>this._animatedUVNode});e=e.add(t.mul(ne))}return e}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):se}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):me}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?ue.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?de.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(he):i.vec3(0)}_setupParametricRimNode(){let e=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):ce,t=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):pe,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):Ee;return Fe({parametricRimLift:t,parametricRimFresnelPower:o,parametricRimColor:e})}};
|
|
3
3
|
/*!
|
|
4
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
4
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
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.1.
|
|
2
|
+
* @pixiv/three-vrm v3.1.3
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -490,7 +490,7 @@ export {
|
|
|
490
490
|
MToonNodeMaterial
|
|
491
491
|
};
|
|
492
492
|
/*!
|
|
493
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
493
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
494
494
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
495
495
|
*
|
|
496
496
|
* 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 W from"three";import*as n from"three/webgpu";import*as r from"three/webgpu";import*as l from"three/webgpu";import*as s from"three/webgpu";import*as c from"three/webgpu";import*as i from"three/webgpu";import*as p from"three/webgpu";var P=parseInt(W.REVISION,10);P<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${P}). This would not work correctly.`);var D=r.materialReference("color","color"),k=r.materialReference("map","texture"),Y=r.materialReference("normalMap","texture"),X=r.materialReference("normalScale","vec2"),z=r.materialReference("emissive","color"),B=r.materialReference("emissiveIntensity","float"),q=r.materialReference("emissiveMap","texture"),K=r.materialReference("shadeColorFactor","color"),j=r.materialReference("shadingShiftFactor","float"),A=r.materialReference("shadeMultiplyTexture","texture"),Z=r.materialReference("shadeMultiplyTextureScale","float"),$=r.materialReference("shadingToonyFactor","float"),G=r.materialReference("rimLightingMixFactor","float"),J=r.materialReference("rimMultiplyTexture","texture"),Q=r.materialReference("matcapFactor","color"),ee=r.materialReference("matcapTexture","texture"),te=r.materialReference("parametricRimColorFactor","color"),ie=r.materialReference("parametricRimLiftFactor","float"),oe=r.materialReference("parametricRimFresnelPowerFactor","float"),re=r.materialReference("outlineWidthMultiplyTexture","texture"),ae=r.materialReference("outlineWidthFactor","float"),O=r.materialReference("outlineColorFactor","color"),le=r.materialReference("outlineLightingMixFactor","float"),ne=r.materialReference("uvAnimationMaskTexture","texture"),se=r.materialReference("uvAnimationScrollXOffset","float"),me=r.materialReference("uvAnimationScrollYOffset","float"),ue=r.materialReference("uvAnimationRotationPhase","float"),he=class extends n.TempNode{constructor(e){super("vec2"),this.hasMaskTexture=e}setup(){let e=1;this.hasMaskTexture&&(e=n.vec4(ne).context({getUV:()=>n.uv()}).r);let t=n.uv(),o=ue.mul(e),a=n.cos(o),m=n.sin(o);t=t.sub(n.vec2(.5,.5)),t=t.mul(n.mat2(a,m,m.negate(),a)),t=t.add(n.vec2(.5,.5));let u=n.vec2(se,me).mul(e);return t=t.add(u),t.temp("AnimatedUV")}},U=s.nodeImmutable(s.PropertyNode,"vec3").temp("ShadeColor"),I=s.nodeImmutable(s.PropertyNode,"float").temp("ShadingShift"),b=s.nodeImmutable(s.PropertyNode,"float").temp("ShadingToony"),v=s.nodeImmutable(s.PropertyNode,"float").temp("RimLightingMix"),N=s.nodeImmutable(s.PropertyNode,"vec3").temp("RimMultiply"),g=s.nodeImmutable(s.PropertyNode,"vec3").temp("matcap"),H=s.nodeImmutable(s.PropertyNode,"vec3").temp("ParametricRim"),T=e=>parseInt(c.REVISION,10)>=168?c.Fn(e):c.tslFn(e),de=T(({a:e,b:t,t:o})=>{let a=o.sub(e),m=t.sub(e);return a.div(m).clamp()}),ce=T(({dotNL:e})=>{let o=l.float(1).sub(b),a=e.add(I);return a=de({a:o.negate(),b:o,t:a}),a=a.mul(1),a}),pe=T(({shading:e,lightColor:t})=>{let o=l.mix(U,l.diffuseColor,e);return t.mul(l.BRDF_Lambert({diffuseColor:o}))}),Ee=class extends l.LightingModel{constructor(){super()}direct({lightDirection:e,lightColor:t,reflectedLight:o}){let a=l.transformedNormalView.dot(e).clamp(-1,1),m=ce({dotNL:a});o.directDiffuse.assign(o.directDiffuse.add(pe({shading:m,lightColor:t}))),o.directSpecular.assign(o.directSpecular.add(H.add(g).mul(N).mul(l.mix(l.vec3(0),l.BRDF_Lambert({diffuseColor:t}),v))))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.assign(t.indirectDiffuse.add(e.mul(l.BRDF_Lambert({diffuseColor:l.diffuseColor}))))}indirectSpecular({reflectedLight:e}){e.indirectSpecular.assign(e.indirectSpecular.add(H.add(g).mul(N).mul(l.mix(l.vec3(1),l.vec3(0),v))))}},R={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"},Re=T(({parametricRimLift:e,parametricRimFresnelPower:t,parametricRimColor:o})=>{let a=p.modelViewPosition.normalize(),m=p.transformedNormalView.dot(a.negate());return p.float(1).sub(m).add(e).clamp().pow(t).mul(o)}),fe=class extends i.NodeMaterial{customProgramCacheKey(){let e=super.customProgramCacheKey();return e+=`isOutline:${this.isOutline},`,e}get isMToonNodeMaterial(){return!0}constructor(e={}){super(),e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,delete e.giEqualizationFactor,delete e.v0CompatShade,delete e.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=R.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(e)}setupLightingModel(){return new Ee}setup(e){var t;this._animatedUVNode=new he((t=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?t:!1),super.setup(e)}setupDiffuseColor(e){let t=null;if(this.colorNode==null){if(t=D,this.map&&this.map.isTexture===!0){let o=k.context({getUV:()=>this._animatedUVNode});t=t.mul(o)}this.colorNode=t}this.vertexColors===!0&&e.geometry.hasAttribute("color")&&(console.warn("MToonNodeMaterial: MToon ignores vertex colors. Consider using a model without vertex colors instead."),this.vertexColors=!1),super.setupDiffuseColor(e),parseInt(i.REVISION,10)<166&&this.transparent===!1&&this.blending===i.NormalBlending&&this.alphaToCoverage===!1&&i.diffuseColor.a.assign(1),this.colorNode===t&&(this.colorNode=null)}setupVariants(){U.assign(this._setupShadeColorNode()),I.assign(this._setupShadingShiftNode()),b.assign(this._setupShadingToonyNode()),v.assign(this._setupRimLightingMixNode()),N.assign(this._setupRimMultiplyNode()),g.assign(this._setupMatcapNode()),H.assign(this._setupParametricRimNode())}setupNormal(e){let t=this.normalNode;if(this.normalNode==null){if(this.normalNode=i.materialNormal,this.normalMap&&this.normalMap.isTexture===!0){let a=Y.context({getUV:()=>this._animatedUVNode});this.normalNode=i.normalMap(a,X)}this.isOutline&&(this.normalNode=this.normalNode.negate())}if(parseInt(i.REVISION,10)>=168){let a=this.normalNode;return this.normalNode=t,a}else{super.setupNormal(e),this.normalNode=t;return}}setupLighting(e){let t=null;if(this.emissiveNode==null){if(t=z.mul(B),this.emissiveMap&&this.emissiveMap.isTexture===!0){let a=q.context({getUV:()=>this._animatedUVNode});t=t.mul(a)}this.emissiveNode=t}let o=super.setupLighting(e);return this.emissiveNode===t&&(this.emissiveNode=null),o}setupOutput(e,t){return this.isOutline&&this.outlineWidthMode!==R.None&&(t=i.vec4(i.mix(O,t.xyz.mul(O),le),t.w)),super.setupOutput(e,t)}setupPosition(e){var t,o;let a=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==R.None){(t=this.positionNode)!=null||(this.positionNode=i.positionLocal);let u=i.normalLocal.normalize(),h=ae;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let d=re.context({getUV:()=>this._animatedUVNode});h=h.mul(d)}let f=i.length(i.modelNormalMatrix.mul(u)),E=h.mul(f).mul(u);if(this.outlineWidthMode===R.WorldCoordinates)this.positionNode=this.positionNode.add(E);else if(this.outlineWidthMode===R.ScreenCoordinates){let d=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(E.div(d).mul(i.positionView.z.negate()))}(o=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let m=super.setupPosition(e);return m.z.add(m.w.mul(1e-6)),this.positionNode=a,m}copy(e){var t,o,a,m,u,h,f,E,d,M,x,S,F,y,C,_,L,w,V;return this.color.copy(e.color),this.map=(t=e.map)!=null?t:null,this.emissive.copy(e.emissive),this.emissiveIntensity=e.emissiveIntensity,this.emissiveMap=(o=e.emissiveMap)!=null?o:null,this.normalMap=(a=e.normalMap)!=null?a:null,this.normalScale.copy(e.normalScale),this.shadeColorFactor.copy(e.shadeColorFactor),this.shadeMultiplyTexture=(m=e.shadeMultiplyTexture)!=null?m:null,this.shadingShiftFactor=e.shadingShiftFactor,this.shadingShiftTexture=(u=e.shadingShiftTexture)!=null?u:null,this.shadingShiftTextureScale=e.shadingShiftTextureScale,this.shadingToonyFactor=e.shadingToonyFactor,this.rimLightingMixFactor=e.rimLightingMixFactor,this.rimMultiplyTexture=(h=e.rimMultiplyTexture)!=null?h:null,this.matcapFactor.copy(e.matcapFactor),this.matcapTexture=(f=e.matcapTexture)!=null?f:null,this.parametricRimColorFactor.copy(e.parametricRimColorFactor),this.parametricRimLiftFactor=e.parametricRimLiftFactor,this.parametricRimFresnelPowerFactor=e.parametricRimFresnelPowerFactor,this.outlineWidthMode=e.outlineWidthMode,this.outlineWidthMultiplyTexture=(E=e.outlineWidthMultiplyTexture)!=null?E:null,this.outlineWidthFactor=e.outlineWidthFactor,this.outlineColorFactor.copy(e.outlineColorFactor),this.outlineLightingMixFactor=e.outlineLightingMixFactor,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.uvAnimationMaskTexture=(d=e.uvAnimationMaskTexture)!=null?d:null,this.shadeColorNode=(M=e.shadeColorNode)!=null?M:null,this.shadingShiftNode=(x=e.shadingShiftNode)!=null?x:null,this.shadingToonyNode=(S=e.shadingToonyNode)!=null?S:null,this.rimLightingMixNode=(F=e.rimLightingMixNode)!=null?F:null,this.rimMultiplyNode=(y=e.rimMultiplyNode)!=null?y:null,this.matcapNode=(C=e.matcapNode)!=null?C:null,this.parametricRimColorNode=(_=e.parametricRimColorNode)!=null?_:null,this.parametricRimLiftNode=(L=e.parametricRimLiftNode)!=null?L:null,this.parametricRimFresnelPowerNode=(w=e.parametricRimFresnelPowerNode)!=null?w:null,this.isOutline=(V=e.isOutline)!=null?V:null,super.copy(e)}update(e){this.uvAnimationScrollXOffset+=e*this.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYOffset+=e*this.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationPhase+=e*this.uvAnimationRotationSpeedFactor}_setupShadeColorNode(){if(this.shadeColorNode!=null)return i.vec3(this.shadeColorNode);let e=K;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let t=A.context({getUV:()=>this._animatedUVNode});e=e.mul(t)}return e}_setupShadingShiftNode(){if(this.shadingShiftNode!=null)return i.float(this.shadingShiftNode);let e=j;if(this.shadingShiftTexture&&this.shadingShiftTexture.isTexture===!0){let t=A.context({getUV:()=>this._animatedUVNode});e=e.add(t.mul(Z))}return e}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):$}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):G}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?J.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?ee.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(Q):i.vec3(0)}_setupParametricRimNode(){let e=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):te,t=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):ie,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):oe;return Re({parametricRimLift:t,parametricRimFresnelPower:o,parametricRimColor:e})}};export{he as MToonAnimatedUVNode,Ee as MToonLightingModel,fe as MToonNodeMaterial};
|
|
3
3
|
/*!
|
|
4
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
4
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
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.1.
|
|
2
|
+
* @pixiv/three-vrm v3.1.3
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6266,7 +6266,7 @@ VRMUtils.removeUnnecessaryJoints = removeUnnecessaryJoints;
|
|
|
6266
6266
|
VRMUtils.removeUnnecessaryVertices = removeUnnecessaryVertices;
|
|
6267
6267
|
VRMUtils.rotateVRM0 = rotateVRM0;
|
|
6268
6268
|
/*!
|
|
6269
|
-
* @pixiv/three-vrm-core v3.1.
|
|
6269
|
+
* @pixiv/three-vrm-core v3.1.3
|
|
6270
6270
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
6271
6271
|
*
|
|
6272
6272
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6274,7 +6274,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6274
6274
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6275
6275
|
*/
|
|
6276
6276
|
/*!
|
|
6277
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
6277
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
6278
6278
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6279
6279
|
*
|
|
6280
6280
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6282,7 +6282,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6282
6282
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6283
6283
|
*/
|
|
6284
6284
|
/*!
|
|
6285
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.
|
|
6285
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.3
|
|
6286
6286
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
6287
6287
|
*
|
|
6288
6288
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6290,7 +6290,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6290
6290
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6291
6291
|
*/
|
|
6292
6292
|
/*!
|
|
6293
|
-
* @pixiv/three-vrm-materials-v0compat v3.1.
|
|
6293
|
+
* @pixiv/three-vrm-materials-v0compat v3.1.3
|
|
6294
6294
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
6295
6295
|
*
|
|
6296
6296
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6298,7 +6298,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6298
6298
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6299
6299
|
*/
|
|
6300
6300
|
/*!
|
|
6301
|
-
* @pixiv/three-vrm-node-constraint v3.1.
|
|
6301
|
+
* @pixiv/three-vrm-node-constraint v3.1.3
|
|
6302
6302
|
* Node constraint module for @pixiv/three-vrm
|
|
6303
6303
|
*
|
|
6304
6304
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6306,7 +6306,7 @@ VRMUtils.rotateVRM0 = rotateVRM0;
|
|
|
6306
6306
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6307
6307
|
*/
|
|
6308
6308
|
/*!
|
|
6309
|
-
* @pixiv/three-vrm-springbone v3.1.
|
|
6309
|
+
* @pixiv/three-vrm-springbone v3.1.3
|
|
6310
6310
|
* Spring bone module for @pixiv/three-vrm
|
|
6311
6311
|
*
|
|
6312
6312
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/three-vrm.min.cjs
CHANGED
|
@@ -923,7 +923,7 @@ void main() {
|
|
|
923
923
|
`)+`
|
|
924
924
|
`;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_SCREEN:this._isOutline&&this._outlineWidthMode===bt.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},ho=new Set(["1.0","1.0-beta"]),hi=class Je{get name(){return Je.EXTENSION_NAME}constructor(e,n={}){var i,r,o,a;this.parser=e,this.materialType=(i=n.materialType)!=null?i:di,this.renderOrderOffset=(r=n.renderOrderOffset)!=null?r:0,this.v0CompatShade=(o=n.v0CompatShade)!=null?o:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return le(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return le(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 le(this,null,function*(){var n;let i=this.parser,o=(n=i.json.meshes)==null?void 0:n[e];if(o==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);let a=o.primitives,l=yield i.loadMesh(e);if(a.length===1){let s=l,u=a[0].material;u!=null&&this._setupPrimitive(s,u)}else{let s=l;for(let u=0;u<a.length;u++){let d=s.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,o)=>{var a;this._getMToonExtension(o)&&((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 s=l.specVersion;if(!ho.has(s)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${Je.EXTENSION_NAME} specVersion "${s}"`);return}return l}_extendMaterialParams(e,n){return le(this,null,function*(){var i;delete n.metalness,delete n.roughness;let r=new so(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 Ke.Material)||!this._shouldGenerateOutline(n))return;e.material=[n];let i=n.clone();i.name+=" (Outline)",i.isOutline=!0,i.side=Ke.BackSide,e.material.push(i);let r=e.geometry,o=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,o,0),r.addGroup(0,o,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)}};hi.EXTENSION_NAME="VRMC_materials_mtoon";var Vt=hi;var co=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),ci=class It{get name(){return It.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return co(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[It.EXTENSION_NAME];if(l!=null)return l}};ci.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var pi=ci;var gi=E(require("three"),1);var po=Object.defineProperty,mo=Object.defineProperties,fo=Object.getOwnPropertyDescriptors,mi=Object.getOwnPropertySymbols,_o=Object.prototype.hasOwnProperty,go=Object.prototype.propertyIsEnumerable,fi=(t,e,n)=>e in t?po(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,G=(t,e)=>{for(var n in e||(e={}))_o.call(e,n)&&fi(t,n,e[n]);if(mi)for(var n of mi(e))go.call(e,n)&&fi(t,n,e[n]);return t},_i=(t,e)=>mo(t,fo(e)),vo=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())});function ve(t){return Math.pow(t,2.2)}var vi=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 vo(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,o)=>{var a,l;let s=(a=e.materials)==null?void 0:a[o];if(s==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(r.shader==="VRM/MToon"){let u=this._parseV0MToonProperties(r,s);e.materials[o]=u}else if((l=r.shader)!=null&&l.startsWith("VRM/Unlit")){let u=this._parseV0UnlitProperties(r,s);e.materials[o]=u}else r.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${r.shader}`)}))})}_parseV0MToonProperties(t,e){var n,i,r,o,a,l,s,u,d,c,f,p,m,h,_,g,x,T,v,R,M,y,A,V,L,H,U,$,xe,ye,J,k,pe,we,O,zt,Gt,jt,Qt,Xt,Yt,qt,Zt,$t,Jt,Kt,en,tn,nn,rn,on,sn,an,ln,un;let dn=(i=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?i:!1,ji=((r=t.floatProperties)==null?void 0:r._ZWrite)===1&&dn,Qi=this._v0ParseRenderQueue(t),hn=(a=(o=t.keywordMap)==null?void 0:o._ALPHATEST_ON)!=null?a:!1,Xi=dn?"BLEND":hn?"MASK":"OPAQUE",Yi=hn?(s=(l=t.floatProperties)==null?void 0:l._Cutoff)!=null?s:.5:void 0,qi=((d=(u=t.floatProperties)==null?void 0:u._CullMode)!=null?d:2)===0,oe=this._portTextureTransform(t),Zi=((f=(c=t.vectorProperties)==null?void 0:c._Color)!=null?f:[1,1,1,1]).map((Mn,Mr)=>Mr===3?Mn:ve(Mn)),cn=(p=t.textureProperties)==null?void 0:p._MainTex,$i=cn!=null?{index:cn,extensions:G({},oe)}:void 0,Ji=(h=(m=t.floatProperties)==null?void 0:m._BumpScale)!=null?h:1,pn=(_=t.textureProperties)==null?void 0:_._BumpMap,Ki=pn!=null?{index:pn,scale:Ji,extensions:G({},oe)}:void 0,er=((x=(g=t.vectorProperties)==null?void 0:g._EmissionColor)!=null?x:[0,0,0,1]).map(ve),mn=(T=t.textureProperties)==null?void 0:T._EmissionMap,tr=mn!=null?{index:mn,extensions:G({},oe)}:void 0,nr=((R=(v=t.vectorProperties)==null?void 0:v._ShadeColor)!=null?R:[.97,.81,.86,1]).map(ve),fn=(M=t.textureProperties)==null?void 0:M._ShadeTexture,ir=fn!=null?{index:fn,extensions:G({},oe)}:void 0,Ue=(A=(y=t.floatProperties)==null?void 0:y._ShadeShift)!=null?A:0,Oe=(L=(V=t.floatProperties)==null?void 0:V._ShadeToony)!=null?L:.9;Oe=gi.MathUtils.lerp(Oe,1,.5+.5*Ue),Ue=-Ue-(1-Oe);let _n=(U=(H=t.floatProperties)==null?void 0:H._IndirectLightIntensity)!=null?U:.1,rr=_n?1-_n:void 0,dt=($=t.textureProperties)==null?void 0:$._SphereAdd,or=dt!=null?[1,1,1]:void 0,sr=dt!=null?{index:dt}:void 0,ar=(ye=(xe=t.floatProperties)==null?void 0:xe._RimLightingMix)!=null?ye:0,gn=(J=t.textureProperties)==null?void 0:J._RimTexture,lr=gn!=null?{index:gn,extensions:G({},oe)}:void 0,ur=((pe=(k=t.vectorProperties)==null?void 0:k._RimColor)!=null?pe:[0,0,0,1]).map(ve),dr=(O=(we=t.floatProperties)==null?void 0:we._RimFresnelPower)!=null?O:1,hr=(Gt=(zt=t.floatProperties)==null?void 0:zt._RimLift)!=null?Gt:0,cr=["none","worldCoordinates","screenCoordinates"][(Qt=(jt=t.floatProperties)==null?void 0:jt._OutlineWidthMode)!=null?Qt:0],ht=(Yt=(Xt=t.floatProperties)==null?void 0:Xt._OutlineWidth)!=null?Yt:0;ht=.01*ht;let vn=(qt=t.textureProperties)==null?void 0:qt._OutlineWidthTexture,pr=vn!=null?{index:vn,extensions:G({},oe)}:void 0,mr=(($t=(Zt=t.vectorProperties)==null?void 0:Zt._OutlineColor)!=null?$t:[0,0,0]).map(ve),fr=((Kt=(Jt=t.floatProperties)==null?void 0:Jt._OutlineColorMode)!=null?Kt:0)===1?(tn=(en=t.floatProperties)==null?void 0:en._OutlineLightingMix)!=null?tn:1:0,En=(nn=t.textureProperties)==null?void 0:nn._UvAnimMaskTexture,_r=En!=null?{index:En,extensions:G({},oe)}:void 0,gr=(on=(rn=t.floatProperties)==null?void 0:rn._UvAnimScrollX)!=null?on:0,Ne=(an=(sn=t.floatProperties)==null?void 0:sn._UvAnimScrollY)!=null?an:0;Ne!=null&&(Ne=-Ne);let vr=(un=(ln=t.floatProperties)==null?void 0:ln._UvAnimRotation)!=null?un:0,Er={specVersion:"1.0",transparentWithZWrite:ji,renderQueueOffsetNumber:Qi,shadeColorFactor:nr,shadeMultiplyTexture:ir,shadingShiftFactor:Ue,shadingToonyFactor:Oe,giEqualizationFactor:rr,matcapFactor:or,matcapTexture:sr,rimLightingMixFactor:ar,rimMultiplyTexture:lr,parametricRimColorFactor:ur,parametricRimFresnelPowerFactor:dr,parametricRimLiftFactor:hr,outlineWidthMode:cr,outlineWidthFactor:ht,outlineWidthMultiplyTexture:pr,outlineColorFactor:mr,outlineLightingMixFactor:fr,uvAnimationMaskTexture:_r,uvAnimationScrollXSpeedFactor:gr,uvAnimationScrollYSpeedFactor:Ne,uvAnimationRotationSpeedFactor:vr};return _i(G({},e),{pbrMetallicRoughness:{baseColorFactor:Zi,baseColorTexture:$i},normalTexture:Ki,emissiveTexture:tr,emissiveFactor:er,alphaMode:Xi,alphaCutoff:Yi,doubleSided:qi,extensions:{VRMC_materials_mtoon:Er}})}_parseV0UnlitProperties(t,e){var n,i,r,o,a;let l=t.shader==="VRM/UnlitTransparentZWrite",s=t.shader==="VRM/UnlitTransparent"||l,u=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",c=s?"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=((o=(r=t.vectorProperties)==null?void 0:r._Color)!=null?o:[1,1,1,1]).map(ve),h=(a=t.textureProperties)==null?void 0:a._MainTex,_=h!=null?{index:h,extensions:G({},p)}:void 0,g={specVersion:"1.0",transparentWithZWrite:l,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:_};return _i(G({},e),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:_},alphaMode:c,alphaCutoff:f,extensions:{VRMC_materials_mtoon:g}})}_portTextureTransform(t){var e,n,i,r,o;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],s=[(r=a==null?void 0:a[2])!=null?r:1,(o=a==null?void 0:a[3])!=null?o:1];return l[1]=1-s[1]-l[1],{KHR_texture_transform:{offset:l,scale:s}}}_v0ParseRenderQueue(t){var e,n;let i=t.shader==="VRM/UnlitTransparentZWrite",r=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||i,o=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||i,a=0;if(r){let l=t.renderQueue;l!=null&&(o?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,o;let a=i.shader==="VRM/UnlitTransparentZWrite",l=((r=i.keywordMap)==null?void 0:r._ALPHABLEND_ON)!=null||i.shader==="VRM/UnlitTransparent"||a,s=((o=i.floatProperties)==null?void 0:o._ZWrite)===1||a;if(l){let u=i.renderQueue;u!=null&&(s?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 o=Math.min(Math.max(r-e.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(n).sort().forEach((i,r)=>{let o=Math.min(Math.max(r,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}};var N=E(require("three"),1),j=E(require("three"),1),Ct=E(require("three"),1),be=E(require("three"),1),Y=E(require("three"),1);var Ei=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),te=new N.Vector3,et=class extends N.Group{constructor(t){super(),this._attrPosition=new N.BufferAttribute(new Float32Array([0,0,0,0,0,0]),3),this._attrPosition.setUsage(N.DynamicDrawUsage);let e=new N.BufferGeometry;e.setAttribute("position",this._attrPosition);let n=new N.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new N.Line(e,n),this.add(this._line),this.constraint=t}updateMatrixWorld(t){te.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,te.x,te.y,te.z),this.constraint.source&&te.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,te.x,te.y,te.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function Mi(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var Eo=new Ct.Vector3,Mo=new Ct.Vector3;function Ro(t,e){return t.decompose(Eo,e,Mo),e}function tt(t){return t.invert?t.invert():t.inverse(),t}var nt=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},To=new j.Vector3,xo=new j.Vector3,yo=new j.Vector3,wo=new j.Quaternion,Po=new j.Quaternion,So=new j.Quaternion,Ri=class extends nt{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 j.Vector3(1,0,0),this._dstRestQuat=new j.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);let t=wo.identity(),e=Po.identity();this.destination.parent&&(Ro(this.destination.parent.matrixWorld,t),tt(e.copy(t)));let n=To.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),i=Mi(this.source.matrixWorld,xo).sub(Mi(this.destination.matrixWorld,yo)).normalize(),r=So.setFromUnitVectors(n,i).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}};function Ao(t,e){let n=[t],i=t.parent;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}var Ti=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 o of r)Ao(o,a=>{let l=this._objectConstraintsMap.get(a);if(l)for(let s of l)this._processConstraint(s,e,n,i)});i(t),n.add(t)}},Lo=new be.Quaternion,Ho=new be.Quaternion,xi=class extends nt{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new be.Quaternion,this._invSrcRestQuat=new be.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),tt(this._invSrcRestQuat.copy(this.source.quaternion))}update(){let t=Lo.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=Ho.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},bo=new Y.Vector3,Vo=new Y.Quaternion,Io=new Y.Quaternion,yi=class extends nt{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 Y.Vector3(1,0,0),this._dstRestQuat=new Y.Quaternion,this._invDstRestQuat=new Y.Quaternion,this._invSrcRestQuatMulDstRestQuat=new Y.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),tt(this._invDstRestQuat.copy(this._dstRestQuat)),tt(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){let t=Vo.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=bo.copy(this._v3RollAxis).applyQuaternion(t),i=Io.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}},Co=new Set(["1.0","1.0-beta"]),wi=class He{get name(){return He.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return Ei(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return Ei(this,null,function*(){var n;let i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf(He.EXTENSION_NAME))!==-1))return null;let o=new Ti,a=yield this.parser.getDependencies("node");return a.forEach((l,s)=>{var u;let d=i.nodes[s],c=(u=d==null?void 0:d.extensions)==null?void 0:u[He.EXTENSION_NAME];if(c==null)return;let f=c.specVersion;if(!Co.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${He.EXTENSION_NAME} specVersion "${f}"`);return}let p=c.constraint;if(p.roll!=null){let m=this._importRollConstraint(l,a,p.roll);o.addConstraint(m)}else if(p.aim!=null){let m=this._importAimConstraint(l,a,p.aim);o.addConstraint(m)}else if(p.rotation!=null){let m=this._importRotationConstraint(l,a,p.rotation);o.addConstraint(m)}}),e.scene.updateMatrixWorld(),o.setInitState(),o})}_importRollConstraint(e,n,i){let{source:r,rollAxis:o,weight:a}=i,l=n[r],s=new yi(e,l);if(o!=null&&(s.rollAxis=o),a!=null&&(s.weight=a),this.helperRoot){let u=new et(s);this.helperRoot.add(u)}return s}_importAimConstraint(e,n,i){let{source:r,aimAxis:o,weight:a}=i,l=n[r],s=new Ri(e,l);if(o!=null&&(s.aimAxis=o),a!=null&&(s.weight=a),this.helperRoot){let u=new et(s);this.helperRoot.add(u)}return s}_importRotationConstraint(e,n,i){let{source:r,weight:o}=i,a=n[r],l=new xi(e,a);if(o!=null&&(l.weight=o),this.helperRoot){let s=new et(l);this.helperRoot.add(s)}return l}};wi.EXTENSION_NAME="VRMC_node_constraint";var Ut=wi;var ie=E(require("three"),1),Ce=E(require("three"),1),Te=E(require("three"),1),Hi=E(require("three"),1),Z=E(require("three"),1),ne=E(require("three"),1),de=E(require("three"),1),re=E(require("three"),1),he=E(require("three"),1),Vi=E(require("three"),1),C=E(require("three"),1),Ii=E(require("three"),1),Ui=E(require("three"),1),D=E(require("three"),1);var it=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),st=class{},Ot=new Ce.Vector3,ue=new Ce.Vector3,Dt=class extends st{get type(){return"capsule"}constructor(t){var e,n,i,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Ce.Vector3(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new Ce.Vector3(0,0,0),this.radius=(i=t==null?void 0:t.radius)!=null?i:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,i){Ot.copy(this.offset).applyMatrix4(t),ue.copy(this.tail).applyMatrix4(t),ue.sub(Ot);let r=ue.lengthSq();i.copy(e).sub(Ot);let o=ue.dot(i);o<=0||(r<=o||ue.multiplyScalar(o/r),i.sub(ue));let a=this.inside?this.radius-n-i.length():i.length()-n-this.radius;return i.normalize(),this.inside&&i.negate(),a}},Nt=new Te.Vector3,Pi=new Te.Matrix3,Ft=class extends st{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Te.Vector3(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new Te.Vector3(0,0,1)}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e),Pi.getNormalMatrix(t),Nt.copy(this.normal).applyNormalMatrix(Pi).normalize();let r=i.dot(Nt)-n;return i.copy(Nt),r}},Wt=class extends st{get type(){return"sphere"}constructor(t){var e,n,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Hi.Vector3(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e);let r=this.inside?this.radius-n-i.length():i.length()-n-this.radius;return i.normalize(),this.inside&&i.negate(),r}},Q=new Z.Vector3,Uo=class extends Z.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new Z.Vector3,this._currentTail=new Z.Vector3,this._shape=t,this._attrPos=new Z.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new Z.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=Q.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){Q.copy(this._currentTail).sub(this._currentOffset);let t=Q.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(Q.y,Math.sqrt(Q.x*Q.x+Q.z*Q.z)),n=-Math.atan2(Q.z,Q.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}},Oo=class extends ne.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentOffset=new ne.Vector3,this._currentNormal=new ne.Vector3,this._shape=t,this._attrPos=new ne.BufferAttribute(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ne.BufferAttribute(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},No=class extends de.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new de.Vector3,this._shape=t,this._attrPos=new de.BufferAttribute(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new de.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 ie.Vector3,rt=class extends ie.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof Wt)this._geometry=new No(this.collider.shape);else if(this.collider.shape instanceof Dt)this._geometry=new Uo(this.collider.shape);else if(this.collider.shape instanceof Ft)this._geometry=new Oo(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");let e=new ie.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new ie.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)}},Do=class extends he.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new he.Vector3,this._springBone=t,this._attrPos=new he.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new he.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}},Fo=new re.Vector3,bi=class extends re.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new Do(this.springBone);let e=new re.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new re.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=Fo.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},ot=class extends Vi.Object3D{constructor(t){super(),this.shape=t}},Wo=new Ii.Matrix4;function Ci(t){return t.invert?t.invert():t.getInverse(Wo.copy(t)),t}var ko=class{constructor(t){this._inverseCache=new Ui.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&&(Ci(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},zo=new C.Matrix4,q=new C.Vector3,Ve=new C.Vector3,Go=new C.Vector3,Ee=new C.Vector3,Si=new C.Vector3,Ie=new C.Vector3,Ai=new C.Quaternion,Me=new C.Matrix4,jo=new C.Matrix4,Oi=class{constructor(t,e,n={},i=[]){this._currentTail=new C.Vector3,this._prevTail=new C.Vector3,this._boneAxis=new C.Vector3,this._worldSpaceBoneLength=0,this._center=null,this._initialLocalMatrix=new C.Matrix4,this._initialLocalRotation=new C.Quaternion,this._initialLocalChildPosition=new C.Vector3;var r,o,a,l,s,u;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(r=n.hitRadius)!=null?r:0,stiffness:(o=n.stiffness)!=null?o:1,gravityPower:(a=n.gravityPower)!=null?a:0,gravityDir:(s=(l=n.gravityDir)==null?void 0:l.clone())!=null?s:new C.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 ko(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:zo}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(),Ee.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(Me);Si.copy(Ee).applyMatrix4(e);let n=Ai.setFromRotationMatrix(e),i=jo.copy(e).multiply(this._parentMatrixWorld),r=Ve.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(Si).normalize(),o=Go.copy(this.settings.gravityDir).applyQuaternion(n).normalize(),a=this._getMatrixCenterToWorld(Me);Ie.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(o).multiplyScalar(this.settings.gravityPower*t)).applyMatrix4(a),Ie.sub(Ee).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ee),this._collision(Ie),e=this._getMatrixWorldToCenter(Me),this._prevTail.copy(this._currentTail),this._currentTail.copy(q.copy(Ie).applyMatrix4(e));let l=Ci(Me.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),s=Ai.setFromUnitVectors(this._boneAxis,q.copy(Ie).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(s),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(Ee).normalize().multiplyScalar(this._worldSpaceBoneLength).add(Ee))})})}_calcWorldSpaceBoneLength(){q.setFromMatrixPosition(this.bone.matrixWorld),this.child?Ve.setFromMatrixPosition(this.child.matrixWorld):(Ve.copy(this._initialLocalChildPosition),Ve.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=q.sub(Ve).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 Qo(t,e){let n=[],i=t;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}function Ni(t,e){t.children.forEach(n=>{e(n)||Ni(n,e)})}var Bt=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,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,o=>o.update(t)),Ni(r.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))==null?void 0:a.size)!=null?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(t,e,n,i,r){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(t);let o=this._getDependencies(t);for(let a of o)Qo(a,l=>{let s=this._objectSpringBonesMap.get(l);if(s)for(let u of s)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}},Li="VRMC_springBone_extended_collider",Xo=new Set(["1.0","1.0-beta"]),Yo=new Set(["1.0"]),Bi=class Re{get name(){return Re.EXTENSION_NAME}constructor(e,n){var i;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(i=n==null?void 0:n.useExtendedColliders)!=null?i:!0}afterRoot(e){return it(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return it(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 it(this,null,function*(){var n,i,r,o,a;let l=e.parser.json;if(!(((n=l.extensionsUsed)==null?void 0:n.indexOf(Re.EXTENSION_NAME))!==-1))return null;let u=new Bt,d=yield e.parser.getDependencies("node"),c=(i=l.extensions)==null?void 0:i[Re.EXTENSION_NAME];if(!c)return null;let f=c.specVersion;if(!Xo.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Re.EXTENSION_NAME} specVersion "${f}"`),null;let p=(r=c.colliders)==null?void 0:r.map((h,_)=>{var g,x,T,v,R,M,y,A,V,L,H,U,$,xe,ye;let J=d[h.node],k=h.shape,pe=(g=h.extensions)==null?void 0:g[Li];if(this.useExtendedColliders&&pe!=null){let we=pe.specVersion;if(!Yo.has(we))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${Li} specVersion "${we}". Fallbacking to the ${Re.EXTENSION_NAME} definition`);else{let O=pe.shape;if(O.sphere)return this._importSphereCollider(J,{offset:new D.Vector3().fromArray((x=O.sphere.offset)!=null?x:[0,0,0]),radius:(T=O.sphere.radius)!=null?T:0,inside:(v=O.sphere.inside)!=null?v:!1});if(O.capsule)return this._importCapsuleCollider(J,{offset:new D.Vector3().fromArray((R=O.capsule.offset)!=null?R:[0,0,0]),radius:(M=O.capsule.radius)!=null?M:0,tail:new D.Vector3().fromArray((y=O.capsule.tail)!=null?y:[0,0,0]),inside:(A=O.capsule.inside)!=null?A:!1});if(O.plane)return this._importPlaneCollider(J,{offset:new D.Vector3().fromArray((V=O.plane.offset)!=null?V:[0,0,0]),normal:new D.Vector3().fromArray((L=O.plane.normal)!=null?L:[0,0,1])})}}if(k.sphere)return this._importSphereCollider(J,{offset:new D.Vector3().fromArray((H=k.sphere.offset)!=null?H:[0,0,0]),radius:(U=k.sphere.radius)!=null?U:0,inside:!1});if(k.capsule)return this._importCapsuleCollider(J,{offset:new D.Vector3().fromArray(($=k.capsule.offset)!=null?$:[0,0,0]),radius:(xe=k.capsule.radius)!=null?xe:0,tail:new D.Vector3().fromArray((ye=k.capsule.tail)!=null?ye:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape`)}),m=(o=c.colliderGroups)==null?void 0:o.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(M=>{let y=m==null?void 0:m[M];if(y==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to use a colliderGroup ${M} but not found`);return y}),v=h.center!=null?d[h.center]:void 0,R;x.forEach(M=>{if(R){let y=R.node,A=d[y],V=M.node,L=d[V],H={hitRadius:R.hitRadius,dragForce:R.dragForce,gravityPower:R.gravityPower,stiffness:R.stiffness,gravityDir:R.gravityDir!=null?new D.Vector3().fromArray(R.gravityDir):void 0},U=this._importJoint(A,L,H,T);v&&(U.center=v),u.addJoint(U)}R=M})}),u.setInitState(),u})}_v0Import(e){return it(this,null,function*(){var n,i,r;let o=e.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;let l=(i=o.extensions)==null?void 0:i.VRM,s=l==null?void 0:l.secondaryAnimation;if(!s)return null;let u=s==null?void 0:s.boneGroups;if(!u)return null;let d=new Bt,c=yield e.parser.getDependencies("node"),f=(r=s.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 M=new D.Vector3(0,0,0);return g.offset&&M.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:M,radius:(R=g.radius)!=null?R:0,inside:!1})})}});return u==null||u.forEach((p,m)=>{let h=p.bones;h&&h.forEach(_=>{var g,x,T,v;let R=c[_],M=new D.Vector3;p.gravityDir?M.set((g=p.gravityDir.x)!=null?g:0,(x=p.gravityDir.y)!=null?x:0,(T=p.gravityDir.z)!=null?T:0):M.set(0,-1,0);let y=p.center!=null?c[p.center]:void 0,A={hitRadius:p.hitRadius,dragForce:p.dragForce,gravityPower:p.gravityPower,stiffness:p.stiffiness,gravityDir:M},V=(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,$=this._importJoint(L,U,A,V);y&&($.center=y),d.addJoint($)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,i,r){let o=new Oi(e,n,i,r);if(this.jointHelperRoot){let a=new bi(o);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return o}_importSphereCollider(e,n){let i=new Wt(n),r=new ot(i);if(e.add(r),this.colliderHelperRoot){let o=new rt(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importCapsuleCollider(e,n){let i=new Dt(n),r=new ot(i);if(e.add(r),this.colliderHelperRoot){let o=new rt(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importPlaneCollider(e,n){let i=new Ft(n),r=new ot(i);if(e.add(r),this.colliderHelperRoot){let o=new rt(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}};Bi.EXTENSION_NAME="VRMC_springBone";var kt=Bi;var at=class{get name(){return"VRMLoaderPlugin"}constructor(e,n){var o,a,l,s,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=(o=n==null?void 0:n.expressionPlugin)!=null?o:new je(e),this.firstPersonPlugin=(a=n==null?void 0:n.firstPersonPlugin)!=null?a:new Qe(e),this.humanoidPlugin=(l=n==null?void 0:n.humanoidPlugin)!=null?l:new Ye(e,{helperRoot:i,autoUpdateHumanBones:r}),this.lookAtPlugin=(s=n==null?void 0:n.lookAtPlugin)!=null?s:new qe(e,{helperRoot:i}),this.metaPlugin=(u=n==null?void 0:n.metaPlugin)!=null?u:new Ze(e),this.mtoonMaterialPlugin=(d=n==null?void 0:n.mtoonMaterialPlugin)!=null?d:new Vt(e),this.materialsHDREmissiveMultiplierPlugin=(c=n==null?void 0:n.materialsHDREmissiveMultiplierPlugin)!=null?c:new pi(e),this.materialsV0CompatPlugin=(f=n==null?void 0:n.materialsV0CompatPlugin)!=null?f:new vi(e),this.springBonePlugin=(p=n==null?void 0:n.springBonePlugin)!=null?p:new kt(e,{colliderHelperRoot:i,jointHelperRoot:i}),this.nodeConstraintPlugin=(m=n==null?void 0:n.nodeConstraintPlugin)!=null?m:new Ut(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 Di(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 qo(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=>Di(r)):i&&Di(i))}function Fi(t){t.traverse(qo)}var lt=E(require("three"),1);function Wi(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,o=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}),o=Math.max(o,d.length)}for(let l of i){let{bones:s,boneInverses:u}=r.get(l);if(n)for(let c=s.length;c<o;c++)s[c]=s[0],u[c]=u[0];let d=new lt.Skeleton(s,u);l.bind(d,new lt.Matrix4)}}var ki=E(require("three"),1),ut=require("three");function zi(t){let e=new Map;t.traverse(n=>{var c,f,p,m;if(!n.isMesh)return;let i=n,r=i.geometry,o=r.index;if(o==null)return;let a=e.get(r);if(a!=null){i.geometry=a;return}let l=new ki.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 s=[],u=[];{let h=o.array,_=new h.constructor(h.length),g=0;for(let x=0;x<h.length;x++){let T=h[x],v=s[T];v==null&&(s[T]=g,u[g]=T,v=g,g++),_[x]=v}l.setIndex(new ut.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:x,normalized:T}=_,v=new g.constructor(u.length*x);u.forEach((R,M)=>{for(let y=0;y<x;y++)v[M*x+y]=g[R*x+y]}),l.setAttribute(h,new ut.BufferAttribute(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,M=new T.constructor(u.length*v);u.forEach((y,A)=>{for(let V=0;V<v;V++)M[A*v+V]=T[y*v+V]}),d=d&&M.every(y=>y===0),l.morphAttributes[h][g]=new ut.BufferAttribute(M,v,R)}}),d&&(l.morphAttributes={}),i.geometry=l}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function Gi(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var ce=class{constructor(){}};ce.deepDispose=Fi,ce.removeUnnecessaryJoints=Wi,ce.removeUnnecessaryVertices=zi,ce.rotateVRM0=Gi;
|
|
925
925
|
/*!
|
|
926
|
-
* @pixiv/three-vrm-core v3.1.
|
|
926
|
+
* @pixiv/three-vrm-core v3.1.3
|
|
927
927
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
928
928
|
*
|
|
929
929
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -931,7 +931,7 @@ void main() {
|
|
|
931
931
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
932
932
|
*/
|
|
933
933
|
/*!
|
|
934
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
934
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
935
935
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
936
936
|
*
|
|
937
937
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -939,7 +939,7 @@ void main() {
|
|
|
939
939
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
940
940
|
*/
|
|
941
941
|
/*!
|
|
942
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.
|
|
942
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.3
|
|
943
943
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
944
944
|
*
|
|
945
945
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -947,7 +947,7 @@ void main() {
|
|
|
947
947
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
948
948
|
*/
|
|
949
949
|
/*!
|
|
950
|
-
* @pixiv/three-vrm-materials-v0compat v3.1.
|
|
950
|
+
* @pixiv/three-vrm-materials-v0compat v3.1.3
|
|
951
951
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
952
952
|
*
|
|
953
953
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -955,7 +955,7 @@ void main() {
|
|
|
955
955
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
956
956
|
*/
|
|
957
957
|
/*!
|
|
958
|
-
* @pixiv/three-vrm-node-constraint v3.1.
|
|
958
|
+
* @pixiv/three-vrm-node-constraint v3.1.3
|
|
959
959
|
* Node constraint module for @pixiv/three-vrm
|
|
960
960
|
*
|
|
961
961
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -963,7 +963,7 @@ void main() {
|
|
|
963
963
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
964
964
|
*/
|
|
965
965
|
/*!
|
|
966
|
-
* @pixiv/three-vrm-springbone v3.1.
|
|
966
|
+
* @pixiv/three-vrm-springbone v3.1.3
|
|
967
967
|
* Spring bone module for @pixiv/three-vrm
|
|
968
968
|
*
|
|
969
969
|
* Copyright (c) 2019-2024 pixiv Inc.
|
package/lib/three-vrm.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @pixiv/three-vrm v3.1.
|
|
2
|
+
* @pixiv/three-vrm v3.1.3
|
|
3
3
|
* VRM file loader for three.js.
|
|
4
4
|
*
|
|
5
5
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6234,7 +6234,7 @@ export {
|
|
|
6234
6234
|
VRMUtils
|
|
6235
6235
|
};
|
|
6236
6236
|
/*!
|
|
6237
|
-
* @pixiv/three-vrm-core v3.1.
|
|
6237
|
+
* @pixiv/three-vrm-core v3.1.3
|
|
6238
6238
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
6239
6239
|
*
|
|
6240
6240
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6242,7 +6242,7 @@ export {
|
|
|
6242
6242
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6243
6243
|
*/
|
|
6244
6244
|
/*!
|
|
6245
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
6245
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
6246
6246
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
6247
6247
|
*
|
|
6248
6248
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6250,7 +6250,7 @@ export {
|
|
|
6250
6250
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6251
6251
|
*/
|
|
6252
6252
|
/*!
|
|
6253
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.
|
|
6253
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.3
|
|
6254
6254
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
6255
6255
|
*
|
|
6256
6256
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6258,7 +6258,7 @@ export {
|
|
|
6258
6258
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6259
6259
|
*/
|
|
6260
6260
|
/*!
|
|
6261
|
-
* @pixiv/three-vrm-materials-v0compat v3.1.
|
|
6261
|
+
* @pixiv/three-vrm-materials-v0compat v3.1.3
|
|
6262
6262
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
6263
6263
|
*
|
|
6264
6264
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6266,7 +6266,7 @@ export {
|
|
|
6266
6266
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6267
6267
|
*/
|
|
6268
6268
|
/*!
|
|
6269
|
-
* @pixiv/three-vrm-node-constraint v3.1.
|
|
6269
|
+
* @pixiv/three-vrm-node-constraint v3.1.3
|
|
6270
6270
|
* Node constraint module for @pixiv/three-vrm
|
|
6271
6271
|
*
|
|
6272
6272
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -6274,7 +6274,7 @@ export {
|
|
|
6274
6274
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
6275
6275
|
*/
|
|
6276
6276
|
/*!
|
|
6277
|
-
* @pixiv/three-vrm-springbone v3.1.
|
|
6277
|
+
* @pixiv/three-vrm-springbone v3.1.3
|
|
6278
6278
|
* Spring bone module for @pixiv/three-vrm
|
|
6279
6279
|
*
|
|
6280
6280
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -923,7 +923,7 @@ void main() {
|
|
|
923
923
|
`)+`
|
|
924
924
|
`;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_SCREEN:this._isOutline&&this._outlineWidthMode===jn.ScreenCoordinates}}_updateTextureMatrix(t,e){t.value&&(t.value.matrixAutoUpdate&&t.value.updateMatrix(),e.value.copy(t.value.matrix))}},zr=new Set(["1.0","1.0-beta"]),qn=class We{get name(){return We.EXTENSION_NAME}constructor(e,n={}){var i,r,o,a;this.parser=e,this.materialType=(i=n.materialType)!=null?i:kr,this.renderOrderOffset=(r=n.renderOrderOffset)!=null?r:0,this.v0CompatShade=(o=n.v0CompatShade)!=null?o:!1,this.debugMode=(a=n.debugMode)!=null?a:"none",this._mToonMaterialSet=new Set}beforeRoot(){return ae(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(e){return ae(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 ae(this,null,function*(){var n;let i=this.parser,o=(n=i.json.meshes)==null?void 0:n[e];if(o==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${e}] of glTF but the mesh doesn't exist`);let a=o.primitives,l=yield i.loadMesh(e);if(a.length===1){let s=l,u=a[0].material;u!=null&&this._setupPrimitive(s,u)}else{let s=l;for(let u=0;u<a.length;u++){let d=s.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,o)=>{var a;this._getMToonExtension(o)&&((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[We.EXTENSION_NAME];if(l==null)return;let s=l.specVersion;if(!zr.has(s)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${We.EXTENSION_NAME} specVersion "${s}"`);return}return l}_extendMaterialParams(e,n){return ae(this,null,function*(){var i;delete n.metalness,delete n.roughness;let r=new Nr(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 ke.Material)||!this._shouldGenerateOutline(n))return;e.material=[n];let i=n.clone();i.name+=" (Outline)",i.isOutline=!0,i.side=ke.BackSide,e.material.push(i);let r=e.geometry,o=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,o,0),r.addGroup(0,o,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)}};qn.EXTENSION_NAME="VRMC_materials_mtoon";var Zn=qn;var Gr=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),$n=class pt{get name(){return pt.EXTENSION_NAME}constructor(e){this.parser=e}extendMaterialParams(e,n){return Gr(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[pt.EXTENSION_NAME];if(l!=null)return l}};$n.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";var Jn=$n;import*as ni from"three";var jr=Object.defineProperty,Qr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,Kn=Object.getOwnPropertySymbols,Yr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,ei=(t,e,n)=>e in t?jr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,z=(t,e)=>{for(var n in e||(e={}))Yr.call(e,n)&&ei(t,n,e[n]);if(Kn)for(var n of Kn(e))qr.call(e,n)&&ei(t,n,e[n]);return t},ti=(t,e)=>Qr(t,Xr(e)),Zr=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())});function me(t){return Math.pow(t,2.2)}var ii=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 Zr(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,o)=>{var a,l;let s=(a=e.materials)==null?void 0:a[o];if(s==null){console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${o}] of glTF but the material doesn't exist`);return}if(r.shader==="VRM/MToon"){let u=this._parseV0MToonProperties(r,s);e.materials[o]=u}else if((l=r.shader)!=null&&l.startsWith("VRM/Unlit")){let u=this._parseV0UnlitProperties(r,s);e.materials[o]=u}else r.shader==="VRM_USE_GLTFSHADER"||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${r.shader}`)}))})}_parseV0MToonProperties(t,e){var n,i,r,o,a,l,s,u,d,c,f,p,m,h,_,g,T,R,v,M,E,x,S,b,A,L,C,Z,Me,Re,$,W,he,Te,U,yt,wt,Pt,St,At,Lt,Ht,bt,Vt,It,Ct,Ut,Ot,Nt,Bt,Dt,Ft,Wt,kt,zt;let Gt=(i=(n=t.keywordMap)==null?void 0:n._ALPHABLEND_ON)!=null?i:!1,Hi=((r=t.floatProperties)==null?void 0:r._ZWrite)===1&&Gt,bi=this._v0ParseRenderQueue(t),jt=(a=(o=t.keywordMap)==null?void 0:o._ALPHATEST_ON)!=null?a:!1,Vi=Gt?"BLEND":jt?"MASK":"OPAQUE",Ii=jt?(s=(l=t.floatProperties)==null?void 0:l._Cutoff)!=null?s:.5:void 0,Ci=((d=(u=t.floatProperties)==null?void 0:u._CullMode)!=null?d:2)===0,re=this._portTextureTransform(t),Ui=((f=(c=t.vectorProperties)==null?void 0:c._Color)!=null?f:[1,1,1,1]).map((en,or)=>or===3?en:me(en)),Qt=(p=t.textureProperties)==null?void 0:p._MainTex,Oi=Qt!=null?{index:Qt,extensions:z({},re)}:void 0,Ni=(h=(m=t.floatProperties)==null?void 0:m._BumpScale)!=null?h:1,Xt=(_=t.textureProperties)==null?void 0:_._BumpMap,Bi=Xt!=null?{index:Xt,scale:Ni,extensions:z({},re)}:void 0,Di=((T=(g=t.vectorProperties)==null?void 0:g._EmissionColor)!=null?T:[0,0,0,1]).map(me),Yt=(R=t.textureProperties)==null?void 0:R._EmissionMap,Fi=Yt!=null?{index:Yt,extensions:z({},re)}:void 0,Wi=((M=(v=t.vectorProperties)==null?void 0:v._ShadeColor)!=null?M:[.97,.81,.86,1]).map(me),qt=(E=t.textureProperties)==null?void 0:E._ShadeTexture,ki=qt!=null?{index:qt,extensions:z({},re)}:void 0,Ie=(S=(x=t.floatProperties)==null?void 0:x._ShadeShift)!=null?S:0,Ce=(A=(b=t.floatProperties)==null?void 0:b._ShadeToony)!=null?A:.9;Ce=ni.MathUtils.lerp(Ce,1,.5+.5*Ie),Ie=-Ie-(1-Ce);let Zt=(C=(L=t.floatProperties)==null?void 0:L._IndirectLightIntensity)!=null?C:.1,zi=Zt?1-Zt:void 0,Qe=(Z=t.textureProperties)==null?void 0:Z._SphereAdd,Gi=Qe!=null?[1,1,1]:void 0,ji=Qe!=null?{index:Qe}:void 0,Qi=(Re=(Me=t.floatProperties)==null?void 0:Me._RimLightingMix)!=null?Re:0,$t=($=t.textureProperties)==null?void 0:$._RimTexture,Xi=$t!=null?{index:$t,extensions:z({},re)}:void 0,Yi=((he=(W=t.vectorProperties)==null?void 0:W._RimColor)!=null?he:[0,0,0,1]).map(me),qi=(U=(Te=t.floatProperties)==null?void 0:Te._RimFresnelPower)!=null?U:1,Zi=(wt=(yt=t.floatProperties)==null?void 0:yt._RimLift)!=null?wt:0,$i=["none","worldCoordinates","screenCoordinates"][(St=(Pt=t.floatProperties)==null?void 0:Pt._OutlineWidthMode)!=null?St:0],Xe=(Lt=(At=t.floatProperties)==null?void 0:At._OutlineWidth)!=null?Lt:0;Xe=.01*Xe;let Jt=(Ht=t.textureProperties)==null?void 0:Ht._OutlineWidthTexture,Ji=Jt!=null?{index:Jt,extensions:z({},re)}:void 0,Ki=((Vt=(bt=t.vectorProperties)==null?void 0:bt._OutlineColor)!=null?Vt:[0,0,0]).map(me),er=((Ct=(It=t.floatProperties)==null?void 0:It._OutlineColorMode)!=null?Ct:0)===1?(Ot=(Ut=t.floatProperties)==null?void 0:Ut._OutlineLightingMix)!=null?Ot:1:0,Kt=(Nt=t.textureProperties)==null?void 0:Nt._UvAnimMaskTexture,tr=Kt!=null?{index:Kt,extensions:z({},re)}:void 0,nr=(Dt=(Bt=t.floatProperties)==null?void 0:Bt._UvAnimScrollX)!=null?Dt:0,Ue=(Wt=(Ft=t.floatProperties)==null?void 0:Ft._UvAnimScrollY)!=null?Wt:0;Ue!=null&&(Ue=-Ue);let ir=(zt=(kt=t.floatProperties)==null?void 0:kt._UvAnimRotation)!=null?zt:0,rr={specVersion:"1.0",transparentWithZWrite:Hi,renderQueueOffsetNumber:bi,shadeColorFactor:Wi,shadeMultiplyTexture:ki,shadingShiftFactor:Ie,shadingToonyFactor:Ce,giEqualizationFactor:zi,matcapFactor:Gi,matcapTexture:ji,rimLightingMixFactor:Qi,rimMultiplyTexture:Xi,parametricRimColorFactor:Yi,parametricRimFresnelPowerFactor:qi,parametricRimLiftFactor:Zi,outlineWidthMode:$i,outlineWidthFactor:Xe,outlineWidthMultiplyTexture:Ji,outlineColorFactor:Ki,outlineLightingMixFactor:er,uvAnimationMaskTexture:tr,uvAnimationScrollXSpeedFactor:nr,uvAnimationScrollYSpeedFactor:Ue,uvAnimationRotationSpeedFactor:ir};return ti(z({},e),{pbrMetallicRoughness:{baseColorFactor:Ui,baseColorTexture:Oi},normalTexture:Bi,emissiveTexture:Fi,emissiveFactor:Di,alphaMode:Vi,alphaCutoff:Ii,doubleSided:Ci,extensions:{VRMC_materials_mtoon:rr}})}_parseV0UnlitProperties(t,e){var n,i,r,o,a;let l=t.shader==="VRM/UnlitTransparentZWrite",s=t.shader==="VRM/UnlitTransparent"||l,u=this._v0ParseRenderQueue(t),d=t.shader==="VRM/UnlitCutout",c=s?"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=((o=(r=t.vectorProperties)==null?void 0:r._Color)!=null?o:[1,1,1,1]).map(me),h=(a=t.textureProperties)==null?void 0:a._MainTex,_=h!=null?{index:h,extensions:z({},p)}:void 0,g={specVersion:"1.0",transparentWithZWrite:l,renderQueueOffsetNumber:u,shadeColorFactor:m,shadeMultiplyTexture:_};return ti(z({},e),{pbrMetallicRoughness:{baseColorFactor:m,baseColorTexture:_},alphaMode:c,alphaCutoff:f,extensions:{VRMC_materials_mtoon:g}})}_portTextureTransform(t){var e,n,i,r,o;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],s=[(r=a==null?void 0:a[2])!=null?r:1,(o=a==null?void 0:a[3])!=null?o:1];return l[1]=1-s[1]-l[1],{KHR_texture_transform:{offset:l,scale:s}}}_v0ParseRenderQueue(t){var e,n;let i=t.shader==="VRM/UnlitTransparentZWrite",r=((e=t.keywordMap)==null?void 0:e._ALPHABLEND_ON)!=null||t.shader==="VRM/UnlitTransparent"||i,o=((n=t.floatProperties)==null?void 0:n._ZWrite)===1||i,a=0;if(r){let l=t.renderQueue;l!=null&&(o?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,o;let a=i.shader==="VRM/UnlitTransparentZWrite",l=((r=i.keywordMap)==null?void 0:r._ALPHABLEND_ON)!=null||i.shader==="VRM/UnlitTransparent"||a,s=((o=i.floatProperties)==null?void 0:o._ZWrite)===1||a;if(l){let u=i.renderQueue;u!=null&&(s?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 o=Math.min(Math.max(r-e.size+1,-9),0);this._renderQueueMapTransparent.set(i,o)}),Array.from(n).sort().forEach((i,r)=>{let o=Math.min(Math.max(r,0),9);this._renderQueueMapTransparentZWrite.set(i,o)})}};import*as O from"three";import*as G from"three";import*as ft from"three";import*as Le from"three";import*as X from"three";var ri=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),ee=new O.Vector3,mt=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){ee.setFromMatrixPosition(this.constraint.destination.matrixWorld),this._attrPosition.setXYZ(0,ee.x,ee.y,ee.z),this.constraint.source&&ee.setFromMatrixPosition(this.constraint.source.matrixWorld),this._attrPosition.setXYZ(1,ee.x,ee.y,ee.z),this._attrPosition.needsUpdate=!0,super.updateMatrixWorld(t)}};function oi(t,e){return e.set(t.elements[12],t.elements[13],t.elements[14])}var $r=new ft.Vector3,Jr=new ft.Vector3;function Kr(t,e){return t.decompose($r,e,Jr),e}function ze(t){return t.invert?t.invert():t.inverse(),t}var _t=class{constructor(t,e){this.destination=t,this.source=e,this.weight=1}},eo=new G.Vector3,to=new G.Vector3,no=new G.Vector3,io=new G.Quaternion,ro=new G.Quaternion,oo=new G.Quaternion,so=class extends _t{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 G.Vector3(1,0,0),this._dstRestQuat=new G.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion)}update(){this.destination.updateWorldMatrix(!0,!1),this.source.updateWorldMatrix(!0,!1);let t=io.identity(),e=ro.identity();this.destination.parent&&(Kr(this.destination.parent.matrixWorld,t),ze(e.copy(t)));let n=eo.copy(this._v3AimAxis).applyQuaternion(this._dstRestQuat).applyQuaternion(t),i=oi(this.source.matrixWorld,to).sub(oi(this.destination.matrixWorld,no)).normalize(),r=oo.setFromUnitVectors(n,i).premultiply(e).multiply(t).multiply(this._dstRestQuat);this.destination.quaternion.copy(this._dstRestQuat).slerp(r,this.weight)}};function ao(t,e){let n=[t],i=t.parent;for(;i!==null;)n.unshift(i),i=i.parent;n.forEach(r=>{e(r)})}var lo=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 o of r)ao(o,a=>{let l=this._objectConstraintsMap.get(a);if(l)for(let s of l)this._processConstraint(s,e,n,i)});i(t),n.add(t)}},uo=new Le.Quaternion,ho=new Le.Quaternion,co=class extends _t{get dependencies(){return new Set([this.source])}constructor(t,e){super(t,e),this._dstRestQuat=new Le.Quaternion,this._invSrcRestQuat=new Le.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),ze(this._invSrcRestQuat.copy(this.source.quaternion))}update(){let t=uo.copy(this._invSrcRestQuat).multiply(this.source.quaternion),e=ho.copy(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(e,this.weight)}},po=new X.Vector3,mo=new X.Quaternion,fo=new X.Quaternion,_o=class extends _t{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 X.Vector3(1,0,0),this._dstRestQuat=new X.Quaternion,this._invDstRestQuat=new X.Quaternion,this._invSrcRestQuatMulDstRestQuat=new X.Quaternion}setInitState(){this._dstRestQuat.copy(this.destination.quaternion),ze(this._invDstRestQuat.copy(this._dstRestQuat)),ze(this._invSrcRestQuatMulDstRestQuat.copy(this.source.quaternion)).multiply(this._dstRestQuat)}update(){let t=mo.copy(this._invDstRestQuat).multiply(this.source.quaternion).multiply(this._invSrcRestQuatMulDstRestQuat),e=po.copy(this._v3RollAxis).applyQuaternion(t),i=fo.setFromUnitVectors(e,this._v3RollAxis).premultiply(this._dstRestQuat).multiply(t);this.destination.quaternion.copy(this._dstRestQuat).slerp(i,this.weight)}},go=new Set(["1.0","1.0-beta"]),si=class Ae{get name(){return Ae.EXTENSION_NAME}constructor(e,n){this.parser=e,this.helperRoot=n==null?void 0:n.helperRoot}afterRoot(e){return ri(this,null,function*(){e.userData.vrmNodeConstraintManager=yield this._import(e)})}_import(e){return ri(this,null,function*(){var n;let i=this.parser.json;if(!(((n=i.extensionsUsed)==null?void 0:n.indexOf(Ae.EXTENSION_NAME))!==-1))return null;let o=new lo,a=yield this.parser.getDependencies("node");return a.forEach((l,s)=>{var u;let d=i.nodes[s],c=(u=d==null?void 0:d.extensions)==null?void 0:u[Ae.EXTENSION_NAME];if(c==null)return;let f=c.specVersion;if(!go.has(f)){console.warn(`VRMNodeConstraintLoaderPlugin: Unknown ${Ae.EXTENSION_NAME} specVersion "${f}"`);return}let p=c.constraint;if(p.roll!=null){let m=this._importRollConstraint(l,a,p.roll);o.addConstraint(m)}else if(p.aim!=null){let m=this._importAimConstraint(l,a,p.aim);o.addConstraint(m)}else if(p.rotation!=null){let m=this._importRotationConstraint(l,a,p.rotation);o.addConstraint(m)}}),e.scene.updateMatrixWorld(),o.setInitState(),o})}_importRollConstraint(e,n,i){let{source:r,rollAxis:o,weight:a}=i,l=n[r],s=new _o(e,l);if(o!=null&&(s.rollAxis=o),a!=null&&(s.weight=a),this.helperRoot){let u=new mt(s);this.helperRoot.add(u)}return s}_importAimConstraint(e,n,i){let{source:r,aimAxis:o,weight:a}=i,l=n[r],s=new so(e,l);if(o!=null&&(s.aimAxis=o),a!=null&&(s.weight=a),this.helperRoot){let u=new mt(s);this.helperRoot.add(u)}return s}_importRotationConstraint(e,n,i){let{source:r,weight:o}=i,a=n[r],l=new co(e,a);if(o!=null&&(l.weight=o),this.helperRoot){let s=new mt(l);this.helperRoot.add(s)}return l}};si.EXTENSION_NAME="VRMC_node_constraint";var ai=si;import*as ne from"three";import*as Ve from"three";import*as ve from"three";import*as fi from"three";import*as q from"three";import*as te from"three";import*as ue from"three";import*as ie from"three";import*as de from"three";import*as gi from"three";import*as I from"three";import*as vi from"three";import*as Mi from"three";import*as B from"three";var Ge=(t,e,n)=>new Promise((i,r)=>{var o=s=>{try{l(n.next(s))}catch(u){r(u)}},a=s=>{try{l(n.throw(s))}catch(u){r(u)}},l=s=>s.done?i(s.value):Promise.resolve(s.value).then(o,a);l((n=n.apply(t,e)).next())}),Rt=class{},gt=new Ve.Vector3,le=new Ve.Vector3,pi=class extends Rt{get type(){return"capsule"}constructor(t){var e,n,i,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Ve.Vector3(0,0,0),this.tail=(n=t==null?void 0:t.tail)!=null?n:new Ve.Vector3(0,0,0),this.radius=(i=t==null?void 0:t.radius)!=null?i:0,this.inside=(r=t==null?void 0:t.inside)!=null?r:!1}calculateCollision(t,e,n,i){gt.copy(this.offset).applyMatrix4(t),le.copy(this.tail).applyMatrix4(t),le.sub(gt);let r=le.lengthSq();i.copy(e).sub(gt);let o=le.dot(i);o<=0||(r<=o||le.multiplyScalar(o/r),i.sub(le));let a=this.inside?this.radius-n-i.length():i.length()-n-this.radius;return i.normalize(),this.inside&&i.negate(),a}},vt=new ve.Vector3,li=new ve.Matrix3,mi=class extends Rt{get type(){return"plane"}constructor(t){var e,n;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new ve.Vector3(0,0,0),this.normal=(n=t==null?void 0:t.normal)!=null?n:new ve.Vector3(0,0,1)}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e),li.getNormalMatrix(t),vt.copy(this.normal).applyNormalMatrix(li).normalize();let r=i.dot(vt)-n;return i.copy(vt),r}},_i=class extends Rt{get type(){return"sphere"}constructor(t){var e,n,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new fi.Vector3(0,0,0),this.radius=(n=t==null?void 0:t.radius)!=null?n:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,n,i){i.copy(this.offset).applyMatrix4(t),i.negate().add(e);let r=this.inside?this.radius-n-i.length():i.length()-n-this.radius;return i.normalize(),this.inside&&i.negate(),r}},j=new q.Vector3,vo=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=j.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(n)>1e-10&&(this._currentTail.copy(n),t=!0),t&&this._buildPosition()}_buildPosition(){j.copy(this._currentTail).sub(this._currentOffset);let t=j.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(j.y,Math.sqrt(j.x*j.x+j.z*j.z)),n=-Math.atan2(j.z,j.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}},Eo=class extends te.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentOffset=new te.Vector3,this._currentNormal=new te.Vector3,this._shape=t,this._attrPos=new te.BufferAttribute(new Float32Array(6*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new te.BufferAttribute(new Uint16Array(10),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentNormal.equals(this._shape.normal)||(this._currentNormal.copy(this._shape.normal),t=!0),t&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,-.5,-.5,0),this._attrPos.setXYZ(1,.5,-.5,0),this._attrPos.setXYZ(2,.5,.5,0),this._attrPos.setXYZ(3,-.5,.5,0),this._attrPos.setXYZ(4,0,0,0),this._attrPos.setXYZ(5,0,0,.25),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this.lookAt(this._currentNormal),this._attrPos.needsUpdate=!0}_buildIndex(){this._attrIndex.setXY(0,0,1),this._attrIndex.setXY(2,1,2),this._attrIndex.setXY(4,2,3),this._attrIndex.setXY(6,3,0),this._attrIndex.setXY(8,4,5),this._attrIndex.needsUpdate=!0}},Mo=class extends ue.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentOffset=new ue.Vector3,this._shape=t,this._attrPos=new ue.BufferAttribute(new Float32Array(32*3*3),3),this.setAttribute("position",this._attrPos),this._attrIndex=new ue.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}},Ro=new ne.Vector3,Et=class extends ne.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof _i)this._geometry=new Mo(this.collider.shape);else if(this.collider.shape instanceof pi)this._geometry=new vo(this.collider.shape);else if(this.collider.shape instanceof mi)this._geometry=new Eo(this.collider.shape);else throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");let e=new ne.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new ne.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=Ro.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},To=class extends de.BufferGeometry{constructor(t){super(),this.worldScale=1,this._currentRadius=0,this._currentTail=new de.Vector3,this._springBone=t,this._attrPos=new de.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new de.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}},xo=new ie.Vector3,yo=class extends ie.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new To(this.springBone);let e=new ie.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new ie.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=xo.set(e[0],e[1],e[2]).length(),this._geometry.update(),super.updateMatrixWorld(t)}},Mt=class extends gi.Object3D{constructor(t){super(),this.shape=t}},wo=new vi.Matrix4;function Ei(t){return t.invert?t.invert():t.getInverse(wo.copy(t)),t}var Po=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&&(Ei(this._inverseCache.copy(this.matrix)),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}},So=new I.Matrix4,Y=new I.Vector3,He=new I.Vector3,Ao=new I.Vector3,fe=new I.Vector3,ui=new I.Vector3,be=new I.Vector3,di=new I.Quaternion,_e=new I.Matrix4,Lo=new I.Matrix4,Ho=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,o,a,l,s,u;this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:(r=n.hitRadius)!=null?r:0,stiffness:(o=n.stiffness)!=null?o:1,gravityPower:(a=n.gravityPower)!=null?a:0,gravityDir:(s=(l=n.gravityDir)==null?void 0:l.clone())!=null?s: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 Po(this._center.matrixWorld)))}get initialLocalChildPosition(){return this._initialLocalChildPosition}get _parentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:So}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(_e);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(_e);this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)).applyMatrix4(t),this._prevTail.copy(this._currentTail)}update(t){if(t<=0)return;this._calcWorldSpaceBoneLength(),fe.setFromMatrixPosition(this.bone.matrixWorld);let e=this._getMatrixWorldToCenter(_e);ui.copy(fe).applyMatrix4(e);let n=di.setFromRotationMatrix(e),i=Lo.copy(e).multiply(this._parentMatrixWorld),r=He.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(i).sub(ui).normalize(),o=Ao.copy(this.settings.gravityDir).applyQuaternion(n).normalize(),a=this._getMatrixCenterToWorld(_e);be.copy(this._currentTail).add(Y.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(Y.copy(r).multiplyScalar(this.settings.stiffness*t)).add(Y.copy(o).multiplyScalar(this.settings.gravityPower*t)).applyMatrix4(a),be.sub(fe).normalize().multiplyScalar(this._worldSpaceBoneLength).add(fe),this._collision(be),e=this._getMatrixWorldToCenter(_e),this._prevTail.copy(this._currentTail),this._currentTail.copy(Y.copy(be).applyMatrix4(e));let l=Ei(_e.copy(this._parentMatrixWorld).multiply(this._initialLocalMatrix)),s=di.setFromUnitVectors(this._boneAxis,Y.copy(be).applyMatrix4(l).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(s),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,Y);i<0&&(t.add(Y.multiplyScalar(-i)),t.sub(fe).normalize().multiplyScalar(this._worldSpaceBoneLength).add(fe))})})}_calcWorldSpaceBoneLength(){Y.setFromMatrixPosition(this.bone.matrixWorld),this.child?He.setFromMatrixPosition(this.child.matrixWorld):(He.copy(this._initialLocalChildPosition),He.applyMatrix4(this.bone.matrixWorld)),this._worldSpaceBoneLength=Y.sub(He).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 Ri(t,e){t.children.forEach(n=>{e(n)||Ri(n,e)})}var hi=class{constructor(){this._joints=new Set,this._hasWarnedCircularDependency=!1,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,o=>o.update(t)),Ri(r.bone,o=>{var a,l;return((l=(a=this._objectSpringBonesMap.get(o))==null?void 0:a.size)!=null?l:0)>0?!0:(o.updateWorldMatrix(!1,!1),!1)})}_processSpringBone(t,e,n,i,r){if(n.has(t))return;if(e.has(t)){this._hasWarnedCircularDependency||(console.warn("VRMSpringBoneManager: Circular dependency detected while updating springbones"),this._hasWarnedCircularDependency=!0);return}e.add(t);let o=this._getDependencies(t);for(let a of o)bo(a,l=>{let s=this._objectSpringBonesMap.get(l);if(s)for(let u of s)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}},ci="VRMC_springBone_extended_collider",Vo=new Set(["1.0","1.0-beta"]),Io=new Set(["1.0"]),Ti=class ge{get name(){return ge.EXTENSION_NAME}constructor(e,n){var i;this.parser=e,this.jointHelperRoot=n==null?void 0:n.jointHelperRoot,this.colliderHelperRoot=n==null?void 0:n.colliderHelperRoot,this.useExtendedColliders=(i=n==null?void 0:n.useExtendedColliders)!=null?i:!0}afterRoot(e){return Ge(this,null,function*(){e.userData.vrmSpringBoneManager=yield this._import(e)})}_import(e){return Ge(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 Ge(this,null,function*(){var n,i,r,o,a;let l=e.parser.json;if(!(((n=l.extensionsUsed)==null?void 0:n.indexOf(ge.EXTENSION_NAME))!==-1))return null;let u=new hi,d=yield e.parser.getDependencies("node"),c=(i=l.extensions)==null?void 0:i[ge.EXTENSION_NAME];if(!c)return null;let f=c.specVersion;if(!Vo.has(f))return console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${ge.EXTENSION_NAME} specVersion "${f}"`),null;let p=(r=c.colliders)==null?void 0:r.map((h,_)=>{var g,T,R,v,M,E,x,S,b,A,L,C,Z,Me,Re;let $=d[h.node],W=h.shape,he=(g=h.extensions)==null?void 0:g[ci];if(this.useExtendedColliders&&he!=null){let Te=he.specVersion;if(!Io.has(Te))console.warn(`VRMSpringBoneLoaderPlugin: Unknown ${ci} specVersion "${Te}". Fallbacking to the ${ge.EXTENSION_NAME} definition`);else{let U=he.shape;if(U.sphere)return this._importSphereCollider($,{offset:new B.Vector3().fromArray((T=U.sphere.offset)!=null?T:[0,0,0]),radius:(R=U.sphere.radius)!=null?R:0,inside:(v=U.sphere.inside)!=null?v:!1});if(U.capsule)return this._importCapsuleCollider($,{offset:new B.Vector3().fromArray((M=U.capsule.offset)!=null?M:[0,0,0]),radius:(E=U.capsule.radius)!=null?E:0,tail:new B.Vector3().fromArray((x=U.capsule.tail)!=null?x:[0,0,0]),inside:(S=U.capsule.inside)!=null?S:!1});if(U.plane)return this._importPlaneCollider($,{offset:new B.Vector3().fromArray((b=U.plane.offset)!=null?b:[0,0,0]),normal:new B.Vector3().fromArray((A=U.plane.normal)!=null?A:[0,0,1])})}}if(W.sphere)return this._importSphereCollider($,{offset:new B.Vector3().fromArray((L=W.sphere.offset)!=null?L:[0,0,0]),radius:(C=W.sphere.radius)!=null?C:0,inside:!1});if(W.capsule)return this._importCapsuleCollider($,{offset:new B.Vector3().fromArray((Z=W.capsule.offset)!=null?Z:[0,0,0]),radius:(Me=W.capsule.radius)!=null?Me:0,tail:new B.Vector3().fromArray((Re=W.capsule.tail)!=null?Re:[0,0,0]),inside:!1});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${_} has no valid shape`)}),m=(o=c.colliderGroups)==null?void 0:o.map((h,_)=>{var g;return{colliders:((g=h.colliders)!=null?g:[]).map(R=>{let v=p==null?void 0:p[R];if(v==null)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${_} attempted to use a collider #${R} but not found`);return v}),name:h.name}});return(a=c.springs)==null||a.forEach((h,_)=>{var g;let T=h.joints,R=(g=h.colliderGroups)==null?void 0:g.map(E=>{let x=m==null?void 0:m[E];if(x==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${_} attempted to use a colliderGroup ${E} but not found`);return x}),v=h.center!=null?d[h.center]:void 0,M;T.forEach(E=>{if(M){let x=M.node,S=d[x],b=E.node,A=d[b],L={hitRadius:M.hitRadius,dragForce:M.dragForce,gravityPower:M.gravityPower,stiffness:M.stiffness,gravityDir:M.gravityDir!=null?new B.Vector3().fromArray(M.gravityDir):void 0},C=this._importJoint(S,A,L,R);v&&(C.center=v),u.addJoint(C)}M=E})}),u.setInitState(),u})}_v0Import(e){return Ge(this,null,function*(){var n,i,r;let o=e.parser.json;if(!(((n=o.extensionsUsed)==null?void 0:n.indexOf("VRM"))!==-1))return null;let l=(i=o.extensions)==null?void 0:i.VRM,s=l==null?void 0:l.secondaryAnimation;if(!s)return null;let u=s==null?void 0:s.boneGroups;if(!u)return null;let d=new hi,c=yield e.parser.getDependencies("node"),f=(r=s.colliderGroups)==null?void 0:r.map(p=>{var m;let h=c[p.node];return{colliders:((m=p.colliders)!=null?m:[]).map((g,T)=>{var R,v,M;let E=new B.Vector3(0,0,0);return g.offset&&E.set((R=g.offset.x)!=null?R:0,(v=g.offset.y)!=null?v:0,g.offset.z?-g.offset.z:0),this._importSphereCollider(h,{offset:E,radius:(M=g.radius)!=null?M:0,inside:!1})})}});return u==null||u.forEach((p,m)=>{let h=p.bones;h&&h.forEach(_=>{var g,T,R,v;let M=c[_],E=new B.Vector3;p.gravityDir?E.set((g=p.gravityDir.x)!=null?g:0,(T=p.gravityDir.y)!=null?T:0,(R=p.gravityDir.z)!=null?R:0):E.set(0,-1,0);let x=p.center!=null?c[p.center]:void 0,S={hitRadius:p.hitRadius,dragForce:p.dragForce,gravityPower:p.gravityPower,stiffness:p.stiffiness,gravityDir:E},b=(v=p.colliderGroups)==null?void 0:v.map(A=>{let L=f==null?void 0:f[A];if(L==null)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${m} attempted to use a colliderGroup ${A} but not found`);return L});M.traverse(A=>{var L;let C=(L=A.children[0])!=null?L:null,Z=this._importJoint(A,C,S,b);x&&(Z.center=x),d.addJoint(Z)})})}),e.scene.updateMatrixWorld(),d.setInitState(),d})}_importJoint(e,n,i,r){let o=new Ho(e,n,i,r);if(this.jointHelperRoot){let a=new yo(o);this.jointHelperRoot.add(a),a.renderOrder=this.jointHelperRoot.renderOrder}return o}_importSphereCollider(e,n){let i=new _i(n),r=new Mt(i);if(e.add(r),this.colliderHelperRoot){let o=new Et(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importCapsuleCollider(e,n){let i=new pi(n),r=new Mt(i);if(e.add(r),this.colliderHelperRoot){let o=new Et(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}_importPlaneCollider(e,n){let i=new mi(n),r=new Mt(i);if(e.add(r),this.colliderHelperRoot){let o=new Et(r);this.colliderHelperRoot.add(o),o.renderOrder=this.colliderHelperRoot.renderOrder}return r}};Ti.EXTENSION_NAME="VRMC_springBone";var xi=Ti;var Tt=class{get name(){return"VRMLoaderPlugin"}constructor(e,n){var o,a,l,s,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=(o=n==null?void 0:n.expressionPlugin)!=null?o:new rt(e),this.firstPersonPlugin=(a=n==null?void 0:n.firstPersonPlugin)!=null?a:new st(e),this.humanoidPlugin=(l=n==null?void 0:n.humanoidPlugin)!=null?l:new at(e,{helperRoot:i,autoUpdateHumanBones:r}),this.lookAtPlugin=(s=n==null?void 0:n.lookAtPlugin)!=null?s:new ut(e,{helperRoot:i}),this.metaPlugin=(u=n==null?void 0:n.metaPlugin)!=null?u:new dt(e),this.mtoonMaterialPlugin=(d=n==null?void 0:n.mtoonMaterialPlugin)!=null?d:new Zn(e),this.materialsHDREmissiveMultiplierPlugin=(c=n==null?void 0:n.materialsHDREmissiveMultiplierPlugin)!=null?c:new Jn(e),this.materialsV0CompatPlugin=(f=n==null?void 0:n.materialsV0CompatPlugin)!=null?f:new ii(e),this.springBonePlugin=(p=n==null?void 0:n.springBonePlugin)!=null?p:new xi(e,{colliderHelperRoot:i,jointHelperRoot:i}),this.nodeConstraintPlugin=(m=n==null?void 0:n.nodeConstraintPlugin)!=null?m:new ai(e,{helperRoot:i})}beforeRoot(){return xe(this,null,function*(){yield this.materialsV0CompatPlugin.beforeRoot(),yield this.mtoonMaterialPlugin.beforeRoot()})}loadMesh(e){return xe(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 xe(this,null,function*(){yield this.materialsHDREmissiveMultiplierPlugin.extendMaterialParams(e,n),yield this.mtoonMaterialPlugin.extendMaterialParams(e,n)})}afterRoot(e){return xe(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 Se({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 yi(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 Co(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=>yi(r)):i&&yi(i))}function wi(t){t.traverse(Co)}import*as je from"three";function Pi(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,o=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}),o=Math.max(o,d.length)}for(let l of i){let{bones:s,boneInverses:u}=r.get(l);if(n)for(let c=s.length;c<o;c++)s[c]=s[0],u[c]=u[0];let d=new je.Skeleton(s,u);l.bind(d,new je.Matrix4)}}import*as Si from"three";import{BufferAttribute as xt}from"three";function Ai(t){let e=new Map;t.traverse(n=>{var c,f,p,m;if(!n.isMesh)return;let i=n,r=i.geometry,o=r.index;if(o==null)return;let a=e.get(r);if(a!=null){i.geometry=a;return}let l=new Si.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 s=[],u=[];{let h=o.array,_=new h.constructor(h.length),g=0;for(let T=0;T<h.length;T++){let R=h[T],v=s[R];v==null&&(s[R]=g,u[g]=R,v=g,g++),_[T]=v}l.setIndex(new xt(_,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:T,normalized:R}=_,v=new g.constructor(u.length*T);u.forEach((M,E)=>{for(let x=0;x<T;x++)v[E*T+x]=g[M*T+x]}),l.setAttribute(h,new xt(v,T,R))});let d=!0;Object.keys(r.morphAttributes).forEach(h=>{l.morphAttributes[h]=[];let _=r.morphAttributes[h];for(let g=0;g<_.length;g++){let T=_[g];if(T.isInterleavedBufferAttribute)throw new Error("removeUnnecessaryVertices: InterleavedBufferAttribute is not supported");let R=T.array,{itemSize:v,normalized:M}=T,E=new R.constructor(u.length*v);u.forEach((x,S)=>{for(let b=0;b<v;b++)E[S*v+b]=R[x*v+b]}),d=d&&E.every(x=>x===0),l.morphAttributes[h][g]=new xt(E,v,M)}}),d&&(l.morphAttributes={}),i.geometry=l}),Array.from(e.keys()).forEach(n=>{n.dispose()})}function Li(t){var e;((e=t.meta)==null?void 0:e.metaVersion)==="0"&&(t.scene.rotation.y=Math.PI)}var Ee=class{constructor(){}};Ee.deepDispose=wi,Ee.removeUnnecessaryJoints=Pi,Ee.removeUnnecessaryVertices=Ai,Ee.rotateVRM0=Li;export{kr as MToonMaterial,Fr as MToonMaterialDebugMode,Zn as MToonMaterialLoaderPlugin,jn as MToonMaterialOutlineWidthMode,Se as VRM,so as VRMAimConstraint,ht as VRMCore,zo as VRMCoreLoaderPlugin,tn as VRMExpression,rt as VRMExpressionLoaderPlugin,on as VRMExpressionManager,sn as VRMExpressionMaterialColorBind,ye as VRMExpressionMaterialColorType,an as VRMExpressionMorphTargetBind,Do as VRMExpressionOverrideType,Je as VRMExpressionPresetName,un as VRMExpressionTextureTransformBind,dn as VRMFirstPerson,st as VRMFirstPersonLoaderPlugin,Fo as VRMFirstPersonMeshAnnotationType,Ye as VRMHumanBoneList,Wo as VRMHumanBoneName,hr as VRMHumanBoneParentMap,fn as VRMHumanoid,pn as VRMHumanoidHelper,at as VRMHumanoidLoaderPlugin,Tt as VRMLoaderPlugin,Sr as VRMLookAt,De as VRMLookAtBoneApplier,nt as VRMLookAtExpressionApplier,Er as VRMLookAtHelper,ut as VRMLookAtLoaderPlugin,yn as VRMLookAtRangeMap,ko as VRMLookAtTypeName,dt as VRMMetaLoaderPlugin,_t as VRMNodeConstraint,mt as VRMNodeConstraintHelper,ai as VRMNodeConstraintLoaderPlugin,lo as VRMNodeConstraintManager,mr as VRMRequiredHumanBoneName,_o as VRMRollConstraint,co as VRMRotationConstraint,Mt as VRMSpringBoneCollider,Et as VRMSpringBoneColliderHelper,Rt as VRMSpringBoneColliderShape,pi as VRMSpringBoneColliderShapeCapsule,mi as VRMSpringBoneColliderShapePlane,_i as VRMSpringBoneColliderShapeSphere,Ho as VRMSpringBoneJoint,yo as VRMSpringBoneJointHelper,xi as VRMSpringBoneLoaderPlugin,hi as VRMSpringBoneManager,Ee as VRMUtils};
|
|
925
925
|
/*!
|
|
926
|
-
* @pixiv/three-vrm-core v3.1.
|
|
926
|
+
* @pixiv/three-vrm-core v3.1.3
|
|
927
927
|
* The implementation of core features of VRM, for @pixiv/three-vrm
|
|
928
928
|
*
|
|
929
929
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -931,7 +931,7 @@ void main() {
|
|
|
931
931
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
932
932
|
*/
|
|
933
933
|
/*!
|
|
934
|
-
* @pixiv/three-vrm-materials-mtoon v3.1.
|
|
934
|
+
* @pixiv/three-vrm-materials-mtoon v3.1.3
|
|
935
935
|
* MToon (toon material) module for @pixiv/three-vrm
|
|
936
936
|
*
|
|
937
937
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -939,7 +939,7 @@ void main() {
|
|
|
939
939
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
940
940
|
*/
|
|
941
941
|
/*!
|
|
942
|
-
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.
|
|
942
|
+
* @pixiv/three-vrm-materials-hdr-emissive-multiplier v3.1.3
|
|
943
943
|
* Support VRMC_hdr_emissiveMultiplier for @pixiv/three-vrm
|
|
944
944
|
*
|
|
945
945
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -947,7 +947,7 @@ void main() {
|
|
|
947
947
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
948
948
|
*/
|
|
949
949
|
/*!
|
|
950
|
-
* @pixiv/three-vrm-materials-v0compat v3.1.
|
|
950
|
+
* @pixiv/three-vrm-materials-v0compat v3.1.3
|
|
951
951
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
952
952
|
*
|
|
953
953
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -955,7 +955,7 @@ void main() {
|
|
|
955
955
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
956
956
|
*/
|
|
957
957
|
/*!
|
|
958
|
-
* @pixiv/three-vrm-node-constraint v3.1.
|
|
958
|
+
* @pixiv/three-vrm-node-constraint v3.1.3
|
|
959
959
|
* Node constraint module for @pixiv/three-vrm
|
|
960
960
|
*
|
|
961
961
|
* Copyright (c) 2019-2024 pixiv Inc.
|
|
@@ -963,7 +963,7 @@ void main() {
|
|
|
963
963
|
* https://github.com/pixiv/three-vrm/blob/release/LICENSE
|
|
964
964
|
*/
|
|
965
965
|
/*!
|
|
966
|
-
* @pixiv/three-vrm-springbone v3.1.
|
|
966
|
+
* @pixiv/three-vrm-springbone v3.1.3
|
|
967
967
|
* Spring bone module for @pixiv/three-vrm
|
|
968
968
|
*
|
|
969
969
|
* 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.1.
|
|
3
|
+
"version": "3.1.3",
|
|
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.1.
|
|
60
|
-
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "3.1.
|
|
61
|
-
"@pixiv/three-vrm-materials-mtoon": "3.1.
|
|
62
|
-
"@pixiv/three-vrm-materials-v0compat": "3.1.
|
|
63
|
-
"@pixiv/three-vrm-node-constraint": "3.1.
|
|
64
|
-
"@pixiv/three-vrm-springbone": "3.1.
|
|
59
|
+
"@pixiv/three-vrm-core": "3.1.3",
|
|
60
|
+
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "3.1.3",
|
|
61
|
+
"@pixiv/three-vrm-materials-mtoon": "3.1.3",
|
|
62
|
+
"@pixiv/three-vrm-materials-v0compat": "3.1.3",
|
|
63
|
+
"@pixiv/three-vrm-node-constraint": "3.1.3",
|
|
64
|
+
"@pixiv/three-vrm-springbone": "3.1.3"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/three": "^0.169.0",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"peerDependencies": {
|
|
71
71
|
"three": ">=0.137"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "483118bb24cc3e29a9c171d9ed640efb64e01625"
|
|
74
74
|
}
|