@ridp/threejs 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PredictiveLoader-C9zJlZEQ.js → PredictiveLoader-Ce8DXwbW.js} +1332 -1237
- package/dist/PredictiveLoader-c5o_CMyI.cjs +2 -0
- package/dist/assets/{gltfParser.worker-D2lwod50.js → gltfParser.worker-BJvxfZUb.js} +2 -2
- package/dist/hooks.cjs +1 -1
- package/dist/hooks.js +2 -2
- package/dist/{modelOptimizer-D6fRg-DF.js → modelOptimizer-B7zPcU53.js} +55 -51
- package/dist/{modelOptimizer-A0Cs6f9e.cjs → modelOptimizer-_7Yr0hPn.cjs} +2 -1
- package/dist/objectQuery-BcL0iGx1.js +1473 -0
- package/dist/objectQuery-DFqBNl0a.cjs +24 -0
- package/dist/threejs.cjs +2 -2
- package/dist/threejs.js +162 -119
- package/dist/{useBatchGLTFLoader-C1C8R5Ss.js → useBatchGLTFLoader-BtuzDyHn.js} +187 -168
- package/dist/useBatchGLTFLoader-wNkKD723.cjs +5 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +40 -31
- package/package.json +1 -1
- package/{README.md → readme.md} +9 -277
- package/dist/PredictiveLoader-Xy5S4HBr.cjs +0 -2
- package/dist/objectQuery-BfHUGPET.js +0 -1453
- package/dist/objectQuery-DNtwsgY8.cjs +0 -24
- package/dist/useBatchGLTFLoader-DHJyQcpJ.cjs +0 -5
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";const an=require("./PredictiveLoader-Xy5S4HBr.cjs"),O=require("three");/*!
|
|
2
|
-
fflate - fast JavaScript compression/decompression
|
|
3
|
-
<https://101arrowz.github.io/fflate>
|
|
4
|
-
Licensed under MIT. https://github.com/101arrowz/fflate/blob/master/LICENSE
|
|
5
|
-
version 0.8.2
|
|
6
|
-
*/var se=Uint8Array,De=Uint16Array,qn=Int32Array,cn=new se([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),un=new se([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Vn=new se([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hn=function(u,h){for(var f=new De(31),_=0;_<31;++_)f[_]=h+=1<<u[_-1];for(var I=new qn(f[30]),_=1;_<30;++_)for(var H=f[_];H<f[_+1];++H)I[H]=H-f[_]<<5|_;return{b:f,r:I}},pn=hn(cn,2),fn=pn.b,Jn=pn.r;fn[28]=258,Jn[258]=28;var Qn=hn(un,0),jn=Qn.b,je=new De(32768);for(var G=0;G<32768;++G){var Ae=(G&43690)>>1|(G&21845)<<1;Ae=(Ae&52428)>>2|(Ae&13107)<<2,Ae=(Ae&61680)>>4|(Ae&3855)<<4,je[G]=((Ae&65280)>>8|(Ae&255)<<8)>>1}var He=function(u,h,f){for(var _=u.length,I=0,H=new De(h);I<_;++I)u[I]&&++H[u[I]-1];var U=new De(h);for(I=1;I<h;++I)U[I]=U[I-1]+H[I-1]<<1;var J;if(f){J=new De(1<<h);var ye=15-h;for(I=0;I<_;++I)if(u[I])for(var de=I<<4|u[I],ae=h-u[I],T=U[u[I]-1]++<<ae,B=T|(1<<ae)-1;T<=B;++T)J[je[T]>>ye]=de}else for(J=new De(_),I=0;I<_;++I)u[I]&&(J[I]=je[U[u[I]-1]++]>>15-u[I]);return J},Ze=new se(288);for(var G=0;G<144;++G)Ze[G]=8;for(var G=144;G<256;++G)Ze[G]=9;for(var G=256;G<280;++G)Ze[G]=7;for(var G=280;G<288;++G)Ze[G]=8;var En=new se(32);for(var G=0;G<32;++G)En[G]=5;var et=He(Ze,9,1),nt=He(En,5,1),Ve=function(u){for(var h=u[0],f=1;f<u.length;++f)u[f]>h&&(h=u[f]);return h},ue=function(u,h,f){var _=h/8|0;return(u[_]|u[_+1]<<8)>>(h&7)&f},Je=function(u,h){var f=h/8|0;return(u[f]|u[f+1]<<8|u[f+2]<<16)>>(h&7)},tt=function(u){return(u+7)/8|0},rt=function(u,h,f){return(f==null||f>u.length)&&(f=u.length),new se(u.subarray(h,f))},ot=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],he=function(u,h,f){var _=new Error(h||ot[u]);if(_.code=u,Error.captureStackTrace&&Error.captureStackTrace(_,he),!f)throw _;return _},lt=function(u,h,f,_){var I=u.length,H=0;if(!I||h.f&&!h.l)return f||new se(0);var U=!f,J=U||h.i!=2,ye=h.i;U&&(f=new se(I*3));var de=function(Le){var Ge=f.length;if(Le>Ge){var ke=new se(Math.max(Ge*2,Le));ke.set(f),f=ke}},ae=h.f||0,T=h.p||0,B=h.b||0,pe=h.l,Ne=h.d,Ie=h.m,ce=h.n,fe=I*8;do{if(!pe){ae=ue(u,T,1);var Me=ue(u,T+1,3);if(T+=3,Me)if(Me==1)pe=et,Ne=nt,Ie=9,ce=5;else if(Me==2){var Re=ue(u,T,31)+257,Ee=ue(u,T+10,15)+4,C=Re+ue(u,T+5,31)+1;T+=14;for(var d=new se(C),x=new se(19),A=0;A<Ee;++A)x[Vn[A]]=ue(u,T+A*3,7);T+=Ee*3;for(var F=Ve(x),Z=(1<<F)-1,b=He(x,F,1),A=0;A<C;){var Y=b[ue(u,T,Z)];T+=Y&15;var ee=Y>>4;if(ee<16)d[A++]=ee;else{var N=0,ne=0;for(ee==16?(ne=3+ue(u,T,3),T+=2,N=d[A-1]):ee==17?(ne=3+ue(u,T,7),T+=3):ee==18&&(ne=11+ue(u,T,127),T+=7);ne--;)d[A++]=N}}var Te=d.subarray(0,Re),Q=d.subarray(Re);Ie=Ve(Te),ce=Ve(Q),pe=He(Te,Ie,1),Ne=He(Q,ce,1)}else he(1);else{var ee=tt(T)+4,ge=u[ee-4]|u[ee-3]<<8,Ce=ee+ge;if(Ce>I){ye&&he(0);break}J&&de(B+ge),f.set(u.subarray(ee,Ce),B),h.b=B+=ge,h.p=T=Ce*8,h.f=ae;continue}if(T>fe){ye&&he(0);break}}J&&de(B+131072);for(var K=(1<<Ie)-1,Oe=(1<<ce)-1,X=T;;X=T){var N=pe[Je(u,T)&K],$=N>>4;if(T+=N&15,T>fe){ye&&he(0);break}if(N||he(2),$<256)f[B++]=$;else if($==256){X=T,pe=null;break}else{var ve=$-254;if($>264){var A=$-257,be=cn[A];ve=ue(u,T,(1<<be)-1)+fn[A],T+=be}var L=Ne[Je(u,T)&Oe],we=L>>4;L||he(3),T+=L&15;var Q=jn[we];if(we>3){var be=un[we];Q+=Je(u,T)&(1<<be)-1,T+=be}if(T>fe){ye&&he(0);break}J&&de(B+131072);var Se=B+ve;if(B<Q){var ze=H-Q,Ke=Math.min(Q,Se);for(ze+B<0&&he(3);B<Ke;++B)f[B]=_[ze+B]}for(;B<Se;++B)f[B]=f[B-Q]}}h.l=pe,h.p=X,h.b=B,h.f=ae,pe&&(ae=1,h.m=Ie,h.d=Ne,h.n=ce)}while(!ae);return B!=f.length&&U?rt(f,0,B):f.subarray(0,B)},it=new se(0),st=function(u,h){return((u[0]&15)!=8||u[0]>>4>7||(u[0]<<8|u[1])%31)&&he(6,"invalid zlib data"),(u[1]>>5&1)==1&&he(6,"invalid zlib data: "+(u[1]&32?"need":"unexpected")+" dictionary"),(u[1]>>3&4)+2};function Xe(u,h){return lt(u.subarray(st(u),-4),{i:2},h,h)}var at=typeof TextDecoder<"u"&&new TextDecoder,ct=0;try{at.decode(it,{stream:!0}),ct=1}catch{}class ut extends O.DataTextureLoader{constructor(h){super(h),this.type=O.HalfFloatType}parse(h){const d=Math.pow(2.7182818,2.2);function x(e,n){let t=0;for(let l=0;l<65536;++l)(l==0||e[l>>3]&1<<(l&7))&&(n[t++]=l);const r=t-1;for(;t<65536;)n[t++]=0;return r}function A(e){for(let n=0;n<16384;n++)e[n]={},e[n].len=0,e[n].lit=0,e[n].p=null}const F={l:0,c:0,lc:0};function Z(e,n,t,r,l){for(;t<e;)n=n<<8|rn(r,l),t+=8;t-=e,F.l=n>>t&(1<<e)-1,F.c=n,F.lc=t}const b=new Array(59);function Y(e){for(let t=0;t<=58;++t)b[t]=0;for(let t=0;t<65537;++t)b[e[t]]+=1;let n=0;for(let t=58;t>0;--t){const r=n+b[t]>>1;b[t]=n,n=r}for(let t=0;t<65537;++t){const r=e[t];r>0&&(e[t]=r|b[r]++<<6)}}function N(e,n,t,r,l,o){const a=n;let p=0,c=0;for(;r<=l;r++){if(a.value-n.value>t)return!1;Z(6,p,c,e,a);const s=F.l;if(p=F.c,c=F.lc,o[r]=s,s==63){if(a.value-n.value>t)throw new Error("Something wrong with hufUnpackEncTable");Z(8,p,c,e,a);let i=F.l+6;if(p=F.c,c=F.lc,r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)o[r++]=0;r--}else if(s>=59){let i=s-59+2;if(r+i>l+1)throw new Error("Something wrong with hufUnpackEncTable");for(;i--;)o[r++]=0;r--}}Y(o)}function ne(e){return e&63}function Te(e){return e>>6}function Q(e,n,t,r){for(;n<=t;n++){const l=Te(e[n]),o=ne(e[n]);if(l>>o)throw new Error("Invalid table entry");if(o>14){const a=r[l>>o-14];if(a.len)throw new Error("Invalid table entry");if(a.lit++,a.p){const p=a.p;a.p=new Array(a.lit);for(let c=0;c<a.lit-1;++c)a.p[c]=p[c]}else a.p=new Array(1);a.p[a.lit-1]=n}else if(o){let a=0;for(let p=1<<14-o;p>0;p--){const c=r[(l<<14-o)+a];if(c.len||c.p)throw new Error("Invalid table entry");c.len=o,c.lit=n,a++}}}return!0}const K={c:0,lc:0};function Oe(e,n,t,r){e=e<<8|rn(t,r),n+=8,K.c=e,K.lc=n}const X={c:0,lc:0};function $(e,n,t,r,l,o,a,p,c){if(e==n){r<8&&(Oe(t,r,l,o),t=K.c,r=K.lc),r-=8;let s=t>>r;if(s=new Uint8Array([s])[0],p.value+s>c)return!1;const i=a[p.value-1];for(;s-- >0;)a[p.value++]=i}else if(p.value<c)a[p.value++]=e;else return!1;X.c=t,X.lc=r}function ve(e){return e&65535}function be(e){const n=ve(e);return n>32767?n-65536:n}const L={a:0,b:0};function we(e,n){const t=be(e),l=be(n),o=t+(l&1)+(l>>1),a=o,p=o-l;L.a=a,L.b=p}function Se(e,n){const t=ve(e),r=ve(n),l=t-(r>>1)&65535,o=r+l-32768&65535;L.a=o,L.b=l}function ze(e,n,t,r,l,o,a){const p=a<16384,c=t>l?l:t;let s=1,i,E;for(;s<=c;)s<<=1;for(s>>=1,i=s,s>>=1;s>=1;){E=0;const v=E+o*(l-i),w=o*s,y=o*i,m=r*s,S=r*i;let R,k,W,re;for(;E<=v;E+=y){let z=E;const M=E+r*(t-i);for(;z<=M;z+=S){const q=z+m,ie=z+w,V=ie+m;p?(we(e[z+n],e[ie+n]),R=L.a,W=L.b,we(e[q+n],e[V+n]),k=L.a,re=L.b,we(R,k),e[z+n]=L.a,e[q+n]=L.b,we(W,re),e[ie+n]=L.a,e[V+n]=L.b):(Se(e[z+n],e[ie+n]),R=L.a,W=L.b,Se(e[q+n],e[V+n]),k=L.a,re=L.b,Se(R,k),e[z+n]=L.a,e[q+n]=L.b,Se(W,re),e[ie+n]=L.a,e[V+n]=L.b)}if(t&s){const q=z+w;p?we(e[z+n],e[q+n]):Se(e[z+n],e[q+n]),R=L.a,e[q+n]=L.b,e[z+n]=R}}if(l&s){let z=E;const M=E+r*(t-i);for(;z<=M;z+=S){const q=z+m;p?we(e[z+n],e[q+n]):Se(e[z+n],e[q+n]),R=L.a,e[q+n]=L.b,e[z+n]=R}}i=s,s>>=1}return E}function Ke(e,n,t,r,l,o,a,p,c){let s=0,i=0;const E=a,v=Math.trunc(r.value+(l+7)/8);for(;r.value<v;)for(Oe(s,i,t,r),s=K.c,i=K.lc;i>=14;){const y=s>>i-14&16383,m=n[y];if(m.len)i-=m.len,$(m.lit,o,s,i,t,r,p,c,E),s=X.c,i=X.lc;else{if(!m.p)throw new Error("hufDecode issues");let S;for(S=0;S<m.lit;S++){const R=ne(e[m.p[S]]);for(;i<R&&r.value<v;)Oe(s,i,t,r),s=K.c,i=K.lc;if(i>=R&&Te(e[m.p[S]])==(s>>i-R&(1<<R)-1)){i-=R,$(m.p[S],o,s,i,t,r,p,c,E),s=X.c,i=X.lc;break}}if(S==m.lit)throw new Error("hufDecode issues")}}const w=8-l&7;for(s>>=w,i-=w;i>0;){const y=n[s<<14-i&16383];if(y.len)i-=y.len,$(y.lit,o,s,i,t,r,p,c,E),s=X.c,i=X.lc;else throw new Error("hufDecode issues")}return!0}function Le(e,n,t,r,l,o){const a={value:0},p=t.value,c=le(n,t),s=le(n,t);t.value+=4;const i=le(n,t);if(t.value+=4,c<0||c>=65537||s<0||s>=65537)throw new Error("Something wrong with HUF_ENCSIZE");const E=new Array(65537),v=new Array(16384);A(v);const w=r-(t.value-p);if(N(e,t,w,c,s,E),i>8*(r-(t.value-p)))throw new Error("Something wrong with hufUncompress");Q(E,c,s,v),Ke(E,v,e,t,i,s,o,l,a)}function Ge(e,n,t){for(let r=0;r<t;++r)n[r]=e[n[r]]}function ke(e){for(let n=1;n<e.length;n++){const t=e[n-1]+e[n]-128;e[n]=t}}function en(e,n){let t=0,r=Math.floor((e.length+1)/2),l=0;const o=e.length-1;for(;!(l>o||(n[l++]=e[t++],l>o));)n[l++]=e[r++]}function nn(e){let n=e.byteLength;const t=new Array;let r=0;const l=new DataView(e);for(;n>0;){const o=l.getInt8(r++);if(o<0){const a=-o;n-=a+1;for(let p=0;p<a;p++)t.push(l.getUint8(r++))}else{const a=o;n-=2;const p=l.getUint8(r++);for(let c=0;c<a+1;c++)t.push(p)}}return t}function gn(e,n,t,r,l,o){let a=new DataView(o.buffer);const p=t[e.idx[0]].width,c=t[e.idx[0]].height,s=3,i=Math.floor(p/8),E=Math.ceil(p/8),v=Math.ceil(c/8),w=p-(E-1)*8,y=c-(v-1)*8,m={value:0},S=new Array(s),R=new Array(s),k=new Array(s),W=new Array(s),re=new Array(s);for(let M=0;M<s;++M)re[M]=n[e.idx[M]],S[M]=M<1?0:S[M-1]+E*v,R[M]=new Float32Array(64),k[M]=new Uint16Array(64),W[M]=new Uint16Array(E*64);for(let M=0;M<v;++M){let q=8;M==v-1&&(q=y);let ie=8;for(let D=0;D<E;++D){D==E-1&&(ie=w);for(let P=0;P<s;++P)k[P].fill(0),k[P][0]=l[S[P]++],vn(m,r,k[P]),Sn(k[P],R[P]),_n(R[P]);yn(R);for(let P=0;P<s;++P)In(R[P],W[P],D*64)}let V=0;for(let D=0;D<s;++D){const P=t[e.idx[D]].type;for(let _e=8*M;_e<8*M+q;++_e){V=re[D][_e];for(let Pe=0;Pe<i;++Pe){const me=Pe*64+(_e&7)*8;a.setUint16(V+0*2*P,W[D][me+0],!0),a.setUint16(V+1*2*P,W[D][me+1],!0),a.setUint16(V+2*2*P,W[D][me+2],!0),a.setUint16(V+3*2*P,W[D][me+3],!0),a.setUint16(V+4*2*P,W[D][me+4],!0),a.setUint16(V+5*2*P,W[D][me+5],!0),a.setUint16(V+6*2*P,W[D][me+6],!0),a.setUint16(V+7*2*P,W[D][me+7],!0),V+=8*2*P}}if(i!=E)for(let _e=8*M;_e<8*M+q;++_e){const Pe=re[D][_e]+8*i*2*P,me=i*64+(_e&7)*8;for(let We=0;We<ie;++We)a.setUint16(Pe+We*2*P,W[D][me+We],!0)}}}const z=new Uint16Array(p);a=new DataView(o.buffer);for(let M=0;M<s;++M){t[e.idx[M]].decoded=!0;const q=t[e.idx[M]].type;if(t[M].type==2)for(let ie=0;ie<c;++ie){const V=re[M][ie];for(let D=0;D<p;++D)z[D]=a.getUint16(V+D*2*q,!0);for(let D=0;D<p;++D)a.setFloat32(V+D*2*q,g(z[D]),!0)}}}function vn(e,n,t){let r,l=1;for(;l<64;)r=n[e.value],r==65280?l=64:r>>8==255?l+=r&255:(t[l]=r,l++),e.value++}function Sn(e,n){n[0]=g(e[0]),n[1]=g(e[1]),n[2]=g(e[5]),n[3]=g(e[6]),n[4]=g(e[14]),n[5]=g(e[15]),n[6]=g(e[27]),n[7]=g(e[28]),n[8]=g(e[2]),n[9]=g(e[4]),n[10]=g(e[7]),n[11]=g(e[13]),n[12]=g(e[16]),n[13]=g(e[26]),n[14]=g(e[29]),n[15]=g(e[42]),n[16]=g(e[3]),n[17]=g(e[8]),n[18]=g(e[12]),n[19]=g(e[17]),n[20]=g(e[25]),n[21]=g(e[30]),n[22]=g(e[41]),n[23]=g(e[43]),n[24]=g(e[9]),n[25]=g(e[11]),n[26]=g(e[18]),n[27]=g(e[24]),n[28]=g(e[31]),n[29]=g(e[40]),n[30]=g(e[44]),n[31]=g(e[53]),n[32]=g(e[10]),n[33]=g(e[19]),n[34]=g(e[23]),n[35]=g(e[32]),n[36]=g(e[39]),n[37]=g(e[45]),n[38]=g(e[52]),n[39]=g(e[54]),n[40]=g(e[20]),n[41]=g(e[22]),n[42]=g(e[33]),n[43]=g(e[38]),n[44]=g(e[46]),n[45]=g(e[51]),n[46]=g(e[55]),n[47]=g(e[60]),n[48]=g(e[21]),n[49]=g(e[34]),n[50]=g(e[37]),n[51]=g(e[47]),n[52]=g(e[50]),n[53]=g(e[56]),n[54]=g(e[59]),n[55]=g(e[61]),n[56]=g(e[35]),n[57]=g(e[36]),n[58]=g(e[48]),n[59]=g(e[49]),n[60]=g(e[57]),n[61]=g(e[58]),n[62]=g(e[62]),n[63]=g(e[63])}function _n(e){const n=.5*Math.cos(.7853975),t=.5*Math.cos(3.14159/16),r=.5*Math.cos(3.14159/8),l=.5*Math.cos(3*3.14159/16),o=.5*Math.cos(5*3.14159/16),a=.5*Math.cos(3*3.14159/8),p=.5*Math.cos(7*3.14159/16),c=new Array(4),s=new Array(4),i=new Array(4),E=new Array(4);for(let v=0;v<8;++v){const w=v*8;c[0]=r*e[w+2],c[1]=a*e[w+2],c[2]=r*e[w+6],c[3]=a*e[w+6],s[0]=t*e[w+1]+l*e[w+3]+o*e[w+5]+p*e[w+7],s[1]=l*e[w+1]-p*e[w+3]-t*e[w+5]-o*e[w+7],s[2]=o*e[w+1]-t*e[w+3]+p*e[w+5]+l*e[w+7],s[3]=p*e[w+1]-o*e[w+3]+l*e[w+5]-t*e[w+7],i[0]=n*(e[w+0]+e[w+4]),i[3]=n*(e[w+0]-e[w+4]),i[1]=c[0]+c[3],i[2]=c[1]-c[2],E[0]=i[0]+i[1],E[1]=i[3]+i[2],E[2]=i[3]-i[2],E[3]=i[0]-i[1],e[w+0]=E[0]+s[0],e[w+1]=E[1]+s[1],e[w+2]=E[2]+s[2],e[w+3]=E[3]+s[3],e[w+4]=E[3]-s[3],e[w+5]=E[2]-s[2],e[w+6]=E[1]-s[1],e[w+7]=E[0]-s[0]}for(let v=0;v<8;++v)c[0]=r*e[16+v],c[1]=a*e[16+v],c[2]=r*e[48+v],c[3]=a*e[48+v],s[0]=t*e[8+v]+l*e[24+v]+o*e[40+v]+p*e[56+v],s[1]=l*e[8+v]-p*e[24+v]-t*e[40+v]-o*e[56+v],s[2]=o*e[8+v]-t*e[24+v]+p*e[40+v]+l*e[56+v],s[3]=p*e[8+v]-o*e[24+v]+l*e[40+v]-t*e[56+v],i[0]=n*(e[v]+e[32+v]),i[3]=n*(e[v]-e[32+v]),i[1]=c[0]+c[3],i[2]=c[1]-c[2],E[0]=i[0]+i[1],E[1]=i[3]+i[2],E[2]=i[3]-i[2],E[3]=i[0]-i[1],e[0+v]=E[0]+s[0],e[8+v]=E[1]+s[1],e[16+v]=E[2]+s[2],e[24+v]=E[3]+s[3],e[32+v]=E[3]-s[3],e[40+v]=E[2]-s[2],e[48+v]=E[1]-s[1],e[56+v]=E[0]-s[0]}function yn(e){for(let n=0;n<64;++n){const t=e[0][n],r=e[1][n],l=e[2][n];e[0][n]=t+1.5747*l,e[1][n]=t-.1873*r-.4682*l,e[2][n]=t+1.8556*r}}function In(e,n,t){for(let r=0;r<64;++r)n[t+r]=O.DataUtils.toHalfFloat(Cn(e[r]))}function Cn(e){return e<=1?Math.sign(e)*Math.pow(Math.abs(e),2.2):Math.sign(e)*Math.pow(d,Math.abs(e)-1)}function $e(e){return new DataView(e.array.buffer,e.offset.value,e.size)}function Rn(e){const n=e.viewer.buffer.slice(e.offset.value,e.offset.value+e.size),t=new Uint8Array(nn(n)),r=new Uint8Array(t.length);return ke(t),en(t,r),new DataView(r.buffer)}function qe(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Xe(n),r=new Uint8Array(t.length);return ke(t),en(t,r),new DataView(r.buffer)}function Tn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint16Array(e.columns*e.lines*(e.inputChannels.length*e.type)),l=new Uint8Array(8192);let o=0;const a=new Array(e.inputChannels.length);for(let y=0,m=e.inputChannels.length;y<m;y++)a[y]={},a[y].start=o,a[y].end=a[y].start,a[y].nx=e.columns,a[y].ny=e.lines,a[y].size=e.type,o+=a[y].nx*a[y].ny*a[y].size;const p=Be(n,t),c=Be(n,t);if(c>=8192)throw new Error("Something is wrong with PIZ_COMPRESSION BITMAP_SIZE");if(p<=c)for(let y=0;y<c-p+1;y++)l[y+p]=Ue(n,t);const s=new Uint16Array(65536),i=x(l,s),E=le(n,t);Le(e.array,n,t,E,r,o);for(let y=0;y<e.inputChannels.length;++y){const m=a[y];for(let S=0;S<a[y].size;++S)ze(r,m.start+S,m.nx,m.size,m.ny,m.nx*m.size,i)}Ge(s,r,o);let v=0;const w=new Uint8Array(r.buffer.byteLength);for(let y=0;y<e.lines;y++)for(let m=0;m<e.inputChannels.length;m++){const S=a[m],R=S.nx*S.size,k=new Uint8Array(r.buffer,S.end*2,R*2);w.set(k,v),v+=R*2,S.end+=R}return new DataView(w.buffer)}function bn(e){const n=e.array.slice(e.offset.value,e.offset.value+e.size),t=Xe(n),r=e.inputChannels.length*e.lines*e.columns*e.totalBytes,l=new ArrayBuffer(r),o=new DataView(l);let a=0,p=0;const c=new Array(4);for(let s=0;s<e.lines;s++)for(let i=0;i<e.inputChannels.length;i++){let E=0;switch(e.inputChannels[i].pixelType){case 1:c[0]=a,c[1]=c[0]+e.columns,a=c[1]+e.columns;for(let w=0;w<e.columns;++w){const y=t[c[0]++]<<8|t[c[1]++];E+=y,o.setUint16(p,E,!0),p+=2}break;case 2:c[0]=a,c[1]=c[0]+e.columns,c[2]=c[1]+e.columns,a=c[2]+e.columns;for(let w=0;w<e.columns;++w){const y=t[c[0]++]<<24|t[c[1]++]<<16|t[c[2]++]<<8;E+=y,o.setUint32(p,E,!0),p+=4}break}}return o}function tn(e){const n=e.viewer,t={value:e.offset.value},r=new Uint8Array(e.columns*e.lines*(e.inputChannels.length*e.type*2)),l={version:te(n,t),unknownUncompressedSize:te(n,t),unknownCompressedSize:te(n,t),acCompressedSize:te(n,t),dcCompressedSize:te(n,t),rleCompressedSize:te(n,t),rleUncompressedSize:te(n,t),rleRawSize:te(n,t),totalAcUncompressedCount:te(n,t),totalDcUncompressedCount:te(n,t),acCompression:te(n,t)};if(l.version<2)throw new Error("EXRLoader.parse: "+Fe.compression+" version "+l.version+" is unsupported");const o=new Array;let a=Be(n,t)-2;for(;a>0;){const m=Ye(n.buffer,t),S=Ue(n,t),R=S>>2&3,k=(S>>4)-1,W=new Int8Array([k])[0],re=Ue(n,t);o.push({name:m,index:W,type:re,compression:R}),a-=m.length+3}const p=Fe.channels,c=new Array(e.inputChannels.length);for(let m=0;m<e.inputChannels.length;++m){const S=c[m]={},R=p[m];S.name=R.name,S.compression=0,S.decoded=!1,S.type=R.pixelType,S.pLinear=R.pLinear,S.width=e.columns,S.height=e.lines}const s={idx:new Array(3)};for(let m=0;m<e.inputChannels.length;++m){const S=c[m];for(let R=0;R<o.length;++R){const k=o[R];S.name==k.name&&(S.compression=k.compression,k.index>=0&&(s.idx[k.index]=m),S.offset=m)}}let i,E,v;if(l.acCompressedSize>0)switch(l.acCompression){case 0:i=new Uint16Array(l.totalAcUncompressedCount),Le(e.array,n,t,l.acCompressedSize,i,l.totalAcUncompressedCount);break;case 1:const m=e.array.slice(t.value,t.value+l.totalAcUncompressedCount),S=Xe(m);i=new Uint16Array(S.buffer),t.value+=l.totalAcUncompressedCount;break}if(l.dcCompressedSize>0){const m={array:e.array,offset:t,size:l.dcCompressedSize};E=new Uint16Array(qe(m).buffer),t.value+=l.dcCompressedSize}if(l.rleRawSize>0){const m=e.array.slice(t.value,t.value+l.rleCompressedSize),S=Xe(m);v=nn(S.buffer),t.value+=l.rleCompressedSize}let w=0;const y=new Array(c.length);for(let m=0;m<y.length;++m)y[m]=new Array;for(let m=0;m<e.lines;++m)for(let S=0;S<c.length;++S)y[S].push(w),w+=c[S].width*e.type*2;gn(s,y,c,i,E,r);for(let m=0;m<c.length;++m){const S=c[m];if(!S.decoded)switch(S.compression){case 2:let R=0,k=0;for(let W=0;W<e.lines;++W){let re=y[m][R];for(let z=0;z<S.width;++z){for(let M=0;M<2*S.type;++M)r[re++]=v[k+M*S.width*S.height];k++}R++}break;case 1:default:throw new Error("EXRLoader.parse: unsupported channel compression")}}return new DataView(r.buffer)}function Ye(e,n){const t=new Uint8Array(e);let r=0;for(;t[n.value+r]!=0;)r+=1;const l=new TextDecoder().decode(t.slice(n.value,n.value+r));return n.value=n.value+r+1,l}function Un(e,n,t){const r=new TextDecoder().decode(new Uint8Array(e).slice(n.value,n.value+t));return n.value=n.value+t,r}function An(e,n){const t=oe(e,n),r=le(e,n);return[t,r]}function dn(e,n){const t=le(e,n),r=le(e,n);return[t,r]}function oe(e,n){const t=e.getInt32(n.value,!0);return n.value=n.value+4,t}function le(e,n){const t=e.getUint32(n.value,!0);return n.value=n.value+4,t}function rn(e,n){const t=e[n.value];return n.value=n.value+1,t}function Ue(e,n){const t=e.getUint8(n.value);return n.value=n.value+1,t}const te=function(e,n){let t;return"getBigInt64"in DataView.prototype?t=Number(e.getBigInt64(n.value,!0)):t=e.getUint32(n.value+4,!0)+Number(e.getUint32(n.value,!0)<<32),n.value+=8,t};function j(e,n){const t=e.getFloat32(n.value,!0);return n.value+=4,t}function Nn(e,n){return O.DataUtils.toHalfFloat(j(e,n))}function g(e){const n=(e&31744)>>10,t=e&1023;return(e>>15?-1:1)*(n?n===31?t?NaN:1/0:Math.pow(2,n-15)*(1+t/1024):6103515625e-14*(t/1024))}function Be(e,n){const t=e.getUint16(n.value,!0);return n.value+=2,t}function Mn(e,n){return g(Be(e,n))}function On(e,n,t,r){const l=t.value,o=[];for(;t.value<l+r-1;){const a=Ye(n,t),p=oe(e,t),c=Ue(e,t);t.value+=3;const s=oe(e,t),i=oe(e,t);o.push({name:a,pixelType:p,pLinear:c,xSampling:s,ySampling:i})}return t.value+=1,o}function Fn(e,n){const t=j(e,n),r=j(e,n),l=j(e,n),o=j(e,n),a=j(e,n),p=j(e,n),c=j(e,n),s=j(e,n);return{redX:t,redY:r,greenX:l,greenY:o,blueX:a,blueY:p,whiteX:c,whiteY:s}}function xn(e,n){const t=["NO_COMPRESSION","RLE_COMPRESSION","ZIPS_COMPRESSION","ZIP_COMPRESSION","PIZ_COMPRESSION","PXR24_COMPRESSION","B44_COMPRESSION","B44A_COMPRESSION","DWAA_COMPRESSION","DWAB_COMPRESSION"],r=Ue(e,n);return t[r]}function Dn(e,n){const t=oe(e,n),r=oe(e,n),l=oe(e,n),o=oe(e,n);return{xMin:t,yMin:r,xMax:l,yMax:o}}function Ln(e,n){const t=["INCREASING_Y","DECREASING_Y","RANDOM_Y"],r=Ue(e,n);return t[r]}function kn(e,n){const t=["ENVMAP_LATLONG","ENVMAP_CUBE"],r=Ue(e,n);return t[r]}function Bn(e,n){const t=["ONE_LEVEL","MIPMAP_LEVELS","RIPMAP_LEVELS"],r=["ROUND_DOWN","ROUND_UP"],l=le(e,n),o=le(e,n),a=Ue(e,n);return{xSize:l,ySize:o,levelMode:t[a&15],roundingMode:r[a>>4]}}function Pn(e,n){const t=j(e,n),r=j(e,n);return[t,r]}function Hn(e,n){const t=j(e,n),r=j(e,n),l=j(e,n);return[t,r,l]}function Zn(e,n,t,r,l){if(r==="string"||r==="stringvector"||r==="iccProfile")return Un(n,t,l);if(r==="chlist")return On(e,n,t,l);if(r==="chromaticities")return Fn(e,t);if(r==="compression")return xn(e,t);if(r==="box2i")return Dn(e,t);if(r==="envmap")return kn(e,t);if(r==="tiledesc")return Bn(e,t);if(r==="lineOrder")return Ln(e,t);if(r==="float")return j(e,t);if(r==="v2f")return Pn(e,t);if(r==="v3f")return Hn(e,t);if(r==="int")return oe(e,t);if(r==="rational")return An(e,t);if(r==="timecode")return dn(e,t);if(r==="preview")return t.value+=l,"skipped";t.value+=l}function zn(e,n){const t=Math.log2(e);return n=="ROUND_DOWN"?Math.floor(t):Math.ceil(t)}function Gn(e,n,t){let r=0;switch(e.levelMode){case"ONE_LEVEL":r=1;break;case"MIPMAP_LEVELS":r=zn(Math.max(n,t),e.roundingMode)+1;break;case"RIPMAP_LEVELS":throw new Error("THREE.EXRLoader: RIPMAP_LEVELS tiles currently unsupported.")}return r}function on(e,n,t,r){const l=new Array(e);for(let o=0;o<e;o++){const a=1<<o;let p=n/a|0;r=="ROUND_UP"&&p*a<n&&(p+=1);const c=Math.max(p,1);l[o]=(c+t-1)/t|0}return l}function Yn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.tileCount;r++){const l=oe(e.viewer,n),o=oe(e.viewer,n);n.value+=8,e.size=le(e.viewer,n);const a=l*e.blockWidth,p=o*e.blockHeight;e.columns=a+e.blockWidth>e.width?e.width-a:e.blockWidth,e.lines=p+e.blockHeight>e.height?e.height-p:e.blockHeight;const c=e.columns*e.totalBytes,i=e.size<e.lines*c?e.uncompress(e):$e(e);n.value+=e.size;for(let E=0;E<e.lines;E++){const v=E*e.columns*e.totalBytes;for(let w=0;w<e.inputChannels.length;w++){const y=Fe.channels[w].name,m=e.channelByteOffsets[y]*e.columns,S=e.decodeChannels[y];if(S===void 0)continue;t.value=v+m;const R=(e.height-(1+p+E))*e.outLineWidth;for(let k=0;k<e.columns;k++){const W=R+(k+a)*e.outputChannels+S;e.byteArray[W]=e.getter(i,t)}}}}}function Wn(){const e=this,n=e.offset,t={value:0};for(let r=0;r<e.height/e.blockHeight;r++){const l=oe(e.viewer,n)-Fe.dataWindow.yMin;e.size=le(e.viewer,n),e.lines=l+e.blockHeight>e.height?e.height-l:e.blockHeight;const o=e.columns*e.totalBytes,p=e.size<e.lines*o?e.uncompress(e):$e(e);n.value+=e.size;for(let c=0;c<e.blockHeight;c++){const s=r*e.blockHeight,i=c+e.scanOrder(s);if(i>=e.height)continue;const E=c*o,v=(e.height-1-i)*e.outLineWidth;for(let w=0;w<e.inputChannels.length;w++){const y=Fe.channels[w].name,m=e.channelByteOffsets[y]*e.columns,S=e.decodeChannels[y];if(S!==void 0){t.value=E+m;for(let R=0;R<e.columns;R++){const k=v+R*e.outputChannels+S;e.byteArray[k]=e.getter(p,t)}}}}}}function Xn(e,n,t){const r={};if(e.getUint32(0,!0)!=20000630)throw new Error("THREE.EXRLoader: Provided file doesn't appear to be in OpenEXR format.");r.version=e.getUint8(4);const l=e.getUint8(5);r.spec={singleTile:!!(l&2),longName:!!(l&4),deepFormat:!!(l&8),multiPart:!!(l&16)},t.value=8;let o=!0;for(;o;){const a=Ye(n,t);if(a==="")o=!1;else{const p=Ye(n,t),c=le(e,t),s=Zn(e,n,t,p,c);s===void 0?console.warn(`THREE.EXRLoader: Skipped unknown header attribute type '${p}'.`):r[a]=s}}if((l&-7)!=0)throw console.error("THREE.EXRHeader:",r),new Error("THREE.EXRLoader: Provided file is currently unsupported.");return r}function Kn(e,n,t,r,l){const o={size:0,viewer:n,array:t,offset:r,width:e.dataWindow.xMax-e.dataWindow.xMin+1,height:e.dataWindow.yMax-e.dataWindow.yMin+1,inputChannels:e.channels,channelByteOffsets:{},scanOrder:null,totalBytes:null,columns:null,lines:null,type:null,uncompress:null,getter:null,format:null,colorSpace:O.LinearSRGBColorSpace};switch(e.compression){case"NO_COMPRESSION":o.blockHeight=1,o.uncompress=$e;break;case"RLE_COMPRESSION":o.blockHeight=1,o.uncompress=Rn;break;case"ZIPS_COMPRESSION":o.blockHeight=1,o.uncompress=qe;break;case"ZIP_COMPRESSION":o.blockHeight=16,o.uncompress=qe;break;case"PIZ_COMPRESSION":o.blockHeight=32,o.uncompress=Tn;break;case"PXR24_COMPRESSION":o.blockHeight=16,o.uncompress=bn;break;case"DWAA_COMPRESSION":o.blockHeight=32,o.uncompress=tn;break;case"DWAB_COMPRESSION":o.blockHeight=256,o.uncompress=tn;break;default:throw new Error("EXRLoader.parse: "+e.compression+" is unsupported")}const a={};for(const i of e.channels)switch(i.name){case"Y":case"R":case"G":case"B":case"A":a[i.name]=!0,o.type=i.pixelType}let p=!1;if(a.R&&a.G&&a.B)p=!a.A,o.outputChannels=4,o.decodeChannels={R:0,G:1,B:2,A:3};else if(a.Y)o.outputChannels=1,o.decodeChannels={Y:0};else throw new Error("EXRLoader.parse: file contains unsupported data channels.");if(o.type==1)switch(l){case O.FloatType:o.getter=Mn;break;case O.HalfFloatType:o.getter=Be;break}else if(o.type==2)switch(l){case O.FloatType:o.getter=j;break;case O.HalfFloatType:o.getter=Nn}else throw new Error("EXRLoader.parse: unsupported pixelType "+o.type+" for "+e.compression+".");o.columns=o.width;const c=o.width*o.height*o.outputChannels;switch(l){case O.FloatType:o.byteArray=new Float32Array(c),p&&o.byteArray.fill(1,0,c);break;case O.HalfFloatType:o.byteArray=new Uint16Array(c),p&&o.byteArray.fill(15360,0,c);break;default:console.error("THREE.EXRLoader: unsupported type: ",l);break}let s=0;for(const i of e.channels)o.decodeChannels[i.name]!==void 0&&(o.channelByteOffsets[i.name]=s),s+=i.pixelType*2;if(o.totalBytes=s,o.outLineWidth=o.width*o.outputChannels,e.lineOrder==="INCREASING_Y"?o.scanOrder=i=>i:o.scanOrder=i=>o.height-1-i,o.outputChannels==4?(o.format=O.RGBAFormat,o.colorSpace=O.LinearSRGBColorSpace):(o.format=O.RedFormat,o.colorSpace=O.NoColorSpace),e.spec.singleTile){o.blockHeight=e.tiles.ySize,o.blockWidth=e.tiles.xSize;const i=Gn(e.tiles,o.width,o.height),E=on(i,o.width,e.tiles.xSize,e.tiles.roundingMode),v=on(i,o.height,e.tiles.ySize,e.tiles.roundingMode);o.tileCount=E[0]*v[0];for(let w=0;w<i;w++)for(let y=0;y<v[w];y++)for(let m=0;m<E[w];m++)te(n,r);o.decode=Yn.bind(o)}else{o.blockWidth=o.width;const i=Math.ceil(o.height/o.blockHeight);for(let E=0;E<i;E++)te(n,r);o.decode=Wn.bind(o)}return o}const ln={value:0},sn=new DataView(h),$n=new Uint8Array(h),Fe=Xn(sn,h,ln),xe=Kn(Fe,sn,$n,ln,this.type);return xe.decode(),{header:Fe,width:xe.width,height:xe.height,data:xe.byteArray,format:xe.format,colorSpace:xe.colorSpace,type:this.type}}setDataType(h){return this.type=h,this}load(h,f,_,I){function H(U,J){U.colorSpace=J.colorSpace,U.minFilter=O.LinearFilter,U.magFilter=O.LinearFilter,U.generateMipmaps=!1,U.flipY=!1,f&&f(U,J)}return super.load(h,H,_,I)}}class ht extends O.DataTextureLoader{constructor(h){super(h),this.type=O.HalfFloatType}parse(h){const U=function(C,d){switch(C){case 1:throw new Error("THREE.RGBELoader: Read Error: "+(d||""));case 2:throw new Error("THREE.RGBELoader: Write Error: "+(d||""));case 3:throw new Error("THREE.RGBELoader: Bad File Format: "+(d||""));default:case 4:throw new Error("THREE.RGBELoader: Memory Error: "+(d||""))}},ae=`
|
|
7
|
-
`,T=function(C,d,x){d=d||1024;let F=C.pos,Z=-1,b=0,Y="",N=String.fromCharCode.apply(null,new Uint16Array(C.subarray(F,F+128)));for(;0>(Z=N.indexOf(ae))&&b<d&&F<C.byteLength;)Y+=N,b+=N.length,F+=128,N+=String.fromCharCode.apply(null,new Uint16Array(C.subarray(F,F+128)));return-1<Z?(C.pos+=b+Z+1,Y+N.slice(0,Z)):!1},B=function(C){const d=/^#\?(\S+)/,x=/^\s*GAMMA\s*=\s*(\d+(\.\d+)?)\s*$/,A=/^\s*EXPOSURE\s*=\s*(\d+(\.\d+)?)\s*$/,F=/^\s*FORMAT=(\S+)\s*$/,Z=/^\s*\-Y\s+(\d+)\s+\+X\s+(\d+)\s*$/,b={valid:0,string:"",comments:"",programtype:"RGBE",format:"",gamma:1,exposure:1,width:0,height:0};let Y,N;for((C.pos>=C.byteLength||!(Y=T(C)))&&U(1,"no header found"),(N=Y.match(d))||U(3,"bad initial token"),b.valid|=1,b.programtype=N[1],b.string+=Y+`
|
|
8
|
-
`;Y=T(C),Y!==!1;){if(b.string+=Y+`
|
|
9
|
-
`,Y.charAt(0)==="#"){b.comments+=Y+`
|
|
10
|
-
`;continue}if((N=Y.match(x))&&(b.gamma=parseFloat(N[1])),(N=Y.match(A))&&(b.exposure=parseFloat(N[1])),(N=Y.match(F))&&(b.valid|=2,b.format=N[1]),(N=Y.match(Z))&&(b.valid|=4,b.height=parseInt(N[1],10),b.width=parseInt(N[2],10)),b.valid&2&&b.valid&4)break}return b.valid&2||U(3,"missing format specifier"),b.valid&4||U(3,"missing image size specifier"),b},pe=function(C,d,x){const A=d;if(A<8||A>32767||C[0]!==2||C[1]!==2||C[2]&128)return new Uint8Array(C);A!==(C[2]<<8|C[3])&&U(3,"wrong scanline width");const F=new Uint8Array(4*d*x);F.length||U(4,"unable to allocate buffer space");let Z=0,b=0;const Y=4*A,N=new Uint8Array(4),ne=new Uint8Array(Y);let Te=x;for(;Te>0&&b<C.byteLength;){b+4>C.byteLength&&U(1),N[0]=C[b++],N[1]=C[b++],N[2]=C[b++],N[3]=C[b++],(N[0]!=2||N[1]!=2||(N[2]<<8|N[3])!=A)&&U(3,"bad rgbe scanline format");let Q=0,K;for(;Q<Y&&b<C.byteLength;){K=C[b++];const X=K>128;if(X&&(K-=128),(K===0||Q+K>Y)&&U(3,"bad scanline data"),X){const $=C[b++];for(let ve=0;ve<K;ve++)ne[Q++]=$}else ne.set(C.subarray(b,b+K),Q),Q+=K,b+=K}const Oe=A;for(let X=0;X<Oe;X++){let $=0;F[Z]=ne[X+$],$+=A,F[Z+1]=ne[X+$],$+=A,F[Z+2]=ne[X+$],$+=A,F[Z+3]=ne[X+$],Z+=4}Te--}return F},Ne=function(C,d,x,A){const F=C[d+3],Z=Math.pow(2,F-128)/255;x[A+0]=C[d+0]*Z,x[A+1]=C[d+1]*Z,x[A+2]=C[d+2]*Z,x[A+3]=1},Ie=function(C,d,x,A){const F=C[d+3],Z=Math.pow(2,F-128)/255;x[A+0]=O.DataUtils.toHalfFloat(Math.min(C[d+0]*Z,65504)),x[A+1]=O.DataUtils.toHalfFloat(Math.min(C[d+1]*Z,65504)),x[A+2]=O.DataUtils.toHalfFloat(Math.min(C[d+2]*Z,65504)),x[A+3]=O.DataUtils.toHalfFloat(1)},ce=new Uint8Array(h);ce.pos=0;const fe=B(ce),Me=fe.width,ee=fe.height,ge=pe(ce.subarray(ce.pos),Me,ee);let Ce,Re,Ee;switch(this.type){case O.FloatType:Ee=ge.length/4;const C=new Float32Array(Ee*4);for(let x=0;x<Ee;x++)Ne(ge,x*4,C,x*4);Ce=C,Re=O.FloatType;break;case O.HalfFloatType:Ee=ge.length/4;const d=new Uint16Array(Ee*4);for(let x=0;x<Ee;x++)Ie(ge,x*4,d,x*4);Ce=d,Re=O.HalfFloatType;break;default:throw new Error("THREE.RGBELoader: Unsupported type: "+this.type)}return{width:Me,height:ee,data:Ce,header:fe.string,gamma:fe.gamma,exposure:fe.exposure,type:Re}}setDataType(h){return this.type=h,this}load(h,f,_,I){function H(U,J){switch(U.type){case O.FloatType:case O.HalfFloatType:U.colorSpace=O.LinearSRGBColorSpace,U.minFilter=O.LinearFilter,U.magFilter=O.LinearFilter,U.generateMipmaps=!1,U.flipY=!0;break}f&&f(U,J)}return super.load(h,H,_,I)}}function pt(u,h=[.3,.3,.3]){const f=document.querySelector(`#${u}`);if(!f){console.log(" 获取 infoPlane 元素失败 (id) =====> :",u);return}const _=f.cloneNode(!0);_.style.display="block";const I=new an.CSS3DSprite(_);return I.visible=!1,I.scale.set(...h),I}function ft(u,h){const f=Et(u);f.style.display="block";const _=new an.CSS3DSprite(f);return _.visible=!1,_.scale.set(h,h,h),_}const Et=u=>{const h=document.createElement("div");h.style.cssText=`
|
|
11
|
-
border-radius: 50px;
|
|
12
|
-
border: 2px solid rgba(255, 255, 255, 0.5);
|
|
13
|
-
background-color: rgba(15, 20, 22, 0.562);
|
|
14
|
-
justify-content: flex-start;
|
|
15
|
-
align-items: center;
|
|
16
|
-
padding: 20px 30px;
|
|
17
|
-
display: flex;
|
|
18
|
-
transform-origin: center 0;`;const f=document.createElement("span");return f.style.cssText=`
|
|
19
|
-
font-size: 40px;
|
|
20
|
-
line-height: 1;
|
|
21
|
-
white-space: nowrap;
|
|
22
|
-
color: #fff;
|
|
23
|
-
font-weight: 700;
|
|
24
|
-
`,f.innerText=u,h.appendChild(f),h},wt=(u,h)=>{const f={};u.forEach(H=>{let U=H.parent;for(;U;)f[U.uuid]?f[U.uuid]++:f[U.uuid]=1,U=U.parent});let _=null,I=0;for(const H in f)f[H]>I&&(I=f[H],_=h.getObjectByProperty("uuid",H));return _},Qe={};async function mt(u,h){if(!h)return;if(Qe[h]){const _=Qe[h];u.environment=_;return}let f=wn(h);return new Promise((_,I)=>{f.load(h,_,void 0,I)}).then(_=>{_.mapping=O.EquirectangularReflectionMapping,u.environment=_,Qe[h]=_}).catch(_=>{console.log(" =====> e:",_)})}async function gt(u){let h=wn(u);return new Promise((f,_)=>{h.load(u,f,void 0,_)})}function wn(u){return u.split(".").pop()==="exr"?new ut:new ht}const vt=(u,h,f)=>{if(u.userData&&u.userData[h]===f)return u;let _=!1,I=null;return u.traverse(H=>{_||H.userData&&H.userData[h]===f&&(I=H,_=!0)}),I},mn=(u,h,f)=>u?u.userData&&u.userData[h]===f?u:mn(u.parent,h,f):null;exports.ImageLoader=gt;exports.createInfoPlane=pt;exports.createTagPlane=ft;exports.getCommonParent=wt;exports.getObjectByUserData=vt;exports.getRootObj=mn;exports.initEnvImage=mt;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("three"),C=require("vue"),I=require("./PredictiveLoader-Xy5S4HBr.cjs"),u={c:null,u:[new c.Vector3,new c.Vector3,new c.Vector3],e:[]},h={c:null,u:[new c.Vector3,new c.Vector3,new c.Vector3],e:[]},b=[[],[],[]],a=[[],[],[]],y=[],V=new c.Vector3,B=new c.Vector3,j=new c.Vector3,x=new c.Vector3,Z=new c.Vector3,K=new c.Vector3,v=new c.Matrix3,ee=new c.Box3,_=new c.Matrix4,te=new c.Matrix4,ne=new c.Ray;class G{constructor(e=new c.Vector3,r=new c.Vector3,s=new c.Matrix3){this.center=e,this.halfSize=r,this.rotation=s}set(e,r,s){return this.center=e,this.halfSize=r,this.rotation=s,this}copy(e){return this.center.copy(e.center),this.halfSize.copy(e.halfSize),this.rotation.copy(e.rotation),this}clone(){return new this.constructor().copy(this)}getSize(e){return e.copy(this.halfSize).multiplyScalar(2)}clampPoint(e,r){const s=this.halfSize;x.subVectors(e,this.center),this.rotation.extractBasis(V,B,j),r.copy(this.center);const o=c.MathUtils.clamp(x.dot(V),-s.x,s.x);r.add(V.multiplyScalar(o));const t=c.MathUtils.clamp(x.dot(B),-s.y,s.y);r.add(B.multiplyScalar(t));const f=c.MathUtils.clamp(x.dot(j),-s.z,s.z);return r.add(j.multiplyScalar(f)),r}containsPoint(e){return x.subVectors(e,this.center),this.rotation.extractBasis(V,B,j),Math.abs(x.dot(V))<=this.halfSize.x&&Math.abs(x.dot(B))<=this.halfSize.y&&Math.abs(x.dot(j))<=this.halfSize.z}intersectsBox3(e){return this.intersectsOBB(le.fromBox3(e))}intersectsSphere(e){return this.clampPoint(e.center,K),K.distanceToSquared(e.center)<=e.radius*e.radius}intersectsOBB(e,r=Number.EPSILON){u.c=this.center,u.e[0]=this.halfSize.x,u.e[1]=this.halfSize.y,u.e[2]=this.halfSize.z,this.rotation.extractBasis(u.u[0],u.u[1],u.u[2]),h.c=e.center,h.e[0]=e.halfSize.x,h.e[1]=e.halfSize.y,h.e[2]=e.halfSize.z,e.rotation.extractBasis(h.u[0],h.u[1],h.u[2]);for(let t=0;t<3;t++)for(let f=0;f<3;f++)b[t][f]=u.u[t].dot(h.u[f]);x.subVectors(h.c,u.c),y[0]=x.dot(u.u[0]),y[1]=x.dot(u.u[1]),y[2]=x.dot(u.u[2]);for(let t=0;t<3;t++)for(let f=0;f<3;f++)a[t][f]=Math.abs(b[t][f])+r;let s,o;for(let t=0;t<3;t++)if(s=u.e[t],o=h.e[0]*a[t][0]+h.e[1]*a[t][1]+h.e[2]*a[t][2],Math.abs(y[t])>s+o)return!1;for(let t=0;t<3;t++)if(s=u.e[0]*a[0][t]+u.e[1]*a[1][t]+u.e[2]*a[2][t],o=h.e[t],Math.abs(y[0]*b[0][t]+y[1]*b[1][t]+y[2]*b[2][t])>s+o)return!1;return s=u.e[1]*a[2][0]+u.e[2]*a[1][0],o=h.e[1]*a[0][2]+h.e[2]*a[0][1],!(Math.abs(y[2]*b[1][0]-y[1]*b[2][0])>s+o||(s=u.e[1]*a[2][1]+u.e[2]*a[1][1],o=h.e[0]*a[0][2]+h.e[2]*a[0][0],Math.abs(y[2]*b[1][1]-y[1]*b[2][1])>s+o)||(s=u.e[1]*a[2][2]+u.e[2]*a[1][2],o=h.e[0]*a[0][1]+h.e[1]*a[0][0],Math.abs(y[2]*b[1][2]-y[1]*b[2][2])>s+o)||(s=u.e[0]*a[2][0]+u.e[2]*a[0][0],o=h.e[1]*a[1][2]+h.e[2]*a[1][1],Math.abs(y[0]*b[2][0]-y[2]*b[0][0])>s+o)||(s=u.e[0]*a[2][1]+u.e[2]*a[0][1],o=h.e[0]*a[1][2]+h.e[2]*a[1][0],Math.abs(y[0]*b[2][1]-y[2]*b[0][1])>s+o)||(s=u.e[0]*a[2][2]+u.e[2]*a[0][2],o=h.e[0]*a[1][1]+h.e[1]*a[1][0],Math.abs(y[0]*b[2][2]-y[2]*b[0][2])>s+o)||(s=u.e[0]*a[1][0]+u.e[1]*a[0][0],o=h.e[1]*a[2][2]+h.e[2]*a[2][1],Math.abs(y[1]*b[0][0]-y[0]*b[1][0])>s+o)||(s=u.e[0]*a[1][1]+u.e[1]*a[0][1],o=h.e[0]*a[2][2]+h.e[2]*a[2][0],Math.abs(y[1]*b[0][1]-y[0]*b[1][1])>s+o)||(s=u.e[0]*a[1][2]+u.e[1]*a[0][2],o=h.e[0]*a[2][1]+h.e[1]*a[2][0],Math.abs(y[1]*b[0][2]-y[0]*b[1][2])>s+o))}intersectsPlane(e){this.rotation.extractBasis(V,B,j);const r=this.halfSize.x*Math.abs(e.normal.dot(V))+this.halfSize.y*Math.abs(e.normal.dot(B))+this.halfSize.z*Math.abs(e.normal.dot(j)),s=e.normal.dot(this.center)-e.constant;return Math.abs(s)<=r}intersectRay(e,r){return this.getSize(Z),ee.setFromCenterAndSize(x.set(0,0,0),Z),_.setFromMatrix3(this.rotation),_.setPosition(this.center),te.copy(_).invert(),ne.copy(e).applyMatrix4(te),ne.intersectBox(ee,r)?r.applyMatrix4(_):null}intersectsRay(e){return this.intersectRay(e,x)!==null}fromBox3(e){return e.getCenter(this.center),e.getSize(this.halfSize).multiplyScalar(.5),this.rotation.identity(),this}equals(e){return e.center.equals(this.center)&&e.halfSize.equals(this.halfSize)&&e.rotation.equals(this.rotation)}applyMatrix4(e){const r=e.elements;let s=x.set(r[0],r[1],r[2]).length();const o=x.set(r[4],r[5],r[6]).length(),t=x.set(r[8],r[9],r[10]).length();e.determinant()<0&&(s=-s),v.setFromMatrix4(e);const l=1/s,n=1/o,i=1/t;return v.elements[0]*=l,v.elements[1]*=l,v.elements[2]*=l,v.elements[3]*=n,v.elements[4]*=n,v.elements[5]*=n,v.elements[6]*=i,v.elements[7]*=i,v.elements[8]*=i,this.rotation.multiply(v),this.halfSize.x*=s,this.halfSize.y*=o,this.halfSize.z*=t,x.setFromMatrixPosition(e),this.center.add(x),this}}const le=new G,ue={enableDamping:!0,dampingFactor:.25,screenSpacePanning:!1,minDistance:.1,maxDistance:1e3,maxPolarAngle:c.MathUtils.degToRad(60)};function he(F,e){typeof console<"u"&&console.warn&&console.warn(`[ThreeIns] useThreeJs() Hook 已弃用,建议使用 ThreeIns 类代替。
|
|
2
|
-
旧用法: const { scene, camera } = useThreeJs(selector, options)
|
|
3
|
-
新用法: const threeIns = new ThreeIns(selector, options)
|
|
4
|
-
|
|
5
|
-
ThreeIns 类提供更完整的 API 和更好的性能。`);const r=Object.assign({css3d:!1,stats:!1,renderType:"change",control:{init:!0,options:{}}},e||{});let s,o,t,f=[];const l=C.ref(!1),n=C.shallowRef(),i=C.ref(0),d=C.ref(0),m=new c.WebGLRenderer({antialias:!0,alpha:!0,precision:"mediump",logarithmicDepthBuffer:!0}),z=new c.Scene({}),p=new c.PerspectiveCamera(50,1,.1,2e3),M=Math.tan(Math.PI/180*p.fov/2);let R=!1;m.setPixelRatio(window.devicePixelRatio);function L(){l.value=!1;const w=Y();i.value=w[0],d.value=w[1],p.aspect=i.value/d.value,p.position.set(47,39,100),p.fov=360/Math.PI*Math.atan(M*(d.value/i.value)),p.lookAt(0,0,0),p.updateProjectionMatrix(),m.setSize(i.value,d.value),s.appendChild(m.domElement),r.stats&&W(),r.css3d&&oe();let P;if(r.control&&r.control.init){P=I.createOrbitControl(p,m.domElement);const A=Object.assign(ue,r.control.options||{});Object.keys(A).forEach(k=>{P[k]=A[k]})}return C.nextTick(()=>l.value=!0),P}function D(w){w.preventDefault(),cancelAnimationFrame(T)}function U(w){w.preventDefault(),L(),T()}function $(w){f.push(w)}function T(w){f&&f.length&&f.forEach(P=>{typeof P=="function"&&P()}),r.renderType==="loop"&&S(),requestAnimationFrame(T)}function S(){R=!1,o&&o.update(),n.value&&n.value.update(),m.render(z,p),t&&t.render(z,p)}function H(){R||(R=!0,requestAnimationFrame(S))}function g(){C.nextTick(()=>{const w=Y();i.value=w[0],d.value=w[1],p.aspect=i.value/d.value,p.fov=360/Math.PI*Math.atan(M*(d.value/i.value)),p.updateProjectionMatrix(),p.lookAt(z.position),m.setSize(i.value,d.value),t&&t.setSize(i.value,d.value),S()})}function Y(){return s=document.querySelector(F),s?[s.clientWidth,s.clientHeight]:[0,0]}function W(){o=new I.Stats,o.dom.style.cssText="position:absolute;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",s.appendChild(o.dom)}function se(w,P,A,k,J){const N=new c.Box3().setFromObject(w),Q=N.getSize(new c.Vector3).length(),E=N.getCenter(new c.Vector3);J&&E.add(J);const ae=Q*P*.5,ie=c.MathUtils.degToRad(A.fov*.5),ce=ae/Math.tan(ie),X=new c.Vector3().subVectors(A.position,E).multiply(new c.Vector3(1,1,1)).normalize().multiplyScalar(ce).add(E),q={x:X.x,y:X.y,z:X.z,lookAt_x:E.x,lookAt_y:E.y,lookAt_z:E.z};return A.position.set(q.x,q.y,q.z),A.lookAt(q.lookAt_x,q.lookAt_y,q.lookAt_z),A.updateProjectionMatrix(),k.target.copy(E),k.update(),Q}function oe(){t=new I.CSS3DRenderer,t.setSize(i.value,d.value),t.domElement.style.position="absolute",t.domElement.style.top=0,t.domElement.style.left=0,t.domElement.style.pointerEvents="none",s.appendChild(t.domElement)}function re(){I.disposeThreeObject(z)}return C.onMounted(()=>{n.value=L(),window.addEventListener("resize",g,!1),m.domElement.addEventListener("webglcontextlost",D,!1),m.domElement.addEventListener("webglcontextrestored",U,!1),r.renderType==="loop"?requestAnimationFrame(T):r.renderType==="change"&&n.value&&n.value.addEventListener("change",H)}),C.onUnmounted(()=>{cancelAnimationFrame(T),m.domElement.removeEventListener("resize",g,!1),m.domElement.removeEventListener("webglcontextlost",D,!1),m.domElement.removeEventListener("webglcontextrestored",U,!1),re()}),{addAnimate:$,frameArea:se,onRender:S,css3dRenderer:t,scene:z,camera:p,control:n,renderer:m,domWidth:i,domHeight:d,isReady:l}}const fe=(F="app")=>{const e=new c.Raycaster;e.params.Line.threshold=8;const r=new c.Vector2,s=document.getElementById(F);function o(l,n){const{scaleX:i,scaleY:d}=f(s),{clientWidth:m,clientHeight:z}=n,p=n.getBoundingClientRect(),M=m*i,R=z*d,L=l.clientX-p.left,D=l.clientY-p.top;return r.x=(l.clientX-p.left)/M*2-1,r.y=-((l.clientY-p.top)/R)*2+1,{pointer:r,x:L,y:D}}function t(l,n,i,d){const{pointer:m,x:z,y:p}=o(l,n);return e.setFromCamera(m,i),{intersects:e.intersectObjects(d),pointer:m,x:z,y:p}}function f(l){const n=window.getComputedStyle(l),i=n.transform||n.webkitTransform||n.mozTransform;if(i&&i!=="none"){const d=i.match(/^matrix\((.+)\)$/);if(d){const m=d[1].split(", "),z=parseFloat(m[0]),p=parseFloat(m[3]);return{scaleX:z,scaleY:p}}}return{scaleX:1,scaleY:1}}return{raycaster:e,pointer:r,getPointer:o,getScale:f,getIntersects:t}},O=[],de=new c.Color(16711680),me=()=>{const F=()=>{O.splice(0)},e=(l,n)=>{n.traverse(i=>{i&&r(l,i)})},r=(l,n)=>{if(n.userData.needCheck&&(n.autoUpdateMatrix=!1,n.updateMatrix(),n.updateMatrixWorld(),n.isMesh)){const i=new c.Box3(new c.Vector3).setFromObject(n);n.geometry.userData.obb=new G,n.geometry.userData.obb.halfSize.copy(i.getSize(new c.Vector3)).multiplyScalar(.5).multiplyScalar(.88),n.userData.obb=new G,n.userData.originColor=n.material.color.clone(),n.userData.parentUid=l,O.push({object:n,parentUid:l})}};return{resetObbs:F,initObb:e,getObbObjectByParentUid:l=>O.filter(n=>n.parentUid===l),addObbFromArray:(l,n)=>{for(let i=0,d=n.length;i<d;i++)r(l,n[i])},removeObbFromArray:l=>{const n=O.filter(i=>!l.includes(i.object));O.splice(0,O.length,...n)},removeUidObb:l=>{for(let n=O.length-1;n>=0;n--)O[n].parentUid===l&&O.splice(n,1)}}};function pe(){const{asyncFetch:F}=I.useGLTFLoader();async function e(o,t={}){const{maxConcurrent:f=3,maxRetries:l=3,onProgress:n,onModelLoad:i,onModelError:d}=t,m=new Map,z=new Map,p=[...o];let M=0,R=0;return new Promise((L,D)=>{const U=async T=>{const{path:S,version:H}=T;R++;try{const g=await F(S,H,Y=>{const W=M/o.length*100+Y/o.length;n==null||n(Math.round(W))},{maxRetries:l});if(g)m.set(S,g),i==null||i(S,g);else throw new Error(`模型加载返回空结果: ${S}`)}catch(g){console.error(`[ 批量加载 ] 加载失败: ${S}`,g),z.set(S,g),d==null||d(S,g)}finally{R--,M++;const g=M/o.length*100;n==null||n(Math.round(g)),$()}},$=()=>{if(M>=o.length){z.size>0&&console.warn(`[ 批量加载 ] 完成,但有 ${z.size} 个模型加载失败`),L(m);return}for(;p.length>0&&R<f;){const T=p.shift();U(T)}};$()})}async function r(o,t={}){console.log(`[ 批量预加载 ] 开始预加载 ${o.length} 个模型`);const f=await e(o,{...t,maxConcurrent:t.maxConcurrent||2});return console.log(`[ 批量预加载 ] 完成,成功加载 ${f.size} 个模型`),f}async function s(o,t={}){const f=new Map;for(let l=0;l<o.length;l++)console.log(`[ 分组批量加载 ] 加载第 ${l+1}/${o.length} 组`),(await e(o[l],{...t,onProgress:i=>{var m;const d=l/o.length*100+i/o.length;(m=t.onProgress)==null||m.call(t,Math.round(d))}})).forEach((i,d)=>{f.set(d,i)});return f}return{batchLoad:e,preload:r,batchLoadGroups:s}}exports.intersectColor=de;exports.obbObjects=O;exports.useBatchGLTFLoader=pe;exports.useObb=me;exports.useRaycaster=fe;exports.useThreeJs=he;
|