@pixiv/three-vrm-materials-mtoon 3.3.3 → 3.3.4

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019-2024 pixiv Inc.
1
+ Copyright (c) 2019-2025 pixiv Inc.
2
2
 
3
3
  MIT License
4
4
 
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @pixiv/three-vrm-materials-mtoon v3.3.3
2
+ * @pixiv/three-vrm-materials-mtoon v3.3.4
3
3
  * MToon (toon material) module for @pixiv/three-vrm
4
4
  *
5
- * Copyright (c) 2019-2024 pixiv Inc.
5
+ * Copyright (c) 2019-2025 pixiv Inc.
6
6
  * @pixiv/three-vrm-materials-mtoon is distributed under MIT License
7
7
  * https://github.com/pixiv/three-vrm/blob/release/LICENSE
8
8
  */
@@ -1,2 +1,2 @@
1
- /*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
1
+ /*! (c) 2019-2025 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
2
  "use strict";var Ne=Object.create;var v=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var Me=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var Se=(r,e)=>{for(var t in e)v(r,t,{get:e[t],enumerable:!0})},Y=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of xe(e))!ge.call(r,n)&&n!==t&&v(r,n,{get:()=>e[n],enumerable:!(o=He(e,n))||o.enumerable});return r};var c=(r,e,t)=>(t=r!=null?Ne(Me(r)):{},Y(e||!r||!r.__esModule?v(t,"default",{value:r,enumerable:!0}):t,r)),be=r=>Y(v({},"__esModule",{value:!0}),r);var Ce={};Se(Ce,{MToonAnimatedUVNode:()=>p,MToonLightingModel:()=>f,MToonNodeMaterial:()=>L});module.exports=be(Ce);var B=c(require("three"),1),X=parseInt(B.REVISION,10);X<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${X}). This would not work correctly.`);var s=c(require("three/webgpu"),1);var a=c(require("three/webgpu"),1),K=a.materialReference("color","color"),q=a.materialReference("map","texture"),Z=a.materialReference("normalMap","texture"),$=a.materialReference("normalScale","vec2"),G=a.materialReference("emissive","color"),J=a.materialReference("emissiveIntensity","float"),Q=a.materialReference("emissiveMap","texture"),ee=a.materialReference("shadeColorFactor","color"),te=a.materialReference("shadingShiftFactor","float"),V=a.materialReference("shadeMultiplyTexture","texture"),ie=a.materialReference("shadeMultiplyTextureScale","float"),oe=a.materialReference("shadingToonyFactor","float"),re=a.materialReference("rimLightingMixFactor","float"),ae=a.materialReference("rimMultiplyTexture","texture"),ne=a.materialReference("matcapFactor","color"),le=a.materialReference("matcapTexture","texture"),se=a.materialReference("parametricRimColorFactor","color"),de=a.materialReference("parametricRimLiftFactor","float"),ue=a.materialReference("parametricRimFresnelPowerFactor","float"),ce=a.materialReference("outlineWidthMultiplyTexture","texture"),Ee=a.materialReference("outlineWidthFactor","float"),P=a.materialReference("outlineColorFactor","color"),me=a.materialReference("outlineLightingMixFactor","float"),he=a.materialReference("uvAnimationMaskTexture","texture"),pe=a.materialReference("uvAnimationScrollXOffset","float"),Te=a.materialReference("uvAnimationScrollYOffset","float"),Re=a.materialReference("uvAnimationRotationPhase","float");var p=class extends s.TempNode{constructor(e){super("vec2"),this.hasMaskTexture=e}setup(){let e=1;this.hasMaskTexture&&(e=s.vec4(he).context({getUV:()=>s.uv()}).r);let t=s.uv(),o=Re.mul(e),n=s.cos(o),u=s.sin(o);t=t.sub(s.vec2(.5,.5)),t=t.mul(s.mat2(n,u,u.negate(),n)),t=t.add(s.vec2(.5,.5));let E=s.vec2(pe,Te).mul(e);return t=t.add(E),t.toVar("AnimatedUV")}};var l=c(require("three/webgpu"),1);var d=c(require("three/webgpu"),1),y=d.nodeImmutable(d.PropertyNode,"vec3").toVar("ShadeColor"),C=d.nodeImmutable(d.PropertyNode,"float").toVar("ShadingShift"),O=d.nodeImmutable(d.PropertyNode,"float").toVar("ShadingToony"),M=d.nodeImmutable(d.PropertyNode,"float").toVar("RimLightingMix"),g=d.nodeImmutable(d.PropertyNode,"vec3").toVar("RimMultiply"),S=d.nodeImmutable(d.PropertyNode,"vec3").toVar("matcap"),b=d.nodeImmutable(d.PropertyNode,"vec3").toVar("ParametricRim");var T=c(require("three/webgpu"),1),R=r=>parseInt(T.REVISION,10)>=168?T.Fn(r):T.tslFn(r);var Fe=R(({a:r,b:e,t})=>{let o=t.sub(r),n=e.sub(r);return o.div(n).clamp()}),ve=R(({dotNL:r})=>{let t=l.float(1).sub(O),o=r.add(C);return o=Fe({a:t.negate(),b:t,t:o}),o=o.mul(1),o}),ye=R(({shading:r,lightColor:e})=>{let t=l.mix(y,l.diffuseColor,r);return e.mul(l.BRDF_Lambert({diffuseColor:t}))}),f=class extends l.LightingModel{constructor(){super()}direct({lightDirection:e,lightColor:t,reflectedLight:o}){let n=l.transformedNormalView.dot(e).clamp(-1,1),u=ve({dotNL:n});o.directDiffuse.assign(o.directDiffuse.add(ye({shading:u,lightColor:t}))),o.directSpecular.assign(o.directSpecular.add(b.add(S).mul(g).mul(l.mix(l.vec3(0),l.BRDF_Lambert({diffuseColor:t}),M))))}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(b.add(S).mul(g).mul(l.mix(l.vec3(1),l.vec3(0),M))))}};var i=c(require("three/webgpu"),1);var N={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"};var H=c(require("three/webgpu"),1);var fe=R(({parametricRimLift:r,parametricRimFresnelPower:e,parametricRimColor:t})=>{let o=H.modelViewPosition.normalize(),n=H.transformedNormalView.dot(o.negate());return H.float(1).sub(n).add(r).clamp().pow(e).mul(t)});var L=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=N.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 f}setup(e){var t;this._animatedUVNode=new p((t=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?t:!1),super.setup(e)}setupDiffuseColor(e){let t=null;if(this.colorNode==null){if(t=K,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(){y.assign(this._setupShadeColorNode()),C.assign(this._setupShadingShiftNode()),O.assign(this._setupShadingToonyNode()),M.assign(this._setupRimLightingMixNode()),g.assign(this._setupRimMultiplyNode()),S.assign(this._setupMatcapNode()),b.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 n=Z.context({getUV:()=>this._animatedUVNode});this.normalNode=i.normalMap(n,$)}this.isOutline&&(this.normalNode=this.normalNode.negate())}if(parseInt(i.REVISION,10)>=168){let n=this.normalNode;return this.normalNode=t,n}else{super.setupNormal(e),this.normalNode=t;return}}setupLighting(e){let t=null;if(this.emissiveNode==null){if(t=G.mul(J),this.emissiveMap&&this.emissiveMap.isTexture===!0){let n=Q.context({getUV:()=>this._animatedUVNode});t=t.mul(n)}this.emissiveNode=t}let o=super.setupLighting(e);return this.emissiveNode===t&&(this.emissiveNode=null),o}setupOutput(e,t){return this.isOutline&&this.outlineWidthMode!==N.None&&(t=i.vec4(i.mix(P,t.xyz.mul(P),me),t.w)),super.setupOutput(e,t)}setupPosition(e){var n,u;let t=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==N.None){(n=this.positionNode)!=null||(this.positionNode=i.positionLocal);let E=i.normalLocal.normalize(),m=Ee;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let h=ce.context({getUV:()=>this._animatedUVNode});m=m.mul(h)}let F=i.length(i.modelNormalMatrix.mul(E)),x=m.mul(F).mul(E);if(this.outlineWidthMode===N.WorldCoordinates)this.positionNode=this.positionNode.add(x);else if(this.outlineWidthMode===N.ScreenCoordinates){let h=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(x.div(h).mul(i.positionView.z.negate()))}(u=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let o=super.setupPosition(e);return o.z.add(o.w.mul(1e-6)),this.positionNode=t,o}copy(e){var t,o,n,u,E,m,F,x,h,w,A,W,j,I,U,_,z,k,D;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=(n=e.normalMap)!=null?n:null,this.normalScale.copy(e.normalScale),this.shadeColorFactor.copy(e.shadeColorFactor),this.shadeMultiplyTexture=(u=e.shadeMultiplyTexture)!=null?u:null,this.shadingShiftFactor=e.shadingShiftFactor,this.shadingShiftTexture=(E=e.shadingShiftTexture)!=null?E:null,this.shadingShiftTextureScale=e.shadingShiftTextureScale,this.shadingToonyFactor=e.shadingToonyFactor,this.rimLightingMixFactor=e.rimLightingMixFactor,this.rimMultiplyTexture=(m=e.rimMultiplyTexture)!=null?m: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=(x=e.outlineWidthMultiplyTexture)!=null?x: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=(h=e.uvAnimationMaskTexture)!=null?h:null,this.shadeColorNode=(w=e.shadeColorNode)!=null?w:null,this.shadingShiftNode=(A=e.shadingShiftNode)!=null?A:null,this.shadingToonyNode=(W=e.shadingToonyNode)!=null?W:null,this.rimLightingMixNode=(j=e.rimLightingMixNode)!=null?j:null,this.rimMultiplyNode=(I=e.rimMultiplyNode)!=null?I:null,this.matcapNode=(U=e.matcapNode)!=null?U:null,this.parametricRimColorNode=(_=e.parametricRimColorNode)!=null?_:null,this.parametricRimLiftNode=(z=e.parametricRimLiftNode)!=null?z:null,this.parametricRimFresnelPowerNode=(k=e.parametricRimFresnelPowerNode)!=null?k:null,this.isOutline=(D=e.isOutline)!=null?D: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=ee;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let t=V.context({getUV:()=>this._animatedUVNode});e=e.mul(t)}return e}_setupShadingShiftNode(){if(this.shadingShiftNode!=null)return i.float(this.shadingShiftNode);let e=te;if(this.shadingShiftTexture&&this.shadingShiftTexture.isTexture===!0){let t=V.context({getUV:()=>this._animatedUVNode});e=e.add(t.mul(ie))}return e}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):oe}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):re}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?ae.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?le.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(ne):i.vec3(0)}_setupParametricRimNode(){let e=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):se,t=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):de,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):ue;return fe({parametricRimLift:t,parametricRimFresnelPower:o,parametricRimColor:e})}};
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @pixiv/three-vrm-materials-mtoon v3.3.3
2
+ * @pixiv/three-vrm-materials-mtoon v3.3.4
3
3
  * MToon (toon material) module for @pixiv/three-vrm
4
4
  *
5
- * Copyright (c) 2019-2024 pixiv Inc.
5
+ * Copyright (c) 2019-2025 pixiv Inc.
6
6
  * @pixiv/three-vrm-materials-mtoon is distributed under MIT License
7
7
  * https://github.com/pixiv/three-vrm/blob/release/LICENSE
8
8
  */
