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

3 lines
24 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 */
"use strict";var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,De=Object.prototype.hasOwnProperty;var je=(n,t)=>{for(var e in t)ne(n,e,{get:t[e],enumerable:!0})},xe=(n,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oe(t))!De.call(n,i)&&i!==e&&ne(n,i,{get:()=>t[i],enumerable:!(r=Ie(t,i))||r.enumerable});return n};var m=(n,t,e)=>(e=n!=null?Pe(Ae(n)):{},xe(t||!n||!n.__esModule?ne(e,"default",{value:n,enumerable:!0}):e,n)),Je=n=>xe(ne({},"__esModule",{value:!0}),n);var K=(n,t,e)=>new Promise((r,i)=>{var o=a=>{try{l(e.next(a))}catch(p){i(p)}},s=a=>{try{l(e.throw(a))}catch(p){i(p)}},l=a=>a.done?r(a.value):Promise.resolve(a.value).then(o,s);l((e=e.apply(n,t)).next())});var ze={};je(ze,{VRMSpringBoneCollider:()=>N,VRMSpringBoneColliderHelper:()=>I,VRMSpringBoneColliderShape:()=>v,VRMSpringBoneColliderShapeCapsule:()=>W,VRMSpringBoneColliderShapePlane:()=>X,VRMSpringBoneColliderShapeSphere:()=>F,VRMSpringBoneJoint:()=>oe,VRMSpringBoneJointHelper:()=>$,VRMSpringBoneLoaderPlugin:()=>Re,VRMSpringBoneManager:()=>k});module.exports=Je(ze);var O=m(require("three"),1);var ee=m(require("three"),1);var v=class{};var ue=new ee.Vector3,G=new ee.Vector3,W=class extends v{get type(){return"capsule"}constructor(t){var e,r,i,o;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new ee.Vector3(0,0,0),this.tail=(r=t==null?void 0:t.tail)!=null?r:new ee.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){ue.setFromMatrixPosition(t),G.subVectors(this.tail,this.offset).applyMatrix4(t),G.sub(ue);let o=G.lengthSq();i.copy(e).sub(ue);let s=G.dot(i);s<=0||(o<=s||G.multiplyScalar(s/o),i.sub(G));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}};var Z=m(require("three"),1);var fe=new Z.Vector3,ye=new Z.Matrix3,X=class extends v{get type(){return"plane"}constructor(t){var e,r;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Z.Vector3(0,0,0),this.normal=(r=t==null?void 0:t.normal)!=null?r:new Z.Vector3(0,0,1)}calculateCollision(t,e,r,i){i.setFromMatrixPosition(t),i.negate().add(e),ye.getNormalMatrix(t),fe.copy(this.normal).applyNormalMatrix(ye).normalize();let o=i.dot(fe)-r;return i.copy(fe),o}};var Ee=m(require("three"),1);var Le=new Ee.Vector3,F=class extends v{get type(){return"sphere"}constructor(t){var e,r,i;super(),this.offset=(e=t==null?void 0:t.offset)!=null?e:new Ee.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,Le.setFromMatrixPosition(t));let o=i.length(),s=this.inside?this.radius-r-o:o-r-this.radius;return s<0&&(i.multiplyScalar(1/o),this.inside&&i.negate()),s}};var B=m(require("three"),1),H=new B.Vector3,se=class extends B.BufferGeometry{constructor(e){super();this.worldScale=1;this._currentRadius=0;this._currentOffset=new B.Vector3;this._currentTail=new B.Vector3;this._shape=e,this._attrPos=new B.BufferAttribute(new Float32Array(396),3),this.setAttribute("position",this._attrPos),this._attrIndex=new B.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=H.copy(this._shape.tail).divideScalar(this.worldScale);this._currentTail.distanceToSquared(i)>1e-10&&(this._currentTail.copy(i),e=!0),e&&this._buildPosition()}_buildPosition(){H.copy(this._currentTail).sub(this._currentOffset);let e=H.length()/this._currentRadius;for(let o=0;o<=16;o++){let s=o/16*Math.PI;this._attrPos.setXYZ(o,-Math.sin(s),-Math.cos(s),0),this._attrPos.setXYZ(17+o,e+Math.sin(s),Math.cos(s),0),this._attrPos.setXYZ(34+o,-Math.sin(s),0,-Math.cos(s)),this._attrPos.setXYZ(51+o,e+Math.sin(s),0,Math.cos(s))}for(l