You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
48 KiB
1 line
48 KiB
|
1 year ago
|
!function(){if(void 0===THREE.SkinnedMeshEx){const e=new THREE.Vector3,t=new THREE.Vector4,r=new THREE.Vector4,n=new THREE.Vector3,o=(new THREE.Box3,new THREE.Matrix4);class s extends THREE.SkinnedMesh{constructor(e,t){super(e,t),this.isSkinnedMeshEx=!0,this.bindMatrixInverseReal=new THREE.Matrix4}computeBoundingBox(){const e=this.geometry;return null===this.boundingBox&&(this.boundingBox=new Box3),e.computeBoundingBox()}getBindMatrixInverse(){return this.bindMatrixInverseReal}copy(e){return super.copy(e),this.isSkinnedMeshEx=e.isSkinnedMeshEx,this.bindMatrixInverseReal.copy(e.bindMatrixInverseReal),this}bind(e,t){this.skeleton&&(this.skeleton.associatedSkinnedMesh=null),super.bind(e,t),this.bindMatrixInverseReal.copy(this.bindMatrix).invert(),this.skeleton.associatedSkinnedMesh=this}updateMatrixWorld(e){THREE.Mesh.prototype.updateMatrixWorld.call(this,e),"attached"===this.bindMode?(this.bindMatrixInverseReal.copy(this.matrixWorld).invert(),this.bindMatrixInverse.identity()):"detached"===this.bindMode?(this.bindMatrixInverse.copy(this.bindMatrix).invert(),this.bindMatrixInverseReal.copy(this.bindMatrix).invert()):console.warn("THREE.SkinnedMesh: Unrecognized bindMode: "+this.bindMode)}boneTransform(s,a){const i=this.skeleton,l=this.geometry;t.fromBufferAttribute(l.attributes.skinIndex,s),r.fromBufferAttribute(l.attributes.skinWeight,s),e.fromBufferAttribute(l.attributes.position,s).applyMatrix4(this.bindMatrix),a.set(0,0,0);for(let s=0;s<4;s++){const l=r.getComponent(s);if(0!==l){const r=t.getComponent(s);o.multiplyMatrices(i.bones[r].matrixWorld,i.boneInverses[r]),a.addScaledVector(n.copy(e).applyMatrix4(o),l)}}return a.applyMatrix4(this.bindMatrixInverseReal)}}THREE.SkinnedMeshEx=s}if(void 0===THREE.SkeletonEx){const e=new THREE.Matrix4,t=new THREE.Matrix4;class r extends THREE.Skeleton{constructor(e=[],t=[]){super(e,t),this.associatedSkinnedMesh=null}clone(){return new r(this.bones,this.boneInverses)}getBindMatrixInverse(){return this.associatedSkinnedMesh?this.associatedSkinnedMesh.getBindMatrixInverse():void 0}update(){const r=this.bones,n=this.boneInverses,o=this.boneMatrices,s=this.boneTexture,a=this.getBindMatrixInverse();for(let s=0,i=r.length;s<i;s++){const i=r[s]?r[s].matrixWorld:t;e.multiplyMatrices(i,n[s]),a&&e.premultiply(a),e.toArray(o,16*s)}null!==s&&(s.needsUpdate=!0)}}THREE.SkeletonEx=r}function e(e,t,r){const n=r.length-e-1;if(t>=r[n])return n-1;if(t<=r[e])return e;let o=e,s=n,a=Math.floor((o+s)/2);for(;t<r[a]||t>=r[a+1];)t<r[a]?s=a:o=a,a=Math.floor((o+s)/2);return a}function t(e,t,r,n){const o=[],s=[],a=[];o[0]=1;for(let i=1;i<=r;++i){s[i]=t-n[e+1-i],a[i]=n[e+i]-t;let r=0;for(let e=0;e<i;++e){const t=a[e+1],n=s[i-e],l=o[e]/(t+n);o[e]=r+t*l,r=n*l}o[i]=r}return o}function r(e,t){let r=1;for(let t=2;t<=e;++t)r*=t;let n=1;for(let e=2;e<=t;++e)n*=e;for(let r=2;r<=e-t;++r)n*=r;return r/n}function n(t,n,o,s,a){const i=function(t,r,n,o,s){const a=s<t?s:t,i=[],l=e(t,o,r),c=function(e,t,r,n,o){const s=[];for(let e=0;e<=r;++e)s[e]=0;const a=[];for(let e=0;e<=n;++e)a[e]=s.slice(0);const i=[];for(let e=0;e<=r;++e)i[e]=s.slice(0);i[0][0]=1;const l=s.slice(0),c=s.slice(0);for(let n=1;n<=r;++n){l[n]=t-o[e+1-n],c[n]=o[e+n]-t;let r=0;for(let e=0;e<n;++e){const t=c[e+1],o=l[n-e];i[n][e]=t+o;const s=i[e][n-1]/i[n][e];i[e][n]=r+t*s,r=o*s}i[n][n]=r}for(let e=0;e<=r;++e)a[0][e]=i[e][r];for(let e=0;e<=r;++e){let t=0,o=1;const l=[];for(let e=0;e<=r;++e)l[e]=s.slice(0);l[0][0]=1;for(let s=1;s<=n;++s){let n=0;const c=e-s,u=r-s;e>=s&&(l[o][0]=l[t][0]/i[u+1][c],n=l[o][0]*i[c][u]);const p=e-1<=u?s-1:r-e;for(let e=c>=-1?1:-c;e<=p;++e)l[o][e]=(l[t][e]-l[t][e-1])/i[u+1][c+e],n+=l[o][e]*i[c+e][u];e<=u&&(l[o][s]=-l[t][s-1]/i[u+1][e],n+=l[o][s]*i[e][u]),a[s][e]=n;const h=t;t=o,o=h}}let u=r;for(let e=1;e<=n;++e){for(let t=0;t<=r;++t)a[e][t]*=u;u*=r-e}return a}(l,o,t,a,r),u=[];for(let e=0;e<n.length;++e){const t=n[e].clone(),r=t.w;t.x*=r,t.y*=r,t.z*=r,u[e]=t}for(let e=0;e<=a;++e){const r=u[l-t].clone().multiplyScalar(c[e][0]);for(let n=1;n<=t;++n)r.add(u[l-t+n].clone().multiplyScalar(c[e][n]));i[e]=r}for(let e=a+1;e<=s+1;++e)i[e]=new THR
|