Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pixiv/three-vrm-springbone

Package Overview
Dependencies
Maintainers
3
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pixiv/three-vrm-springbone - npm Package Compare versions

Comparing version 1.0.0-beta.3 to 1.0.0-beta.4

6

lib/three-vrm-springbone.min.js

@@ -1,3 +0,3 @@

/*! (c) 2020 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/master/LICENSE */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE_VRM_SPRINGBONE={},t.THREE)}(this,(function(t,e){"use strict";function i(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=i(e);class s{}const n=new r.Vector3,o=new r.Vector3;class a extends s{constructor(t){var e,i,s;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.tail=null!==(i=null==t?void 0:t.tail)&&void 0!==i?i:new r.Vector3(0,0,0),this.radius=null!==(s=null==t?void 0:t.radius)&&void 0!==s?s:1}get type(){return"capsule"}calculateCollision(t,e,i,r){n.copy(this.offset).applyMatrix4(t),o.copy(this.tail).applyMatrix4(t),o.sub(n);const s=o.lengthSq();r.copy(e).sub(n);const a=o.dot(r);a<=0||(s<=a||o.multiplyScalar(a/s),r.sub(o));const l=i+this.radius,h=r.length()-l;return r.normalize(),h}}class l extends s{constructor(t){var e,i;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.radius=null!==(i=null==t?void 0:t.radius)&&void 0!==i?i:1}get type(){return"sphere"}calculateCollision(t,e,i,r){r.copy(this.offset).applyMatrix4(t),r.negate().add(e);const s=i+this.radius,n=r.length()-s;return r.normalize(),n}}const h=new r.Vector3;class c extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentOffset=new r.Vector3,this._currentTail=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentTail.equals(this._shape.tail)||(this._currentTail.copy(this._shape.tail),t=!0),t&&this._buildPosition()}_buildPosition(){h.copy(this._currentTail).sub(this._currentOffset);const t=h.length()/this._currentRadius;for(let e=0;e<=16;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(e,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+e,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+e,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+e,t+Math.sin(i),0,Math.cos(i))}for(let e=0;e<32;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(68+e,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+e,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(h.y,Math.sqrt(h.x*h.x+h.z*h.z)),i=-Math.atan2(h.z,h.x);this.rotateZ(e),this.rotateY(i),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(68+2*t,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+2*t,68+t,68+e),this._attrIndex.setXY(200+2*t,100+t,100+e)}this._attrIndex.needsUpdate=!0}}class d extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentOffset=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.needsUpdate=!0}}class u extends r.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof l)this._geometry=new d(this.collider.shape);else{if(!(this.collider.shape instanceof a))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new c(this.collider.shape)}const e=new r.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class p extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentTail=new r.Vector3,this._springBone=t,this._attrPos=new r.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._springBone.settings.hitRadius&&(this._currentRadius=this._springBone.settings.hitRadius,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}class _ extends r.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new p(this.springBone);const e=new r.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class f extends r.Object3D{constructor(t){super(),this.shape=t}}const x=new r.Vector3,g=new r.Vector3;const v=new r.Matrix4;class y{constructor(t){this._inverseCache=new r.Matrix4,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(t,e,i)=>(this._shouldUpdateInverse=!0,t[e]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.getInverse(this.matrix),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const M=Object.freeze(new r.Matrix4),m=Object.freeze(new r.Quaternion),w=new r.Vector3,b=new r.Vector3,P=new r.Quaternion,S=new r.Matrix4,R=new r.Matrix4;class B{constructor(t,e,i={},s=[]){var n,o,a,l,h,c;this._currentTail=new r.Vector3,this._prevTail=new r.Vector3,this._nextTail=new r.Vector3,this._boneAxis=new r.Vector3,this._centerSpaceBoneLength=0,this._centerSpacePosition=new r.Vector3,this._center=null,this._parentWorldRotation=new r.Quaternion,this._initialLocalMatrix=new r.Matrix4,this._initialLocalRotation=new r.Quaternion,this._initialLocalChildPosition=new r.Vector3,this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:null!==(n=i.hitRadius)&&void 0!==n?n:0,stiffness:null!==(o=i.stiffness)&&void 0!==o?o:1,gravityPower:null!==(a=i.gravityPower)&&void 0!==a?a:0,gravityDir:null!==(h=null===(l=i.gravityDir)||void 0===l?void 0:l.clone())&&void 0!==h?h:new r.Vector3(0,-1,0),dragForce:null!==(c=i.dragForce)&&void 0!==c?c:.4},this.colliderGroups=s}get center(){return this._center}set center(t){var e;this._getMatrixCenterToWorld(S),this._currentTail.applyMatrix4(S),this._prevTail.applyMatrix4(S),this._nextTail.applyMatrix4(S),(null===(e=this._center)||void 0===e?void 0:e.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new y(this._center.matrixWorld))),this._getMatrixWorldToCenter(S),this._currentTail.applyMatrix4(S),this._prevTail.applyMatrix4(S),this._nextTail.applyMatrix4(S),S.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(S),this._centerSpaceBoneLength=w.copy(this._initialLocalChildPosition).applyMatrix4(S).sub(this._centerSpacePosition).length()}get initialLocalChildPosition(){return this._initialLocalChildPosition}setInitState(){this.bone.updateMatrix(),this.bone.updateWorldMatrix(!1,!1),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize(),this._centerSpaceBoneLength=w.copy(this._initialLocalChildPosition).applyMatrix4(this.bone.matrixWorld).sub(this._centerSpacePosition).length()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail)}update(t){if(t<=0)return;var e,i;this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this.bone.parent?(e=this.bone.parent,i=this._parentWorldRotation,e.matrixWorld.decompose(x,i,g)):this._parentWorldRotation.copy(m),this._getMatrixWorldToCenter(S),S.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(S),this._getMatrixWorldToCenter(R),R.multiply(this._getParentMatrixWorld());const r=this.settings.stiffness*t,s=b.copy(this.settings.gravityDir).multiplyScalar(this.settings.gravityPower*t);this._nextTail.copy(this._currentTail).add(w.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(w.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(R).sub(this._centerSpacePosition).normalize().multiplyScalar(r)).add(s),this._nextTail.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition),this._collision(this._nextTail),this._prevTail.copy(this._currentTail),this._currentTail.copy(this._nextTail);const n=((o=S.copy(R.multiply(this._initialLocalMatrix))).invert?o.invert():o.getInverse(v.copy(o)),o);var o;const a=P.setFromUnitVectors(this._boneAxis,w.copy(this._nextTail).applyMatrix4(n).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(a),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix)}_collision(t){this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{this._getMatrixWorldToCenter(S),S.multiply(e.matrixWorld);const i=e.shape.calculateCollision(S,t,this.settings.hitRadius,w);i<0&&(t.add(w.multiplyScalar(-i)),t.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition))}))}))}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}_getParentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:M}}
/*! (c) 2020-2021 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("three")):"function"==typeof define&&define.amd?define(["exports","three"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).THREE_VRM_SPRINGBONE={},t.THREE)}(this,(function(t,e){"use strict";function i(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var r=i(e);class s{}const n=new r.Vector3,o=new r.Vector3;class a extends s{constructor(t){var e,i,s;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.tail=null!==(i=null==t?void 0:t.tail)&&void 0!==i?i:new r.Vector3(0,0,0),this.radius=null!==(s=null==t?void 0:t.radius)&&void 0!==s?s:1}get type(){return"capsule"}calculateCollision(t,e,i,r){n.copy(this.offset).applyMatrix4(t),o.copy(this.tail).applyMatrix4(t),o.sub(n);const s=o.lengthSq();r.copy(e).sub(n);const a=o.dot(r);a<=0||(s<=a||o.multiplyScalar(a/s),r.sub(o));const l=i+this.radius,h=r.length()-l;return r.normalize(),h}}class l extends s{constructor(t){var e,i;super(),this.offset=null!==(e=null==t?void 0:t.offset)&&void 0!==e?e:new r.Vector3(0,0,0),this.radius=null!==(i=null==t?void 0:t.radius)&&void 0!==i?i:1}get type(){return"sphere"}calculateCollision(t,e,i,r){r.copy(this.offset).applyMatrix4(t),r.negate().add(e);const s=i+this.radius,n=r.length()-s;return r.normalize(),n}}const h=new r.Vector3;class c extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentOffset=new r.Vector3,this._currentTail=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentTail.equals(this._shape.tail)||(this._currentTail.copy(this._shape.tail),t=!0),t&&this._buildPosition()}_buildPosition(){h.copy(this._currentTail).sub(this._currentOffset);const t=h.length()/this._currentRadius;for(let e=0;e<=16;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(e,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+e,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+e,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+e,t+Math.sin(i),0,Math.cos(i))}for(let e=0;e<32;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(68+e,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+e,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(h.y,Math.sqrt(h.x*h.x+h.z*h.z)),i=-Math.atan2(h.z,h.x);this.rotateZ(e),this.rotateY(i),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(68+2*t,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+2*t,68+t,68+e),this._attrIndex.setXY(200+2*t,100+t,100+e)}this._attrIndex.needsUpdate=!0}}class d extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentOffset=new r.Vector3,this._shape=t,this._attrPos=new r.BufferAttribute(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.needsUpdate=!0}}class u extends r.Group{constructor(t){if(super(),this.matrixAutoUpdate=!1,this.collider=t,this.collider.shape instanceof l)this._geometry=new d(this.collider.shape);else{if(!(this.collider.shape instanceof a))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new c(this.collider.shape)}const e=new r.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class p extends r.BufferGeometry{constructor(t){super(),this._currentRadius=0,this._currentTail=new r.Vector3,this._springBone=t,this._attrPos=new r.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new r.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._springBone.settings.hitRadius&&(this._currentRadius=this._springBone.settings.hitRadius,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}class _ extends r.Group{constructor(t){super(),this.matrixAutoUpdate=!1,this.springBone=t,this._geometry=new p(this.springBone);const e=new r.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new r.LineSegments(this._geometry,e),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class f extends r.Object3D{constructor(t){super(),this.shape=t}}const x=new r.Vector3,g=new r.Vector3;const y=new r.Matrix4;function v(t){return t.invert?t.invert():t.getInverse(y.copy(t)),t}class M{constructor(t){this._inverseCache=new r.Matrix4,this._shouldUpdateInverse=!0,this.matrix=t;const e={set:(t,e,i)=>(this._shouldUpdateInverse=!0,t[e]=i,!0)};this._originalElements=t.elements,t.elements=new Proxy(t.elements,e)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),v(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const m=Object.freeze(new r.Matrix4),w=Object.freeze(new r.Quaternion),b=new r.Vector3,P=new r.Vector3,S=new r.Quaternion,R=new r.Matrix4,B=new r.Matrix4;class T{constructor(t,e,i={},s=[]){var n,o,a,l,h,c;this._currentTail=new r.Vector3,this._prevTail=new r.Vector3,this._nextTail=new r.Vector3,this._boneAxis=new r.Vector3,this._centerSpaceBoneLength=0,this._centerSpacePosition=new r.Vector3,this._center=null,this._parentWorldRotation=new r.Quaternion,this._initialLocalMatrix=new r.Matrix4,this._initialLocalRotation=new r.Quaternion,this._initialLocalChildPosition=new r.Vector3,this.bone=t,this.bone.matrixAutoUpdate=!1,this.child=e,this.settings={hitRadius:null!==(n=i.hitRadius)&&void 0!==n?n:0,stiffness:null!==(o=i.stiffness)&&void 0!==o?o:1,gravityPower:null!==(a=i.gravityPower)&&void 0!==a?a:0,gravityDir:null!==(h=null===(l=i.gravityDir)||void 0===l?void 0:l.clone())&&void 0!==h?h:new r.Vector3(0,-1,0),dragForce:null!==(c=i.dragForce)&&void 0!==c?c:.4},this.colliderGroups=s}get center(){return this._center}set center(t){var e;this._getMatrixCenterToWorld(R),this._currentTail.applyMatrix4(R),this._prevTail.applyMatrix4(R),this._nextTail.applyMatrix4(R),(null===(e=this._center)||void 0===e?void 0:e.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new M(this._center.matrixWorld))),this._getMatrixWorldToCenter(R),this._currentTail.applyMatrix4(R),this._prevTail.applyMatrix4(R),this._nextTail.applyMatrix4(R),R.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(R),this._centerSpaceBoneLength=b.copy(this._initialLocalChildPosition).applyMatrix4(R).sub(this._centerSpacePosition).length()}get initialLocalChildPosition(){return this._initialLocalChildPosition}setInitState(){this.bone.updateMatrix(),this.bone.updateWorldMatrix(!1,!1),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize(),this._centerSpaceBoneLength=b.copy(this._initialLocalChildPosition).applyMatrix4(this.bone.matrixWorld).sub(this._centerSpacePosition).length()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail)}update(t){if(t<=0)return;var e,i;this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this.bone.parent?(e=this.bone.parent,i=this._parentWorldRotation,e.matrixWorld.decompose(x,i,g)):this._parentWorldRotation.copy(w),this._getMatrixWorldToCenter(R),R.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(R),this._getMatrixWorldToCenter(B),B.multiply(this._getParentMatrixWorld());const r=this.settings.stiffness*t,s=P.copy(this.settings.gravityDir).multiplyScalar(this.settings.gravityPower*t);this._nextTail.copy(this._currentTail).add(b.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(b.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(B).sub(this._centerSpacePosition).normalize().multiplyScalar(r)).add(s),this._nextTail.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition),this._collision(this._nextTail),this._prevTail.copy(this._currentTail),this._currentTail.copy(this._nextTail);const n=v(R.copy(B.multiply(this._initialLocalMatrix))),o=S.setFromUnitVectors(this._boneAxis,b.copy(this._nextTail).applyMatrix4(n).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(o),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix)}_collision(t){this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{this._getMatrixWorldToCenter(R),R.multiply(e.matrixWorld);const i=e.shape.calculateCollision(R,t,this.settings.hitRadius,b);i<0&&(t.add(b.multiplyScalar(-i)),t.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition))}))}))}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}_getParentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:m}}
/*! *****************************************************************************

@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function T(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function I(t,e){const i=[];let r=t;for(;null!==r;)i.unshift(r),r=r.parent;i.forEach((t=>{e(t)}))}function V(t,e){t.children.forEach((t=>{e(t)||V(t,e)}))}class C{constructor(){this._springBones=new Set,this._objectSpringBonesMap=new Map}get springBones(){return this._springBones}get colliderGroups(){const t=new Set;return this._springBones.forEach((e=>{e.colliderGroups.forEach((e=>{t.add(e)}))})),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{t.add(e)}))})),Array.from(t)}addSpringBone(t){this._springBones.add(t);let e=this._objectSpringBonesMap.get(t.bone);null==e&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}deleteSpringBone(t){this._springBones.delete(t);this._objectSpringBonesMap.get(t.bone).delete(t)}setInitState(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.setInitState()))}reset(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.reset()))}update(t){const e=new Set,i=new Set;for(const r of this._springBones)this._processSpringBone(r,e,i,(e=>e.update(t))),V(r.bone,(t=>{var e,i;return(null!==(i=null===(e=this._objectSpringBonesMap.get(t))||void 0===e?void 0:e.size)&&void 0!==i?i:0)>0||(t.updateWorldMatrix(!1,!1),!1)}))}_processSpringBone(t,e,i,r){if(i.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating constraints");e.add(t);const s=this._getDependencies(t);for(const t of s)I(t,(t=>{const s=this._objectSpringBonesMap.get(t);if(s)for(const t of s)this._processSpringBone(t,e,i,r)}));r(t),i.add(t)}_getDependencies(t){const e=new Set,i=t.bone.parent;return i&&e.add(i),e}}class W{constructor(t,e){this.parser=t,this.jointHelperRoot=null==e?void 0:e.jointHelperRoot,this.colliderHelperRoot=null==e?void 0:e.colliderHelperRoot}get name(){return W.EXTENSION_NAME}afterRoot(t){return T(this,void 0,void 0,(function*(){t.userData.vrmSpringBoneManager=yield this._import(t)}))}_import(t){return T(this,void 0,void 0,(function*(){const e=yield this._v1Import(t);if(null!=e)return e;const i=yield this._v0Import(t);return null!=i?i:null}))}_v1Import(t){var e,i,s,n,o;return T(this,void 0,void 0,(function*(){if(!(-1!==(null===(e=t.parser.json.extensionsUsed)||void 0===e?void 0:e.indexOf(W.EXTENSION_NAME))))return null;const a=new C,l=yield t.parser.getDependencies("node"),h=null===(i=t.parser.json.extensions)||void 0===i?void 0:i[W.EXTENSION_NAME];if(!h)return null;if("1.0-beta"!==h.specVersion)return null;const c=null===(s=h.colliders)||void 0===s?void 0:s.map(((t,e)=>{var i,s,n,o,a;const h=l[t.node],c=t.shape;if(c.sphere)return this._importSphereCollider(h,{offset:(new r.Vector3).fromArray(null!==(i=c.sphere.offset)&&void 0!==i?i:[0,0,0]),radius:null!==(s=c.sphere.radius)&&void 0!==s?s:0});if(c.capsule)return this._importCapsuleCollider(h,{offset:(new r.Vector3).fromArray(null!==(n=c.capsule.offset)&&void 0!==n?n:[0,0,0]),radius:null!==(o=c.capsule.radius)&&void 0!==o?o:0,tail:(new r.Vector3).fromArray(null!==(a=c.capsule.tail)&&void 0!==a?a:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${e} has no valid shape`)})),d=null===(n=h.colliderGroups)||void 0===n?void 0:n.map(((t,e)=>{var i;return{colliders:(null!==(i=t.colliders)&&void 0!==i?i:[]).map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${e} attempted to use a collider #${t} but not found`);return i})),name:t.name}}));return null===(o=h.springs)||void 0===o||o.forEach(((t,e)=>{var i;const s=t.joints,n=null===(i=t.colliderGroups)||void 0===i?void 0:i.map((t=>{const i=null==d?void 0:d[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i}));let o;s.forEach((t=>{var e;if(o){const i=o.node,s=l[i],h=t.node,c=l[h],d={hitRadius:o.hitRadius,dragForce:o.dragForce,gravityPower:o.gravityPower,stiffness:o.stiffness,gravityDir:(new r.Vector3).fromArray(null!==(e=o.gravityDir)&&void 0!==e?e:[0,1,0])},u=this._importJoint(s,c,d,n);a.addSpringBone(u)}o=t}))})),t.scene.updateMatrixWorld(),a.setInitState(),a}))}_v0Import(t){var e,i,s;return T(this,void 0,void 0,(function*(){if(!(-1!==(null===(e=t.parser.json.extensionsUsed)||void 0===e?void 0:e.indexOf("VRM"))))return null;const n=null===(i=t.parser.json.extensions)||void 0===i?void 0:i.VRM,o=null==n?void 0:n.secondaryAnimation;if(!o)return null;const a=null==o?void 0:o.boneGroups;if(!a)return null;const l=new C,h=yield t.parser.getDependencies("node"),c=null===(s=o.colliderGroups)||void 0===s?void 0:s.map((t=>{var e;const i=h[t.node];return{colliders:(null!==(e=t.colliders)&&void 0!==e?e:[]).map(((t,e)=>{var s,n,o;const a=new r.Vector3(0,0,0);return t.offset&&a.set(null!==(s=t.offset.x)&&void 0!==s?s:0,null!==(n=t.offset.y)&&void 0!==n?n:0,t.offset.z?-t.offset.z:0),this._importSphereCollider(i,{offset:a,radius:null!==(o=t.radius)&&void 0!==o?o:0})}))}}));return null==a||a.forEach(((t,e)=>{const i=t.bones;i&&i.forEach((i=>{var s,n,o,a;const d=h[i],u=new r.Vector3;t.gravityDir?u.set(null!==(s=t.gravityDir.x)&&void 0!==s?s:0,null!==(n=t.gravityDir.y)&&void 0!==n?n:0,null!==(o=t.gravityDir.z)&&void 0!==o?o:0):u.set(0,-1,0);const p={hitRadius:t.hitRadius,dragForce:t.dragForce,gravityPower:t.gravityPower,stiffness:t.stiffiness,gravityDir:u},_=null===(a=t.colliderGroups)||void 0===a?void 0:a.map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i}));d.traverse((t=>{var e;const i=null!==(e=t.children[0])&&void 0!==e?e:null,r=this._importJoint(t,i,p,_);l.addSpringBone(r)}))}))})),t.scene.updateMatrixWorld(),l.setInitState(),l}))}_importJoint(t,e,i,r){const s=new B(t,e,i,r);if(this.jointHelperRoot){const t=new _(s);this.jointHelperRoot.add(t),t.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const{offset:i,radius:r}=e,s=new l({offset:i,radius:r}),n=new f(s);if(t.add(n),this.colliderHelperRoot){const t=new u(n);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return n}_importCapsuleCollider(t,e){const{offset:i,radius:r,tail:s}=e,n=new a({offset:i,radius:r,tail:s}),o=new f(n);if(t.add(o),this.colliderHelperRoot){const t=new u(o);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return o}}W.EXTENSION_NAME="VRMC_springBone",t.VRMSpringBoneCollider=f,t.VRMSpringBoneColliderHelper=u,t.VRMSpringBoneColliderShape=s,t.VRMSpringBoneColliderShapeCapsule=a,t.VRMSpringBoneColliderShapeSphere=l,t.VRMSpringBoneJoint=B,t.VRMSpringBoneJointHelper=_,t.VRMSpringBoneLoaderPlugin=W,t.VRMSpringBoneManager=C,Object.defineProperty(t,"__esModule",{value:!0}),Object.assign(e,t)}));
***************************************************************************** */function I(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function C(t,e){const i=[];let r=t;for(;null!==r;)i.unshift(r),r=r.parent;i.forEach((t=>{e(t)}))}function V(t,e){t.children.forEach((t=>{e(t)||V(t,e)}))}class W{constructor(){this._springBones=new Set,this._objectSpringBonesMap=new Map}get springBones(){return this._springBones}get colliderGroups(){const t=new Set;return this._springBones.forEach((e=>{e.colliderGroups.forEach((e=>{t.add(e)}))})),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{t.add(e)}))})),Array.from(t)}addSpringBone(t){this._springBones.add(t);let e=this._objectSpringBonesMap.get(t.bone);null==e&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}deleteSpringBone(t){this._springBones.delete(t);this._objectSpringBonesMap.get(t.bone).delete(t)}setInitState(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.setInitState()))}reset(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.reset()))}update(t){const e=new Set,i=new Set;for(const r of this._springBones)this._processSpringBone(r,e,i,(e=>e.update(t))),V(r.bone,(t=>{var e,i;return(null!==(i=null===(e=this._objectSpringBonesMap.get(t))||void 0===e?void 0:e.size)&&void 0!==i?i:0)>0||(t.updateWorldMatrix(!1,!1),!1)}))}_processSpringBone(t,e,i,r){if(i.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating constraints");e.add(t);const s=this._getDependencies(t);for(const t of s)C(t,(t=>{const s=this._objectSpringBonesMap.get(t);if(s)for(const t of s)this._processSpringBone(t,e,i,r)}));r(t),i.add(t)}_getDependencies(t){const e=new Set,i=t.bone.parent;return i&&e.add(i),e}}class E{constructor(t,e){this.parser=t,this.jointHelperRoot=null==e?void 0:e.jointHelperRoot,this.colliderHelperRoot=null==e?void 0:e.colliderHelperRoot}get name(){return E.EXTENSION_NAME}afterRoot(t){return I(this,void 0,void 0,(function*(){t.userData.vrmSpringBoneManager=yield this._import(t)}))}_import(t){return I(this,void 0,void 0,(function*(){const e=yield this._v1Import(t);if(null!=e)return e;const i=yield this._v0Import(t);return null!=i?i:null}))}_v1Import(t){var e,i,s,n,o;return I(this,void 0,void 0,(function*(){if(!(-1!==(null===(e=t.parser.json.extensionsUsed)||void 0===e?void 0:e.indexOf(E.EXTENSION_NAME))))return null;const a=new W,l=yield t.parser.getDependencies("node"),h=null===(i=t.parser.json.extensions)||void 0===i?void 0:i[E.EXTENSION_NAME];if(!h)return null;if("1.0-beta"!==h.specVersion)return null;const c=null===(s=h.colliders)||void 0===s?void 0:s.map(((t,e)=>{var i,s,n,o,a;const h=l[t.node],c=t.shape;if(c.sphere)return this._importSphereCollider(h,{offset:(new r.Vector3).fromArray(null!==(i=c.sphere.offset)&&void 0!==i?i:[0,0,0]),radius:null!==(s=c.sphere.radius)&&void 0!==s?s:0});if(c.capsule)return this._importCapsuleCollider(h,{offset:(new r.Vector3).fromArray(null!==(n=c.capsule.offset)&&void 0!==n?n:[0,0,0]),radius:null!==(o=c.capsule.radius)&&void 0!==o?o:0,tail:(new r.Vector3).fromArray(null!==(a=c.capsule.tail)&&void 0!==a?a:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${e} has no valid shape`)})),d=null===(n=h.colliderGroups)||void 0===n?void 0:n.map(((t,e)=>{var i;return{colliders:(null!==(i=t.colliders)&&void 0!==i?i:[]).map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${e} attempted to use a collider #${t} but not found`);return i})),name:t.name}}));return null===(o=h.springs)||void 0===o||o.forEach(((t,e)=>{var i;const s=t.joints,n=null===(i=t.colliderGroups)||void 0===i?void 0:i.map((t=>{const i=null==d?void 0:d[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i}));let o;s.forEach((t=>{var e;if(o){const i=o.node,s=l[i],h=t.node,c=l[h],d={hitRadius:o.hitRadius,dragForce:o.dragForce,gravityPower:o.gravityPower,stiffness:o.stiffness,gravityDir:(new r.Vector3).fromArray(null!==(e=o.gravityDir)&&void 0!==e?e:[0,1,0])},u=this._importJoint(s,c,d,n);a.addSpringBone(u)}o=t}))})),t.scene.updateMatrixWorld(),a.setInitState(),a}))}_v0Import(t){var e,i,s;return I(this,void 0,void 0,(function*(){if(!(-1!==(null===(e=t.parser.json.extensionsUsed)||void 0===e?void 0:e.indexOf("VRM"))))return null;const n=null===(i=t.parser.json.extensions)||void 0===i?void 0:i.VRM,o=null==n?void 0:n.secondaryAnimation;if(!o)return null;const a=null==o?void 0:o.boneGroups;if(!a)return null;const l=new W,h=yield t.parser.getDependencies("node"),c=null===(s=o.colliderGroups)||void 0===s?void 0:s.map((t=>{var e;const i=h[t.node];return{colliders:(null!==(e=t.colliders)&&void 0!==e?e:[]).map(((t,e)=>{var s,n,o;const a=new r.Vector3(0,0,0);return t.offset&&a.set(null!==(s=t.offset.x)&&void 0!==s?s:0,null!==(n=t.offset.y)&&void 0!==n?n:0,t.offset.z?-t.offset.z:0),this._importSphereCollider(i,{offset:a,radius:null!==(o=t.radius)&&void 0!==o?o:0})}))}}));return null==a||a.forEach(((t,e)=>{const i=t.bones;i&&i.forEach((i=>{var s,n,o,a;const d=h[i],u=new r.Vector3;t.gravityDir?u.set(null!==(s=t.gravityDir.x)&&void 0!==s?s:0,null!==(n=t.gravityDir.y)&&void 0!==n?n:0,null!==(o=t.gravityDir.z)&&void 0!==o?o:0):u.set(0,-1,0);const p={hitRadius:t.hitRadius,dragForce:t.dragForce,gravityPower:t.gravityPower,stiffness:t.stiffiness,gravityDir:u},_=null===(a=t.colliderGroups)||void 0===a?void 0:a.map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${e} attempted to use a colliderGroup ${t} but not found`);return i}));d.traverse((t=>{var e;const i=null!==(e=t.children[0])&&void 0!==e?e:null,r=this._importJoint(t,i,p,_);l.addSpringBone(r)}))}))})),t.scene.updateMatrixWorld(),l.setInitState(),l}))}_importJoint(t,e,i,r){const s=new T(t,e,i,r);if(this.jointHelperRoot){const t=new _(s);this.jointHelperRoot.add(t),t.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const{offset:i,radius:r}=e,s=new l({offset:i,radius:r}),n=new f(s);if(t.add(n),this.colliderHelperRoot){const t=new u(n);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return n}_importCapsuleCollider(t,e){const{offset:i,radius:r,tail:s}=e,n=new a({offset:i,radius:r,tail:s}),o=new f(n);if(t.add(o),this.colliderHelperRoot){const t=new u(o);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return o}}E.EXTENSION_NAME="VRMC_springBone",t.VRMSpringBoneCollider=f,t.VRMSpringBoneColliderHelper=u,t.VRMSpringBoneColliderShape=s,t.VRMSpringBoneColliderShapeCapsule=a,t.VRMSpringBoneColliderShapeSphere=l,t.VRMSpringBoneJoint=T,t.VRMSpringBoneJointHelper=_,t.VRMSpringBoneLoaderPlugin=E,t.VRMSpringBoneManager=W,Object.defineProperty(t,"__esModule",{value:!0}),Object.assign(e,t)}));

@@ -1,3 +0,3 @@

/*! (c) 2020 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/master/LICENSE */
import*as t from"three";class e{}const i=new t.Vector3,r=new t.Vector3;class s extends e{constructor(e){var i,r,s;super(),this.offset=null!==(i=null==e?void 0:e.offset)&&void 0!==i?i:new t.Vector3(0,0,0),this.tail=null!==(r=null==e?void 0:e.tail)&&void 0!==r?r:new t.Vector3(0,0,0),this.radius=null!==(s=null==e?void 0:e.radius)&&void 0!==s?s:1}get type(){return"capsule"}calculateCollision(t,e,s,n){i.copy(this.offset).applyMatrix4(t),r.copy(this.tail).applyMatrix4(t),r.sub(i);const o=r.lengthSq();n.copy(e).sub(i);const a=r.dot(n);a<=0||(o<=a||r.multiplyScalar(a/o),n.sub(r));const l=s+this.radius,h=n.length()-l;return n.normalize(),h}}class n extends e{constructor(e){var i,r;super(),this.offset=null!==(i=null==e?void 0:e.offset)&&void 0!==i?i:new t.Vector3(0,0,0),this.radius=null!==(r=null==e?void 0:e.radius)&&void 0!==r?r:1}get type(){return"sphere"}calculateCollision(t,e,i,r){r.copy(this.offset).applyMatrix4(t),r.negate().add(e);const s=i+this.radius,n=r.length()-s;return r.normalize(),n}}const o=new t.Vector3;class a extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentOffset=new t.Vector3,this._currentTail=new t.Vector3,this._shape=e,this._attrPos=new t.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentTail.equals(this._shape.tail)||(this._currentTail.copy(this._shape.tail),t=!0),t&&this._buildPosition()}_buildPosition(){o.copy(this._currentTail).sub(this._currentOffset);const t=o.length()/this._currentRadius;for(let e=0;e<=16;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(e,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+e,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+e,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+e,t+Math.sin(i),0,Math.cos(i))}for(let e=0;e<32;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(68+e,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+e,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(o.y,Math.sqrt(o.x*o.x+o.z*o.z)),i=-Math.atan2(o.z,o.x);this.rotateZ(e),this.rotateY(i),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(68+2*t,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+2*t,68+t,68+e),this._attrIndex.setXY(200+2*t,100+t,100+e)}this._attrIndex.needsUpdate=!0}}class l extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentOffset=new t.Vector3,this._shape=e,this._attrPos=new t.BufferAttribute(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.needsUpdate=!0}}class h extends t.Group{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof n)this._geometry=new l(this.collider.shape);else{if(!(this.collider.shape instanceof s))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new a(this.collider.shape)}const i=new t.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new t.LineSegments(this._geometry,i),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class c extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentTail=new t.Vector3,this._springBone=e,this._attrPos=new t.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._springBone.settings.hitRadius&&(this._currentRadius=this._springBone.settings.hitRadius,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}class d extends t.Group{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new c(this.springBone);const i=new t.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new t.LineSegments(this._geometry,i),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class u extends t.Object3D{constructor(t){super(),this.shape=t}}const p=new t.Vector3,_=new t.Vector3;const f=new t.Matrix4;class x{constructor(e){this._inverseCache=new t.Matrix4,this._shouldUpdateInverse=!0,this.matrix=e;const i={set:(t,e,i)=>(this._shouldUpdateInverse=!0,t[e]=i,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,i)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.getInverse(this.matrix),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const v=Object.freeze(new t.Matrix4),g=Object.freeze(new t.Quaternion),y=new t.Vector3,m=new t.Vector3,M=new t.Quaternion,w=new t.Matrix4,b=new t.Matrix4;class P{constructor(e,i,r={},s=[]){var n,o,a,l,h,c;this._currentTail=new t.Vector3,this._prevTail=new t.Vector3,this._nextTail=new t.Vector3,this._boneAxis=new t.Vector3,this._centerSpaceBoneLength=0,this._centerSpacePosition=new t.Vector3,this._center=null,this._parentWorldRotation=new t.Quaternion,this._initialLocalMatrix=new t.Matrix4,this._initialLocalRotation=new t.Quaternion,this._initialLocalChildPosition=new t.Vector3,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=i,this.settings={hitRadius:null!==(n=r.hitRadius)&&void 0!==n?n:0,stiffness:null!==(o=r.stiffness)&&void 0!==o?o:1,gravityPower:null!==(a=r.gravityPower)&&void 0!==a?a:0,gravityDir:null!==(h=null===(l=r.gravityDir)||void 0===l?void 0:l.clone())&&void 0!==h?h:new t.Vector3(0,-1,0),dragForce:null!==(c=r.dragForce)&&void 0!==c?c:.4},this.colliderGroups=s}get center(){return this._center}set center(t){var e;this._getMatrixCenterToWorld(w),this._currentTail.applyMatrix4(w),this._prevTail.applyMatrix4(w),this._nextTail.applyMatrix4(w),(null===(e=this._center)||void 0===e?void 0:e.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new x(this._center.matrixWorld))),this._getMatrixWorldToCenter(w),this._currentTail.applyMatrix4(w),this._prevTail.applyMatrix4(w),this._nextTail.applyMatrix4(w),w.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(w),this._centerSpaceBoneLength=y.copy(this._initialLocalChildPosition).applyMatrix4(w).sub(this._centerSpacePosition).length()}get initialLocalChildPosition(){return this._initialLocalChildPosition}setInitState(){this.bone.updateMatrix(),this.bone.updateWorldMatrix(!1,!1),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize(),this._centerSpaceBoneLength=y.copy(this._initialLocalChildPosition).applyMatrix4(this.bone.matrixWorld).sub(this._centerSpacePosition).length()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail)}update(t){if(t<=0)return;var e,i;this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this.bone.parent?(e=this.bone.parent,i=this._parentWorldRotation,e.matrixWorld.decompose(p,i,_)):this._parentWorldRotation.copy(g),this._getMatrixWorldToCenter(w),w.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(w),this._getMatrixWorldToCenter(b),b.multiply(this._getParentMatrixWorld());const r=this.settings.stiffness*t,s=m.copy(this.settings.gravityDir).multiplyScalar(this.settings.gravityPower*t);this._nextTail.copy(this._currentTail).add(y.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(y.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(b).sub(this._centerSpacePosition).normalize().multiplyScalar(r)).add(s),this._nextTail.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition),this._collision(this._nextTail),this._prevTail.copy(this._currentTail),this._currentTail.copy(this._nextTail);const n=((o=w.copy(b.multiply(this._initialLocalMatrix))).invert?o.invert():o.getInverse(f.copy(o)),o);var o;const a=M.setFromUnitVectors(this._boneAxis,y.copy(this._nextTail).applyMatrix4(n).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(a),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix)}_collision(t){this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{this._getMatrixWorldToCenter(w),w.multiply(e.matrixWorld);const i=e.shape.calculateCollision(w,t,this.settings.hitRadius,y);i<0&&(t.add(y.multiplyScalar(-i)),t.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition))}))}))}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}_getParentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:v}}
/*! (c) 2020-2021 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
import*as t from"three";class e{}const i=new t.Vector3,r=new t.Vector3;class s extends e{constructor(e){var i,r,s;super(),this.offset=null!==(i=null==e?void 0:e.offset)&&void 0!==i?i:new t.Vector3(0,0,0),this.tail=null!==(r=null==e?void 0:e.tail)&&void 0!==r?r:new t.Vector3(0,0,0),this.radius=null!==(s=null==e?void 0:e.radius)&&void 0!==s?s:1}get type(){return"capsule"}calculateCollision(t,e,s,n){i.copy(this.offset).applyMatrix4(t),r.copy(this.tail).applyMatrix4(t),r.sub(i);const o=r.lengthSq();n.copy(e).sub(i);const a=r.dot(n);a<=0||(o<=a||r.multiplyScalar(a/o),n.sub(r));const l=s+this.radius,h=n.length()-l;return n.normalize(),h}}class n extends e{constructor(e){var i,r;super(),this.offset=null!==(i=null==e?void 0:e.offset)&&void 0!==i?i:new t.Vector3(0,0,0),this.radius=null!==(r=null==e?void 0:e.radius)&&void 0!==r?r:1}get type(){return"sphere"}calculateCollision(t,e,i,r){r.copy(this.offset).applyMatrix4(t),r.negate().add(e);const s=i+this.radius,n=r.length()-s;return r.normalize(),n}}const o=new t.Vector3;class a extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentOffset=new t.Vector3,this._currentTail=new t.Vector3,this._shape=e,this._attrPos=new t.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),this._currentTail.equals(this._shape.tail)||(this._currentTail.copy(this._shape.tail),t=!0),t&&this._buildPosition()}_buildPosition(){o.copy(this._currentTail).sub(this._currentOffset);const t=o.length()/this._currentRadius;for(let e=0;e<=16;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(e,-Math.sin(i),-Math.cos(i),0),this._attrPos.setXYZ(17+e,t+Math.sin(i),Math.cos(i),0),this._attrPos.setXYZ(34+e,-Math.sin(i),0,-Math.cos(i)),this._attrPos.setXYZ(51+e,t+Math.sin(i),0,Math.cos(i))}for(let e=0;e<32;e++){const i=e/16*Math.PI;this._attrPos.setXYZ(68+e,0,Math.sin(i),Math.cos(i)),this._attrPos.setXYZ(100+e,t,Math.sin(i),Math.cos(i))}const e=Math.atan2(o.y,Math.sqrt(o.x*o.x+o.z*o.z)),i=-Math.atan2(o.z,o.x);this.rotateZ(e),this.rotateY(i),this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<34;t++){const e=(t+1)%34;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(68+2*t,34+t,34+e)}for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(136+2*t,68+t,68+e),this._attrIndex.setXY(200+2*t,100+t,100+e)}this._attrIndex.needsUpdate=!0}}class l extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentOffset=new t.Vector3,this._shape=e,this._attrPos=new t.BufferAttribute(new Float32Array(288),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(192),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._shape.radius&&(this._currentRadius=this._shape.radius,t=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentOffset.x,this._currentOffset.y,this._currentOffset.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.needsUpdate=!0}}class h extends t.Group{constructor(e){if(super(),this.matrixAutoUpdate=!1,this.collider=e,this.collider.shape instanceof n)this._geometry=new l(this.collider.shape);else{if(!(this.collider.shape instanceof s))throw new Error("VRMSpringBoneColliderHelper: Unknown collider shape type detected");this._geometry=new a(this.collider.shape)}const i=new t.LineBasicMaterial({color:16711935,depthTest:!1,depthWrite:!1});this._line=new t.LineSegments(this._geometry,i),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.collider.updateWorldMatrix(!0,!1),this.matrix.copy(this.collider.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class c extends t.BufferGeometry{constructor(e){super(),this._currentRadius=0,this._currentTail=new t.Vector3,this._springBone=e,this._attrPos=new t.BufferAttribute(new Float32Array(294),3),this.setAttribute("position",this._attrPos),this._attrIndex=new t.BufferAttribute(new Uint16Array(194),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let t=!1;this._currentRadius!==this._springBone.settings.hitRadius&&(this._currentRadius=this._springBone.settings.hitRadius,t=!0),this._currentTail.equals(this._springBone.initialLocalChildPosition)||(this._currentTail.copy(this._springBone.initialLocalChildPosition),t=!0),t&&this._buildPosition()}_buildPosition(){for(let t=0;t<32;t++){const e=t/16*Math.PI;this._attrPos.setXYZ(t,Math.cos(e),Math.sin(e),0),this._attrPos.setXYZ(32+t,0,Math.cos(e),Math.sin(e)),this._attrPos.setXYZ(64+t,Math.sin(e),0,Math.cos(e))}this.scale(this._currentRadius,this._currentRadius,this._currentRadius),this.translate(this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.setXYZ(96,0,0,0),this._attrPos.setXYZ(97,this._currentTail.x,this._currentTail.y,this._currentTail.z),this._attrPos.needsUpdate=!0}_buildIndex(){for(let t=0;t<32;t++){const e=(t+1)%32;this._attrIndex.setXY(2*t,t,e),this._attrIndex.setXY(64+2*t,32+t,32+e),this._attrIndex.setXY(128+2*t,64+t,64+e)}this._attrIndex.setXY(192,96,97),this._attrIndex.needsUpdate=!0}}class d extends t.Group{constructor(e){super(),this.matrixAutoUpdate=!1,this.springBone=e,this._geometry=new c(this.springBone);const i=new t.LineBasicMaterial({color:16776960,depthTest:!1,depthWrite:!1});this._line=new t.LineSegments(this._geometry,i),this.add(this._line)}dispose(){this._geometry.dispose()}updateMatrixWorld(t){this.springBone.bone.updateWorldMatrix(!0,!1),this.matrix.copy(this.springBone.bone.matrixWorld),this._geometry.update(),super.updateMatrixWorld(t)}}class u extends t.Object3D{constructor(t){super(),this.shape=t}}const p=new t.Vector3,_=new t.Vector3;const f=new t.Matrix4;function x(t){return t.invert?t.invert():t.getInverse(f.copy(t)),t}class v{constructor(e){this._inverseCache=new t.Matrix4,this._shouldUpdateInverse=!0,this.matrix=e;const i={set:(t,e,i)=>(this._shouldUpdateInverse=!0,t[e]=i,!0)};this._originalElements=e.elements,e.elements=new Proxy(e.elements,i)}get inverse(){return this._shouldUpdateInverse&&(this._inverseCache.copy(this.matrix),x(this._inverseCache),this._shouldUpdateInverse=!1),this._inverseCache}revert(){this.matrix.elements=this._originalElements}}const y=Object.freeze(new t.Matrix4),g=Object.freeze(new t.Quaternion),m=new t.Vector3,M=new t.Vector3,w=new t.Quaternion,b=new t.Matrix4,P=new t.Matrix4;class S{constructor(e,i,r={},s=[]){var n,o,a,l,h,c;this._currentTail=new t.Vector3,this._prevTail=new t.Vector3,this._nextTail=new t.Vector3,this._boneAxis=new t.Vector3,this._centerSpaceBoneLength=0,this._centerSpacePosition=new t.Vector3,this._center=null,this._parentWorldRotation=new t.Quaternion,this._initialLocalMatrix=new t.Matrix4,this._initialLocalRotation=new t.Quaternion,this._initialLocalChildPosition=new t.Vector3,this.bone=e,this.bone.matrixAutoUpdate=!1,this.child=i,this.settings={hitRadius:null!==(n=r.hitRadius)&&void 0!==n?n:0,stiffness:null!==(o=r.stiffness)&&void 0!==o?o:1,gravityPower:null!==(a=r.gravityPower)&&void 0!==a?a:0,gravityDir:null!==(h=null===(l=r.gravityDir)||void 0===l?void 0:l.clone())&&void 0!==h?h:new t.Vector3(0,-1,0),dragForce:null!==(c=r.dragForce)&&void 0!==c?c:.4},this.colliderGroups=s}get center(){return this._center}set center(t){var e;this._getMatrixCenterToWorld(b),this._currentTail.applyMatrix4(b),this._prevTail.applyMatrix4(b),this._nextTail.applyMatrix4(b),(null===(e=this._center)||void 0===e?void 0:e.userData.inverseCacheProxy)&&(this._center.userData.inverseCacheProxy.revert(),delete this._center.userData.inverseCacheProxy),this._center=t,this._center&&(this._center.userData.inverseCacheProxy||(this._center.userData.inverseCacheProxy=new v(this._center.matrixWorld))),this._getMatrixWorldToCenter(b),this._currentTail.applyMatrix4(b),this._prevTail.applyMatrix4(b),this._nextTail.applyMatrix4(b),b.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(b),this._centerSpaceBoneLength=m.copy(this._initialLocalChildPosition).applyMatrix4(b).sub(this._centerSpacePosition).length()}get initialLocalChildPosition(){return this._initialLocalChildPosition}setInitState(){this.bone.updateMatrix(),this.bone.updateWorldMatrix(!1,!1),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this._initialLocalMatrix.copy(this.bone.matrix),this._initialLocalRotation.copy(this.bone.quaternion),this.child?this._initialLocalChildPosition.copy(this.child.position):this._initialLocalChildPosition.copy(this.bone.position).normalize().multiplyScalar(.07),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail),this._boneAxis.copy(this._initialLocalChildPosition).normalize(),this._centerSpaceBoneLength=m.copy(this._initialLocalChildPosition).applyMatrix4(this.bone.matrixWorld).sub(this._centerSpacePosition).length()}reset(){this.bone.quaternion.copy(this._initialLocalRotation),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this._centerSpacePosition.setFromMatrixPosition(this.bone.matrixWorld),this.bone.localToWorld(this._currentTail.copy(this._initialLocalChildPosition)),this._prevTail.copy(this._currentTail),this._nextTail.copy(this._currentTail)}update(t){if(t<=0)return;var e,i;this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix),this.bone.parent?(e=this.bone.parent,i=this._parentWorldRotation,e.matrixWorld.decompose(p,i,_)):this._parentWorldRotation.copy(g),this._getMatrixWorldToCenter(b),b.multiply(this.bone.matrixWorld),this._centerSpacePosition.setFromMatrixPosition(b),this._getMatrixWorldToCenter(P),P.multiply(this._getParentMatrixWorld());const r=this.settings.stiffness*t,s=M.copy(this.settings.gravityDir).multiplyScalar(this.settings.gravityPower*t);this._nextTail.copy(this._currentTail).add(m.copy(this._currentTail).sub(this._prevTail).multiplyScalar(1-this.settings.dragForce)).add(m.copy(this._boneAxis).applyMatrix4(this._initialLocalMatrix).applyMatrix4(P).sub(this._centerSpacePosition).normalize().multiplyScalar(r)).add(s),this._nextTail.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition),this._collision(this._nextTail),this._prevTail.copy(this._currentTail),this._currentTail.copy(this._nextTail);const n=x(b.copy(P.multiply(this._initialLocalMatrix))),o=w.setFromUnitVectors(this._boneAxis,m.copy(this._nextTail).applyMatrix4(n).normalize());this.bone.quaternion.copy(this._initialLocalRotation).multiply(o),this.bone.updateMatrix(),this.bone.matrixWorld.multiplyMatrices(this._getParentMatrixWorld(),this.bone.matrix)}_collision(t){this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{this._getMatrixWorldToCenter(b),b.multiply(e.matrixWorld);const i=e.shape.calculateCollision(b,t,this.settings.hitRadius,m);i<0&&(t.add(m.multiplyScalar(-i)),t.sub(this._centerSpacePosition).normalize().multiplyScalar(this._centerSpaceBoneLength).add(this._centerSpacePosition))}))}))}_getMatrixCenterToWorld(t){return this._center?t.copy(this._center.matrixWorld):t.identity(),t}_getMatrixWorldToCenter(t){return this._center?t.copy(this._center.userData.inverseCacheProxy.inverse):t.identity(),t}_getParentMatrixWorld(){return this.bone.parent?this.bone.parent.matrixWorld:y}}
/*! *****************************************************************************

@@ -16,2 +16,2 @@ Copyright (c) Microsoft Corporation.

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function S(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function T(t,e){const i=[];let r=t;for(;null!==r;)i.unshift(r),r=r.parent;i.forEach((t=>{e(t)}))}function R(t,e){t.children.forEach((t=>{e(t)||R(t,e)}))}class B{constructor(){this._springBones=new Set,this._objectSpringBonesMap=new Map}get springBones(){return this._springBones}get colliderGroups(){const t=new Set;return this._springBones.forEach((e=>{e.colliderGroups.forEach((e=>{t.add(e)}))})),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{t.add(e)}))})),Array.from(t)}addSpringBone(t){this._springBones.add(t);let e=this._objectSpringBonesMap.get(t.bone);null==e&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}deleteSpringBone(t){this._springBones.delete(t);this._objectSpringBonesMap.get(t.bone).delete(t)}setInitState(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.setInitState()))}reset(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.reset()))}update(t){const e=new Set,i=new Set;for(const r of this._springBones)this._processSpringBone(r,e,i,(e=>e.update(t))),R(r.bone,(t=>{var e,i;return(null!==(i=null===(e=this._objectSpringBonesMap.get(t))||void 0===e?void 0:e.size)&&void 0!==i?i:0)>0||(t.updateWorldMatrix(!1,!1),!1)}))}_processSpringBone(t,e,i,r){if(i.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating constraints");e.add(t);const s=this._getDependencies(t);for(const t of s)T(t,(t=>{const s=this._objectSpringBonesMap.get(t);if(s)for(const t of s)this._processSpringBone(t,e,i,r)}));r(t),i.add(t)}_getDependencies(t){const e=new Set,i=t.bone.parent;return i&&e.add(i),e}}class I{constructor(t,e){this.parser=t,this.jointHelperRoot=null==e?void 0:e.jointHelperRoot,this.colliderHelperRoot=null==e?void 0:e.colliderHelperRoot}get name(){return I.EXTENSION_NAME}afterRoot(t){return S(this,void 0,void 0,(function*(){t.userData.vrmSpringBoneManager=yield this._import(t)}))}_import(t){return S(this,void 0,void 0,(function*(){const e=yield this._v1Import(t);if(null!=e)return e;const i=yield this._v0Import(t);return null!=i?i:null}))}_v1Import(e){var i,r,s,n,o;return S(this,void 0,void 0,(function*(){if(!(-1!==(null===(i=e.parser.json.extensionsUsed)||void 0===i?void 0:i.indexOf(I.EXTENSION_NAME))))return null;const a=new B,l=yield e.parser.getDependencies("node"),h=null===(r=e.parser.json.extensions)||void 0===r?void 0:r[I.EXTENSION_NAME];if(!h)return null;if("1.0-beta"!==h.specVersion)return null;const c=null===(s=h.colliders)||void 0===s?void 0:s.map(((e,i)=>{var r,s,n,o,a;const h=l[e.node],c=e.shape;if(c.sphere)return this._importSphereCollider(h,{offset:(new t.Vector3).fromArray(null!==(r=c.sphere.offset)&&void 0!==r?r:[0,0,0]),radius:null!==(s=c.sphere.radius)&&void 0!==s?s:0});if(c.capsule)return this._importCapsuleCollider(h,{offset:(new t.Vector3).fromArray(null!==(n=c.capsule.offset)&&void 0!==n?n:[0,0,0]),radius:null!==(o=c.capsule.radius)&&void 0!==o?o:0,tail:(new t.Vector3).fromArray(null!==(a=c.capsule.tail)&&void 0!==a?a:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${i} has no valid shape`)})),d=null===(n=h.colliderGroups)||void 0===n?void 0:n.map(((t,e)=>{var i;return{colliders:(null!==(i=t.colliders)&&void 0!==i?i:[]).map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${e} attempted to use a collider #${t} but not found`);return i})),name:t.name}}));return null===(o=h.springs)||void 0===o||o.forEach(((e,i)=>{var r;const s=e.joints,n=null===(r=e.colliderGroups)||void 0===r?void 0:r.map((t=>{const e=null==d?void 0:d[t];if(null==e)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${i} attempted to use a colliderGroup ${t} but not found`);return e}));let o;s.forEach((e=>{var i;if(o){const r=o.node,s=l[r],h=e.node,c=l[h],d={hitRadius:o.hitRadius,dragForce:o.dragForce,gravityPower:o.gravityPower,stiffness:o.stiffness,gravityDir:(new t.Vector3).fromArray(null!==(i=o.gravityDir)&&void 0!==i?i:[0,1,0])},u=this._importJoint(s,c,d,n);a.addSpringBone(u)}o=e}))})),e.scene.updateMatrixWorld(),a.setInitState(),a}))}_v0Import(e){var i,r,s;return S(this,void 0,void 0,(function*(){if(!(-1!==(null===(i=e.parser.json.extensionsUsed)||void 0===i?void 0:i.indexOf("VRM"))))return null;const n=null===(r=e.parser.json.extensions)||void 0===r?void 0:r.VRM,o=null==n?void 0:n.secondaryAnimation;if(!o)return null;const a=null==o?void 0:o.boneGroups;if(!a)return null;const l=new B,h=yield e.parser.getDependencies("node"),c=null===(s=o.colliderGroups)||void 0===s?void 0:s.map((e=>{var i;const r=h[e.node];return{colliders:(null!==(i=e.colliders)&&void 0!==i?i:[]).map(((e,i)=>{var s,n,o;const a=new t.Vector3(0,0,0);return e.offset&&a.set(null!==(s=e.offset.x)&&void 0!==s?s:0,null!==(n=e.offset.y)&&void 0!==n?n:0,e.offset.z?-e.offset.z:0),this._importSphereCollider(r,{offset:a,radius:null!==(o=e.radius)&&void 0!==o?o:0})}))}}));return null==a||a.forEach(((e,i)=>{const r=e.bones;r&&r.forEach((r=>{var s,n,o,a;const d=h[r],u=new t.Vector3;e.gravityDir?u.set(null!==(s=e.gravityDir.x)&&void 0!==s?s:0,null!==(n=e.gravityDir.y)&&void 0!==n?n:0,null!==(o=e.gravityDir.z)&&void 0!==o?o:0):u.set(0,-1,0);const p={hitRadius:e.hitRadius,dragForce:e.dragForce,gravityPower:e.gravityPower,stiffness:e.stiffiness,gravityDir:u},_=null===(a=e.colliderGroups)||void 0===a?void 0:a.map((t=>{const e=null==c?void 0:c[t];if(null==e)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${i} attempted to use a colliderGroup ${t} but not found`);return e}));d.traverse((t=>{var e;const i=null!==(e=t.children[0])&&void 0!==e?e:null,r=this._importJoint(t,i,p,_);l.addSpringBone(r)}))}))})),e.scene.updateMatrixWorld(),l.setInitState(),l}))}_importJoint(t,e,i,r){const s=new P(t,e,i,r);if(this.jointHelperRoot){const t=new d(s);this.jointHelperRoot.add(t),t.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const{offset:i,radius:r}=e,s=new n({offset:i,radius:r}),o=new u(s);if(t.add(o),this.colliderHelperRoot){const t=new h(o);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(t,e){const{offset:i,radius:r,tail:n}=e,o=new s({offset:i,radius:r,tail:n}),a=new u(o);if(t.add(a),this.colliderHelperRoot){const t=new h(a);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return a}}I.EXTENSION_NAME="VRMC_springBone";export{u as VRMSpringBoneCollider,h as VRMSpringBoneColliderHelper,e as VRMSpringBoneColliderShape,s as VRMSpringBoneColliderShapeCapsule,n as VRMSpringBoneColliderShapeSphere,P as VRMSpringBoneJoint,d as VRMSpringBoneJointHelper,I as VRMSpringBoneLoaderPlugin,B as VRMSpringBoneManager};
***************************************************************************** */function T(t,e,i,r){return new(i||(i=Promise))((function(s,n){function o(t){try{l(r.next(t))}catch(t){n(t)}}function a(t){try{l(r.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?s(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,a)}l((r=r.apply(t,e||[])).next())}))}function R(t,e){const i=[];let r=t;for(;null!==r;)i.unshift(r),r=r.parent;i.forEach((t=>{e(t)}))}function B(t,e){t.children.forEach((t=>{e(t)||B(t,e)}))}class I{constructor(){this._springBones=new Set,this._objectSpringBonesMap=new Map}get springBones(){return this._springBones}get colliderGroups(){const t=new Set;return this._springBones.forEach((e=>{e.colliderGroups.forEach((e=>{t.add(e)}))})),Array.from(t)}get colliders(){const t=new Set;return this.colliderGroups.forEach((e=>{e.colliders.forEach((e=>{t.add(e)}))})),Array.from(t)}addSpringBone(t){this._springBones.add(t);let e=this._objectSpringBonesMap.get(t.bone);null==e&&(e=new Set,this._objectSpringBonesMap.set(t.bone,e)),e.add(t)}deleteSpringBone(t){this._springBones.delete(t);this._objectSpringBonesMap.get(t.bone).delete(t)}setInitState(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.setInitState()))}reset(){const t=new Set,e=new Set;for(const i of this._springBones)this._processSpringBone(i,t,e,(t=>t.reset()))}update(t){const e=new Set,i=new Set;for(const r of this._springBones)this._processSpringBone(r,e,i,(e=>e.update(t))),B(r.bone,(t=>{var e,i;return(null!==(i=null===(e=this._objectSpringBonesMap.get(t))||void 0===e?void 0:e.size)&&void 0!==i?i:0)>0||(t.updateWorldMatrix(!1,!1),!1)}))}_processSpringBone(t,e,i,r){if(i.has(t))return;if(e.has(t))throw new Error("VRMSpringBoneManager: Circular dependency detected while updating constraints");e.add(t);const s=this._getDependencies(t);for(const t of s)R(t,(t=>{const s=this._objectSpringBonesMap.get(t);if(s)for(const t of s)this._processSpringBone(t,e,i,r)}));r(t),i.add(t)}_getDependencies(t){const e=new Set,i=t.bone.parent;return i&&e.add(i),e}}class W{constructor(t,e){this.parser=t,this.jointHelperRoot=null==e?void 0:e.jointHelperRoot,this.colliderHelperRoot=null==e?void 0:e.colliderHelperRoot}get name(){return W.EXTENSION_NAME}afterRoot(t){return T(this,void 0,void 0,(function*(){t.userData.vrmSpringBoneManager=yield this._import(t)}))}_import(t){return T(this,void 0,void 0,(function*(){const e=yield this._v1Import(t);if(null!=e)return e;const i=yield this._v0Import(t);return null!=i?i:null}))}_v1Import(e){var i,r,s,n,o;return T(this,void 0,void 0,(function*(){if(!(-1!==(null===(i=e.parser.json.extensionsUsed)||void 0===i?void 0:i.indexOf(W.EXTENSION_NAME))))return null;const a=new I,l=yield e.parser.getDependencies("node"),h=null===(r=e.parser.json.extensions)||void 0===r?void 0:r[W.EXTENSION_NAME];if(!h)return null;if("1.0-beta"!==h.specVersion)return null;const c=null===(s=h.colliders)||void 0===s?void 0:s.map(((e,i)=>{var r,s,n,o,a;const h=l[e.node],c=e.shape;if(c.sphere)return this._importSphereCollider(h,{offset:(new t.Vector3).fromArray(null!==(r=c.sphere.offset)&&void 0!==r?r:[0,0,0]),radius:null!==(s=c.sphere.radius)&&void 0!==s?s:0});if(c.capsule)return this._importCapsuleCollider(h,{offset:(new t.Vector3).fromArray(null!==(n=c.capsule.offset)&&void 0!==n?n:[0,0,0]),radius:null!==(o=c.capsule.radius)&&void 0!==o?o:0,tail:(new t.Vector3).fromArray(null!==(a=c.capsule.tail)&&void 0!==a?a:[0,0,0])});throw new Error(`VRMSpringBoneLoaderPlugin: The collider #${i} has no valid shape`)})),d=null===(n=h.colliderGroups)||void 0===n?void 0:n.map(((t,e)=>{var i;return{colliders:(null!==(i=t.colliders)&&void 0!==i?i:[]).map((t=>{const i=null==c?void 0:c[t];if(null==i)throw new Error(`VRMSpringBoneLoaderPlugin: The colliderGroup #${e} attempted to use a collider #${t} but not found`);return i})),name:t.name}}));return null===(o=h.springs)||void 0===o||o.forEach(((e,i)=>{var r;const s=e.joints,n=null===(r=e.colliderGroups)||void 0===r?void 0:r.map((t=>{const e=null==d?void 0:d[t];if(null==e)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${i} attempted to use a colliderGroup ${t} but not found`);return e}));let o;s.forEach((e=>{var i;if(o){const r=o.node,s=l[r],h=e.node,c=l[h],d={hitRadius:o.hitRadius,dragForce:o.dragForce,gravityPower:o.gravityPower,stiffness:o.stiffness,gravityDir:(new t.Vector3).fromArray(null!==(i=o.gravityDir)&&void 0!==i?i:[0,1,0])},u=this._importJoint(s,c,d,n);a.addSpringBone(u)}o=e}))})),e.scene.updateMatrixWorld(),a.setInitState(),a}))}_v0Import(e){var i,r,s;return T(this,void 0,void 0,(function*(){if(!(-1!==(null===(i=e.parser.json.extensionsUsed)||void 0===i?void 0:i.indexOf("VRM"))))return null;const n=null===(r=e.parser.json.extensions)||void 0===r?void 0:r.VRM,o=null==n?void 0:n.secondaryAnimation;if(!o)return null;const a=null==o?void 0:o.boneGroups;if(!a)return null;const l=new I,h=yield e.parser.getDependencies("node"),c=null===(s=o.colliderGroups)||void 0===s?void 0:s.map((e=>{var i;const r=h[e.node];return{colliders:(null!==(i=e.colliders)&&void 0!==i?i:[]).map(((e,i)=>{var s,n,o;const a=new t.Vector3(0,0,0);return e.offset&&a.set(null!==(s=e.offset.x)&&void 0!==s?s:0,null!==(n=e.offset.y)&&void 0!==n?n:0,e.offset.z?-e.offset.z:0),this._importSphereCollider(r,{offset:a,radius:null!==(o=e.radius)&&void 0!==o?o:0})}))}}));return null==a||a.forEach(((e,i)=>{const r=e.bones;r&&r.forEach((r=>{var s,n,o,a;const d=h[r],u=new t.Vector3;e.gravityDir?u.set(null!==(s=e.gravityDir.x)&&void 0!==s?s:0,null!==(n=e.gravityDir.y)&&void 0!==n?n:0,null!==(o=e.gravityDir.z)&&void 0!==o?o:0):u.set(0,-1,0);const p={hitRadius:e.hitRadius,dragForce:e.dragForce,gravityPower:e.gravityPower,stiffness:e.stiffiness,gravityDir:u},_=null===(a=e.colliderGroups)||void 0===a?void 0:a.map((t=>{const e=null==c?void 0:c[t];if(null==e)throw new Error(`VRMSpringBoneLoaderPlugin: The spring #${i} attempted to use a colliderGroup ${t} but not found`);return e}));d.traverse((t=>{var e;const i=null!==(e=t.children[0])&&void 0!==e?e:null,r=this._importJoint(t,i,p,_);l.addSpringBone(r)}))}))})),e.scene.updateMatrixWorld(),l.setInitState(),l}))}_importJoint(t,e,i,r){const s=new S(t,e,i,r);if(this.jointHelperRoot){const t=new d(s);this.jointHelperRoot.add(t),t.renderOrder=this.jointHelperRoot.renderOrder}return s}_importSphereCollider(t,e){const{offset:i,radius:r}=e,s=new n({offset:i,radius:r}),o=new u(s);if(t.add(o),this.colliderHelperRoot){const t=new h(o);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return o}_importCapsuleCollider(t,e){const{offset:i,radius:r,tail:n}=e,o=new s({offset:i,radius:r,tail:n}),a=new u(o);if(t.add(a),this.colliderHelperRoot){const t=new h(a);this.colliderHelperRoot.add(t),t.renderOrder=this.colliderHelperRoot.renderOrder}return a}}W.EXTENSION_NAME="VRMC_springBone";export{u as VRMSpringBoneCollider,h as VRMSpringBoneColliderHelper,e as VRMSpringBoneColliderShape,s as VRMSpringBoneColliderShapeCapsule,n as VRMSpringBoneColliderShapeSphere,S as VRMSpringBoneJoint,d as VRMSpringBoneJointHelper,W as VRMSpringBoneLoaderPlugin,I as VRMSpringBoneManager};
{
"name": "@pixiv/three-vrm-springbone",
"version": "1.0.0-beta.3",
"version": "1.0.0-beta.4",
"description": "Spring bone module for @pixiv/three-vrm",

@@ -26,9 +26,7 @@ "license": "MIT",

"all": "yarn lint && yarn clean && yarn build && yarn docs",
"dev": "cross-env NODE_ENV=development SERVE=1 rollup -w -c -o lib/three-vrm-springbone.js",
"dev": "cross-env NODE_ENV=development rollup -w -c",
"clean": "rimraf docs/ lib/ ts*/ types/",
"build": "yarn build-dev && yarn build-prod && yarn build-moduledev && yarn build-moduleprod && yarn build-types",
"build-dev": "cross-env NODE_ENV=development rollup -c -o lib/three-vrm-springbone.js",
"build-prod": "cross-env NODE_ENV=production rollup -c -o lib/three-vrm-springbone.min.js",
"build-moduledev": "cross-env NODE_ENV=development ESM=1 rollup -c -o lib/three-vrm-springbone.module.js",
"build-moduleprod": "cross-env NODE_ENV=production ESM=1 rollup -c -o lib/three-vrm-springbone.module.min.js",
"build": "yarn build-dev && yarn build-prod && yarn build-types",
"build-dev": "cross-env NODE_ENV=development rollup -c",
"build-prod": "cross-env NODE_ENV=production rollup -c",
"build-types": "tsc --declaration --declarationDir ./types --emitDeclarationOnly && downlevel-dts types ts3.4/types",

@@ -47,13 +45,13 @@ "docs": "typedoc --entryPoints ./src/index.ts --out docs",

"dependencies": {
"@pixiv/types-vrm-0.0": "1.0.0-beta.3",
"@pixiv/types-vrmc-springbone-1.0": "1.0.0-beta.3"
"@pixiv/types-vrm-0.0": "1.0.0-beta.4",
"@pixiv/types-vrmc-springbone-1.0": "1.0.0-beta.4"
},
"devDependencies": {
"lint-staged": "10.4.2",
"three": "^0.126.1"
"three": "^0.133.1"
},
"peerDependencies": {
"three": "^0.126.1"
"three": "^0.133.1"
},
"gitHead": "fb89b23619d6e4b14aab1be3c482a0d5424ee7d8"
"gitHead": "d44ab5f1a39ca615cbd87994d753517c99f29a5a"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc