@pixiv/three-vrm-core 1.0.0-beta.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/three-vrm-core.js +3367 -2551
- package/lib/three-vrm-core.min.js +2 -2
- package/lib/three-vrm-core.module.js +3365 -2552
- package/lib/three-vrm-core.module.min.js +2 -2
- package/package.json +12 -12
- package/ts3.4/types/VRMCore.d.ts +7 -7
- package/ts3.4/types/VRMCoreLoaderPluginOptions.d.ts +1 -0
- package/ts3.4/types/VRMCoreParameters.d.ts +2 -2
- package/ts3.4/types/expressions/VRMExpression.d.ts +1 -1
- package/ts3.4/types/expressions/VRMExpressionMaterialColorBind.d.ts +3 -0
- package/ts3.4/types/expressions/VRMExpressionMaterialColorType.d.ts +4 -0
- package/ts3.4/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/ts3.4/types/humanoid/VRMHumanBoneName.d.ts +7 -2
- package/ts3.4/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/ts3.4/types/humanoid/VRMHumanoid.d.ts +130 -21
- package/ts3.4/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +9 -1
- package/ts3.4/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
- package/ts3.4/types/humanoid/VRMHumanoidRig.d.ts +31 -0
- package/ts3.4/types/humanoid/VRMRig.d.ts +62 -0
- package/ts3.4/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
- package/ts3.4/types/humanoid/helpers/index.d.ts +1 -0
- package/ts3.4/types/humanoid/index.d.ts +4 -0
- package/ts3.4/types/lookAt/VRMLookAt.d.ts +48 -6
- package/ts3.4/types/lookAt/VRMLookAtApplier.d.ts +8 -2
- package/ts3.4/types/lookAt/VRMLookAtBoneApplier.d.ts +35 -2
- package/ts3.4/types/lookAt/VRMLookAtExpressionApplier.d.ts +7 -2
- package/ts3.4/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
- package/ts3.4/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
- package/ts3.4/types/lookAt/utils/calcAzimuthAltitude.d.ts +16 -0
- package/ts3.4/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
- package/ts3.4/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
- package/ts3.4/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
- package/ts3.4/types/meta/VRMMetaLoaderPlugin.d.ts +1 -1
- package/ts3.4/types/meta/VRMMetaLoaderPluginOptions.d.ts +1 -1
- package/ts3.4/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
- package/ts3.4/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
- package/ts3.4/types/utils/renameMaterialProperty.d.ts +1 -0
- package/types/VRMCore.d.ts +58 -58
- package/types/VRMCoreLoaderPlugin.d.ts +18 -18
- package/types/VRMCoreLoaderPluginOptions.d.ts +19 -18
- package/types/VRMCoreParameters.d.ts +16 -16
- package/types/expressions/VRMExpression.d.ts +64 -64
- package/types/expressions/VRMExpressionBind.d.ts +11 -11
- package/types/expressions/VRMExpressionLoaderPlugin.d.ts +23 -23
- package/types/expressions/VRMExpressionManager.d.ts +124 -124
- package/types/expressions/VRMExpressionMaterialColorBind.d.ts +45 -42
- package/types/expressions/VRMExpressionMaterialColorType.d.ts +12 -8
- package/types/expressions/VRMExpressionMorphTargetBind.d.ts +35 -35
- package/types/expressions/VRMExpressionOverrideType.d.ts +6 -6
- package/types/expressions/VRMExpressionPresetName.d.ts +21 -21
- package/types/expressions/VRMExpressionTextureTransformBind.d.ts +40 -40
- package/types/expressions/index.d.ts +10 -10
- package/types/firstPerson/VRMFirstPerson.d.ts +84 -84
- package/types/firstPerson/VRMFirstPersonLoaderPlugin.d.ts +20 -20
- package/types/firstPerson/VRMFirstPersonMeshAnnotation.d.ts +5 -5
- package/types/firstPerson/VRMFirstPersonMeshAnnotationType.d.ts +7 -7
- package/types/firstPerson/index.d.ts +4 -4
- package/types/humanoid/VRMHumanBone.d.ts +10 -10
- package/types/humanoid/VRMHumanBoneList.d.ts +5 -0
- package/types/humanoid/VRMHumanBoneName.d.ts +63 -58
- package/types/humanoid/VRMHumanBoneParentMap.d.ts +9 -0
- package/types/humanoid/VRMHumanBones.d.ts +11 -11
- package/types/humanoid/VRMHumanoid.d.ts +182 -73
- package/types/humanoid/VRMHumanoidLoaderPlugin.d.ts +32 -24
- package/types/humanoid/VRMHumanoidLoaderPluginOptions.d.ts +15 -0
- package/types/humanoid/VRMHumanoidRig.d.ts +31 -0
- package/types/humanoid/VRMPose.d.ts +24 -24
- package/types/humanoid/VRMPoseTransform.d.ts +15 -15
- package/types/humanoid/VRMRequiredHumanBoneName.d.ts +18 -18
- package/types/humanoid/VRMRig.d.ts +62 -0
- package/types/humanoid/helpers/VRMHumanoidHelper.d.ts +9 -0
- package/types/humanoid/helpers/index.d.ts +1 -0
- package/types/humanoid/index.d.ts +12 -8
- package/types/index.d.ts +9 -9
- package/types/lookAt/VRMLookAt.d.ts +148 -104
- package/types/lookAt/VRMLookAtApplier.d.ts +18 -12
- package/types/lookAt/VRMLookAtBoneApplier.d.ts +83 -50
- package/types/lookAt/VRMLookAtExpressionApplier.d.ts +56 -51
- package/types/lookAt/VRMLookAtLoaderPlugin.d.ts +30 -30
- package/types/lookAt/VRMLookAtLoaderPluginOptions.d.ts +8 -8
- package/types/lookAt/VRMLookAtRangeMap.d.ts +23 -23
- package/types/lookAt/VRMLookAtTypeName.d.ts +8 -8
- package/types/lookAt/helpers/VRMLookAtHelper.d.ts +11 -11
- package/types/lookAt/helpers/index.d.ts +1 -1
- package/types/lookAt/helpers/utils/FanBufferGeometry.d.ts +13 -13
- package/types/lookAt/helpers/utils/LineAndSphereBufferGeometry.d.ts +13 -13
- package/types/lookAt/index.d.ts +8 -8
- package/types/lookAt/tests/VRMLookAt.test.d.ts +1 -0
- package/types/lookAt/tests/VRMLookAtBoneApplier.test.d.ts +1 -0
- package/types/lookAt/utils/calcAzimuthAltitude.d.ts +13 -0
- package/types/lookAt/utils/sanitizeAngle.d.ts +11 -0
- package/types/lookAt/utils/tests/calcAzimuthAltitude.test.d.ts +1 -0
- package/types/lookAt/utils/tests/sanitizeAngle.test.d.ts +1 -0
- package/types/meta/VRM0Meta.d.ts +62 -62
- package/types/meta/VRM1Meta.d.ts +86 -86
- package/types/meta/VRMMeta.d.ts +6 -6
- package/types/meta/VRMMetaLoaderPlugin.d.ts +32 -32
- package/types/meta/VRMMetaLoaderPluginOptions.d.ts +22 -22
- package/types/meta/index.d.ts +5 -5
- package/types/tests/matchers/toBeCloseToQuaternion.d.ts +10 -0
- package/types/tests/matchers/toBeCloseToVector3.d.ts +10 -0
- package/types/utils/getWorldQuaternionLite.d.ts +8 -8
- package/types/utils/gltfExtractPrimitivesFromNode.d.ts +21 -21
- package/types/utils/gltfGetAssociatedMaterialIndex.d.ts +10 -10
- package/types/utils/quatInvertCompat.d.ts +8 -8
- package/types/utils/renameMaterialProperty.d.ts +1 -0
- package/types/utils/resolveURL.d.ts +4 -4
- package/types/utils/saturate.d.ts +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! (c) 2020-2021 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
|
|
2
|
-
import*as e from"three";class t extends e.Object3D{constructor(e){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${e}`,this.expressionName=e,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return"block"===this.overrideBlink?0<this.weight?1:0:"blend"===this.overrideBlink?this.weight:0}get overrideLookAtAmount(){return"block"===this.overrideLookAt?0<this.weight?1:0:"blend"===this.overrideLookAt?this.weight:0}get overrideMouthAmount(){return"block"===this.overrideMouth?0<this.weight?1:0:"blend"===this.overrideMouth?this.weight:0}addBind(e){this._binds.push(e)}applyWeight(e){var t;let i=this.isBinary?
|
|
2
|
+
import*as e from"three";class t extends e.Object3D{constructor(e){super(),this.weight=0,this.isBinary=!1,this.overrideBlink="none",this.overrideLookAt="none",this.overrideMouth="none",this._binds=[],this.name=`VRMExpression_${e}`,this.expressionName=e,this.type="VRMExpression",this.visible=!1}get overrideBlinkAmount(){return"block"===this.overrideBlink?0<this.weight?1:0:"blend"===this.overrideBlink?this.weight:0}get overrideLookAtAmount(){return"block"===this.overrideLookAt?0<this.weight?1:0:"blend"===this.overrideLookAt?this.weight:0}get overrideMouthAmount(){return"block"===this.overrideMouth?0<this.weight?1:0:"blend"===this.overrideMouth?this.weight:0}addBind(e){this._binds.push(e)}applyWeight(e){var t;let i=this.isBinary?this.weight<=.5?0:1:this.weight;i*=null!==(t=null==e?void 0:e.multiplier)&&void 0!==t?t:1,this._binds.forEach((e=>e.applyWeight(i)))}clearAppliedWeight(){this._binds.forEach((e=>e.clearAppliedWeight()))}}
|
|
3
3
|
/*! *****************************************************************************
|
|
4
4
|
Copyright (c) Microsoft Corporation.
|
|
5
5
|
|
|
@@ -13,4 +13,4 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
|
13
13
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
14
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
15
|
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */function i(e,t,i,r){return new(i||(i=Promise))((function(n,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function r(e,t,i){var r,n;const o=e.parser.json,s=null===(r=o.nodes)||void 0===r?void 0:r[t];if(null==s)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const a=s.mesh;if(null==a)return null;const l=null===(n=o.meshes)||void 0===n?void 0:n[a];if(null==l)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const h=l.primitives.length,u=[];return i.traverse((e=>{u.length<h&&e.isMesh&&u.push(e)})),u}function n(e,t){return i(this,void 0,void 0,(function*(){const i=yield e.parser.getDependency("node",t);return r(e,t,i)}))}function o(e){return i(this,void 0,void 0,(function*(){const t=yield e.parser.getDependencies("node"),i=new Map;return t.forEach(((t,n)=>{const o=r(e,n,t);null!=o&&i.set(n,o)})),i}))}function s(t,i){var r,n;let o=null;if(parseInt(e.REVISION,10)>=133)o=null!==(n=null===(r=t.associations.get(i))||void 0===r?void 0:r.materials)&&void 0!==n?n:null;else{const e=t.associations.get(i);"materials"===(null==e?void 0:e.type)&&(o=e.index)}return o}const a={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function l(e){return Math.max(Math.min(e,1),0)}class h{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)&&(e[i]=r)})),e}get customExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)||(e[i]=r)})),e}copy(e){return this._expressions.concat().forEach((e=>{this.unregisterExpression(e)})),e._expressions.forEach((e=>{this.registerExpression(e)})),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return(new h).copy(this)}getExpression(e){var t;return null!==(t=this._expressionMap[e])&&void 0!==t?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);-1===t&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const i=this.getExpression(e);return null!==(t=null==i?void 0:i.weight)&&void 0!==t?t:null}setValue(e,t){const i=this.getExpression(e);i&&(i.weight=l(t))}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach((e=>{e.clearAppliedWeight()})),this._expressions.forEach((t=>{let i=1;const r=t.expressionName;-1!==this.blinkExpressionNames.indexOf(r)&&(i*=e.blink),-1!==this.lookAtExpressionNames.indexOf(r)&&(i*=e.lookAt),-1!==this.mouthExpressionNames.indexOf(r)&&(i*=e.mouth),t.applyWeight({multiplier:i})}))}_calculateWeightMultipliers(){let e=1,t=1,i=1;return this._expressions.forEach((r=>{e-=r.overrideBlinkAmount,t-=r.overrideLookAtAmount,i-=r.overrideMouthAmount})),e=Math.max(0,e),t=Math.max(0,t),i=Math.max(0,i),{blink:e,lookAt:t,mouth:i}}}const u=new e.Color;class d{constructor({material:e,type:t,targetValue:i}){var r,n,o;this.material=e,this.type=t,this.targetValue=i;const s=null===(r=Object.entries(d._propertyNameMapMap).find((([t])=>!0===e[t])))||void 0===r?void 0:r[1],a=null!==(n=null==s?void 0:s[t])&&void 0!==n?n:null;if(null==a)console.warn(`Tried to add a material color bind to the material ${null!==(o=e.name)&&void 0!==o?o:"(no name)"}, the type ${t} but the material or the type is not supported.`),this._state=null;else{const t=e[a].clone(),i=this.targetValue.clone().sub(t);this._state={propertyName:a,initialValue:t,deltaValue:i}}}applyWeight(e){if(null==this._state)return;const{propertyName:t,deltaValue:i}=this._state,r=this.material[t];void 0!==r&&(r.add(u.copy(i).multiplyScalar(e)),"boolean"==typeof this.material.shouldApplyUniforms&&(this.material.shouldApplyUniforms=!0))}clearAppliedWeight(){if(null==this._state)return;const{propertyName:e,initialValue:t}=this._state,i=this.material[e];void 0!==i&&(i.copy(t),"boolean"==typeof this.material.shouldApplyUniforms&&(this.material.shouldApplyUniforms=!0))}}d._propertyNameMapMap={isMeshStandardMaterial:{color:"color",emissionColor:"emissive"},isMeshBasicMaterial:{color:"color"},isMToonMaterial:{color:"color",emissionColor:"emissive",outlineColor:"outlineFactor",rimColor:"rimFactor",shadeColor:"shadeFactor"}};class c{constructor({primitives:e,index:t,weight:i}){this.primitives=e,this.index=t,this.weight=i}applyWeight(e){this.primitives.forEach((t=>{var i;null!=(null===(i=t.morphTargetInfluences)||void 0===i?void 0:i[this.index])&&(t.morphTargetInfluences[this.index]+=this.weight*e)}))}clearAppliedWeight(){this.primitives.forEach((e=>{var t;null!=(null===(t=e.morphTargetInfluences)||void 0===t?void 0:t[this.index])&&(e.morphTargetInfluences[this.index]=0)}))}}const p=new e.Vector2;class m{constructor({material:e,scale:t,offset:i}){var r,n;this.material=e,this.scale=t,this.offset=i;const o=null===(r=Object.entries(m._propertyNamesMap).find((([t])=>!0===e[t])))||void 0===r?void 0:r[1];null==o?(console.warn(`Tried to add a texture transform bind to the material ${null!==(n=e.name)&&void 0!==n?n:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],o.forEach((r=>{var n;const o=null===(n=e[r])||void 0===n?void 0:n.clone();if(!o)return null;e[r]=o;const s=o.offset.clone(),a=o.repeat.clone(),l=i.clone().sub(s),h=t.clone().sub(a);this._properties.push({name:r,initialOffset:s,deltaOffset:l,initialScale:a,deltaScale:h})})))}applyWeight(e){this._properties.forEach((t=>{const i=this.material[t.name];void 0!==i&&(i.offset.add(p.copy(t.deltaOffset).multiplyScalar(e)),i.repeat.add(p.copy(t.deltaScale).multiplyScalar(e)),i.needsUpdate=!0)}))}clearAppliedWeight(){this._properties.forEach((e=>{const t=this.material[e.name];void 0!==t&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale),t.needsUpdate=!0)}))}}m._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};class f{constructor(e){this.parser=e}get name(){return"VRMExpressionLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmExpressionManager=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(r){var o,l;return i(this,void 0,void 0,(function*(){const u=this.parser.json;if(!(-1!==(null===(o=u.extensionsUsed)||void 0===o?void 0:o.indexOf("VRMC_vrm"))))return null;const p=null===(l=u.extensions)||void 0===l?void 0:l.VRMC_vrm;if(!p)return null;if("1.0-beta"!==p.specVersion)return null;const f=p.expressions;if(!f)return null;const g=new Set(Object.values(a)),v=new Map;null!=f.preset&&Object.entries(f.preset).forEach((([e,t])=>{null!=t&&(g.has(e)?v.set(e,t):console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${e}" detected. Ignoring the expression`))})),null!=f.custom&&Object.entries(f.custom).forEach((([e,t])=>{g.has(e)?console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${e}". Ignoring the expression`):v.set(e,t)}));const y=new h;return yield Promise.all(Array.from(v.entries()).map((([o,a])=>i(this,void 0,void 0,(function*(){var l,h,u,p,f,g,v;const x=new t(o);if(r.scene.add(x),x.isBinary=null!==(l=a.isBinary)&&void 0!==l&&l,x.overrideBlink=null!==(h=a.overrideBlink)&&void 0!==h?h:"none",x.overrideLookAt=null!==(u=a.overrideLookAt)&&void 0!==u?u:"none",x.overrideMouth=null!==(p=a.overrideMouth)&&void 0!==p?p:"none",null===(f=a.morphTargetBinds)||void 0===f||f.forEach((e=>i(this,void 0,void 0,(function*(){var t;if(void 0===e.node||void 0===e.index)return;const i=yield n(r,e.node),o=e.index;i.every((e=>Array.isArray(e.morphTargetInfluences)&&o<e.morphTargetInfluences.length))?x.addBind(new c({primitives:i,index:o,weight:null!==(t=e.weight)&&void 0!==t?t:1})):console.warn(`VRMExpressionLoaderPlugin: ${a.name} attempts to index morph #${o} but not found.`)})))),a.materialColorBinds||a.textureTransformBinds){const t=[];r.scene.traverse((e=>{const i=e.material;i&&t.push(i)})),null===(g=a.materialColorBinds)||void 0===g||g.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{x.addBind(new d({material:t,type:r.type,targetValue:(new e.Color).fromArray(r.targetValue)}))}))})))),null===(v=a.textureTransformBinds)||void 0===v||v.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{var i,n;x.addBind(new m({material:t,offset:(new e.Vector2).fromArray(null!==(i=r.offset)&&void 0!==i?i:[0,0]),scale:(new e.Vector2).fromArray(null!==(n=r.scale)&&void 0!==n?n:[1,1])}))}))}))))}y.registerExpression(x)}))))),y}))}_v0Import(e){var r;return i(this,void 0,void 0,(function*(){const o=this.parser.json,s=null===(r=o.extensions)||void 0===r?void 0:r.VRM;if(!s)return null;const a=s.blendShapeMaster;if(!a)return null;const l=new h,u=a.blendShapeGroups;if(!u)return l;const d=new Set;return yield Promise.all(u.map((r=>i(this,void 0,void 0,(function*(){var s;const a=r.presetName,h=null!=a&&f.v0v1PresetNameMap[a]||null,u=null!=h?h:r.name;if(null==u)return void console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");if(d.has(u))return void console.warn(`VRMExpressionLoaderPlugin: An expression preset ${a} has duplicated entries. Ignoring the expression`);d.add(u);const p=new t(u);e.scene.add(p),p.isBinary=null!==(s=r.isBinary)&&void 0!==s&&s,r.binds&&r.binds.forEach((t=>i(this,void 0,void 0,(function*(){var s;if(void 0===t.mesh||void 0===t.index)return;const a=[];null===(s=o.nodes)||void 0===s||s.forEach(((e,i)=>{e.mesh===t.mesh&&a.push(i)}));const l=t.index;yield Promise.all(a.map((o=>i(this,void 0,void 0,(function*(){var i;const s=yield n(e,o);s.every((e=>Array.isArray(e.morphTargetInfluences)&&l<e.morphTargetInfluences.length))?p.addBind(new c({primitives:s,index:l,weight:.01*(null!==(i=t.weight)&&void 0!==i?i:100)})):console.warn(`VRMExpressionLoaderPlugin: ${r.name} attempts to index ${l}th morph but not found.`)})))))}))));const m=r.materialValues;m&&0!==m.length&&console.warn("Material binds of VRM 0.0 are not supported. Setup the model in VRM 1.0 and try again"),l.registerExpression(p)}))))),l}))}}f.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};const g={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",RimColor:"rimColor",OutlineColor:"outlineColor"},v={None:"none",Block:"block",Blend:"blend"};class y{constructor(e,t){this._firstPersonOnlyLayer=y.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=y.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map((e=>({meshes:e.meshes.concat(),type:e.type}))),this}clone(){return new y(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=y.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=y.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach((e=>{e.meshes.forEach((t=>{"firstPersonOnly"===e.type?(t.layers.set(this._firstPersonOnlyLayer),t.traverse((e=>e.layers.set(this._firstPersonOnlyLayer)))):"thirdPersonOnly"===e.type?(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)))):"auto"===e.type&&this._createHeadlessModel(t)}))})),this._initializedLayers=!0)}_excludeTriangles(e,t,i,r){let n=0;if(null!=t&&t.length>0)for(let o=0;o<e.length;o+=3){const s=e[o],a=e[o+1],l=e[o+2],h=t[s],u=i[s];if(h[0]>0&&r.includes(u[0]))continue;if(h[1]>0&&r.includes(u[1]))continue;if(h[2]>0&&r.includes(u[2]))continue;if(h[3]>0&&r.includes(u[3]))continue;const d=t[a],c=i[a];if(d[0]>0&&r.includes(c[0]))continue;if(d[1]>0&&r.includes(c[1]))continue;if(d[2]>0&&r.includes(c[2]))continue;if(d[3]>0&&r.includes(c[3]))continue;const p=t[l],m=i[l];p[0]>0&&r.includes(m[0])||(p[1]>0&&r.includes(m[1])||p[2]>0&&r.includes(m[2])||p[3]>0&&r.includes(m[3])||(e[n++]=s,e[n++]=a,e[n++]=l))}return n}_createErasedMesh(t,i){const r=new e.SkinnedMesh(t.geometry.clone(),t.material);r.name=`${t.name}(erase)`,r.frustumCulled=t.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const n=r.geometry,o=n.getAttribute("skinIndex").array,s=[];for(let e=0;e<o.length;e+=4)s.push([o[e],o[e+1],o[e+2],o[e+3]]);const a=n.getAttribute("skinWeight").array,l=[];for(let e=0;e<a.length;e+=4)l.push([a[e],a[e+1],a[e+2],a[e+3]]);const h=n.getIndex();if(!h)throw new Error("The geometry doesn't have an index buffer");const u=Array.from(h.array),d=this._excludeTriangles(u,l,s,i),c=[];for(let e=0;e<d;e++)c[e]=u[e];return n.setIndex(c),t.onBeforeRender&&(r.onBeforeRender=t.onBeforeRender),r.bind(new e.Skeleton(t.skeleton.bones,t.skeleton.boneInverses),new e.Matrix4),r}_createHeadlessModelForSkinnedMesh(e,t){const i=[];if(t.skeleton.bones.forEach(((e,t)=>{this._isEraseTarget(e)&&i.push(t)})),!i.length)return t.layers.enable(this._thirdPersonOnlyLayer),void t.layers.enable(this._firstPersonOnlyLayer);t.layers.set(this._thirdPersonOnlyLayer);const r=this._createErasedMesh(t,i);e.add(r)}_createHeadlessModel(t){if("Group"===t.type)if(t.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(t))t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)));else{const i=new e.Group;i.name=`_headless_${t.name}`,i.layers.set(this._firstPersonOnlyLayer),t.parent.add(i),t.children.filter((e=>"SkinnedMesh"===e.type)).forEach((e=>{const t=e;this._createHeadlessModelForSkinnedMesh(i,t)}))}else if("SkinnedMesh"===t.type){const e=t;this._createHeadlessModelForSkinnedMesh(t.parent,e)}else this._isEraseTarget(t)&&(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer))))}_isEraseTarget(e){return e===this.humanoid.getBoneNode("head")||!!e.parent&&this._isEraseTarget(e.parent)}}y.DEFAULT_FIRSTPERSON_ONLY_LAYER=9,y.DEFAULT_THIRDPERSON_ONLY_LAYER=10;class x{constructor(e){this.parser=e}get name(){return"VRMFirstPersonLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null!==t){if(void 0===t)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}}))}_import(e,t){return i(this,void 0,void 0,(function*(){if(null==t)return null;const i=yield this._v1Import(e,t);if(i)return i;const r=yield this._v0Import(e,t);return r||null}))}_v1Import(e,t){var r,n;return i(this,void 0,void 0,(function*(){const i=this.parser.json;if(!(-1!==(null===(r=i.extensionsUsed)||void 0===r?void 0:r.indexOf("VRMC_vrm"))))return null;const s=null===(n=i.extensions)||void 0===n?void 0:n.VRMC_vrm;if(!s)return null;if("1.0-beta"!==s.specVersion)return null;const a=s.firstPerson;if(!a)return null;const l=[],h=yield o(e);return Array.from(h.entries()).forEach((([e,t])=>{var i;const r=a.meshAnnotations?a.meshAnnotations.find((t=>t.node===e)):void 0;l.push({meshes:t,type:null!==(i=null==r?void 0:r.type)&&void 0!==i?i:"both"})})),new y(t,l)}))}_v0Import(e,t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,n=null===(r=i.extensions)||void 0===r?void 0:r.VRM;if(!n)return null;const s=n.firstPerson;if(!s)return null;const a=[],l=yield o(e);return Array.from(l.entries()).forEach((([e,t])=>{const r=i.nodes[e],n=s.meshAnnotations?s.meshAnnotations.find((e=>e.mesh===r.mesh)):void 0;a.push({meshes:t,type:this._convertV0FlagToV1Type(null==n?void 0:n.firstPersonFlag)})})),new y(t,a)}))}_convertV0FlagToV1Type(e){return"FirstPersonOnly"===e?"firstPersonOnly":"ThirdPersonOnly"===e?"thirdPersonOnly":"Auto"===e?"auto":"both"}}const _={Auto:"auto",Both:"both",ThirdPersonOnly:"thirdPersonOnly",FirstPersonOnly:"firstPersonOnly"},M={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbProximal:"leftThumbProximal",LeftThumbIntermediate:"leftThumbIntermediate",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbProximal:"rightThumbProximal",RightThumbIntermediate:"rightThumbIntermediate",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"};function w(e){return e.invert?e.invert():e.inverse(),e}const L=new e.Vector3,P=new e.Quaternion;class R{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}copy(e){return this.humanBones=e.humanBones,this.restPose=e.restPose,this}clone(){return new R(this.humanBones).copy(this)}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);r&&(L.copy(r.position),P.copy(r.quaternion),e[i]={position:L.toArray(),rotation:P.toArray()})})),e}getPose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);if(!r)return;L.set(0,0,0),P.identity();const n=this.restPose[i];(null==n?void 0:n.position)&&L.fromArray(n.position).negate(),(null==n?void 0:n.rotation)&&w(P.fromArray(n.rotation)),L.add(r.position),P.premultiply(r.quaternion),e[i]={position:L.toArray(),rotation:P.toArray()}})),e}setPose(e){Object.entries(e).forEach((([e,t])=>{const i=e,r=this.getBoneNode(i);if(!r)return;const n=this.restPose[i];n&&((null==t?void 0:t.position)&&(r.position.fromArray(t.position),n.position&&r.position.add(L.fromArray(n.position))),(null==t?void 0:t.rotation)&&(r.quaternion.fromArray(t.rotation),n.rotation&&r.quaternion.multiply(P.fromArray(n.rotation))))}))}resetPose(){Object.entries(this.restPose).forEach((([e,t])=>{const i=this.getBoneNode(e);i&&((null==t?void 0:t.position)&&i.position.fromArray(t.position),(null==t?void 0:t.rotation)&&i.quaternion.fromArray(t.rotation))}))}getBone(e){var t;return null!==(t=this.humanBones[e])&&void 0!==t?t:void 0}getBoneNode(e){var t,i;return null!==(i=null===(t=this.humanBones[e])||void 0===t?void 0:t.node)&&void 0!==i?i:null}}const A={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"};class b{constructor(e){this.parser=e}get name(){return"VRMHumanoidLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmHumanoid=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(e){var t,r;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(t=e.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const n=null===(r=e.extensions)||void 0===r?void 0:r.VRMC_vrm;if(!n)return null;if("1.0-beta"!==n.specVersion)return null;const o=n.humanoid;if(!o)return null;const s={};return null!=o.humanBones&&(yield Promise.all(Object.entries(o.humanBones).map((([e,t])=>i(this,void 0,void 0,(function*(){const i=e,r=t.node,n=yield this.parser.getDependency("node",r);null!=n?s[i]={node:n}:console.warn(`A glTF node bound to the humanoid bone ${i} (index = ${r}) does not exist`)})))))),new R(this._ensureRequiredBonesExist(s))}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const e=this.parser.json,r=null===(t=e.extensions)||void 0===t?void 0:t.VRM;if(!r)return null;const n=r.humanoid;if(!n)return null;const o={};return null!=n.humanBones&&(yield Promise.all(n.humanBones.map((e=>i(this,void 0,void 0,(function*(){const t=e.bone,i=e.node;if(null==t||null==i)return;const r=yield this.parser.getDependency("node",i);null!=r?null==o[t]?o[t]={node:r}:console.warn(`Multiple bone entries for ${t} detected (index = ${i}), ignoring duplicated entries.`):console.warn(`A glTF node bound to the humanoid bone ${t} (index = ${i}) does not exist`)})))))),new R(this._ensureRequiredBonesExist(o))}))}_ensureRequiredBonesExist(e){const t=Object.values(A).filter((t=>null==e[t]));if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}}class I extends e.BufferGeometry{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new e.BufferAttribute(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(3*e,0,e+1,e+2);this._attrIndex.needsUpdate=!0}}class E extends e.BufferGeometry{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new e.Vector3,this._currentTail=new e.Vector3,this._attrPos=new e.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const k=new e.Quaternion,V=new e.Quaternion,T=new e.Vector3,O=new e.Vector3,U=Math.sqrt(2)/2,B=new e.Quaternion(0,0,-U,U),D=new e.Vector3(0,1,0);class N extends e.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const t=new I;t.radius=.5;const i=new e.MeshBasicMaterial({color:65280,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshPitch=new e.Mesh(t,i),this.add(this._meshPitch)}{const t=new I;t.radius=.5;const i=new e.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshYaw=new e.Mesh(t,i),this.add(this._meshYaw)}{const t=new E;t.radius=.1;const i=new e.LineBasicMaterial({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new e.LineSegments(t,i),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(e){this.vrmLookAt.getLookAtWorldPosition(T),this.vrmLookAt.getLookAtWorldQuaternion(k);const t=this.vrmLookAt.euler.y,i=this.vrmLookAt.euler.x;this._meshYaw.geometry.theta=t,this._meshYaw.geometry.update(),this._meshYaw.position.copy(T),this._meshYaw.quaternion.copy(k),this._meshPitch.geometry.theta=i,this._meshPitch.geometry.update(),this._meshPitch.position.copy(T),this._meshPitch.quaternion.copy(k),this._meshPitch.quaternion.multiply(V.setFromAxisAngle(D,t)),this._meshPitch.quaternion.multiply(B);const r=this.vrmLookAt.target;null!=r&&(r.getWorldPosition(O).sub(T),this._lineTarget.geometry.tail.copy(O),this._lineTarget.geometry.update(),this._lineTarget.position.copy(T)),super.updateMatrixWorld(e)}}const F=new e.Vector3,H=new e.Vector3;const S=new e.Vector3,C=new e.Vector3,Y=new e.Vector3,j=new e.Quaternion,W=new e.Quaternion;class ${constructor(t,i){this.offsetFromHeadBone=new e.Vector3,this.autoUpdate=!0,this.faceFront=new e.Vector3(0,0,1),this._euler=new e.Euler(0,0,0,$.EULER_ORDER),this.humanoid=t,this.applier=i}get euler(){return this._euler.clone()}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new $(this.humanoid,this.applier).copy(this)}reset(){this._euler.set(0,0,0),this.applier.lookAt(this._euler)}getLookAtWorldPosition(e){const t=this.humanoid.getBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){const t=this.humanoid.getBoneNode("head");return i=e,t.matrixWorld.decompose(F,i,H),i;var i}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(j),e.copy(this.faceFront).applyEuler(this._euler).applyQuaternion(j)}lookAt(e){this._calcEuler(this._euler,e),this.applier.lookAt(this._euler)}update(e){this.target&&this.autoUpdate&&(this.lookAt(this.target.getWorldPosition(S)),this.applier.lookAt(this._euler))}_calcEuler(e,t){const i=w(this.getLookAtWorldQuaternion(j)),r=this.getLookAtWorldPosition(C),n=Y.copy(t).sub(r).applyQuaternion(i).normalize(),o=W.setFromUnitVectors(this.faceFront,n);return Y.set(0,0,1).applyQuaternion(o),e.x=Math.atan2(-Y.y,Math.sqrt(Y.x*Y.x+Y.z*Y.z)),e.y=Math.atan2(Y.x,Y.z),e}}$.EULER_ORDER="YXZ";const z=new e.Euler(0,0,0,"YXZ");class q{constructor(e,t,i,r,n){this.humanoid=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=i,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=n}lookAt(e){const t=180*e.x/Math.PI,i=180*e.y/Math.PI,r=this.humanoid.getBoneNode("leftEye"),n=this.humanoid.getBoneNode("rightEye");r&&(z.x=t<0?-this.rangeMapVerticalDown.map(-t)/180*Math.PI:this.rangeMapVerticalUp.map(t)/180*Math.PI,z.y=i<0?-this.rangeMapHorizontalInner.map(-i)/180*Math.PI:this.rangeMapHorizontalOuter.map(i)/180*Math.PI,r.quaternion.setFromEuler(z)),n&&(z.x=t<0?-this.rangeMapVerticalDown.map(-t)/180*Math.PI:this.rangeMapVerticalUp.map(t)/180*Math.PI,z.y=i<0?-this.rangeMapHorizontalOuter.map(-i)/180*Math.PI:this.rangeMapHorizontalInner.map(i)/180*Math.PI,n.quaternion.setFromEuler(z))}}q.type="bone";class X{constructor(e,t,i,r,n){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=i,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=n}lookAt(e){const t=180*e.x/Math.PI,i=180*e.y/Math.PI;t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),i<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-i))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(i)))}}X.type="expression";class Q{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*l(e/this.inputMaxValue)}}class Z{constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot}get name(){return"VRMLookAtLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null===t)return;if(void 0===t)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const i=e.userData.vrmExpressionManager;if(null!==i){if(void 0===i)throw new Error("VRMFirstPersonLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,i)}}))}_import(e,t,r){return i(this,void 0,void 0,(function*(){if(null==t||null==r)return null;const i=yield this._v1Import(e,t,r);if(i)return i;const n=yield this._v0Import(e,t,r);return n||null}))}_v1Import(e,t,r){var n,o,s;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(n=e.extensionsUsed)||void 0===n?void 0:n.indexOf("VRMC_vrm"))))return null;const i=null===(o=e.extensions)||void 0===o?void 0:o.VRMC_vrm;if(!i)return null;if("1.0-beta"!==i.specVersion)return null;const a=i.lookAt;if(!a)return null;const l="expression"===a.type?1:10,h=this._v1ImportRangeMap(a.rangeMapHorizontalInner,l),u=this._v1ImportRangeMap(a.rangeMapHorizontalOuter,l),d=this._v1ImportRangeMap(a.rangeMapVerticalDown,l),c=this._v1ImportRangeMap(a.rangeMapVerticalUp,l);let p;p="expression"===a.type?new X(r,h,u,d,c):new q(t,h,u,d,c);const m=this._importLookAt(t,p);return m.offsetFromHeadBone.fromArray(null!==(s=a.offsetFromHeadBone)&&void 0!==s?s:[0,.06,0]),m}))}_v1ImportRangeMap(e,t){var i,r;return new Q(null!==(i=null==e?void 0:e.inputMaxValue)&&void 0!==i?i:90,null!==(r=null==e?void 0:e.outputScale)&&void 0!==r?r:t)}_v0Import(e,t,r){var n,o,s,a;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(n=e.extensions)||void 0===n?void 0:n.VRM;if(!i)return null;const l=i.firstPerson;if(!l)return null;const h="BlendShape"===l.lookAtTypeName?1:10,u=this._v0ImportDegreeMap(l.lookAtHorizontalInner,h),d=this._v0ImportDegreeMap(l.lookAtHorizontalOuter,h),c=this._v0ImportDegreeMap(l.lookAtVerticalDown,h),p=this._v0ImportDegreeMap(l.lookAtVerticalUp,h);let m;m="BlendShape"===l.lookAtTypeName?new X(r,u,d,c,p):new q(t,u,d,c,p);const f=this._importLookAt(t,m);return l.firstPersonBoneOffset?f.offsetFromHeadBone.set(null!==(o=l.firstPersonBoneOffset.x)&&void 0!==o?o:0,null!==(s=l.firstPersonBoneOffset.y)&&void 0!==s?s:.06,-(null!==(a=l.firstPersonBoneOffset.z)&&void 0!==a?a:0)):f.offsetFromHeadBone.set(0,.06,0),f.faceFront.set(0,0,-1),f}))}_v0ImportDegreeMap(e,t){var i,r;const n=null==e?void 0:e.curve;return"[0,0,0,1,1,1,1,0]"!==JSON.stringify(n)&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported"),new Q(null!==(i=null==e?void 0:e.xRange)&&void 0!==i?i:90,null!==(r=null==e?void 0:e.yRange)&&void 0!==r?r:t)}_importLookAt(e,t){const i=new $(e,t);if(this.helperRoot){const e=new N(i);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return i}}const G={Bone:"bone",Expression:"expression"};class J{constructor(e,t){var i,r,n;this.parser=e,this.needThumbnailImage=null===(i=null==t?void 0:t.needThumbnailImage)||void 0===i||i,this.acceptLicenseUrls=null!==(r=null==t?void 0:t.acceptLicenseUrls)&&void 0!==r?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=null===(n=null==t?void 0:t.acceptV0Meta)||void 0===n||n}get name(){return"VRMMetaLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmMeta=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(null!=t)return t;const i=yield this._v0Import(e);return null!=i?i:null}))}_v1Import(e){var t,r,n;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(t=e.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const i=null===(r=e.extensions)||void 0===r?void 0:r.VRMC_vrm;if(null==i)return null;if("1.0-beta"!==i.specVersion)return null;const o=i.meta;if(!o)return null;const s=o.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(s))throw new Error(`VRMMetaLoaderPlugin: The license url "${s}" is not accepted`);let a;return this.needThumbnailImage&&null!=o.thumbnailImage&&(a=null!==(n=yield this._extractGLTFImage(o.thumbnailImage))&&void 0!==n?n:void 0),{metaVersion:"1",name:o.name,version:o.version,authors:o.authors,copyrightInformation:o.copyrightInformation,contactInformation:o.contactInformation,references:o.references,thirdPartyLicenses:o.thirdPartyLicenses,thumbnailImage:a,licenseUrl:o.licenseUrl,avatarPermission:o.avatarPermission,allowExcessivelyViolentUsage:o.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:o.allowExcessivelySexualUsage,commercialUsage:o.commercialUsage,allowPoliticalOrReligiousUsage:o.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:o.allowAntisocialOrHateUsage,creditNotation:o.creditNotation,allowRedistribution:o.allowRedistribution,modification:o.modification,otherLicenseUrl:o.otherLicenseUrl}}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(t=e.extensions)||void 0===t?void 0:t.VRM;if(!i)return null;const r=i.meta;if(!r)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.X meta but acceptV0Meta is false");let n;return this.needThumbnailImage&&null!=r.texture&&-1!==r.texture&&(n=yield this.parser.getDependency("texture",r.texture)),{metaVersion:"0",allowedUserName:r.allowedUserName,author:r.author,commercialUssageName:r.commercialUssageName,contactInformation:r.contactInformation,licenseName:r.licenseName,otherLicenseUrl:r.otherLicenseUrl,otherPermissionUrl:r.otherPermissionUrl,reference:r.reference,sexualUssageName:r.sexualUssageName,texture:null!=n?n:void 0,title:r.title,version:r.version,violentUssageName:r.violentUssageName}}))}_extractGLTFImage(t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,n=null===(r=i.images)||void 0===r?void 0:r[t];if(null==n)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image doesn't exist`),null;let o=n.uri;if(null!=n.bufferView){const e=yield this.parser.getDependency("bufferView",n.bufferView),t=new Blob([e],{type:n.mimeType});o=URL.createObjectURL(t)}if(null==o)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image couldn't load properly`),null;const s=new e.ImageLoader;return yield s.loadAsync((a=o,l=this.parser.options.path,"string"!=typeof a||""===a?"":(/^https?:\/\//i.test(l)&&/^\//.test(a)&&(l=l.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)?a:l+a))).catch((e=>(console.error(e),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null)));var a,l}))}}class K{constructor(e){this.scene=e.scene,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt,this.meta=e.meta}update(e){this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}}class ee{constructor(e,t){var i,r,n,o,s;this.parser=e;const a=null==t?void 0:t.helperRoot;this.expressionPlugin=null!==(i=null==t?void 0:t.expressionPlugin)&&void 0!==i?i:new f(e),this.firstPersonPlugin=null!==(r=null==t?void 0:t.firstPersonPlugin)&&void 0!==r?r:new x(e),this.humanoidPlugin=null!==(n=null==t?void 0:t.humanoidPlugin)&&void 0!==n?n:new b(e),this.lookAtPlugin=null!==(o=null==t?void 0:t.lookAtPlugin)&&void 0!==o?o:new Z(e,{helperRoot:a}),this.metaPlugin=null!==(s=null==t?void 0:t.metaPlugin)&&void 0!==s?s:new J(e)}get name(){return"VRMC_vrm"}afterRoot(e){return i(this,void 0,void 0,(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);const t=new K({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:e.userData.vrmHumanoid,lookAt:e.userData.vrmLookAt,meta:e.userData.vrmMeta});e.userData.vrmCore=t}))}}export{K as VRMCore,ee as VRMCoreLoaderPlugin,t as VRMExpression,f as VRMExpressionLoaderPlugin,h as VRMExpressionManager,g as VRMExpressionMaterialColorType,v as VRMExpressionOverrideType,a as VRMExpressionPresetName,y as VRMFirstPerson,x as VRMFirstPersonLoaderPlugin,_ as VRMFirstPersonMeshAnnotationType,M as VRMHumanBoneName,R as VRMHumanoid,b as VRMHumanoidLoaderPlugin,$ as VRMLookAt,q as VRMLookAtBoneApplier,X as VRMLookAtExpressionApplier,N as VRMLookAtHelper,Z as VRMLookAtLoaderPlugin,Q as VRMLookAtRangeMap,G as VRMLookAtTypeName,J as VRMMetaLoaderPlugin,A as VRMRequiredHumanBoneName};
|
|
16
|
+
***************************************************************************** */function i(e,t,i,r){return new(i||(i=Promise))((function(o,n){function s(e){try{l(r.next(e))}catch(e){n(e)}}function a(e){try{l(r.throw(e))}catch(e){n(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}l((r=r.apply(e,t||[])).next())}))}function r(e,t,i){var r,o;const n=e.parser.json,s=null===(r=n.nodes)||void 0===r?void 0:r[t];if(null==s)return console.warn(`extractPrimitivesInternal: Attempt to use nodes[${t}] of glTF but the node doesn't exist`),null;const a=s.mesh;if(null==a)return null;const l=null===(o=n.meshes)||void 0===o?void 0:o[a];if(null==l)return console.warn(`extractPrimitivesInternal: Attempt to use meshes[${a}] of glTF but the mesh doesn't exist`),null;const h=l.primitives.length,u=[];return i.traverse((e=>{u.length<h&&e.isMesh&&u.push(e)})),u}function o(e,t){return i(this,void 0,void 0,(function*(){const i=yield e.parser.getDependency("node",t);return r(e,t,i)}))}function n(e){return i(this,void 0,void 0,(function*(){const t=yield e.parser.getDependencies("node"),i=new Map;return t.forEach(((t,o)=>{const n=r(e,o,t);null!=n&&i.set(o,n)})),i}))}function s(t,i){var r,o;let n=null;if(parseInt(e.REVISION,10)>=133)n=null!==(o=null===(r=t.associations.get(i))||void 0===r?void 0:r.materials)&&void 0!==o?o:null;else{const e=t.associations.get(i);"materials"===(null==e?void 0:e.type)&&(n=e.index)}return n}const a={Aa:"aa",Ih:"ih",Ou:"ou",Ee:"ee",Oh:"oh",Blink:"blink",Happy:"happy",Angry:"angry",Sad:"sad",Relaxed:"relaxed",LookUp:"lookUp",Surprised:"surprised",LookDown:"lookDown",LookLeft:"lookLeft",LookRight:"lookRight",BlinkLeft:"blinkLeft",BlinkRight:"blinkRight",Neutral:"neutral"};function l(e){return Math.max(Math.min(e,1),0)}class h{constructor(){this.blinkExpressionNames=["blink","blinkLeft","blinkRight"],this.lookAtExpressionNames=["lookLeft","lookRight","lookUp","lookDown"],this.mouthExpressionNames=["aa","ee","ih","oh","ou"],this._expressions=[],this._expressionMap={}}get expressions(){return this._expressions.concat()}get expressionMap(){return Object.assign({},this._expressionMap)}get presetExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)&&(e[i]=r)})),e}get customExpressionMap(){const e={},t=new Set(Object.values(a));return Object.entries(this._expressionMap).forEach((([i,r])=>{t.has(i)||(e[i]=r)})),e}copy(e){return this._expressions.concat().forEach((e=>{this.unregisterExpression(e)})),e._expressions.forEach((e=>{this.registerExpression(e)})),this.blinkExpressionNames=e.blinkExpressionNames.concat(),this.lookAtExpressionNames=e.lookAtExpressionNames.concat(),this.mouthExpressionNames=e.mouthExpressionNames.concat(),this}clone(){return(new h).copy(this)}getExpression(e){var t;return null!==(t=this._expressionMap[e])&&void 0!==t?t:null}registerExpression(e){this._expressions.push(e),this._expressionMap[e.expressionName]=e}unregisterExpression(e){const t=this._expressions.indexOf(e);-1===t&&console.warn("VRMExpressionManager: The specified expressions is not registered"),this._expressions.splice(t,1),delete this._expressionMap[e.expressionName]}getValue(e){var t;const i=this.getExpression(e);return null!==(t=null==i?void 0:i.weight)&&void 0!==t?t:null}setValue(e,t){const i=this.getExpression(e);i&&(i.weight=l(t))}getExpressionTrackName(e){const t=this.getExpression(e);return t?`${t.name}.weight`:null}update(){const e=this._calculateWeightMultipliers();this._expressions.forEach((e=>{e.clearAppliedWeight()})),this._expressions.forEach((t=>{let i=1;const r=t.expressionName;-1!==this.blinkExpressionNames.indexOf(r)&&(i*=e.blink),-1!==this.lookAtExpressionNames.indexOf(r)&&(i*=e.lookAt),-1!==this.mouthExpressionNames.indexOf(r)&&(i*=e.mouth),t.applyWeight({multiplier:i})}))}_calculateWeightMultipliers(){let e=1,t=1,i=1;return this._expressions.forEach((r=>{e-=r.overrideBlinkAmount,t-=r.overrideLookAtAmount,i-=r.overrideMouthAmount})),e=Math.max(0,e),t=Math.max(0,t),i=Math.max(0,i),{blink:e,lookAt:t,mouth:i}}}const u={Color:"color",EmissionColor:"emissionColor",ShadeColor:"shadeColor",MatcapColor:"matcapColor",RimColor:"rimColor",OutlineColor:"outlineColor"},d={_Color:u.Color,_EmissionColor:u.EmissionColor,_ShadeColor:u.ShadeColor,_RimColor:u.RimColor,_OutlineColor:u.OutlineColor},p=new e.Color;class c{constructor({material:t,type:i,targetValue:r}){var o,n,s;this.material=t,this.type=i,this.targetValue=r;const a=null===(o=Object.entries(c._propertyNameMapMap).find((([e])=>!0===t[e])))||void 0===o?void 0:o[1],l=null!==(n=null==a?void 0:a[i])&&void 0!==n?n:null;if(null==l)console.warn(`Tried to add a material color bind to the material ${null!==(s=t.name)&&void 0!==s?s:"(no name)"}, the type ${i} but the material or the type is not supported.`),this._state=null;else{const i=t[l].clone(),o=new e.Color(r.r-i.r,r.g-i.g,r.b-i.b);this._state={propertyName:l,initialValue:i,deltaValue:o}}}applyWeight(e){if(null==this._state)return;const{propertyName:t,deltaValue:i}=this._state,r=this.material[t];void 0!==r&&(r.add(p.copy(i).multiplyScalar(e)),"boolean"==typeof this.material.shouldApplyUniforms&&(this.material.shouldApplyUniforms=!0))}clearAppliedWeight(){if(null==this._state)return;const{propertyName:e,initialValue:t}=this._state,i=this.material[e];void 0!==i&&(i.copy(t),"boolean"==typeof this.material.shouldApplyUniforms&&(this.material.shouldApplyUniforms=!0))}}c._propertyNameMapMap={isMeshStandardMaterial:{color:"color",emissionColor:"emissive"},isMeshBasicMaterial:{color:"color"},isMToonMaterial:{color:"color",emissionColor:"emissive",outlineColor:"outlineColorFactor",matcapColor:"matcapFactor",rimColor:"parametricRimColorFactor",shadeColor:"shadeColorFactor"}};class m{constructor({primitives:e,index:t,weight:i}){this.primitives=e,this.index=t,this.weight=i}applyWeight(e){this.primitives.forEach((t=>{var i;null!=(null===(i=t.morphTargetInfluences)||void 0===i?void 0:i[this.index])&&(t.morphTargetInfluences[this.index]+=this.weight*e)}))}clearAppliedWeight(){this.primitives.forEach((e=>{var t;null!=(null===(t=e.morphTargetInfluences)||void 0===t?void 0:t[this.index])&&(e.morphTargetInfluences[this.index]=0)}))}}const g=new e.Vector2;class f{constructor({material:e,scale:t,offset:i}){var r,o;this.material=e,this.scale=t,this.offset=i;const n=null===(r=Object.entries(f._propertyNamesMap).find((([t])=>!0===e[t])))||void 0===r?void 0:r[1];null==n?(console.warn(`Tried to add a texture transform bind to the material ${null!==(o=e.name)&&void 0!==o?o:"(no name)"} but the material is not supported.`),this._properties=[]):(this._properties=[],n.forEach((r=>{var o;const n=null===(o=e[r])||void 0===o?void 0:o.clone();if(!n)return null;e[r]=n;const s=n.offset.clone(),a=n.repeat.clone(),l=i.clone().sub(s),h=t.clone().sub(a);this._properties.push({name:r,initialOffset:s,deltaOffset:l,initialScale:a,deltaScale:h})})))}applyWeight(e){this._properties.forEach((t=>{const i=this.material[t.name];void 0!==i&&(i.offset.add(g.copy(t.deltaOffset).multiplyScalar(e)),i.repeat.add(g.copy(t.deltaScale).multiplyScalar(e)),i.needsUpdate=!0)}))}clearAppliedWeight(){this._properties.forEach((e=>{const t=this.material[e.name];void 0!==t&&(t.offset.copy(e.initialOffset),t.repeat.copy(e.initialScale),t.needsUpdate=!0)}))}}f._propertyNamesMap={isMeshStandardMaterial:["map","emissiveMap","bumpMap","normalMap","displacementMap","roughnessMap","metalnessMap","alphaMap"],isMeshBasicMaterial:["map","specularMap","alphaMap"],isMToonMaterial:["map","normalMap","emissiveMap","shadeMultiplyTexture","rimMultiplyTexture","outlineWidthMultiplyTexture","uvAnimationMaskTexture"]};const v=new Set(["1.0","1.0-beta"]);class y{constructor(e){this.parser=e}get name(){return"VRMExpressionLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmExpressionManager=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(r){var n,l;return i(this,void 0,void 0,(function*(){const u=this.parser.json;if(!(-1!==(null===(n=u.extensionsUsed)||void 0===n?void 0:n.indexOf("VRMC_vrm"))))return null;const d=null===(l=u.extensions)||void 0===l?void 0:l.VRMC_vrm;if(!d)return null;const p=d.specVersion;if(!v.has(p))return console.warn(`VRMExpressionLoaderPlugin: Unknown VRMC_vrm specVersion "${p}"`),null;const g=d.expressions;if(!g)return null;const y=new Set(Object.values(a)),w=new Map;null!=g.preset&&Object.entries(g.preset).forEach((([e,t])=>{null!=t&&(y.has(e)?w.set(e,t):console.warn(`VRMExpressionLoaderPlugin: Unknown preset name "${e}" detected. Ignoring the expression`))})),null!=g.custom&&Object.entries(g.custom).forEach((([e,t])=>{y.has(e)?console.warn(`VRMExpressionLoaderPlugin: Custom expression cannot have preset name "${e}". Ignoring the expression`):w.set(e,t)}));const x=new h;return yield Promise.all(Array.from(w.entries()).map((([n,a])=>i(this,void 0,void 0,(function*(){var l,h,u,d,p,g,v;const y=new t(n);if(r.scene.add(y),y.isBinary=null!==(l=a.isBinary)&&void 0!==l&&l,y.overrideBlink=null!==(h=a.overrideBlink)&&void 0!==h?h:"none",y.overrideLookAt=null!==(u=a.overrideLookAt)&&void 0!==u?u:"none",y.overrideMouth=null!==(d=a.overrideMouth)&&void 0!==d?d:"none",null===(p=a.morphTargetBinds)||void 0===p||p.forEach((e=>i(this,void 0,void 0,(function*(){var t;if(void 0===e.node||void 0===e.index)return;const i=yield o(r,e.node),n=e.index;i.every((e=>Array.isArray(e.morphTargetInfluences)&&n<e.morphTargetInfluences.length))?y.addBind(new m({primitives:i,index:n,weight:null!==(t=e.weight)&&void 0!==t?t:1})):console.warn(`VRMExpressionLoaderPlugin: ${a.name} attempts to index morph #${n} but not found.`)})))),a.materialColorBinds||a.textureTransformBinds){const t=[];r.scene.traverse((e=>{const i=e.material;i&&t.push(i)})),null===(g=a.materialColorBinds)||void 0===g||g.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{y.addBind(new c({material:t,type:r.type,targetValue:(new e.Color).fromArray(r.targetValue)}))}))})))),null===(v=a.textureTransformBinds)||void 0===v||v.forEach((r=>i(this,void 0,void 0,(function*(){t.filter((e=>{const t=s(this.parser,e);return r.material===t})).forEach((t=>{var i,o;y.addBind(new f({material:t,offset:(new e.Vector2).fromArray(null!==(i=r.offset)&&void 0!==i?i:[0,0]),scale:(new e.Vector2).fromArray(null!==(o=r.scale)&&void 0!==o?o:[1,1])}))}))}))))}x.registerExpression(y)}))))),x}))}_v0Import(r){var n;return i(this,void 0,void 0,(function*(){const s=this.parser.json,a=null===(n=s.extensions)||void 0===n?void 0:n.VRM;if(!a)return null;const l=a.blendShapeMaster;if(!l)return null;const u=new h,p=l.blendShapeGroups;if(!p)return u;const g=new Set;return yield Promise.all(p.map((n=>i(this,void 0,void 0,(function*(){var a;const l=n.presetName,h=null!=l&&y.v0v1PresetNameMap[l]||null,p=null!=h?h:n.name;if(null==p)return void console.warn("VRMExpressionLoaderPlugin: One of custom expressions has no name. Ignoring the expression");if(g.has(p))return void console.warn(`VRMExpressionLoaderPlugin: An expression preset ${l} has duplicated entries. Ignoring the expression`);g.add(p);const v=new t(p);r.scene.add(v),v.isBinary=null!==(a=n.isBinary)&&void 0!==a&&a,n.binds&&n.binds.forEach((e=>i(this,void 0,void 0,(function*(){var t;if(void 0===e.mesh||void 0===e.index)return;const a=[];null===(t=s.nodes)||void 0===t||t.forEach(((t,i)=>{t.mesh===e.mesh&&a.push(i)}));const l=e.index;yield Promise.all(a.map((t=>i(this,void 0,void 0,(function*(){var i;const s=yield o(r,t);s.every((e=>Array.isArray(e.morphTargetInfluences)&&l<e.morphTargetInfluences.length))?v.addBind(new m({primitives:s,index:l,weight:.01*(null!==(i=e.weight)&&void 0!==i?i:100)})):console.warn(`VRMExpressionLoaderPlugin: ${n.name} attempts to index ${l}th morph but not found.`)})))))}))));const w=n.materialValues;w&&0!==w.length&&w.forEach((t=>{if(void 0===t.materialName||void 0===t.propertyName||void 0===t.targetValue)return;const i=[];r.scene.traverse((e=>{if(e.material){const r=e.material;Array.isArray(r)?i.push(...r.filter((e=>(e.name===t.materialName||e.name===t.materialName+" (Outline)")&&-1===i.indexOf(e)))):r.name===t.materialName&&-1===i.indexOf(r)&&i.push(r)}}));const o=t.propertyName;i.forEach((i=>{if("_MainTex_ST"===o){const r=new e.Vector2(t.targetValue[0],t.targetValue[1]),o=new e.Vector2(t.targetValue[2],t.targetValue[3]);return void v.addBind(new f({material:i,scale:r,offset:o}))}const r=d[o];r?v.addBind(new c({material:i,type:r,targetValue:new e.Color(...t.targetValue.slice(0,3))})):console.warn(o+" is not supported")}))})),u.registerExpression(v)}))))),u}))}}y.v0v1PresetNameMap={a:"aa",e:"ee",i:"ih",o:"oh",u:"ou",blink:"blink",joy:"happy",angry:"angry",sorrow:"sad",fun:"relaxed",lookup:"lookUp",lookdown:"lookDown",lookleft:"lookLeft",lookright:"lookRight",blink_l:"blinkLeft",blink_r:"blinkRight",neutral:"neutral"};const w={None:"none",Block:"block",Blend:"blend"};class x{constructor(e,t){this._firstPersonOnlyLayer=x.DEFAULT_FIRSTPERSON_ONLY_LAYER,this._thirdPersonOnlyLayer=x.DEFAULT_THIRDPERSON_ONLY_LAYER,this._initializedLayers=!1,this.humanoid=e,this.meshAnnotations=t}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMFirstPerson: humanoid must be same in order to copy");return this.meshAnnotations=e.meshAnnotations.map((e=>({meshes:e.meshes.concat(),type:e.type}))),this}clone(){return new x(this.humanoid,this.meshAnnotations).copy(this)}get firstPersonOnlyLayer(){return this._firstPersonOnlyLayer}get thirdPersonOnlyLayer(){return this._thirdPersonOnlyLayer}setup({firstPersonOnlyLayer:e=x.DEFAULT_FIRSTPERSON_ONLY_LAYER,thirdPersonOnlyLayer:t=x.DEFAULT_THIRDPERSON_ONLY_LAYER}={}){this._initializedLayers||(this._firstPersonOnlyLayer=e,this._thirdPersonOnlyLayer=t,this.meshAnnotations.forEach((e=>{e.meshes.forEach((t=>{"firstPersonOnly"===e.type?(t.layers.set(this._firstPersonOnlyLayer),t.traverse((e=>e.layers.set(this._firstPersonOnlyLayer)))):"thirdPersonOnly"===e.type?(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)))):"auto"===e.type&&this._createHeadlessModel(t)}))})),this._initializedLayers=!0)}_excludeTriangles(e,t,i,r){let o=0;if(null!=t&&t.length>0)for(let n=0;n<e.length;n+=3){const s=e[n],a=e[n+1],l=e[n+2],h=t[s],u=i[s];if(h[0]>0&&r.includes(u[0]))continue;if(h[1]>0&&r.includes(u[1]))continue;if(h[2]>0&&r.includes(u[2]))continue;if(h[3]>0&&r.includes(u[3]))continue;const d=t[a],p=i[a];if(d[0]>0&&r.includes(p[0]))continue;if(d[1]>0&&r.includes(p[1]))continue;if(d[2]>0&&r.includes(p[2]))continue;if(d[3]>0&&r.includes(p[3]))continue;const c=t[l],m=i[l];c[0]>0&&r.includes(m[0])||(c[1]>0&&r.includes(m[1])||c[2]>0&&r.includes(m[2])||c[3]>0&&r.includes(m[3])||(e[o++]=s,e[o++]=a,e[o++]=l))}return o}_createErasedMesh(t,i){const r=new e.SkinnedMesh(t.geometry.clone(),t.material);r.name=`${t.name}(erase)`,r.frustumCulled=t.frustumCulled,r.layers.set(this._firstPersonOnlyLayer);const o=r.geometry,n=o.getAttribute("skinIndex").array,s=[];for(let e=0;e<n.length;e+=4)s.push([n[e],n[e+1],n[e+2],n[e+3]]);const a=o.getAttribute("skinWeight").array,l=[];for(let e=0;e<a.length;e+=4)l.push([a[e],a[e+1],a[e+2],a[e+3]]);const h=o.getIndex();if(!h)throw new Error("The geometry doesn't have an index buffer");const u=Array.from(h.array),d=this._excludeTriangles(u,l,s,i),p=[];for(let e=0;e<d;e++)p[e]=u[e];return o.setIndex(p),t.onBeforeRender&&(r.onBeforeRender=t.onBeforeRender),r.bind(new e.Skeleton(t.skeleton.bones,t.skeleton.boneInverses),new e.Matrix4),r}_createHeadlessModelForSkinnedMesh(e,t){const i=[];if(t.skeleton.bones.forEach(((e,t)=>{this._isEraseTarget(e)&&i.push(t)})),!i.length)return t.layers.enable(this._thirdPersonOnlyLayer),void t.layers.enable(this._firstPersonOnlyLayer);t.layers.set(this._thirdPersonOnlyLayer);const r=this._createErasedMesh(t,i);e.add(r)}_createHeadlessModel(t){if("Group"===t.type)if(t.layers.set(this._thirdPersonOnlyLayer),this._isEraseTarget(t))t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer)));else{const i=new e.Group;i.name=`_headless_${t.name}`,i.layers.set(this._firstPersonOnlyLayer),t.parent.add(i),t.children.filter((e=>"SkinnedMesh"===e.type)).forEach((e=>{const t=e;this._createHeadlessModelForSkinnedMesh(i,t)}))}else if("SkinnedMesh"===t.type){const e=t;this._createHeadlessModelForSkinnedMesh(t.parent,e)}else this._isEraseTarget(t)&&(t.layers.set(this._thirdPersonOnlyLayer),t.traverse((e=>e.layers.set(this._thirdPersonOnlyLayer))))}_isEraseTarget(e){return e===this.humanoid.getRawBoneNode("head")||!!e.parent&&this._isEraseTarget(e.parent)}}x.DEFAULT_FIRSTPERSON_ONLY_LAYER=9,x.DEFAULT_THIRDPERSON_ONLY_LAYER=10;const _=new Set(["1.0","1.0-beta"]);class M{constructor(e){this.parser=e}get name(){return"VRMFirstPersonLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null!==t){if(void 0===t)throw new Error("VRMFirstPersonLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");e.userData.vrmFirstPerson=yield this._import(e,t)}}))}_import(e,t){return i(this,void 0,void 0,(function*(){if(null==t)return null;const i=yield this._v1Import(e,t);if(i)return i;const r=yield this._v0Import(e,t);return r||null}))}_v1Import(e,t){var r,o;return i(this,void 0,void 0,(function*(){const i=this.parser.json;if(!(-1!==(null===(r=i.extensionsUsed)||void 0===r?void 0:r.indexOf("VRMC_vrm"))))return null;const s=null===(o=i.extensions)||void 0===o?void 0:o.VRMC_vrm;if(!s)return null;const a=s.specVersion;if(!_.has(a))return console.warn(`VRMFirstPersonLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=s.firstPerson;if(!l)return null;const h=[],u=yield n(e);return Array.from(u.entries()).forEach((([e,t])=>{var i;const r=l.meshAnnotations?l.meshAnnotations.find((t=>t.node===e)):void 0;h.push({meshes:t,type:null!==(i=null==r?void 0:r.type)&&void 0!==i?i:"both"})})),new x(t,h)}))}_v0Import(e,t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,o=null===(r=i.extensions)||void 0===r?void 0:r.VRM;if(!o)return null;const s=o.firstPerson;if(!s)return null;const a=[],l=yield n(e);return Array.from(l.entries()).forEach((([e,t])=>{const r=i.nodes[e],o=s.meshAnnotations?s.meshAnnotations.find((e=>e.mesh===r.mesh)):void 0;a.push({meshes:t,type:this._convertV0FlagToV1Type(null==o?void 0:o.firstPersonFlag)})})),new x(t,a)}))}_convertV0FlagToV1Type(e){return"FirstPersonOnly"===e?"firstPersonOnly":"ThirdPersonOnly"===e?"thirdPersonOnly":"Auto"===e?"auto":"both"}}const R={Auto:"auto",Both:"both",ThirdPersonOnly:"thirdPersonOnly",FirstPersonOnly:"firstPersonOnly"},P=new e.Vector3,L=new e.Vector3,A=new e.Quaternion;class b extends e.Group{constructor(t){super(),this.vrmHumanoid=t,this._boneAxesMap=new Map,Object.values(t.humanBones).forEach((t=>{const i=new e.AxesHelper(1);i.matrixAutoUpdate=!1,i.material.depthTest=!1,i.material.depthWrite=!1,this.add(i),this._boneAxesMap.set(t,i)}))}dispose(){Array.from(this._boneAxesMap.values()).forEach((e=>{e.geometry.dispose(),e.material.dispose()}))}updateMatrixWorld(e){Array.from(this._boneAxesMap.entries()).forEach((([e,t])=>{e.node.updateWorldMatrix(!0,!1),e.node.matrixWorld.decompose(P,A,L);const i=P.set(.1,.1,.1).divide(L);t.matrix.copy(e.node.matrixWorld).scale(i)})),super.updateMatrixWorld(e)}}const E=["hips","spine","chest","upperChest","neck","head","leftEye","rightEye","jaw","leftUpperLeg","leftLowerLeg","leftFoot","leftToes","rightUpperLeg","rightLowerLeg","rightFoot","rightToes","leftShoulder","leftUpperArm","leftLowerArm","leftHand","rightShoulder","rightUpperArm","rightLowerArm","rightHand","leftThumbMetacarpal","leftThumbProximal","leftThumbDistal","leftIndexProximal","leftIndexIntermediate","leftIndexDistal","leftMiddleProximal","leftMiddleIntermediate","leftMiddleDistal","leftRingProximal","leftRingIntermediate","leftRingDistal","leftLittleProximal","leftLittleIntermediate","leftLittleDistal","rightThumbMetacarpal","rightThumbProximal","rightThumbDistal","rightIndexProximal","rightIndexIntermediate","rightIndexDistal","rightMiddleProximal","rightMiddleIntermediate","rightMiddleDistal","rightRingProximal","rightRingIntermediate","rightRingDistal","rightLittleProximal","rightLittleIntermediate","rightLittleDistal"],I={Hips:"hips",Spine:"spine",Chest:"chest",UpperChest:"upperChest",Neck:"neck",Head:"head",LeftEye:"leftEye",RightEye:"rightEye",Jaw:"jaw",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",LeftToes:"leftToes",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",RightToes:"rightToes",LeftShoulder:"leftShoulder",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightShoulder:"rightShoulder",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand",LeftThumbMetacarpal:"leftThumbMetacarpal",LeftThumbProximal:"leftThumbProximal",LeftThumbDistal:"leftThumbDistal",LeftIndexProximal:"leftIndexProximal",LeftIndexIntermediate:"leftIndexIntermediate",LeftIndexDistal:"leftIndexDistal",LeftMiddleProximal:"leftMiddleProximal",LeftMiddleIntermediate:"leftMiddleIntermediate",LeftMiddleDistal:"leftMiddleDistal",LeftRingProximal:"leftRingProximal",LeftRingIntermediate:"leftRingIntermediate",LeftRingDistal:"leftRingDistal",LeftLittleProximal:"leftLittleProximal",LeftLittleIntermediate:"leftLittleIntermediate",LeftLittleDistal:"leftLittleDistal",RightThumbMetacarpal:"rightThumbMetacarpal",RightThumbProximal:"rightThumbProximal",RightThumbDistal:"rightThumbDistal",RightIndexProximal:"rightIndexProximal",RightIndexIntermediate:"rightIndexIntermediate",RightIndexDistal:"rightIndexDistal",RightMiddleProximal:"rightMiddleProximal",RightMiddleIntermediate:"rightMiddleIntermediate",RightMiddleDistal:"rightMiddleDistal",RightRingProximal:"rightRingProximal",RightRingIntermediate:"rightRingIntermediate",RightRingDistal:"rightRingDistal",RightLittleProximal:"rightLittleProximal",RightLittleIntermediate:"rightLittleIntermediate",RightLittleDistal:"rightLittleDistal"},B={hips:null,spine:"hips",chest:"spine",upperChest:"chest",neck:"upperChest",head:"neck",leftEye:"head",rightEye:"head",jaw:"head",leftUpperLeg:"hips",leftLowerLeg:"leftUpperLeg",leftFoot:"leftLowerLeg",leftToes:"leftFoot",rightUpperLeg:"hips",rightLowerLeg:"rightUpperLeg",rightFoot:"rightLowerLeg",rightToes:"rightFoot",leftShoulder:"chest",leftUpperArm:"leftShoulder",leftLowerArm:"leftUpperArm",leftHand:"leftLowerArm",rightShoulder:"chest",rightUpperArm:"rightShoulder",rightLowerArm:"rightUpperArm",rightHand:"rightLowerArm",leftThumbMetacarpal:"leftHand",leftThumbProximal:"leftThumbMetacarpal",leftThumbDistal:"leftThumbProximal",leftIndexProximal:"leftHand",leftIndexIntermediate:"leftIndexProximal",leftIndexDistal:"leftIndexIntermediate",leftMiddleProximal:"leftHand",leftMiddleIntermediate:"leftMiddleProximal",leftMiddleDistal:"leftMiddleIntermediate",leftRingProximal:"leftHand",leftRingIntermediate:"leftRingProximal",leftRingDistal:"leftRingIntermediate",leftLittleProximal:"leftHand",leftLittleIntermediate:"leftLittleProximal",leftLittleDistal:"leftLittleIntermediate",rightThumbMetacarpal:"rightHand",rightThumbProximal:"rightThumbMetacarpal",rightThumbDistal:"rightThumbProximal",rightIndexProximal:"rightHand",rightIndexIntermediate:"rightIndexProximal",rightIndexDistal:"rightIndexIntermediate",rightMiddleProximal:"rightHand",rightMiddleIntermediate:"rightMiddleProximal",rightMiddleDistal:"rightMiddleIntermediate",rightRingProximal:"rightHand",rightRingIntermediate:"rightRingProximal",rightRingDistal:"rightRingIntermediate",rightLittleProximal:"rightHand",rightLittleIntermediate:"rightLittleProximal",rightLittleDistal:"rightLittleIntermediate"};function V(e){return e.invert?e.invert():e.inverse(),e}const U=new e.Vector3,k=new e.Quaternion;class T{constructor(e){this.humanBones=e,this.restPose=this.getAbsolutePose()}getAbsolutePose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);r&&(U.copy(r.position),k.copy(r.quaternion),e[i]={position:U.toArray(),rotation:k.toArray()})})),e}getPose(){const e={};return Object.keys(this.humanBones).forEach((t=>{const i=t,r=this.getBoneNode(i);if(!r)return;U.set(0,0,0),k.identity();const o=this.restPose[i];(null==o?void 0:o.position)&&U.fromArray(o.position).negate(),(null==o?void 0:o.rotation)&&V(k.fromArray(o.rotation)),U.add(r.position),k.premultiply(r.quaternion),e[i]={position:U.toArray(),rotation:k.toArray()}})),e}setPose(e){Object.entries(e).forEach((([e,t])=>{const i=e,r=this.getBoneNode(i);if(!r)return;const o=this.restPose[i];o&&((null==t?void 0:t.position)&&(r.position.fromArray(t.position),o.position&&r.position.add(U.fromArray(o.position))),(null==t?void 0:t.rotation)&&(r.quaternion.fromArray(t.rotation),o.rotation&&r.quaternion.multiply(k.fromArray(o.rotation))))}))}resetPose(){Object.entries(this.restPose).forEach((([e,t])=>{const i=this.getBoneNode(e);i&&((null==t?void 0:t.position)&&i.position.fromArray(t.position),(null==t?void 0:t.rotation)&&i.quaternion.fromArray(t.rotation))}))}getBone(e){var t;return null!==(t=this.humanBones[e])&&void 0!==t?t:void 0}getBoneNode(e){var t,i;return null!==(i=null===(t=this.humanBones[e])||void 0===t?void 0:t.node)&&void 0!==i?i:null}}const D=new e.Vector3,H=new e.Quaternion;class O extends T{constructor(e){const{rigBones:t,root:i,parentWorldRotations:r,boneRotations:o}=O._setupTransforms(e);super(t),this.original=e,this.root=i,this._parentWorldRotations=r,this._boneRotations=o}static _setupTransforms(t){const i=new e.Object3D;i.name="VRMHumanoidRig";const r={},o={},n={};E.forEach((i=>{const s=t.getBoneNode(i);if(s){const t=new e.Vector3,a=new e.Quaternion;s.updateWorldMatrix(!0,!1),s.matrixWorld.decompose(t,a,D),r[i]=t,o[i]=a,n[i]=s.quaternion.clone()}}));const s={},a={};return E.forEach((n=>{var l;const h=t.getBoneNode(n);if(h){const t=r[n];let u,d,p=n;for(;null==u&&(p=B[p],null!=p);)u=r[p],d=o[p];const c=new e.Object3D;c.name="Normalized_"+h.name;(p?null===(l=a[p])||void 0===l?void 0:l.node:i).add(c),c.position.copy(t),u&&c.position.sub(u),a[n]={node:c},s[n]=null!=d?d:new e.Quaternion}})),{rigBones:a,root:i,parentWorldRotations:s,boneRotations:n}}update(){E.forEach((t=>{const i=this.original.getBoneNode(t);if(null!=i){const r=this.getBoneNode(t),o=this._parentWorldRotations[t],n=H.copy(o).invert(),s=this._boneRotations[t];if(i.quaternion.copy(r.quaternion).multiply(o).premultiply(n).multiply(s),"hips"===t){const t=r.getWorldPosition(new e.Vector3),o=i.parent.matrixWorld,n=t.applyMatrix4(o.invert());i.position.copy(n)}}}))}}class N{constructor(e,t){var i;this.autoUpdateHumanBones=null===(i=null==t?void 0:t.autoUpdateHumanBones)||void 0===i||i,this._rawHumanBones=new T(e),this._normalizedHumanBones=new O(this._rawHumanBones)}get restPose(){return console.warn("VRMHumanoid: restPose is deprecated. Use either rawRestPose or normalizedRestPose instead."),this.rawRestPose}get rawRestPose(){return this._rawHumanBones.restPose}get normalizedRestPose(){return this._normalizedHumanBones.restPose}get humanBones(){return this._rawHumanBones.humanBones}get rawHumanBones(){return this._rawHumanBones.humanBones}get normalizedHumanBones(){return this._normalizedHumanBones.humanBones}get normalizedHumanBonesRoot(){return this._normalizedHumanBones.root}copy(e){return this.autoUpdateHumanBones=e.autoUpdateHumanBones,this._rawHumanBones=new T(e.humanBones),this._normalizedHumanBones=new O(this._rawHumanBones),this}clone(){return new N(this.humanBones,{autoUpdateHumanBones:this.autoUpdateHumanBones}).copy(this)}getAbsolutePose(){return console.warn("VRMHumanoid: getAbsolutePose() is deprecated. Use either getRawAbsolutePose() or getNormalizedAbsolutePose() instead."),this.getRawAbsolutePose()}getRawAbsolutePose(){return this._rawHumanBones.getAbsolutePose()}getNormalizedAbsolutePose(){return this._normalizedHumanBones.getAbsolutePose()}getPose(){return console.warn("VRMHumanoid: getPose() is deprecated. Use either getRawPose() or getNormalizedPose() instead."),this.getRawPose()}getRawPose(){return this._rawHumanBones.getPose()}getNormalizedPose(){return this._normalizedHumanBones.getPose()}setPose(e){return console.warn("VRMHumanoid: setPose() is deprecated. Use either setRawPose() or setNormalizedPose() instead."),this.setRawPose(e)}setRawPose(e){return this._rawHumanBones.setPose(e)}setNormalizedPose(e){return this._normalizedHumanBones.setPose(e)}resetPose(){return console.warn("VRMHumanoid: resetPose() is deprecated. Use either resetRawPose() or resetNormalizedPose() instead."),this.resetRawPose()}resetRawPose(){return this._rawHumanBones.resetPose()}resetNormalizedPose(){return this._rawHumanBones.resetPose()}getBone(e){return console.warn("VRMHumanoid: getBone() is deprecated. Use either getRawBone() or getNormalizedBone() instead."),this.getRawBone(e)}getRawBone(e){return this._rawHumanBones.getBone(e)}getNormalizedBone(e){return this._normalizedHumanBones.getBone(e)}getBoneNode(e){return console.warn("VRMHumanoid: getBoneNode() is deprecated. Use either getRawBoneNode() or getNormalizedBoneNode() instead."),this.getRawBoneNode(e)}getRawBoneNode(e){return this._rawHumanBones.getBoneNode(e)}getNormalizedBoneNode(e){return this._normalizedHumanBones.getBoneNode(e)}update(){this.autoUpdateHumanBones&&this._normalizedHumanBones.update()}}const F={Hips:"hips",Spine:"spine",Head:"head",LeftUpperLeg:"leftUpperLeg",LeftLowerLeg:"leftLowerLeg",LeftFoot:"leftFoot",RightUpperLeg:"rightUpperLeg",RightLowerLeg:"rightLowerLeg",RightFoot:"rightFoot",LeftUpperArm:"leftUpperArm",LeftLowerArm:"leftLowerArm",LeftHand:"leftHand",RightUpperArm:"rightUpperArm",RightLowerArm:"rightLowerArm",RightHand:"rightHand"},S=new Set(["1.0","1.0-beta"]),C={leftThumbProximal:"leftThumbMetacarpal",leftThumbIntermediate:"leftThumbProximal",rightThumbProximal:"rightThumbMetacarpal",rightThumbIntermediate:"rightThumbProximal"};class W{constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot,this.autoUpdateHumanBones=null==t?void 0:t.autoUpdateHumanBones}get name(){return"VRMHumanoidLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmHumanoid=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(t)return t;const i=yield this._v0Import(e);return i||null}))}_v1Import(e){var t,r;return i(this,void 0,void 0,(function*(){const o=this.parser.json;if(!(-1!==(null===(t=o.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const n=null===(r=o.extensions)||void 0===r?void 0:r.VRMC_vrm;if(!n)return null;const s=n.specVersion;if(!S.has(s))return console.warn(`VRMHumanoidLoaderPlugin: Unknown VRMC_vrm specVersion "${s}"`),null;const a=n.humanoid;if(!a)return null;const l=null!=a.humanBones.leftThumbIntermediate||null!=a.humanBones.rightThumbIntermediate,h={};null!=a.humanBones&&(yield Promise.all(Object.entries(a.humanBones).map((([e,t])=>i(this,void 0,void 0,(function*(){let i=e;const r=t.node;if(l){const e=C[i];null!=e&&(i=e)}const o=yield this.parser.getDependency("node",r);null!=o?h[i]={node:o}:console.warn(`A glTF node bound to the humanoid bone ${i} (index = ${r}) does not exist`)}))))));const u=new N(this._ensureRequiredBonesExist(h),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(u.normalizedHumanBonesRoot),this.helperRoot){const e=new b(u);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return u}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const r=this.parser.json,o=null===(t=r.extensions)||void 0===t?void 0:t.VRM;if(!o)return null;const n=o.humanoid;if(!n)return null;const s={};null!=n.humanBones&&(yield Promise.all(n.humanBones.map((e=>i(this,void 0,void 0,(function*(){const t=e.bone,i=e.node;if(null==t||null==i)return;const r=yield this.parser.getDependency("node",i);if(null==r)return void console.warn(`A glTF node bound to the humanoid bone ${t} (index = ${i}) does not exist`);const o=C[t],n=null!=o?o:t;null==s[n]?s[n]={node:r}:console.warn(`Multiple bone entries for ${n} detected (index = ${i}), ignoring duplicated entries.`)}))))));const a=new N(this._ensureRequiredBonesExist(s),{autoUpdateHumanBones:this.autoUpdateHumanBones});if(e.scene.add(a.normalizedHumanBonesRoot),this.helperRoot){const e=new b(a);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return a}))}_ensureRequiredBonesExist(e){const t=Object.values(F).filter((t=>null==e[t]));if(t.length>0)throw new Error(`VRMHumanoidLoaderPlugin: These humanoid bones are required but not exist: ${t.join(", ")}`);return e}}class z extends e.BufferGeometry{constructor(){super(),this._currentTheta=0,this._currentRadius=0,this.theta=0,this.radius=0,this._currentTheta=0,this._currentRadius=0,this._attrPos=new e.BufferAttribute(new Float32Array(195),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(189),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentTheta!==this.theta&&(this._currentTheta=this.theta,e=!0),this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),e&&this._buildPosition()}_buildPosition(){this._attrPos.setXYZ(0,0,0,0);for(let e=0;e<64;e++){const t=e/63*this._currentTheta;this._attrPos.setXYZ(e+1,this._currentRadius*Math.sin(t),0,this._currentRadius*Math.cos(t))}this._attrPos.needsUpdate=!0}_buildIndex(){for(let e=0;e<63;e++)this._attrIndex.setXYZ(3*e,0,e+1,e+2);this._attrIndex.needsUpdate=!0}}class Q extends e.BufferGeometry{constructor(){super(),this.radius=0,this._currentRadius=0,this.tail=new e.Vector3,this._currentTail=new e.Vector3,this._attrPos=new e.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new e.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1;this._currentRadius!==this.radius&&(this._currentRadius=this.radius,e=!0),this._currentTail.equals(this.tail)||(this._currentTail.copy(this.tail),e=!0),e&&this._buildPosition()}_buildPosition(){for(let e=0;e<32;e++){const t=e/16*Math.PI;this._attrPos.setXYZ(e,Math.cos(t),Math.sin(t),0),this._attrPos.setXYZ(32+e,0,Math.cos(t),Math.sin(t)),this._attrPos.setXYZ(64+e,Math.sin(t),0,Math.cos(t))}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 e=0;e<32;e++){const t=(e+1)%32;this._attrIndex.setXY(2*e,e,t),this._attrIndex.setXY(64+2*e,32+e,32+t),this._attrIndex.setXY(128+2*e,64+e,64+t)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}const Y=new e.Quaternion,j=new e.Quaternion,$=new e.Vector3,q=new e.Vector3,G=Math.sqrt(2)/2,X=new e.Quaternion(0,0,-G,G),Z=new e.Vector3(0,1,0);class J extends e.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.vrmLookAt=t;{const t=new z;t.radius=.5;const i=new e.MeshBasicMaterial({color:65280,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshPitch=new e.Mesh(t,i),this.add(this._meshPitch)}{const t=new z;t.radius=.5;const i=new e.MeshBasicMaterial({color:16711680,transparent:!0,opacity:.5,side:e.DoubleSide,depthTest:!1,depthWrite:!1});this._meshYaw=new e.Mesh(t,i),this.add(this._meshYaw)}{const t=new Q;t.radius=.1;const i=new e.LineBasicMaterial({color:16777215,depthTest:!1,depthWrite:!1});this._lineTarget=new e.LineSegments(t,i),this._lineTarget.frustumCulled=!1,this.add(this._lineTarget)}}dispose(){this._meshYaw.geometry.dispose(),this._meshYaw.material.dispose(),this._meshPitch.geometry.dispose(),this._meshPitch.material.dispose(),this._lineTarget.geometry.dispose(),this._lineTarget.material.dispose()}updateMatrixWorld(t){const i=e.MathUtils.DEG2RAD*this.vrmLookAt.yaw;this._meshYaw.geometry.theta=i,this._meshYaw.geometry.update();const r=e.MathUtils.DEG2RAD*this.vrmLookAt.pitch;this._meshPitch.geometry.theta=r,this._meshPitch.geometry.update(),this.vrmLookAt.getLookAtWorldPosition($),this.vrmLookAt.getLookAtWorldQuaternion(Y),Y.multiply(this.vrmLookAt.getFaceFrontQuaternion(j)),this._meshYaw.position.copy($),this._meshYaw.quaternion.copy(Y),this._meshPitch.position.copy($),this._meshPitch.quaternion.copy(Y),this._meshPitch.quaternion.multiply(j.setFromAxisAngle(Z,i)),this._meshPitch.quaternion.multiply(X);const{target:o,autoUpdate:n}=this.vrmLookAt;null!=o&&n&&(o.getWorldPosition(q).sub($),this._lineTarget.geometry.tail.copy(q),this._lineTarget.geometry.update(),this._lineTarget.position.copy($)),super.updateMatrixWorld(t)}}const K=new e.Vector3,ee=new e.Vector3;function te(e,t){return e.matrixWorld.decompose(K,t,ee),t}function ie(e){return[Math.atan2(-e.z,e.x),Math.atan2(e.y,Math.sqrt(e.x*e.x+e.z*e.z))]}function re(e){const t=Math.round(e/2/Math.PI);return e-2*Math.PI*t}const oe=new e.Vector3(0,0,1),ne=new e.Vector3,se=new e.Vector3,ae=new e.Vector3,le=new e.Quaternion,he=new e.Quaternion,ue=new e.Quaternion,de=new e.Quaternion,pe=new e.Euler;class ce{constructor(t,i){this.offsetFromHeadBone=new e.Vector3,this.autoUpdate=!0,this.faceFront=new e.Vector3(0,0,1),this.humanoid=t,this.applier=i,this._yaw=0,this._pitch=0,this._needsUpdate=!0,this._restHeadWorldQuaternion=this.getLookAtWorldQuaternion(new e.Quaternion)}get yaw(){return this._yaw}set yaw(e){this._yaw=e,this._needsUpdate=!0}get pitch(){return this._pitch}set pitch(e){this._pitch=e,this._needsUpdate=!0}get euler(){return console.warn("VRMLookAt: euler is deprecated. use getEuler() instead."),this.getEuler(new e.Euler)}getEuler(t){return t.set(e.MathUtils.DEG2RAD*this._pitch,e.MathUtils.DEG2RAD*this._yaw,0,"YXZ")}copy(e){if(this.humanoid!==e.humanoid)throw new Error("VRMLookAt: humanoid must be same in order to copy");return this.offsetFromHeadBone.copy(e.offsetFromHeadBone),this.applier=e.applier,this.autoUpdate=e.autoUpdate,this.target=e.target,this.faceFront.copy(e.faceFront),this}clone(){return new ce(this.humanoid,this.applier).copy(this)}reset(){this._yaw=0,this._pitch=0,this._needsUpdate=!0}getLookAtWorldPosition(e){const t=this.humanoid.getRawBoneNode("head");return e.copy(this.offsetFromHeadBone).applyMatrix4(t.matrixWorld)}getLookAtWorldQuaternion(e){return te(this.humanoid.getRawBoneNode("head"),e)}getFaceFrontQuaternion(e){if(this.faceFront.distanceToSquared(oe)<.01)return e.copy(this._restHeadWorldQuaternion).invert();const[t,i]=ie(this.faceFront);return pe.set(0,.5*Math.PI+t,i,"YZX"),e.setFromEuler(pe).premultiply(de.copy(this._restHeadWorldQuaternion).invert())}getLookAtWorldDirection(e){return this.getLookAtWorldQuaternion(he),this.getFaceFrontQuaternion(ue),e.copy(oe).applyQuaternion(he).applyQuaternion(ue).applyEuler(this.getEuler(pe))}lookAt(t){const i=le.copy(this._restHeadWorldQuaternion).multiply(V(this.getLookAtWorldQuaternion(he))),r=this.getLookAtWorldPosition(se),o=ae.copy(t).sub(r).applyQuaternion(i).normalize(),[n,s]=ie(this.faceFront),[a,l]=ie(o),h=re(a-n),u=re(s-l);this._yaw=e.MathUtils.RAD2DEG*h,this._pitch=e.MathUtils.RAD2DEG*u,this._needsUpdate=!0}update(e){null!=this.target&&this.autoUpdate&&this.lookAt(this.target.getWorldPosition(ne)),this._needsUpdate&&(this._needsUpdate=!1,this.applier.applyYawPitch(this._yaw,this._pitch))}}ce.EULER_ORDER="YXZ";const me=new e.Vector3(0,0,1),ge=new e.Quaternion,fe=new e.Quaternion,ve=new e.Euler(0,0,0,"YXZ");class ye{constructor(t,i,r,o,n){this.humanoid=t,this.rangeMapHorizontalInner=i,this.rangeMapHorizontalOuter=r,this.rangeMapVerticalDown=o,this.rangeMapVerticalUp=n,this.faceFront=new e.Vector3(0,0,1),this._restQuatLeftEye=new e.Quaternion,this._restQuatRightEye=new e.Quaternion,this._restLeftEyeParentWorldQuat=new e.Quaternion,this._restRightEyeParentWorldQuat=new e.Quaternion;const s=this.humanoid.getRawBoneNode("leftEye"),a=this.humanoid.getRawBoneNode("leftEye");s&&(this._restQuatLeftEye.copy(s.quaternion),te(s.parent,this._restLeftEyeParentWorldQuat)),a&&(this._restQuatRightEye.copy(a.quaternion),te(a.parent,this._restRightEyeParentWorldQuat))}applyYawPitch(t,i){const r=this.humanoid.getRawBoneNode("leftEye"),o=this.humanoid.getRawBoneNode("rightEye"),n=this.humanoid.getNormalizedBoneNode("leftEye"),s=this.humanoid.getNormalizedBoneNode("rightEye");r&&(ve.x=i<0?-e.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-i):e.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(i),ve.y=t<0?-e.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(-t):e.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(t),ge.setFromEuler(ve),this._getWorldFaceFrontQuat(fe),n.quaternion.copy(fe).multiply(ge).multiply(fe.invert()),ge.copy(this._restLeftEyeParentWorldQuat),r.quaternion.copy(n.quaternion).multiply(ge).premultiply(ge.invert()).multiply(this._restQuatLeftEye)),o&&(ve.x=i<0?-e.MathUtils.DEG2RAD*this.rangeMapVerticalDown.map(-i):e.MathUtils.DEG2RAD*this.rangeMapVerticalUp.map(i),ve.y=t<0?-e.MathUtils.DEG2RAD*this.rangeMapHorizontalOuter.map(-t):e.MathUtils.DEG2RAD*this.rangeMapHorizontalInner.map(t),ge.setFromEuler(ve),this._getWorldFaceFrontQuat(fe),s.quaternion.copy(fe).multiply(ge).multiply(fe.invert()),ge.copy(this._restRightEyeParentWorldQuat),o.quaternion.copy(s.quaternion).multiply(ge).premultiply(ge.invert()).multiply(this._restQuatRightEye))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const i=e.MathUtils.RAD2DEG*t.y,r=e.MathUtils.RAD2DEG*t.x;this.applyYawPitch(i,r)}_getWorldFaceFrontQuat(e){if(this.faceFront.distanceToSquared(me)<.01)return e.identity();const[t,i]=ie(this.faceFront);return ve.set(0,.5*Math.PI+t,i,"YZX"),e.setFromEuler(ve)}}ye.type="bone";class we{constructor(e,t,i,r,o){this.expressions=e,this.rangeMapHorizontalInner=t,this.rangeMapHorizontalOuter=i,this.rangeMapVerticalDown=r,this.rangeMapVerticalUp=o}applyYawPitch(e,t){t<0?(this.expressions.setValue("lookDown",0),this.expressions.setValue("lookUp",this.rangeMapVerticalUp.map(-t))):(this.expressions.setValue("lookUp",0),this.expressions.setValue("lookDown",this.rangeMapVerticalDown.map(t))),e<0?(this.expressions.setValue("lookLeft",0),this.expressions.setValue("lookRight",this.rangeMapHorizontalOuter.map(-e))):(this.expressions.setValue("lookRight",0),this.expressions.setValue("lookLeft",this.rangeMapHorizontalOuter.map(e)))}lookAt(t){console.warn("VRMLookAtBoneApplier: lookAt() is deprecated. use apply() instead.");const i=e.MathUtils.RAD2DEG*t.y,r=e.MathUtils.RAD2DEG*t.x;this.applyYawPitch(i,r)}}we.type="expression";class xe{constructor(e,t){this.inputMaxValue=e,this.outputScale=t}map(e){return this.outputScale*l(e/this.inputMaxValue)}}const _e=new Set(["1.0","1.0-beta"]);class Me{constructor(e,t){this.parser=e,this.helperRoot=null==t?void 0:t.helperRoot}get name(){return"VRMLookAtLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){const t=e.userData.vrmHumanoid;if(null===t)return;if(void 0===t)throw new Error("VRMLookAtLoaderPlugin: vrmHumanoid is undefined. VRMHumanoidLoaderPlugin have to be used first");const i=e.userData.vrmExpressionManager;if(null!==i){if(void 0===i)throw new Error("VRMLookAtLoaderPlugin: vrmExpressionManager is undefined. VRMExpressionLoaderPlugin have to be used first");e.userData.vrmLookAt=yield this._import(e,t,i)}}))}_import(e,t,r){return i(this,void 0,void 0,(function*(){if(null==t||null==r)return null;const i=yield this._v1Import(e,t,r);if(i)return i;const o=yield this._v0Import(e,t,r);return o||null}))}_v1Import(e,t,r){var o,n,s;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(o=e.extensionsUsed)||void 0===o?void 0:o.indexOf("VRMC_vrm"))))return null;const i=null===(n=e.extensions)||void 0===n?void 0:n.VRMC_vrm;if(!i)return null;const a=i.specVersion;if(!_e.has(a))return console.warn(`VRMLookAtLoaderPlugin: Unknown VRMC_vrm specVersion "${a}"`),null;const l=i.lookAt;if(!l)return null;const h="expression"===l.type?1:10,u=this._v1ImportRangeMap(l.rangeMapHorizontalInner,h),d=this._v1ImportRangeMap(l.rangeMapHorizontalOuter,h),p=this._v1ImportRangeMap(l.rangeMapVerticalDown,h),c=this._v1ImportRangeMap(l.rangeMapVerticalUp,h);let m;m="expression"===l.type?new we(r,u,d,p,c):new ye(t,u,d,p,c);const g=this._importLookAt(t,m);return g.offsetFromHeadBone.fromArray(null!==(s=l.offsetFromHeadBone)&&void 0!==s?s:[0,.06,0]),g}))}_v1ImportRangeMap(e,t){var i,r;return new xe(null!==(i=null==e?void 0:e.inputMaxValue)&&void 0!==i?i:90,null!==(r=null==e?void 0:e.outputScale)&&void 0!==r?r:t)}_v0Import(e,t,r){var o,n,s,a;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(o=e.extensions)||void 0===o?void 0:o.VRM;if(!i)return null;const l=i.firstPerson;if(!l)return null;const h="BlendShape"===l.lookAtTypeName?1:10,u=this._v0ImportDegreeMap(l.lookAtHorizontalInner,h),d=this._v0ImportDegreeMap(l.lookAtHorizontalOuter,h),p=this._v0ImportDegreeMap(l.lookAtVerticalDown,h),c=this._v0ImportDegreeMap(l.lookAtVerticalUp,h);let m;m="BlendShape"===l.lookAtTypeName?new we(r,u,d,p,c):new ye(t,u,d,p,c);const g=this._importLookAt(t,m);return l.firstPersonBoneOffset?g.offsetFromHeadBone.set(null!==(n=l.firstPersonBoneOffset.x)&&void 0!==n?n:0,null!==(s=l.firstPersonBoneOffset.y)&&void 0!==s?s:.06,-(null!==(a=l.firstPersonBoneOffset.z)&&void 0!==a?a:0)):g.offsetFromHeadBone.set(0,.06,0),g.faceFront.set(0,0,-1),m instanceof ye&&m.faceFront.set(0,0,-1),g}))}_v0ImportDegreeMap(e,t){var i,r;const o=null==e?void 0:e.curve;return"[0,0,0,1,1,1,1,0]"!==JSON.stringify(o)&&console.warn("Curves of LookAtDegreeMap defined in VRM 0.0 are not supported"),new xe(null!==(i=null==e?void 0:e.xRange)&&void 0!==i?i:90,null!==(r=null==e?void 0:e.yRange)&&void 0!==r?r:t)}_importLookAt(e,t){const i=new ce(e,t);if(this.helperRoot){const e=new J(i);this.helperRoot.add(e),e.renderOrder=this.helperRoot.renderOrder}return i}}const Re={Bone:"bone",Expression:"expression"};const Pe=new Set(["1.0","1.0-beta"]);class Le{constructor(e,t){var i,r,o;this.parser=e,this.needThumbnailImage=null===(i=null==t?void 0:t.needThumbnailImage)||void 0===i||i,this.acceptLicenseUrls=null!==(r=null==t?void 0:t.acceptLicenseUrls)&&void 0!==r?r:["https://vrm.dev/licenses/1.0/"],this.acceptV0Meta=null===(o=null==t?void 0:t.acceptV0Meta)||void 0===o||o}get name(){return"VRMMetaLoaderPlugin"}afterRoot(e){return i(this,void 0,void 0,(function*(){e.userData.vrmMeta=yield this._import(e)}))}_import(e){return i(this,void 0,void 0,(function*(){const t=yield this._v1Import(e);if(null!=t)return t;const i=yield this._v0Import(e);return null!=i?i:null}))}_v1Import(e){var t,r,o;return i(this,void 0,void 0,(function*(){const e=this.parser.json;if(!(-1!==(null===(t=e.extensionsUsed)||void 0===t?void 0:t.indexOf("VRMC_vrm"))))return null;const i=null===(r=e.extensions)||void 0===r?void 0:r.VRMC_vrm;if(null==i)return null;const n=i.specVersion;if(!Pe.has(n))return console.warn(`VRMMetaLoaderPlugin: Unknown VRMC_vrm specVersion "${n}"`),null;const s=i.meta;if(!s)return null;const a=s.licenseUrl;if(!new Set(this.acceptLicenseUrls).has(a))throw new Error(`VRMMetaLoaderPlugin: The license url "${a}" is not accepted`);let l;return this.needThumbnailImage&&null!=s.thumbnailImage&&(l=null!==(o=yield this._extractGLTFImage(s.thumbnailImage))&&void 0!==o?o:void 0),{metaVersion:"1",name:s.name,version:s.version,authors:s.authors,copyrightInformation:s.copyrightInformation,contactInformation:s.contactInformation,references:s.references,thirdPartyLicenses:s.thirdPartyLicenses,thumbnailImage:l,licenseUrl:s.licenseUrl,avatarPermission:s.avatarPermission,allowExcessivelyViolentUsage:s.allowExcessivelyViolentUsage,allowExcessivelySexualUsage:s.allowExcessivelySexualUsage,commercialUsage:s.commercialUsage,allowPoliticalOrReligiousUsage:s.allowPoliticalOrReligiousUsage,allowAntisocialOrHateUsage:s.allowAntisocialOrHateUsage,creditNotation:s.creditNotation,allowRedistribution:s.allowRedistribution,modification:s.modification,otherLicenseUrl:s.otherLicenseUrl}}))}_v0Import(e){var t;return i(this,void 0,void 0,(function*(){const e=this.parser.json,i=null===(t=e.extensions)||void 0===t?void 0:t.VRM;if(!i)return null;const r=i.meta;if(!r)return null;if(!this.acceptV0Meta)throw new Error("VRMMetaLoaderPlugin: Attempted to load VRM0.0 meta but acceptV0Meta is false");let o;return this.needThumbnailImage&&null!=r.texture&&-1!==r.texture&&(o=yield this.parser.getDependency("texture",r.texture)),{metaVersion:"0",allowedUserName:r.allowedUserName,author:r.author,commercialUssageName:r.commercialUssageName,contactInformation:r.contactInformation,licenseName:r.licenseName,otherLicenseUrl:r.otherLicenseUrl,otherPermissionUrl:r.otherPermissionUrl,reference:r.reference,sexualUssageName:r.sexualUssageName,texture:null!=o?o:void 0,title:r.title,version:r.version,violentUssageName:r.violentUssageName}}))}_extractGLTFImage(t){var r;return i(this,void 0,void 0,(function*(){const i=this.parser.json,o=null===(r=i.images)||void 0===r?void 0:r[t];if(null==o)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image doesn't exist`),null;let n=o.uri;if(null!=o.bufferView){const e=yield this.parser.getDependency("bufferView",o.bufferView),t=new Blob([e],{type:o.mimeType});n=URL.createObjectURL(t)}if(null==n)return console.warn(`VRMMetaLoaderPlugin: Attempt to use images[${t}] of glTF as a thumbnail but the image couldn't load properly`),null;const s=new e.ImageLoader;return yield s.loadAsync((a=n,l=this.parser.options.path,"string"!=typeof a||""===a?"":(/^https?:\/\//i.test(l)&&/^\//.test(a)&&(l=l.replace(/(^https?:\/\/[^/]+).*/i,"$1")),/^(https?:)?\/\//i.test(a)||/^data:.*,.*$/i.test(a)||/^blob:.*$/i.test(a)?a:l+a))).catch((e=>(console.error(e),console.warn("VRMMetaLoaderPlugin: Failed to load a thumbnail image"),null)));var a,l}))}}class Ae{constructor(e){this.scene=e.scene,this.meta=e.meta,this.humanoid=e.humanoid,this.expressionManager=e.expressionManager,this.firstPerson=e.firstPerson,this.lookAt=e.lookAt}update(e){this.humanoid.update(),this.lookAt&&this.lookAt.update(e),this.expressionManager&&this.expressionManager.update()}}class be{constructor(e,t){var i,r,o,n,s;this.parser=e;const a=null==t?void 0:t.helperRoot,l=null==t?void 0:t.autoUpdateHumanBones;this.expressionPlugin=null!==(i=null==t?void 0:t.expressionPlugin)&&void 0!==i?i:new y(e),this.firstPersonPlugin=null!==(r=null==t?void 0:t.firstPersonPlugin)&&void 0!==r?r:new M(e),this.humanoidPlugin=null!==(o=null==t?void 0:t.humanoidPlugin)&&void 0!==o?o:new W(e,{helperRoot:a,autoUpdateHumanBones:l}),this.lookAtPlugin=null!==(n=null==t?void 0:t.lookAtPlugin)&&void 0!==n?n:new Me(e,{helperRoot:a}),this.metaPlugin=null!==(s=null==t?void 0:t.metaPlugin)&&void 0!==s?s:new Le(e)}get name(){return"VRMC_vrm"}afterRoot(e){return i(this,void 0,void 0,(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);const t=e.userData.vrmMeta,i=e.userData.vrmHumanoid;if(t&&i){const r=new Ae({scene:e.scene,expressionManager:e.userData.vrmExpressionManager,firstPerson:e.userData.vrmFirstPerson,humanoid:i,lookAt:e.userData.vrmLookAt,meta:t});e.userData.vrmCore=r}}))}}export{Ae as VRMCore,be as VRMCoreLoaderPlugin,t as VRMExpression,y as VRMExpressionLoaderPlugin,h as VRMExpressionManager,u as VRMExpressionMaterialColorType,w as VRMExpressionOverrideType,a as VRMExpressionPresetName,x as VRMFirstPerson,M as VRMFirstPersonLoaderPlugin,R as VRMFirstPersonMeshAnnotationType,E as VRMHumanBoneList,I as VRMHumanBoneName,B as VRMHumanBoneParentMap,N as VRMHumanoid,b as VRMHumanoidHelper,W as VRMHumanoidLoaderPlugin,ce as VRMLookAt,ye as VRMLookAtBoneApplier,we as VRMLookAtExpressionApplier,J as VRMLookAtHelper,Me as VRMLookAtLoaderPlugin,xe as VRMLookAtRangeMap,Re as VRMLookAtTypeName,Le as VRMMetaLoaderPlugin,F as VRMRequiredHumanBoneName};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pixiv/three-vrm-core",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The implementation of core features of VRM, for @pixiv/three-vrm",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "pixiv",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
"build": "yarn build-dev && yarn build-prod && yarn build-types",
|
|
33
33
|
"build-dev": "cross-env NODE_ENV=development rollup -c",
|
|
34
34
|
"build-prod": "cross-env NODE_ENV=production rollup -c",
|
|
35
|
-
"build-moduledev": "cross-env NODE_ENV=development ESM=1 rollup -c -o lib/three-vrm-core.module.js",
|
|
36
|
-
"build-moduleprod": "cross-env NODE_ENV=production ESM=1 rollup -c -o lib/three-vrm-core.module.min.js",
|
|
37
35
|
"build-types": "tsc --declaration --declarationDir ./types --emitDeclarationOnly && downlevel-dts types ts3.4/types",
|
|
38
36
|
"docs": "typedoc --entryPoints ./src/index.ts --out docs",
|
|
39
|
-
"
|
|
40
|
-
"lint
|
|
37
|
+
"test": "jest",
|
|
38
|
+
"lint": "eslint \"src/**/*.{ts,tsx}\" && yarn lint-examples && prettier \"src/**/*.{ts,tsx}\" --check",
|
|
39
|
+
"lint-examples": "eslint \"examples/**/*.{ts,tsx,js,html}\" --rule \"padded-blocks: error\"",
|
|
40
|
+
"lint-fix": "eslint \"src/**/*.{ts,tsx}\" --fix && eslint \"examples/**/*.{ts,tsx,js,html}\" --fix && prettier \"src/**/*.{ts,tsx}\" --write"
|
|
41
41
|
},
|
|
42
42
|
"lint-staged": {
|
|
43
43
|
"./src/**/*.{ts,tsx}": [
|
|
@@ -46,17 +46,17 @@
|
|
|
46
46
|
]
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@pixiv/types-vrm-0.0": "
|
|
50
|
-
"@pixiv/types-vrmc-vrm-1.0": "
|
|
49
|
+
"@pixiv/types-vrm-0.0": "1.0.0",
|
|
50
|
+
"@pixiv/types-vrmc-vrm-1.0": "1.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@types/three": "^0.
|
|
53
|
+
"@types/three": "^0.140.0",
|
|
54
54
|
"lint-staged": "10.5.3",
|
|
55
|
-
"three": "^0.
|
|
55
|
+
"three": "^0.140.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@types/three": "^0.
|
|
59
|
-
"three": "^0.
|
|
58
|
+
"@types/three": "^0.140.0",
|
|
59
|
+
"three": "^0.140.2"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "4d68337eb9a48a1bc53db87c9f5db7894184ce35"
|
|
62
62
|
}
|
package/ts3.4/types/VRMCore.d.ts
CHANGED
|
@@ -14,13 +14,18 @@ export declare class VRMCore {
|
|
|
14
14
|
* `THREE.Group` that contains the entire VRM.
|
|
15
15
|
*/
|
|
16
16
|
readonly scene: THREE.Group;
|
|
17
|
+
/**
|
|
18
|
+
* Contains meta fields of the VRM.
|
|
19
|
+
* You might want to refer these license fields before use your VRMs.
|
|
20
|
+
*/
|
|
21
|
+
readonly meta: VRMMeta;
|
|
17
22
|
/**
|
|
18
23
|
* Contains {@link VRMHumanoid} of the VRM.
|
|
19
|
-
* You can control each bones using {@link VRMHumanoid.
|
|
24
|
+
* You can control each bones using {@link VRMHumanoid.getNormalizedBoneNode} or {@link VRMHumanoid.getRawBoneNode}.
|
|
20
25
|
*
|
|
21
26
|
* @TODO Add a link to VRM spec
|
|
22
27
|
*/
|
|
23
|
-
readonly humanoid
|
|
28
|
+
readonly humanoid: VRMHumanoid;
|
|
24
29
|
/**
|
|
25
30
|
* Contains {@link VRMExpressionManager} of the VRM.
|
|
26
31
|
* You might want to control these facial expressions via {@link VRMExpressionManager.setValue}.
|
|
@@ -36,11 +41,6 @@ export declare class VRMCore {
|
|
|
36
41
|
* You might want to use {@link VRMLookAt.target} to control the eye direction of your VRMs.
|
|
37
42
|
*/
|
|
38
43
|
readonly lookAt?: VRMLookAt;
|
|
39
|
-
/**
|
|
40
|
-
* Contains meta fields of the VRM.
|
|
41
|
-
* You might want to refer these license fields before use your VRMs.
|
|
42
|
-
*/
|
|
43
|
-
readonly meta?: VRMMeta;
|
|
44
44
|
/**
|
|
45
45
|
* Create a new VRM instance.
|
|
46
46
|
*
|
|
@@ -8,9 +8,9 @@ import { VRMMeta } from './meta/VRMMeta';
|
|
|
8
8
|
*/
|
|
9
9
|
export interface VRMCoreParameters {
|
|
10
10
|
scene: THREE.Group;
|
|
11
|
-
|
|
11
|
+
meta: VRMMeta;
|
|
12
|
+
humanoid: VRMHumanoid;
|
|
12
13
|
expressionManager?: VRMExpressionManager;
|
|
13
14
|
firstPerson?: VRMFirstPerson;
|
|
14
15
|
lookAt?: VRMLookAt;
|
|
15
|
-
meta?: VRMMeta;
|
|
16
16
|
}
|
|
@@ -5,6 +5,9 @@ import { VRMExpressionMaterialColorType } from './VRMExpressionMaterialColorType
|
|
|
5
5
|
* A bind of expression influences to a material color.
|
|
6
6
|
*/
|
|
7
7
|
export declare class VRMExpressionMaterialColorBind implements VRMExpressionBind {
|
|
8
|
+
/**
|
|
9
|
+
* Mapping of property names from VRMC/materialColorBinds.type to three.js/Material.
|
|
10
|
+
*/
|
|
8
11
|
private static _propertyNameMapMap;
|
|
9
12
|
/**
|
|
10
13
|
* The target material.
|
|
@@ -2,7 +2,11 @@ export declare const VRMExpressionMaterialColorType: {
|
|
|
2
2
|
readonly Color: "color";
|
|
3
3
|
readonly EmissionColor: "emissionColor";
|
|
4
4
|
readonly ShadeColor: "shadeColor";
|
|
5
|
+
readonly MatcapColor: "matcapColor";
|
|
5
6
|
readonly RimColor: "rimColor";
|
|
6
7
|
readonly OutlineColor: "outlineColor";
|
|
7
8
|
};
|
|
8
9
|
export declare type VRMExpressionMaterialColorType = typeof VRMExpressionMaterialColorType[keyof typeof VRMExpressionMaterialColorType];
|
|
10
|
+
export declare const v0ExpressionMaterialColorMap: {
|
|
11
|
+
[key: string]: VRMExpressionMaterialColorType | undefined;
|
|
12
|
+
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The names of {@link VRMHumanoid} bone names.
|
|
3
|
+
*
|
|
4
|
+
* Ref: https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0/humanoid.md
|
|
5
|
+
*/
|
|
1
6
|
export declare const VRMHumanBoneName: {
|
|
2
7
|
readonly Hips: "hips";
|
|
3
8
|
readonly Spine: "spine";
|
|
@@ -24,8 +29,8 @@ export declare const VRMHumanBoneName: {
|
|
|
24
29
|
readonly RightUpperArm: "rightUpperArm";
|
|
25
30
|
readonly RightLowerArm: "rightLowerArm";
|
|
26
31
|
readonly RightHand: "rightHand";
|
|
32
|
+
readonly LeftThumbMetacarpal: "leftThumbMetacarpal";
|
|
27
33
|
readonly LeftThumbProximal: "leftThumbProximal";
|
|
28
|
-
readonly LeftThumbIntermediate: "leftThumbIntermediate";
|
|
29
34
|
readonly LeftThumbDistal: "leftThumbDistal";
|
|
30
35
|
readonly LeftIndexProximal: "leftIndexProximal";
|
|
31
36
|
readonly LeftIndexIntermediate: "leftIndexIntermediate";
|
|
@@ -39,8 +44,8 @@ export declare const VRMHumanBoneName: {
|
|
|
39
44
|
readonly LeftLittleProximal: "leftLittleProximal";
|
|
40
45
|
readonly LeftLittleIntermediate: "leftLittleIntermediate";
|
|
41
46
|
readonly LeftLittleDistal: "leftLittleDistal";
|
|
47
|
+
readonly RightThumbMetacarpal: "rightThumbMetacarpal";
|
|
42
48
|
readonly RightThumbProximal: "rightThumbProximal";
|
|
43
|
-
readonly RightThumbIntermediate: "rightThumbIntermediate";
|
|
44
49
|
readonly RightThumbDistal: "rightThumbDistal";
|
|
45
50
|
readonly RightIndexProximal: "rightIndexProximal";
|
|
46
51
|
readonly RightIndexIntermediate: "rightIndexIntermediate";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VRMHumanBoneName } from './VRMHumanBoneName';
|
|
2
|
+
/**
|
|
3
|
+
* An object that maps from {@link VRMHumanBoneName} to its parent {@link VRMHumanBoneName}.
|
|
4
|
+
*
|
|
5
|
+
* Ref: https://github.com/vrm-c/vrm-specification/blob/master/specification/VRMC_vrm-1.0/humanoid.md
|
|
6
|
+
*/
|
|
7
|
+
export declare const VRMHumanBoneParentMap: {
|
|
8
|
+
[bone in VRMHumanBoneName]: VRMHumanBoneName | null;
|
|
9
|
+
};
|
|
@@ -8,20 +8,58 @@ import { VRMPose } from './VRMPose';
|
|
|
8
8
|
*/
|
|
9
9
|
export declare class VRMHumanoid {
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Whether it copies pose from normalizedHumanBones to rawHumanBones on {@link update}.
|
|
12
|
+
* `true` by default.
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
*/
|
|
16
|
+
autoUpdateHumanBones: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* A raw rig of the VRM.
|
|
13
19
|
*/
|
|
14
|
-
|
|
20
|
+
private _rawHumanBones;
|
|
15
21
|
/**
|
|
16
|
-
* A
|
|
17
|
-
* Note that it's not compatible with {@link setPose} and {@link getPose}, since it contains non-relative values of each local transforms.
|
|
22
|
+
* A normalized rig of the VRM.
|
|
18
23
|
*/
|
|
19
|
-
|
|
24
|
+
private _normalizedHumanBones;
|
|
25
|
+
/*
|
|
26
|
+
* @deprecated Deprecated. Use either {@link rawRestPose} or {@link normalizedRestPose} instead.
|
|
27
|
+
*/
|
|
28
|
+
readonly restPose: VRMPose;
|
|
29
|
+
/*
|
|
30
|
+
* A {@link VRMPose} of its raw human bones that is its default state.
|
|
31
|
+
* Note that it's not compatible with {@link setRawPose} and {@link getRawPose}, since it contains non-relative values of each local transforms.
|
|
32
|
+
*/
|
|
33
|
+
readonly rawRestPose: VRMPose;
|
|
34
|
+
/*
|
|
35
|
+
* A {@link VRMPose} of its normalized human bones that is its default state.
|
|
36
|
+
* Note that it's not compatible with {@link setNormalizedPose} and {@link getNormalizedPose}, since it contains non-relative values of each local transforms.
|
|
37
|
+
*/
|
|
38
|
+
readonly normalizedRestPose: VRMPose;
|
|
39
|
+
/*
|
|
40
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
41
|
+
*/
|
|
42
|
+
readonly humanBones: VRMHumanBones;
|
|
43
|
+
/*
|
|
44
|
+
* A map from {@link VRMHumanBoneName} to raw {@link VRMHumanBone}s.
|
|
45
|
+
*/
|
|
46
|
+
readonly rawHumanBones: VRMHumanBones;
|
|
47
|
+
/*
|
|
48
|
+
* A map from {@link VRMHumanBoneName} to normalized {@link VRMHumanBone}s.
|
|
49
|
+
*/
|
|
50
|
+
readonly normalizedHumanBones: VRMHumanBones;
|
|
51
|
+
/*
|
|
52
|
+
* The root of normalized {@link VRMHumanBone}s.
|
|
53
|
+
*/
|
|
54
|
+
readonly normalizedHumanBonesRoot: THREE.Object3D;
|
|
20
55
|
/**
|
|
21
56
|
* Create a new {@link VRMHumanoid}.
|
|
22
|
-
* @param
|
|
57
|
+
* @param humanBones A {@link VRMHumanBones} contains all the bones of the new humanoid
|
|
58
|
+
* @param autoUpdateHumanBones Whether it copies pose from normalizedHumanBones to rawHumanBones on {@link update}. `true` by default.
|
|
23
59
|
*/
|
|
24
|
-
constructor(humanBones: VRMHumanBones
|
|
60
|
+
constructor(humanBones: VRMHumanBones, options?: {
|
|
61
|
+
autoUpdateHumanBones?: boolean;
|
|
62
|
+
});
|
|
25
63
|
/**
|
|
26
64
|
* Copy the given {@link VRMHumanoid} into this one.
|
|
27
65
|
* @param source The {@link VRMHumanoid} you want to copy
|
|
@@ -34,40 +72,111 @@ export declare class VRMHumanoid {
|
|
|
34
72
|
*/
|
|
35
73
|
clone(): VRMHumanoid;
|
|
36
74
|
/**
|
|
37
|
-
*
|
|
38
|
-
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
39
|
-
* You might want to use {@link getPose} instead.
|
|
75
|
+
* @deprecated Deprecated. Use either {@link getRawAbsolutePose} or {@link getNormalizedAbsolutePose} instead.
|
|
40
76
|
*/
|
|
41
77
|
getAbsolutePose(): VRMPose;
|
|
42
78
|
/**
|
|
43
|
-
* Return the current pose of this
|
|
79
|
+
* Return the current absolute pose of this raw human bones as a {@link VRMPose}.
|
|
80
|
+
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
81
|
+
* You might want to use {@link getRawPose} instead.
|
|
82
|
+
*/
|
|
83
|
+
getRawAbsolutePose(): VRMPose;
|
|
84
|
+
/**
|
|
85
|
+
* Return the current absolute pose of this normalized human bones as a {@link VRMPose}.
|
|
86
|
+
* Note that the output result will contain initial state of the VRM and not compatible between different models.
|
|
87
|
+
* You might want to use {@link getNormalizedPose} instead.
|
|
88
|
+
*/
|
|
89
|
+
getNormalizedAbsolutePose(): VRMPose;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Deprecated. Use either {@link getRawPose} or {@link getNormalizedPose} instead.
|
|
92
|
+
*/
|
|
93
|
+
getPose(): VRMPose;
|
|
94
|
+
/**
|
|
95
|
+
* Return the current pose of raw human bones as a {@link VRMPose}.
|
|
44
96
|
*
|
|
45
97
|
* Each transform is a local transform relative from rest pose (T-pose).
|
|
46
98
|
*/
|
|
47
|
-
|
|
99
|
+
getRawPose(): VRMPose;
|
|
100
|
+
/**
|
|
101
|
+
* Return the current pose of normalized human bones as a {@link VRMPose}.
|
|
102
|
+
*
|
|
103
|
+
* Each transform is a local transform relative from rest pose (T-pose).
|
|
104
|
+
*/
|
|
105
|
+
getNormalizedPose(): VRMPose;
|
|
106
|
+
/**
|
|
107
|
+
* @deprecated Deprecated. Use either {@link setRawPose} or {@link setNormalizedPose} instead.
|
|
108
|
+
*/
|
|
109
|
+
setPose(poseObject: VRMPose): void;
|
|
48
110
|
/**
|
|
49
|
-
* Let the
|
|
111
|
+
* Let the raw human bones do a specified pose.
|
|
50
112
|
*
|
|
51
113
|
* Each transform have to be a local transform relative from rest pose (T-pose).
|
|
52
|
-
* You can pass what you got from {@link
|
|
114
|
+
* You can pass what you got from {@link getRawPose}.
|
|
115
|
+
*
|
|
116
|
+
* If you are using {@link autoUpdateHumanBones}, you might want to use {@link setNormalizedPose} instead.
|
|
53
117
|
*
|
|
54
|
-
* @param poseObject A
|
|
118
|
+
* @param poseObject A {@link VRMPose} that represents a single pose
|
|
55
119
|
*/
|
|
56
|
-
|
|
120
|
+
setRawPose(poseObject: VRMPose): void;
|
|
121
|
+
/**
|
|
122
|
+
* Let the normalized human bones do a specified pose.
|
|
123
|
+
*
|
|
124
|
+
* Each transform have to be a local transform relative from rest pose (T-pose).
|
|
125
|
+
* You can pass what you got from {@link getNormalizedPose}.
|
|
126
|
+
*
|
|
127
|
+
* @param poseObject A {@link VRMPose} that represents a single pose
|
|
128
|
+
*/
|
|
129
|
+
setNormalizedPose(poseObject: VRMPose): void;
|
|
57
130
|
/**
|
|
58
|
-
*
|
|
131
|
+
* @deprecated Deprecated. Use either {@link resetRawPose} or {@link resetNormalizedPose} instead.
|
|
59
132
|
*/
|
|
60
133
|
resetPose(): void;
|
|
61
134
|
/**
|
|
62
|
-
*
|
|
135
|
+
* Reset the raw humanoid to its rest pose.
|
|
63
136
|
*
|
|
64
|
-
*
|
|
137
|
+
* If you are using {@link autoUpdateHumanBones}, you might want to use {@link resetNormalizedPose} instead.
|
|
138
|
+
*/
|
|
139
|
+
resetRawPose(): void;
|
|
140
|
+
/**
|
|
141
|
+
* Reset the normalized humanoid to its rest pose.
|
|
142
|
+
*/
|
|
143
|
+
resetNormalizedPose(): void;
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated Deprecated. Use either {@link getRawBone} or {@link getNormalizedBone} instead.
|
|
65
146
|
*/
|
|
66
147
|
getBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
67
148
|
/**
|
|
68
|
-
* Return a
|
|
149
|
+
* Return a raw {@link VRMHumanBone} bound to a specified {@link VRMHumanBoneName}.
|
|
150
|
+
*
|
|
151
|
+
* @param name Name of the bone you want
|
|
152
|
+
*/
|
|
153
|
+
getRawBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
154
|
+
/**
|
|
155
|
+
* Return a normalized {@link VRMHumanBone} bound to a specified {@link VRMHumanBoneName}.
|
|
69
156
|
*
|
|
70
157
|
* @param name Name of the bone you want
|
|
71
158
|
*/
|
|
159
|
+
getNormalizedBone(name: VRMHumanBoneName): VRMHumanBone | undefined;
|
|
160
|
+
/**
|
|
161
|
+
* @deprecated Deprecated. Use either {@link getRawBoneNode} or {@link getNormalizedBoneNode} instead.
|
|
162
|
+
*/
|
|
72
163
|
getBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
164
|
+
/**
|
|
165
|
+
* Return a raw bone as a `THREE.Object3D` bound to a specified {@link VRMHumanBoneName}.
|
|
166
|
+
*
|
|
167
|
+
* @param name Name of the bone you want
|
|
168
|
+
*/
|
|
169
|
+
getRawBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
170
|
+
/**
|
|
171
|
+
* Return a normalized bone as a `THREE.Object3D` bound to a specified {@link VRMHumanBoneName}.
|
|
172
|
+
*
|
|
173
|
+
* @param name Name of the bone you want
|
|
174
|
+
*/
|
|
175
|
+
getNormalizedBoneNode(name: VRMHumanBoneName): THREE.Object3D | null;
|
|
176
|
+
/**
|
|
177
|
+
* Update the humanoid component.
|
|
178
|
+
*
|
|
179
|
+
* If {@link autoUpdateHumanBones} is `true`, it transfers the pose of normalized human bones to raw human bones.
|
|
180
|
+
*/
|
|
181
|
+
update(): void;
|
|
73
182
|
}
|