@galacean/cli 2.0.0-alpha.22 → 2.0.0-alpha.24
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/cli.bundle.cjs +32922 -32372
- package/dist/preview-client/_static/{Accordion-b106eaf3.js → Accordion-f938dadf.js} +1 -1
- package/dist/preview-client/_static/{AmbientLightAsset-6b2d168c.js → AmbientLightAsset-e34de607.js} +1 -1
- package/dist/preview-client/_static/{AnimationClipAsset-a5d290cc.js → AnimationClipAsset-b084da2a.js} +1 -1
- package/dist/preview-client/_static/{AnimatorControllerAsset-616578b4.js → AnimatorControllerAsset-6cc04274.js} +1 -1
- package/dist/preview-client/_static/{AnimatorStore-bc865a7e.js → AnimatorStore-0bc90c37.js} +1 -1
- package/dist/preview-client/_static/{AssetViewer-1a9f3cad.js → AssetViewer-d2c63b00.js} +1 -1
- package/dist/preview-client/_static/{AudioAsset-24b03bc3.js → AudioAsset-9c715952.js} +1 -1
- package/dist/preview-client/_static/{AudioComponent-060f13a6.js → AudioComponent-80d06ef4.js} +1 -1
- package/dist/preview-client/_static/{Callout-c8b9b055.js → Callout-48e71f13.js} +1 -1
- package/dist/preview-client/_static/{CameraComponent-33b1918d.js → CameraComponent-9c9db3fb.js} +1 -1
- package/dist/preview-client/_static/{Component-3cb422ab.js → Component-b95aa2af.js} +1 -1
- package/dist/preview-client/_static/{DirectLight-072d3047.js → DirectLight-b0490ef7.js} +1 -1
- package/dist/preview-client/_static/{FontAsset-1e1118c1.js → FontAsset-6e9c0549.js} +1 -1
- package/dist/preview-client/_static/{FormItemArray-f1283fce.js → FormItemArray-b2a3d249.js} +1 -1
- package/dist/preview-client/_static/{GlTFAsset-dc68541e.js → GlTFAsset-83e8190e.js} +1 -1
- package/dist/preview-client/_static/{IconPlus-99d7bb90.js → IconPlus-172c6c17.js} +1 -1
- package/dist/preview-client/_static/{IconPointFilled-f8224625.js → IconPointFilled-bad94cf1.js} +1 -1
- package/dist/preview-client/_static/{LightBaseComponent-b610e42a.js → LightBaseComponent-b4854e8a.js} +1 -1
- package/dist/preview-client/_static/{LottieAnimationComponent-b70c2426.js → LottieAnimationComponent-efd5da2b.js} +1 -1
- package/dist/preview-client/_static/{MarkdownAsset-2a4a1d10.js → MarkdownAsset-b42846c0.js} +1 -1
- package/dist/preview-client/_static/{MaterialAsset-dfaa82d9.js → MaterialAsset-0b9d7eba.js} +1 -1
- package/dist/preview-client/_static/{MaterialInspector-21fc5b67.js → MaterialInspector-23ea0240.js} +1 -1
- package/dist/preview-client/_static/{Menu-62cee67e.js → Menu-05c1f0a4.js} +1 -1
- package/dist/preview-client/_static/{MeshAsset-07529e4e.js → MeshAsset-85e99837.js} +1 -1
- package/dist/preview-client/_static/{MeshRendererBaseComponent-2af8db12.js → MeshRendererBaseComponent-5621d663.js} +1 -1
- package/dist/preview-client/_static/{MeshRendererComponent-d9df7d58.js → MeshRendererComponent-c3c3c683.js} +1 -1
- package/dist/preview-client/_static/{MeshThumbnail-bd30617c.js → MeshThumbnail-b1283749.js} +1 -1
- package/dist/preview-client/_static/{ParticleRendererComponent-8729cfbf.js → ParticleRendererComponent-94656239.js} +1 -1
- package/dist/preview-client/_static/{PhysicsMaterialAsset-e9abb944.js → PhysicsMaterialAsset-cb9afb6e.js} +1 -1
- package/dist/preview-client/_static/{PhysicsStore-96164e4e.js → PhysicsStore-0a751fa0.js} +1 -1
- package/dist/preview-client/_static/{PointLight-76172b61.js → PointLight-a2bfed75.js} +1 -1
- package/dist/preview-client/_static/{PostProcessComponent-83f23ced.js → PostProcessComponent-040cf521.js} +1 -1
- package/dist/preview-client/_static/{PrefabAsset-4bac196b.js → PrefabAsset-265f6f48.js} +1 -1
- package/dist/preview-client/_static/{PrimitiveMesh-9ff7dbc1.js → PrimitiveMesh-70c93e7e.js} +1 -1
- package/dist/preview-client/_static/{ReferencedMaterial-27ba90e2.js → ReferencedMaterial-831d0583.js} +1 -1
- package/dist/preview-client/_static/{RenderTargetAsset-e112b8ca.js → RenderTargetAsset-b810caf3.js} +1 -1
- package/dist/preview-client/_static/{SceneAsset-a39f097a.js → SceneAsset-d05b1a79.js} +1 -1
- package/dist/preview-client/_static/{ShaderAsset-068b4b97.js → ShaderAsset-370b6f1c.js} +1 -1
- package/dist/preview-client/_static/{ShaderChunkAsset-bdb39acc.js → ShaderChunkAsset-e3487bd1.js} +1 -1
- package/dist/preview-client/_static/{ShaderUIScriptAsset-0c11d0ed.js → ShaderUIScriptAsset-ebf57ceb.js} +1 -1
- package/dist/preview-client/_static/{SkinnedMeshRendererComponent-5e58927a.js → SkinnedMeshRendererComponent-ee33da25.js} +1 -1
- package/dist/preview-client/_static/{SpineAnimationComponent-1ae4feaa.js → SpineAnimationComponent-12e694e8.js} +1 -1
- package/dist/preview-client/_static/{SpineSkeletonDataAsset-284f5f4d.js → SpineSkeletonDataAsset-0dffbb4d.js} +1 -1
- package/dist/preview-client/_static/{SpotLight-1a8af1d4.js → SpotLight-ada565f2.js} +1 -1
- package/dist/preview-client/_static/{SpriteBaseComponent-fd82e43b.js → SpriteBaseComponent-3156cb3b.js} +1 -1
- package/dist/preview-client/_static/{SpriteMaskComponent-eab0faf7.js → SpriteMaskComponent-a32024e1.js} +1 -1
- package/dist/preview-client/_static/{SpriteRendererComponent-1496fc43.js → SpriteRendererComponent-489486e0.js} +1 -1
- package/dist/preview-client/_static/{TextBaseComponent-7d2db29c.js → TextBaseComponent-520dea39.js} +1 -1
- package/dist/preview-client/_static/{TextRendererComponent-88494abb.js → TextRendererComponent-6be5f80c.js} +1 -1
- package/dist/preview-client/_static/{TextureAsset-7172cc65.js → TextureAsset-9cd94531.js} +1 -1
- package/dist/preview-client/_static/{Tooltip-9ce2e9d6.js → Tooltip-71e5a4e7.js} +1 -1
- package/dist/preview-client/_static/{TrailRendererComponent-4443baab.js → TrailRendererComponent-74bf88c0.js} +1 -1
- package/dist/preview-client/_static/{TransformBaseComponent-ca2fa45d.js → TransformBaseComponent-0d241199.js} +1 -1
- package/dist/preview-client/_static/{TransformComponent-683b5e9c.js → TransformComponent-49d279f5.js} +1 -1
- package/dist/preview-client/_static/{XRReferenceImageAsset-823e47cd.js → XRReferenceImageAsset-79e78558.js} +1 -1
- package/dist/preview-client/_static/{audio-10d03160.js → audio-5d0ddf55.js} +1 -1
- package/dist/preview-client/_static/{createOnModelChange-73358d10.js → createOnModelChange-e65da908.js} +1 -1
- package/dist/preview-client/_static/{createReactComponent-fcd6848b.js → createReactComponent-cb70ea50.js} +1 -1
- package/dist/preview-client/_static/index-0fef73f8.js +1 -0
- package/dist/preview-client/_static/index-1e036622.js +1 -0
- package/dist/preview-client/_static/index-1fd4207a.js +1 -0
- package/dist/preview-client/_static/{index-2202e8e4.js → index-46c87b46.js} +1 -1
- package/dist/preview-client/_static/index-6649d404.js +1 -0
- package/dist/preview-client/_static/{index-8d2f0997.js → index-788e8750.js} +1 -1
- package/dist/preview-client/_static/{index-2274eaf1.js → index-7e414715.js} +1 -1
- package/dist/preview-client/_static/index-87ef1c72.js +1 -0
- package/dist/preview-client/_static/{index-4ac10da2.js → index-b13216a9.js} +1 -1
- package/dist/preview-client/_static/{index-5392907c.js → index-b4bde36a.js} +3 -3
- package/dist/preview-client/_static/{index-4cde6efd.js → index-d00c8bc3.js} +1 -1
- package/dist/preview-client/_static/index-d9ee84ce.js +1 -0
- package/dist/preview-client/_static/{index-0a53aaef.js → index-debbe073.js} +1 -1
- package/dist/preview-client/_static/{index-03b6134d.js → index-e44b357e.js} +6 -6
- package/dist/preview-client/_static/{index-19f5510d.js → index-ea7fe254.js} +1 -1
- package/dist/preview-client/_static/{index-7e5ce9d9.js → index-f7bd6fef.js} +1 -1
- package/dist/preview-client/_static/{ktx2-encoder-4cac07f2.js → ktx2-encoder-522fc017.js} +1 -1
- package/dist/preview-client/_static/{module-101126a2.js → module-5547be1c.js} +1 -1
- package/dist/preview-client/_static/{module-5fa1eae0.js → module-57b6e417.js} +1 -1
- package/dist/preview-client/_static/{module-03df665c.js → module-5906e0d4.js} +1 -1
- package/dist/preview-client/_static/postmen-443b3e5f.js +2 -0
- package/dist/preview-client/_static/{shader-data-utils-d59bc4f5.js → shader-data-utils-000170ae.js} +1 -1
- package/dist/preview-client/index.html +1 -1
- package/package.json +1 -1
- package/dist/preview-client/_static/index-0a683358.js +0 -1
- package/dist/preview-client/_static/index-6f3c991c.js +0 -1
- package/dist/preview-client/_static/index-a2c9fc83.js +0 -1
- package/dist/preview-client/_static/index-c216bbcf.js +0 -1
- package/dist/preview-client/_static/index-f06b751f.js +0 -1
- package/dist/preview-client/_static/index-f4a0b8dd.js +0 -1
- package/dist/preview-client/_static/postmen-9e6354af.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var Mt=(M,s,i)=>s in M?wt(M,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):M[s]=i;var A=(M,s,i)=>(Mt(M,typeof s!="symbol"?s+"":s,i),i);import{ai as rt,B as q,bu as Rt,a5 as ut,a6 as dt,a7 as mt,a9 as ft,a3 as G,bv as tt,a4 as et,bw as Pt,j as It,bx as At,K as Ht,y as Vt,p as _,e as b,C as B,t as _t,m as N,n as Bt,o as Nt,q as Tt}from"./index-03b6134d.js";import"./index-0a53aaef.js";import"./postmen-9e6354af.js";import"./meshopt_simplifier.module-cd99529d.js";import{a as Dt}from"./bundlers-9b0d37fc.js";import{M as Et}from"./MeshThumbnail-bd30617c.js";const z=class z{static createSphere(s=.5,i=18){i=Math.max(2,Math.floor(i));const o=i+1,e=o*o,c=i*i,l=z._generateIndices(e,c*6),R=Math.PI,t=R*2,a=1/o,y=1/i,m=8,h=new Float32Array(e*m);for(let x=0;x<e;++x){const u=x%o,d=x*a|0,p=u*y,n=d*y,w=p*t,f=n*R,v=Math.sin(f),I=-s*Math.cos(w)*v,P=s*Math.cos(f),S=s*Math.sin(w)*v;let r=x*m;h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=p,h[r++]=n}let C=0;for(let x=0;x<c;++x){const u=x%i,p=(x*y|0)*o+u,n=p+1,w=p+o,f=w+1;l[C++]=n,l[C++]=p,l[C++]=f,l[C++]=p,l[C++]=w,l[C++]=f}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:l,vertices:h,bounds:g}}static createCuboid(s=1,i=1,o=1){const e=s/2,c=i/2,l=o/2,R=8,t=new Float32Array(24*R);t[0]=-e,t[1]=c,t[2]=-l,t[6]=0,t[7]=0,t[8]=e,t[9]=c,t[10]=-l,t[14]=1,t[15]=0,t[16]=e,t[17]=c,t[18]=l,t[22]=1,t[23]=1,t[24]=-e,t[25]=c,t[26]=l,t[30]=0,t[31]=1;for(let m=0;m<4;m++){let h=R*m+3;t[h++]=0,t[h++]=1,t[h++]=0}t[32]=-e,t[33]=-c,t[34]=-l,t[38]=0,t[39]=1,t[40]=e,t[41]=-c,t[42]=-l,t[46]=1,t[47]=1,t[48]=e,t[49]=-c,t[50]=l,t[54]=1,t[55]=0,t[56]=-e,t[57]=-c,t[58]=l,t[62]=0,t[63]=0;for(let m=0;m<4;m++){let h=R*m+35;t[h++]=0,t[h++]=-1,t[h++]=0}t[64]=-e,t[65]=c,t[66]=-l,t[70]=0,t[71]=0,t[72]=-e,t[73]=c,t[74]=l,t[78]=1,t[79]=0,t[80]=-e,t[81]=-c,t[82]=l,t[86]=1,t[87]=1,t[88]=-e,t[89]=-c,t[90]=-l,t[94]=0,t[95]=1;for(let m=0;m<4;m++){let h=R*m+67;t[h++]=-1,t[h++]=0,t[h++]=0}t[96]=e,t[97]=c,t[98]=-l,t[102]=1,t[103]=0,t[104]=e,t[105]=c,t[106]=l,t[110]=0,t[111]=0,t[112]=e,t[113]=-c,t[114]=l,t[118]=0,t[119]=1,t[120]=e,t[121]=-c,t[122]=-l,t[126]=1,t[127]=1;for(let m=0;m<4;m++){let h=R*m+99;t[h++]=1,t[h++]=0,t[h++]=0}t[128]=-e,t[129]=c,t[130]=l,t[134]=0,t[135]=0,t[136]=e,t[137]=c,t[138]=l,t[142]=1,t[143]=0,t[144]=e,t[145]=-c,t[146]=l,t[150]=1,t[151]=1,t[152]=-e,t[153]=-c,t[154]=l,t[158]=0,t[159]=1;for(let m=0;m<4;m++){let h=R*m+131;t[h++]=0,t[h++]=0,t[h++]=1}t[160]=-e,t[161]=c,t[162]=-l,t[166]=1,t[167]=0,t[168]=e,t[169]=c,t[170]=-l,t[174]=0,t[175]=0,t[176]=e,t[177]=-c,t[178]=-l,t[182]=0,t[183]=1,t[184]=-e,t[185]=-c,t[186]=-l,t[190]=1,t[191]=1;for(let m=0;m<4;m++){let h=R*m+163;t[h++]=0,t[h++]=0,t[h++]=-1}const a=new Uint16Array(36);a[0]=0,a[1]=2,a[2]=1,a[3]=2,a[4]=0,a[5]=3,a[6]=4,a[7]=6,a[8]=7,a[9]=6,a[10]=4,a[11]=5,a[12]=8,a[13]=10,a[14]=9,a[15]=10,a[16]=8,a[17]=11,a[18]=12,a[19]=14,a[20]=15,a[21]=14,a[22]=12,a[23]=13,a[24]=16,a[25]=18,a[26]=17,a[27]=18,a[28]=16,a[29]=19,a[30]=20,a[31]=22,a[32]=23,a[33]=22,a[34]=20,a[35]=21;const y=new q;return y.min.set(-e,-c,-l),y.max.set(e,c,l),{vertices:t,bounds:y,indices:a}}static createPlane(s=1,i=1,o=1,e=1){o=Math.max(1,Math.floor(o)),e=Math.max(1,Math.floor(e));const c=o+1,l=e+1,R=s/2,t=i/2,a=s/o,y=i/e,m=c*l,h=e*o,C=z._generateIndices(m,h*6),g=1/c,x=1/o,u=1/e,d=8,p=new Float32Array(m*d);for(let f=0;f<m;++f){const v=f%c,I=f*g|0;let P=f*d;p[P++]=v*a-R,p[P++]=0,p[P++]=I*y-t,p[P++]=0,p[P++]=1,p[P++]=0,p[P++]=v*x,p[P++]=I*u}let n=0;for(let f=0;f<h;++f){const v=f%o,P=(f*x|0)*c+v,S=P+1,r=P+c,D=r+1;C[n++]=P,C[n++]=r,C[n++]=S,C[n++]=r,C[n++]=D,C[n++]=S}const w=new q;return w.min.set(-R,0,-t),w.max.set(R,0,t),{bounds:w,vertices:p,indices:C}}static createCylinder(s=.5,i=.5,o=2,e=20,c=1){e=Math.floor(e),c=Math.floor(c);const l=e+1,R=c+1,t=o*.5,a=o/c,y=l*R,m=e*c,h=e*2,C=y+2+h,g=z._generateIndices(C,m*6+h*3),x=1/l,u=1/e,d=1/c,p=8,n=new Float32Array(C*p);let w=0;const f=Math.PI,v=Math.PI*2,I=i-s,P=I/o,S=I/c;for(let F=0;F<y;++F){const Z=F%l,W=F*x|0,O=Z*u,J=W*d,$=f+O*v,nt=Math.sin($),pt=Math.cos($),ht=i-W*S,xt=ht*nt,vt=W*a-t,Ct=ht*pt;let L=F*p;n[L++]=xt,n[L++]=vt,n[L++]=Ct,n[L++]=nt,n[L++]=P,n[L++]=pt,n[L++]=O,n[L++]=1-J}for(let F=0;F<m;++F){const Z=F%e,O=(F*u|0)*l+Z,J=O+1,$=O+l,nt=$+1;g[w++]=J,g[w++]=$,g[w++]=O,g[w++]=J,g[w++]=nt,g[w++]=$}let r=y*p;n[r++]=0,n[r++]=-t,n[r++]=0,n[r++]=0,n[r++]=-1,n[r++]=0,n[r++]=.5,n[r++]=.5,n[r++]=0,n[r++]=t,n[r++]=0,n[r++]=0,n[r++]=1,n[r++]=0,n[r++]=.5,n[r++]=.5,r=(y+2)*p;const D=1/(s*2),j=1/(i*2),E=l*c;for(let F=0;F<e;++F){const Z=F*p;let W=n[Z],O=n[Z+2];n[r++]=W,n[r++]=-t,n[r++]=O,n[r++]=0,n[r++]=-1,n[r++]=0,n[r++]=W*j+.5,n[r++]=.5-O*j;const J=(F+E)*p;W=n[J],O=n[J+2],n[r++]=W,n[r++]=t,n[r++]=O,n[r++]=0,n[r++]=1,n[r++]=0,n[r++]=W*D+.5,n[r++]=.5-O*D}const Y=y+1,X=y+2,U=X+1;for(let F=0;F<e;++F){const Z=F*2,W=F===e-1?0:Z+2;g[w++]=y,g[w++]=X+W,g[w++]=X+Z,g[w++]=Y,g[w++]=U+Z,g[w++]=U+W}const Q=new q,K=Math.max(s,i);return Q.min.set(-K,-t,-K),Q.max.set(K,t,K),{bounds:Q,vertices:n,indices:g}}static createTorus(s=.5,i=.1,o=30,e=30,c=360){o=Math.floor(o),e=Math.floor(e);const l=(o+1)*(e+1),R=o*e,t=z._generateIndices(l,R*6),a=8,y=new Float32Array(l*a);c=c/180*Math.PI;let m=0;const h=z._tempVec30;for(let x=0;x<=o;x++)for(let u=0;u<=e;u++){const d=u/e*c,p=x/o*Math.PI*2,n=Math.cos(p),w=Math.sin(p),f=Math.cos(d),v=Math.sin(d),I=(s+i*n)*f,P=(s+i*n)*v,S=i*w;y[m++]=I,y[m++]=P,y[m++]=S;const r=s*f,D=s*v;h.set(I-r,P-D,S).normalize(),y[m++]=h.x,y[m++]=h.y,y[m++]=h.z,y[m++]=u/e,y[m++]=x/o}m=0;for(let x=1;x<=o;x++)for(let u=1;u<=e;u++){const d=(e+1)*x+u-1,p=(e+1)*(x-1)+u-1,n=(e+1)*(x-1)+u,w=(e+1)*x+u;t[m++]=d,t[m++]=p,t[m++]=w,t[m++]=p,t[m++]=n,t[m++]=w}const C=new q,g=s+i;return C.min.set(-g,-g,-i),C.max.set(g,g,i),{bounds:C,vertices:y,indices:t}}static createCone(s=.5,i=2,o=20,e=1){o=Math.floor(o),e=Math.floor(e);const c=o+1,l=e+1,R=i*.5,t=i/e,a=c*l,y=o*e,m=a+1+o,h=z._generateIndices(m,y*6+o*3),C=1/c,g=1/o,x=1/e,u=8,d=new Float32Array(m*8);let p=0;const n=Math.PI,w=Math.PI*2,f=s/i;for(let r=0;r<a;++r){const D=r%c,j=r*C|0,E=D*g,Y=j*x,X=n+E*w,U=Math.sin(X),Q=Math.cos(X),K=s-j*s,F=K*U,Z=j*t-R,W=K*Q;let O=r*u;d[O++]=F,d[O++]=Z,d[O++]=W,d[O++]=U,d[O++]=f,d[O++]=Q,d[O++]=E,d[O++]=1-Y}for(let r=0;r<y;++r){const D=r%o,E=(r*g|0)*c+D,Y=E+1,X=E+c,U=X+1;h[p++]=Y,h[p++]=X,h[p++]=E,h[p++]=Y,h[p++]=U,h[p++]=X}let v=a*u;d[v++]=0,d[v++]=-R,d[v++]=0,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=.5,d[v++]=.5,v=(a+1)*u;const I=1/(s*2);for(let r=0;r<o;++r){const D=d[r*u],j=d[r*u+2];d[v++]=D,d[v++]=-R,d[v++]=j,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=D*I+.5,d[v++]=.5-j*I}const P=a+1;for(let r=0;r<o;++r){const D=r,j=r===o-1?0:D+1;h[p++]=a,h[p++]=P+j,h[p++]=P+D}const S=new q;return S.min.set(-s,-R,-s),S.max.set(s,R,s),{bounds:S,vertices:d,indices:h}}static createCapsule(s=.5,i=2,o=6,e=1){o=Math.max(2,Math.floor(o)),e=Math.floor(e);const c=o+1,l=e+1,R=i*.5,t=i/e,a=c*l,y=o*e,m=c*c,h=o*o,C=a+2*m,g=z._generateIndices(C,(y+2*h)*6),x=1/c,u=1/o,d=1/e,p=Math.PI,n=Math.PI*2,w=8,f=new Float32Array(C*w);let v=0;for(let P=0;P<a;++P){const S=P%c,r=P*x|0,D=S*u,j=r*d,E=p+D*n,Y=Math.sin(E),X=Math.cos(E);let U=P*w;f[U++]=s*Y,f[U++]=r*t-R,f[U++]=s*X,f[U++]=Y,f[U++]=0,f[U++]=X,f[U++]=D,f[U++]=1-j}for(let P=0;P<y;++P){const S=P%o,D=(P*u|0)*c+S,j=D+1,E=D+c,Y=E+1;g[v++]=j,g[v++]=E,g[v++]=D,g[v++]=j,g[v++]=Y,g[v++]=E}z._createCapsuleCap(s,i,o,p,n,a,1,f,g,v),z._createCapsuleCap(s,i,o,p,-n,a+m,-1,f,g,v+6*h);const I=new q;return I.min.set(-s,-s-R,-s),I.max.set(s,s+R,s),{bounds:I,vertices:f,indices:g}}static _generateIndices(s,i){let o=null;return s>65535?o=new Uint32Array(i):o=new Uint16Array(i),o}static _createCapsuleCap(s,i,o,e,c,l,R,t,a,y){const m=o+1,h=i*.5*R,C=m*m,g=o*o,x=1/m,u=1/o,d=8;for(let p=0;p<C;++p){const n=p%m,w=p*x|0,f=n*u,v=w*u,I=e+f*c,P=v*Math.PI*.5,S=Math.sin(P),r=s*Math.sin(I)*S,D=s*Math.cos(P)*R+h,j=s*Math.cos(I)*S;let E=(p+l)*d;t[E++]=r,t[E++]=D,t[E++]=j,t[E++]=r,t[E++]=D-h,t[E++]=j,t[E++]=f,t[E++]=v}for(let p=0;p<g;++p){const n=p%o,f=(p*u|0)*m+n+l,v=f+1,I=f+m,P=I+1;a[y++]=v,a[y++]=f,a[y++]=P,a[y++]=f,a[y++]=I,a[y++]=P}}static createSubdivisionSurfaceSphereData(s=.5,i=3){i=Rt.clamp(Math.floor(i),1,6);const o=new Float32Array(3*(6*Math.pow(4,i)+2)),e=new Float32Array(24*Math.pow(4,i));this._subdiveCatmullClark(i,o,e);const c=o.length/3,l=e.length/4,R=c+Math.pow(2,i+1)-1,t=R+16,a=new Float32Array(t*8),y=this._generateIndices(c,l*6);let m=0;const h={};for(let x=0;x<c;x++){let u=3*x,d=o[u],p=o[u+1],n=o[u+2];const w=1/Math.sqrt(d*d+p*p+n*n);if(d*=w,p*=w,n*=w,u=8*x,a[u]=d*s,a[u+1]=p*s,a[u+2]=n*s,a[u+3]=d,a[u+4]=p,a[u+5]=n,a[u+6]=(Math.PI-Math.atan2(n,d))/(2*Math.PI),a[u+7]=Math.acos(p)/Math.PI,a[u+6]===0){const f=8*(c+m++);a.set(a.subarray(u,u+8),f),a[f+6]=1,h[u/8]=f/8}}let C=0;this._spherePoleIdx=0;for(let x=0;x<l;x++){const u=4*x;let d=e[u],p=e[u+1],n=e[u+2],w=e[u+3];const f=8*d,v=8*p,I=8*n,P=8*w;a[f+2]+a[v+2]+a[I+2]<0&&(a[f+6]===0&&(d=h[d]),a[v+6]===0&&(p=h[p]),a[I+6]===0&&(n=h[n]),a[P+6]===0&&(w=h[w])),y[C]=d,y[C+1]=p,y[C+2]=n,this._generateAndReplacePoleUV(y,a,C,R),y[C+3]=d,y[C+4]=n,y[C+5]=w,this._generateAndReplacePoleUV(y,a,C+3,R),C+=6}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:y,vertices:a,bounds:g}}static _generateAndReplacePoleUV(s,i,o,e){const c=i[8*s[o]+7];if(c===0||c===1){const l=8*s[o],R=8*(e+this._spherePoleIdx);i.set(i.subarray(l,l+8),R),i[R+6]=.5*(i[l+6]+i[8*s[o+1]+6]+i[8*s[o+2]+6]-.5),s[o]=e+this._spherePoleIdx++}}static _subdiveCatmullClark(s,i,o){const e=new Map,c=new Array;i.set(this._sphereSeedPositions),o.set(this._sphereSeedCells);for(let l=0;l<s;l++){const R=6*Math.pow(4,l),t=4*R+2;e.clear(),c.length=0;for(let C=0;C<R;C++){const g=c[C]={facePoint:new rt,adjacentEdges:new Array(4)};for(let x=0;x<4;x++){const u=3*o[4*C+x];g.facePoint.x+=.25*i[u],g.facePoint.y+=.25*i[u+1],g.facePoint.z+=.25*i[u+2]}for(let x=0;x<4;x++){const u=o[4*C+x],d=o[4*C+(x+1)%4],p=Math.min(u,d)*t+Math.max(u,d);if(!e.has(p)){const v={edgePoint:new rt,edgePointIndex:void 0},I=3*u,P=3*d;v.edgePoint.set(.25*(i[I]+i[P]),.25*(i[I+1]+i[P+1]),.25*(i[I+2]+i[P+2])),e.set(p,v)}const n=e.get(p);g.adjacentEdges[x]=n;const w=n.edgePoint,f=g.facePoint;w.x+=.25*f.x,w.y+=.25*f.y,w.z+=.25*f.z}}const a=R+2,y=a+R;let m=0;this._sphereEdgeIdx=0;const h=o.slice(0,4*R);for(let C=0;C<R;C++){const g=c[C];g.facePoint.copyToArray(i,3*(a+C));const x=a+C;let u,d,p;for(let n=0;n<4;n++){const w=h[m++];switch(n){case 0:{const v=g.adjacentEdges[n%4],I=g.adjacentEdges[(n+3)%4];d=this._calculateEdgeIndex(i,v,y),u=this._calculateEdgeIndex(i,I,y),p=u;break}case 1:case 2:{const v=g.adjacentEdges[n%4];u=d,d=this._calculateEdgeIndex(i,v,y);break}case 3:{u=d,d=p;break}}const f=4*(4*C+n);o[f]=w,o[f+1]=d,o[f+2]=x,o[f+3]=u}}}}static _calculateEdgeIndex(s,i,o){if(i.edgePointIndex!==void 0)return i.edgePointIndex;{i.edgePoint.copyToArray(s,3*(o+this._sphereEdgeIdx));const e=o+this._sphereEdgeIdx++;return i.edgePointIndex=e,e}}};A(z,"_tempVec30",new rt),A(z,"_sphereSeedPositions",new Float32Array([-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1])),A(z,"_sphereSeedCells",new Float32Array([0,1,2,3,3,2,4,5,5,4,6,7,7,0,3,5,7,6,1,0,6,4,2,1])),A(z,"_sphereEdgeIdx",0),A(z,"_spherePoleIdx",0);let k=z;function Ft(){return[new G(tt.Position,0,et.Vector3,0),new G(tt.Normal,12,et.Vector3,0),new G(tt.UV,24,et.Vector2,0)]}function yt(M,s,{vertices:i,indices:o,bounds:e}){const c=new ut(s,dt.VertexBuffer,i,mt.Static),l=new ut(s,dt.IndexBuffer,o,mt.Static);M.setVertexElements(Ft()),M.setIndexBufferBinding(l,o instanceof Uint16Array?ft.UInt16:ft.UInt32),M.setVertexBufferBinding(c,32),M.bounds=e,M.subMesh?M.subMesh.count=o.length:M.addSubMesh(0,o.length)}class St extends Pt{constructor(s,i,o){super(s),this.engine=i,this.generateData=o}restoreContent(){yt(this.resource,this.engine,this.generateData())}}function Ot(M,s,i){s.resourceManager.addContentRestorer(new St(M,s,i))}var jt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,V=(M,s,i,o)=>{for(var e=o>1?void 0:o?Ut(s,i):s,c=M.length-1,l;c>=0;c--)(l=M[c])&&(e=(o?l(s,i,e):l(e))||e);return o&&e&&jt(s,i,e),e},bt=(M=>(M.Sphere="sphere",M.Cuboid="cuboid",M.Plane="plane",M.Cylinder="cylinder",M.Torus="torus",M.Cone="cone",M.Capsule="capsule",M))(bt||{});const gt=M=>M.type==="sphere",it=M=>M.type==="capsule",at=M=>M.type==="cone",lt=M=>M.type==="cuboid",ot=M=>M.type==="cylinder",st=M=>M.type==="torus",ct=M=>M.type==="plane",T=M=>M._updateData();let H=class extends It{constructor(s){super(s);A(this,"type","sphere");A(this,"sphereRadius",.5);A(this,"sphereStep",3);A(this,"capsuleRadius",.5);A(this,"capsuleHeight",2);A(this,"capsuleRadialSegments",6);A(this,"capsuleHeightSegments",1);A(this,"coneRadius",.5);A(this,"coneHeight",2);A(this,"coneRadialSegment",20);A(this,"coneHeightSegment",1);A(this,"cuboidWidth",1);A(this,"cuboidHeight",1);A(this,"cuboidDepth",1);A(this,"cylinderRadiusTop",.5);A(this,"cylinderRadiusBottom",.5);A(this,"cylinderHeight",2);A(this,"cylinderRadialSegment",20);A(this,"cylinderHeightSegment",1);A(this,"planeWidth",1);A(this,"planeHeight",1);A(this,"planeHorizontalSegments",1);A(this,"planeVerticalSegments",1);A(this,"torusRadius",.5);A(this,"torusTubeRadius",.1);A(this,"torusRadialSegments",30);A(this,"torusTubularSegments",30);A(this,"torusArc",360)}async initByCreation(s,i,o){const c=(typeof(o==null?void 0:o.primitiveType)=="string"?o.primitiveType:"").trim().toLowerCase();return{type:{sphere:"sphere",cube:"cuboid",cuboid:"cuboid",cylinder:"cylinder",plane:"plane",capsule:"capsule",cone:"cone",torus:"torus"}[c]??"sphere"}}async initByMain(s,i){const o=JSON.parse(await s.text()),e=this.engine,c=o.type,l=new At(e,c);l.setVertexElements([new G(tt.Position,0,et.Vector3,0),new G(tt.Normal,12,et.Vector3,0),new G(tt.UV,24,et.Vector2,0)]);for(const y in o)this[y]=o[y];this.bindEngineObject(l),Ot(l,e,()=>this._generateDataByType(this.type)),this._updateData();const R=new Ht(e,c&&c.charAt(0).toUpperCase()+c.slice(1)),t=R.addComponent(Vt);t.mesh=this.engineObject;const a=await this.root.assetStore.getAssetByRef({refId:"0000200"});t.setMaterial(a.engineObject),this.setDragTempEntity(R)}instantiate(){const s=this.root.sceneStore.createEntity(),i=this.getDragTempEntity();return s.initByEngineObject(i.clone()),s}_updateData(){const s=this.engine,i=this._engineObject;yt(i,s,this._generateDataByType(this.type))}_generateDataByType(s){switch(s){case"sphere":return k.createSubdivisionSurfaceSphereData(this.sphereRadius,this.sphereStep);case"capsule":return k.createCapsule(this.capsuleRadius,this.capsuleHeight,this.capsuleRadialSegments,this.capsuleHeightSegments);case"cone":return k.createCone(this.coneRadius,this.coneHeight,this.coneRadialSegment,this.coneHeightSegment);case"cuboid":return k.createCuboid(this.cuboidWidth,this.cuboidHeight,this.cuboidDepth);case"cylinder":return k.createCylinder(this.cylinderRadiusTop,this.cylinderRadiusBottom,this.cylinderHeight,this.cylinderRadialSegment,this.cylinderHeightSegment);case"plane":return k.createPlane(this.planeWidth,this.planeHeight,this.planeHorizontalSegments,this.planeVerticalSegments);case"torus":return k.createTorus(this.torusRadius,this.torusTubeRadius,this.torusRadialSegments,this.torusTubularSegments,this.torusArc);default:return k.createSphere(this.sphereRadius,this.sphereStep)}}};V([_({label:b("asset.primitive-mesh.type.label"),info:b("asset.primitive-mesh.type.info"),type:B.Select,value:"sphere",options:_t(bt),onChange(M){M._updateData()}}),N()],H.prototype,"type",2);V([_({label:b("asset.primitive-mesh.sphere.radius.label"),info:b("asset.primitive-mesh.sphere.radius.info"),type:B.Number,min:0,dragStep:.1,when:gt,onChange:T}),N()],H.prototype,"sphereRadius",2);V([_({label:b("asset.primitive-mesh.sphere.step.label"),info:b("asset.primitive-mesh.sphere.step.info"),type:B.Number,min:1,dragStep:1,when:gt,onChange:T}),N()],H.prototype,"sphereStep",2);V([_({label:b("asset.primitive-mesh.capsule.radius.label"),info:b("asset.primitive-mesh.capsule.radius.info"),type:B.Number,min:0,dragStep:.1,when:it,onChange:T}),N()],H.prototype,"capsuleRadius",2);V([_({label:b("asset.primitive-mesh.capsule.height.label"),info:b("asset.primitive-mesh.capsule.height.info"),type:B.Number,min:0,dragStep:.1,when:it,onChange:T}),N()],H.prototype,"capsuleHeight",2);V([_({label:b("asset.primitive-mesh.capsule.radial-segments.label"),info:b("asset.primitive-mesh.capsule.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:it,onChange:T}),N()],H.prototype,"capsuleRadialSegments",2);V([_({label:b("asset.primitive-mesh.capsule.height-segments.label"),info:b("asset.primitive-mesh.capsule.height-segments.info"),type:B.Number,min:1,dragStep:1,when:it,onChange:T}),N()],H.prototype,"capsuleHeightSegments",2);V([_({label:b("asset.primitive-mesh.cone.radius.label"),info:b("asset.primitive-mesh.cone.radius.info"),type:B.Number,min:0,dragStep:.1,when:at,onChange:T}),N()],H.prototype,"coneRadius",2);V([_({label:b("asset.primitive-mesh.cone.height.label"),info:b("asset.primitive-mesh.cone.height.info"),type:B.Number,min:0,dragStep:.1,when:at,onChange:T}),N()],H.prototype,"coneHeight",2);V([_({label:b("asset.primitive-mesh.cone.radial-segments.label"),info:b("asset.primitive-mesh.cone.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:at,onChange:T}),N()],H.prototype,"coneRadialSegment",2);V([_({label:b("asset.primitive-mesh.cone.height-segments.label"),info:b("asset.primitive-mesh.cone.height-segments.info"),type:B.Number,min:1,dragStep:1,when:at,onChange:T}),N()],H.prototype,"coneHeightSegment",2);V([_({label:b("asset.primitive-mesh.cuboid.width.label"),info:b("asset.primitive-mesh.cuboid.width.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidWidth",2);V([_({label:b("asset.primitive-mesh.cuboid.height.label"),info:b("asset.primitive-mesh.cuboid.height.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidHeight",2);V([_({label:b("asset.primitive-mesh.cuboid.depth.label"),info:b("asset.primitive-mesh.cuboid.depth.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidDepth",2);V([_({label:b("asset.primitive-mesh.cylinder.radius-top.label"),info:b("asset.primitive-mesh.cylinder.radius-top.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadiusTop",2);V([_({label:b("asset.primitive-mesh.cylinder.radius-bottom.label"),info:b("asset.primitive-mesh.cylinder.radius-bottom.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadiusBottom",2);V([_({label:b("asset.primitive-mesh.cylinder.height.label"),info:b("asset.primitive-mesh.cylinder.height.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderHeight",2);V([_({label:b("asset.primitive-mesh.cylinder.radial-segments.label"),info:b("asset.primitive-mesh.cylinder.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadialSegment",2);V([_({label:b("asset.primitive-mesh.cylinder.height-segments.label"),info:b("asset.primitive-mesh.cylinder.height-segments.info"),type:B.Number,min:1,dragStep:1,when:ot,onChange:T}),N()],H.prototype,"cylinderHeightSegment",2);V([_({label:b("asset.primitive-mesh.plane.width.label"),info:b("asset.primitive-mesh.plane.width.info"),type:B.Number,min:0,dragStep:.1,when:ct,onChange:T}),N()],H.prototype,"planeWidth",2);V([_({label:b("asset.primitive-mesh.plane.height.label"),info:b("asset.primitive-mesh.plane.height.info"),type:B.Number,min:0,dragStep:.1,when:ct,onChange:T}),N()],H.prototype,"planeHeight",2);V([_({label:b("asset.primitive-mesh.plane.horizontal-segments.label"),info:b("asset.primitive-mesh.plane.horizontal-segments.info"),type:B.Number,min:1,dragStep:1,when:ct,onChange:T}),N()],H.prototype,"planeHorizontalSegments",2);V([_({label:b("asset.primitive-mesh.plane.vertical-segments.label"),info:b("asset.primitive-mesh.plane.vertical-segments.info"),type:B.Number,min:1,dragStep:1,when:ct,onChange:T}),N()],H.prototype,"planeVerticalSegments",2);V([_({label:b("asset.primitive-mesh.torus.radius.label"),info:b("asset.primitive-mesh.torus.radius.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusRadius",2);V([_({label:b("asset.primitive-mesh.torus.tube-radius.label"),info:b("asset.primitive-mesh.torus.tube-radius.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusTubeRadius",2);V([_({label:b("asset.primitive-mesh.torus.radial-segments.label"),info:b("asset.primitive-mesh.torus.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:st,onChange:T}),N()],H.prototype,"torusRadialSegments",2);V([_({label:b("asset.primitive-mesh.torus.tubular-segments.label"),info:b("asset.primitive-mesh.torus.tubular-segments.info"),type:B.Number,min:1,dragStep:1,when:st,onChange:T}),N()],H.prototype,"torusTubularSegments",2);V([_({label:b("asset.primitive-mesh.torus.arc.label"),info:b("asset.primitive-mesh.torus.arc.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusArc",2);H=V([Bt({type:"PrimitiveMesh",label:b("asset.primitive-mesh.title"),loaderType:"PrimitiveMesh",importMenuConfig:{type:Nt.Add},defaultName:"Mesh",dragLayer:Tt.PrimitiveMesh,thumbnail:Et,async bundle({content:M}){return{content:new Blob([Dt(await M.text())])}}})],H);export{H as PrimitiveMesh};
|
|
1
|
+
var wt=Object.defineProperty;var Mt=(M,s,i)=>s in M?wt(M,s,{enumerable:!0,configurable:!0,writable:!0,value:i}):M[s]=i;var A=(M,s,i)=>(Mt(M,typeof s!="symbol"?s+"":s,i),i);import{ai as rt,B as q,bu as Rt,a5 as ut,a6 as dt,a7 as mt,a9 as ft,a3 as G,bv as tt,a4 as et,bw as Pt,j as It,bx as At,K as Ht,y as Vt,p as _,e as b,C as B,t as _t,m as N,n as Bt,o as Nt,q as Tt}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";import"./meshopt_simplifier.module-cd99529d.js";import{a as Dt}from"./bundlers-9b0d37fc.js";import{M as Et}from"./MeshThumbnail-b1283749.js";const z=class z{static createSphere(s=.5,i=18){i=Math.max(2,Math.floor(i));const o=i+1,e=o*o,c=i*i,l=z._generateIndices(e,c*6),R=Math.PI,t=R*2,a=1/o,y=1/i,m=8,h=new Float32Array(e*m);for(let x=0;x<e;++x){const u=x%o,d=x*a|0,p=u*y,n=d*y,w=p*t,f=n*R,v=Math.sin(f),I=-s*Math.cos(w)*v,P=s*Math.cos(f),S=s*Math.sin(w)*v;let r=x*m;h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=I,h[r++]=P,h[r++]=S,h[r++]=p,h[r++]=n}let C=0;for(let x=0;x<c;++x){const u=x%i,p=(x*y|0)*o+u,n=p+1,w=p+o,f=w+1;l[C++]=n,l[C++]=p,l[C++]=f,l[C++]=p,l[C++]=w,l[C++]=f}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:l,vertices:h,bounds:g}}static createCuboid(s=1,i=1,o=1){const e=s/2,c=i/2,l=o/2,R=8,t=new Float32Array(24*R);t[0]=-e,t[1]=c,t[2]=-l,t[6]=0,t[7]=0,t[8]=e,t[9]=c,t[10]=-l,t[14]=1,t[15]=0,t[16]=e,t[17]=c,t[18]=l,t[22]=1,t[23]=1,t[24]=-e,t[25]=c,t[26]=l,t[30]=0,t[31]=1;for(let m=0;m<4;m++){let h=R*m+3;t[h++]=0,t[h++]=1,t[h++]=0}t[32]=-e,t[33]=-c,t[34]=-l,t[38]=0,t[39]=1,t[40]=e,t[41]=-c,t[42]=-l,t[46]=1,t[47]=1,t[48]=e,t[49]=-c,t[50]=l,t[54]=1,t[55]=0,t[56]=-e,t[57]=-c,t[58]=l,t[62]=0,t[63]=0;for(let m=0;m<4;m++){let h=R*m+35;t[h++]=0,t[h++]=-1,t[h++]=0}t[64]=-e,t[65]=c,t[66]=-l,t[70]=0,t[71]=0,t[72]=-e,t[73]=c,t[74]=l,t[78]=1,t[79]=0,t[80]=-e,t[81]=-c,t[82]=l,t[86]=1,t[87]=1,t[88]=-e,t[89]=-c,t[90]=-l,t[94]=0,t[95]=1;for(let m=0;m<4;m++){let h=R*m+67;t[h++]=-1,t[h++]=0,t[h++]=0}t[96]=e,t[97]=c,t[98]=-l,t[102]=1,t[103]=0,t[104]=e,t[105]=c,t[106]=l,t[110]=0,t[111]=0,t[112]=e,t[113]=-c,t[114]=l,t[118]=0,t[119]=1,t[120]=e,t[121]=-c,t[122]=-l,t[126]=1,t[127]=1;for(let m=0;m<4;m++){let h=R*m+99;t[h++]=1,t[h++]=0,t[h++]=0}t[128]=-e,t[129]=c,t[130]=l,t[134]=0,t[135]=0,t[136]=e,t[137]=c,t[138]=l,t[142]=1,t[143]=0,t[144]=e,t[145]=-c,t[146]=l,t[150]=1,t[151]=1,t[152]=-e,t[153]=-c,t[154]=l,t[158]=0,t[159]=1;for(let m=0;m<4;m++){let h=R*m+131;t[h++]=0,t[h++]=0,t[h++]=1}t[160]=-e,t[161]=c,t[162]=-l,t[166]=1,t[167]=0,t[168]=e,t[169]=c,t[170]=-l,t[174]=0,t[175]=0,t[176]=e,t[177]=-c,t[178]=-l,t[182]=0,t[183]=1,t[184]=-e,t[185]=-c,t[186]=-l,t[190]=1,t[191]=1;for(let m=0;m<4;m++){let h=R*m+163;t[h++]=0,t[h++]=0,t[h++]=-1}const a=new Uint16Array(36);a[0]=0,a[1]=2,a[2]=1,a[3]=2,a[4]=0,a[5]=3,a[6]=4,a[7]=6,a[8]=7,a[9]=6,a[10]=4,a[11]=5,a[12]=8,a[13]=10,a[14]=9,a[15]=10,a[16]=8,a[17]=11,a[18]=12,a[19]=14,a[20]=15,a[21]=14,a[22]=12,a[23]=13,a[24]=16,a[25]=18,a[26]=17,a[27]=18,a[28]=16,a[29]=19,a[30]=20,a[31]=22,a[32]=23,a[33]=22,a[34]=20,a[35]=21;const y=new q;return y.min.set(-e,-c,-l),y.max.set(e,c,l),{vertices:t,bounds:y,indices:a}}static createPlane(s=1,i=1,o=1,e=1){o=Math.max(1,Math.floor(o)),e=Math.max(1,Math.floor(e));const c=o+1,l=e+1,R=s/2,t=i/2,a=s/o,y=i/e,m=c*l,h=e*o,C=z._generateIndices(m,h*6),g=1/c,x=1/o,u=1/e,d=8,p=new Float32Array(m*d);for(let f=0;f<m;++f){const v=f%c,I=f*g|0;let P=f*d;p[P++]=v*a-R,p[P++]=0,p[P++]=I*y-t,p[P++]=0,p[P++]=1,p[P++]=0,p[P++]=v*x,p[P++]=I*u}let n=0;for(let f=0;f<h;++f){const v=f%o,P=(f*x|0)*c+v,S=P+1,r=P+c,D=r+1;C[n++]=P,C[n++]=r,C[n++]=S,C[n++]=r,C[n++]=D,C[n++]=S}const w=new q;return w.min.set(-R,0,-t),w.max.set(R,0,t),{bounds:w,vertices:p,indices:C}}static createCylinder(s=.5,i=.5,o=2,e=20,c=1){e=Math.floor(e),c=Math.floor(c);const l=e+1,R=c+1,t=o*.5,a=o/c,y=l*R,m=e*c,h=e*2,C=y+2+h,g=z._generateIndices(C,m*6+h*3),x=1/l,u=1/e,d=1/c,p=8,n=new Float32Array(C*p);let w=0;const f=Math.PI,v=Math.PI*2,I=i-s,P=I/o,S=I/c;for(let F=0;F<y;++F){const Z=F%l,W=F*x|0,O=Z*u,J=W*d,$=f+O*v,nt=Math.sin($),pt=Math.cos($),ht=i-W*S,xt=ht*nt,vt=W*a-t,Ct=ht*pt;let L=F*p;n[L++]=xt,n[L++]=vt,n[L++]=Ct,n[L++]=nt,n[L++]=P,n[L++]=pt,n[L++]=O,n[L++]=1-J}for(let F=0;F<m;++F){const Z=F%e,O=(F*u|0)*l+Z,J=O+1,$=O+l,nt=$+1;g[w++]=J,g[w++]=$,g[w++]=O,g[w++]=J,g[w++]=nt,g[w++]=$}let r=y*p;n[r++]=0,n[r++]=-t,n[r++]=0,n[r++]=0,n[r++]=-1,n[r++]=0,n[r++]=.5,n[r++]=.5,n[r++]=0,n[r++]=t,n[r++]=0,n[r++]=0,n[r++]=1,n[r++]=0,n[r++]=.5,n[r++]=.5,r=(y+2)*p;const D=1/(s*2),j=1/(i*2),E=l*c;for(let F=0;F<e;++F){const Z=F*p;let W=n[Z],O=n[Z+2];n[r++]=W,n[r++]=-t,n[r++]=O,n[r++]=0,n[r++]=-1,n[r++]=0,n[r++]=W*j+.5,n[r++]=.5-O*j;const J=(F+E)*p;W=n[J],O=n[J+2],n[r++]=W,n[r++]=t,n[r++]=O,n[r++]=0,n[r++]=1,n[r++]=0,n[r++]=W*D+.5,n[r++]=.5-O*D}const Y=y+1,X=y+2,U=X+1;for(let F=0;F<e;++F){const Z=F*2,W=F===e-1?0:Z+2;g[w++]=y,g[w++]=X+W,g[w++]=X+Z,g[w++]=Y,g[w++]=U+Z,g[w++]=U+W}const Q=new q,K=Math.max(s,i);return Q.min.set(-K,-t,-K),Q.max.set(K,t,K),{bounds:Q,vertices:n,indices:g}}static createTorus(s=.5,i=.1,o=30,e=30,c=360){o=Math.floor(o),e=Math.floor(e);const l=(o+1)*(e+1),R=o*e,t=z._generateIndices(l,R*6),a=8,y=new Float32Array(l*a);c=c/180*Math.PI;let m=0;const h=z._tempVec30;for(let x=0;x<=o;x++)for(let u=0;u<=e;u++){const d=u/e*c,p=x/o*Math.PI*2,n=Math.cos(p),w=Math.sin(p),f=Math.cos(d),v=Math.sin(d),I=(s+i*n)*f,P=(s+i*n)*v,S=i*w;y[m++]=I,y[m++]=P,y[m++]=S;const r=s*f,D=s*v;h.set(I-r,P-D,S).normalize(),y[m++]=h.x,y[m++]=h.y,y[m++]=h.z,y[m++]=u/e,y[m++]=x/o}m=0;for(let x=1;x<=o;x++)for(let u=1;u<=e;u++){const d=(e+1)*x+u-1,p=(e+1)*(x-1)+u-1,n=(e+1)*(x-1)+u,w=(e+1)*x+u;t[m++]=d,t[m++]=p,t[m++]=w,t[m++]=p,t[m++]=n,t[m++]=w}const C=new q,g=s+i;return C.min.set(-g,-g,-i),C.max.set(g,g,i),{bounds:C,vertices:y,indices:t}}static createCone(s=.5,i=2,o=20,e=1){o=Math.floor(o),e=Math.floor(e);const c=o+1,l=e+1,R=i*.5,t=i/e,a=c*l,y=o*e,m=a+1+o,h=z._generateIndices(m,y*6+o*3),C=1/c,g=1/o,x=1/e,u=8,d=new Float32Array(m*8);let p=0;const n=Math.PI,w=Math.PI*2,f=s/i;for(let r=0;r<a;++r){const D=r%c,j=r*C|0,E=D*g,Y=j*x,X=n+E*w,U=Math.sin(X),Q=Math.cos(X),K=s-j*s,F=K*U,Z=j*t-R,W=K*Q;let O=r*u;d[O++]=F,d[O++]=Z,d[O++]=W,d[O++]=U,d[O++]=f,d[O++]=Q,d[O++]=E,d[O++]=1-Y}for(let r=0;r<y;++r){const D=r%o,E=(r*g|0)*c+D,Y=E+1,X=E+c,U=X+1;h[p++]=Y,h[p++]=X,h[p++]=E,h[p++]=Y,h[p++]=U,h[p++]=X}let v=a*u;d[v++]=0,d[v++]=-R,d[v++]=0,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=.5,d[v++]=.5,v=(a+1)*u;const I=1/(s*2);for(let r=0;r<o;++r){const D=d[r*u],j=d[r*u+2];d[v++]=D,d[v++]=-R,d[v++]=j,d[v++]=0,d[v++]=-1,d[v++]=0,d[v++]=D*I+.5,d[v++]=.5-j*I}const P=a+1;for(let r=0;r<o;++r){const D=r,j=r===o-1?0:D+1;h[p++]=a,h[p++]=P+j,h[p++]=P+D}const S=new q;return S.min.set(-s,-R,-s),S.max.set(s,R,s),{bounds:S,vertices:d,indices:h}}static createCapsule(s=.5,i=2,o=6,e=1){o=Math.max(2,Math.floor(o)),e=Math.floor(e);const c=o+1,l=e+1,R=i*.5,t=i/e,a=c*l,y=o*e,m=c*c,h=o*o,C=a+2*m,g=z._generateIndices(C,(y+2*h)*6),x=1/c,u=1/o,d=1/e,p=Math.PI,n=Math.PI*2,w=8,f=new Float32Array(C*w);let v=0;for(let P=0;P<a;++P){const S=P%c,r=P*x|0,D=S*u,j=r*d,E=p+D*n,Y=Math.sin(E),X=Math.cos(E);let U=P*w;f[U++]=s*Y,f[U++]=r*t-R,f[U++]=s*X,f[U++]=Y,f[U++]=0,f[U++]=X,f[U++]=D,f[U++]=1-j}for(let P=0;P<y;++P){const S=P%o,D=(P*u|0)*c+S,j=D+1,E=D+c,Y=E+1;g[v++]=j,g[v++]=E,g[v++]=D,g[v++]=j,g[v++]=Y,g[v++]=E}z._createCapsuleCap(s,i,o,p,n,a,1,f,g,v),z._createCapsuleCap(s,i,o,p,-n,a+m,-1,f,g,v+6*h);const I=new q;return I.min.set(-s,-s-R,-s),I.max.set(s,s+R,s),{bounds:I,vertices:f,indices:g}}static _generateIndices(s,i){let o=null;return s>65535?o=new Uint32Array(i):o=new Uint16Array(i),o}static _createCapsuleCap(s,i,o,e,c,l,R,t,a,y){const m=o+1,h=i*.5*R,C=m*m,g=o*o,x=1/m,u=1/o,d=8;for(let p=0;p<C;++p){const n=p%m,w=p*x|0,f=n*u,v=w*u,I=e+f*c,P=v*Math.PI*.5,S=Math.sin(P),r=s*Math.sin(I)*S,D=s*Math.cos(P)*R+h,j=s*Math.cos(I)*S;let E=(p+l)*d;t[E++]=r,t[E++]=D,t[E++]=j,t[E++]=r,t[E++]=D-h,t[E++]=j,t[E++]=f,t[E++]=v}for(let p=0;p<g;++p){const n=p%o,f=(p*u|0)*m+n+l,v=f+1,I=f+m,P=I+1;a[y++]=v,a[y++]=f,a[y++]=P,a[y++]=f,a[y++]=I,a[y++]=P}}static createSubdivisionSurfaceSphereData(s=.5,i=3){i=Rt.clamp(Math.floor(i),1,6);const o=new Float32Array(3*(6*Math.pow(4,i)+2)),e=new Float32Array(24*Math.pow(4,i));this._subdiveCatmullClark(i,o,e);const c=o.length/3,l=e.length/4,R=c+Math.pow(2,i+1)-1,t=R+16,a=new Float32Array(t*8),y=this._generateIndices(c,l*6);let m=0;const h={};for(let x=0;x<c;x++){let u=3*x,d=o[u],p=o[u+1],n=o[u+2];const w=1/Math.sqrt(d*d+p*p+n*n);if(d*=w,p*=w,n*=w,u=8*x,a[u]=d*s,a[u+1]=p*s,a[u+2]=n*s,a[u+3]=d,a[u+4]=p,a[u+5]=n,a[u+6]=(Math.PI-Math.atan2(n,d))/(2*Math.PI),a[u+7]=Math.acos(p)/Math.PI,a[u+6]===0){const f=8*(c+m++);a.set(a.subarray(u,u+8),f),a[f+6]=1,h[u/8]=f/8}}let C=0;this._spherePoleIdx=0;for(let x=0;x<l;x++){const u=4*x;let d=e[u],p=e[u+1],n=e[u+2],w=e[u+3];const f=8*d,v=8*p,I=8*n,P=8*w;a[f+2]+a[v+2]+a[I+2]<0&&(a[f+6]===0&&(d=h[d]),a[v+6]===0&&(p=h[p]),a[I+6]===0&&(n=h[n]),a[P+6]===0&&(w=h[w])),y[C]=d,y[C+1]=p,y[C+2]=n,this._generateAndReplacePoleUV(y,a,C,R),y[C+3]=d,y[C+4]=n,y[C+5]=w,this._generateAndReplacePoleUV(y,a,C+3,R),C+=6}const g=new q;return g.min.set(-s,-s,-s),g.max.set(s,s,s),{indices:y,vertices:a,bounds:g}}static _generateAndReplacePoleUV(s,i,o,e){const c=i[8*s[o]+7];if(c===0||c===1){const l=8*s[o],R=8*(e+this._spherePoleIdx);i.set(i.subarray(l,l+8),R),i[R+6]=.5*(i[l+6]+i[8*s[o+1]+6]+i[8*s[o+2]+6]-.5),s[o]=e+this._spherePoleIdx++}}static _subdiveCatmullClark(s,i,o){const e=new Map,c=new Array;i.set(this._sphereSeedPositions),o.set(this._sphereSeedCells);for(let l=0;l<s;l++){const R=6*Math.pow(4,l),t=4*R+2;e.clear(),c.length=0;for(let C=0;C<R;C++){const g=c[C]={facePoint:new rt,adjacentEdges:new Array(4)};for(let x=0;x<4;x++){const u=3*o[4*C+x];g.facePoint.x+=.25*i[u],g.facePoint.y+=.25*i[u+1],g.facePoint.z+=.25*i[u+2]}for(let x=0;x<4;x++){const u=o[4*C+x],d=o[4*C+(x+1)%4],p=Math.min(u,d)*t+Math.max(u,d);if(!e.has(p)){const v={edgePoint:new rt,edgePointIndex:void 0},I=3*u,P=3*d;v.edgePoint.set(.25*(i[I]+i[P]),.25*(i[I+1]+i[P+1]),.25*(i[I+2]+i[P+2])),e.set(p,v)}const n=e.get(p);g.adjacentEdges[x]=n;const w=n.edgePoint,f=g.facePoint;w.x+=.25*f.x,w.y+=.25*f.y,w.z+=.25*f.z}}const a=R+2,y=a+R;let m=0;this._sphereEdgeIdx=0;const h=o.slice(0,4*R);for(let C=0;C<R;C++){const g=c[C];g.facePoint.copyToArray(i,3*(a+C));const x=a+C;let u,d,p;for(let n=0;n<4;n++){const w=h[m++];switch(n){case 0:{const v=g.adjacentEdges[n%4],I=g.adjacentEdges[(n+3)%4];d=this._calculateEdgeIndex(i,v,y),u=this._calculateEdgeIndex(i,I,y),p=u;break}case 1:case 2:{const v=g.adjacentEdges[n%4];u=d,d=this._calculateEdgeIndex(i,v,y);break}case 3:{u=d,d=p;break}}const f=4*(4*C+n);o[f]=w,o[f+1]=d,o[f+2]=x,o[f+3]=u}}}}static _calculateEdgeIndex(s,i,o){if(i.edgePointIndex!==void 0)return i.edgePointIndex;{i.edgePoint.copyToArray(s,3*(o+this._sphereEdgeIdx));const e=o+this._sphereEdgeIdx++;return i.edgePointIndex=e,e}}};A(z,"_tempVec30",new rt),A(z,"_sphereSeedPositions",new Float32Array([-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,1,-1,-1,-1,-1,-1,1,-1])),A(z,"_sphereSeedCells",new Float32Array([0,1,2,3,3,2,4,5,5,4,6,7,7,0,3,5,7,6,1,0,6,4,2,1])),A(z,"_sphereEdgeIdx",0),A(z,"_spherePoleIdx",0);let k=z;function Ft(){return[new G(tt.Position,0,et.Vector3,0),new G(tt.Normal,12,et.Vector3,0),new G(tt.UV,24,et.Vector2,0)]}function yt(M,s,{vertices:i,indices:o,bounds:e}){const c=new ut(s,dt.VertexBuffer,i,mt.Static),l=new ut(s,dt.IndexBuffer,o,mt.Static);M.setVertexElements(Ft()),M.setIndexBufferBinding(l,o instanceof Uint16Array?ft.UInt16:ft.UInt32),M.setVertexBufferBinding(c,32),M.bounds=e,M.subMesh?M.subMesh.count=o.length:M.addSubMesh(0,o.length)}class St extends Pt{constructor(s,i,o){super(s),this.engine=i,this.generateData=o}restoreContent(){yt(this.resource,this.engine,this.generateData())}}function Ot(M,s,i){s.resourceManager.addContentRestorer(new St(M,s,i))}var jt=Object.defineProperty,Ut=Object.getOwnPropertyDescriptor,V=(M,s,i,o)=>{for(var e=o>1?void 0:o?Ut(s,i):s,c=M.length-1,l;c>=0;c--)(l=M[c])&&(e=(o?l(s,i,e):l(e))||e);return o&&e&&jt(s,i,e),e},bt=(M=>(M.Sphere="sphere",M.Cuboid="cuboid",M.Plane="plane",M.Cylinder="cylinder",M.Torus="torus",M.Cone="cone",M.Capsule="capsule",M))(bt||{});const gt=M=>M.type==="sphere",it=M=>M.type==="capsule",at=M=>M.type==="cone",lt=M=>M.type==="cuboid",ot=M=>M.type==="cylinder",st=M=>M.type==="torus",ct=M=>M.type==="plane",T=M=>M._updateData();let H=class extends It{constructor(s){super(s);A(this,"type","sphere");A(this,"sphereRadius",.5);A(this,"sphereStep",3);A(this,"capsuleRadius",.5);A(this,"capsuleHeight",2);A(this,"capsuleRadialSegments",6);A(this,"capsuleHeightSegments",1);A(this,"coneRadius",.5);A(this,"coneHeight",2);A(this,"coneRadialSegment",20);A(this,"coneHeightSegment",1);A(this,"cuboidWidth",1);A(this,"cuboidHeight",1);A(this,"cuboidDepth",1);A(this,"cylinderRadiusTop",.5);A(this,"cylinderRadiusBottom",.5);A(this,"cylinderHeight",2);A(this,"cylinderRadialSegment",20);A(this,"cylinderHeightSegment",1);A(this,"planeWidth",1);A(this,"planeHeight",1);A(this,"planeHorizontalSegments",1);A(this,"planeVerticalSegments",1);A(this,"torusRadius",.5);A(this,"torusTubeRadius",.1);A(this,"torusRadialSegments",30);A(this,"torusTubularSegments",30);A(this,"torusArc",360)}async initByCreation(s,i,o){const c=(typeof(o==null?void 0:o.primitiveType)=="string"?o.primitiveType:"").trim().toLowerCase();return{type:{sphere:"sphere",cube:"cuboid",cuboid:"cuboid",cylinder:"cylinder",plane:"plane",capsule:"capsule",cone:"cone",torus:"torus"}[c]??"sphere"}}async initByMain(s,i){const o=JSON.parse(await s.text()),e=this.engine,c=o.type,l=new At(e,c);l.setVertexElements([new G(tt.Position,0,et.Vector3,0),new G(tt.Normal,12,et.Vector3,0),new G(tt.UV,24,et.Vector2,0)]);for(const y in o)this[y]=o[y];this.bindEngineObject(l),Ot(l,e,()=>this._generateDataByType(this.type)),this._updateData();const R=new Ht(e,c&&c.charAt(0).toUpperCase()+c.slice(1)),t=R.addComponent(Vt);t.mesh=this.engineObject;const a=await this.root.assetStore.getAssetByRef({refId:"0000200"});t.setMaterial(a.engineObject),this.setDragTempEntity(R)}instantiate(){const s=this.root.sceneStore.createEntity(),i=this.getDragTempEntity();return s.initByEngineObject(i.clone()),s}_updateData(){const s=this.engine,i=this._engineObject;yt(i,s,this._generateDataByType(this.type))}_generateDataByType(s){switch(s){case"sphere":return k.createSubdivisionSurfaceSphereData(this.sphereRadius,this.sphereStep);case"capsule":return k.createCapsule(this.capsuleRadius,this.capsuleHeight,this.capsuleRadialSegments,this.capsuleHeightSegments);case"cone":return k.createCone(this.coneRadius,this.coneHeight,this.coneRadialSegment,this.coneHeightSegment);case"cuboid":return k.createCuboid(this.cuboidWidth,this.cuboidHeight,this.cuboidDepth);case"cylinder":return k.createCylinder(this.cylinderRadiusTop,this.cylinderRadiusBottom,this.cylinderHeight,this.cylinderRadialSegment,this.cylinderHeightSegment);case"plane":return k.createPlane(this.planeWidth,this.planeHeight,this.planeHorizontalSegments,this.planeVerticalSegments);case"torus":return k.createTorus(this.torusRadius,this.torusTubeRadius,this.torusRadialSegments,this.torusTubularSegments,this.torusArc);default:return k.createSphere(this.sphereRadius,this.sphereStep)}}};V([_({label:b("asset.primitive-mesh.type.label"),info:b("asset.primitive-mesh.type.info"),type:B.Select,value:"sphere",options:_t(bt),onChange(M){M._updateData()}}),N()],H.prototype,"type",2);V([_({label:b("asset.primitive-mesh.sphere.radius.label"),info:b("asset.primitive-mesh.sphere.radius.info"),type:B.Number,min:0,dragStep:.1,when:gt,onChange:T}),N()],H.prototype,"sphereRadius",2);V([_({label:b("asset.primitive-mesh.sphere.step.label"),info:b("asset.primitive-mesh.sphere.step.info"),type:B.Number,min:1,dragStep:1,when:gt,onChange:T}),N()],H.prototype,"sphereStep",2);V([_({label:b("asset.primitive-mesh.capsule.radius.label"),info:b("asset.primitive-mesh.capsule.radius.info"),type:B.Number,min:0,dragStep:.1,when:it,onChange:T}),N()],H.prototype,"capsuleRadius",2);V([_({label:b("asset.primitive-mesh.capsule.height.label"),info:b("asset.primitive-mesh.capsule.height.info"),type:B.Number,min:0,dragStep:.1,when:it,onChange:T}),N()],H.prototype,"capsuleHeight",2);V([_({label:b("asset.primitive-mesh.capsule.radial-segments.label"),info:b("asset.primitive-mesh.capsule.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:it,onChange:T}),N()],H.prototype,"capsuleRadialSegments",2);V([_({label:b("asset.primitive-mesh.capsule.height-segments.label"),info:b("asset.primitive-mesh.capsule.height-segments.info"),type:B.Number,min:1,dragStep:1,when:it,onChange:T}),N()],H.prototype,"capsuleHeightSegments",2);V([_({label:b("asset.primitive-mesh.cone.radius.label"),info:b("asset.primitive-mesh.cone.radius.info"),type:B.Number,min:0,dragStep:.1,when:at,onChange:T}),N()],H.prototype,"coneRadius",2);V([_({label:b("asset.primitive-mesh.cone.height.label"),info:b("asset.primitive-mesh.cone.height.info"),type:B.Number,min:0,dragStep:.1,when:at,onChange:T}),N()],H.prototype,"coneHeight",2);V([_({label:b("asset.primitive-mesh.cone.radial-segments.label"),info:b("asset.primitive-mesh.cone.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:at,onChange:T}),N()],H.prototype,"coneRadialSegment",2);V([_({label:b("asset.primitive-mesh.cone.height-segments.label"),info:b("asset.primitive-mesh.cone.height-segments.info"),type:B.Number,min:1,dragStep:1,when:at,onChange:T}),N()],H.prototype,"coneHeightSegment",2);V([_({label:b("asset.primitive-mesh.cuboid.width.label"),info:b("asset.primitive-mesh.cuboid.width.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidWidth",2);V([_({label:b("asset.primitive-mesh.cuboid.height.label"),info:b("asset.primitive-mesh.cuboid.height.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidHeight",2);V([_({label:b("asset.primitive-mesh.cuboid.depth.label"),info:b("asset.primitive-mesh.cuboid.depth.info"),type:B.Number,min:0,dragStep:.1,when:lt,onChange:T}),N()],H.prototype,"cuboidDepth",2);V([_({label:b("asset.primitive-mesh.cylinder.radius-top.label"),info:b("asset.primitive-mesh.cylinder.radius-top.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadiusTop",2);V([_({label:b("asset.primitive-mesh.cylinder.radius-bottom.label"),info:b("asset.primitive-mesh.cylinder.radius-bottom.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadiusBottom",2);V([_({label:b("asset.primitive-mesh.cylinder.height.label"),info:b("asset.primitive-mesh.cylinder.height.info"),type:B.Number,min:0,dragStep:.1,when:ot,onChange:T}),N()],H.prototype,"cylinderHeight",2);V([_({label:b("asset.primitive-mesh.cylinder.radial-segments.label"),info:b("asset.primitive-mesh.cylinder.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:ot,onChange:T}),N()],H.prototype,"cylinderRadialSegment",2);V([_({label:b("asset.primitive-mesh.cylinder.height-segments.label"),info:b("asset.primitive-mesh.cylinder.height-segments.info"),type:B.Number,min:1,dragStep:1,when:ot,onChange:T}),N()],H.prototype,"cylinderHeightSegment",2);V([_({label:b("asset.primitive-mesh.plane.width.label"),info:b("asset.primitive-mesh.plane.width.info"),type:B.Number,min:0,dragStep:.1,when:ct,onChange:T}),N()],H.prototype,"planeWidth",2);V([_({label:b("asset.primitive-mesh.plane.height.label"),info:b("asset.primitive-mesh.plane.height.info"),type:B.Number,min:0,dragStep:.1,when:ct,onChange:T}),N()],H.prototype,"planeHeight",2);V([_({label:b("asset.primitive-mesh.plane.horizontal-segments.label"),info:b("asset.primitive-mesh.plane.horizontal-segments.info"),type:B.Number,min:1,dragStep:1,when:ct,onChange:T}),N()],H.prototype,"planeHorizontalSegments",2);V([_({label:b("asset.primitive-mesh.plane.vertical-segments.label"),info:b("asset.primitive-mesh.plane.vertical-segments.info"),type:B.Number,min:1,dragStep:1,when:ct,onChange:T}),N()],H.prototype,"planeVerticalSegments",2);V([_({label:b("asset.primitive-mesh.torus.radius.label"),info:b("asset.primitive-mesh.torus.radius.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusRadius",2);V([_({label:b("asset.primitive-mesh.torus.tube-radius.label"),info:b("asset.primitive-mesh.torus.tube-radius.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusTubeRadius",2);V([_({label:b("asset.primitive-mesh.torus.radial-segments.label"),info:b("asset.primitive-mesh.torus.radial-segments.info"),type:B.Number,min:1,dragStep:1,when:st,onChange:T}),N()],H.prototype,"torusRadialSegments",2);V([_({label:b("asset.primitive-mesh.torus.tubular-segments.label"),info:b("asset.primitive-mesh.torus.tubular-segments.info"),type:B.Number,min:1,dragStep:1,when:st,onChange:T}),N()],H.prototype,"torusTubularSegments",2);V([_({label:b("asset.primitive-mesh.torus.arc.label"),info:b("asset.primitive-mesh.torus.arc.info"),type:B.Number,min:0,dragStep:.1,when:st,onChange:T}),N()],H.prototype,"torusArc",2);H=V([Bt({type:"PrimitiveMesh",label:b("asset.primitive-mesh.title"),loaderType:"PrimitiveMesh",importMenuConfig:{type:Nt.Add},defaultName:"Mesh",dragLayer:Tt.PrimitiveMesh,thumbnail:Et,async bundle({content:M}){return{content:new Blob([Dt(await M.text())])}}})],H);export{H as PrimitiveMesh};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aH as n,aI as s,aJ as o,aK as i,av as t,aL as d,aM as c,aN as g}from"./index-
|
|
1
|
+
import{aH as n,aI as s,aJ as o,aK as i,av as t,aL as d,aM as c,aN as g}from"./index-e44b357e.js";import{M as h}from"./MaterialInspector-23ea0240.js";const m=n("div",{marginLeft:"5px"}),u=n(s,{borderRadius:"$3",padding:"$1_5",marginLeft:"-$1_5",marginRight:"-$0_5",marginBottom:"$1",color:"$gray11",cursor:"pointer",backgroundColor:"transparent",transition:"background-color 0.2s","&:hover":{backgroundColor:"$grayA3"},variants:{open:{true:{boxShadow:"inset 0 0 0 1px $colors$grayA3",backgroundColor:"$grayA5","&:hover":{backgroundColor:"$grayA5"}}}}});function x(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 17.4l-3.9 3.9q-.275.275-.7.275t-.7-.275t-.275-.7t.275-.7l3.875-3.875q.575-.575 1.425-.575t1.425.575L17.3 19.9q.275.275.275.7t-.275.7t-.7.275t-.7-.275zm0-10.8l3.9-3.9q.275-.275.7-.275t.7.275t.275.7t-.275.7l-3.875 3.875Q12.85 8.55 12 8.55t-1.425-.575L6.7 4.1q-.275-.275-.275-.7t.275-.7t.7-.275t.7.275z"})})}function p(r){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",...r,children:t.jsx("path",{fill:"currentColor",d:"m12 19.15l3.875-3.875q.3-.3.7-.3t.7.3t.3.713t-.3.712l-3.85 3.875q-.575.575-1.425.575t-1.425-.575L6.7 16.7q-.3-.3-.288-.712t.313-.713t.713-.3t.712.3zm0-14.3L8.15 8.7q-.3.3-.7.288t-.7-.288q-.3-.3-.312-.712t.287-.713l3.85-3.85Q11.15 2.85 12 2.85t1.425.575l3.85 3.85q.3.3.288.713t-.313.712q-.3.275-.7.288t-.7-.288z"})})}const b=o(function(e){const{t:a}=i();return t.jsxs(u,{align:"v",justifyContent:"between",open:e.open,children:[t.jsxs(s,{align:"v",gap:"xs",children:[t.jsx("img",{src:e.thumbnailUrl,alt:a("mesh-renderer.material.thumbnail"),width:"20px",height:"20px"}),t.jsxs(m,{children:[a("mesh-renderer.material.title"),"(",e.name,")"]})]}),t.jsx(d,{size:"xs",variant:"subtle",children:e.open?t.jsx(x,{}):t.jsx(p,{})})]})}),w=r=>{const{materialAsset:e}=r,[a,l]=c.useState(!1);return t.jsx(g,{nesting:!0,title:t.jsx(b,{open:a,thumbnailUrl:e.thumbnailUrl,name:e.name}),defaultOpen:!1,open:a,onOpenChange:l,children:t.jsx(h,{asset:e})})};export{w as R};
|
package/dist/preview-client/_static/{RenderTargetAsset-e112b8ca.js → RenderTargetAsset-b810caf3.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
var C=Object.defineProperty;var M=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(M(s,typeof t!="symbol"?t+"":t,e),e);import{N as R,$ as y,a$ as l,j as x,a_ as v,by as S,p as b,C as m,m as f,n as G,e as F,o as O,q as D}from"./index-
|
|
1
|
+
var C=Object.defineProperty;var M=(s,t,e)=>t in s?C(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var h=(s,t,e)=>(M(s,typeof t!="symbol"?t+"":t,e),e);import{N as R,$ as y,a$ as l,j as x,a_ as v,by as S,p as b,C as m,m as f,n as G,e as F,o as O,q as D}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";import{A as B}from"./AssetViewer-d2c63b00.js";class A{static update(t,e){var o;this.spriteEntity?this.spriteEntity.isActive=!0:this.initScene(t),this.entity=this.spriteEntity;const i=(o=e.engineObject)==null?void 0:o.getColorTexture(0);i&&(this.sprite.texture=i)}static clear(){this.spriteEntity&&(this.spriteEntity.isActive=!1)}static initScene(t){const e=this.spriteEntity=t.createChild("rt-thumbnail");this.spriteRenderer=e.addComponent(R),this.spriteRenderer.sprite=this.sprite=new y(t.engine)}}h(A,"entity"),h(A,"spriteEntity"),h(A,"spriteRenderer"),h(A,"sprite");class j extends B{constructor(){super(...arguments);h(this,"_asset");h(this,"_sprite");h(this,"_onRebuild",()=>{var e;if(this._sprite&&((e=this._asset)!=null&&e.engineObject)){const i=this._asset.engineObject.getColorTexture(0);i&&(this._sprite.texture=i)}})}setViewAsset(e,i){var _;this._asset=e;const o=i.engine,r=i.createChild("rt_preview"),n=(_=e.engineObject)==null?void 0:_.getColorTexture(0),a=new y(o,n),c=r.addComponent(R);c.sprite=a,this._sprite=a,this._entity=r,e.onRebuild(this._onRebuild)}stopViewAsset(){super.stopViewAsset(),this._asset&&this._asset.offRebuild(this._onRebuild),this._asset=null,this._sprite=null}getDescription(e){return`${e.width}x${e.height}`}}var E=Object.defineProperty,V=Object.getOwnPropertyDescriptor,g=(s,t,e,i)=>{for(var o=i>1?void 0:i?V(t,e):t,r=s.length-1,n;r>=0;r--)(n=s[r])&&(o=(i?n(t,e,o):n(o))||o);return i&&o&&E(t,e,o),o};const I=[{label:"R8G8B8A8",value:l.R8G8B8A8},{label:"R8G8B8",value:l.R8G8B8},{label:"R16G16B16A16",value:l.R16G16B16A16},{label:"R32G32B32A32",value:l.R32G32B32A32},{label:"R11G11B10_UFloat",value:l.R11G11B10_UFloat}],w=-1,L=[{label:"None",value:w},{label:"Depth",value:l.Depth},{label:"Depth16",value:l.Depth16},{label:"Depth24",value:l.Depth24},{label:"Depth32",value:l.Depth32},{label:"Depth24Stencil8",value:l.Depth24Stencil8},{label:"Depth32Stencil8",value:l.Depth32Stencil8}],U=[{label:"1",value:1},{label:"2",value:2},{label:"4",value:4},{label:"8",value:8}];let u=class extends x{constructor(){super(...arguments);h(this,"_onRebuildCallbacks",[]);h(this,"width",512);h(this,"height",512);h(this,"colorFormat",l.R8G8B8A8);h(this,"depthFormat",l.Depth);h(this,"antiAliasing",1);h(this,"autoGenerateMipmaps",!0)}registerThumbnail(){}onRebuild(t){this._onRebuildCallbacks.push(t)}offRebuild(t){const e=this._onRebuildCallbacks.indexOf(t);e!==-1&&this._onRebuildCallbacks.splice(e,1)}async initByCreation(){return this.getMainData()}getMainData(){var i;const t={width:this.width,height:this.height,colorFormats:[this.colorFormat],depthFormat:this.depthFormat,antiAliasing:this.antiAliasing,autoGenerateMipmaps:this.autoGenerateMipmaps},e=(i=this.engineObject)==null?void 0:i.getColorTexture(0);return e&&(t.colorTextures=[{isSRGBColorSpace:e.isSRGBColorSpace,mipmap:e.mipmapCount>1,filterMode:e.filterMode,wrapModeU:e.wrapModeU,wrapModeV:e.wrapModeV,anisoLevel:e.anisoLevel}]),JSON.stringify(t)}async initByMain(t){const e=JSON.parse(await t.text());this.width=Math.round(e.width??512),this.height=Math.round(e.height??512);const i=e.colorFormats??[e.colorFormat??l.R8G8B8A8];this.colorFormat=i[0],this.depthFormat=e.depthFormat??l.Depth,this.antiAliasing=e.antiAliasing??1,this.autoGenerateMipmaps=e.autoGenerateMipmaps??!1;const r=(e.colorTextures??(e.colorTexture?[e.colorTexture]:[]))[0],n=this._buildRenderTarget((r==null?void 0:r.mipmap)??!0,r==null?void 0:r.isSRGBColorSpace);await this.bindEngineObject(n);const a=n.getColorTexture(0);a&&r&&(r.filterMode!=null&&(a.filterMode=r.filterMode),r.wrapModeU!=null&&(a.wrapModeU=r.wrapModeU),r.wrapModeV!=null&&(a.wrapModeV=r.wrapModeV),r.anisoLevel!=null&&(a.anisoLevel=r.anisoLevel)),await this._generateSubAssets()}destroy(){this._destroySubAssets(),this.engineObject&&this._replaceCameraRenderTarget(this.engineObject,null),this._onRebuildCallbacks.length=0,this._destroyRenderTarget(),super.destroy()}async _rebuild(){var _;if(!this.engineObject)return;const t=this.engineObject,e=t.getColorTexture(0),i=(_=this._subAssets)==null?void 0:_[0],o=i?i.mipmap??!0:!0,r=i?i.isSRGBColorSpace??this.colorFormat===l.R8G8B8A8:this.colorFormat===l.R8G8B8A8,n=e&&e.format===this.colorFormat&&e.width===this.width&&e.height===this.height&&e.isSRGBColorSpace===r&&o===e.mipmapCount>1;let a;try{a=n?this._buildRenderTargetWithTexture(e):this._buildRenderTarget(o,r)}catch(p){console.warn("Failed to create RenderTarget:",p);return}if(!n&&e){const p=a.getColorTexture(0);p&&(p.filterMode=e.filterMode,p.wrapModeU=e.wrapModeU,p.wrapModeV=e.wrapModeV,p.anisoLevel=e.anisoLevel)}const c=this._replaceCameraRenderTarget(t,a);if(t.destroy(),await this.bindEngineObject(a),n||(e==null||e.destroy(),this._destroySubAssets(),await this._generateSubAssets()),c.length>0){const p=c.map(d=>d.enabled);c.forEach(d=>d.enabled=!0),requestAnimationFrame(()=>{this._onRebuildCallbacks.forEach(d=>d()),c.forEach((d,T)=>d.enabled=p[T])})}else this._onRebuildCallbacks.forEach(p=>p())}_buildRenderTarget(t=!0,e){const{width:i,height:o,colorFormat:r}=this;e===void 0&&(e=r===l.R8G8B8A8);const n=new v(this.engine,i,o,r,t,e);return n.isGCIgnored=!0,this._buildRenderTargetWithTexture(n)}_buildRenderTargetWithTexture(t){const{width:e,height:i,depthFormat:o,antiAliasing:r,autoGenerateMipmaps:n}=this,a=o===w?null:o,c=new S(this.engine,e,i,t,a,r);return c.isGCIgnored=!0,c.autoGenerateMipmaps=n,c}_destroyRenderTarget(){var e;const t=this.engineObject;t&&((e=t.getColorTexture(0))==null||e.destroy(),t.destroy())}_replaceCameraRenderTarget(t,e){const i=this.root.projectStore.currentScene;if(!i)return[];const o=[];for(const r of i.entities.values())for(const n of r.components)if(n.type==="Camera"){const a=n.engineObject;(a==null?void 0:a.renderTarget)===t&&(a.renderTarget=e,o.push(a))}return o}async _generateSubAssets(){const t=this.engineObject,e=[],i=t.getColorTexture(0);if(i){i.name=`${this.name}-color`;const o=await this.root.assetStore.createSubAsset("Texture",i,this.id,"colorTextures[0]");o._editable=!0,e.push(o)}this._subAssets=e}_destroySubAssets(){if(this._subAssets){for(const t of this._subAssets)this.root.assetStore.deleteSubAsset(t.id);this._subAssets=[]}}};g([b({type:m.Number,label:"Width",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.width=Math.round(s.width),s._rebuild()}}),f()],u.prototype,"width",2);g([b({type:m.Number,label:"Height",min:1,max:8192,triggerAfterInit:!1,onChange:s=>{s.height=Math.round(s.height),s._rebuild()}}),f()],u.prototype,"height",2);g([b({type:m.Select,label:"Color Format",options:I,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"colorFormat",2);g([b({type:m.Select,label:"Depth Format",options:L,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"depthFormat",2);g([b({type:m.Select,label:"Anti-Aliasing",options:U,triggerAfterInit:!1,onChange:s=>s._rebuild()}),f()],u.prototype,"antiAliasing",2);g([b({type:m.Toggle,label:"Auto Generate Mipmaps",triggerAfterInit:!1,onChange:s=>{const t=s.engineObject;t&&(t.autoGenerateMipmaps=s.autoGenerateMipmaps)}}),f()],u.prototype,"autoGenerateMipmaps",2);u=g([G({type:"RenderTarget",label:F("asset.render-target.title"),extname:"renderTarget",importMenuConfig:{type:O.Add},dragLayer:D.RenderTarget,viewer:j,thumbnail:A,async bundle({content:s}){return{content:s}}})],u);export{u as RenderTargetAsset};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var p=Object.defineProperty;var l=(t,e,s)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>(l(t,typeof e!="symbol"?e+"":e,s),s);import{j as m,u as h,aW as u,aX as d,aY as f,aZ as y,n as D,e as S,o as v}from"./index-
|
|
1
|
+
var p=Object.defineProperty;var l=(t,e,s)=>e in t?p(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var o=(t,e,s)=>(l(t,typeof e!="symbol"?e+"":e,s),s);import{j as m,u as h,aW as u,aX as d,aY as f,aZ as y,n as D,e as S,o as v}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";function b(t){const e={asset:{version:"2.0",generator:"Galacean Editor"},scene:{rootEntities:["1000000","1000001"],background:{mode:0,color:{r:.0157,g:.0157,b:.0157,a:1}},ambient:{},shadow:{},fog:{}},entities:[{id:"1000000",name:"Camera",position:[0,0,10],components:["1000100"]},{id:"1000001",name:"DirectLight",position:[0,3,0],rotation:[-45,-45,0],components:["1000101"]}],components:[{id:"1000100",type:"Camera",props:{isOrthographic:!1,nearClipPlane:.1,farClipPlane:100,viewport:{x:0,y:0,z:1,w:1}}},{id:"1000101",type:"DirectLight",props:{enabled:!0,intensity:.6,color:{r:1,g:1,b:1,a:1}}}]};return t!==void 0&&(e.scene.name=t),e}var g=Object.defineProperty,w=Object.getOwnPropertyDescriptor,C=(t,e,s,a)=>{for(var n=a>1?void 0:a?w(e,s):e,i=t.length-1,r;i>=0;i--)(r=t[i])&&(n=(a?r(e,s,n):r(n))||n);return a&&n&&g(e,s,n),n};let c=class extends m{constructor(e){super(e);o(this,"sceneData",null);h(this)}async initByMain(e,s){this.sceneData=u(await e.text())}getMainData(){return d(this.sceneData)}async rename(e){await super.rename(e),await this.root.assetFacade.persistAssetMain(this.id)}saveMainImmediately(){var s;const e=this.root.sceneStore;if(this.id===e.refId){if(e.destroyed){f(this.root.projectStore.id,this.serverId);return}const a=y(this.root,this.id);return this.sceneData=a,this.sceneData.scene&&(this.sceneData.scene.name=this.name),super.saveMainImmediately()}else if((s=this.sceneData)!=null&&s.scene&&this.sceneData.scene.name!==this.name)return this.sceneData.scene.name=this.name,super.saveMainImmediately()}async initByCreation(e,s,a){return this.sceneData=b(this._name)}onDoubleClick(){this.root.projectStore.switchScene({scene:this.id})}};c=C([D({type:"Scene",label:S("asset.scene.title"),defaultName:"Scene",extname:"scene",importMenuConfig:{type:v.Add},async bundle(t){return{content:new Blob([t.content],{type:"application/json"})}}})],c);export{c as SceneAsset};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Dr=Object.defineProperty;var Vr=(e,c,i)=>c in e?Dr(e,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[c]=i;var Ae=(e,c,i)=>(Vr(e,typeof c!="symbol"?c+"":c,i),i);import{dM as Fr,b3 as Ke,dN as Gr,dO as Br,ag as Tr,dP as kr,dQ as Ur,a2 as Wr,a1 as Nr,af as zr,dR as Hr,dS as rr,dT as dr,dU as jr,aH as qr,aJ as Xr,av as Je,e as ht,C as ue,dV as wr,aO as Qr,b1 as vr,b2 as ir,j as Yr,u as $r,ae as Nt,dW as Jr,F as ar,ai as nr,V as sr,bX as Zr,aT as Kr,x as ei,c2 as ti,n as ri,o as ii,dX as ai,dY as ni,dZ as si}from"./index-
|
|
1
|
+
var Dr=Object.defineProperty;var Vr=(e,c,i)=>c in e?Dr(e,c,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[c]=i;var Ae=(e,c,i)=>(Vr(e,typeof c!="symbol"?c+"":c,i),i);import{dM as Fr,b3 as Ke,dN as Gr,dO as Br,ag as Tr,dP as kr,dQ as Ur,a2 as Wr,a1 as Nr,af as zr,dR as Hr,dS as rr,dT as dr,dU as jr,aH as qr,aJ as Xr,av as Je,e as ht,C as ue,dV as wr,aO as Qr,b1 as vr,b2 as ir,j as Yr,u as $r,ae as Nt,dW as Jr,F as ar,ai as nr,V as sr,bX as Zr,aT as Kr,x as ei,c2 as ti,n as ri,o as ii,dX as ai,dY as ni,dZ as si}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";import"./meshopt_simplifier.module-cd99529d.js";import{c as Re,t as oi,g as ci,i as li,E as or,b as ui,l as pi}from"./ShaderUIScriptAsset-ebf57ceb.js";import{E as de,s as hi}from"./shader-data-utils-000170ae.js";import{I as fi}from"./IconPointFilled-bad94cf1.js";import{F as _i}from"./index-7e414715.js";function di(e,c){const{precompile:i,platformTarget:t=0,basePathForIncludeKey:r}=c,n=i(e,t,r);return JSON.stringify(n)}function R(e,c){return c!=null&&typeof Symbol<"u"&&c[Symbol.hasInstance]?!!c[Symbol.hasInstance](e):e instanceof c}function tt(e,c){return tt=Object.setPrototypeOf||function(t,r){return t.__proto__=r,t},tt(e,c)}function D(e,c){if(typeof c!="function"&&c!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(c&&c.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),c&&tt(e,c)}function cr(e,c){for(var i=0;i<c.length;i++){var t=c[i];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}}function be(e,c,i){return c&&cr(e.prototype,c),i&&cr(e,i),e}function lr(e,c){(c==null||c>e.length)&&(c=e.length);for(var i=0,t=new Array(c);i<c;i++)t[i]=e[i];return t}function vi(e,c){if(e){if(typeof e=="string")return lr(e,c);var i=Object.prototype.toString.call(e).slice(8,-1);if(i==="Object"&&e.constructor&&(i=e.constructor.name),i==="Map"||i==="Set")return Array.from(i);if(i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return lr(e,c)}}function Y(e,c){var i=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=vi(e))||c&&e&&typeof e.length=="number"){i&&(e=i);var t=0;return function(){return t>=e.length?{done:!0}:{done:!1,value:e[t++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function B(e,c,i,t){var r=arguments.length,n=r<3?c:t===null?t=Object.getOwnPropertyDescriptor(c,i):t,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(e,c,i,t);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(c,i,n):s(c,i))||n);return r>3&&n&&Object.defineProperty(c,i,n),n}function mi(e,c){var i={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=l(0),s.throw=l(1),s.return=l(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(_){return function(S){return u([_,S])}}function u(_){if(t)throw new TypeError("Generator is already executing.");for(;s&&(s=0,_[0]&&(i=0)),i;)try{if(t=1,r&&(n=_[0]&2?r.return:_[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,_[1])).done)return n;switch(r=0,n&&(_=[_[0]&2,n.value]),_[0]){case 0:case 1:n=_;break;case 4:return i.label++,{value:_[1],done:!1};case 5:i.label++,r=_[1],_=[0];continue;case 7:_=i.ops.pop(),i.trys.pop();continue;default:if(n=i.trys,!(n=n.length>0&&n[n.length-1])&&(_[0]===6||_[0]===2)){i=0;continue}if(_[0]===3&&(!n||_[1]>n[0]&&_[1]<n[3])){i.label=_[1];break}if(_[0]===6&&i.label<n[1]){i.label=n[1],n=_;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(_);break}n[2]&&i.ops.pop(),i.trys.pop();continue}_=c.call(e,i)}catch(S){_=[6,S],r=0}finally{t=n=0}if(_[0]&5)throw _[1];return{value:_[0]?_[1]:void 0,done:!0}}}var mr=function(){function e(){}var c=e.prototype;return c.set=function(t,r){this.start=t,this.end=r},c.dispose=function(){this.start.dispose(),this.end.dispose()},e}(),Sr=function(){function e(){}var c=e.prototype;return c.set=function(t){this.index=t},c.dispose=function(){this.index=0},e}(),h=function(e){return e[e.ID=1e3]="ID",e[e.FLOAT_CONSTANT=1001]="FLOAT_CONSTANT",e[e.INT_CONSTANT=1002]="INT_CONSTANT",e[e.STRING_CONST=1003]="STRING_CONST",e[e.LEFT_OP=1004]="LEFT_OP",e[e.RIGHT_OP=1005]="RIGHT_OP",e[e.INC_OP=1006]="INC_OP",e[e.DEC_OP=1007]="DEC_OP",e[e.LE_OP=1008]="LE_OP",e[e.GE_OP=1009]="GE_OP",e[e.EQ_OP=1010]="EQ_OP",e[e.NE_OP=1011]="NE_OP",e[e.AND_OP=1012]="AND_OP",e[e.OR_OP=1013]="OR_OP",e[e.XOR_OP=1014]="XOR_OP",e[e.MUL_ASSIGN=1015]="MUL_ASSIGN",e[e.DIV_ASSIGN=1016]="DIV_ASSIGN",e[e.ADD_ASSIGN=1017]="ADD_ASSIGN",e[e.SUB_ASSIGN=1018]="SUB_ASSIGN",e[e.MOD_ASSIGN=1019]="MOD_ASSIGN",e[e.LEFT_ASSIGN=1020]="LEFT_ASSIGN",e[e.RIGHT_ASSIGN=1021]="RIGHT_ASSIGN",e[e.AND_ASSIGN=1022]="AND_ASSIGN",e[e.XOR_ASSIGN=1023]="XOR_ASSIGN",e[e.OR_ASSIGN=1024]="OR_ASSIGN",e[e.LEFT_PAREN=1025]="LEFT_PAREN",e[e.RIGHT_PAREN=1026]="RIGHT_PAREN",e[e.LEFT_BRACKET=1027]="LEFT_BRACKET",e[e.RIGHT_BRACKET=1028]="RIGHT_BRACKET",e[e.LEFT_BRACE=1029]="LEFT_BRACE",e[e.RIGHT_BRACE=1030]="RIGHT_BRACE",e[e.DOT=1031]="DOT",e[e.COMMA=1032]="COMMA",e[e.COLON=1033]="COLON",e[e.EQUAL=1034]="EQUAL",e[e.SEMICOLON=1035]="SEMICOLON",e[e.BANG=1036]="BANG",e[e.DASH=1037]="DASH",e[e.TILDE=1038]="TILDE",e[e.PLUS=1039]="PLUS",e[e.STAR=1040]="STAR",e[e.SLASH=1041]="SLASH",e[e.PERCENT=1042]="PERCENT",e[e.LEFT_ANGLE=1043]="LEFT_ANGLE",e[e.RIGHT_ANGLE=1044]="RIGHT_ANGLE",e[e.VERTICAL_BAR=1045]="VERTICAL_BAR",e[e.CARET=1046]="CARET",e[e.AMPERSAND=1047]="AMPERSAND",e[e.QUESTION=1048]="QUESTION",e[e.NotWord=1049]="NotWord",e[e.EPSILON=1998]="EPSILON",e[e.EOF=1999]="EOF",e}({}),_e=3e3,a=function(e){return e[e.CONST=0]="CONST",e[e.BOOL=1]="BOOL",e[e.FLOAT=2]="FLOAT",e[e.DOUBLE=3]="DOUBLE",e[e.INT=4]="INT",e[e.UINT=5]="UINT",e[e.BREAK=6]="BREAK",e[e.CONTINUE=7]="CONTINUE",e[e.DO=8]="DO",e[e.ELSE=9]="ELSE",e[e.FOR=10]="FOR",e[e.IF=11]="IF",e[e.WHILE=12]="WHILE",e[e.DISCARD=13]="DISCARD",e[e.RETURN=14]="RETURN",e[e.BVEC2=15]="BVEC2",e[e.BVEC3=16]="BVEC3",e[e.BVEC4=17]="BVEC4",e[e.IVEC2=18]="IVEC2",e[e.IVEC3=19]="IVEC3",e[e.IVEC4=20]="IVEC4",e[e.UVEC2=21]="UVEC2",e[e.UVEC3=22]="UVEC3",e[e.UVEC4=23]="UVEC4",e[e.VEC2=24]="VEC2",e[e.VEC3=25]="VEC3",e[e.VEC4=26]="VEC4",e[e.VEC4_ARRAY=27]="VEC4_ARRAY",e[e.MAT2=28]="MAT2",e[e.MAT3=29]="MAT3",e[e.MAT4=30]="MAT4",e[e.MAT2X3=31]="MAT2X3",e[e.MAT2X4=32]="MAT2X4",e[e.MAT3X2=33]="MAT3X2",e[e.MAT3X4=34]="MAT3X4",e[e.MAT4X2=35]="MAT4X2",e[e.MAT4X3=36]="MAT4X3",e[e.IN=37]="IN",e[e.OUT=38]="OUT",e[e.INOUT=39]="INOUT",e[e.CENTROID=40]="CENTROID",e[e.SAMPLER2D=41]="SAMPLER2D",e[e.SAMPLER3D=42]="SAMPLER3D",e[e.SAMPLER_CUBE=43]="SAMPLER_CUBE",e[e.SAMPLER2D_SHADOW=44]="SAMPLER2D_SHADOW",e[e.SAMPLER_CUBE_SHADOW=45]="SAMPLER_CUBE_SHADOW",e[e.SAMPLER2D_ARRAY=46]="SAMPLER2D_ARRAY",e[e.SAMPLER2D_ARRAY_SHADOW=47]="SAMPLER2D_ARRAY_SHADOW",e[e.I_SAMPLER2D=48]="I_SAMPLER2D",e[e.I_SAMPLER3D=49]="I_SAMPLER3D",e[e.I_SAMPLER_CUBE=50]="I_SAMPLER_CUBE",e[e.I_SAMPLER2D_ARRAY=51]="I_SAMPLER2D_ARRAY",e[e.U_SAMPLER2D=52]="U_SAMPLER2D",e[e.U_SAMPLER3D=53]="U_SAMPLER3D",e[e.U_SAMPLER_CUBE=54]="U_SAMPLER_CUBE",e[e.U_SAMPLER2D_ARRAY=55]="U_SAMPLER2D_ARRAY",e[e.STRUCT=56]="STRUCT",e[e.LAYOUT=57]="LAYOUT",e[e.LOCATION=58]="LOCATION",e[e.VOID=59]="VOID",e[e.PRECISION=60]="PRECISION",e[e.PRECISE=61]="PRECISE",e[e.HIGHP=62]="HIGHP",e[e.MEDIUMP=63]="MEDIUMP",e[e.LOWP=64]="LOWP",e[e.INVARIANT=65]="INVARIANT",e[e.SMOOTH=66]="SMOOTH",e[e.FLAT=67]="FLAT",e[e.NOPERSPECTIVE=68]="NOPERSPECTIVE",e[e.True=69]="True",e[e.False=70]="False",e[e.LeftBrace=71]="LeftBrace",e[e.RightBrace=72]="RightBrace",e[e.Equal=73]="Equal",e[e.BitwiseOr=74]="BitwiseOr",e[e.GSRenderQueueType=75]="GSRenderQueueType",e[e.GSBlendState=76]="GSBlendState",e[e.GSDepthState=77]="GSDepthState",e[e.GSStencilState=78]="GSStencilState",e[e.GSRasterState=79]="GSRasterState",e[e.GSEditorProperties=80]="GSEditorProperties",e[e.GSEditorMacros=81]="GSEditorMacros",e[e.GSEditor=82]="GSEditor",e[e.GSTags=83]="GSTags",e[e.GSVertexShader=84]="GSVertexShader",e[e.GSFragmentShader=85]="GSFragmentShader",e[e.GSSubShader=86]="GSSubShader",e[e.GSPass=87]="GSPass",e[e.GSBlendFactor=88]="GSBlendFactor",e[e.GSBlendOperation=89]="GSBlendOperation",e[e.GSBool=90]="GSBool",e[e.GSNumber=91]="GSNumber",e[e.GSColor=92]="GSColor",e[e.GSCompareFunction=93]="GSCompareFunction",e[e.GSStencilOperation=94]="GSStencilOperation",e[e.GSCullMode=95]="GSCullMode",e[e.GSColorWriteMask=96]="GSColorWriteMask",e[e.GSUsePass=97]="GSUsePass",e[e.MACRO_IF=98]="MACRO_IF",e[e.MACRO_IFDEF=99]="MACRO_IFDEF",e[e.MACRO_IFNDEF=100]="MACRO_IFNDEF",e[e.MACRO_ELSE=101]="MACRO_ELSE",e[e.MACRO_ELIF=102]="MACRO_ELIF",e[e.MACRO_ENDIF=103]="MACRO_ENDIF",e[e.MACRO_UNDEF=104]="MACRO_UNDEF",e[e.MACRO_DEFINE_EXPRESSION=105]="MACRO_DEFINE_EXPRESSION",e[e.MACRO_CONDITIONAL_EXPRESSION=106]="MACRO_CONDITIONAL_EXPRESSION",e[e.MACRO_CALL=107]="MACRO_CALL",e[e.MACRO_DEFINE=108]="MACRO_DEFINE",e[e.MACRO_DEFINE_END=109]="MACRO_DEFINE_END",e[e.MACRO_DEFINE_PARAMS=110]="MACRO_DEFINE_PARAMS",e}({}),xe=function(){function e(){}return e.createObjectPool=function(i){var t=new Gr(i);return e._shaderCompilerObjectPoolSet.push(t),t},e.clearAllShaderCompilerObjectPool=function(){for(var i=0,t=e._shaderCompilerObjectPoolSet.length;i<t;i++)e._shaderCompilerObjectPoolSet[i].clear()},e.createGSError=function(i,t,r,n,s){console.error(i);var l=new Error(i);return l.name=t,l},e}();xe._shaderCompilerObjectPoolSet=[];var Xt=[],w=function(){function e(){this.branch=Xt}var c=e.prototype;return c.set=function(t,r,n){if(this.type=t,this.lexeme=r,this.branch=Xt,n)if(R(n,mr))this.location=n;else{var s=Ce.createPosition(n.index+r.length);this.location=Ce.createRange(n,s)}},c.dispose=function(){},e}();w.pool=xe.createObjectPool(w);var wt=new w;wt.set(h.EOF,"/EOF");var o=function(e){return e[e.START=2e3]="START",e[e.gs_shader_program=2001]="gs_shader_program",e[e.global_declaration=2002]="global_declaration",e[e.variable_declaration=2003]="variable_declaration",e[e.variable_declaration_list=2004]="variable_declaration_list",e[e.variable_declaration_statement=2005]="variable_declaration_statement",e[e.array_specifier_list=2006]="array_specifier_list",e[e.array_specifier=2007]="array_specifier",e[e.ext_builtin_type_specifier_nonarray=2008]="ext_builtin_type_specifier_nonarray",e[e.precision_specifier=2009]="precision_specifier",e[e.variable_identifier=2010]="variable_identifier",e[e.variable_identifier_node=2011]="variable_identifier_node",e[e.primary_expression=2012]="primary_expression",e[e.postfix_expression=2013]="postfix_expression",e[e.integer_expression=2014]="integer_expression",e[e.function_call=2015]="function_call",e[e.function_call_generic=2016]="function_call_generic",e[e.function_call_header_no_parameters=2017]="function_call_header_no_parameters",e[e.function_call_header_with_parameters=2018]="function_call_header_with_parameters",e[e.function_call_parameter_list=2019]="function_call_parameter_list",e[e.function_call_header=2020]="function_call_header",e[e.function_identifier=2021]="function_identifier",e[e.constructor_identifier=2022]="constructor_identifier",e[e.unary_expression=2023]="unary_expression",e[e.unary_operator=2024]="unary_operator",e[e.multiplicative_expression=2025]="multiplicative_expression",e[e.additive_expression=2026]="additive_expression",e[e.shift_expression=2027]="shift_expression",e[e.relational_expression=2028]="relational_expression",e[e.equality_expression=2029]="equality_expression",e[e.and_expression=2030]="and_expression",e[e.inclusive_or_expression=2031]="inclusive_or_expression",e[e.exclusive_or_expression=2032]="exclusive_or_expression",e[e.logical_and_expression=2033]="logical_and_expression",e[e.logical_xor_expression=2034]="logical_xor_expression",e[e.logical_or_expression=2035]="logical_or_expression",e[e.conditional_expression=2036]="conditional_expression",e[e.assignment_expression=2037]="assignment_expression",e[e.assignment_operator=2038]="assignment_operator",e[e.expression=2039]="expression",e[e.integer_constant_expression=2040]="integer_constant_expression",e[e.integer_constant_expression_operator=2041]="integer_constant_expression_operator",e[e.declaration=2042]="declaration",e[e.function_prototype=2043]="function_prototype",e[e.function_declarator=2044]="function_declarator",e[e.function_header_with_parameters=2045]="function_header_with_parameters",e[e.function_header=2046]="function_header",e[e.function_parameter_list=2047]="function_parameter_list",e[e.parameter_declarator=2048]="parameter_declarator",e[e.parameter_declaration=2049]="parameter_declaration",e[e.parameter_qualifier=2050]="parameter_qualifier",e[e.parameter_type_specifier=2051]="parameter_type_specifier",e[e.init_declarator_list=2052]="init_declarator_list",e[e.single_declaration=2053]="single_declaration",e[e.fully_specified_type=2054]="fully_specified_type",e[e.type_qualifier=2055]="type_qualifier",e[e.single_type_qualifier=2056]="single_type_qualifier",e[e.storage_qualifier=2057]="storage_qualifier",e[e.precision_qualifier=2058]="precision_qualifier",e[e.interpolation_qualifier=2059]="interpolation_qualifier",e[e.invariant_qualifier=2060]="invariant_qualifier",e[e.type_specifier=2061]="type_specifier",e[e.type_specifier_nonarray=2062]="type_specifier_nonarray",e[e.type_specifier_no_prec=2063]="type_specifier_no_prec",e[e.basic_type=2064]="basic_type",e[e.struct_specifier=2065]="struct_specifier",e[e.struct_declaration_list=2066]="struct_declaration_list",e[e.struct_declaration=2067]="struct_declaration",e[e.layout_qualifier=2068]="layout_qualifier",e[e.struct_declarator_list=2069]="struct_declarator_list",e[e.struct_declarator=2070]="struct_declarator",e[e.identifier_list=2071]="identifier_list",e[e.decl_identifier=2072]="decl_identifier",e[e.initializer=2073]="initializer",e[e.initializer_list=2074]="initializer_list",e[e.declaration_statement=2075]="declaration_statement",e[e.simple_statement=2076]="simple_statement",e[e.compound_statement_no_scope=2077]="compound_statement_no_scope",e[e.statement_with_scope=2078]="statement_with_scope",e[e.compound_statement=2079]="compound_statement",e[e.statement=2080]="statement",e[e.statement_list=2081]="statement_list",e[e.iteration_statement_no_new_scope=2082]="iteration_statement_no_new_scope",e[e.expression_statement=2083]="expression_statement",e[e.selection_statement=2084]="selection_statement",e[e.selection_rest_statement=2085]="selection_rest_statement",e[e.condition=2086]="condition",e[e.conditionopt=2087]="conditionopt",e[e.iteration_statement=2088]="iteration_statement",e[e.for_init_statement=2089]="for_init_statement",e[e.for_rest_statement=2090]="for_rest_statement",e[e.jump_statement=2091]="jump_statement",e[e.external_declaration=2092]="external_declaration",e[e.function_definition=2093]="function_definition",e[e.field_selection=2094]="field_selection",e[e.bool_constant=2095]="bool_constant",e[e.function_identifier_node=2096]="function_identifier_node",e[e.typename_identifier_node=2097]="typename_identifier_node",e[e.scope_brace=2098]="scope_brace",e[e.scope_end_brace=2099]="scope_end_brace",e[e.macro_undef=2100]="macro_undef",e[e.macro_push_context=2101]="macro_push_context",e[e.macro_pop_context=2102]="macro_pop_context",e[e.macro_elif_expression=2103]="macro_elif_expression",e[e.macro_else_expression=2104]="macro_else_expression",e[e.global_macro_if_statement=2105]="global_macro_if_statement",e[e.global_macro_declaration=2106]="global_macro_declaration",e[e.global_macro_branch=2107]="global_macro_branch",e[e.macro_struct_declaration=2108]="macro_struct_declaration",e[e.macro_struct_branch=2109]="macro_struct_branch",e[e.macro_if_statement=2110]="macro_if_statement",e[e.macro_branch=2111]="macro_branch",e[e.macro_param_case_list=2112]="macro_param_case_list",e[e.macro_param_block=2113]="macro_param_block",e[e.macro_parameter_branch=2114]="macro_parameter_branch",e[e.macro_call_arg_case_list=2115]="macro_call_arg_case_list",e[e.macro_call_arg_block=2116]="macro_call_arg_block",e[e.macro_call_arg_branch=2117]="macro_call_arg_branch",e[e.macro_call_symbol=2118]="macro_call_symbol",e[e.macro_call_function=2119]="macro_call_function",e[e.macro_define=2120]="macro_define",e[e._ignore=2121]="_ignore",e}({}),Be=function(){function e(){}return e.unwrapNodeByType=function(i,t){var r=i.children[0];if(!R(r,w))return r.nt===t?r:e.unwrapNodeByType(r,t)},e.parseMacroParamList=function(i){var t=i.replace(/^\s*\(\s*|\s*\)\s*$/g,"");return t?t.split(",").map(function(r){return r.trim()}).filter(Boolean):[]},e.unwrapBareIdentifier=function(i,t){for(var r=i;;){if(R(r,P.VariableIdentifier))return r;if(t.allowParens&&R(r,P.PrimaryExpression)&&r.children.length===3){var n=r.children[1];if(!R(n,G))return;r=n;continue}if(R(r,P.ExpressionAstNode)&&r.children.length===1){var s=r.children[0];if(!R(s,G))return;r=s;continue}return}},e.extractDirectIdentLexeme=function(i){var t=e.unwrapBareIdentifier(i,{allowParens:!0});if(!t)return null;var r=t.children[0];return R(r,w)?r.lexeme:null},e.isTerminal=function(i){return i<o.START},e}();function gr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gr=function(){return!!e})()}function Ne(e,c,i){return gr()?Ne=Reflect.construct:Ne=function(r,n,s){var l=[null];l.push.apply(l,n);var u=Function.bind.apply(r,l),_=new u;return s&&tt(_,s.prototype),_},Ne.apply(null,arguments)}function Qt(e){return Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(i){return i.__proto__||Object.getPrototypeOf(i)},Qt(e)}function Si(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Yt(e){var c=typeof Map=="function"?new Map:void 0;return Yt=function(i){if(i===null||!Si(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof c<"u"){if(c.has(i))return c.get(i);c.set(i,t)}function t(){return Ne(i,arguments,Qt(this).constructor)}return t.prototype=Object.create(i.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),tt(t,i)},Yt(e)}var Cr=function(e){D(c,e);function c(t,r,n,s,l){var u;return u=e.call(this,r)||this,u.location=n,u.source=s,u.file=l,u.name=t,u}var i=c.prototype;return i.toString=function(){var r=this,n=r.message,s=r.location,l=r.source;if(!l)return n;R(s,Sr)||(s.start,s.end),l.split(`
|
|
3
3
|
`);var u=this.name+": "+n+`
|
|
4
4
|
|
package/dist/preview-client/_static/{ShaderChunkAsset-bdb39acc.js → ShaderChunkAsset-e3487bd1.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var ni=Object.defineProperty;var ai=(n,e,t)=>e in n?ni(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>(ai(n,typeof e!="symbol"?e+"":e,t),t);import{aJ as ut,aM as b,av as y,aO as ve,bz as ri,aI as tt,
|
|
1
|
+
var ni=Object.defineProperty;var ai=(n,e,t)=>e in n?ni(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var d=(n,e,t)=>(ai(n,typeof e!="symbol"?e+"":e,t),t);import{aJ as ut,aM as b,av as y,aO as ve,bz as ri,aI as tt,g8 as oi,cl as li,N as Nt,W as ci,aH as it,aK as Rt,ai as Wt,a_ as Fe,by as pi,a$ as hi,gw as ui,b3 as di,co as fi,dh as ke,f4 as gi,aL as mi,eW as yi,e as P,bA as jt,q as et,ay as wi,aP as _t,F as De,j as ot,gx as be,$ as xi,K as Ee,C as R,bV as Pt,aA as vi,p as M,m as E,f as bi,v as Si,aC as Bt,n as Ct,o as Mt,bR as Le,c7 as Ii,bZ as gt,bY as Se,gy as Ri,bk as Ci,dk as _i,eq as Ie,ad as Q,T as D,gz as Re,s as Pi,f6 as Ht,aN as Mi,bX as Jt,b_ as Gt,u as $e,S as Ti,x as yt,aT as dt,bW as Ai,dX as pt,ae as ji,dY as Bi,dZ as Oi}from"./index-e44b357e.js";import{L as Zt}from"./module-5547be1c.js";import{u as re,F as Qt,r as te}from"./index-debbe073.js";import"./postmen-443b3e5f.js";import{c as Ne}from"./createReactComponent-cb70ea50.js";import{I as ze}from"./IconPlus-172c6c17.js";import{A as Ue}from"./AssetViewer-d2c63b00.js";import"./meshopt_simplifier.module-cd99529d.js";import{c as Fi}from"./bundlers-9b0d37fc.js";import{b as Ve,a as qe,c as ki}from"./TextureAsset-9cd94531.js";import"./GlTFAsset-83e8190e.js";import"./MaterialAsset-0b9d7eba.js";import"./MeshAsset-85e99837.js";import"./AnimatorControllerAsset-6cc04274.js";import"./AnimationClipAsset-b084da2a.js";import"./AmbientLightAsset-e34de607.js";import{L as Di}from"./module-57b6e417.js";import{s as Ei}from"./SpineSkeletonDataAsset-0dffbb4d.js";import"./FontAsset-6e9c0549.js";import"./SceneAsset-d05b1a79.js";import"./ShaderAsset-370b6f1c.js";import{l as Li}from"./ShaderUIScriptAsset-ebf57ceb.js";import"./PrimitiveMesh-70c93e7e.js";import"./XRReferenceImageAsset-79e78558.js";import"./PrefabAsset-265f6f48.js";import"./PhysicsMaterialAsset-cb9afb6e.js";import"./RenderTargetAsset-b810caf3.js";import"./AudioAsset-9c715952.js";import"./index-ea7fe254.js";import"./MarkdownAsset-b42846c0.js";import{F as We}from"./FormItemArray-b2a3d249.js";import{F as Kt}from"./index-7e414715.js";function $i(n,e){const t={};for(let i=0;i<n.length;i++){const s=n[i],a=e(s);Object.hasOwn(t,a)||(t[a]=[]),t[a].push(s)}return t}function Ni(n,e){const t=[],i=[];for(let s=0;s<n.length;s++){const a=n[s];e(a)?t.push(a):i.push(a)}return[t,i]}function zi(n,e){const t=new Map;for(let i=0;i<n.length;i++){const s=n[i],a=e(s);t.has(a)||t.set(a,s)}return Array.from(t.values())}/**
|
|
2
2
|
* @license @tabler/icons-react v3.24.0 - MIT
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var N=Object.defineProperty;var B=(t,a,e)=>a in t?N(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e;var d=(t,a,e)=>(B(t,typeof a!="symbol"?a+"":a,e),e);import{eB as w,bX as S,e as R,dJ as x,aJ as H,C as T,av as A,dV as I,j as Q,u as k,x as X,aT as U,p as $,c2 as j,n as V,q as G,o as q,dY as z,dZ as W,eC as Y,dU as K,dW as J}from"./index-
|
|
1
|
+
var N=Object.defineProperty;var B=(t,a,e)=>a in t?N(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e;var d=(t,a,e)=>(B(t,typeof a!="symbol"?a+"":a,e),e);import{eB as w,bX as S,e as R,dJ as x,aJ as H,C as T,av as A,dV as I,j as Q,u as k,x as X,aT as U,p as $,c2 as j,n as V,q as G,o as q,dY as z,dZ as W,eC as Y,dU as K,dW as J}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";function Z(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}const E="galacean-local-ide-config";function ee(t,a){const e=t.trim().replace(/^["'`]+|["'`]+$/g,"").replace(/\\/g,"/").replace(/\/{2,}/g,"/").replace(/\/+$/,"");if(!e)return p("empty",e);if(/[\r\n\t]/.test(e))return p("embedded-newline",e);if(/(^|\/)[a-z][a-z0-9+.-]*:\/\//i.test(e))return p("embedded-url",e);if(e.startsWith("~"))return p("tilde",e);if(!e.startsWith("/")&&!/^[A-Za-z]:\//.test(e))return p("not-absolute",e);if(/[<>"|?*]/.test(e))return p("illegal-chars",e);const r=e.split("/").filter(Boolean);return r.includes("..")||r.includes(".")?p("parent-segment",e):a?r[r.length-1]!==a?{kind:"error",reason:"tail-mismatch",normalized:e,expectedTail:a}:{kind:"ok",normalized:e}:p("no-binding",e)}function p(t,a){return{kind:"error",reason:t,normalized:a}}function ae(t){try{const a=localStorage.getItem(E);if(!a)return null;const e=JSON.parse(a);if(!e||typeof e.workspacePath!="string"||typeof e.ide!="string")return null;if(!e.workspacePath.trim())return localStorage.removeItem(E),null;const r=ee(e.workspacePath,t??null);return r.kind==="error"&&r.reason!=="no-binding"?(localStorage.removeItem(E),null):e}catch{return null}}function te(t){const a=t.replace(/\\/g,"/");return/^[A-Za-z]:\//.test(a)?`/${a}`:a}function re(t,a){switch(t){case"vscode":return`vscode://file${a}`;case"cursor":return`cursor://file${a}`;case"webstorm":return`webstorm://open?file=${encodeURIComponent(a)}`}}function v(t,a,e="",r=""){const s=[a.replace(/[\\/]+$/,""),e,r].filter(Boolean).join("/");return re(t,te(s))}function D(t){const a=document.createElement("a");a.href=t,a.style.display="none",document.body.appendChild(a),a.click(),a.remove()}function se(t,a,e){const{ide:r,workspacePath:s}=t,n=v(r,s,a,e);if(r==="webstorm"){D(n);return}D(v(r,s,a)),setTimeout(()=>D(n),800)}async function ne(t,a,e){const r=a.projectStore.localWorkspaceSync,s=ae(r==null?void 0:r.directoryName);if(!s||!(r!=null&&r.directoryHandle)){e();return}const n=a.projectStore.id,o=w(t);if(!await r.hasSyncedFile(o)){const h=(u,M)=>R(`asset.local-workspace-sync.${u}`,M),m=S.loading(h("syncing"));try{if(!await r.syncEditorAssetsToLocal()||!await r.hasSyncedFile(o)){S.error(r.errorMessage||h("failed"),{id:m}),e();return}S.success(h("success",[r.directoryName||h("local-workspace")]),{id:m})}catch(u){S.error(u instanceof Error?u.message:h("failed"),{id:m}),e();return}}se(s,n,o)}const oe=t=>{const{type:a="esm",varName:e,namedExports:r=null,defaultExport:s=!0}=typeof t=="string"?{varName:t}:t;return{type:a,varName:e,namedExports:r,defaultExport:s}},ie=t=>`module.exports = ${t};`,le=(t,a,e)=>{const r=e?[`export default ${t};`]:[];if(a&&a.length){const s=[...new Set(a)].join(", ");r.push(`const { ${s} } = ${t};`),r.push(`export { ${s} };`)}return r.join(`
|
|
2
2
|
`)},de=t=>{const{type:a,varName:e,namedExports:r,defaultExport:s}=t;switch(a){case"esm":return le(e,r,s);case"cjs":return ie(e)}},f="global-externals",ce=t=>{const{modulePathFilter:a,getModuleInfo:e}=t;return{name:f,setup(r){r.onResolve({filter:a},s=>({path:s.path,namespace:f})),r.onLoad({filter:/.*/,namespace:f},s=>{const n=s.path,o=oe(e(n));return{contents:de(o)}})}}},he=t=>{const a={modulePathFilter:new RegExp(`^(?:${Object.keys(t).join("|")})$`),getModuleInfo:e=>t[e]};return ce(a)},ue=async t=>x(()=>import(t),[]);async function pe(t,a=ue){const e=URL.createObjectURL(new Blob([t],{type:"application/javascript"}));try{return await a(e)}finally{URL.revokeObjectURL(e)}}var c=(t=>(t.Default="default",t.ShaderUI="shader_ui",t.StateMachine="state_machine",t))(c||{});const C=`
|
|
3
3
|
this.onPropertyChanged("isTransparent", (material, isTransparent) => {
|
|
4
4
|
const shaderData = material.shaderData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var y=Object.defineProperty;var j=(s,e,r)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var c=(s,e,r)=>(j(s,typeof e!="symbol"?e+"":e,r),r);import{aJ as m,bm as v,aK as b,av as t,aw as S,ay as d,aH as f,aI as g,aM as u,aO as k,aN as B,f as O,p as h,C as F,s as R}from"./index-
|
|
1
|
+
var y=Object.defineProperty;var j=(s,e,r)=>e in s?y(s,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[e]=r;var c=(s,e,r)=>(j(s,typeof e!="symbol"?e+"":e,r),r);import{aJ as m,bm as v,aK as b,av as t,aw as S,ay as d,aH as f,aI as g,aM as u,aO as k,aN as B,f as O,p as h,C as F,s as R}from"./index-e44b357e.js";import{u as I}from"./index-debbe073.js";import{c as M}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";import{c as E}from"./createOnModelChange-e65da908.js";import{M as _}from"./MaterialInspector-23ea0240.js";import{M as z}from"./MeshRendererBaseComponent-5621d663.js";import"./IconPointFilled-bad94cf1.js";import"./createReactComponent-cb70ea50.js";const x=m(v),P=m(({model:s,inspectorConfig:e,onModelChange:r})=>{const{disabled:n,property:o}=e,{t:i}=b();return t.jsxs(t.Fragment,{children:[t.jsx(S,{label:i(e.label),info:i(e.info),fieldCss:{minHeight:"$5"},children:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:null})}),t.jsx(x,{label:" ",disabled:n,value:s[o].min,onChange:a=>{r==null||r(o,{...s[o],min:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:i("skinned-mesh-renderer.local-bounds.min.label")})}),t.jsx(x,{label:" ",disabled:n,value:s[o].max,onChange:a=>{r==null||r(o,{...s[o],max:a})},formEndSlot:t.jsx(d,{size:"sm",selectable:!0,code:!0,children:i("skinned-mesh-renderer.local-bounds.max.label")})})]})}),C=f("div",{marginLeft:"5px"}),T=f(g,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),$=m(function(s){const e=s.data,{t:r}=b();return t.jsxs(T,{align:"v",children:[t.jsx("img",{src:e.thumbnailUrl,alt:"Material Thumbnail",width:"20px",height:"20px"}),t.jsxs(C,{children:[r("skinned-mesh-renderer.material.label"),"(",e.name,")"]})]})}),w=m(function(s){const[e,r]=u.useState(null),n=s.data,{assetStore:o,inspectorFacade:i}=I();return u.useEffect(()=>{o.getAssetByRef(n.material).then(a=>{r(a)})},[n.material]),t.jsxs(t.Fragment,{children:[t.jsx(k.List,{model:n,configs:n.formSchema.items,onModelChange:E("component",n.id,i,n)}),e&&t.jsx(B,{nesting:!0,title:t.jsx($,{data:e}),open:n.materialOpen,onOpenChange:a=>{n.setMaterialOpen(a)},children:t.jsx(_,{asset:e})})]})});var H=Object.defineProperty,V=Object.getOwnPropertyDescriptor,p=(s,e,r,n)=>{for(var o=n>1?void 0:n?V(e,r):e,i=s.length-1,a;i>=0;i--)(a=s[i])&&(o=(n?a(e,r,o):a(o))||o);return n&&o&&H(e,r,o),o};let l=class extends z{constructor(e,r){super(e,r);c(this,"rootBone",null);c(this,"localBounds",{min:{x:0,y:0,z:0},max:{x:0,y:0,z:0}})}};p([O({getEngineValue:s=>{var e;return(e=s.skin)==null?void 0:e.rootBone}}),h({label:"skinned-mesh-renderer.skin.root-bone.label",info:"skinned-mesh-renderer.skin.root-bone.info",type:F.EntityPicker,disabled:!0})],l.prototype,"rootBone",2);p([h({label:"skinned-mesh-renderer.local-bounds.title",info:"skinned-mesh-renderer.local-bounds.info",customComponent:P,type:"BoundingBox"}),R()],l.prototype,"localBounds",2);l=p([M({type:"SkinnedMeshRenderer",customInspector:w,componentsMenu:{label:"component.renderer.skinned-mesh.title"}})],l);export{l as SkinnedMeshRendererComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var F=Object.defineProperty;var S=(e,i,n)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n;var a=(e,i,n)=>(S(e,typeof i!="symbol"?i+"":i,n),n);import{S as v,a as B}from"./module-
|
|
1
|
+
var F=Object.defineProperty;var S=(e,i,n)=>i in e?F(e,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[i]=n;var a=(e,i,n)=>(S(e,typeof i!="symbol"?i+"":i,n),n);import{S as v,a as B}from"./module-57b6e417.js";import{aJ as h,bk as b,e as y,E as N,bl as O,x as g,p as l,C as f,s as m}from"./index-e44b357e.js";import{u as k}from"./index-debbe073.js";import{c as P}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";const R=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.animation.label"),value:i.animationName,options:i.animationForm,onChange(t){n.componentChange(i.id,"animationName",t)}})}),T=h(function(e){const{model:i}=e,{inspectorFacade:n}=k();return b({label:y("spine.skin.label"),value:i.skinName,options:i.skinForm,onChange(t){n.componentChange(i.id,"skinName",t)}})});var _=Object.defineProperty,j=Object.getOwnPropertyDescriptor,p=(e,i,n,t)=>{for(var o=t>1?void 0:t?j(i,n):i,c=e.length-1,u;c>=0;c--)(u=e[c])&&(o=(t?u(i,n,o):u(o))||o);return t&&o&&_(i,n,o),o};let s=class extends N{constructor(i,n){super(i,n);a(this,"animationForm",[]);a(this,"skinForm",[]);a(this,"hasInit",!1);a(this,"resource",null);a(this,"loop",!1);a(this,"animationName","none");a(this,"skinName","default");a(this,"priority",0);a(this,"premultipliedAlpha",!1);a(this,"tintBlack",!1)}deserialize(i){const{props:n}=i;if(this._enabled=(n==null?void 0:n.enabled)??!0,n){this.priority=n.priority,this.resource=n.resource,this.premultipliedAlpha=n.premultipliedAlpha,this.tintBlack=n.tintBlack??!1;const{animationName:t,skinName:o,loop:c}=n.defaultConfig;this.animationName=t||"none",this.skinName=o,this.loop=c}super.deserialize(i)}toJSON(){const i=this.animationName==="none"?null:this.animationName;return{type:this.type,props:O({enabled:this.enabled,priority:this.priority,resource:this.resource,premultipliedAlpha:this.premultipliedAlpha,tintBlack:this.tintBlack,defaultConfig:{animationName:i,skinName:this.skinName,loop:this.loop}})}}};p([g],s.prototype,"animationForm",2);p([g],s.prototype,"skinForm",2);p([l({label:"spine.resource.label",info:"spine.resource.info",type:f.AssetPicker,assetType:"SpineSkeletonData",onChange:async(e,i,n)=>{const t=e.engineObject;if(n){t.enabled=!0;const{skeletonData:o}=n;if(!o)return;const u=o.animations.map(r=>r.name).map(r=>({label:r,value:r}));u.unshift({label:"none",value:"none"}),e.animationForm=u,e.skinForm=o.skins.map(r=>({label:r.name,value:r.name})),e.hasInit?(e.animationName="none",e.skinName="default"):e.hasInit=!0;const{loop:d,skinName:C}=e,A=e.animationName==="none"?null:e.animationName;t.defaultConfig.animationName=A,t.defaultConfig.skinName=C,t.defaultConfig.loop=d,t.resource=new v(t.engine,o)}else t.enabled=!1,e.animationName="none",e.animationForm.length=0,e.skinForm.length=0,e.premultipliedAlpha=!1,e.tintBlack=!1}}),m()],s.prototype,"resource",2);p([l({label:"spine.loop.label",info:"spine.loop.info",type:f.Toggle,onChange(e,i,n){const{state:t}=e.engineObject;if(t){const o=t.getCurrent(0);o&&(o.loop=n)}}}),m()],s.prototype,"loop",2);p([l({info:"spine.animation.info",customComponent:R,onChange(e,i,n){const{state:t}=e.engineObject;t&&(n==="none"?t.setEmptyAnimation(0,0):t.setAnimation(0,n,e.loop))}}),m()],s.prototype,"animationName",2);p([l({info:"spine.skin.info",customComponent:T,onChange(e,i,n){const{engineObject:{skeleton:t}}=e;t&&n&&(t.setSkinByName(n),t.setSlotsToSetupPose())}}),m()],s.prototype,"skinName",2);p([l({label:"spine.priority.label",info:"spine.priority.info",type:f.Number,bindPath:"priority"}),m()],s.prototype,"priority",2);p([l({label:"spine.premultiplied-alpha.label",info:"spine.premultiplied-alpha.info",type:f.Toggle,bindPath:"premultipliedAlpha"}),m()],s.prototype,"premultipliedAlpha",2);p([l({label:"spine.tint-black.label",info:"spine.tint-black.info",type:f.Toggle,bindPath:"tintBlack"}),m()],s.prototype,"tintBlack",2);s=p([P({type:"SpineAnimationRenderer",componentsMenu:{group:"2D",label:"component.spine-animation.title"}})],s);N.registerCustomEngineComponent("SpineAnimationRenderer",B);export{s as SpineAnimationComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var I=Object.defineProperty;var j=(t,s,e)=>s in t?I(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var c=(t,s,e)=>(j(t,typeof s!="symbol"?s+"":s,e),e);import{bR as b,e as w,aH as B,u as $,S as U,aJ as q,aM as C,av as A,bS as z,x as g,aC as k,bT as V,bU as M,j as J,K,bV as W,p as L,C as X,aT as Y,m as H,n as G,q as Q,o as Z,bW as ee,bX as te}from"./index-03b6134d.js";import{b as ne,c as se,T as ie,d as ae,R as oe,M as re,B as le,P as pe,e as ce,C as ue,f as me,a as v,S as T,L as he}from"./module-5fa1eae0.js";import"./index-0a53aaef.js";import"./postmen-9e6354af.js";import{A as de}from"./AssetViewer-1a9f3cad.js";const x=new Map;function fe(t){return t??""}function ge(t){return`${t.name}|${t.size}|${t.lastModified}|${t.type}`}function ye(t,s){const{uploadAssetFile:e,assetType:n,parentFolderId:i,assetMeta:a}=s,o=i??t.currentFolderId??"",r=b(e.main,"upload.bin"),u=ge(r),l=fe(a);return`${o}|${n}|${u}|${l}`}function N(t,s){const e=ye(t,s),n=x.get(e);if(n)return n;const i=t.createAssetByUpload(s).finally(()=>{x.get(e)===i&&x.delete(e)});return x.set(e,i),i}var O=(t=>(t.region="region",t.boundingbox="boundingbox",t.mesh="mesh",t.linkedmesh="linkedmesh",t.path="path",t.point="point",t.clipping="clipping",t.sequence="sequence",t))(O||{});const Ae=["region","linkedmesh","mesh"];async function we(t,s){const e={uploadFiles:[],usedFiles:[],errors:[]},{atlasRawFiles:n,atlasFound:i}=await ke(t,e),a=await Promise.all(n.map(l=>N(s.root.assetFacade,{uploadAssetFile:l,assetType:"SpineAtlas"})));e.usedFiles.push(...n.flatMap(l=>[b(l.main,"spine.atlas"),...Object.values(l.subFiles)]));const o=await Se(t,e);o.length>0&&!i&&e.errors.push(w("spine.error.no-atlas-file"));const r=o.map(l=>(e.usedFiles.push(l.spineFile),xe(l,a,e)));let u=await Promise.all(r);return u=u.filter(l=>l!==null),e.uploadFiles.push(...u),e}async function ke(t,s){const e=[];let n=!1;for(const i in t){const a=t[i];if(a.name.endsWith(".atlas")){n=!0;const r=await Pe(t,a);if(r.length>0){const u={};r.forEach(l=>u[l.name]=l),e.push({main:a,subFiles:u})}else s.errors.push(w("spine.error.missing-images"))}}return{atlasRawFiles:e,atlasFound:n}}async function Se(t,s){const e=[];for(const n in t){const i=t[n],a=i.name,o=a.split(".")[0];if(a.endsWith(".json"))try{const r=await i.text(),u=JSON.parse(r);u.skeleton&&u.skeleton.spine&&e.push({spineFile:i,spineName:o,isBinary:!1})}catch(r){s.errors.push(P(a,r))}else a.endsWith(".skel")&&e.push({spineFile:i,spineName:o,isBinary:!0})}return e}async function xe(t,s,e){const{spineFile:n}=t,i={type:"SpineSkeletonData",atlas:{refId:null}},a={main:n,meta:null};let o;try{o=await De(t,s,e)}catch(r){return e.errors.push(r instanceof Error?r.message:P(n.name,r)),null}return s.length===0?null:o?(i.atlas.refId=o.id,a.meta=JSON.stringify(i),a):(e.errors.push(w("spine.error.missing-attachments")),null)}async function De(t,s,e){const n=await _e(t);return await Re(s,n)}async function _e(t){const{spineFile:s,isBinary:e}=t,n=new Set;if(e){const r=await s.arrayBuffer();return Fe(r,n),Array.from(n)}const i=await s.text();let a;try{a=JSON.parse(i)}catch(r){throw new Error(P(s.name,r))}return!a||!a.skins?[]:(a.skins.forEach(r=>{if(r.attachments)for(const u in r.attachments){const l=r.attachments[u];for(const y in l){const p=l[y];if(p.type){let h;const f=p.type;try{h=O[f]}catch(F){throw console.warn(w("spine.error.incompatible-version",f)),F}if(!Ae.includes(h))continue}if(p.path)n.add(p.path);else if(p.name)n.add(p.name);else if(p.sequence){const h=new ne(null).readSequence(p.sequence);if(h)for(let f=0;f<h.regions.length;++f)n.add(h.getPath(y,f));else n.add(y)}else n.add(y)}}}),Array.from(n))}function Fe(t,s){new se(new D(s)).readSkeletonData(new Uint8Array(t))}class D{constructor(s){c(this,"requiredPaths");this.requiredPaths=s}static assignDummyRegion(s){s.region=new ie(new ae("dummy"),"")}newRegionAttachment(s,e,n,i){const a=new oe(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newMeshAttachment(s,e,n,i){const a=new re(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newBoundingBoxAttachment(s,e){return new le(e)}newPathAttachment(s,e){return new pe(e)}newPointAttachment(s,e){return new ce(e)}newClippingAttachment(s,e){return new ue(e)}loadSequence(s,e){const n=e.regions;for(let i=0,a=n.length;i<a;i++){const o=e.getPath(s,i);this.requiredPaths.add(o)}}}async function Re(t,s){for(let e=0;e<t.length;e+=1){const n=t[e];if(Te(n.textureAtlas,s))return n}return null}async function Te(t,s){for(let e=0;e<s.length;e+=1){const n=s[e];if(!be(t,n))return!1}return!0}function P(t,s){const e=s instanceof Error?s.message:String(s);return`Failed to parse spine JSON "${t}": ${e}`}function be(t,s){const e=t.findRegion(s);if(e)return e;const n=s.length;for(const i of t.regions){const a=i.name;if(a.startsWith(s)&&a.substring(n).split("").every(r=>r>="0"&&r<="9"))return i}return null}async function Pe(t,s){const e=await s.text(),n=new me(e),i=[];return n.pages.forEach(a=>{const o=a.name,r=t[o];if(r)i.push(r);else return null}),i}async function Me(t,s,e){const n=b(t.main,"spine.atlas"),i=await Ce(t,e);return{main:n,meta:JSON.stringify({textures:i,type:"SpineAtlas"})}}async function Ce(t,s){const e=[];for(const p in t.subFiles){const h=t.subFiles[p];h.name.endsWith(".atlas")||e.push({main:h,type:"Texture"})}const n=[];let i=[],a;const o=s.getAssetFromCurrentFolder();(o==null?void 0:o.length)>0&&(a=o.filter(p=>p.meta.type==="Texture")),a?e.forEach(p=>{const h=a.find(f=>f.name===p.main.name);h?n.push(h.getCurrentRef()):i.push(p)}):i=e;const r=[];i.forEach(p=>{r.push(N(s.root.assetFacade,{uploadAssetFile:p,assetType:"Texture"}))});const l=(await Promise.all(r)).map(p=>p.getCurrentRef());return n.concat(l)}var ve=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,d=(t,s,e,n)=>{for(var i=n>1?void 0:n?Ne(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&ve(s,e,i),i};const Oe=B("div",{position:"absolute",top:8,left:8,display:"grid",gap:"$1",marginTop:"$1 $2",variants:{hasClips:{true:{gridTemplateColumns:"150px 18px 1fr"},false:{gridTemplateColumns:"$4_5 1fr"}}}});class m extends de{constructor(){super();c(this,"_spineAnimationRenderer");c(this,"_animationTrack");c(this,"_updateComponent");c(this,"playing",!1);c(this,"frameTime",0);c(this,"duration",0);c(this,"animationNames",[]);c(this,"skinNames",[]);c(this,"animationIndex",0);c(this,"skinIndex",0);c(this,"_size",{w:0,h:0});c(this,"overridePreviewer",q(({asset:e,viewer:n})=>{const i=e.getViewerRootEntity();return C.useEffect(()=>{this.skinIndex=0},[e]),C.useEffect(()=>{this._spineAnimationRenderer?this.updateViewAsset(e,i):this.setViewAsset(e,i)},[e.skeletonData]),A.jsxs(A.Fragment,{children:[A.jsx(z,{asset:e,viewer:n}),A.jsx(Ee,{selectedKey:this.skinIndex,clips:this.skinNames,onSelectClip:a=>{this.skinIndex=a,this.changeSkin(this.skinNames[a])}})]})}));$(this)}setViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}this.animationIndex=0,this.duration=0;const i=n.engine,a=e.skeletonData,o=n.createChild("spine-entity"),r=o.addComponent(v);this.animationNames=a.animations.map(R=>R.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(R=>R.name),this._entity=o,this._spineAnimationRenderer=r,r.resource=new T(i,a);const{width:u,height:l,x:y,y:p}=a;this._size={w:u,h:l};const h=y+u/2,f=p+l/2;o.transform.setPosition(-h/100,-f/100,0);const F=this;this._updateComponent=this._entity.addComponent(class extends U{onUpdate(){F._onUpdate()}})}updateViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}const i=n.engine,a=e.skeletonData;this.animationNames=a.animations.map(o=>o.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(o=>o.name),this._spineAnimationRenderer.resource=new T(i,a)}getSize(){return{width:this._size.w/100,height:this._size.h/100}}stopViewAsset(){var e;super.stopViewAsset(),this.playing=!1,this.frameTime=0,this.duration=0,this.animationNames=[],this.skinNames=[],this.animationIndex=0,this.skinIndex=0,this._spineAnimationRenderer&&(this._spineAnimationRenderer.enabled=!1),this._spineAnimationRenderer=null,(e=this._updateComponent)==null||e.destroy()}changeSkin(e){const{skeleton:n,state:i}=this._spineAnimationRenderer;n.setSkinByName(e),n.setSlotsToSetupPose(),i.apply(n)}selectAnimation(e){this.animationIndex=e;const n=this.animationNames[e];this.play(n)}play(e){let n;const{state:i}=this._spineAnimationRenderer;e==="none"?n=i.setEmptyAnimation(0,0):n=i.setAnimation(0,e,!0),this._animationTrack=n,this._spineAnimationRenderer.state.timeScale=1,this.playing=!0,this.duration=n.animationEnd}pauseAnimation(){this.pause()}playAnimation(){this._spineAnimationRenderer.state.timeScale=1}pause(){this._spineAnimationRenderer.state.timeScale=0,this.playing=!1}_onUpdate(){if(!this.playing)return;const e=this._animationTrack.trackTime%this.duration;this.frameTime=isNaN(e)?0:e}}d([g],m.prototype,"playing",2);d([g],m.prototype,"frameTime",2);d([g],m.prototype,"duration",2);d([g],m.prototype,"animationNames",2);d([g],m.prototype,"skinNames",2);d([g],m.prototype,"animationIndex",2);d([g],m.prototype,"skinIndex",2);d([k],m.prototype,"changeSkin",1);d([k],m.prototype,"selectAnimation",1);d([k],m.prototype,"play",1);d([k],m.prototype,"pauseAnimation",1);d([k],m.prototype,"playAnimation",1);d([k],m.prototype,"pause",1);d([k],m.prototype,"_onUpdate",1);function Ee({onSelectClip:t,clips:s,selectedKey:e}){return A.jsx(Oe,{hasClips:!!s.length,children:s.length>0&&A.jsx(V,{value:e,onValueChange:t,valueType:"number",size:"xs",sideOffset:8,children:s.map((n,i)=>n?A.jsx(M,{value:i,children:n},i):null)})})}var Ie=Object.defineProperty,je=Object.getOwnPropertyDescriptor,_=(t,s,e,n)=>{for(var i=n>1?void 0:n?je(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&Ie(s,e,i),i};let S=class extends J{constructor(s){super(s);c(this,"_delOnSkeletonDel");c(this,"_delOnAtlasDel");c(this,"_hasInit",!1);c(this,"atlas",null);c(this,"skeletonRawData","");c(this,"skeletonData")}async initByMain(s){const e=await s.text();try{JSON.parse(e),this.skeletonRawData=e}catch{this.skeletonRawData=await s.arrayBuffer()}const n=this.meta,{atlas:i}=n;this.atlas=i;const a=await this.root.assetStore.getAssetByRef(i),o=E(this.skeletonRawData,a,!0);o&&this.createDragTempEntity(o)}createDragTempEntity(s){this.skeletonData=s;const e=new K(this.engine),n=e.addComponent(v);n.resource=new T(this.engine,this.skeletonData),this.setDragTempEntity(e)}instantiate(){if(!this.skeletonData)return;const s=this.root.sceneStore.createEntity(),e=this.getDragTempEntity(),{position:n,rotation:i}=e.transform,a={components:[{class:"SpineAnimationRenderer",id:W(),props:{resource:this.getCurrentRef(),priority:0,defaultConfig:{loop:!1,animationName:"none",skinName:"default"}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"spine",position:{x:n.x,y:n.y,z:n.z},rotation:{x:i.x,y:i.y,z:i.z},scale:{x:1,y:1,z:1}};return s.initByFile(a),s}};_([L({assetType:"SpineAtlas",label:w("asset.spine-atlas.title"),type:X.AssetPicker,onChange:async(t,s,e)=>{if(t._delOnAtlasDel&&(t._delOnAtlasDel(),t._delOnAtlasDel=null),e){let n=!0;t._hasInit?n=!1:t._hasInit=!0,t.skeletonData=E(t.skeletonRawData,e,n),t.skeletonData&&t.createDragTempEntity(t.skeletonData);const i=()=>{t._delOnSkeletonDel&&t._delOnSkeletonDel(),t._delOnSkeletonDel=null,t.skeletonData=null};e.on("delete",i),t._delOnSkeletonDel=()=>{e.off("delete",i)}}else t.skeletonData=null}}),Y()],S.prototype,"atlas",2);_([H()],S.prototype,"skeletonRawData",2);_([g.ref],S.prototype,"skeletonData",2);S=_([G({type:"SpineSkeletonData",label:w("asset.spine-skeleton-data.title"),loaderType:"Spine",viewer:m,dragLayer:Q.SpineSkeletonData,dragType:"2d",filterUploadFiles:we,importMenuConfig:{type:Z.Upload,accept:".json,.atlas,.skel,.png,.jpg,.jpeg,.webp",multiple:!0},bundle(t){return t.dependencies=ee(t.meta,["atlas"]),{content:t.content}}})],S);function E(t,s,e){if(!s)return null;try{return he.createSkeletonData(t,s.textureAtlas,.01)}catch{return!e&&te.error(w("spine.error.generate-skeleton-data")),null}}const Je=Object.freeze(Object.defineProperty({__proto__:null,get SpineSkeletonDataAsset(){return S}},Symbol.toStringTag,{value:"Module"}));export{S,Je as a,Me as s};
|
|
1
|
+
var I=Object.defineProperty;var j=(t,s,e)=>s in t?I(t,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[s]=e;var c=(t,s,e)=>(j(t,typeof s!="symbol"?s+"":s,e),e);import{bR as b,e as w,aH as B,u as $,S as U,aJ as q,aM as C,av as A,bS as z,x as g,aC as k,bT as V,bU as M,j as J,K,bV as W,p as L,C as X,aT as Y,m as H,n as G,q as Q,o as Z,bW as ee,bX as te}from"./index-e44b357e.js";import{b as ne,c as se,T as ie,d as ae,R as oe,M as re,B as le,P as pe,e as ce,C as ue,f as me,a as v,S as T,L as he}from"./module-57b6e417.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";import{A as de}from"./AssetViewer-d2c63b00.js";const x=new Map;function fe(t){return t??""}function ge(t){return`${t.name}|${t.size}|${t.lastModified}|${t.type}`}function ye(t,s){const{uploadAssetFile:e,assetType:n,parentFolderId:i,assetMeta:a}=s,o=i??t.currentFolderId??"",r=b(e.main,"upload.bin"),u=ge(r),l=fe(a);return`${o}|${n}|${u}|${l}`}function N(t,s){const e=ye(t,s),n=x.get(e);if(n)return n;const i=t.createAssetByUpload(s).finally(()=>{x.get(e)===i&&x.delete(e)});return x.set(e,i),i}var O=(t=>(t.region="region",t.boundingbox="boundingbox",t.mesh="mesh",t.linkedmesh="linkedmesh",t.path="path",t.point="point",t.clipping="clipping",t.sequence="sequence",t))(O||{});const Ae=["region","linkedmesh","mesh"];async function we(t,s){const e={uploadFiles:[],usedFiles:[],errors:[]},{atlasRawFiles:n,atlasFound:i}=await ke(t,e),a=await Promise.all(n.map(l=>N(s.root.assetFacade,{uploadAssetFile:l,assetType:"SpineAtlas"})));e.usedFiles.push(...n.flatMap(l=>[b(l.main,"spine.atlas"),...Object.values(l.subFiles)]));const o=await Se(t,e);o.length>0&&!i&&e.errors.push(w("spine.error.no-atlas-file"));const r=o.map(l=>(e.usedFiles.push(l.spineFile),xe(l,a,e)));let u=await Promise.all(r);return u=u.filter(l=>l!==null),e.uploadFiles.push(...u),e}async function ke(t,s){const e=[];let n=!1;for(const i in t){const a=t[i];if(a.name.endsWith(".atlas")){n=!0;const r=await Pe(t,a);if(r.length>0){const u={};r.forEach(l=>u[l.name]=l),e.push({main:a,subFiles:u})}else s.errors.push(w("spine.error.missing-images"))}}return{atlasRawFiles:e,atlasFound:n}}async function Se(t,s){const e=[];for(const n in t){const i=t[n],a=i.name,o=a.split(".")[0];if(a.endsWith(".json"))try{const r=await i.text(),u=JSON.parse(r);u.skeleton&&u.skeleton.spine&&e.push({spineFile:i,spineName:o,isBinary:!1})}catch(r){s.errors.push(P(a,r))}else a.endsWith(".skel")&&e.push({spineFile:i,spineName:o,isBinary:!0})}return e}async function xe(t,s,e){const{spineFile:n}=t,i={type:"SpineSkeletonData",atlas:{refId:null}},a={main:n,meta:null};let o;try{o=await De(t,s,e)}catch(r){return e.errors.push(r instanceof Error?r.message:P(n.name,r)),null}return s.length===0?null:o?(i.atlas.refId=o.id,a.meta=JSON.stringify(i),a):(e.errors.push(w("spine.error.missing-attachments")),null)}async function De(t,s,e){const n=await _e(t);return await Re(s,n)}async function _e(t){const{spineFile:s,isBinary:e}=t,n=new Set;if(e){const r=await s.arrayBuffer();return Fe(r,n),Array.from(n)}const i=await s.text();let a;try{a=JSON.parse(i)}catch(r){throw new Error(P(s.name,r))}return!a||!a.skins?[]:(a.skins.forEach(r=>{if(r.attachments)for(const u in r.attachments){const l=r.attachments[u];for(const y in l){const p=l[y];if(p.type){let h;const f=p.type;try{h=O[f]}catch(F){throw console.warn(w("spine.error.incompatible-version",f)),F}if(!Ae.includes(h))continue}if(p.path)n.add(p.path);else if(p.name)n.add(p.name);else if(p.sequence){const h=new ne(null).readSequence(p.sequence);if(h)for(let f=0;f<h.regions.length;++f)n.add(h.getPath(y,f));else n.add(y)}else n.add(y)}}}),Array.from(n))}function Fe(t,s){new se(new D(s)).readSkeletonData(new Uint8Array(t))}class D{constructor(s){c(this,"requiredPaths");this.requiredPaths=s}static assignDummyRegion(s){s.region=new ie(new ae("dummy"),"")}newRegionAttachment(s,e,n,i){const a=new oe(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newMeshAttachment(s,e,n,i){const a=new re(e,"");return i?this.loadSequence(n,i):(this.requiredPaths.add(n),D.assignDummyRegion(a)),a}newBoundingBoxAttachment(s,e){return new le(e)}newPathAttachment(s,e){return new pe(e)}newPointAttachment(s,e){return new ce(e)}newClippingAttachment(s,e){return new ue(e)}loadSequence(s,e){const n=e.regions;for(let i=0,a=n.length;i<a;i++){const o=e.getPath(s,i);this.requiredPaths.add(o)}}}async function Re(t,s){for(let e=0;e<t.length;e+=1){const n=t[e];if(Te(n.textureAtlas,s))return n}return null}async function Te(t,s){for(let e=0;e<s.length;e+=1){const n=s[e];if(!be(t,n))return!1}return!0}function P(t,s){const e=s instanceof Error?s.message:String(s);return`Failed to parse spine JSON "${t}": ${e}`}function be(t,s){const e=t.findRegion(s);if(e)return e;const n=s.length;for(const i of t.regions){const a=i.name;if(a.startsWith(s)&&a.substring(n).split("").every(r=>r>="0"&&r<="9"))return i}return null}async function Pe(t,s){const e=await s.text(),n=new me(e),i=[];return n.pages.forEach(a=>{const o=a.name,r=t[o];if(r)i.push(r);else return null}),i}async function Me(t,s,e){const n=b(t.main,"spine.atlas"),i=await Ce(t,e);return{main:n,meta:JSON.stringify({textures:i,type:"SpineAtlas"})}}async function Ce(t,s){const e=[];for(const p in t.subFiles){const h=t.subFiles[p];h.name.endsWith(".atlas")||e.push({main:h,type:"Texture"})}const n=[];let i=[],a;const o=s.getAssetFromCurrentFolder();(o==null?void 0:o.length)>0&&(a=o.filter(p=>p.meta.type==="Texture")),a?e.forEach(p=>{const h=a.find(f=>f.name===p.main.name);h?n.push(h.getCurrentRef()):i.push(p)}):i=e;const r=[];i.forEach(p=>{r.push(N(s.root.assetFacade,{uploadAssetFile:p,assetType:"Texture"}))});const l=(await Promise.all(r)).map(p=>p.getCurrentRef());return n.concat(l)}var ve=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,d=(t,s,e,n)=>{for(var i=n>1?void 0:n?Ne(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&ve(s,e,i),i};const Oe=B("div",{position:"absolute",top:8,left:8,display:"grid",gap:"$1",marginTop:"$1 $2",variants:{hasClips:{true:{gridTemplateColumns:"150px 18px 1fr"},false:{gridTemplateColumns:"$4_5 1fr"}}}});class m extends de{constructor(){super();c(this,"_spineAnimationRenderer");c(this,"_animationTrack");c(this,"_updateComponent");c(this,"playing",!1);c(this,"frameTime",0);c(this,"duration",0);c(this,"animationNames",[]);c(this,"skinNames",[]);c(this,"animationIndex",0);c(this,"skinIndex",0);c(this,"_size",{w:0,h:0});c(this,"overridePreviewer",q(({asset:e,viewer:n})=>{const i=e.getViewerRootEntity();return C.useEffect(()=>{this.skinIndex=0},[e]),C.useEffect(()=>{this._spineAnimationRenderer?this.updateViewAsset(e,i):this.setViewAsset(e,i)},[e.skeletonData]),A.jsxs(A.Fragment,{children:[A.jsx(z,{asset:e,viewer:n}),A.jsx(Ee,{selectedKey:this.skinIndex,clips:this.skinNames,onSelectClip:a=>{this.skinIndex=a,this.changeSkin(this.skinNames[a])}})]})}));$(this)}setViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}this.animationIndex=0,this.duration=0;const i=n.engine,a=e.skeletonData,o=n.createChild("spine-entity"),r=o.addComponent(v);this.animationNames=a.animations.map(R=>R.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(R=>R.name),this._entity=o,this._spineAnimationRenderer=r,r.resource=new T(i,a);const{width:u,height:l,x:y,y:p}=a;this._size={w:u,h:l};const h=y+u/2,f=p+l/2;o.transform.setPosition(-h/100,-f/100,0);const F=this;this._updateComponent=this._entity.addComponent(class extends U{onUpdate(){F._onUpdate()}})}updateViewAsset(e,n){if(!e.skeletonData){this.stopViewAsset();return}const i=n.engine,a=e.skeletonData;this.animationNames=a.animations.map(o=>o.name),this.animationNames.unshift("none"),this.skinNames=a.skins.map(o=>o.name),this._spineAnimationRenderer.resource=new T(i,a)}getSize(){return{width:this._size.w/100,height:this._size.h/100}}stopViewAsset(){var e;super.stopViewAsset(),this.playing=!1,this.frameTime=0,this.duration=0,this.animationNames=[],this.skinNames=[],this.animationIndex=0,this.skinIndex=0,this._spineAnimationRenderer&&(this._spineAnimationRenderer.enabled=!1),this._spineAnimationRenderer=null,(e=this._updateComponent)==null||e.destroy()}changeSkin(e){const{skeleton:n,state:i}=this._spineAnimationRenderer;n.setSkinByName(e),n.setSlotsToSetupPose(),i.apply(n)}selectAnimation(e){this.animationIndex=e;const n=this.animationNames[e];this.play(n)}play(e){let n;const{state:i}=this._spineAnimationRenderer;e==="none"?n=i.setEmptyAnimation(0,0):n=i.setAnimation(0,e,!0),this._animationTrack=n,this._spineAnimationRenderer.state.timeScale=1,this.playing=!0,this.duration=n.animationEnd}pauseAnimation(){this.pause()}playAnimation(){this._spineAnimationRenderer.state.timeScale=1}pause(){this._spineAnimationRenderer.state.timeScale=0,this.playing=!1}_onUpdate(){if(!this.playing)return;const e=this._animationTrack.trackTime%this.duration;this.frameTime=isNaN(e)?0:e}}d([g],m.prototype,"playing",2);d([g],m.prototype,"frameTime",2);d([g],m.prototype,"duration",2);d([g],m.prototype,"animationNames",2);d([g],m.prototype,"skinNames",2);d([g],m.prototype,"animationIndex",2);d([g],m.prototype,"skinIndex",2);d([k],m.prototype,"changeSkin",1);d([k],m.prototype,"selectAnimation",1);d([k],m.prototype,"play",1);d([k],m.prototype,"pauseAnimation",1);d([k],m.prototype,"playAnimation",1);d([k],m.prototype,"pause",1);d([k],m.prototype,"_onUpdate",1);function Ee({onSelectClip:t,clips:s,selectedKey:e}){return A.jsx(Oe,{hasClips:!!s.length,children:s.length>0&&A.jsx(V,{value:e,onValueChange:t,valueType:"number",size:"xs",sideOffset:8,children:s.map((n,i)=>n?A.jsx(M,{value:i,children:n},i):null)})})}var Ie=Object.defineProperty,je=Object.getOwnPropertyDescriptor,_=(t,s,e,n)=>{for(var i=n>1?void 0:n?je(s,e):s,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(s,e,i):o(i))||i);return n&&i&&Ie(s,e,i),i};let S=class extends J{constructor(s){super(s);c(this,"_delOnSkeletonDel");c(this,"_delOnAtlasDel");c(this,"_hasInit",!1);c(this,"atlas",null);c(this,"skeletonRawData","");c(this,"skeletonData")}async initByMain(s){const e=await s.text();try{JSON.parse(e),this.skeletonRawData=e}catch{this.skeletonRawData=await s.arrayBuffer()}const n=this.meta,{atlas:i}=n;this.atlas=i;const a=await this.root.assetStore.getAssetByRef(i),o=E(this.skeletonRawData,a,!0);o&&this.createDragTempEntity(o)}createDragTempEntity(s){this.skeletonData=s;const e=new K(this.engine),n=e.addComponent(v);n.resource=new T(this.engine,this.skeletonData),this.setDragTempEntity(e)}instantiate(){if(!this.skeletonData)return;const s=this.root.sceneStore.createEntity(),e=this.getDragTempEntity(),{position:n,rotation:i}=e.transform,a={components:[{class:"SpineAnimationRenderer",id:W(),props:{resource:this.getCurrentRef(),priority:0,defaultConfig:{loop:!1,animationName:"none",skinName:"default"}}}],id:s.id,isActive:!0,isClone:!1,name:this.name?this.name:"spine",position:{x:n.x,y:n.y,z:n.z},rotation:{x:i.x,y:i.y,z:i.z},scale:{x:1,y:1,z:1}};return s.initByFile(a),s}};_([L({assetType:"SpineAtlas",label:w("asset.spine-atlas.title"),type:X.AssetPicker,onChange:async(t,s,e)=>{if(t._delOnAtlasDel&&(t._delOnAtlasDel(),t._delOnAtlasDel=null),e){let n=!0;t._hasInit?n=!1:t._hasInit=!0,t.skeletonData=E(t.skeletonRawData,e,n),t.skeletonData&&t.createDragTempEntity(t.skeletonData);const i=()=>{t._delOnSkeletonDel&&t._delOnSkeletonDel(),t._delOnSkeletonDel=null,t.skeletonData=null};e.on("delete",i),t._delOnSkeletonDel=()=>{e.off("delete",i)}}else t.skeletonData=null}}),Y()],S.prototype,"atlas",2);_([H()],S.prototype,"skeletonRawData",2);_([g.ref],S.prototype,"skeletonData",2);S=_([G({type:"SpineSkeletonData",label:w("asset.spine-skeleton-data.title"),loaderType:"Spine",viewer:m,dragLayer:Q.SpineSkeletonData,dragType:"2d",filterUploadFiles:we,importMenuConfig:{type:Z.Upload,accept:".json,.atlas,.skel,.png,.jpg,.jpeg,.webp",multiple:!0},bundle(t){return t.dependencies=ee(t.meta,["atlas"]),{content:t.content}}})],S);function E(t,s,e){if(!s)return null;try{return he.createSkeletonData(t,s.textureAtlas,.01)}catch{return!e&&te.error(w("spine.error.generate-skeleton-data")),null}}const Je=Object.freeze(Object.defineProperty({__proto__:null,get SpineSkeletonDataAsset(){return S}},Symbol.toStringTag,{value:"Module"}));export{S,Je as a,Me as s};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var c=(t,e,o)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var r=(t,e,o)=>(c(t,typeof e!="symbol"?e+"":e,o),o);import{s as m,az as h,p as g,C as b,f as u}from"./index-
|
|
1
|
+
var f=Object.defineProperty;var c=(t,e,o)=>e in t?f(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o;var r=(t,e,o)=>(c(t,typeof e!="symbol"?e+"":e,o),o);import{s as m,az as h,p as g,C as b,f as u}from"./index-e44b357e.js";import"./index-debbe073.js";import{c as d}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";import{L as P}from"./LightBaseComponent-b4854e8a.js";var y=Object.defineProperty,v=Object.getOwnPropertyDescriptor,i=(t,e,o,n)=>{for(var p=n>1?void 0:n?v(e,o):e,l=t.length-1,s;l>=0;l--)(s=t[l])&&(p=(n?s(e,o,p):s(p))||p);return n&&p&&y(e,o,p),p};let a=class extends P{constructor(e,o){super(e,o);r(this,"angle",20);r(this,"distance",60);r(this,"penumbra",60)}};i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"angle",label:"light.spot.angle.label",info:"light.spot.angle.info"}),u({getPath:"angle",getEditorValue:t=>t*180/Math.PI})],a.prototype,"angle",2);i([m(),g({type:b.Number,bindPath:"distance",label:"light.spot.distance.label",info:"light.spot.distance.info"})],a.prototype,"distance",2);i([m(h()),g({type:b.Slider,min:1,max:179,bindPath:"penumbra",label:"light.spot.penumbra.label",info:"light.spot.penumbra.info"}),u({getPath:"penumbra",getEditorValue:t=>t*180/Math.PI})],a.prototype,"penumbra",2);a=i([d({type:"SpotLight",componentsMenu:{group:"light",label:"component.light.spot.title"}})],a);export{a as SpotLightComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var f=Object.defineProperty;var y=(e,r,p)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[r]=p;var s=(e,r,p)=>(y(e,typeof r!="symbol"?r+"":r,p),p);import{p as d,C as a,s as c,aF as o,E as w}from"./index-
|
|
1
|
+
var f=Object.defineProperty;var y=(e,r,p)=>r in e?f(e,r,{enumerable:!0,configurable:!0,writable:!0,value:p}):e[r]=p;var s=(e,r,p)=>(y(e,typeof r!="symbol"?r+"":r,p),p);import{p as d,C as a,s as c,aF as o,E as w}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";var C=Object.defineProperty,P=Object.getOwnPropertyDescriptor,b=(e,r,p,i)=>{for(var t=i>1?void 0:i?P(r,p):r,l=e.length-1,n;l>=0;l--)(n=e[l])&&(t=(i?n(r,p,t):n(t))||t);return i&&t&&C(r,p,t),t};class m extends w{constructor(){super(...arguments);s(this,"sprite",null);s(this,"color",{r:1,g:1,b:1,a:1});s(this,"drawMode",o.Simple)}}b([d({label:"sprite.renderer.sprite.label",info:"sprite.renderer.sprite.info",type:a.AssetPicker,assetType:"sprite",onChange:async(e,r,p)=>{e.sprite=p?p.getCurrentRef():null,await e.applyBoundPathChange("sprite",a.AssetPicker,e.sprite),e.emit("propertychange","sprite",p)}}),c()],m.prototype,"sprite",2);b([d({bindPath:"color",label:"sprite.renderer.color.label",info:"sprite.renderer.color.info",type:a.Color}),c()],m.prototype,"color",2);b([d({label:"sprite.renderer.draw-mode.label",info:"sprite.renderer.draw-mode.info",type:a.Select,bindPath:"drawMode",value:o.Simple,options:[{label:"sprite.renderer.draw-mode.simple",value:o.Simple},{label:"sprite.renderer.draw-mode.sliced",value:o.Sliced},{label:"sprite.renderer.draw-mode.tiled",value:o.Tiled}]}),c()],m.prototype,"drawMode",2);export{m as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var u=Object.defineProperty;var b=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>(b(r,typeof e!="symbol"?e+"":e,t),t);import{E as h,aA as f,p as m,C as y,s as c,l as v,g as C}from"./index-
|
|
1
|
+
var u=Object.defineProperty;var b=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var i=(r,e,t)=>(b(r,typeof e!="symbol"?e+"":e,t),t);import{E as h,aA as f,p as m,C as y,s as c,l as v,g as C}from"./index-e44b357e.js";import"./index-debbe073.js";import{c as P}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";var g=Object.defineProperty,S=Object.getOwnPropertyDescriptor,o=(r,e,t,s)=>{for(var p=s>1?void 0:s?S(e,t):e,l=r.length-1,n;l>=0;l--)(n=r[l])&&(p=(s?n(e,t,p):n(p))||p);return s&&p&&g(e,t,p),p};let a=class extends h{constructor(e,t){super(e,t);i(this,"sprite",null);i(this,"alphaCutoff",.5);i(this,"influenceLayers",[f.Everything])}};o([m({label:"sprite.mask.sprite.label",info:"sprite.mask.sprite.info",type:y.AssetPicker,assetType:"sprite",bindPath:"sprite"}),c()],a.prototype,"sprite",2);o([m({label:"sprite.mask.alpha-cutoff.label",info:"sprite.mask.alpha-cutoff.info",dragStep:.01,min:0,max:1,type:y.Slider,bindPath:"alphaCutoff"}),c()],a.prototype,"alphaCutoff",2);o([c(v()),m({label:"sprite.mask.influence-layers.label",info:"sprite.mask.influence-layers.info",type:y.Select,...C([f.Nothing,f.Everything]),bindPath:"influenceLayers"})],a.prototype,"influenceLayers",2);a=o([P({type:"SpriteMask",componentsMenu:{group:"2D",label:"component.sprite-mask.title"}})],a);export{a as SpriteMaskComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var x=Object.defineProperty;var M=(i,t,e)=>t in i?x(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>(M(i,typeof t!="symbol"?t+"":t,e),e);import{aH as _,aI as C,aJ as N,aK as w,av as p,bj as P,aM as g,aO as y,aN as v,aB as u,aA as m,C as o,p as f,s as h,l as O,g as I,f as j}from"./index-
|
|
1
|
+
var x=Object.defineProperty;var M=(i,t,e)=>t in i?x(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e;var l=(i,t,e)=>(M(i,typeof t!="symbol"?t+"":t,e),e);import{aH as _,aI as C,aJ as N,aK as w,av as p,bj as P,aM as g,aO as y,aN as v,aB as u,aA as m,C as o,p as f,s as h,l as O,g as I,f as j}from"./index-e44b357e.js";import{u as R}from"./index-debbe073.js";import{c as B}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";import{c as b}from"./createOnModelChange-e65da908.js";import{S as H}from"./SpriteBaseComponent-3156cb3b.js";const k=_("div",{marginLeft:"5px"}),E=_(C,{border:"1px solid $gray6",borderRadius:"$2",padding:"$0_5",color:"$gray11",cursor:"pointer"}),X=N(function(i){const t=i.data,{t:e}=w();return p.jsxs(E,{align:"v",children:[t.loadingStatus==="loading"&&p.jsx(P,{size:"xs"}),t.loadingStatus==="success"&&p.jsx("img",{src:t.thumbnailUrl,alt:e("sprite.inspector.thumbnail"),width:"20px",height:"20px"}),p.jsxs(k,{children:[e("sprite.inspector.title"),"(",t.name,")"]})]})}),Y=N(function(i){const[t,e]=g.useState(null),r=i.data,{assetStore:s,inspectorFacade:n}=R();return g.useEffect(()=>{s.getAssetByRef(r.sprite).then(c=>{e(c)})},[r.sprite]),p.jsxs(p.Fragment,{children:[p.jsx(y.List,{model:r,configs:r.formSchema.items,onModelChange:b("component",r.id,n,r)}),t?p.jsx(v,{nesting:!0,title:p.jsx(X,{data:t}),defaultOpen:!1,children:p.jsx(y.List,{model:t,configs:t.formSchema.items,onModelChange:b("asset",t.id,n,t)})}):null]})});var S=Object.defineProperty,L=Object.getOwnPropertyDescriptor,W=(i,t,e)=>t in i?S(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,d=(i,t,e,r)=>{for(var s=r>1?void 0:r?L(t,e):t,n=i.length-1,c;n>=0;n--)(c=i[n])&&(s=(r?c(t,e,s):c(s))||s);return r&&s&&S(t,e,s),s},z=(i,t,e)=>(W(i,typeof t!="symbol"?t+"":t,e),e);let a=class extends H{constructor(t,e){super(t,e);l(this,"width",0);l(this,"height",0);l(this,"flip",[]);l(this,"maskInteraction",u.None);l(this,"maskLayer",[m.Everything]);l(this,"material",{refId:a._internalSpriteMaterialRefId});l(this,"priority",0);l(this,"_customWidth");l(this,"_customHeight");this.on("propertychange",(r,s)=>{if(r==="sprite"){const n=this.engineObject;isNaN(this._customWidth)?this.width=n.width:(this.width=this._customWidth,this.applyBoundPathChange("width",o.Number,this._customWidth)),isNaN(this._customHeight)?this.height=n.height:(this.height=this._customHeight,this.applyBoundPathChange("height",o.Number,this._customHeight))}})}async applyBoundPathChange(t,e,r){if(t==="flip"){const s=Array.isArray(r)?r:[];await super.applyBoundPathChange("flipX",o.Toggle,s.includes("flipX")),await super.applyBoundPathChange("flipY",o.Toggle,s.includes("flipY"));return}await super.applyBoundPathChange(t,e,r)}deserializeByEngineObject(t){var r;super.deserializeByEngineObject(t);const e=[];t.flipX&&e.push("flipX"),t.flipY&&e.push("flipY"),this.flip=e,(r=this._originValueMap)==null||r.set("flip",[...e])}deserialize(t){super.deserialize(t);const{props:e}=t;e!=null&&e.flipX&&this.flip.push("flipX"),e!=null&&e.flipY&&this.flip.push("flipY"),isNaN(e==null?void 0:e.width)||(this._customWidth=e.width),isNaN(e==null?void 0:e.height)||(this._customHeight=e.height)}toJSON(){const t=super.toJSON(),e=this.flip;return e&&(t.props.flipX=e.indexOf("flipX")!==-1,t.props.flipY=e.indexOf("flipY")!==-1),isNaN(this._customWidth)||(t.props.width=this._customWidth),isNaN(this._customHeight)||(t.props.height=this._customHeight),t}};z(a,"_internalSpriteMaterialRefId","0000203");d([f({label:"sprite.renderer.width.label",info:"sprite.renderer.width.info",type:o.Number,bindPath:"width",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customWidth=e)}}),h()],a.prototype,"width",2);d([f({label:"sprite.renderer.height.label",info:"sprite.renderer.height.info",type:o.Number,bindPath:"height",triggerAfterInit:!1,onChange(i,t,e){isNaN(e)||(i._customHeight=e)}}),h()],a.prototype,"height",2);d([f({label:"sprite.renderer.flip.label",info:"sprite.renderer.flip.info",type:o.ToggleGroup,bindPath:"flip",multiple:!0,options:[{label:"sprite.renderer.flip.x",value:"flipX"},{label:"sprite.renderer.flip.y",value:"flipY"}]}),h()],a.prototype,"flip",2);d([f({label:"sprite.renderer.mask-interaction.label",info:"sprite.renderer.mask-interaction.info",type:o.Select,bindPath:"maskInteraction",value:u.None,options:[{label:"sprite.renderer.mask-interaction.none",value:u.None},{label:"sprite.renderer.mask-interaction.visible-inside",value:u.VisibleInsideMask},{label:"sprite.renderer.mask-interaction.visible-outside",value:u.VisibleOutsideMask}]}),h()],a.prototype,"maskInteraction",2);d([h(O()),f({label:"sprite.renderer.mask-layer.label",info:"sprite.renderer.mask-layer.info",type:o.Select,...I([m.Nothing,m.Everything]),bindPath:"maskLayer"}),h()],a.prototype,"maskLayer",2);d([f({label:"sprite.renderer.material.label",info:"sprite.renderer.material.info",type:o.AssetPicker,assetType:"Material",customFilter:i=>{var t;return((t=i.engineObject.shader)==null?void 0:t.name)!=="Effect/Particle"},onChange:async(i,t,e)=>{const{material:r}=i,s=i.engineObject;if(!r){s.setMaterial(null);return}const{refId:n}=r;n===a._internalSpriteMaterialRefId?s.setMaterial(s.engine._basicResources.spriteDefaultMaterial):e?i.engineObject.setMaterial(e.engineObject):console.error(`Material asset not found: ${r.refId}`)}}),j({engineKey:"setMaterial",getEngineValue:i=>i.getMaterial()}),h()],a.prototype,"material",2);d([f({label:"sprite.renderer.priority.label",info:"sprite.renderer.priority.info",type:o.Number,bindPath:"priority"}),h()],a.prototype,"priority",2);a=d([B({type:"SpriteRenderer",componentsMenu:{group:"2D",label:"component.renderer.sprite.title"},customInspector:Y})],a);export{a as SpriteRendererComponent};
|
package/dist/preview-client/_static/{TextBaseComponent-7d2db29c.js → TextBaseComponent-520dea39.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var m=Object.defineProperty;var w=(e,n,t)=>n in e?m(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>(w(e,typeof n!="symbol"?n+"":n,t),t);import{ch as h,av as o,ci as g,p as c,C as i,s as f,cj as s,f as v,aE as y,bL as b,ck as d,e as C,E as A}from"./index-
|
|
1
|
+
var m=Object.defineProperty;var w=(e,n,t)=>n in e?m(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>(w(e,typeof n!="symbol"?n+"":n,t),t);import{ch as h,av as o,ci as g,p as c,C as i,s as f,cj as s,f as v,aE as y,bL as b,ck as d,e as C,E as A}from"./index-e44b357e.js";import"./index-debbe073.js";import"./postmen-443b3e5f.js";import{c as u}from"./createReactComponent-cb70ea50.js";/**
|
|
2
2
|
* @license @tabler/icons-react v3.24.0 - MIT
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the MIT license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var c=Object.defineProperty;var x=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>(x(r,typeof e!="symbol"?e+"":e,t),t);import{aB as l,aA as h,p,C as s,s as m,g as f,l as u}from"./index-
|
|
1
|
+
var c=Object.defineProperty;var x=(r,e,t)=>e in r?c(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>(x(r,typeof e!="symbol"?e+"":e,t),t);import{aB as l,aA as h,p,C as s,s as m,g as f,l as u}from"./index-e44b357e.js";import"./index-debbe073.js";import{c as v}from"./Component-b95aa2af.js";import"./postmen-443b3e5f.js";import{T as k}from"./TextBaseComponent-520dea39.js";import"./createReactComponent-cb70ea50.js";var g=Object.defineProperty,P=Object.getOwnPropertyDescriptor,o=(r,e,t,d)=>{for(var i=d>1?void 0:d?P(e,t):e,b=r.length-1,y;b>=0;b--)(y=r[b])&&(i=(d?y(e,t,i):y(i))||i);return d&&i&&g(e,t,i),i};let n=class extends k{constructor(e,t){super(e,t);a(this,"width",0);a(this,"height",0);a(this,"maskInteraction",l.None);a(this,"maskLayer",[h.Layer0]);a(this,"priority",0)}};o([p({label:"text-renderer.width.label",info:"text-renderer.width.info",type:s.Number,bindPath:"width"}),m()],n.prototype,"width",2);o([p({label:"text-renderer.height.label",info:"text-renderer.height.info",type:s.Number,bindPath:"height"}),m()],n.prototype,"height",2);o([p({label:"text-renderer.mask-interaction.label",info:"text-renderer.mask-interaction.info",type:s.Select,bindPath:"maskInteraction",value:l.None,options:[{label:"text-renderer.mask-interaction.none",value:l.None},{label:"text-renderer.mask-interaction.visible-inside",value:l.VisibleInsideMask},{label:"text-renderer.mask-interaction.visible-outside",value:l.VisibleOutsideMask}]}),m()],n.prototype,"maskInteraction",2);o([p({label:"text-renderer.mask-layer.label",info:"text-renderer.mask-layer.info",type:s.Select,bindPath:"maskLayer",...f([h.Nothing,h.Everything])}),m(u())],n.prototype,"maskLayer",2);o([p({label:"text-renderer.priority.label",info:"text-renderer.priority.info",type:s.Number,bindPath:"priority"}),m()],n.prototype,"priority",2);n=o([v({type:"TextRenderer",componentsMenu:{group:"2D",label:"component.text-renderer.title"}})],n);export{n as TextRendererComponent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var me=Object.defineProperty;var fe=(n,e,t)=>e in n?me(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var v=(n,e,t)=>(fe(n,typeof e!="symbol"?e+"":e,t),t);import{ae as V,b1 as Y,N as J,$ as Z,y as Q,bD as ee,ah as te,aJ as q,aK as be,av as w,bk as ne,aI as N,ay as H,bz as ye,cm as ge,aN as we,e as P,dr as xe,aM as ve,aO as Me,K as Se,j as Ce,ad as I,T as S,p as A,C as j,aT as T,x as _e,n as Re,o as Te,bR as De,b3 as Oe,q as Be,a_ as K,a$ as ie,ey as Ae,ez as ae,eA as je}from"./index-
|
|
1
|
+
var me=Object.defineProperty;var fe=(n,e,t)=>e in n?me(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var v=(n,e,t)=>(fe(n,typeof e!="symbol"?e+"":e,t),t);import{ae as V,b1 as Y,N as J,$ as Z,y as Q,bD as ee,ah as te,aJ as q,aK as be,av as w,bk as ne,aI as N,ay as H,bz as ye,cm as ge,aN as we,e as P,dr as xe,aM as ve,aO as Me,K as Se,j as Ce,ad as I,T as S,p as A,C as j,aT as T,x as _e,n as Re,o as Te,bR as De,b3 as Oe,q as Be,a_ as K,a$ as ie,ey as Ae,ez as ae,eA as je}from"./index-e44b357e.js";import{k,H as re}from"./ktx2-encoder-522fc017.js";import{u as Ee}from"./index-debbe073.js";import"./postmen-443b3e5f.js";import{e as se}from"./encode-ac4bb64e.js";import"./meshopt_simplifier.module-cd99529d.js";import{T as Ie}from"./Tooltip-71e5a4e7.js";import{c as Ue}from"./createReactComponent-cb70ea50.js";import{A as Pe}from"./AssetViewer-d2c63b00.js";const X=function(n,e,t){return n>=t?t:n<=e?e:n};function Le(n,e,t,i,a){const r=new Uint8Array(n);i=X(i,0,255),a=X(a,0,255);const s=(d,p)=>(p*e+d)*4,c=[[-1,0],[1,0],[0,-1],[0,1]],o=[];for(let d=0;d<t;d++)for(let p=0;p<e;p++)if(r[s(p,d)+3]!==0)for(const[y,b]of c){const h=p+y,m=d+b;if(h>=0&&h<e&&m>=0&&m<t&&r[s(h,m)+3]===0){o.push([p,d]);break}}const l=new Set,u=[];for(;o.length>0;){const d=[];for(const[p,y]of o)for(const[b,h]of c){const m=p+b,f=y+h;if(m<0||m>=e||f<0||f>=t)continue;const x=s(m,f);if(r[x+3]>i)continue;const g=f*e+m;if(l.has(g))continue;l.add(g);const C=s(p,y);r[x]=r[C],r[x+1]=r[C+1],r[x+2]=r[C+2],r[x+3]=255,d.push([m,f]),u.push(x)}o.length=0;for(let p=0;p<d.length;p++)o.push(d[p])}for(const d of u)r[d+3]=a;return r}function L(n){const e=n instanceof Uint8Array?n:new Uint8Array(n);return e[0]===35&&e[1]===63}function z(n,e){const t=new Float32Array(1),i=new Uint32Array(t.buffer);for(let a=0;a<n.length;a++){t[0]=n[a];const r=i[0],s=r>>16&32768,c=(r>>23&255)-127+15,o=r&8388607;c<=0?e[a]=s:c>=31?e[a]=s|31744:e[a]=s|c<<10|o>>13}}function F(n){const e=Ge(n),{width:t,height:i,dataPosition:a}=e,r=He(n.subarray(a),t,i),s=Fe(r,t,i);return{width:t,height:i,pixels:s}}function Fe(n,e,t){const i=e*t,a=new Float32Array(i*4);for(let r=0;r<i;r++){const s=r*4,c=r*4,o=Math.pow(2,n[s+3]-128-8);a[c]=Math.min(n[s]*o,65504),a[c+1]=Math.min(n[s+1]*o,65504),a[c+2]=Math.min(n[s+2]*o,65504),a[c+3]=1}return a}function Ge(n){let e=$(n,0);if(e[0]!=="#"||e[1]!=="?")throw new Error("HDR: invalid header");let t=0,i=!1,a=!1;do t+=e.length+1,e=$(n,t),e==="FORMAT=32-bit_rle_rgbe"?i=!0:e.length===0&&(a=!0);while(!a);if(!i)throw new Error("HDR: unsupported format");t+=e.length+1,e=$(n,t);const r=/^\-Y (.*) \+X (.*)$/g.exec(e);if(!r||r.length<3)throw new Error("HDR: missing size");return{width:parseInt(r[2]),height:parseInt(r[1]),dataPosition:t+e.length+1}}function He(n,e,t){const i=n.byteLength,a=new Uint8Array(4*e*t);let r=0,s=0;const c=4*e,o=new Uint8Array(c);let l=t;for(;l>0&&s<i;){const u=n[s++],d=n[s++],p=n[s++],y=n[s++];if(u!==2||d!==2||p&128||e<8||e>32767)return n;if((p<<8|y)!==e)throw new Error("HDR: wrong scanline width");let b=0;for(;b<c&&s<i;){let h=n[s++];const m=h>128;if(m&&(h-=128),h===0||b+h>c)throw new Error("HDR: bad scanline");if(m){const f=n[s++];for(let x=0;x<h;x++)o[b++]=f}else o.set(n.subarray(s,s+h),b),b+=h,s+=h}for(let h=0;h<e;h++,r+=4)a[r]=o[h],a[r+1]=o[h+e],a[r+2]=o[h+e*2],a[r+3]=o[h+e*3];l--}return a}function $(n,e){let t="";for(let i=e;i<n.length;i++){const a=String.fromCharCode(n[i]);if(a===`
|
|
2
2
|
`)break;t+=a}return t}function Ve(n,e,t){if(n.length!==e*t*4)throw new Error(`HDREncoder: pixel count mismatch (expected ${e*t*4}, got ${n.length})`);const i=ke(e,t),a=ze(n,e,t),r=new Uint8Array(i.length+a.length);return r.set(i,0),r.set(a,i.length),r.buffer}function ke(n,e){const t=`#?RADIANCE
|
|
3
3
|
# Written by Galacean HDREncoder
|
|
4
4
|
FORMAT=32-bit_rle_rgbe
|