@@ -1,2 +1,2 @@
1
- /*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
1
+ /*! (c) 2019-2025 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
2
  import*as D from"three";var k=parseInt(D.REVISION,10);k<167&&console.warn(`MToonNodeMaterial requires Three.js r167 or higher (You are using r${k}). This would not work correctly.`);import*as l from"three/webgpu";import*as r from"three/webgpu";var Y=r.materialReference("color","color"),X=r.materialReference("map","texture"),B=r.materialReference("normalMap","texture"),K=r.materialReference("normalScale","vec2"),q=r.materialReference("emissive","color"),Z=r.materialReference("emissiveIntensity","float"),$=r.materialReference("emissiveMap","texture"),G=r.materialReference("shadeColorFactor","color"),J=r.materialReference("shadingShiftFactor","float"),C=r.materialReference("shadeMultiplyTexture","texture"),Q=r.materialReference("shadeMultiplyTextureScale","float"),ee=r.materialReference("shadingToonyFactor","float"),te=r.materialReference("rimLightingMixFactor","float"),ie=r.materialReference("rimMultiplyTexture","texture"),oe=r.materialReference("matcapFactor","color"),re=r.materialReference("matcapTexture","texture"),ae=r.materialReference("parametricRimColorFactor","color"),ne=r.materialReference("parametricRimLiftFactor","float"),le=r.materialReference("parametricRimFresnelPowerFactor","float"),se=r.materialReference("outlineWidthMultiplyTexture","texture"),de=r.materialReference("outlineWidthFactor","float"),O=r.materialReference("outlineColorFactor","color"),ue=r.materialReference("outlineLightingMixFactor","float"),ce=r.materialReference("uvAnimationMaskTexture","texture"),Ee=r.materialReference("uvAnimationScrollXOffset","float"),me=r.materialReference("uvAnimationScrollYOffset","float"),he=r.materialReference("uvAnimationRotationPhase","float");var N=class extends l.TempNode{constructor(e){super("vec2"),this.hasMaskTexture=e}setup(){let e=1;this.hasMaskTexture&&(e=l.vec4(ce).context({getUV:()=>l.uv()}).r);let t=l.uv(),o=he.mul(e),n=l.cos(o),u=l.sin(o);t=t.sub(l.vec2(.5,.5)),t=t.mul(l.mat2(n,u,u.negate(),n)),t=t.add(l.vec2(.5,.5));let c=l.vec2(Ee,me).mul(e);return t=t.add(c),t.toVar("AnimatedUV")}};import*as a from"three/webgpu";import*as s from"three/webgpu";var F=s.nodeImmutable(s.PropertyNode,"vec3").toVar("ShadeColor"),v=s.nodeImmutable(s.PropertyNode,"float").toVar("ShadingShift"),y=s.nodeImmutable(s.PropertyNode,"float").toVar("ShadingToony"),H=s.nodeImmutable(s.PropertyNode,"float").toVar("RimLightingMix"),x=s.nodeImmutable(s.PropertyNode,"vec3").toVar("RimMultiply"),M=s.nodeImmutable(s.PropertyNode,"vec3").toVar("matcap"),g=s.nodeImmutable(s.PropertyNode,"vec3").toVar("ParametricRim");import*as h from"three/webgpu";var p=d=>parseInt(h.REVISION,10)>=168?h.Fn(d):h.tslFn(d);var Te=p(({a:d,b:e,t})=>{let o=t.sub(d),n=e.sub(d);return o.div(n).clamp()}),Re=p(({dotNL:d})=>{let t=a.float(1).sub(y),o=d.add(v);return o=Te({a:t.negate(),b:t,t:o}),o=o.mul(1),o}),fe=p(({shading:d,lightColor:e})=>{let t=a.mix(F,a.diffuseColor,d);return e.mul(a.BRDF_Lambert({diffuseColor:t}))}),S=class extends a.LightingModel{constructor(){super()}direct({lightDirection:e,lightColor:t,reflectedLight:o}){let n=a.transformedNormalView.dot(e).clamp(-1,1),u=Re({dotNL:n});o.directDiffuse.assign(o.directDiffuse.add(fe({shading:u,lightColor:t}))),o.directSpecular.assign(o.directSpecular.add(g.add(M).mul(x).mul(a.mix(a.vec3(0),a.BRDF_Lambert({diffuseColor:t}),H))))}indirect(e){this.indirectDiffuse(e),this.indirectSpecular(e)}indirectDiffuse({irradiance:e,reflectedLight:t}){t.indirectDiffuse.assign(t.indirectDiffuse.add(e.mul(a.BRDF_Lambert({diffuseColor:a.diffuseColor}))))}indirectSpecular({reflectedLight:e}){e.indirectSpecular.assign(e.indirectSpecular.add(g.add(M).mul(x).mul(a.mix(a.vec3(1),a.vec3(0),H))))}};import*as i from"three/webgpu";var T={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"};import*as R from"three/webgpu";var pe=p(({parametricRimLift:d,parametricRimFresnelPower:e,parametricRimColor:t})=>{let o=R.modelViewPosition.normalize(),n=R.transformedNormalView.dot(o.negate());return R.float(1).sub(n).add(d).clamp().pow(e).mul(t)});var L=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=T.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 S}setup(e){var t;this._animatedUVNode=new N((t=this.uvAnimationMaskTexture&&this.uvAnimationMaskTexture.isTexture===!0)!=null?t:!1),super.setup(e)}setupDiffuseColor(e){let t=null;if(this.colorNode==null){if(t=Y,this.map&&this.map.isTexture===!0){let o=X.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(){F.assign(this._setupShadeColorNode()),v.assign(this._setupShadingShiftNode()),y.assign(this._setupShadingToonyNode()),H.assign(this._setupRimLightingMixNode()),x.assign(this._setupRimMultiplyNode()),M.assign(this._setupMatcapNode()),g.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 n=B.context({getUV:()=>this._animatedUVNode});this.normalNode=i.normalMap(n,K)}this.isOutline&&(this.normalNode=this.normalNode.negate())}if(parseInt(i.REVISION,10)>=168){let n=this.normalNode;return this.normalNode=t,n}else{super.setupNormal(e),this.normalNode=t;return}}setupLighting(e){let t=null;if(this.emissiveNode==null){if(t=q.mul(Z),this.emissiveMap&&this.emissiveMap.isTexture===!0){let n=$.context({getUV:()=>this._animatedUVNode});t=t.mul(n)}this.emissiveNode=t}let o=super.setupLighting(e);return this.emissiveNode===t&&(this.emissiveNode=null),o}setupOutput(e,t){return this.isOutline&&this.outlineWidthMode!==T.None&&(t=i.vec4(i.mix(O,t.xyz.mul(O),ue),t.w)),super.setupOutput(e,t)}setupPosition(e){var n,u;let t=this.positionNode;if(this.isOutline&&this.outlineWidthMode!==T.None){(n=this.positionNode)!=null||(this.positionNode=i.positionLocal);let c=i.normalLocal.normalize(),E=de;if(this.outlineWidthMultiplyTexture&&this.outlineWidthMultiplyTexture.isTexture===!0){let m=se.context({getUV:()=>this._animatedUVNode});E=E.mul(m)}let b=i.length(i.modelNormalMatrix.mul(c)),f=E.mul(b).mul(c);if(this.outlineWidthMode===T.WorldCoordinates)this.positionNode=this.positionNode.add(f);else if(this.outlineWidthMode===T.ScreenCoordinates){let m=i.cameraProjectionMatrix.element(1).element(1);this.positionNode=this.positionNode.add(f.div(m).mul(i.positionView.z.negate()))}(u=this.positionNode)!=null||(this.positionNode=i.positionLocal)}let o=super.setupPosition(e);return o.z.add(o.w.mul(1e-6)),this.positionNode=t,o}copy(e){var t,o,n,u,c,E,b,f,m,V,P,w,A,W,j,I,U,_,z;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=(n=e.normalMap)!=null?n:null,this.normalScale.copy(e.normalScale),this.shadeColorFactor.copy(e.shadeColorFactor),this.shadeMultiplyTexture=(u=e.shadeMultiplyTexture)!=null?u:null,this.shadingShiftFactor=e.shadingShiftFactor,this.shadingShiftTexture=(c=e.shadingShiftTexture)!=null?c:null,this.shadingShiftTextureScale=e.shadingShiftTextureScale,this.shadingToonyFactor=e.shadingToonyFactor,this.rimLightingMixFactor=e.rimLightingMixFactor,this.rimMultiplyTexture=(E=e.rimMultiplyTexture)!=null?E:null,this.matcapFactor.copy(e.matcapFactor),this.matcapTexture=(b=e.matcapTexture)!=null?b:null,this.parametricRimColorFactor.copy(e.parametricRimColorFactor),this.parametricRimLiftFactor=e.parametricRimLiftFactor,this.parametricRimFresnelPowerFactor=e.parametricRimFresnelPowerFactor,this.outlineWidthMode=e.outlineWidthMode,this.outlineWidthMultiplyTexture=(f=e.outlineWidthMultiplyTexture)!=null?f: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=(m=e.uvAnimationMaskTexture)!=null?m:null,this.shadeColorNode=(V=e.shadeColorNode)!=null?V:null,this.shadingShiftNode=(P=e.shadingShiftNode)!=null?P:null,this.shadingToonyNode=(w=e.shadingToonyNode)!=null?w:null,this.rimLightingMixNode=(A=e.rimLightingMixNode)!=null?A:null,this.rimMultiplyNode=(W=e.rimMultiplyNode)!=null?W:null,this.matcapNode=(j=e.matcapNode)!=null?j:null,this.parametricRimColorNode=(I=e.parametricRimColorNode)!=null?I:null,this.parametricRimLiftNode=(U=e.parametricRimLiftNode)!=null?U:null,this.parametricRimFresnelPowerNode=(_=e.parametricRimFresnelPowerNode)!=null?_:null,this.isOutline=(z=e.isOutline)!=null?z: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=G;if(this.shadeMultiplyTexture&&this.shadeMultiplyTexture.isTexture===!0){let t=C.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=C.context({getUV:()=>this._animatedUVNode});e=e.add(t.mul(Q))}return e}_setupShadingToonyNode(){return this.shadingToonyNode!=null?i.float(this.shadingToonyNode):ee}_setupRimLightingMixNode(){return this.rimLightingMixNode!=null?i.float(this.rimLightingMixNode):te}_setupRimMultiplyNode(){return this.rimMultiplyNode!=null?i.vec3(this.rimMultiplyNode):this.rimMultiplyTexture&&this.rimMultiplyTexture.isTexture===!0?ie.context({getUV:()=>this._animatedUVNode}):i.vec3(1)}_setupMatcapNode(){return this.matcapNode!=null?i.vec3(this.matcapNode):this.matcapTexture&&this.matcapTexture.isTexture===!0?re.context({getUV:()=>i.matcapUV.mul(1,-1).add(0,1)}).mul(oe):i.vec3(0)}_setupParametricRimNode(){let e=this.parametricRimColorNode!=null?i.vec3(this.parametricRimColorNode):ae,t=this.parametricRimLiftNode!=null?i.float(this.parametricRimLiftNode):ne,o=this.parametricRimFresnelPowerNode!=null?i.float(this.parametricRimFresnelPowerNode):le;return pe({parametricRimLift:t,parametricRimFresnelPower:o,parametricRimColor:e})}};export{N as MToonAnimatedUVNode,S as MToonLightingModel,L as MToonNodeMaterial};
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @pixiv/three-vrm-materials-mtoon v3.3.3
2
+ * @pixiv/three-vrm-materials-mtoon v3.3.4
3
3
  * MToon (toon material) module for @pixiv/three-vrm
4
4
  *
5
- * Copyright (c) 2019-2024 pixiv Inc.
5
+ * Copyright (c) 2019-2025 pixiv Inc.
6
6
  * @pixiv/three-vrm-materials-mtoon is distributed under MIT License
7
7
  * https://github.com/pixiv/three-vrm/blob/release/LICENSE
8
8
  */
