@pixiv/three-vrm 1.0.1 → 1.0.2
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.
|
@@ -83,7 +83,7 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
83
83
|
***************************************************************************** */
|
|
84
84
|
function He(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))}Be.EXTENSION_NAME="VRMC_materials_mtoon";class ke{constructor(e){this.parser=e}get name(){return ke.EXTENSION_NAME}extendMaterialParams(e,t){return He(this,void 0,void 0,(function*(){const i=this._getHDREmissiveMultiplierExtension(e);if(null==i)return;console.warn("VRMMaterialsHDREmissiveMultiplierLoaderPlugin: `VRMC_materials_hdr_emissiveMultiplier` is archived. Use `KHR_materials_emissive_strength` instead.");const n=i.emissiveMultiplier;t.emissiveIntensity=n}))}_getHDREmissiveMultiplierExtension(e){var t,i;const n=null===(t=this.parser.json.materials)||void 0===t?void 0:t[e];if(null==n)return void console.warn(`VRMMaterialsHDREmissiveMultiplierLoaderPlugin: Attempt to use materials[${e}] of glTF but the material doesn't exist`);const r=null===(i=n.extensions)||void 0===i?void 0:i[ke.EXTENSION_NAME];return null!=r?r:void 0}}
|
|
85
85
|
/*!
|
|
86
|
-
* @pixiv/three-vrm-materials-v0compat v1.0.
|
|
86
|
+
* @pixiv/three-vrm-materials-v0compat v1.0.2
|
|
87
87
|
* VRM0.0 materials compatibility layer plugin for @pixiv/three-vrm
|
|
88
88
|
*
|
|
89
89
|
* Copyright (c) 2020-2021 pixiv Inc.
|
|
@@ -104,7 +104,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
104
104
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
105
105
|
PERFORMANCE OF THIS SOFTWARE.
|
|
106
106
|
***************************************************************************** */
|
|
107
|
-
function We(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))}function ze(e){return Math.pow(e,2.2)}ke.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";class je{constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const i=this.parser.json;i.extensionsUsed=null!==(t=i.extensionsUsed)&&void 0!==t?t:[],-1===i.extensionsUsed.indexOf("KHR_texture_transform")&&i.extensionsUsed.push("KHR_texture_transform")}get name(){return"VRMMaterialsV0CompatPlugin"}beforeRoot(){var e;return We(this,void 0,void 0,(function*(){const t=this.parser.json,i=null===(e=t.extensions)||void 0===e?void 0:e.VRM,n=null==i?void 0:i.materialProperties;n&&(this._populateRenderQueueMap(n),n.forEach(((e,i)=>{var n,r;const o=null===(n=t.materials)||void 0===n?void 0:n[i];if(null!=o)if("VRM/MToon"===e.shader){const n=this._parseV0MToonProperties(e,o);t.materials[i]=n}else if(null===(r=e.shader)||void 0===r?void 0:r.startsWith("VRM/Unlit")){const n=this._parseV0UnlitProperties(e,o);t.materials[i]=n}else"VRM_USE_GLTFSHADER"===e.shader||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${e.shader}`);else console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${i}] of glTF but the material doesn't exist`)})))}))}_parseV0MToonProperties(t,i){var n,r,o,s,a,l,u,d,h,c,p,m,f,v,g,_,x,M,y,T,R,w,E,P,L,S,A,b,I,U,O,V,C,N,D,F,B,H,k,W,z,j,Q,X;const G=null!==(r=null===(n=t.keywordMap)||void 0===n?void 0:n._ALPHABLEND_ON)&&void 0!==r&&r,Y=1===(null===(o=t.floatProperties)||void 0===o?void 0:o._ZWrite)&&G,q=this._v0ParseRenderQueue(t),$=null!==(a=null===(s=t.keywordMap)||void 0===s?void 0:s._ALPHATEST_ON)&&void 0!==a&&a,Z=G?"BLEND":$?"MASK":"OPAQUE",J=$?null===(l=t.floatProperties)||void 0===l?void 0:l._Cutoff:void 0,K=0===(null!==(d=null===(u=t.floatProperties)||void 0===u?void 0:u._CullMode)&&void 0!==d?d:2),ee=this._portTextureTransform(t),te=null===(c=null===(h=t.vectorProperties)||void 0===h?void 0:h._Color)||void 0===c?void 0:c.map(((e,t)=>3===t?e:ze(e))),ie=null===(p=t.textureProperties)||void 0===p?void 0:p._MainTex,ne=null!=ie?{index:ie,extensions:Object.assign({},ee)}:void 0,re=null===(m=t.floatProperties)||void 0===m?void 0:m._BumpScale,oe=null===(f=t.textureProperties)||void 0===f?void 0:f._BumpMap,se=null!=oe?{index:oe,scale:re,extensions:Object.assign({},ee)}:void 0,ae=null===(g=null===(v=t.vectorProperties)||void 0===v?void 0:v._EmissionColor)||void 0===g?void 0:g.map(ze),le=null===(_=t.textureProperties)||void 0===_?void 0:_._EmissionMap,ue=null!=le?{index:le,extensions:Object.assign({},ee)}:void 0,de=null===(M=null===(x=t.vectorProperties)||void 0===x?void 0:x._ShadeColor)||void 0===M?void 0:M.map(ze),he=null===(y=t.textureProperties)||void 0===y?void 0:y._ShadeTexture,ce=null!=he?{index:he,extensions:Object.assign({},ee)}:void 0;let pe=null!==(R=null===(T=t.floatProperties)||void 0===T?void 0:T._ShadeShift)&&void 0!==R?R:0,me=null!==(E=null===(w=t.floatProperties)||void 0===w?void 0:w._ShadeToony)&&void 0!==E?E:.9;me=e.MathUtils.lerp(me,1,.5+.5*pe),pe=-pe-(1-me);const fe=null===(P=t.floatProperties)||void 0===P?void 0:P._IndirectLightIntensity,ve=fe?1-fe:void 0,ge=null===(L=t.textureProperties)||void 0===L?void 0:L._SphereAdd,_e=null!=ge?{index:ge}:void 0,
|
|
107
|
+
function We(e,t,i,n){return new(i||(i=Promise))((function(r,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((n=n.apply(e,t||[])).next())}))}function ze(e){return Math.pow(e,2.2)}ke.EXTENSION_NAME="VRMC_materials_hdr_emissiveMultiplier";class je{constructor(e){var t;this.parser=e,this._renderQueueMapTransparent=new Map,this._renderQueueMapTransparentZWrite=new Map;const i=this.parser.json;i.extensionsUsed=null!==(t=i.extensionsUsed)&&void 0!==t?t:[],-1===i.extensionsUsed.indexOf("KHR_texture_transform")&&i.extensionsUsed.push("KHR_texture_transform")}get name(){return"VRMMaterialsV0CompatPlugin"}beforeRoot(){var e;return We(this,void 0,void 0,(function*(){const t=this.parser.json,i=null===(e=t.extensions)||void 0===e?void 0:e.VRM,n=null==i?void 0:i.materialProperties;n&&(this._populateRenderQueueMap(n),n.forEach(((e,i)=>{var n,r;const o=null===(n=t.materials)||void 0===n?void 0:n[i];if(null!=o)if("VRM/MToon"===e.shader){const n=this._parseV0MToonProperties(e,o);t.materials[i]=n}else if(null===(r=e.shader)||void 0===r?void 0:r.startsWith("VRM/Unlit")){const n=this._parseV0UnlitProperties(e,o);t.materials[i]=n}else"VRM_USE_GLTFSHADER"===e.shader||console.warn(`VRMMaterialsV0CompatPlugin: Unknown shader: ${e.shader}`);else console.warn(`VRMMaterialsV0CompatPlugin: Attempt to use materials[${i}] of glTF but the material doesn't exist`)})))}))}_parseV0MToonProperties(t,i){var n,r,o,s,a,l,u,d,h,c,p,m,f,v,g,_,x,M,y,T,R,w,E,P,L,S,A,b,I,U,O,V,C,N,D,F,B,H,k,W,z,j,Q,X;const G=null!==(r=null===(n=t.keywordMap)||void 0===n?void 0:n._ALPHABLEND_ON)&&void 0!==r&&r,Y=1===(null===(o=t.floatProperties)||void 0===o?void 0:o._ZWrite)&&G,q=this._v0ParseRenderQueue(t),$=null!==(a=null===(s=t.keywordMap)||void 0===s?void 0:s._ALPHATEST_ON)&&void 0!==a&&a,Z=G?"BLEND":$?"MASK":"OPAQUE",J=$?null===(l=t.floatProperties)||void 0===l?void 0:l._Cutoff:void 0,K=0===(null!==(d=null===(u=t.floatProperties)||void 0===u?void 0:u._CullMode)&&void 0!==d?d:2),ee=this._portTextureTransform(t),te=null===(c=null===(h=t.vectorProperties)||void 0===h?void 0:h._Color)||void 0===c?void 0:c.map(((e,t)=>3===t?e:ze(e))),ie=null===(p=t.textureProperties)||void 0===p?void 0:p._MainTex,ne=null!=ie?{index:ie,extensions:Object.assign({},ee)}:void 0,re=null===(m=t.floatProperties)||void 0===m?void 0:m._BumpScale,oe=null===(f=t.textureProperties)||void 0===f?void 0:f._BumpMap,se=null!=oe?{index:oe,scale:re,extensions:Object.assign({},ee)}:void 0,ae=null===(g=null===(v=t.vectorProperties)||void 0===v?void 0:v._EmissionColor)||void 0===g?void 0:g.map(ze),le=null===(_=t.textureProperties)||void 0===_?void 0:_._EmissionMap,ue=null!=le?{index:le,extensions:Object.assign({},ee)}:void 0,de=null===(M=null===(x=t.vectorProperties)||void 0===x?void 0:x._ShadeColor)||void 0===M?void 0:M.map(ze),he=null===(y=t.textureProperties)||void 0===y?void 0:y._ShadeTexture,ce=null!=he?{index:he,extensions:Object.assign({},ee)}:void 0;let pe=null!==(R=null===(T=t.floatProperties)||void 0===T?void 0:T._ShadeShift)&&void 0!==R?R:0,me=null!==(E=null===(w=t.floatProperties)||void 0===w?void 0:w._ShadeToony)&&void 0!==E?E:.9;me=e.MathUtils.lerp(me,1,.5+.5*pe),pe=-pe-(1-me);const fe=null===(P=t.floatProperties)||void 0===P?void 0:P._IndirectLightIntensity,ve=fe?1-fe:void 0,ge=null===(L=t.textureProperties)||void 0===L?void 0:L._SphereAdd,_e=null!=ge?[1,1,1]:void 0,xe=null!=ge?{index:ge}:void 0,Me=null===(S=t.floatProperties)||void 0===S?void 0:S._RimLightingMix,ye=null===(A=t.textureProperties)||void 0===A?void 0:A._RimTexture,Te=null!=ye?{index:ye,extensions:Object.assign({},ee)}:void 0,Re=null===(I=null===(b=t.vectorProperties)||void 0===b?void 0:b._RimColor)||void 0===I?void 0:I.map(ze),we=null===(U=t.floatProperties)||void 0===U?void 0:U._RimFresnelPower,Ee=null===(O=t.floatProperties)||void 0===O?void 0:O._RimLift,Pe=["none","worldCoordinates","screenCoordinates"][null!==(C=null===(V=t.floatProperties)||void 0===V?void 0:V._OutlineWidthMode)&&void 0!==C?C:0];let Le=null!==(D=null===(N=t.floatProperties)||void 0===N?void 0:N._OutlineWidth)&&void 0!==D?D:0;Le*=.01;const Se=null===(F=t.textureProperties)||void 0===F?void 0:F._OutlineWidthTexture,Ae=null!=Se?{index:Se,extensions:Object.assign({},ee)}:void 0,be=null===(H=null===(B=t.vectorProperties)||void 0===B?void 0:B._OutlineColor)||void 0===H?void 0:H.map(ze),Ie=1===(null===(k=t.floatProperties)||void 0===k?void 0:k._OutlineColorMode)?null===(W=t.floatProperties)||void 0===W?void 0:W._OutlineLightingMix:0,Ue=null===(z=t.textureProperties)||void 0===z?void 0:z._UvAnimMaskTexture,Oe=null!=Ue?{index:Ue,extensions:Object.assign({},ee)}:void 0,Ve=null===(j=t.floatProperties)||void 0===j?void 0:j._UvAnimScrollX;let Ce=null===(Q=t.floatProperties)||void 0===Q?void 0:Q._UvAnimScrollY;null!=Ce&&(Ce=-Ce);const Ne={specVersion:"1.0",transparentWithZWrite:Y,renderQueueOffsetNumber:q,shadeColorFactor:de,shadeMultiplyTexture:ce,shadingShiftFactor:pe,shadingToonyFactor:me,giEqualizationFactor:ve,matcapFactor:_e,matcapTexture:xe,rimLightingMixFactor:Me,rimMultiplyTexture:Te,parametricRimColorFactor:Re,parametricRimFresnelPowerFactor:we,parametricRimLiftFactor:Ee,outlineWidthMode:Pe,outlineWidthFactor:Le,outlineWidthMultiplyTexture:Ae,outlineColorFactor:be,outlineLightingMixFactor:Ie,uvAnimationMaskTexture:Oe,uvAnimationScrollXSpeedFactor:Ve,uvAnimationScrollYSpeedFactor:Ce,uvAnimationRotationSpeedFactor:null===(X=t.floatProperties)||void 0===X?void 0:X._UvAnimRotation};return Object.assign(Object.assign({},i),{pbrMetallicRoughness:{baseColorFactor:te,baseColorTexture:ne},normalTexture:se,emissiveTexture:ue,emissiveFactor:ae,alphaMode:Z,alphaCutoff:J,doubleSided:K,extensions:{VRMC_materials_mtoon:Ne}})}_parseV0UnlitProperties(e,t){var i,n,r,o;const s="VRM/UnlitTransparentZWrite"===e.shader,a="VRM/UnlitTransparent"===e.shader||s,l=this._v0ParseRenderQueue(e),u="VRM/UnlitCutout"===e.shader,d=a?"BLEND":u?"MASK":"OPAQUE",h=u?null===(i=e.floatProperties)||void 0===i?void 0:i._Cutoff:void 0,c=this._portTextureTransform(e),p=null===(r=null===(n=e.vectorProperties)||void 0===n?void 0:n._Color)||void 0===r?void 0:r.map(ze),m=null===(o=e.textureProperties)||void 0===o?void 0:o._MainTex,f=null!=m?{index:m,extensions:Object.assign({},c)}:void 0,v={specVersion:"1.0",transparentWithZWrite:s,renderQueueOffsetNumber:l,shadeColorFactor:p,shadeMultiplyTexture:f};return Object.assign(Object.assign({},t),{pbrMetallicRoughness:{baseColorFactor:p,baseColorTexture:f},alphaMode:d,alphaCutoff:h,extensions:{VRMC_materials_mtoon:v}})}_portTextureTransform(e){var t,i,n,r,o;const s=null===(t=e.vectorProperties)||void 0===t?void 0:t._MainTex;if(null==s)return{};const a=[null!==(i=null==s?void 0:s[0])&&void 0!==i?i:0,null!==(n=null==s?void 0:s[1])&&void 0!==n?n:0],l=[null!==(r=null==s?void 0:s[2])&&void 0!==r?r:1,null!==(o=null==s?void 0:s[3])&&void 0!==o?o:1];return a[1]=l[1]*(1-a[1])%1,{KHR_texture_transform:{offset:a,scale:l}}}_v0ParseRenderQueue(e){var t,i,n;const r=null!==(i=null===(t=e.keywordMap)||void 0===t?void 0:t._ALPHABLEND_ON)&&void 0!==i&&i,o=1===(null===(n=e.floatProperties)||void 0===n?void 0:n._ZWrite);let s=0;if(r){const t=e.renderQueue;null!=t&&(s=o?this._renderQueueMapTransparentZWrite.get(t):this._renderQueueMapTransparent.get(t))}return s}_populateRenderQueueMap(e){const t=new Set,i=new Set;e.forEach((e=>{var n,r,o;const s=null!==(r=null===(n=e.keywordMap)||void 0===n?void 0:n._ALPHABLEND_ON)&&void 0!==r&&r,a=1===(null===(o=e.floatProperties)||void 0===o?void 0:o._ZWrite);if(s){const n=e.renderQueue;null!=n&&(a?i.add(n):t.add(n))}})),t.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${t.size} render queues for Transparent materials while VRM 1.0 only supports up to 10 render queues. The model might not be rendered correctly.`),i.size>10&&console.warn(`VRMMaterialsV0CompatPlugin: This VRM uses ${i.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(t).sort().forEach(((e,i)=>{const n=Math.min(Math.max(i-t.size+1,-9),0);this._renderQueueMapTransparent.set(e,n)})),Array.from(i).sort().forEach(((e,t)=>{const i=Math.min(Math.max(t,0),9);this._renderQueueMapTransparentZWrite.set(e,i)}))}}
|
|
108
108
|
/*!
|
|
109
109
|
* @pixiv/three-vrm-node-constraint v1.0.0
|
|
110
110
|
* Node constraint module for @pixiv/three-vrm
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixiv/three-vrm",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "VRM file loader for three.js.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "pixiv",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@pixiv/three-vrm-core": "1.0.1",
|
|
50
50
|
"@pixiv/three-vrm-materials-hdr-emissive-multiplier": "1.0.0",
|
|
51
51
|
"@pixiv/three-vrm-materials-mtoon": "1.0.0",
|
|
52
|
-
"@pixiv/three-vrm-materials-v0compat": "1.0.
|
|
52
|
+
"@pixiv/three-vrm-materials-v0compat": "1.0.2",
|
|
53
53
|
"@pixiv/three-vrm-node-constraint": "1.0.0",
|
|
54
54
|
"@pixiv/three-vrm-springbone": "1.0.0"
|
|
55
55
|
},
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"@types/three": "^0.140.0",
|
|
64
64
|
"three": "^0.140.2"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "a914501582754519697cda0fa2375657f6d41394"
|
|
67
67
|
}
|