mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-03-15 02:10:55 +00:00
1 line
No EOL
4.6 KiB
JavaScript
1 line
No EOL
4.6 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,64972,e=>{"use strict";var r=e.i(43476),t=e.i(932),i=e.i(71645),s=e.i(71753),o=e.i(47071),n=e.i(90072),a=e.i(85557),c=e.i(12979);let l=new n.Vector3,u=new n.Vector3,d=new n.Vector3,f=new n.Vector3,y=new n.Vector3,b=new n.Vector3,x=new n.Vector3(0,1,0);function h(e){let i,s,a,l,u,d=(0,t.c)(14),{entity:f}=e,{visual:y}=f;d[0]!==y.texture?(i=(0,c.textureToUrl)(y.texture),d[0]=y.texture,d[1]=i):i=d[1];let b=i,x=(0,o.useTexture)(b,p),h=Array.isArray(x)?x[0]:x;d[2]!==y.color.b||d[3]!==y.color.g||d[4]!==y.color.r?(s=new n.Color().setRGB(y.color.r,y.color.g,y.color.b,n.SRGBColorSpace),d[2]=y.color.b,d[3]=y.color.g,d[4]=y.color.r,d[5]=s):s=d[5];let m=s;return d[6]!==y.size?(a=[y.size,y.size,1],d[6]=y.size,d[7]=a):a=d[7],d[8]!==m||d[9]!==h?(l=(0,r.jsx)("spriteMaterial",{map:h,color:m,transparent:!0,blending:n.AdditiveBlending,depthWrite:!1,toneMapped:!1}),d[8]=m,d[9]=h,d[10]=l):l=d[10],d[11]!==a||d[12]!==l?(u=(0,r.jsx)("sprite",{scale:a,children:l}),d[11]=a,d[12]=l,d[13]=u):u=d[13],u}function p(e){let r=Array.isArray(e)?e[0]:e;(0,a.setupEffectTexture)(r)}function m(e){let h,p,m,g,S,w,j,z,T,V,v,C,B=(0,t.c)(29),{entity:R}=e,{visual:U}=R,_=(0,i.useRef)(null),F=(0,i.useRef)(null),q=(0,i.useRef)(null);B[0]===Symbol.for("react.memo_cache_sentinel")?(h=new n.Quaternion,B[0]=h):h=B[0];let M=(0,i.useRef)(h);B[1]!==U.texture?(p=(0,c.textureToUrl)(U.texture),B[1]=U.texture,B[2]=p):p=B[2];let W=U.crossTexture??U.texture;B[3]!==W?(m=(0,c.textureToUrl)(W),B[3]=W,B[4]=m):m=B[4],B[5]!==p||B[6]!==m?(g=[p,m],B[5]=p,B[6]=m,B[7]=g):g=B[7];let G=g,P=(0,o.useTexture)(G,A);B[8]!==P?(S=Array.isArray(P)?P:[P,P],B[8]=P,B[9]=S):S=B[9];let[k,D]=S;return B[10]!==R.direction||B[11]!==R.keyframes?.[0]||B[12]!==U.crossSize||B[13]!==U.crossViewAng||B[14]!==U.renderCross||B[15]!==U.tracerLength||B[16]!==U.tracerWidth?(w=e=>{let{camera:r}=e,t=_.current,i=F.current;if(!t||!i)return;let s=R.keyframes?.[0],o=s?.position,n=R.direction??s?.velocity;if(!o||!n||((0,a.torqueVecToThree)(n,l),1e-8>l.lengthSq())){t.visible=!1,q.current&&(q.current.visible=!1);return}l.normalize(),t.visible=!0,(0,a.torqueVecToThree)(o,b),u.copy(b).sub(r.position),d.crossVectors(u,l),1e-8>d.lengthSq()&&(d.crossVectors(x,l),1e-8>d.lengthSq()&&d.set(1,0,0)),d.normalize().multiplyScalar(U.tracerWidth);let c=.5*U.tracerLength;f.copy(l).multiplyScalar(-c),y.copy(l).multiplyScalar(c);let h=i.array;h[0]=f.x+d.x,h[1]=f.y+d.y,h[2]=f.z+d.z,h[3]=f.x-d.x,h[4]=f.y-d.y,h[5]=f.z-d.z,h[6]=y.x-d.x,h[7]=y.y-d.y,h[8]=y.z-d.z,h[9]=y.x+d.x,h[10]=y.y+d.y,h[11]=y.z+d.z,i.needsUpdate=!0;let p=q.current;if(!p)return;if(!U.renderCross){p.visible=!1;return}u.normalize();let m=l.dot(u);if(m>-U.crossViewAng&&m<U.crossViewAng){p.visible=!1;return}p.visible=!0,(0,a.setQuaternionFromDir)(l,M.current),p.quaternion.copy(M.current),p.scale.setScalar(U.crossSize)},B[10]=R.direction,B[11]=R.keyframes?.[0],B[12]=U.crossSize,B[13]=U.crossViewAng,B[14]=U.renderCross,B[15]=U.tracerLength,B[16]=U.tracerWidth,B[17]=w):w=B[17],(0,s.useFrame)(w),B[18]===Symbol.for("react.memo_cache_sentinel")?(j=(0,r.jsx)("bufferAttribute",{ref:F,attach:"attributes-position",args:[new Float32Array(12),3]}),B[18]=j):j=B[18],B[19]===Symbol.for("react.memo_cache_sentinel")?(z=(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",args:[new Float32Array([0,0,0,1,1,1,1,0]),2]}),B[19]=z):z=B[19],B[20]===Symbol.for("react.memo_cache_sentinel")?(T=(0,r.jsxs)("bufferGeometry",{children:[j,z,(0,r.jsx)("bufferAttribute",{attach:"index",args:[new Uint16Array([0,1,2,0,2,3]),1]})]}),B[20]=T):T=B[20],B[21]!==k?(V=(0,r.jsxs)("mesh",{ref:_,children:[T,(0,r.jsx)("meshBasicMaterial",{map:k,transparent:!0,blending:n.AdditiveBlending,side:n.DoubleSide,depthWrite:!1,toneMapped:!1})]}),B[21]=k,B[22]=V):V=B[22],B[23]!==D||B[24]!==U.renderCross?(v=U.renderCross?(0,r.jsxs)("mesh",{ref:q,children:[(0,r.jsxs)("bufferGeometry",{children:[(0,r.jsx)("bufferAttribute",{attach:"attributes-position",args:[new Float32Array([-.5,0,-.5,.5,0,-.5,.5,0,.5,-.5,0,.5]),3]}),(0,r.jsx)("bufferAttribute",{attach:"attributes-uv",args:[new Float32Array([0,0,0,1,1,1,1,0]),2]}),(0,r.jsx)("bufferAttribute",{attach:"index",args:[new Uint16Array([0,1,2,0,2,3]),1]})]}),(0,r.jsx)("meshBasicMaterial",{map:D,transparent:!0,blending:n.AdditiveBlending,side:n.DoubleSide,depthWrite:!1,toneMapped:!1})]}):null,B[23]=D,B[24]=U.renderCross,B[25]=v):v=B[25],B[26]!==V||B[27]!==v?(C=(0,r.jsxs)(r.Fragment,{children:[V,v]}),B[26]=V,B[27]=v,B[28]=C):C=B[28],C}function A(e){for(let r of Array.isArray(e)?e:[e])(0,a.setupEffectTexture)(r)}e.s(["SpriteProjectile",()=>h,"TracerProjectile",()=>m])}]); |