@@ -1,4 +1,4 @@
1
- /*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
1
+ /*! (c) 2019-2025 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
2
  "use strict";var N=Object.create;var h=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames,x=Object.getOwnPropertySymbols,D=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,V=Object.prototype.propertyIsEnumerable;var L=(a,i,e)=>i in a?h(a,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[i]=e,S=(a,i)=>{for(var e in i||(i={}))b.call(i,e)&&L(a,e,i[e]);if(x)for(var e of x(i))V.call(i,e)&&L(a,e,i[e]);return a};var W=(a,i)=>{for(var e in i)h(a,e,{get:i[e],enumerable:!0})},U=(a,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of w(i))!b.call(a,r)&&r!==e&&h(a,r,{get:()=>i[r],enumerable:!(t=F(i,r))||t.enumerable});return a};var p=(a,i,e)=>(e=a!=null?N(D(a)):{},U(i||!a||!a.__esModule?h(e,"default",{value:a,enumerable:!0}):e,a)),G=a=>U(h({},"__esModule",{value:!0}),a);var m=(a,i,e)=>new Promise((t,r)=>{var n=l=>{try{u(e.next(l))}catch(d){r(d)}},s=l=>{try{u(e.throw(l))}catch(d){r(d)}},u=l=>l.done?t(l.value):Promise.resolve(l.value).then(n,s);u((e=e.apply(a,i)).next())});var Y={};W(Y,{MToonMaterial:()=>c,MToonMaterialDebugMode:()=>v,MToonMaterialLoaderPlugin:()=>M,MToonMaterialOutlineWidthMode:()=>T});module.exports=G(Y);var _=p(require("three"),1);var H=p(require("three"),1);var A=p(require("three"),1),B={"":3e3,srgb:3001};function y(a,i){parseInt(A.REVISION,10)>=152?a.colorSpace=i:a.encoding=B[i]}var E=class{get pending(){return Promise.all(this._pendings)}constructor(i,e){this._parser=i,this._materialParams=e,this._pendings=[]}assignPrimitive(i,e){e!=null&&(this._materialParams[i]=e)}assignColor(i,e,t){e!=null&&(this._materialParams[i]=new H.Color().fromArray(e),t&&this._materialParams[i].convertSRGBToLinear())}assignTexture(i,e,t){return m(this,null,function*(){let r=m(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,i,e),t&&y(this._materialParams[i],"srgb"))});return this._pendings.push(r),r})}assignTextureByIndex(i,e,t){return m(this,null,function*(){return this.assignTexture(i,e!=null?{index:e}:void 0,t)})}};var o=p(require("three"),1);var O=`// #define PHONG
3
3
 
4
4
  varying vec3 vViewPosition;
@@ -1,8 +1,8 @@
1
1
  /*!
2
- * @pixiv/three-vrm-materials-mtoon v3.3.3
2
+ * @pixiv/three-vrm-materials-mtoon v3.3.4
3
3
  * MToon (toon material) module for @pixiv/three-vrm
4
4
  *
5
- * Copyright (c) 2019-2024 pixiv Inc.
5
+ * Copyright (c) 2019-2025 pixiv Inc.
6
6
  * @pixiv/three-vrm-materials-mtoon is distributed under MIT License
7
7
  * https://github.com/pixiv/three-vrm/blob/release/LICENSE
8
8
  */
