@pixiv/three-vrm-materials-mtoon 3.5.2 → 3.5.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.
@@ -1,5 +1,5 @@
1
1
  /*! (c) 2019-2026 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
2
- var y=Object.defineProperty;var S=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var R=(l,i,e)=>i in l?y(l,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[i]=e,g=(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 a=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(a,s);u((e=e.apply(l,i)).next())});import*as E from"three";import*as U 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){if(e!=null){let r=new U.Color().fromArray(e);t&&r.convertSRGBToLinear(),this._materialParams[i]=r}}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 o from"three";var O=`// #define PHONG
2
+ var y=Object.defineProperty;var S=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,P=Object.prototype.propertyIsEnumerable;var R=(l,i,e)=>i in l?y(l,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[i]=e,g=(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 a=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(a,s);u((e=e.apply(l,i)).next())});import*as E from"three";import*as U 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){if(e!=null){let r=new U.Color().fromArray(e);t&&r.convertSRGBToLinear(),this._materialParams[i]=r}}assignTexture(i,e,t){return m(this,null,function*(){let r=m(this,null,function*(){if(e!=null){let a=yield this._parser.assignTexture(this._materialParams,i,e);if(a==null){console.warn("GLTFMToonMaterialParamsAssignHelper: Failed to load texture. The rendering result may be wrong");return}t&&L(a,"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 o from"three";var b=`// #define PHONG
3
3
 
4
4
  varying vec3 vViewPosition;
5
5
 
@@ -117,7 +117,7 @@ void main() {
117
117
  #include <shadowmap_vertex>
118
118
  #include <fog_vertex>
119
119
 
120
- }`;var b=`// #define PHONG
120
+ }`;var O=`// #define PHONG
121
121
 
122
122
  uniform vec3 litFactor;
123
123
 
@@ -930,6 +930,6 @@ void main() {
930
930
  gl_FragColor = vec4( col, diffuseColor.a );
931
931
  postCorrection();
932
932
  }
933
- `;var v={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"};var p={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"};import*as A from"three";var F={3e3:"",3001:"srgb"};function T(l){return parseInt(A.REVISION,10)>=152?l.colorSpace:F[l.encoding]}var f=class extends o.ShaderMaterial{constructor(e={}){var t;super({vertexShader:O,fragmentShader:b});this.uvAnimationScrollXSpeedFactor=0;this.uvAnimationScrollYSpeedFactor=0;this.uvAnimationRotationSpeedFactor=0;this.fog=!0;this.normalMapType=o.TangentSpaceNormalMap;this._ignoreVertexColor=!0;this._v0CompatShade=!1;this._debugMode=v.None;this._outlineWidthMode=p.None;this._isOutline=!1;e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,e.fog=!0,e.lights=!0,e.clipping=!0,this.uniforms=o.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.normalmap,o.UniformsLib.emissivemap,o.UniformsLib.fog,o.UniformsLib.lights,{litFactor:{value:new o.Color(1,1,1)},mapUvTransform:{value:new o.Matrix3},colorAlpha:{value:1},normalMapUvTransform:{value:new o.Matrix3},shadeColorFactor:{value:new o.Color(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new o.Matrix3},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new o.Matrix3},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new o.Color(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new o.Matrix3},parametricRimColorFactor:{value:new o.Color(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new o.Matrix3},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new o.Color(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new o.Matrix3},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new o.Matrix3},outlineWidthFactor:{value:0},outlineColorFactor:{value:new o.Color(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new o.Matrix3},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(t=e.uniforms)!=null?t:{}]),this.setValues(e),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([r,a])=>`${r}:${a}`),this.matcapTexture?`matcapTextureColorSpace:${T(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${T(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${T(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=r=>{let a=parseInt(o.REVISION,10),s=Object.entries(g(g({},this._generateDefines()),this.defines)).filter(([u,n])=>!!n).map(([u,n])=>`#define ${u} ${n}`).join(`
933
+ `;var v={None:"none",Normal:"normal",LitShadeRate:"litShadeRate",UV:"uv"};var p={None:"none",WorldCoordinates:"worldCoordinates",ScreenCoordinates:"screenCoordinates"};import*as A from"three";var F={3e3:"",3001:"srgb"};function T(l){return parseInt(A.REVISION,10)>=152?l.colorSpace:F[l.encoding]}var f=class extends o.ShaderMaterial{constructor(e={}){var t;super({vertexShader:b,fragmentShader:O});this.uvAnimationScrollXSpeedFactor=0;this.uvAnimationScrollYSpeedFactor=0;this.uvAnimationRotationSpeedFactor=0;this.fog=!0;this.normalMapType=o.TangentSpaceNormalMap;this._ignoreVertexColor=!0;this._v0CompatShade=!1;this._debugMode=v.None;this._outlineWidthMode=p.None;this._isOutline=!1;e.transparentWithZWrite&&(e.depthWrite=!0),delete e.transparentWithZWrite,e.fog=!0,e.lights=!0,e.clipping=!0,this.uniforms=o.UniformsUtils.merge([o.UniformsLib.common,o.UniformsLib.normalmap,o.UniformsLib.emissivemap,o.UniformsLib.fog,o.UniformsLib.lights,{litFactor:{value:new o.Color(1,1,1)},mapUvTransform:{value:new o.Matrix3},colorAlpha:{value:1},normalMapUvTransform:{value:new o.Matrix3},shadeColorFactor:{value:new o.Color(0,0,0)},shadeMultiplyTexture:{value:null},shadeMultiplyTextureUvTransform:{value:new o.Matrix3},shadingShiftFactor:{value:0},shadingShiftTexture:{value:null},shadingShiftTextureUvTransform:{value:new o.Matrix3},shadingShiftTextureScale:{value:1},shadingToonyFactor:{value:.9},giEqualizationFactor:{value:.9},matcapFactor:{value:new o.Color(1,1,1)},matcapTexture:{value:null},matcapTextureUvTransform:{value:new o.Matrix3},parametricRimColorFactor:{value:new o.Color(0,0,0)},rimMultiplyTexture:{value:null},rimMultiplyTextureUvTransform:{value:new o.Matrix3},rimLightingMixFactor:{value:1},parametricRimFresnelPowerFactor:{value:5},parametricRimLiftFactor:{value:0},emissive:{value:new o.Color(0,0,0)},emissiveIntensity:{value:1},emissiveMapUvTransform:{value:new o.Matrix3},outlineWidthMultiplyTexture:{value:null},outlineWidthMultiplyTextureUvTransform:{value:new o.Matrix3},outlineWidthFactor:{value:0},outlineColorFactor:{value:new o.Color(0,0,0)},outlineLightingMixFactor:{value:1},uvAnimationMaskTexture:{value:null},uvAnimationMaskTextureUvTransform:{value:new o.Matrix3},uvAnimationScrollXOffset:{value:0},uvAnimationScrollYOffset:{value:0},uvAnimationRotationPhase:{value:0}},(t=e.uniforms)!=null?t:{}]),this.setValues(e),this._uploadUniformsWorkaround(),this.customProgramCacheKey=()=>[...Object.entries(this._generateDefines()).map(([r,a])=>`${r}:${a}`),this.matcapTexture?`matcapTextureColorSpace:${T(this.matcapTexture)}`:"",this.shadeMultiplyTexture?`shadeMultiplyTextureColorSpace:${T(this.shadeMultiplyTexture)}`:"",this.rimMultiplyTexture?`rimMultiplyTextureColorSpace:${T(this.rimMultiplyTexture)}`:""].join(","),this.onBeforeCompile=r=>{let a=parseInt(o.REVISION,10),s=Object.entries(g(g({},this._generateDefines()),this.defines)).filter(([u,n])=>!!n).map(([u,n])=>`#define ${u} ${n}`).join(`
934
934
  `)+`
935
935
  `;r.vertexShader=s+r.vertexShader,r.fragmentShader=s+r.fragmentShader,a<154&&(r.fragmentShader=r.fragmentShader.replace("#include <colorspace_fragment>","#include <encodings_fragment>"))}}get color(){return this.uniforms.litFactor.value}set color(e){this.uniforms.litFactor.value=e}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e}get normalMap(){return this.uniforms.normalMap.value}set normalMap(e){this.uniforms.normalMap.value=e}get normalScale(){return this.uniforms.normalScale.value}set normalScale(e){this.uniforms.normalScale.value=e}get emissive(){return this.uniforms.emissive.value}set emissive(e){this.uniforms.emissive.value=e}get emissiveIntensity(){return this.uniforms.emissiveIntensity.value}set emissiveIntensity(e){this.uniforms.emissiveIntensity.value=e}get emissiveMap(){return this.uniforms.emissiveMap.value}set emissiveMap(e){this.uniforms.emissiveMap.value=e}get shadeColorFactor(){return this.uniforms.shadeColorFactor.value}set shadeColorFactor(e){this.uniforms.shadeColorFactor.value=e}get shadeMultiplyTexture(){return this.uniforms.shadeMultiplyTexture.value}set shadeMultiplyTexture(e){this.uniforms.shadeMultiplyTexture.value=e}get shadingShiftFactor(){return this.uniforms.shadingShiftFactor.value}set shadingShiftFactor(e){this.uniforms.shadingShiftFactor.value=e}get shadingShiftTexture(){return this.uniforms.shadingShiftTexture.value}set shadingShiftTexture(e){this.uniforms.shadingShiftTexture.value=e}get shadingShiftTextureScale(){return this.uniforms.shadingShiftTextureScale.value}set shadingShiftTextureScale(e){this.uniforms.shadingShiftTextureScale.value=e}get shadingToonyFactor(){return this.uniforms.shadingToonyFactor.value}set shadingToonyFactor(e){this.uniforms.shadingToonyFactor.value=e}get giEqualizationFactor(){return this.uniforms.giEqualizationFactor.value}set giEqualizationFactor(e){this.uniforms.giEqualizationFactor.value=e}get matcapFactor(){return this.uniforms.matcapFactor.value}set matcapFactor(e){this.uniforms.matcapFactor.value=e}get matcapTexture(){return this.uniforms.matcapTexture.value}set matcapTexture(e){this.uniforms.matcapTexture.value=e}get parametricRimColorFactor(){return this.uniforms.parametricRimColorFactor.value}set parametricRimColorFactor(e){this.uniforms.parametricRimColorFactor.value=e}get rimMultiplyTexture(){return this.uniforms.rimMultiplyTexture.value}set rimMultiplyTexture(e){this.uniforms.rimMultiplyTexture.value=e}get rimLightingMixFactor(){return this.uniforms.rimLightingMixFactor.value}set rimLightingMixFactor(e){this.uniforms.rimLightingMixFactor.value=e}get parametricRimFresnelPowerFactor(){return this.uniforms.parametricRimFresnelPowerFactor.value}set parametricRimFresnelPowerFactor(e){this.uniforms.parametricRimFresnelPowerFactor.value=e}get parametricRimLiftFactor(){return this.uniforms.parametricRimLiftFactor.value}set parametricRimLiftFactor(e){this.uniforms.parametricRimLiftFactor.value=e}get outlineWidthMultiplyTexture(){return this.uniforms.outlineWidthMultiplyTexture.value}set outlineWidthMultiplyTexture(e){this.uniforms.outlineWidthMultiplyTexture.value=e}get outlineWidthFactor(){return this.uniforms.outlineWidthFactor.value}set outlineWidthFactor(e){this.uniforms.outlineWidthFactor.value=e}get outlineColorFactor(){return this.uniforms.outlineColorFactor.value}set outlineColorFactor(e){this.uniforms.outlineColorFactor.value=e}get outlineLightingMixFactor(){return this.uniforms.outlineLightingMixFactor.value}set outlineLightingMixFactor(e){this.uniforms.outlineLightingMixFactor.value=e}get uvAnimationMaskTexture(){return this.uniforms.uvAnimationMaskTexture.value}set uvAnimationMaskTexture(e){this.uniforms.uvAnimationMaskTexture.value=e}get uvAnimationScrollXOffset(){return this.uniforms.uvAnimationScrollXOffset.value}set uvAnimationScrollXOffset(e){this.uniforms.uvAnimationScrollXOffset.value=e}get uvAnimationScrollYOffset(){return this.uniforms.uvAnimationScrollYOffset.value}set uvAnimationScrollYOffset(e){this.uniforms.uvAnimationScrollYOffset.value=e}get uvAnimationRotationPhase(){return this.uniforms.uvAnimationRotationPhase.value}set uvAnimationRotationPhase(e){this.uniforms.uvAnimationRotationPhase.value=e}get ignoreVertexColor(){return this._ignoreVertexColor}set ignoreVertexColor(e){this._ignoreVertexColor=e,this.needsUpdate=!0}get v0CompatShade(){return this._v0CompatShade}set v0CompatShade(e){this._v0CompatShade=e,this.needsUpdate=!0}get debugMode(){return this._debugMode}set debugMode(e){this._debugMode=e,this.needsUpdate=!0}get outlineWidthMode(){return this._outlineWidthMode}set outlineWidthMode(e){this._outlineWidthMode=e,this.needsUpdate=!0}get isOutline(){return this._isOutline}set isOutline(e){this._isOutline=e,this.needsUpdate=!0}get isMToonMaterial(){return!0}update(e){this._uploadUniformsWorkaround(),this._updateUVAnimation(e)}copy(e){return super.copy(e),this.map=e.map,this.normalMap=e.normalMap,this.emissiveMap=e.emissiveMap,this.shadeMultiplyTexture=e.shadeMultiplyTexture,this.shadingShiftTexture=e.shadingShiftTexture,this.matcapTexture=e.matcapTexture,this.rimMultiplyTexture=e.rimMultiplyTexture,this.outlineWidthMultiplyTexture=e.outlineWidthMultiplyTexture,this.uvAnimationMaskTexture=e.uvAnimationMaskTexture,this.normalMapType=e.normalMapType,this.uvAnimationScrollXSpeedFactor=e.uvAnimationScrollXSpeedFactor,this.uvAnimationScrollYSpeedFactor=e.uvAnimationScrollYSpeedFactor,this.uvAnimationRotationSpeedFactor=e.uvAnimationRotationSpeedFactor,this.ignoreVertexColor=e.ignoreVertexColor,this.v0CompatShade=e.v0CompatShade,this.debugMode=e.debugMode,this.outlineWidthMode=e.outlineWidthMode,this.isOutline=e.isOutline,this.needsUpdate=!0,this}_updateUVAnimation(e){this.uniforms.uvAnimationScrollXOffset.value+=e*this.uvAnimationScrollXSpeedFactor,this.uniforms.uvAnimationScrollYOffset.value+=e*this.uvAnimationScrollYSpeedFactor,this.uniforms.uvAnimationRotationPhase.value+=e*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 e=parseInt(o.REVISION,10),t=this.outlineWidthMultiplyTexture!==null,r=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:e,OUTLINE:this._isOutline,MTOON_USE_UV:t||r,MTOON_UVS_VERTEX_ONLY:t&&!r,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===p.ScreenCoordinates}}_updateTextureMatrix(e,t){e.value&&(e.value.matrixAutoUpdate&&e.value.updateMatrix(),t.value.copy(e.value.matrix))}};var D=new Set(["1.0","1.0-beta"]),c=class c{get name(){return c.EXTENSION_NAME}constructor(i,e={}){var t,r,a,s;this.parser=i,this.materialType=(t=e.materialType)!=null?t:f,this.renderOrderOffset=(r=e.renderOrderOffset)!=null?r:0,this.v0CompatShade=(a=e.v0CompatShade)!=null?a:!1,this.debugMode=(s=e.debugMode)!=null?s:"none",this._mToonMaterialSet=new Set}beforeRoot(){return m(this,null,function*(){this._removeUnlitExtensionIfMToonExists()})}afterRoot(i){return m(this,null,function*(){i.userData.vrmMToonMaterials=Array.from(this._mToonMaterialSet)})}getMaterialType(i){return this._getMToonExtension(i)?this.materialType:null}extendMaterialParams(i,e){let t=this._getMToonExtension(i);return t?this._extendMaterialParams(t,e):null}loadMesh(i){return m(this,null,function*(){var u;let e=this.parser,r=(u=e.json.meshes)==null?void 0:u[i];if(r==null)throw new Error(`MToonMaterialLoaderPlugin: Attempt to use meshes[${i}] of glTF but the mesh doesn't exist`);let a=r.primitives,s=yield e.loadMesh(i);if(a.length===1){let n=s,d=a[0].material;d!=null&&this._setupPrimitive(n,d)}else{let n=s;for(let d=0;d<a.length;d++){let H=n.children[d],_=a[d].material;_!=null&&this._setupPrimitive(H,_)}}return s})}_removeUnlitExtensionIfMToonExists(){let t=this.parser.json.materials;t==null||t.map((r,a)=>{var u;this._getMToonExtension(a)&&((u=r.extensions)!=null&&u.KHR_materials_unlit)&&delete r.extensions.KHR_materials_unlit})}_getMToonExtension(i){var u,n;let r=(u=this.parser.json.materials)==null?void 0:u[i];if(r==null){console.warn(`MToonMaterialLoaderPlugin: Attempt to use materials[${i}] of glTF but the material doesn't exist`);return}let a=(n=r.extensions)==null?void 0:n[c.EXTENSION_NAME];if(a==null)return;let s=a.specVersion;if(!D.has(s)){console.warn(`MToonMaterialLoaderPlugin: Unknown ${c.EXTENSION_NAME} specVersion "${s}"`);return}return a}_extendMaterialParams(i,e){return m(this,null,function*(){var r;delete e.metalness,delete e.roughness;let t=new h(this.parser,e);t.assignPrimitive("transparentWithZWrite",i.transparentWithZWrite),t.assignColor("shadeColorFactor",i.shadeColorFactor),t.assignTexture("shadeMultiplyTexture",i.shadeMultiplyTexture,!0),t.assignPrimitive("shadingShiftFactor",i.shadingShiftFactor),t.assignTexture("shadingShiftTexture",i.shadingShiftTexture,!0),t.assignPrimitive("shadingShiftTextureScale",(r=i.shadingShiftTexture)==null?void 0:r.scale),t.assignPrimitive("shadingToonyFactor",i.shadingToonyFactor),t.assignPrimitive("giEqualizationFactor",i.giEqualizationFactor),t.assignColor("matcapFactor",i.matcapFactor),t.assignTexture("matcapTexture",i.matcapTexture,!0),t.assignColor("parametricRimColorFactor",i.parametricRimColorFactor),t.assignTexture("rimMultiplyTexture",i.rimMultiplyTexture,!0),t.assignPrimitive("rimLightingMixFactor",i.rimLightingMixFactor),t.assignPrimitive("parametricRimFresnelPowerFactor",i.parametricRimFresnelPowerFactor),t.assignPrimitive("parametricRimLiftFactor",i.parametricRimLiftFactor),t.assignPrimitive("outlineWidthMode",i.outlineWidthMode),t.assignPrimitive("outlineWidthFactor",i.outlineWidthFactor),t.assignTexture("outlineWidthMultiplyTexture",i.outlineWidthMultiplyTexture,!1),t.assignColor("outlineColorFactor",i.outlineColorFactor),t.assignPrimitive("outlineLightingMixFactor",i.outlineLightingMixFactor),t.assignTexture("uvAnimationMaskTexture",i.uvAnimationMaskTexture,!1),t.assignPrimitive("uvAnimationScrollXSpeedFactor",i.uvAnimationScrollXSpeedFactor),t.assignPrimitive("uvAnimationScrollYSpeedFactor",i.uvAnimationScrollYSpeedFactor),t.assignPrimitive("uvAnimationRotationSpeedFactor",i.uvAnimationRotationSpeedFactor),t.assignPrimitive("v0CompatShade",this.v0CompatShade),t.assignPrimitive("debugMode",this.debugMode),yield t.pending})}_setupPrimitive(i,e){let t=this._getMToonExtension(e);if(t){let r=this._parseRenderOrder(t);i.renderOrder=r+this.renderOrderOffset,this._generateOutline(i),this._addToMaterialSet(i);return}}_shouldGenerateOutline(i){return typeof i.outlineWidthMode=="string"&&i.outlineWidthMode!=="none"&&typeof i.outlineWidthFactor=="number"&&i.outlineWidthFactor>0}_generateOutline(i){let e=i.material;if(!(e instanceof E.Material)||!this._shouldGenerateOutline(e))return;i.material=[e];let t=e.clone();t.name+=" (Outline)",t.isOutline=!0,t.side=E.BackSide,i.material.push(t);let r=i.geometry,a=r.index?r.index.count:r.attributes.position.count/3;r.addGroup(0,a,0),r.addGroup(0,a,1)}_addToMaterialSet(i){let e=i.material,t=new Set;Array.isArray(e)?e.forEach(r=>t.add(r)):t.add(e);for(let r of t)this._mToonMaterialSet.add(r)}_parseRenderOrder(i){var t;return(i.transparentWithZWrite?0:19)+((t=i.renderQueueOffsetNumber)!=null?t:0)}};c.EXTENSION_NAME="VRMC_materials_mtoon";var M=c;export{f as MToonMaterial,v as MToonMaterialDebugMode,M as MToonMaterialLoaderPlugin,p as MToonMaterialOutlineWidthMode};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixiv/three-vrm-materials-mtoon",
3
- "version": "3.5.2",
3
+ "version": "3.5.3",
4
4
  "description": "MToon (toon material) module for @pixiv/three-vrm",
5
5
  "license": "MIT",
6
6
  "author": "pixiv",
@@ -54,8 +54,8 @@
54
54
  ]
55
55
  },
56
56
  "dependencies": {
57
- "@pixiv/types-vrm-0.0": "3.5.2",
58
- "@pixiv/types-vrmc-materials-mtoon-1.0": "3.5.2"
57
+ "@pixiv/types-vrm-0.0": "3.5.3",
58
+ "@pixiv/types-vrmc-materials-mtoon-1.0": "3.5.3"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/three": "^0.180.0",
@@ -64,5 +64,5 @@
64
64
  "peerDependencies": {
65
65
  "three": ">=0.137"
66
66
  },
67
- "gitHead": "9d125586f6d7da094b0ac5f204cebf19586f2397"
67
+ "gitHead": "54e050311b9a27881da21ab842e15380bb512ad8"
68
68
  }
@@ -13,7 +13,7 @@ export declare class GLTFMToonMaterialParamsAssignHelper {
13
13
  constructor(parser: GLTFParser, materialParams: MToonMaterialParameters);
14
14
  assignPrimitive<T extends keyof MToonMaterialParameters>(key: T, value: MToonMaterialParameters[T]): void;
15
15
  assignColor<T extends keyof MToonMaterialParameters>(key: T, value: number[] | undefined, convertSRGBToLinear?: boolean): void;
16
- assignTexture<T extends keyof MToonMaterialParameters>(key: T, texture: {
16
+ assignTexture<T extends keyof MToonMaterialParameters>(key: T, schemaTexture: {
17
17
  index: number;
18
18
  } | undefined, isColorTexture: boolean): Promise<void>;
19
19
  assignTextureByIndex<T extends keyof MToonMaterialParameters>(key: T, textureIndex: number | undefined, isColorTexture: boolean): Promise<void>;