Ai_Assistant/client/node_modules/@pixiv/three-vrm-springbone/lib/three-vrm-springbone.module.min.js

3 lines
23 KiB
JavaScript
Raw Normal View History

2026-05-24 13:31:30 +02:00
/*! (c) 2019-2025 pixiv Inc. - https://github.com/pixiv/three-vrm/blob/release/LICENSE */
var q=(s,t,e)=>new Promise((r,i)=>{var o=a=>{try{l(e.next(a))}catch(p){i(p)}},n=a=>{try{l(e.throw(a))}catch(p){i(p)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,n);l((e=e.apply(s,t)).next())});import*as P from"three";import*as k from"three";var w=class{};var de=new k.Vector3,J=new k.Vector3,F=class extends w{get type(){return"capsule"}constructor(t){var e,r,i,o;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new k.Vector3(0,0,0),this.tail=(r=t==null?void 0:t.tail)!=null?r:new k.Vector3(0,0,0),this.radius=(i=t==null?void 0:t.radius)!=null?i:0,this.inside=(o=t==null?void 0:t.inside)!=null?o:!1}calculateCollision(t,e,r,i){de.setFromMatrixPosition(t),J.subVectors(this.tail,this.offset).applyMatrix4(t),J.sub(de);let o=J.lengthSq();i.copy(e).sub(de);let n=J.dot(i);n<=0||(o<=n||J.multiplyScalar(n/o),i.sub(J));let l=i.length(),a=this.inside?this.radius-r-l:l-r-this.radius;return a<0&&(i.multiplyScalar(1/l),this.inside&&i.negate()),a}};import*as U from"three";var he=new U.Vector3,be=new U.Matrix3,Y=class extends w{get type(){return"plane"}constructor(t){var e,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new U.Vector3(0,0,0),this.normal=(r=t==null?void 0:t.normal)!=null?r:new U.Vector3(0,0,1)}calculateCollision(t,e,r,i){i.setFromMatrixPosition(t),i.negate().add(e),be.getNormalMatrix(t),he.copy(this.normal).applyNormalMatrix(be).normalize();let o=i.dot(he)-r;return i.copy(he),o}};import*as ue from"three";var Be=new ue.Vector3,N=class extends w{get type(){return"sphere"}constructor(t){var e,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new ue.Vector3(0,0,0),this.radius=(r=t==null?void 0:t.radius)!=null?r:0,this.inside=(i=t==null?void 0:t.inside)!=null?i:!1}calculateCollision(t,e,r,i){i.subVectors(e,Be.setFromMatrixPosition(t));let o=i.length(),n=this.inside?this.radius-r-o:o-r-this.radius;return n<0&&(i.multiplyScalar(1/o),this.inside&&i.negate()),n}};import*as V from"three";var y=new V.Vector3,ie=class extends V.BufferGeometry{constructor(e){super();this.worldScale=1;this._currentRadius=0;this._currentOffset=new V.Vector3;this._currentTail=new V.Vector3;this._shape=e,this._attrPos=new V.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new V.BufferAttribute(new Uint16Array(264),1),this.setIndex(this._attrIndex),this._buildIndex(),this.update()}update(){let e=!1,r=this._shape.radius/this.worldScale;this._currentRadius!==r&&(this._currentRadius=r,e=!0),this._currentOffset.equals(this._shape.offset)||(this._currentOffset.copy(this._shape.offset),e=!0);let i=y.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(i)>1e-10&&(this._currentTail.copy(i),e=!0),e&&this._buildPosition()}_buildPosition(){y.copy(this._currentTail).sub(this._currentOffset);let e=y.length()/this._currentRadius;for(let o=0;o<=16;o++){let n=o/16*Math.PI;this._attrPos.setXYZ(o,-Math.sin(n),-Math.cos(n),0),this._attrPos.setXYZ(17+o,e+Math.sin(n),Math.cos(n),0),this._attrPos.setXYZ(34+o,-Math.sin(n),0,-Math.cos(n)),this._attrPos.setXYZ(51+o,e+Math.sin(n),0,Math.cos(n))}for(let o=0;o<32;o++){let n=o/16*Math.PI;this._attrPos.setXYZ(68+o,0,Math.sin(n),Math.cos(n)),this._attrPos.setXYZ(100+o,e,Math.sin(n),Math.cos(n))}let r=Math.atan2(y.y,Math.sqrt(y.x*y.x+y.z*y.z)),i=-Math.atan2(y.z,y.x);this.rotateZ(r),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 e=0;e<34;e++){let r=(e+1)%34;this._attrIndex.setXY(e*2,e,r),this._attrIndex.setXY(68+e*2,34+e,34+r)}for(let e=0;e<32;e++){let r=(e+1)%32;this._attrIndex.setXY(136+e*2,68+e,68+r),this._attrIndex.setXY(200+e*2,100+e,100+r)}this._attrIndex.needsUpdate=!0}};import*as C from"three";var oe=class extends C.BufferGeometry{constructor(e){super();this.worldScale=1;this._currentOffset=new C.Vector3;this._currentNormal=new C.Vector3;this._shape=e,this._attrPos=new C.BufferAttribute(new Float32Array(6*3),3),this.setAttribute("position",