@@ -1,4 +1,4 @@
1
- /*! (c) 2019-2024 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
1
+ /*! (c) 2019-2025 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
2
  var O=Object.defineProperty;var S=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var R=(l,i,e)=>i in l?O(l,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[i]=e,v=(l,i)=>{for(var e in i||(i={}))C.call(i,e)&&R(l,e,i[e]);if(S)for(var e of S(i))P.call(i,e)&&R(l,e,i[e]);return l};var m=(l,i,e)=>new Promise((t,r)=>{var o=n=>{try{u(e.next(n))}catch(d){r(d)}},s=n=>{try{u(e.throw(n))}catch(d){r(d)}},u=n=>n.done?t(n.value):Promise.resolve(n.value).then(o,s);u((e=e.apply(l,i)).next())});import*as E from"three";import*as b from"three";import*as x from"three";var I={"":3e3,srgb:3001};function L(l,i){parseInt(x.REVISION,10)>=152?l.colorSpace=i:l.encoding=I[i]}var h=class{get pending(){return Promise.all(this._pendings)}constructor(i,e){this._parser=i,this._materialParams=e,this._pendings=[]}assignPrimitive(i,e){e!=null&&(this._materialParams[i]=e)}assignColor(i,e,t){e!=null&&(this._materialParams[i]=new b.Color().fromArray(e),t&&this._materialParams[i].convertSRGBToLinear())}assignTexture(i,e,t){return m(this,null,function*(){let r=m(this,null,function*(){e!=null&&(yield this._parser.assignTexture(this._materialParams,i,e),t&&L(this._materialParams[i],"srgb"))});return this._pendings.push(r),r})}assignTextureByIndex(i,e,t){return m(this,null,function*(){return this.assignTexture(i,e!=null?{index:e}:void 0,t)})}};import*as a from"three";var U=`// #define PHONG
3
3
 
4
4
  varying vec3 vViewPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixiv/three-vrm-materials-mtoon",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "description": "MToon (toon material) module for @pixiv/three-vrm",
5
5
  "license": "MIT",
6
6
  "author": "pixiv",
@@ -55,8 +55,8 @@
55
55
  ]
56
56
  },
57
57
  "dependencies": {
58
- "@pixiv/types-vrm-0.0": "3.3.3",
59
- "@pixiv/types-vrmc-materials-mtoon-1.0": "3.3.3"
58
+ "@pixiv/types-vrm-0.0": "3.3.4",
59
+ "@pixiv/types-vrmc-materials-mtoon-1.0": "3.3.4"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/three": "^0.169.0",
@@ -65,5 +65,5 @@
65
65
  "peerDependencies": {
66
66
  "three": ">=0.137"
67
67
  },
68
- "gitHead": "b3c49efe2f6a8e6807cef0d3b22d6a4ec0b43af3"
68
+ "gitHead": "776c2823dcf3453d689a2d56aa82b289fdf963cf"
69
69
  }