@fleox/agent3d 0.4.0 → 0.5.0
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/README.md +16 -14
- package/changelog.json +15 -0
- package/dist/agent/agent3d.mjs +779 -85
- package/dist/agent/chunks/{assets-YBkgdfgy.mjs → assets-DdzHgVcn.mjs} +2 -2
- package/dist/agent/chunks/{browser-Dil7VM5m.mjs → browser-nFaRUETt.mjs} +1 -1
- package/dist/agent/chunks/{cdp-DLEis_Z3.mjs → cdp-6vF_gP-H.mjs} +1 -1
- package/dist/agent/chunks/{check-DP9fRYbK.mjs → check-E7GdPxTt.mjs} +14 -2
- package/dist/agent/chunks/{depth-CD_ql3QJ.mjs → depth-Bf7cHwod.mjs} +4 -4
- package/dist/agent/chunks/{depth-BZT4gseQ.mjs → depth-DEaogEAi.mjs} +4 -114
- package/dist/agent/chunks/{export-CEX5DFLo.mjs → export-BSOqVfPT.mjs} +8 -4
- package/dist/agent/chunks/{imageCodec-DeGfmBp3.mjs → imageCodec-DXxqkEQA.mjs} +53 -4
- package/dist/agent/chunks/{objects-DuytRxiC.mjs → objects-DvzrcVmK.mjs} +2 -2
- package/dist/agent/chunks/{optimizeSizing-B-BBiUkD.mjs → optimizeSizing-Dd8vaSnE.mjs} +24 -1
- package/dist/agent/chunks/{package-DjRnLzcU.mjs → package-DzXqX5Oe.mjs} +1 -1
- package/dist/agent/chunks/photoPlacement-D-k3mD0T.mjs +138 -0
- package/dist/agent/chunks/plate-Cwl35I2T.mjs +604 -0
- package/dist/agent/chunks/pngEncode-BMc3U9QC.mjs +119 -0
- package/dist/agent/chunks/{render-B05DU4Q5.mjs → render-CCKciCgu.mjs} +76 -11
- package/dist/agent/chunks/{scene-DWgXH6As.mjs → scene-DSjsun-3.mjs} +22 -5
- package/dist/agent/chunks/{server-Dt_YFvN7.mjs → server-CLvLORgA.mjs} +1 -1
- package/dist/agent/chunks/{tools-CZyIc4zw.mjs → tools-Vs74Xopx.mjs} +142 -13
- package/dist/runtime/agent3d-photo.js +51 -10
- package/dist/runtime/agent3d-runtime.js +23 -23
- package/dist/runtime/agent3d-runtime.single.js +405 -134
- package/dist/runtime/chunks/photo-Dq-AKlfw.js +526 -0
- package/dist/studio/assets/BufferGeometryUtils-BbzK4rCj.js +1 -0
- package/dist/studio/assets/{EXRLoader-BKkzlNd8.js → EXRLoader-CuDOo1xG.js} +1 -1
- package/dist/studio/assets/{FontLoader-Bzjx8mXt.js → FontLoader-DlBfss5q.js} +1 -1
- package/dist/studio/assets/{GLTFLoader-1Zd9N406.js → GLTFLoader-bl1eymL4.js} +1 -1
- package/dist/studio/assets/{GroundedSkybox-BEMqNCBD.js → GroundedSkybox-cLn9JVlt.js} +1 -1
- package/dist/studio/assets/{HDRLoader-DxB0kxPH.js → HDRLoader-8EiZoQQP.js} +1 -1
- package/dist/studio/assets/{OrbitControls-MlE9XiCg.js → OrbitControls-1xEm394I.js} +1 -1
- package/dist/studio/assets/{RectAreaLightUniformsLib-ClHrtYY6.js → RectAreaLightUniformsLib-S0AelTmO.js} +1 -1
- package/dist/studio/assets/{RoomEnvironment-MJ-jIEC8.js → RoomEnvironment-v4QurKxu.js} +1 -1
- package/dist/studio/assets/{SVGLoader-CIYl0nEy.js → SVGLoader-KDBVv02P.js} +1 -1
- package/dist/studio/assets/{Sky-DNMfpp92.js → Sky-D8Lp9Zh3.js} +1 -1
- package/dist/studio/assets/assets-DnOt59SU.js +2 -0
- package/dist/studio/assets/camera-DrubOxWu.js +2 -0
- package/dist/studio/assets/catalog-DDg904x2.js +1 -0
- package/dist/studio/assets/{editor-DzyukvQl.js → editor-V--luWVq.js} +1 -1
- package/dist/studio/assets/{extrude-9bG8hr2C.js → extrude-BpJda0hq.js} +1 -1
- package/dist/studio/assets/game-43BhY_EE.js +19 -0
- package/dist/studio/assets/{generators-BuVeRXnC.js → generators-lG93qWTO.js} +1 -1
- package/dist/studio/assets/index-BPVRhKVV.js +479 -0
- package/dist/studio/assets/index-D-TPNQMQ.css +1 -0
- package/dist/studio/assets/model-D8-inS_D.js +2 -0
- package/dist/studio/assets/params-BZqUA__U.js +1 -0
- package/dist/studio/assets/photo-BuVK-UvQ.js +526 -0
- package/dist/studio/assets/{physicsHost-z9qn_mpg.js → physicsHost-EkPuIy04.js} +1 -1
- package/dist/studio/assets/{postfx-B3jDEaEK.js → postfx-Bcnem9ci.js} +2 -2
- package/dist/studio/assets/rolldown-runtime-4tVxZq34.js +1 -0
- package/dist/studio/assets/runtime-5Ti8UJJR.js +572 -0
- package/dist/studio/assets/{shaders-bFhELLmD.js → shaders-WM5brr9C.js} +1 -1
- package/dist/studio/assets/svg-CJ_RtiER.js +2 -0
- package/dist/studio/assets/text-NO7lyCoH.js +3 -0
- package/dist/studio/assets/three.module-B9FlcKtd.js +4225 -0
- package/dist/studio/index.html +5 -3
- package/package.json +1 -1
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agent3d-assets/SKILL.md +42 -27
- package/plugin/skills/agent3d-create/SKILL.md +77 -29
- package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
- package/plugin/skills/agent3d-create/references/recipes.md +6 -6
- package/plugin/skills/agent3d-edit/SKILL.md +22 -22
- package/plugin/skills/agent3d-edit/references/patch-ops.md +3 -3
- package/plugin/skills/agent3d-game/SKILL.md +7 -7
- package/plugin/skills/agent3d-publish/SKILL.md +30 -23
- package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
- package/templates/hero-scroll-story/README.md +1 -1
- package/templates/photo-scroll-story/README.md +29 -0
- package/templates/photo-scroll-story/agent3d.json +8 -0
- package/templates/photo-scroll-story/assets/depth/lake-depth.png +0 -0
- package/templates/photo-scroll-story/assets/depth/street-depth.png +0 -0
- package/templates/photo-scroll-story/assets/manifest.json +46 -0
- package/templates/photo-scroll-story/assets/textures/lake.webp +0 -0
- package/templates/photo-scroll-story/assets/textures/street.webp +0 -0
- package/templates/photo-scroll-story/preview.png +0 -0
- package/templates/photo-scroll-story/scene.json +112 -0
- package/templates/photo-scroll-story/template.json +8 -0
- package/templates/photo-title-inside/README.md +31 -0
- package/templates/photo-title-inside/agent3d.json +8 -0
- package/templates/photo-title-inside/assets/depth/street-depth.png +0 -0
- package/templates/photo-title-inside/assets/manifest.json +25 -0
- package/templates/photo-title-inside/assets/textures/street.webp +0 -0
- package/templates/photo-title-inside/preview.png +0 -0
- package/templates/photo-title-inside/scene.json +80 -0
- package/templates/photo-title-inside/template.json +8 -0
- package/dist/runtime/chunks/photo-w6dwHX7j.js +0 -255
- package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +0 -1
- package/dist/studio/assets/assets--ehPZf8R.js +0 -1
- package/dist/studio/assets/camera-C0sxfRxy.js +0 -2
- package/dist/studio/assets/game-DNpTN_Ga.js +0 -19
- package/dist/studio/assets/index-BQT0otii.css +0 -1
- package/dist/studio/assets/index-C2nMYSoW.js +0 -479
- package/dist/studio/assets/model-DQgOrTs4.js +0 -2
- package/dist/studio/assets/params-D-Ul6GSt.js +0 -1
- package/dist/studio/assets/photo-Dx2IBJ11.js +0 -255
- package/dist/studio/assets/runtime-rd9RW3WH.js +0 -572
- package/dist/studio/assets/svg-BkV9LeqP.js +0 -2
- package/dist/studio/assets/text-Dp8gdjSA.js +0 -3
- package/dist/studio/assets/three.module-CnI50X0U.js +0 -4225
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ot as e,Pt as t,Vt as n,Y as r,an as i,p as a,wt as o,xt as s}from"./three.module-
|
|
1
|
+
import{Ot as e,Pt as t,Vt as n,Y as r,an as i,p as a,wt as o,xt as s}from"./three.module-B9FlcKtd.js";var c=class extends i{constructor(){super(),this.name=`RoomEnvironment`,this.position.y=-3.5;let i=new a;i.deleteAttribute(`uv`);let o=new e({side:1}),c=new e,u=new n(16777215,900,28,2);u.position.set(.418,16.199,.3),this.add(u);let d=new s(i,o);d.position.set(-.757,13.219,.717),d.scale.set(31.713,28.305,28.591),this.add(d);let f=new r(i,c,6),p=new t;p.position.set(-10.906,2.009,1.846),p.rotation.set(0,-.195,0),p.scale.set(2.328,7.905,4.651),p.updateMatrix(),f.setMatrixAt(0,p.matrix),p.position.set(-5.607,-.754,-.758),p.rotation.set(0,.994,0),p.scale.set(1.97,1.534,3.955),p.updateMatrix(),f.setMatrixAt(1,p.matrix),p.position.set(6.167,.857,7.803),p.rotation.set(0,.561,0),p.scale.set(3.927,6.285,3.687),p.updateMatrix(),f.setMatrixAt(2,p.matrix),p.position.set(-2.017,.018,6.124),p.rotation.set(0,.333,0),p.scale.set(2.002,4.566,2.064),p.updateMatrix(),f.setMatrixAt(3,p.matrix),p.position.set(2.291,-.756,-2.621),p.rotation.set(0,-.286,0),p.scale.set(1.546,1.552,1.496),p.updateMatrix(),f.setMatrixAt(4,p.matrix),p.position.set(-2.193,-.369,-5.547),p.rotation.set(0,.516,0),p.scale.set(3.875,3.487,2.986),p.updateMatrix(),f.setMatrixAt(5,p.matrix),this.add(f);let m=new s(i,l(50));m.position.set(-16.116,14.37,8.208),m.scale.set(.1,2.428,2.739),this.add(m);let h=new s(i,l(50));h.position.set(-16.109,18.021,-8.207),h.scale.set(.1,2.425,2.751),this.add(h);let g=new s(i,l(17));g.position.set(14.904,12.198,-1.832),g.scale.set(.15,4.265,6.331),this.add(g);let _=new s(i,l(43));_.position.set(-.462,8.89,14.52),_.scale.set(4.38,5.441,.088),this.add(_);let v=new s(i,l(20));v.position.set(3.235,11.486,-12.541),v.scale.set(2.5,2,.1),this.add(v);let y=new s(i,l(100));y.position.set(0,20,0),y.scale.set(1,.1,1),this.add(y)}dispose(){let e=new Set;this.traverse(t=>{t.isMesh&&(e.add(t.geometry),e.add(t.material))});for(let t of e)t.dispose()}};function l(e){return new o({color:0,emissive:16777215,emissiveIntensity:e})}export{c as RoomEnvironment};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,I as t,In as n,Ln as r,Lt as i,St as a,b as o,dn as s,ft as c,g as l,h as u,kt as d,rn as f,tn as p,u as m,un as h,x as g,yt as _}from"./three.module-CnI50X0U.js";var v=f,y=class o extends c{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(t,n,r,i){let a=this,o=new e(a.manager);o.setPriority(a.priority),o.setCache(a.cache),o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(e){let t=this;function a(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let n=E(e),r=!1,i=null;switch(e.nodeName){case`svg`:t=b(e,t);break;case`style`:s(e);break;case`g`:t=b(e,t);break;case`path`:t=b(e,t),e.hasAttribute(`d`)&&(i=o(e));break;case`rect`:t=b(e,t),i=u(e);break;case`polygon`:t=b(e,t),i=d(e);break;case`polyline`:t=b(e,t),i=f(e);break;case`circle`:t=b(e,t),i=p(e);break;case`ellipse`:t=b(e,t),i=m(e);break;case`line`:t=b(e,t),i=g(e);break;case`defs`:r=!0;break;case`use`:t=b(e,t);let n=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),c=e.viewportElement.getElementById(n);c?a(c,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+n)}if(i){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&i.color.setStyle(t.fill,v),k(i,K),I.push(i);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*P(K),i.userData={node:e,style:n,transform:K.clone(),gradients:R}}let c=e.childNodes;for(let e=0;e<c.length;e++){let n=c[e];r&&n.nodeName!==`style`&&n.nodeName!==`defs`||a(n,t)}n&&(z.pop(),z.length>0?K.copy(z[z.length-1]):K.identity())}function o(e){let t=new h,r=new n,i=new n,a=new n,o=!1,s=e.getAttribute(`d`);if(s===``||s===`none`)return null;let l=s.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,n=l.length;e<n;e++){let n=l[e],s=n.charAt(0),u=n.slice(1).trim();o===!0&&(s!==`M`&&s!==`m`&&s!==`Z`&&s!==`z`&&t.moveTo(a.x,a.y),o=!1);let d;switch(s){case`M`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x=d[e+0],r.y=d[e+1],i.x=r.x,i.y=r.y,e===0?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),e===0&&a.copy(r);break;case`H`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.x=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`V`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.y=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`L`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x=d[e+0],r.y=d[e+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`C`:d=S(u);for(let e=0,n=d.length;e<n;e+=6)t.bezierCurveTo(d[e+0],d[e+1],d[e+2],d[e+3],d[e+4],d[e+5]),i.x=d[e+2],i.y=d[e+3],r.x=d[e+4],r.y=d[e+5];break;case`S`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.bezierCurveTo(x(r.x,i.x),x(r.y,i.y),d[e+0],d[e+1],d[e+2],d[e+3]),i.x=d[e+0],i.y=d[e+1],r.x=d[e+2],r.y=d[e+3];break;case`Q`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.quadraticCurveTo(d[e+0],d[e+1],d[e+2],d[e+3]),i.x=d[e+0],i.y=d[e+1],r.x=d[e+2],r.y=d[e+3];break;case`T`:d=S(u);for(let e=0,n=d.length;e<n;e+=2){let n=x(r.x,i.x),a=x(r.y,i.y);t.quadraticCurveTo(n,a,d[e+0],d[e+1]),i.x=n,i.y=a,r.x=d[e+0],r.y=d[e+1]}break;case`A`:d=S(u,[3,4],7);for(let e=0,n=d.length;e<n;e+=7){if(d[e+5]==r.x&&d[e+6]==r.y)continue;let n=r.clone();r.x=d[e+5],r.y=d[e+6],i.x=r.x,i.y=r.y,c(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],n,r)}break;case`m`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x+=d[e+0],r.y+=d[e+1],i.x=r.x,i.y=r.y,e===0?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),e===0&&a.copy(r);break;case`h`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.x+=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`v`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.y+=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`l`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x+=d[e+0],r.y+=d[e+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`c`:d=S(u);for(let e=0,n=d.length;e<n;e+=6)t.bezierCurveTo(r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3],r.x+d[e+4],r.y+d[e+5]),i.x=r.x+d[e+2],i.y=r.y+d[e+3],r.x+=d[e+4],r.y+=d[e+5];break;case`s`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.bezierCurveTo(x(r.x,i.x),x(r.y,i.y),r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3]),i.x=r.x+d[e+0],i.y=r.y+d[e+1],r.x+=d[e+2],r.y+=d[e+3];break;case`q`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.quadraticCurveTo(r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3]),i.x=r.x+d[e+0],i.y=r.y+d[e+1],r.x+=d[e+2],r.y+=d[e+3];break;case`t`:d=S(u);for(let e=0,n=d.length;e<n;e+=2){let n=x(r.x,i.x),a=x(r.y,i.y);t.quadraticCurveTo(n,a,r.x+d[e+0],r.y+d[e+1]),i.x=n,i.y=a,r.x+=d[e+0],r.y+=d[e+1]}break;case`a`:d=S(u,[3,4],7);for(let e=0,n=d.length;e<n;e+=7){if(d[e+5]==0&&d[e+6]==0)continue;let n=r.clone();r.x+=d[e+5],r.y+=d[e+6],i.x=r.x,i.y=r.y,c(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],n,r)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(r.copy(a),t.currentPath.currentPoint.copy(r),o=!0);break;default:console.warn(n)}}return t}function s(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim()),i={};for(let e=0;e<n.style.length;e++){let t=n.style[e];i[t]=n.style.getPropertyValue(t)}for(let e=0;e<r.length;e++)L[r[e]]=Object.assign(L[r[e]]||{},i)}}function c(e,t,n,r,i,a,o,s){if(t==0||n==0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,u=(o.y-s.y)/2,d=Math.cos(r)*c+Math.sin(r)*u,f=-Math.sin(r)*c+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(o.x+s.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(o.y+s.y)/2,T=l(1,0,(d-x)/t,(f-S)/n),E=l((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function l(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function u(e){let t=T(e.getAttribute(`x`)||0),n=T(e.getAttribute(`y`)||0),r=T(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=T(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=T(e.getAttribute(`width`)),o=T(e.getAttribute(`height`)),s=.448084975506,c=new h;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function d(e){function t(e,t,n){let a=T(t),o=T(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new h,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function f(e){function t(e,t,n){let a=T(t),o=T(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new h,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function p(e){let t=T(e.getAttribute(`cx`)||0),n=T(e.getAttribute(`cy`)||0),r=T(e.getAttribute(`r`)||0),a=new i;a.absarc(t,n,r,0,Math.PI*2);let o=new h;return o.subPaths.push(a),o}function m(e){let t=T(e.getAttribute(`cx`)||0),n=T(e.getAttribute(`cy`)||0),r=T(e.getAttribute(`rx`)||0),a=T(e.getAttribute(`ry`)||0),o=new i;o.absellipse(t,n,r,a,0,Math.PI*2);let s=new h;return s.subPaths.push(o),s}function g(e){let t=T(e.getAttribute(`x1`)||0),n=T(e.getAttribute(`y1`)||0),r=T(e.getAttribute(`x2`)||0),i=T(e.getAttribute(`y2`)||0),a=new h;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function y(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new _,O(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:T(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}R[e]=a}}function b(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,L[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,L[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[r]&&(t[i]=a(n[r])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,T(e)))}function a(e){return Math.max(0,T(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function x(e,t){return e-(t-e)}function S(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let C=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],w={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function T(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=C.length;t<r;t++){let r=C[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=w.in[t.defaultUnit]/t.defaultDPI:(r=w[n][t.defaultUnit],r<0&&(r=w[n].in*t.defaultDPI)),r*parseFloat(e)}function E(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=D(e);return z.length>0&&t.premultiply(z[z.length-1]),K.copy(t),z.push(t),t}function D(e){let t=new _;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=T(e.getAttribute(`x`)||0),r=T(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&O(e.getAttribute(`transform`),t),t}function O(e,t){let n=B,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=S(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),V.makeTranslation(-t,-i),H.makeRotation(e),U.multiplyMatrices(H,V),V.makeTranslation(t,i),n.multiplyMatrices(V,U)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function k(e,t){function n(e){G.set(e.x,e.y,1).applyMatrix3(t),e.set(G.x,G.y)}function i(e){let n=e.xRadius,i=e.yRadius,a=Math.cos(e.aRotation),o=Math.sin(e.aRotation),s=new r(n*a,n*o,0),c=new r(-i*o,i*a,0),l=s.applyMatrix3(t),u=c.applyMatrix3(t),d=B.set(l.x,u.x,0,l.y,u.y,0,0,0,1),f=V.copy(d).invert(),p=H.copy(f).transpose().multiply(f).elements,m=F(p[0],p[1],p[4]),h=Math.sqrt(m.rt1),g=Math.sqrt(m.rt2);if(e.xRadius=1/h,e.yRadius=1/g,e.aRotation=Math.atan2(m.sn,m.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=V.set(h,0,0,0,g,0,0,0,1),i=H.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),a=n.multiply(i).multiply(d),o=e=>{let{x:t,y:n}=new r(Math.cos(e),Math.sin(e),0).applyMatrix3(a);return Math.atan2(n,t)};e.aStartAngle=o(e.aStartAngle),e.aEndAngle=o(e.aEndAngle),A(t)&&(e.aClockwise=!e.aClockwise)}}function a(e){let n=M(t),r=N(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,A(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let o=e.subPaths;for(let e=0,r=o.length;e<r;e++){let r=o[e].curves;for(let e=0;e<r.length;e++){let o=r[e];o.isLineCurve?(n(o.v1),n(o.v2)):o.isCubicBezierCurve?(n(o.v0),n(o.v1),n(o.v2),n(o.v3)):o.isQuadraticBezierCurve?(n(o.v0),n(o.v1),n(o.v2)):o.isEllipseCurve&&(W.set(o.aX,o.aY),n(W),o.aX=W.x,o.aY=W.y,j(t)?i(o):a(o))}}}function A(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function j(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=M(e),i=N(e);return Math.abs(n/(r*i))>2**-52}function M(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function N(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function P(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function F(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let I=[],L={},R={},z=[],B=new _,V=new _,H=new _,U=new _,W=new n,G=new r,K=new _,q=new DOMParser().parseFromString(e,`image/svg+xml`);return y(q),a(q.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:I,gradients:R,xml:q.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=b.exec(t.fill);i&&(r=x(e.userData.gradients&&e.userData.gradients[i[1]],e));let o=new a({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?o.color=n:o.map=r,o}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(b.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new a({color:new g().setStyle(t.stroke,v),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(e,n,r,i){let a=[],s=[],c=[];if(o.pointsToStrokeWithBuffers(e,n,r,i,a,s,c)===0)return null;let l=new u;return l.setAttribute(`position`,new t(a,3)),l.setAttribute(`normal`,new t(s,3)),l.setAttribute(`uv`,new t(c,2)),l}static pointsToStrokeWithBuffers(e,t,r,i,a,o,c,l){let u=new n,d=new n,f=new n,p=new n,m=new n,h=new n,g=new n,_=new n,v=new n,y=new n,b=new n,x=new n,S=new n,C=new n,w=new n,T=new n,E=new n;r=r===void 0?12:r,i=i===void 0?.001:i,l=l===void 0?0:l,e=X(e);let D=e.length;if(D<2)return 0;let O=e[0].equals(e[D-1]),k,A=e[0],j,M=t.strokeWidth/2,N=1/(D-1),P=0,F,I,L,R,z=!1,B=0,V=l*3,H=l*2;U(e[0],e[1],u).multiplyScalar(M),_.copy(e[0]).sub(u),v.copy(e[0]).add(u),y.copy(_),b.copy(v);for(let n=1;n<D;n++){k=e[n],j=n===D-1?O?e[1]:void 0:e[n+1];let r=u;if(U(A,k,r),f.copy(r).multiplyScalar(M),x.copy(k).sub(f),S.copy(k).add(f),F=P+N,I=!1,j!==void 0){U(k,j,d),f.copy(d).multiplyScalar(M),C.copy(k).sub(f),w.copy(k).add(f),L=!0,f.subVectors(j,A),r.dot(f)<0&&(L=!1),n===1&&(z=L),f.subVectors(j,k),f.normalize();let e=Math.abs(r.dot(f));if(e>2**-52){let n=M/e;f.multiplyScalar(-n),p.subVectors(k,A),m.copy(p).setLength(n).add(f),T.copy(m).negate();let r=m.length(),i=p.length();p.divideScalar(i),h.subVectors(j,k);let a=h.length();if(h.divideScalar(a),p.dot(T)<i&&h.dot(T)<a&&(I=!0),E.copy(m).add(k),T.add(k),I){let e=L?v:_,t=(E.x-e.x)*(T.y-e.y)-(E.y-e.y)*(T.x-e.x);(L&&t<0||!L&&t>0)&&T.copy(e)}switch(R=!1,I?L?(w.copy(T),S.copy(T)):(C.copy(T),x.copy(T)):K(),t.strokeLineJoin){case`bevel`:q(L,I,F);break;case`round`:J(L,I),L?G(k,x,C,F,0):G(k,w,S,F,1);break;default:let e=M*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){q(L,I,F);break}J(L,I),L?(h.subVectors(E,x).multiplyScalar(e).add(x),g.subVectors(E,C).multiplyScalar(e).add(C),W(x,F,0),W(h,F,0),W(k,F,.5),W(k,F,.5),W(h,F,0),W(g,F,0),W(k,F,.5),W(g,F,0),W(C,F,0)):(h.subVectors(E,S).multiplyScalar(e).add(S),g.subVectors(E,w).multiplyScalar(e).add(w),W(S,F,1),W(h,F,1),W(k,F,.5),W(k,F,.5),W(h,F,1),W(g,F,1),W(k,F,.5),W(g,F,1),W(w,F,1))}else I?(L?(W(v,P,1),W(_,P,0),W(E,F,0),W(v,P,1),W(E,F,0),W(T,F,1)):(W(v,P,1),W(_,P,0),W(E,F,1),W(_,P,0),W(T,F,0),W(E,F,1)),L?C.copy(E):w.copy(E)):L?(W(x,F,0),W(E,F,0),W(k,F,.5),W(k,F,.5),W(E,F,0),W(C,F,0)):(W(S,F,1),W(E,F,1),W(k,F,.5),W(k,F,.5),W(E,F,1),W(w,F,1)),R=!0}}else K()}else K();!O&&n===D-1&&Y(e[0],y,b,L,!0,P),P=F,A=k,_.copy(C),v.copy(w)}if(!O)Y(k,x,S,L,!1,F);else if(I&&a){let e=E,t=T;z!==L&&(e=T,t=E),L?(R||z)&&(t.toArray(a,0),t.toArray(a,9),R&&e.toArray(a,3)):(R||!z)&&(t.toArray(a,3),t.toArray(a,9),R&&e.toArray(a,0))}if(a){let e=[new n,new n,new n],t=l*3;for(let n=t;n<V;n+=9)e[0].set(a[n],a[n+1]),e[1].set(a[n+3],a[n+4]),e[2].set(a[n+6],a[n+7]),s.area(e)<0&&(a[n+3]=e[0].x,a[n+4]=e[0].y)}return B;function U(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function W(e,t,n){a&&(a[V]=e.x,a[V+1]=e.y,a[V+2]=0,o&&(o[V]=0,o[V+1]=0,o[V+2]=1),V+=3,c&&(c[H]=t,c[H+1]=n,H+=2)),B+=3}function G(e,t,n,i,a){u.copy(t).sub(e).normalize(),d.copy(n).sub(e).normalize();let o=Math.PI,s=u.dot(d);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=r,f.copy(t);for(let t=0,n=r-1;t<n;t++)p.copy(f).rotateAround(e,o),W(f,i,a),W(p,i,a),W(e,i,.5),f.copy(p);W(f,i,a),W(n,i,a),W(e,i,.5)}function K(){W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(S,F,1)}function q(e,t,n){t?e?(W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(T,F,1),W(x,n,0),W(C,n,0),W(T,n,.5)):(W(v,P,1),W(_,P,0),W(S,F,1),W(_,P,0),W(T,F,0),W(S,F,1),W(S,n,1),W(T,n,0),W(w,n,1)):e?(W(x,n,0),W(C,n,0),W(k,n,.5)):(W(S,n,1),W(w,n,0),W(k,n,.5))}function J(e,t){t&&(e?(W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(T,F,1),W(x,P,0),W(k,F,.5),W(T,F,1),W(k,F,.5),W(C,P,0),W(T,F,1)):(W(v,P,1),W(_,P,0),W(S,F,1),W(_,P,0),W(T,F,0),W(S,F,1),W(S,P,1),W(T,F,0),W(k,F,.5),W(k,F,.5),W(T,F,0),W(w,P,1)))}function Y(e,n,r,i,o,s){switch(t.strokeLineCap){case`round`:o?G(e,r,n,s,.5):G(e,n,r,s,.5);break;case`square`:if(o)u.subVectors(n,e),d.set(u.y,-u.x),f.addVectors(u,d).add(e),p.subVectors(d,u).add(e),i?(f.toArray(a,3),p.toArray(a,0),p.toArray(a,9)):(f.toArray(a,3),c[7]===1?p.toArray(a,9):f.toArray(a,9),p.toArray(a,0));else{u.subVectors(r,e),d.set(u.y,-u.x),f.addVectors(u,d).add(e),p.subVectors(d,u).add(e);let t=a.length;i?(f.toArray(a,t-3),p.toArray(a,t-6),p.toArray(a,t-12)):(p.toArray(a,t-6),f.toArray(a,t-3),p.toArray(a,t-12))}}}function X(e){let t=!1;for(let n=1,r=e.length-1;n<r;n++)if(e[n].distanceTo(e[n+1])<i){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,r=e.length-1;t<r;t++)e[t].distanceTo(e[t+1])>=i&&n.push(e[t]);return n.push(e[e.length-1]),n}}},b=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/;function x(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let i=t.userData.transform,a=e.gradientUnits===`objectBoundingBox`,s=null;if(a&&(s=S(t,i),s===null))return null;function c(t,n,r){r.set(t,n,1),e.gradientTransform&&r.applyMatrix3(e.gradientTransform),a&&r.set(s.minX+r.x*s.width,s.minY+r.y*s.height,1),i&&r.applyMatrix3(i)}let u=document.createElement(`canvas`),f;if(e.type===`linearGradient`){u.width=n,u.height=1;let t=u.getContext(`2d`),i=t.createLinearGradient(0,0,n,0);C(i,e.stops),t.fillStyle=i,t.fillRect(0,0,n,1);let a=new r,o=new r;c(e.x1,e.y1,a),c(e.x2,e.y2,o);let s=o.x-a.x,l=o.y-a.y,d=s*s+l*l||1e-20,p=s/d,m=l/d,h=-(p*a.x+m*a.y);f=new _().set(p,m,h,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,c=e.fx,l=e.fy,d=e.r;if(e.gradientTransform){let n=new r;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(c,l,1).applyMatrix3(e.gradientTransform),c=n.x,l=n.y}if(a&&(t=s.minX+t*s.width,o=s.minY+o*s.height,c=s.minX+c*s.width,l=s.minY+l*s.height,d*=Math.sqrt((s.width*s.width+s.height*s.height)/2)),d<=0)return null;u.width=n,u.height=n;let p=u.getContext(`2d`),m=t-d,h=o-d,g=2*d,v=n/g;p.setTransform(v,0,0,v,-m*v,-h*v);let y=p.createRadialGradient(c,l,0,t,o,d);C(y,e.stops),p.fillStyle=y,p.fillRect(m,h,g,g);let b=i?i.clone().invert():new _;f=new _().set(1/g,0,-m/g,0,1/g,-h/g,0,0,1).multiply(b)}let m=new l(u);m.colorSpace=v,m.flipY=!1,m.matrixAutoUpdate=!1,m.matrix=f;let h=e.spreadMethod===`reflect`?d:e.spreadMethod===`repeat`?p:o;return m.wrapS=h,m.wrapT=h,m}function S(e,t){let r=t?t.clone().invert():null,i=new n,a=new m;for(let t of e.subPaths)for(let e of t.getPoints())i.copy(e),r&&i.applyMatrix3(r),a.expandByPoint(i);return a.isEmpty()?null:{minX:a.min.x,minY:a.min.y,width:a.max.x-a.min.x,height:a.max.y-a.min.y}}function C(e,t){let n=new g;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,v);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(v));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}export{y as SVGLoader};
|
|
1
|
+
import{F as e,I as t,In as n,Ln as r,Lt as i,St as a,b as o,dn as s,ft as c,g as l,h as u,kt as d,rn as f,tn as p,u as m,un as h,x as g,yt as _}from"./three.module-B9FlcKtd.js";var v=f,y=class o extends c{constructor(e){super(e),this.defaultDPI=90,this.defaultUnit=`px`}load(t,n,r,i){let a=this,o=new e(a.manager);o.setPriority(a.priority),o.setCache(a.cache),o.setPath(a.path),o.setRequestHeader(a.requestHeader),o.setWithCredentials(a.withCredentials),o.load(t,function(e){try{n(a.parse(e))}catch(e){i?i(e):console.error(e),a.manager.itemError(t)}},r,i)}parse(e){let t=this;function a(e,t){if(e.nodeType!==1)return;e.hasAttribute(`filter`)&&console.warn(`THREE.SVGLoader: Filters are not supported.`);let n=E(e),r=!1,i=null;switch(e.nodeName){case`svg`:t=b(e,t);break;case`style`:s(e);break;case`g`:t=b(e,t);break;case`path`:t=b(e,t),e.hasAttribute(`d`)&&(i=o(e));break;case`rect`:t=b(e,t),i=u(e);break;case`polygon`:t=b(e,t),i=d(e);break;case`polyline`:t=b(e,t),i=f(e);break;case`circle`:t=b(e,t),i=p(e);break;case`ellipse`:t=b(e,t),i=m(e);break;case`line`:t=b(e,t),i=g(e);break;case`defs`:r=!0;break;case`use`:t=b(e,t);let n=(e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``).substring(1),c=e.viewportElement.getElementById(n);c?a(c,t):console.warn(`SVGLoader: 'use node' references non-existent node id: `+n)}if(i){t.fill!==void 0&&t.fill!==`none`&&!t.fill.startsWith(`url`)&&i.color.setStyle(t.fill,v),k(i,K),I.push(i);let n=Object.assign({},t);n.strokeWidth=t.strokeWidth*P(K),i.userData={node:e,style:n,transform:K.clone(),gradients:R}}let c=e.childNodes;for(let e=0;e<c.length;e++){let n=c[e];r&&n.nodeName!==`style`&&n.nodeName!==`defs`||a(n,t)}n&&(z.pop(),z.length>0?K.copy(z[z.length-1]):K.identity())}function o(e){let t=new h,r=new n,i=new n,a=new n,o=!1,s=e.getAttribute(`d`);if(s===``||s===`none`)return null;let l=s.match(/[a-df-z][^a-df-z]*/gi);for(let e=0,n=l.length;e<n;e++){let n=l[e],s=n.charAt(0),u=n.slice(1).trim();o===!0&&(s!==`M`&&s!==`m`&&s!==`Z`&&s!==`z`&&t.moveTo(a.x,a.y),o=!1);let d;switch(s){case`M`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x=d[e+0],r.y=d[e+1],i.x=r.x,i.y=r.y,e===0?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),e===0&&a.copy(r);break;case`H`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.x=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`V`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.y=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`L`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x=d[e+0],r.y=d[e+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`C`:d=S(u);for(let e=0,n=d.length;e<n;e+=6)t.bezierCurveTo(d[e+0],d[e+1],d[e+2],d[e+3],d[e+4],d[e+5]),i.x=d[e+2],i.y=d[e+3],r.x=d[e+4],r.y=d[e+5];break;case`S`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.bezierCurveTo(x(r.x,i.x),x(r.y,i.y),d[e+0],d[e+1],d[e+2],d[e+3]),i.x=d[e+0],i.y=d[e+1],r.x=d[e+2],r.y=d[e+3];break;case`Q`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.quadraticCurveTo(d[e+0],d[e+1],d[e+2],d[e+3]),i.x=d[e+0],i.y=d[e+1],r.x=d[e+2],r.y=d[e+3];break;case`T`:d=S(u);for(let e=0,n=d.length;e<n;e+=2){let n=x(r.x,i.x),a=x(r.y,i.y);t.quadraticCurveTo(n,a,d[e+0],d[e+1]),i.x=n,i.y=a,r.x=d[e+0],r.y=d[e+1]}break;case`A`:d=S(u,[3,4],7);for(let e=0,n=d.length;e<n;e+=7){if(d[e+5]==r.x&&d[e+6]==r.y)continue;let n=r.clone();r.x=d[e+5],r.y=d[e+6],i.x=r.x,i.y=r.y,c(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],n,r)}break;case`m`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x+=d[e+0],r.y+=d[e+1],i.x=r.x,i.y=r.y,e===0?t.moveTo(r.x,r.y):t.lineTo(r.x,r.y),e===0&&a.copy(r);break;case`h`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.x+=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`v`:d=S(u);for(let e=0,n=d.length;e<n;e++)r.y+=d[e],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`l`:d=S(u);for(let e=0,n=d.length;e<n;e+=2)r.x+=d[e+0],r.y+=d[e+1],i.x=r.x,i.y=r.y,t.lineTo(r.x,r.y);break;case`c`:d=S(u);for(let e=0,n=d.length;e<n;e+=6)t.bezierCurveTo(r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3],r.x+d[e+4],r.y+d[e+5]),i.x=r.x+d[e+2],i.y=r.y+d[e+3],r.x+=d[e+4],r.y+=d[e+5];break;case`s`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.bezierCurveTo(x(r.x,i.x),x(r.y,i.y),r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3]),i.x=r.x+d[e+0],i.y=r.y+d[e+1],r.x+=d[e+2],r.y+=d[e+3];break;case`q`:d=S(u);for(let e=0,n=d.length;e<n;e+=4)t.quadraticCurveTo(r.x+d[e+0],r.y+d[e+1],r.x+d[e+2],r.y+d[e+3]),i.x=r.x+d[e+0],i.y=r.y+d[e+1],r.x+=d[e+2],r.y+=d[e+3];break;case`t`:d=S(u);for(let e=0,n=d.length;e<n;e+=2){let n=x(r.x,i.x),a=x(r.y,i.y);t.quadraticCurveTo(n,a,r.x+d[e+0],r.y+d[e+1]),i.x=n,i.y=a,r.x+=d[e+0],r.y+=d[e+1]}break;case`a`:d=S(u,[3,4],7);for(let e=0,n=d.length;e<n;e+=7){if(d[e+5]==0&&d[e+6]==0)continue;let n=r.clone();r.x+=d[e+5],r.y+=d[e+6],i.x=r.x,i.y=r.y,c(t,d[e],d[e+1],d[e+2],d[e+3],d[e+4],n,r)}break;case`Z`:case`z`:t.currentPath.autoClose=!0,t.currentPath.curves.length>0&&(r.copy(a),t.currentPath.currentPoint.copy(r),o=!0);break;default:console.warn(n)}}return t}function s(e){if(e.sheet&&e.sheet.cssRules&&e.sheet.cssRules.length)for(let t=0;t<e.sheet.cssRules.length;t++){let n=e.sheet.cssRules[t];if(n.type!==1)continue;let r=n.selectorText.split(/,/gm).filter(Boolean).map(e=>e.trim()),i={};for(let e=0;e<n.style.length;e++){let t=n.style[e];i[t]=n.style.getPropertyValue(t)}for(let e=0;e<r.length;e++)L[r[e]]=Object.assign(L[r[e]]||{},i)}}function c(e,t,n,r,i,a,o,s){if(t==0||n==0){e.lineTo(s.x,s.y);return}r=r*Math.PI/180,t=Math.abs(t),n=Math.abs(n);let c=(o.x-s.x)/2,u=(o.y-s.y)/2,d=Math.cos(r)*c+Math.sin(r)*u,f=-Math.sin(r)*c+Math.cos(r)*u,p=t*t,m=n*n,h=d*d,g=f*f,_=h/p+g/m;if(_>1){let e=Math.sqrt(_);t=e*t,n=e*n,p=t*t,m=n*n}let v=p*g+m*h,y=(p*m-v)/v,b=Math.sqrt(Math.max(0,y));i===a&&(b=-b);let x=b*t*f/n,S=-b*n*d/t,C=Math.cos(r)*x-Math.sin(r)*S+(o.x+s.x)/2,w=Math.sin(r)*x+Math.cos(r)*S+(o.y+s.y)/2,T=l(1,0,(d-x)/t,(f-S)/n),E=l((d-x)/t,(f-S)/n,(-d-x)/t,(-f-S)/n)%(Math.PI*2);e.currentPath.absellipse(C,w,t,n,T,T+E,a===0,r)}function l(e,t,n,r){let i=e*n+t*r,a=Math.sqrt(e*e+t*t)*Math.sqrt(n*n+r*r),o=Math.acos(Math.max(-1,Math.min(1,i/a)));return e*r-t*n<0&&(o=-o),o}function u(e){let t=T(e.getAttribute(`x`)||0),n=T(e.getAttribute(`y`)||0),r=T(e.getAttribute(`rx`)||e.getAttribute(`ry`)||0),i=T(e.getAttribute(`ry`)||e.getAttribute(`rx`)||0),a=T(e.getAttribute(`width`)),o=T(e.getAttribute(`height`)),s=.448084975506,c=new h;return c.moveTo(t+r,n),c.lineTo(t+a-r,n),(r!==0||i!==0)&&c.bezierCurveTo(t+a-r*s,n,t+a,n+i*s,t+a,n+i),c.lineTo(t+a,n+o-i),(r!==0||i!==0)&&c.bezierCurveTo(t+a,n+o-i*s,t+a-r*s,n+o,t+a-r,n+o),c.lineTo(t+r,n+o),(r!==0||i!==0)&&c.bezierCurveTo(t+r*s,n+o,t,n+o-i*s,t,n+o-i),c.lineTo(t,n+i),(r!==0||i!==0)&&c.bezierCurveTo(t,n+i*s,t+r*s,n,t+r,n),c}function d(e){function t(e,t,n){let a=T(t),o=T(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new h,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!0,r}function f(e){function t(e,t,n){let a=T(t),o=T(n);i===0?r.moveTo(a,o):r.lineTo(a,o),i++}let n=/([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(?:,|\s)([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)/g,r=new h,i=0;return e.getAttribute(`points`).replace(n,t),r.currentPath.autoClose=!1,r}function p(e){let t=T(e.getAttribute(`cx`)||0),n=T(e.getAttribute(`cy`)||0),r=T(e.getAttribute(`r`)||0),a=new i;a.absarc(t,n,r,0,Math.PI*2);let o=new h;return o.subPaths.push(a),o}function m(e){let t=T(e.getAttribute(`cx`)||0),n=T(e.getAttribute(`cy`)||0),r=T(e.getAttribute(`rx`)||0),a=T(e.getAttribute(`ry`)||0),o=new i;o.absellipse(t,n,r,a,0,Math.PI*2);let s=new h;return s.subPaths.push(o),s}function g(e){let t=T(e.getAttribute(`x1`)||0),n=T(e.getAttribute(`y1`)||0),r=T(e.getAttribute(`x2`)||0),i=T(e.getAttribute(`y2`)||0),a=new h;return a.moveTo(t,n),a.lineTo(r,i),a.currentPath.autoClose=!1,a}function y(e){let t=e.querySelectorAll(`linearGradient, radialGradient`),n=[`x1`,`y1`,`x2`,`y2`,`cx`,`cy`,`r`,`fx`,`fy`,`gradientUnits`,`gradientTransform`,`spreadMethod`],r={};for(let e of t){let t=e.getAttribute(`id`);if(!t)continue;let i={type:e.nodeName===`radialGradient`?`radialGradient`:`linearGradient`,attrs:{},stops:null,href:null},a=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`href`)||``;a.startsWith(`#`)&&(i.href=a.substring(1));for(let t of n)e.hasAttribute(t)&&(i.attrs[t]=e.getAttribute(t));let o=e.querySelectorAll(`stop`);if(o.length>0){i.stops=[];for(let e of o){let t=e.getAttribute(`stop-color`);!t&&e.style&&(t=e.style[`stop-color`]),t||=`#000`;let n=e.getAttribute(`stop-opacity`);(n===null||n===``)&&e.style&&(n=e.style[`stop-opacity`]),n=n===null||n===``||n===void 0?1:Math.max(0,Math.min(1,parseFloat(n)));let r=Math.max(0,Math.min(1,parseFloat(e.getAttribute(`offset`)||`0`)));i.stops.push({offset:r,color:t,opacity:n})}}r[t]=i}function i(e,t){let n=r[e];if(!n||t.has(e))return n;if(t.add(e),n.href&&r[n.href]){let e=i(n.href,t);if(e){n.stops||=e.stops;for(let t in e.attrs)t in n.attrs||(n.attrs[t]=e.attrs[t])}}return n}for(let e in r)i(e,new Set);for(let e in r){let t=r[e],n=t.attrs,i=n.gradientUnits===`userSpaceOnUse`?`userSpaceOnUse`:`objectBoundingBox`,a={type:t.type,gradientUnits:i,spreadMethod:n.spreadMethod===`reflect`||n.spreadMethod===`repeat`?n.spreadMethod:`pad`,gradientTransform:null,stops:(t.stops||[]).slice().sort((e,t)=>e.offset-t.offset)};n.gradientTransform&&(a.gradientTransform=new _,O(n.gradientTransform,a.gradientTransform));function o(e){return typeof e==`string`?e.endsWith(`%`)?parseFloat(e)/100:T(e):0}if(t.type===`linearGradient`)a.x1=n.x1===void 0?0:o(n.x1),a.y1=n.y1===void 0?0:o(n.y1),a.x2=n.x2===void 0?+(i===`objectBoundingBox`):o(n.x2),a.y2=n.y2===void 0?0:o(n.y2);else{let e=i===`objectBoundingBox`?.5:0,t=i===`objectBoundingBox`?.5:0;a.cx=n.cx===void 0?e:o(n.cx),a.cy=n.cy===void 0?e:o(n.cy),a.r=n.r===void 0?t:o(n.r),a.fx=n.fx===void 0?a.cx:o(n.fx),a.fy=n.fy===void 0?a.cy:o(n.fy)}R[e]=a}}function b(e,t){t=Object.assign({},t);let n={};if(e.hasAttribute(`class`)){let t=e.getAttribute(`class`).split(/\s/).filter(Boolean).map(e=>e.trim());for(let e=0;e<t.length;e++)n=Object.assign(n,L[`.`+t[e]])}e.hasAttribute(`id`)&&(n=Object.assign(n,L[`#`+e.getAttribute(`id`)]));function r(r,i,a){a===void 0&&(a=function(e){return e}),e.hasAttribute(r)&&(t[i]=a(e.getAttribute(r))),n[r]&&(t[i]=a(n[r])),e.style&&e.style[r]!==``&&(t[i]=a(e.style[r]))}function i(e){return Math.max(0,Math.min(1,T(e)))}function a(e){return Math.max(0,T(e))}return r(`fill`,`fill`),r(`fill-opacity`,`fillOpacity`,i),r(`fill-rule`,`fillRule`),r(`opacity`,`opacity`,i),r(`stroke`,`stroke`),r(`stroke-opacity`,`strokeOpacity`,i),r(`stroke-width`,`strokeWidth`,a),r(`stroke-linejoin`,`strokeLineJoin`),r(`stroke-linecap`,`strokeLineCap`),r(`stroke-miterlimit`,`strokeMiterLimit`,a),r(`visibility`,`visibility`),t}function x(e,t){return e-(t-e)}function S(e,t,n){if(typeof e!=`string`)throw TypeError(`Invalid input: `+typeof e);let r={SEPARATOR:/[ \t\r\n\,.\-+]/,WHITESPACE:/[ \t\r\n]/,DIGIT:/[\d]/,SIGN:/[-+]/,POINT:/\./,COMMA:/,/,EXP:/e/i,FLAGS:/[01]/},i=0,a=!0,o=``,s=``,c=[];function l(e,t,n){let r=SyntaxError(`Unexpected character "`+e+`" at index `+t+`.`);throw r.partial=n,r}function u(){o!==``&&(s===``?c.push(Number(o)):c.push(Number(o)*10**Number(s))),o=``,s=``}let d,f=e.length;for(let p=0;p<f;p++)if(d=e[p],Array.isArray(t)&&t.includes(c.length%n)&&r.FLAGS.test(d))i=1,o=d,u();else{if(i===0){if(r.WHITESPACE.test(d))continue;if(r.DIGIT.test(d)||r.SIGN.test(d)){i=1,o=d;continue}if(r.POINT.test(d)){i=2,o=d;continue}r.COMMA.test(d)&&(a&&l(d,p,c),a=!0)}if(i===1){if(r.DIGIT.test(d)){o+=d;continue}if(r.POINT.test(d)){o+=d,i=2;continue}if(r.EXP.test(d)){i=3;continue}r.SIGN.test(d)&&o.length===1&&r.SIGN.test(o[0])&&l(d,p,c)}if(i===2){if(r.DIGIT.test(d)){o+=d;continue}if(r.EXP.test(d)){i=3;continue}r.POINT.test(d)&&o[o.length-1]===`.`&&l(d,p,c)}if(i===3){if(r.DIGIT.test(d)){s+=d;continue}if(r.SIGN.test(d)){if(s===``){s+=d;continue}s.length===1&&r.SIGN.test(s)&&l(d,p,c)}}r.WHITESPACE.test(d)?(u(),i=0,a=!1):r.COMMA.test(d)?(u(),i=0,a=!0):r.SIGN.test(d)?(u(),i=1,o=d):r.POINT.test(d)?(u(),i=2,o=d):l(d,p,c)}return u(),c}let C=[`mm`,`cm`,`in`,`pt`,`pc`,`px`],w={mm:{mm:1,cm:.1,in:1/25.4,pt:72/25.4,pc:6/25.4,px:-1},cm:{mm:10,cm:1,in:1/2.54,pt:72/2.54,pc:6/2.54,px:-1},in:{mm:25.4,cm:2.54,in:1,pt:72,pc:6,px:-1},pt:{mm:25.4/72,cm:2.54/72,in:1/72,pt:1,pc:6/72,px:-1},pc:{mm:25.4/6,cm:2.54/6,in:1/6,pt:12,pc:1,px:-1},px:{px:1}};function T(e){let n=`px`;if(typeof e==`string`||e instanceof String)for(let t=0,r=C.length;t<r;t++){let r=C[t];if(e.endsWith(r)){n=r,e=e.substring(0,e.length-r.length);break}}let r;return n===`px`&&t.defaultUnit!==`px`?r=w.in[t.defaultUnit]/t.defaultDPI:(r=w[n][t.defaultUnit],r<0&&(r=w[n].in*t.defaultDPI)),r*parseFloat(e)}function E(e){if(!(e.hasAttribute(`transform`)||e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))))return null;let t=D(e);return z.length>0&&t.premultiply(z[z.length-1]),K.copy(t),z.push(t),t}function D(e){let t=new _;if(e.nodeName===`use`&&(e.hasAttribute(`x`)||e.hasAttribute(`y`))){let n=T(e.getAttribute(`x`)||0),r=T(e.getAttribute(`y`)||0);t.makeTranslation(n,r)}return e.hasAttribute(`transform`)&&O(e.getAttribute(`transform`),t),t}function O(e,t){let n=B,r=e.split(`)`);for(let e=r.length-1;e>=0;e--){let i=r[e].trim();if(i===``)continue;let a=i.indexOf(`(`),o=i.length;if(a>0&&a<o){let e=i.slice(0,a),r=S(i.slice(a+1));switch(n.identity(),e){case`translate`:if(r.length>=1){let e=r[0],t=0;r.length>=2&&(t=r[1]),n.makeTranslation(e,t)}break;case`rotate`:if(r.length>=1){let e=0,t=0,i=0;e=r[0]*Math.PI/180,r.length>=3&&(t=r[1],i=r[2]),V.makeTranslation(-t,-i),H.makeRotation(e),U.multiplyMatrices(H,V),V.makeTranslation(t,i),n.multiplyMatrices(V,U)}break;case`scale`:if(r.length>=1){let e=r[0],t=e;r.length>=2&&(t=r[1]),n.makeScale(e,t)}break;case`skewX`:r.length===1&&n.set(1,Math.tan(r[0]*Math.PI/180),0,0,1,0,0,0,1);break;case`skewY`:r.length===1&&n.set(1,0,0,Math.tan(r[0]*Math.PI/180),1,0,0,0,1);break;case`matrix`:r.length===6&&n.set(r[0],r[2],r[4],r[1],r[3],r[5],0,0,1)}t.premultiply(n)}}return t}function k(e,t){function n(e){G.set(e.x,e.y,1).applyMatrix3(t),e.set(G.x,G.y)}function i(e){let n=e.xRadius,i=e.yRadius,a=Math.cos(e.aRotation),o=Math.sin(e.aRotation),s=new r(n*a,n*o,0),c=new r(-i*o,i*a,0),l=s.applyMatrix3(t),u=c.applyMatrix3(t),d=B.set(l.x,u.x,0,l.y,u.y,0,0,0,1),f=V.copy(d).invert(),p=H.copy(f).transpose().multiply(f).elements,m=F(p[0],p[1],p[4]),h=Math.sqrt(m.rt1),g=Math.sqrt(m.rt2);if(e.xRadius=1/h,e.yRadius=1/g,e.aRotation=Math.atan2(m.sn,m.cs),!((e.aEndAngle-e.aStartAngle)%(2*Math.PI)<2**-52)){let n=V.set(h,0,0,0,g,0,0,0,1),i=H.set(m.cs,m.sn,0,-m.sn,m.cs,0,0,0,1),a=n.multiply(i).multiply(d),o=e=>{let{x:t,y:n}=new r(Math.cos(e),Math.sin(e),0).applyMatrix3(a);return Math.atan2(n,t)};e.aStartAngle=o(e.aStartAngle),e.aEndAngle=o(e.aEndAngle),A(t)&&(e.aClockwise=!e.aClockwise)}}function a(e){let n=M(t),r=N(t);e.xRadius*=n,e.yRadius*=r;let i=n>2**-52?Math.atan2(t.elements[1],t.elements[0]):Math.atan2(-t.elements[3],t.elements[4]);e.aRotation+=i,A(t)&&(e.aStartAngle*=-1,e.aEndAngle*=-1,e.aClockwise=!e.aClockwise)}let o=e.subPaths;for(let e=0,r=o.length;e<r;e++){let r=o[e].curves;for(let e=0;e<r.length;e++){let o=r[e];o.isLineCurve?(n(o.v1),n(o.v2)):o.isCubicBezierCurve?(n(o.v0),n(o.v1),n(o.v2),n(o.v3)):o.isQuadraticBezierCurve?(n(o.v0),n(o.v1),n(o.v2)):o.isEllipseCurve&&(W.set(o.aX,o.aY),n(W),o.aX=W.x,o.aY=W.y,j(t)?i(o):a(o))}}}function A(e){let t=e.elements;return t[0]*t[4]-t[1]*t[3]<0}function j(e){let t=e.elements,n=t[0]*t[3]+t[1]*t[4];if(n===0)return!1;let r=M(e),i=N(e);return Math.abs(n/(r*i))>2**-52}function M(e){let t=e.elements;return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function N(e){let t=e.elements;return Math.sqrt(t[3]*t[3]+t[4]*t[4])}function P(e){let t=e.elements,n=t[0]*t[4]-t[1]*t[3];return Math.sqrt(Math.abs(n))}function F(e,t,n){let r,i,a,o,s,c=e+n,l=e-n,u=Math.sqrt(l*l+4*t*t);return c>0?(r=.5*(c+u),s=1/r,i=e*s*n-t*s*t):c<0?i=.5*(c-u):(r=.5*u,i=-.5*u),a=l>0?l+u:l-u,Math.abs(a)>2*Math.abs(t)?(s=-2*t/a,o=1/Math.sqrt(1+s*s),a=s*o):Math.abs(t)===0?(a=1,o=0):(s=-.5*a/t,a=1/Math.sqrt(1+s*s),o=s*a),l>0&&(s=a,a=-o,o=s),{rt1:r,rt2:i,cs:a,sn:o}}let I=[],L={},R={},z=[],B=new _,V=new _,H=new _,U=new _,W=new n,G=new r,K=new _,q=new DOMParser().parseFromString(e,`image/svg+xml`);return y(q),a(q.documentElement,{fill:`#000`,fillOpacity:1,strokeOpacity:1,strokeWidth:1,strokeLineJoin:`miter`,strokeLineCap:`butt`,strokeMiterLimit:4}),{paths:I,gradients:R,xml:q.documentElement}}static createFillMaterial(e){let t=e.userData.style;if(t.fill===void 0||t.fill===`none`)return null;let n=e.color,r=null,i=b.exec(t.fill);i&&(r=x(e.userData.gradients&&e.userData.gradients[i[1]],e));let o=new a({opacity:t.fillOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1});return r===null?o.color=n:o.map=r,o}static createStrokeMaterial(e){let t=e.userData.style;return t.stroke===void 0||t.stroke===`none`?null:(b.test(t.stroke)&&console.warn(`THREE.SVGLoader: Gradient strokes are not supported.`),new a({color:new g().setStyle(t.stroke,v),opacity:t.strokeOpacity*(t.opacity||1),transparent:!0,side:2,depthWrite:!1}))}static createShapes(e){return console.warn(`SVGLoader: createShapes() is deprecated. Use shapePath.toShapes() instead.`),e.toShapes()}static getStrokeStyle(e,t,n,r,i){return e=e===void 0?1:e,t=t===void 0?`#000`:t,n=n===void 0?`miter`:n,r=r===void 0?`butt`:r,i=i===void 0?4:i,{strokeColor:t,strokeWidth:e,strokeLineJoin:n,strokeLineCap:r,strokeMiterLimit:i}}static pointsToStroke(e,n,r,i){let a=[],s=[],c=[];if(o.pointsToStrokeWithBuffers(e,n,r,i,a,s,c)===0)return null;let l=new u;return l.setAttribute(`position`,new t(a,3)),l.setAttribute(`normal`,new t(s,3)),l.setAttribute(`uv`,new t(c,2)),l}static pointsToStrokeWithBuffers(e,t,r,i,a,o,c,l){let u=new n,d=new n,f=new n,p=new n,m=new n,h=new n,g=new n,_=new n,v=new n,y=new n,b=new n,x=new n,S=new n,C=new n,w=new n,T=new n,E=new n;r=r===void 0?12:r,i=i===void 0?.001:i,l=l===void 0?0:l,e=X(e);let D=e.length;if(D<2)return 0;let O=e[0].equals(e[D-1]),k,A=e[0],j,M=t.strokeWidth/2,N=1/(D-1),P=0,F,I,L,R,z=!1,B=0,V=l*3,H=l*2;U(e[0],e[1],u).multiplyScalar(M),_.copy(e[0]).sub(u),v.copy(e[0]).add(u),y.copy(_),b.copy(v);for(let n=1;n<D;n++){k=e[n],j=n===D-1?O?e[1]:void 0:e[n+1];let r=u;if(U(A,k,r),f.copy(r).multiplyScalar(M),x.copy(k).sub(f),S.copy(k).add(f),F=P+N,I=!1,j!==void 0){U(k,j,d),f.copy(d).multiplyScalar(M),C.copy(k).sub(f),w.copy(k).add(f),L=!0,f.subVectors(j,A),r.dot(f)<0&&(L=!1),n===1&&(z=L),f.subVectors(j,k),f.normalize();let e=Math.abs(r.dot(f));if(e>2**-52){let n=M/e;f.multiplyScalar(-n),p.subVectors(k,A),m.copy(p).setLength(n).add(f),T.copy(m).negate();let r=m.length(),i=p.length();p.divideScalar(i),h.subVectors(j,k);let a=h.length();if(h.divideScalar(a),p.dot(T)<i&&h.dot(T)<a&&(I=!0),E.copy(m).add(k),T.add(k),I){let e=L?v:_,t=(E.x-e.x)*(T.y-e.y)-(E.y-e.y)*(T.x-e.x);(L&&t<0||!L&&t>0)&&T.copy(e)}switch(R=!1,I?L?(w.copy(T),S.copy(T)):(C.copy(T),x.copy(T)):K(),t.strokeLineJoin){case`bevel`:q(L,I,F);break;case`round`:J(L,I),L?G(k,x,C,F,0):G(k,w,S,F,1);break;default:let e=M*t.strokeMiterLimit/r;if(e<1){if(t.strokeLineJoin!==`miter-clip`){q(L,I,F);break}J(L,I),L?(h.subVectors(E,x).multiplyScalar(e).add(x),g.subVectors(E,C).multiplyScalar(e).add(C),W(x,F,0),W(h,F,0),W(k,F,.5),W(k,F,.5),W(h,F,0),W(g,F,0),W(k,F,.5),W(g,F,0),W(C,F,0)):(h.subVectors(E,S).multiplyScalar(e).add(S),g.subVectors(E,w).multiplyScalar(e).add(w),W(S,F,1),W(h,F,1),W(k,F,.5),W(k,F,.5),W(h,F,1),W(g,F,1),W(k,F,.5),W(g,F,1),W(w,F,1))}else I?(L?(W(v,P,1),W(_,P,0),W(E,F,0),W(v,P,1),W(E,F,0),W(T,F,1)):(W(v,P,1),W(_,P,0),W(E,F,1),W(_,P,0),W(T,F,0),W(E,F,1)),L?C.copy(E):w.copy(E)):L?(W(x,F,0),W(E,F,0),W(k,F,.5),W(k,F,.5),W(E,F,0),W(C,F,0)):(W(S,F,1),W(E,F,1),W(k,F,.5),W(k,F,.5),W(E,F,1),W(w,F,1)),R=!0}}else K()}else K();!O&&n===D-1&&Y(e[0],y,b,L,!0,P),P=F,A=k,_.copy(C),v.copy(w)}if(!O)Y(k,x,S,L,!1,F);else if(I&&a){let e=E,t=T;z!==L&&(e=T,t=E),L?(R||z)&&(t.toArray(a,0),t.toArray(a,9),R&&e.toArray(a,3)):(R||!z)&&(t.toArray(a,3),t.toArray(a,9),R&&e.toArray(a,0))}if(a){let e=[new n,new n,new n],t=l*3;for(let n=t;n<V;n+=9)e[0].set(a[n],a[n+1]),e[1].set(a[n+3],a[n+4]),e[2].set(a[n+6],a[n+7]),s.area(e)<0&&(a[n+3]=e[0].x,a[n+4]=e[0].y)}return B;function U(e,t,n){return n.subVectors(t,e),n.set(-n.y,n.x).normalize()}function W(e,t,n){a&&(a[V]=e.x,a[V+1]=e.y,a[V+2]=0,o&&(o[V]=0,o[V+1]=0,o[V+2]=1),V+=3,c&&(c[H]=t,c[H+1]=n,H+=2)),B+=3}function G(e,t,n,i,a){u.copy(t).sub(e).normalize(),d.copy(n).sub(e).normalize();let o=Math.PI,s=u.dot(d);Math.abs(s)<1&&(o=Math.abs(Math.acos(s))),o/=r,f.copy(t);for(let t=0,n=r-1;t<n;t++)p.copy(f).rotateAround(e,o),W(f,i,a),W(p,i,a),W(e,i,.5),f.copy(p);W(f,i,a),W(n,i,a),W(e,i,.5)}function K(){W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(S,F,1)}function q(e,t,n){t?e?(W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(T,F,1),W(x,n,0),W(C,n,0),W(T,n,.5)):(W(v,P,1),W(_,P,0),W(S,F,1),W(_,P,0),W(T,F,0),W(S,F,1),W(S,n,1),W(T,n,0),W(w,n,1)):e?(W(x,n,0),W(C,n,0),W(k,n,.5)):(W(S,n,1),W(w,n,0),W(k,n,.5))}function J(e,t){t&&(e?(W(v,P,1),W(_,P,0),W(x,F,0),W(v,P,1),W(x,F,0),W(T,F,1),W(x,P,0),W(k,F,.5),W(T,F,1),W(k,F,.5),W(C,P,0),W(T,F,1)):(W(v,P,1),W(_,P,0),W(S,F,1),W(_,P,0),W(T,F,0),W(S,F,1),W(S,P,1),W(T,F,0),W(k,F,.5),W(k,F,.5),W(T,F,0),W(w,P,1)))}function Y(e,n,r,i,o,s){switch(t.strokeLineCap){case`round`:o?G(e,r,n,s,.5):G(e,n,r,s,.5);break;case`square`:if(o)u.subVectors(n,e),d.set(u.y,-u.x),f.addVectors(u,d).add(e),p.subVectors(d,u).add(e),i?(f.toArray(a,3),p.toArray(a,0),p.toArray(a,9)):(f.toArray(a,3),c[7]===1?p.toArray(a,9):f.toArray(a,9),p.toArray(a,0));else{u.subVectors(r,e),d.set(u.y,-u.x),f.addVectors(u,d).add(e),p.subVectors(d,u).add(e);let t=a.length;i?(f.toArray(a,t-3),p.toArray(a,t-6),p.toArray(a,t-12)):(p.toArray(a,t-6),f.toArray(a,t-3),p.toArray(a,t-12))}}}function X(e){let t=!1;for(let n=1,r=e.length-1;n<r;n++)if(e[n].distanceTo(e[n+1])<i){t=!0;break}if(!t)return e;let n=[];n.push(e[0]);for(let t=1,r=e.length-1;t<r;t++)e[t].distanceTo(e[t+1])>=i&&n.push(e[t]);return n.push(e[e.length-1]),n}}},b=/^\s*url\(\s*(?:["']\s*)?#([^)'"\s]+)(?:\s*["'])?\s*\)\s*$/;function x(e,t,n=256){if(!e||!Array.isArray(e.stops)||e.stops.length===0)return null;let i=t.userData.transform,a=e.gradientUnits===`objectBoundingBox`,s=null;if(a&&(s=S(t,i),s===null))return null;function c(t,n,r){r.set(t,n,1),e.gradientTransform&&r.applyMatrix3(e.gradientTransform),a&&r.set(s.minX+r.x*s.width,s.minY+r.y*s.height,1),i&&r.applyMatrix3(i)}let u=document.createElement(`canvas`),f;if(e.type===`linearGradient`){u.width=n,u.height=1;let t=u.getContext(`2d`),i=t.createLinearGradient(0,0,n,0);C(i,e.stops),t.fillStyle=i,t.fillRect(0,0,n,1);let a=new r,o=new r;c(e.x1,e.y1,a),c(e.x2,e.y2,o);let s=o.x-a.x,l=o.y-a.y,d=s*s+l*l||1e-20,p=s/d,m=l/d,h=-(p*a.x+m*a.y);f=new _().set(p,m,h,0,0,.5,0,0,1)}else{let t=e.cx,o=e.cy,c=e.fx,l=e.fy,d=e.r;if(e.gradientTransform){let n=new r;n.set(t,o,1).applyMatrix3(e.gradientTransform),t=n.x,o=n.y,n.set(c,l,1).applyMatrix3(e.gradientTransform),c=n.x,l=n.y}if(a&&(t=s.minX+t*s.width,o=s.minY+o*s.height,c=s.minX+c*s.width,l=s.minY+l*s.height,d*=Math.sqrt((s.width*s.width+s.height*s.height)/2)),d<=0)return null;u.width=n,u.height=n;let p=u.getContext(`2d`),m=t-d,h=o-d,g=2*d,v=n/g;p.setTransform(v,0,0,v,-m*v,-h*v);let y=p.createRadialGradient(c,l,0,t,o,d);C(y,e.stops),p.fillStyle=y,p.fillRect(m,h,g,g);let b=i?i.clone().invert():new _;f=new _().set(1/g,0,-m/g,0,1/g,-h/g,0,0,1).multiply(b)}let m=new l(u);m.colorSpace=v,m.flipY=!1,m.matrixAutoUpdate=!1,m.matrix=f;let h=e.spreadMethod===`reflect`?d:e.spreadMethod===`repeat`?p:o;return m.wrapS=h,m.wrapT=h,m}function S(e,t){let r=t?t.clone().invert():null,i=new n,a=new m;for(let t of e.subPaths)for(let e of t.getPoints())i.copy(e),r&&i.applyMatrix3(r),a.expandByPoint(i);return a.isEmpty()?null:{minX:a.min.x,minY:a.min.y,width:a.max.x-a.min.x,height:a.max.y-a.min.y}}function C(e,t){let n=new g;for(let r of t){let t=r.color;if(r.opacity<1){n.setStyle(r.color,v);let e=/rgb\(([^)]+)\)/.exec(n.getStyle(v));e&&(t=`rgba(${e[1]},${r.opacity})`)}e.addColorStop(Math.max(0,Math.min(1,r.offset)),t)}}export{y as SVGLoader};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ln as e,Mn as t,on as n,p as r,xt as i}from"./three.module-
|
|
1
|
+
import{Ln as e,Mn as t,on as n,p as r,xt as i}from"./three.module-B9FlcKtd.js";var a=class e extends i{constructor(){let i=e.SkyShader,a=new n({name:i.name,uniforms:t.clone(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:1,depthWrite:!1});super(new r(1,1,1),a),this.isSky=!0}};a.SkyShader={name:`SkyShader`,uniforms:{turbidity:{value:2},rayleigh:{value:1},mieCoefficient:{value:.005},mieDirectionalG:{value:.8},sunPosition:{value:new e},cloudScale:{value:2e-4},cloudSpeed:{value:2e-5},cloudCoverage:{value:.4},cloudDensity:{value:.4},cloudElevation:{value:.5},showSunDisc:{value:1},time:{value:0}},vertexShader:`
|
|
2
2
|
uniform vec3 sunPosition;
|
|
3
3
|
uniform float rayleigh;
|
|
4
4
|
uniform float turbidity;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./three.module-B9FlcKtd.js","./rolldown-runtime-4tVxZq34.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{g as e}from"./index-BPVRhKVV.js";var t=new Map;function n(e){let n=t.get(e);return n||(n=fetch(e).then(t=>{if(!t.ok)throw Error(`HTTP ${t.status} for ${e}`);return t.text()}),n.catch(()=>t.delete(e)),t.set(e,n)),n}async function r(e){return JSON.parse(await n(e))}var i=new Map;function a(t){let n=i.get(t);return n||(n=e(()=>import(`./three.module-B9FlcKtd.js`).then(e=>e.a).then(e=>new Promise((n,r)=>{new e.TextureLoader().load(t,n,void 0,()=>r(Error(`Cannot load texture ${t}`)))})),__vite__mapDeps([0,1]),import.meta.url),n.catch(()=>i.delete(t)),i.set(t,n)),n.then(e=>{let t=e.clone();return t.needsUpdate=!0,t})}export{n,a as r,r as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./OrbitControls-1xEm394I.js","./three.module-B9FlcKtd.js","./rolldown-runtime-4tVxZq34.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,r as t,t as n}from"./num-CQNAlL82.js";import{In as r,It as i,Ln as a,Rt as o,wn as s,x as c}from"./three.module-B9FlcKtd.js";import{g as l}from"./index-BPVRhKVV.js";function u(e,t){return typeof e==`boolean`?e:t}function d(e,t){return typeof e==`string`?e:t}function f(e,t){return Array.isArray(e)&&e.length>=3&&e.every(e=>typeof e==`number`)?[e[0],e[1],e[2]]:t}function p(e,t){return typeof e==`string`?[e]:Array.isArray(e)&&e.length&&e.every(e=>typeof e==`string`)?e:t}var m=new Map;function h(e,t=`#ffffff`){let n=typeof e==`string`&&e?e:t,r=m.get(n);if(!r){r=new c;try{r.setStyle(n)}catch{r.setStyle(t)}m.size>512&&m.clear(),m.set(n,r)}return r.clone()}function g(e,t){let n={};if(e)for(let t of e.params)t.default!==void 0&&(n[t.name]=t.default);for(let[e,r]of Object.entries(t))r!==void 0&&(n[e]=r);return n}function _(t,n){let r=e(t,0,.999);return r<=0?1:1-r**(n*60)}function v(e){let t=Math.sin(e*127.1+311.7)*43758.5453123;return t-Math.floor(t)}function y(e){e.traverse(e=>{let t=e;t.geometry&&t.geometry.dispose();let n=t.material;if(n)for(let e of Array.isArray(n)?n:[n])b(e)})}function b(e){for(let t of Object.values(e))t instanceof s&&t.dispose();e.dispose()}function x(e){let t=new Set;return e.traverse(e=>{let n=e.material;if(n&&!e.userData.depthTwin)for(let e of Array.isArray(n)?n:[n])t.add(e)}),[...t]}function S(e){let t=(Math.floor(e)|0)^2654435769,n=()=>{t=t+2654435769|0;let e=t;return e=Math.imul(e^e>>>16,2246822507),e=Math.imul(e^e>>>13,3266489909),(e^e>>>16)>>>0},r=n(),i=n(),a=n(),o=n(),s=()=>{r>>>=0,i>>>=0,a>>>=0,o>>>=0;let e=(r+i|0)+o|0;return o=o+1|0,r=i^i>>>9,i=a+(a<<3)|0,a=a<<21|a>>>11,a=a+e|0,(e>>>0)/4294967296};for(let e=0;e<12;e++)s();return{next:s,range:(e,t)=>e+(t-e)*s(),int:(e,t)=>e+Math.floor(s()*(t-e+1)),pick:e=>e[Math.floor(s()*e.length)]}}function C(e,t){let n=(e|0)^2166136261;for(let e=0;e<t.length;e++)n^=t.charCodeAt(e),n=Math.imul(n,16777619);return n>>>0}var w=new Uint8Array(512),T=new Uint8Array(512);{let e=new Uint8Array(256);for(let t=0;t<256;t++)e[t]=t;let t=S(1337);for(let n=255;n>0;n--){let r=Math.floor(t.next()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}for(let t=0;t<512;t++)w[t]=e[t&255],T[t]=w[t]%12}var E=new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),D=.5*(Math.sqrt(3)-1),O=(3-Math.sqrt(3))/6;function k(e,t){let n=(e+t)*D,r=Math.floor(e+n),i=Math.floor(t+n),a=(r+i)*O,o=e-(r-a),s=t-(i-a),c=+(o>s),l=o>s?0:1,u=o-c+O,d=s-l+O,f=o-1+2*O,p=s-1+2*O,m=r&255,h=i&255,g=0,_=.5-o*o-s*s;if(_>0){let e=T[m+w[h]]*3;_*=_,g+=_*_*(E[e]*o+E[e+1]*s)}let v=.5-u*u-d*d;if(v>0){let e=T[m+c+w[h+l]]*3;v*=v,g+=v*v*(E[e]*u+E[e+1]*d)}let y=.5-f*f-p*p;if(y>0){let e=T[m+1+w[h+1]]*3;y*=y,g+=y*y*(E[e]*f+E[e+1]*p)}return 70*g}var A=1/3,j=1/6;function M(e,t,n){let r=(e+t+n)*A,i=Math.floor(e+r),a=Math.floor(t+r),o=Math.floor(n+r),s=(i+a+o)*j,c=e-(i-s),l=t-(a-s),u=n-(o-s),d,f,p,m,h,g;c>=l?l>=u?[d,f,p,m,h,g]=[1,0,0,1,1,0]:c>=u?[d,f,p,m,h,g]=[1,0,0,1,0,1]:[d,f,p,m,h,g]=[0,0,1,1,0,1]:l<u?[d,f,p,m,h,g]=[0,0,1,0,1,1]:c<u?[d,f,p,m,h,g]=[0,1,0,0,1,1]:[d,f,p,m,h,g]=[0,1,0,1,1,0];let _=c-d+j,v=l-f+j,y=u-p+j,b=c-m+2*j,x=l-h+2*j,S=u-g+2*j,C=c-1+3*j,D=l-1+3*j,O=u-1+3*j,k=i&255,M=a&255,N=o&255,P=0,F=(e,t,n,r)=>{let i=.6-e*e-t*t-n*n;if(i>0){let a=r*3;i*=i,P+=i*i*(E[a]*e+E[a+1]*t+E[a+2]*n)}};return F(c,l,u,T[k+w[M+w[N]]]),F(_,v,y,T[k+d+w[M+f+w[N+p]]]),F(b,x,S,T[k+m+w[M+h+w[N+g]]]),F(C,D,O,T[k+1+w[M+1+w[N+1]]]),32*P}function N(e,t,n,r=2,i=.5){let a=0,o=1,s=1,c=0;for(let l=0;l<n;l++)a+=o*k(e*s+l*17.31,t*s-l*9.17),c+=o,o*=i,s*=r;return c>0?a/c:0}function P(e,t,n,r,i=2,a=.5){let o=0,s=1,c=1,l=0;for(let u=0;u<r;u++)o+=s*M(e*c+u*17.31,t*c-u*9.17,n*c+u*3.7),l+=s,s*=a,c*=i;return l>0?o/l:0}function F(e,t,n,r=2,i=.5){let a=0,o=1,s=1,c=0;for(let l=0;l<n;l++){let n=1-Math.abs(k(e*s+l*31.7,t*s+l*11.3));a+=o*n*n,c+=o,o*=i,s*=r}return c>0?a/c:0}function I(e,t){return!t||!(e>0)||e>=t?1:Math.min(t/e,3)}function L(e,t){return t<=1?e:Math.min(100,2*Math.atan(Math.tan(e*n/2)*t)/n)}function R(e){let t=/^\s*([\d.]+)\s*[:/x]\s*([\d.]+)\s*$/.exec(e??``),n=t?Number(t[1])/Number(t[2]):void 0;return n&&Number.isFinite(n)&&n>0?n:void 0}function z(e,t){let n=t.x-e.x,r=t.y-e.y,i=t.z-e.z,a=Math.hypot(n,r,i);if(a<1e-9)return;let o=-1e-4/a;e.set(e.x+n*o,e.y+r*o,e.z+i*o)}function B(e,n){let r=t(e.near,.1),s=t(e.far,1e3),c;if(e.type===`orthographic`){let a=t(e.zoom,10)/2;c=new i(-a*n,a*n,a,-a,r,s)}else c=new o(t(e.fov,45),n,r,s);c.position.set(...e.position);let l=e.target??[0,0,0];return z(c.position,new a(l[0],l[1],l[2])),c.lookAt(l[0],l[1],l[2]),c}function V(e,n,r,a){let s=I(r,a);if(e.userData.fitScale=s,e instanceof o)e.aspect=r,e.fov=L(t(e.userData.restFov,t(n.fov,45)),s),e.updateProjectionMatrix();else if(e instanceof i){let i=(e.userData.zoomHeight??t(n.zoom,10))/2*s;e.left=-i*r,e.right=i*r,e.top=i,e.bottom=-i,e.updateProjectionMatrix()}}async function H(s,c,u,d){let f=new a(...s.target??[0,0,0]),p={position:new a(...s.position),target:f.clone(),fov:t(s.fov,45),zoom:t(s.zoom,10)},m=s.controls??`none`,h=p.position.clone(),g=p.target.clone(),v=new r,y=new a,b=!0,x=null;if(m===`orbit`&&u&&!d){let{OrbitControls:e}=await l(async()=>{let{OrbitControls:e}=await import(`./OrbitControls-1xEm394I.js`);return{OrbitControls:e}},__vite__mapDeps([0,1,2]),import.meta.url),t=new e(c,u);t.target.copy(p.target),t.enableDamping=!0,t.dampingFactor=.08,t.enableZoom=s.orbitZoom!==!1,t.enablePan=!1;let r=s.orbitLimits??{};r.minDistance!==void 0&&(t.minDistance=r.minDistance),r.maxDistance!==void 0&&(t.maxDistance=r.maxDistance),r.minPolar!==void 0&&(t.minPolarAngle=r.minPolar*n),r.maxPolar!==void 0&&(t.maxPolarAngle=r.maxPolar*n),r.minAzimuth!==void 0&&(t.minAzimuthAngle=r.minAzimuth*n),r.maxAzimuth!==void 0&&(t.maxAzimuthAngle=r.maxAzimuth*n),s.autoRotate&&(t.autoRotate=!0,t.autoRotateSpeed=s.autoRotate/360*60),x=t}let S=new a,C=new a;return{rest:p,shake:y,orbit:x,update(r,l,u){if(c instanceof o){c.userData.restFov=p.fov;let e=L(p.fov,t(c.userData.fitScale,1));c.fov!==e&&(c.fov=e,c.updateProjectionMatrix())}else if(c instanceof i&&t(c.userData.zoomHeight,t(s.zoom,10))!==p.zoom){c.userData.zoomHeight=p.zoom;let e=(c.right-c.left)/Math.max(c.top-c.bottom,1e-6),n=p.zoom/2*t(c.userData.fitScale,1);c.left=-n*e,c.right=n*e,c.top=n,c.bottom=-n,c.updateProjectionMatrix()}if(x){x.update(),c.position.add(y);return}let d=S.copy(p.position),f=g;if(m===`scroll`&&s.scrollPath?.length){let t=s.scrollPath,n=e(u.scroll,0,1)*(t.length-1),r=Math.min(Math.floor(n),t.length-2),i=t.length===1?0:n-Math.max(r,0),o=i*i*(3-2*i),c=t[Math.max(r,0)],l=t[Math.min(Math.max(r,0)+1,t.length-1)];d.set(...c.position).lerp(new a(...l.position),o);let p=new a(...c.target??s.target??[0,0,0]),m=new a(...l.target??s.target??[0,0,0]);f.copy(p.lerp(m,o))}else if(m===`follow`&&u.followTarget){let e=s.follow??{target:``},n=u.followTarget.getWorldPosition(new a),r=new a(...e.offset??[0,4,8]),i=n.clone().add(r),o=n.clone().add(new a(0,0,-t(e.lookAhead,0))),c=b?1:_(t(e.smoothing,.85),l);h.lerp(i,c),f.lerp(o,c),d=S.copy(h)}else f.copy(p.target);if(u.lookAt&&f.copy(u.lookAt),s.autoRotate&&m!==`follow`){let e=s.autoRotate*n*r,t=d.clone().sub(f);t.applyAxisAngle(new a(0,1,0),e),d.copy(f).add(t)}if(m===`parallax`){let e=s.parallax??{},n=t(e.strength,.5),r=_(t(e.smoothing,.92),l);v.x+=(u.pointer.x*n-v.x)*r,v.y+=(u.pointer.y*n*.6-v.y)*r;let i=f.clone().sub(d).normalize(),o=new a().crossVectors(i,c.up).normalize(),p=new a().crossVectors(o,i).normalize();d.addScaledVector(o,v.x).addScaledVector(p,v.y)}if(s.shake){let e=s.shake,i=t(e.speed,.5),o=t(e.amount,.03),l=t(e.rotation,.4)*n,u=t(e.seed,1)*17.31,p=e=>k(r*i+u,e*7.13)*.75+k(r*i*2.7+u,e*7.13+3.1)*.25,m=f.clone().sub(d),h=m.length()||1;m.divideScalar(h);let g=new a().crossVectors(m,c.up).normalize(),_=new a().crossVectors(g,m).normalize();d.addScaledVector(g,p(0)*o).addScaledVector(_,p(1)*o),C.copy(f).addScaledVector(g,Math.tan(p(2)*l)*h).addScaledVector(_,Math.tan(p(3)*l)*h)}else C.copy(f);c.position.copy(d).add(y),z(c.position,C),c.lookAt(C),b=!1},dispose(){x?.dispose()}}}export{_,S as a,f as b,C as c,F as d,u as f,x as g,v as h,R as i,k as l,y as m,H as n,N as o,p,V as r,P as s,B as t,M as u,d as v,g as x,h as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=(e,t,n,r,i)=>({name:e,type:`number`,description:t,default:n,min:r,max:i}),t=(e,t,n,r,i)=>({name:e,type:`integer`,description:t,default:n,min:r,max:i}),n=(e,t,n)=>({name:e,type:`boolean`,description:t,default:n}),r=(e,t,n)=>({name:e,type:`color`,description:t,default:n}),i=(e,t,n)=>({name:e,type:`colors`,description:t,default:n}),a=(e,t,n)=>({name:e,type:`vec3`,description:t,default:n}),o=(e,t,n,r)=>({name:e,type:`enum`,description:t,options:n,default:r}),s=t(`segments`,`Smoothness (radial segments).`,32,3,256),c=[{id:`box`,description:`Box.`,params:[e(`width`,`Size on X.`,1,0),e(`height`,`Size on Y.`,1,0),e(`depth`,`Size on Z.`,1,0)],cost:`12`},{id:`roundedBox`,description:`Box with rounded edges (nice for UI-like blocks, dice, buttons).`,params:[e(`width`,`Size on X.`,1,0),e(`height`,`Size on Y.`,1,0),e(`depth`,`Size on Z.`,1,0),e(`radius`,`Corner radius.`,.1,0),t(`segments`,`Corner smoothness.`,4,1,16)],cost:`~500`},{id:`sphere`,description:`Sphere.`,params:[e(`radius`,`Radius.`,.5,0),s,t(`heightSegments`,`Vertical segments.`,24,2,256)],cost:`segments*heightSegments*2`},{id:`cylinder`,description:`Cylinder (different top/bottom radii make a truncated cone).`,params:[e(`radiusTop`,`Top radius.`,.5,0),e(`radiusBottom`,`Bottom radius.`,.5,0),e(`height`,`Height.`,1,0),s,n(`openEnded`,`No caps.`,!1)],cost:`segments*4`},{id:`cone`,description:`Cone.`,params:[e(`radius`,`Base radius.`,.5,0),e(`height`,`Height.`,1,0),s],cost:`segments*2`},{id:`capsule`,description:`Capsule (pill).`,params:[e(`radius`,`Radius.`,.3,0),e(`length`,`Length of the straight part.`,.6,0),t(`segments`,`Smoothness.`,16,2,64)],cost:`~1000`},{id:`torus`,description:`Torus (donut).`,params:[e(`radius`,`Ring radius.`,.5,0),e(`tube`,`Tube radius.`,.15,0),t(`radialSegments`,`Tube segments.`,24,2),t(`tubularSegments`,`Ring segments.`,64,3),e(`arc`,`Arc in degrees.`,360,0,360)],cost:`radialSegments*tubularSegments*2`},{id:`torusKnot`,description:`Torus knot (decorative).`,params:[e(`radius`,`Radius.`,.5,0),e(`tube`,`Tube radius.`,.15,0),t(`tubularSegments`,`Segments along the knot.`,128,3),t(`radialSegments`,`Tube segments.`,16,3),t(`p`,`Winds around its axis.`,2,1),t(`q`,`Winds around the torus interior.`,3,1)],cost:`tubularSegments*radialSegments*2`},{id:`plane`,description:`Flat rectangle facing +Z (rotate [-90,0,0] for a floor).`,params:[e(`width`,`Width.`,1,0),e(`height`,`Height.`,1,0),t(`widthSegments`,`Subdivisions (for shaders).`,1,1),t(`heightSegments`,`Subdivisions.`,1,1)],cost:`2`},{id:`circle`,description:`Flat disc facing +Z.`,params:[e(`radius`,`Radius.`,.5,0),s],cost:`segments`},{id:`ring`,description:`Flat ring facing +Z.`,params:[e(`innerRadius`,`Inner radius.`,.3,0),e(`outerRadius`,`Outer radius.`,.5,0),s],cost:`segments*2`},{id:`icosahedron`,description:`Icosahedron (detail 0 = low-poly gem, 3+ = smooth sphere).`,params:[e(`radius`,`Radius.`,.5,0),t(`detail`,`Subdivision.`,0,0,6)],cost:`20*4^detail`},{id:`dodecahedron`,description:`Dodecahedron.`,params:[e(`radius`,`Radius.`,.5,0),t(`detail`,`Subdivision.`,0,0,5)],cost:`36`},{id:`octahedron`,description:`Octahedron (diamond).`,params:[e(`radius`,`Radius.`,.5,0),t(`detail`,`Subdivision.`,0,0,5)],cost:`8`},{id:`tetrahedron`,description:`Tetrahedron (pyramid).`,params:[e(`radius`,`Radius.`,.5,0),t(`detail`,`Subdivision.`,0,0,5)],cost:`4`},{id:`lathe`,description:`Surface of revolution from a 2D profile (vases, bottles, chess pieces).`,params:[{name:`points`,type:`array`,description:`Profile [[x,y], …] (x = radius) from bottom to top.`,required:!0},s],cost:`points*segments*2`},{id:`extrude`,description:`Extruded 2D shape (stars, arrows, custom polygons).`,params:[{name:`shape`,type:`array`,description:`Polygon [[x,y], …] (closed automatically).`,required:!0},e(`depth`,`Extrusion depth.`,.2,0),e(`bevel`,`Bevel size.`,.02,0)],cost:`~points*20`},{id:`tube`,description:`Tube along a smooth curve through points (pipes, paths, ribbons).`,params:[{name:`points`,type:`array`,description:`Curve points [[x,y,z], …].`,required:!0},e(`radius`,`Tube radius.`,.05,0),t(`tubularSegments`,`Segments along the curve.`,64,2),t(`radialSegments`,`Segments around.`,8,3),n(`closed`,`Close the loop.`,!1)],cost:`tubularSegments*radialSegments*2`}],l=[{id:`plastic`,description:`Glossy plastic.`,props:{type:`physical`,color:`#e8e8e8`,roughness:.35,metalness:0,clearcoat:.3}},{id:`matte`,description:`Flat, non-reflective paint.`,props:{type:`standard`,color:`#d9d9d9`,roughness:.95,metalness:0}},{id:`clay`,description:`Soft clay / ceramic look (great for stylised scenes).`,props:{type:`standard`,color:`#e9dccb`,roughness:.8,metalness:0}},{id:`chrome`,description:`Mirror chrome (needs environment lighting).`,props:{type:`physical`,color:`#ffffff`,roughness:.05,metalness:1}},{id:`brushedMetal`,description:`Brushed steel.`,props:{type:`physical`,color:`#c8ccd2`,roughness:.35,metalness:1,anisotropy:.6}},{id:`gold`,description:`Polished gold.`,props:{type:`physical`,color:`#ffcf6b`,roughness:.15,metalness:1}},{id:`copper`,description:`Copper.`,props:{type:`physical`,color:`#e8926a`,roughness:.25,metalness:1}},{id:`glass`,description:`Clear refractive glass.`,props:{type:`physical`,color:`#ffffff`,roughness:.02,metalness:0,transmission:1,thickness:.5,ior:1.5}},{id:`frostedGlass`,description:`Frosted glass.`,props:{type:`physical`,color:`#ffffff`,roughness:.4,metalness:0,transmission:1,thickness:.8,ior:1.4}},{id:`rubber`,description:`Matte rubber.`,props:{type:`standard`,color:`#2b2b2b`,roughness:1,metalness:0}},{id:`pearl`,description:`Iridescent pearl.`,props:{type:`physical`,color:`#f4f1ee`,roughness:.25,metalness:0,iridescence:1,clearcoat:1}},{id:`holographic`,description:`Holographic iridescent foil.`,props:{type:`physical`,color:`#d7e3ff`,roughness:.15,metalness:.9,iridescence:1}},{id:`neon`,description:`Glowing neon (shines with bloom).`,props:{type:`standard`,color:`#ff2fd6`,emissive:`#ff2fd6`,emissiveIntensity:3,roughness:.5}},{id:`toon`,description:`Cel-shaded cartoon.`,props:{type:`toon`,color:`#ffb347`}},{id:`flat`,description:`Unlit flat colour (ignores lights).`,props:{type:`basic`,color:`#ffffff`}},{id:`lowpoly`,description:`Faceted low-poly shading.`,props:{type:`standard`,color:`#8bc34a`,roughness:.9,flatShading:!0}},{id:`velvet`,description:`Soft fabric with sheen.`,props:{type:`physical`,color:`#7b2d5b`,roughness:.9,sheen:1}},{id:`wireframe`,description:`Wireframe lines.`,props:{type:`basic`,color:`#7cf7ff`,wireframe:!0}},{id:`normal`,description:`Rainbow normals (debug / playful).`,props:{type:`normal`}},{id:`carPaint`,description:`Metallic car paint: sparkling flakes under a glossy clearcoat.`,props:{type:`physical`,color:`#b3121f`,metalness:.6,roughness:.4,clearcoat:1,clearcoatRoughness:.03,normalMap:{procedural:`flakes`,scale:40},normalScale:.2}},{id:`ceramic`,description:`Glazed ceramic / porcelain (soft body, glossy glaze).`,props:{type:`physical`,color:`#f3efe8`,roughness:.45,metalness:0,clearcoat:1,clearcoatRoughness:.06}},{id:`marble`,description:`Polished white marble with grey veins (procedural, triplanar-mapped: no UV stretching).`,props:{type:`physical`,color:`#ffffff`,roughness:.2,metalness:0,clearcoat:.4,clearcoatRoughness:.1,map:{procedural:`marble`},triplanar:.5}},{id:`terrazzo`,description:`Terrazzo stone with coloured chips (procedural, triplanar-mapped).`,props:{type:`physical`,color:`#ffffff`,roughness:.45,metalness:0,map:{procedural:`terrazzo`},triplanar:.5}},{id:`wood`,description:`Varnished wood grain (procedural texture).`,props:{type:`physical`,color:`#ffffff`,roughness:.5,metalness:0,clearcoat:.5,clearcoatRoughness:.2,map:{procedural:`wood`}}},{id:`carbonFiber`,description:`Woven carbon fibre under clearcoat (procedural texture).`,props:{type:`physical`,color:`#ffffff`,roughness:.35,metalness:.3,clearcoat:1,clearcoatRoughness:.04,map:{procedural:`carbon`,scale:12},anisotropy:.5}},{id:`leather`,description:`Fine-grain leather with soft sheen.`,props:{type:`physical`,color:`#6b3a22`,roughness:.62,metalness:0,sheen:.5,sheenRoughness:.5,sheenColor:`#c49a7a`,bumpMap:{procedural:`voronoi`,scale:60},bumpScale:.6}},{id:`satin`,description:`Satin fabric: soft anisotropic sheen.`,props:{type:`physical`,color:`#c9a0dc`,roughness:.4,metalness:0,sheen:1,sheenRoughness:.3,sheenColor:`#ffffff`,anisotropy:.4}},{id:`silk`,description:`Silk: bright, very soft sheen.`,props:{type:`physical`,color:`#f2d7c9`,roughness:.3,metalness:0,sheen:1,sheenRoughness:.2,sheenColor:`#fff4ec`,specularIntensity:.6}},{id:`brushedAluminium`,description:`Brushed aluminium with stretched (anisotropic) highlights.`,props:{type:`physical`,color:`#d9dce1`,roughness:.3,metalness:1,anisotropy:.85,roughnessMap:{procedural:`brushed`,scale:1}}},{id:`ice`,description:`Clear blue-tinted ice with a frosty surface.`,props:{type:`physical`,color:`#eaf8ff`,roughness:.1,metalness:0,transmission:1,thickness:1.2,ior:1.31,attenuationColor:`#8fd3ff`,attenuationDistance:1.2,bumpMap:{procedural:`noise`,scale:3},bumpScale:.4}},{id:`water`,description:`Liquid water: clear, slightly blue-green.`,props:{type:`physical`,color:`#ffffff`,roughness:.02,metalness:0,transmission:1,thickness:1,ior:1.333,attenuationColor:`#4fc3d9`,attenuationDistance:2}},{id:`diamond`,description:`Diamond: high IOR with rainbow dispersion (fire).`,props:{type:`physical`,color:`#ffffff`,roughness:0,metalness:0,transmission:1,thickness:2.5,ior:2.33,dispersion:8,specularIntensity:1,envMapIntensity:2.5,attenuationColor:`#dde8ff`,attenuationDistance:3}},{id:`gem`,description:`Coloured gemstone (ruby-like; change color/attenuationColor for sapphire, emerald…).`,props:{type:`physical`,color:`#ffe5ec`,roughness:0,metalness:0,transmission:1,thickness:1,ior:1.77,dispersion:2,attenuationColor:`#e0115f`,attenuationDistance:.5,envMapIntensity:1.4}},{id:`jelly`,description:`Gummy jelly: coloured, translucent, glossy.`,props:{type:`physical`,color:`#ff7aa2`,roughness:.12,metalness:0,transmission:.95,thickness:1.5,ior:1.35,attenuationColor:`#ff2d6f`,attenuationDistance:.6,clearcoat:1,clearcoatRoughness:.1}},{id:`chromeGradient`,description:"Chrome tinted by a colour ramp (set `gradient`).",props:{type:`gradient`,gradient:[`#7f5cff`,`#ff5ca8`,`#ffd36e`],metalness:1,roughness:.08}},{id:`soapBubble`,description:`Soap bubble: clear with thin-film rainbow reflections.`,props:{type:`physical`,color:`#ffffff`,roughness:0,metalness:0,transmission:1,thickness:.05,ior:1.1,iridescence:1,iridescenceIOR:1.33,iridescenceThicknessRange:[120,900],side:`double`}},{id:`mattePastel`,description:`Soft matte pastel with a velvety edge (stylised product renders).`,props:{type:`physical`,color:`#f7c8d8`,roughness:.75,metalness:0,sheen:.35,sheenRoughness:.8}},{id:`emissiveGradient`,description:"Glowing colour ramp (set `gradient`; blooms with postfx bloom).",props:{type:`gradient`,gradient:[`#00e5ff`,`#7c4dff`,`#ff3d9a`],emissive:`#ffffff`,emissiveIntensity:1.6,gradientEmissive:!0,roughness:.4}}],u=[{id:`plasma`,description:`Animated colourful plasma.`,params:[i(`colors`,`Palette.`,[`#ff006e`,`#8338ec`,`#3a86ff`]),e(`speed`,`Animation speed.`,1,0),e(`scale`,`Pattern scale.`,1,0)]},{id:`waves`,description:`Moving stripes / waves.`,params:[i(`colors`,`Two colours.`,[`#0b132b`,`#5bc0be`]),e(`speed`,`Speed.`,1,0),e(`frequency`,`Stripe frequency.`,8,0)]},{id:`noise`,description:`Animated smooth noise (clouds, smoke, marble).`,params:[i(`colors`,`Ramp colours.`,[`#1b1b3a`,`#ff9f1c`]),e(`speed`,`Speed.`,.3,0),e(`scale`,`Scale.`,2,0)]},{id:`hologram`,description:`Sci-fi hologram with scanlines and fresnel rim (transparent).`,params:[r(`color`,`Colour.`,`#38f9ff`),e(`speed`,`Scanline speed.`,1,0),e(`lines`,`Scanline count.`,80,0)]},{id:`gradientFlow`,description:`Smooth flowing multi-colour gradient (backgrounds, blobs).`,params:[i(`colors`,`Palette.`,[`#ff7eb3`,`#ff758c`,`#7afcff`,`#feffb7`]),e(`speed`,`Speed.`,.4,0)]},{id:`toonRim`,description:`Cartoon shading with coloured rim light.`,params:[r(`color`,`Base colour.`,`#ffb347`),r(`rim`,`Rim colour.`,`#ffffff`),t(`steps`,`Shading bands.`,3,1,8)]},{id:`dissolve`,description:"Noise dissolve driven by `uniforms.progress` (0..1) — animate it in the timeline.",params:[r(`color`,`Colour.`,`#ffffff`),r(`edge`,`Burning edge colour.`,`#ff7b00`),e(`progress`,`0 = solid, 1 = gone.`,0,0,1)]},{id:`gradientMesh`,description:`Animated mesh gradient (Stripe-like soft colour blobs) — perfect banner backdrop on a plane.`,params:[i(`colors`,`Up to 6 colours.`,[`#ff6ec4`,`#7873f5`,`#4adede`,`#ffd86f`]),e(`speed`,`Animation speed.`,.25,0),e(`scale`,`Blob scale (higher = more blobs).`,1,.1),e(`grain`,`Film grain amount.`,.04,0,1)]},{id:`aurora`,description:`Northern-lights curtains over a dark sky (planes, sky domes).`,params:[i(`colors`,`Curtain colours.`,[`#00ffa3`,`#00b3ff`,`#b400ff`]),r(`background`,`Sky colour.`,`#030714`),e(`speed`,`Speed.`,.3,0),e(`intensity`,`Brightness.`,1.2,0)]},{id:`liquidChrome`,description:`Flowing liquid chrome / metaballs with a coloured reflection ramp.`,params:[i(`colors`,`Reflection ramp.`,[`#0a0a12`,`#5a5f7a`,`#e8ecff`,`#9ab8ff`]),e(`speed`,`Flow speed.`,.35,0),e(`scale`,`Pattern scale.`,1.5,.1)]},{id:`nebula`,description:`Deep-space nebula with stars (star-nest style) — space backdrops.`,params:[i(`colors`,`Gas colours.`,[`#1b0b3b`,`#7b2ff7`,`#f72585`,`#4cc9f0`]),e(`speed`,`Drift speed.`,.05,0),e(`stars`,`Star density.`,1,0,3),e(`scale`,`Scale.`,1,.1)]},{id:`caustics`,description:`Underwater light caustics (pools, water floors, light patterns).`,params:[r(`color`,`Light colour.`,`#bff6ff`),r(`background`,`Base colour.`,`#05677d`),e(`speed`,`Speed.`,.5,0),e(`scale`,`Pattern scale.`,3,.1),e(`intensity`,`Brightness.`,1.4,0)]},{id:`fresnelGlow`,description:`Glowing rim (fresnel) — force fields, atmospheres, x-ray looks (additive, transparent).`,params:[r(`color`,`Rim colour.`,`#4cc9f0`),r(`core`,`Centre colour (black = see-through).`,`#000000`),e(`power`,`Rim sharpness.`,2.5,.1),e(`intensity`,`Brightness.`,1.5,0),e(`pulse`,`Pulse speed (0 = steady).`,0,0)]},{id:`iridescentFoil`,description:`Holographic foil: view-dependent rainbow with fine noise sparkle.`,params:[e(`speed`,`Shimmer speed.`,.3,0),e(`scale`,`Rainbow bands.`,2,.1),e(`sparkle`,`Glitter amount.`,.5,0,1),r(`tint`,`Tint.`,`#ffffff`)]},{id:`lavaLamp`,description:`Soft rising lava-lamp blobs (warm retro backdrops).`,params:[i(`colors`,`Background → blob colours.`,[`#2a0845`,`#ff512f`,`#f09819`]),e(`speed`,`Speed.`,.3,0),e(`scale`,`Blob size.`,1,.1)]},{id:`grainGradient`,description:`Static-friendly grainy gradient (editorial, film look).`,params:[i(`colors`,`Gradient colours.`,[`#ffb88c`,`#de6262`,`#4b1248`]),e(`angle`,`Gradient angle (degrees).`,30),e(`grain`,`Grain amount.`,.06,0,1),e(`speed`,`Grain animation (0 = static).`,0,0)]},{id:`matrixRain`,description:`Falling digital glyph rain (cyber / hacker look).`,params:[r(`color`,`Glyph colour.`,`#3dff7a`),r(`background`,`Background.`,`#000a03`),e(`speed`,`Fall speed.`,1,0),e(`columns`,`Columns across the surface.`,40,4,200)]}],d=[e(`scale`,`Pattern repeats across the texture.`,1,.05),t(`seed`,`Random seed.`,1),t(`resolution`,`Texture size in pixels.`,512,32,2048)],f=[{id:`marble`,description:`Veined marble.`,params:[i(`colors`,`Base → vein colours.`,[`#f4f2ee`,`#b9b6b1`,`#5d5a57`]),e(`veins`,`Vein sharpness.`,.6,0,1),e(`turbulence`,`Vein waviness.`,1,0),...d]},{id:`wood`,description:`Wood grain (rings + fibres).`,params:[i(`colors`,`Light → dark wood.`,[`#d9a066`,`#a0632f`,`#6b3a17`]),e(`rings`,`Growth rings.`,10,1),e(`grain`,`Fibre detail.`,.5,0,1),...d]},{id:`terrazzo`,description:`Terrazzo: stone chips in a cement base.`,params:[i(`colors`,`Base colour, then chip colours.`,[`#efe9e1`,`#e07a5f`,`#3d405b`,`#81b29a`,`#f2cc8f`]),e(`density`,`Chip density.`,.5,0,1),e(`chipSize`,`Chip size.`,1,.2,4),...d]},{id:`carbon`,description:`Twill-woven carbon fibre.`,params:[i(`colors`,`Dark → light fibre.`,[`#0b0b0d`,`#2a2c31`,`#5b5e66`]),...d]},{id:`noise`,description:`Smooth fractal noise (clouds, stains, variation, bump).`,params:[i(`colors`,`Ramp colours.`,[`#000000`,`#ffffff`]),t(`octaves`,`Detail layers.`,5,1,8),e(`contrast`,`Contrast.`,1,0),...d]},{id:`voronoi`,description:`Cells (leather grain, scales, cracked ground, stone).`,params:[i(`colors`,`Cell colour → border colour.`,[`#ffffff`,`#000000`]),e(`jitter`,`Cell irregularity.`,1,0,1),...d]},{id:`flakes`,description:`Metallic paint flakes — use as normalMap (sparkle) or roughnessMap.`,params:[i(`colors`,`Flake colours (map slot).`,[`#808080`,`#ffffff`]),e(`strength`,`Flake tilt (normal slot).`,.6,0,1),...d]},{id:`brushed`,description:`Brushed-metal streaks — use as roughnessMap or bumpMap.`,params:[i(`colors`,`Ramp colours.`,[`#9a9a9a`,`#d0d0d0`]),e(`streaks`,`Streak density.`,1,.1),...d]},{id:`grid`,description:`Grid lines (blueprint, tiles, sci-fi floors).`,params:[i(`colors`,`Background → line colours.`,[`#0b1d3a`,`#6fd3ff`]),t(`cells`,`Cells per texture side.`,8,1,256),e(`lineWidth`,`Line width (fraction of a cell).`,.04,0,.5),...d]},{id:`checker`,description:`Checkerboard.`,params:[i(`colors`,`Two colours.`,[`#ffffff`,`#222222`]),t(`cells`,`Cells per texture side.`,8,1,256),...d]},{id:`stripes`,description:`Stripes.`,params:[i(`colors`,`Alternating colours.`,[`#ffffff`,`#ff4d6d`]),t(`count`,`Stripes per texture side.`,8,1,256),e(`angle`,`Angle in degrees (0, 45, 90 tile seamlessly).`,0),e(`softness`,`Edge softness.`,.05,0,.5),...d]},{id:`dots`,description:`Polka dots.`,params:[i(`colors`,`Background → dot colours.`,[`#ffffff`,`#ff4d6d`]),t(`cells`,`Dots per texture side.`,8,1,256),e(`radius`,`Dot radius (fraction of a cell).`,.3,0,.5),...d]}],p=[e(`intensity`,`Overall brightness multiplier.`,1,0),e(`rotation`,`Rotate the whole rig around Y (degrees).`,0),n(`castShadow`,`Key light casts shadows.`,!0),e(`scale`,`Distance multiplier (big scenes).`,1,.05),r(`color`,`Tint mixed into every light (optional).`)],m=[{id:`studio-3point`,description:`Classic key / fill / rim: warm key with soft shadow, cool fill, bright back rim. Safe default for anything.`,params:p},{id:`softbox`,description:`Large overhead and side softboxes (area lights): soft wrap-around product lighting with long glossy highlights.`,params:p},{id:`product-top`,description:`Overhead softbox + two vertical strip lights: luxury product / packshot look (best on glossy and metal).`,params:p},{id:`rim`,description:`Two strong back rims (cool and warm) and a faint front fill: silhouettes and edge highlights on dark backgrounds.`,params:p},{id:`dramatic`,description:`One hard side key (spot) with deep shadows and a thin rim — moody, high contrast.`,params:p},{id:`golden-hour`,description:`Low warm sun with long shadows and a blue sky fill.`,params:p},{id:`noon`,description:`High white sun with crisp shadows and a sky-blue fill.`,params:p},{id:`overcast`,description:`Soft shadowless daylight (big sky dome, faint top key).`,params:p},{id:`neon`,description:`Magenta and cyan side lights (area panels) over a dark ambient — night / synthwave.`,params:p},{id:`moonlight`,description:`Cool blue moon key with soft shadows and a dim night-sky fill.`,params:p}],h=a(`axis`,`Axis.`,[0,1,0]),g=[{id:`rotate`,description:`Spin continuously.`,params:[h,e(`speed`,`Degrees per second.`,45)],example:{type:`rotate`,axis:[0,1,0],speed:30}},{id:`float`,description:`Gentle up-down floating (sine).`,params:[e(`amplitude`,`Height of the motion.`,.15,0),e(`speed`,`Cycles per second.`,.5,0),e(`phase`,`Phase offset (0..1) to desync objects.`,0)]},{id:`bob`,description:`Bouncy hop (abs sine) — characters, icons.`,params:[e(`height`,`Hop height.`,.3,0),e(`speed`,`Hops per second.`,1.5,0)]},{id:`pulse`,description:`Breathing scale.`,params:[e(`amount`,`Scale change (0.1 = ±10%).`,.08,0),e(`speed`,`Cycles per second.`,1,0)]},{id:`wobble`,description:`Jelly-like squash and stretch.`,params:[e(`amount`,`Intensity.`,.08,0),e(`speed`,`Speed.`,2,0)]},{id:`sway`,description:`Pendulum rotation back and forth (trees, signs).`,params:[a(`axis`,`Rotation axis.`,[0,0,1]),e(`angle`,`Max angle (degrees).`,8,0),e(`speed`,`Cycles per second.`,.5,0)]},{id:`orbit`,description:`Move in a circle around a centre.`,params:[a(`center`,`Centre (parent space).`,[0,0,0]),e(`radius`,`Radius.`,2,0),e(`speed`,`Degrees per second.`,30),h,n(`faceDirection`,`Turn to face the direction of travel.`,!1),e(`phase`,`Start angle (degrees).`,0)]},{id:`path`,description:`Follow a smooth path through points.`,params:[{name:`points`,type:`array`,description:`[[x,y,z], …].`,required:!0},e(`duration`,`Seconds per lap.`,5,0),n(`loop`,`Loop (closed curve).`,!0),n(`faceDirection`,`Look along the path.`,!0)]},{id:`followPointer`,description:`Lean / move toward the mouse or finger.`,params:[e(`strength`,`How far it moves (units).`,.5,0),e(`smoothing`,`0 = instant, 0.95 = very smooth.`,.9,0,.99),o(`mode`,`Move or rotate.`,[`move`,`rotate`,`both`],`rotate`)]},{id:`lookAtPointer`,description:`Turn to face the pointer (eyes, heads, turrets).`,params:[e(`maxAngle`,`Max rotation (degrees).`,35,0),e(`smoothing`,`Smoothing.`,.85,0,.99)]},{id:`hoverScale`,description:`Grow when hovered.`,params:[e(`scale`,`Scale when hovered.`,1.15,0),e(`smoothing`,`Smoothing.`,.8,0,.99)]},{id:`hoverLift`,description:`Rise and tilt when hovered (cards, products).`,params:[e(`height`,`Lift.`,.2),e(`tilt`,`Tilt toward the pointer (degrees).`,10)]},{id:`clickBounce`,description:`Squash-bounce on click / tap.`,params:[e(`amount`,`Intensity.`,.25,0)]},{id:`spinOnClick`,description:`Do a full spin on click (or each time the pointer enters, with trigger hover).`,params:[h,e(`duration`,`Seconds.`,.8,0),o(`trigger`,`What starts a spin: a click / tap, or the pointer entering the object.`,[`click`,`hover`],`click`)]},{id:`scrollRotate`,description:`Rotate with the page scroll.`,params:[h,e(`degrees`,`Rotation across the whole scroll range.`,360)]},{id:`scrollMove`,description:`Move with the page scroll (parallax depth).`,params:[a(`offset`,`Offset across the scroll range.`,[0,2,0])]},{id:`drift`,description:`Slow random wandering inside a box (fish, dust, balloons).`,params:[a(`area`,`Box size around the start position.`,[1,1,1]),e(`speed`,`Speed.`,.3,0),t(`seed`,`Random seed.`,1)]},{id:`blink`,description:`Toggle visibility / flicker (lights, signs, eyes).`,params:[e(`interval`,`Seconds between blinks.`,3,0),e(`duration`,`Blink length.`,.15,0),n(`random`,`Irregular timing.`,!0)]},{id:`colorCycle`,description:`Cycle the material colour through a palette.`,params:[i(`colors`,`Palette.`,[`#ff006e`,`#8338ec`,`#3a86ff`]),e(`speed`,`Colours per second.`,.5,0),n(`emissive`,`Also drive the emissive colour.`,!1)]},{id:`flicker`,description:`Random intensity flicker (fire, candles — on lights or emissive materials).`,params:[e(`amount`,`0..1.`,.3,0,1),e(`speed`,`Speed.`,8,0)]},{id:`billboard`,description:`Always face the camera (sprites, labels).`,params:[n(`lockY`,`Only rotate around Y.`,!0)]},{id:`appear`,description:`Entrance animation when the scene becomes visible.`,params:[o(`effect`,`Effect.`,[`scale`,`fade`,`rise`,`drop`,`spin`],`scale`),e(`duration`,`Seconds.`,.8,0),o(`ease`,`Easing.`,[`outBack`,`outCubic`,`outElastic`,`outBounce`],`outBack`)]},{id:`magnet`,description:`Pulled toward the pointer when close, springs back.`,params:[e(`radius`,`Influence radius (screen fraction 0..1).`,.25,0,1),e(`strength`,`Pull (units).`,.4,0)]},{id:`spring`,description:`Follow the pointer with spring physics (overshoot and settle) — lively cards, mascots.`,params:[e(`strength`,`Travel (units) at the canvas edge.`,.4,0),e(`stiffness`,`Spring stiffness (higher = snappier).`,120,1),e(`damping`,`Damping (lower = more bounce).`,12,0),e(`mass`,`Mass.`,1,.01),o(`mode`,`Move, lean (rotate) or both.`,[`move`,`rotate`,`both`],`move`),e(`angle`,`Lean at the edge (degrees, rotate mode).`,15,0)],example:{type:`spring`,mode:`both`,strength:.3,damping:9}},{id:`parallax`,description:`Depth layer moving with the pointer (and the page scroll) in proportion to its depth — stack layers with different depths.`,params:[e(`depth`,`0 = background, 1 = foreground (negative: opposite way).`,.5),e(`pointer`,`Pointer travel (units) at depth 1.`,.3),e(`scroll`,`Vertical travel (units) across the scroll range at depth 1.`,0),e(`smoothing`,`Smoothing.`,.9,0,.99)],example:{type:`parallax`,depth:1,pointer:.4}},{id:`tilt`,description:`Card tilt: leans toward the pointer, lifts and scales up (product cards, posters).`,params:[e(`maxAngle`,`Max tilt (degrees).`,12,0,60),e(`scale`,`Scale while active.`,1.04,0),e(`lift`,`Move toward the camera (units, +Z).`,.1),n(`hoverOnly`,`Only while the object is hovered (else whenever the pointer is over the canvas).`,!0),n(`reverse`,`Lean away from the pointer.`,!1),e(`smoothing`,`Smoothing.`,.86,0,.99)]},{id:`breathe`,description:`Organic breathing: slow inhale, shorter exhale, Y expands most (idle characters, blobs).`,params:[e(`amount`,`Scale change (0.04 = 4 %).`,.04,0),e(`period`,`Seconds per breath.`,4,.1),e(`rise`,`Rise at full inhale (units).`,.02),e(`phase`,`Phase offset (0..1).`,0)]},{id:`noise`,description:`Organic wandering from smooth noise: position + rotation (calmer, less repetitive than float / sway).`,params:[a(`amplitude`,`Position amplitude per axis (units).`,[.1,.1,.05]),a(`rotation`,`Rotation amplitude per axis (degrees).`,[3,3,2]),e(`speed`,`Speed.`,.3,0),t(`seed`,`Noise seed.`,1)]},{id:`lookAt`,description:`Turn to face another object, the camera or a point (smoothed). The object's front is +Z.`,params:[{name:`target`,type:`string`,description:`Object id or "camera" (default).`,default:`camera`},a(`point`,`Look at this point instead (parent space of the scene).`),e(`smoothing`,`Smoothing.`,.85,0,.99),n(`lockY`,`Only turn around the vertical axis.`,!1)],example:{type:`lookAt`,target:`hero`,lockY:!0}}],_=[{id:`terrain`,description:`Heightmap terrain with colour bands (low-poly or smooth): hills, mountains, islands, dunes, canyons, a lake basin ringed by mountains, a valley. Trees / rocks / grass / flowers with onTerrain sit on it (and stay below its snow).`,params:[e(`size`,`Width/depth.`,40,0),t(`resolution`,`Grid cells per side.`,96,8,512),e(`height`,`Max height.`,6,0),e(`scale`,`Noise scale (bigger = wider features).`,1,0),t(`octaves`,`Detail levels.`,5,1,8),o(`shape`,`Overall shape. basin = low flat floor in the middle (a lake with waterLevel ≈ 0.1 × height) ringed by mountains; valley = flat-floored valley running along z between mountain walls, closed by mountains at the far end (-z): a camera on +z looks down it.`,[`hills`,`mountains`,`island`,`dunes`,`canyon`,`basin`,`valley`,`flat`],`hills`),e(`edgeFalloff`,`Fraction (0..1) of the half-size over which the borders sink smoothly below 0 (no vertical cut walls at the edge). Default per shape: mountains 0.3, basin 0.2, valley 0.15, others 0.`,void 0,0,1),i(`palette`,`Colours from low to high (sand, grass, rock, snow).`,[`#e2c290`,`#6aa84f`,`#38761d`,`#7f6a5d`,`#ffffff`]),n(`lowpoly`,`Faceted shading.`,!0),e(`waterLevel`,`Water surface height in world units (absolute, not a fraction of height); null = no water.`,.6),r(`waterColor`,`Water colour.`,`#3d9bd6`),n(`waterPlane`,"Draw the built-in water plane at waterLevel. false = add your own `water` object at y = waterLevel (full control of colours, waves, foam); waterLevel still colours the shore and keeps trees / grass / flowers out of the lake.",!0),e(`snowLine`,`Height fraction (0..1, above the water) where the last palette colour (snow) caps the peaks; 1 = summit only. Relative to this terrain's own relief: use snowHeight for the same snow altitude across terrains.`,1,0,1),e(`snowHeight`,`Absolute snow altitude in terrain units (like waterLevel): everything above is snow-capped. Overrides snowLine.`,void 0,0)],cost:`resolution^2*2+(1-lowpoly)*max(resolution, 48)^2*2+~3200*lowpoly`,material:`The ground (not the water plane). Without colour / preset / map the palette bands are kept (e.g. { "roughness": 0.6, "flatShading": false }).`},{id:`trees`,description:`Scattered stylised trees.`,params:[t(`count`,`How many.`,30,1,2e3),a(`area`,`Scatter box (x, 0, z).`,[30,0,30]),o(`style`,`Tree style.`,[`pine`,`round`,`palm`,`birch`,`dead`,`mixed`],`mixed`),e(`minScale`,`Min scale.`,.7,0),e(`maxScale`,`Max scale.`,1.4,0),i(`leafColors`,`Foliage colours.`,[`#2e7d32`,`#43a047`,`#66bb6a`]),r(`trunkColor`,`Trunk colour.`,`#6d4c41`),n(`onTerrain`,`Drop onto a sibling terrain generator.`,!0),n(`sway`,`Wind sway animation.`,!0)],cost:`count*(70*style_pine+200*style_round+460*style_palm+430*style_birch+220*style_dead+212*style_mixed)`},{id:`rocks`,description:`Scattered low-poly rocks.`,params:[t(`count`,`How many.`,20,1,2e3),a(`area`,`Scatter box.`,[20,0,20]),e(`minSize`,`Min size.`,.3,0),e(`maxSize`,`Max size.`,1.5,0),i(`colors`,`Colours.`,[`#8d8d8d`,`#757575`,`#9e9e9e`]),n(`onTerrain`,`Drop onto a sibling terrain.`,!0)],cost:`count*40`,material:`Every rock. Without colour / preset / map the per-rock colours are kept.`},{id:`grass`,description:`Instanced grass blades swaying in the wind.`,params:[t(`count`,`Blades.`,5e3,1,1e5),a(`area`,`Area.`,[20,0,20]),e(`height`,`Blade height.`,.4,0),i(`colors`,`Colours (base → tip).`,[`#2d6a1f`,`#8bc34a`]),e(`wind`,`Wind strength.`,.5,0),n(`onTerrain`,`Follow a sibling terrain.`,!0)],cost:`count*3`},{id:`flowers`,description:`Scattered little flowers.`,params:[t(`count`,`How many.`,200,1,2e4),a(`area`,`Area.`,[20,0,20]),i(`colors`,`Petal colours.`,[`#ff5d8f`,`#ffd166`,`#ffffff`,`#9b5de5`]),n(`onTerrain`,`Follow a sibling terrain.`,!0)],cost:`count*56`},{id:`water`,description:`Animated stylised water: waves, shallow → deep colour from the terrain depth below, animated shore foam lines, ripple normals with a moving sun glint, fresnel.`,params:[e(`size`,`Width/depth.`,40,0),r(`color`,`Deep colour.`,`#1e6fa8`),r(`shallowColor`,`Shallow / crest colour.`,`#5ec8e5`),r(`foamColor`,`Foam colour.`,`#ffffff`),e(`waveHeight`,`Wave height.`,.15,0),e(`waveSpeed`,`Wave speed.`,1,0),e(`foam`,`Shore foam band width (depth units; 0 = none). Needs a sibling terrain below.`,.6,0),e(`ripples`,`Ripple normal strength (sun glint).`,1,0),e(`depthRange`,`Depth at which the colour is fully deep.`,3,.01),e(`opacity`,`Opacity.`,.9,0,1),n(`lowpoly`,`Faceted low-poly water (no ripples).`,!1),n(`reflections`,`Planar mirror reflections of the scene (mirror lakes at sunrise; lower waveHeight / ripples for a calm mirror). Costly: the scene is rendered a second time each frame (half resolution on the medium tier, off on the low tier).`,!1),e(`reflectivity`,`Reflection strength with reflections on (fresnel: stronger at grazing angles).`,.8,0,1)],cost:`min(size*(3-1.6*lowpoly), 160)^2*2`},{id:`clouds`,description:`Drifting clouds: soft puffy cotton balls (or faceted low-poly), bright tops, cool shadowed undersides, silver-lining rim.`,params:[t(`count`,`Clouds.`,8,1,200),a(`area`,`Area.`,[40,6,40]),e(`height`,`Altitude.`,10),e(`size`,`Cloud size factor.`,1,0),r(`color`,`Colour (lit tops).`,`#ffffff`),r(`shadowColor`,`Underside colour.`,`#a9bdd6`),e(`speed`,`Drift speed.`,.3,0),o(`style`,`puffy = smooth soft puffs, lowpoly = faceted.`,[`puffy`,`lowpoly`],`puffy`)],cost:`count*(2600-1950*style_lowpoly)`},{id:`city`,description:`Procedural city blocks with buildings (skylines, isometric towns).`,params:[t(`blocks`,`Blocks per side.`,6,1,40),e(`blockSize`,`Block size.`,4,0),e(`street`,`Street width.`,1.2,0),e(`minHeight`,`Min building height.`,1,0),e(`maxHeight`,`Max building height.`,8,0),i(`colors`,`Building colours.`,[`#e0e1dd`,`#778da9`,`#415a77`,`#ffd6a5`]),n(`windows`,`Lit windows (emissive).`,!0),r(`windowColor`,`Window colour.`,`#ffe8a3`),n(`trees`,`Street trees.`,!0)],cost:`blocks^2*(235+205*trees)`},{id:`character`,description:`Chibi character or mascot built from soft clay-like primitives on a real skeleton: expressive face (eyes with highlights, brows, mouth expressions), hair styles, outfits, accessories and procedural animations (idle, walk, run, wave, jump, dance, cheer, celebrate, sit, point, talk). Styles: humanoid, astronaut (bubble helmet), robot (glowing screen face), blob, cat, fox, bird, ghost.`,params:[o(`style`,`Body style.`,[`humanoid`,`astronaut`,`robot`,`blob`,`cat`,`fox`,`bird`,`ghost`],`humanoid`),r(`skin`,`Skin / fur / body colour (default per style).`),r(`shirt`,`Top / suit colour (robot: metal, blob: body, bird: wings; default per style).`),r(`pants`,`Bottom colour (robot: joints; default per style).`),r(`hair`,`Hair / brows colour (cat: stripes, fox: socks and ear tips, bird: crest; default per style).`),r(`accent`,`Accent: shoes, caps, scarves, robot glow, nose, beak (default per style).`),o(`expression`,`Facial expression (cheer / celebrate / dance / run switch the default happy face to a laugh).`,[`happy`,`laugh`,`neutral`,`surprised`,`wink`,`sad`,`angry`,`sleepy`],`happy`),o(`hairStyle`,`Hair style (humanoid).`,[`short`,`long`,`bob`,`bun`,`ponytail`,`spiky`,`curly`,`none`],`short`),o(`outfit`,`Outfit (humanoid).`,[`tshirt`,`hoodie`,`dress`,`suit`,`overalls`],`tshirt`),{name:`accessories`,type:`array`,description:`Accessories (humanoid / astronaut): any of cap, beanie, crown, glasses, sunglasses, headphones, backpack, scarf, bowtie.`,default:[],options:[`cap`,`beanie`,`glasses`,`sunglasses`,`headphones`,`backpack`,`scarf`,`bowtie`,`crown`]},o(`animation`,`Animation. sit = sitting on the ground; point = points to the screen right (mirror with scale [-1, 1, 1] to point left).`,[`idle`,`walk`,`run`,`wave`,`jump`,`dance`,`cheer`,`celebrate`,`sit`,`point`,`talk`,`none`],`idle`),e(`animationSpeed`,`Animation speed.`,1,0),e(`height`,`Total height.`,1.8,0),o(`shading`,`smooth = soft claymation, lowpoly = faceted (fewer triangles), toon = cel-shaded.`,[`smooth`,`lowpoly`,`toon`],`smooth`),n(`eyesFollowPointer`,`Head turns toward the pointer.`,!1)],cost:`(16100*style_humanoid+17300*style_astronaut+11600*style_robot+7700*style_blob+9500*style_cat+9800*style_fox+9100*style_bird+6400*style_ghost)*(1-0.82*shading_lowpoly)`},{id:`planet`,description:`Small stylised planet with continents, optional rings and atmosphere.`,params:[e(`radius`,`Radius.`,2,0),i(`palette`,`Ocean, land, mountain, ice.`,[`#2a6f97`,`#52b788`,`#8d6e63`,`#ffffff`]),e(`landAmount`,`0..1.`,.45,0,1),n(`rings`,`Rings.`,!1),r(`ringColor`,`Ring colour.`,`#e9c46a`),n(`atmosphere`,`Glow halo.`,!0),r(`atmosphereColor`,`Halo colour.`,`#8ecae6`),t(`detail`,`Subdivision.`,5,1,7),e(`spin`,`Globe rotation around its own (ring) axis in deg/s — use this rather than a rotate behaviour so the rings stay stable.`,0)],cost:`20*4^detail+~700`,material:`The globe surface (ocean + land; rings and atmosphere keep theirs). Without colour / preset / map the palette is kept.`},{id:`starfield`,description:`Large sphere of stars around the scene (space backdrops).`,params:[t(`count`,`Stars.`,3e3,1,5e4),e(`radius`,`Distance.`,80,0),i(`colors`,`Star colours.`,[`#ffffff`,`#cfe2ff`,`#ffe8c2`]),e(`size`,`Star size.`,.25,0),n(`twinkle`,`Twinkle.`,!0)],cost:`count`},{id:`blob`,description:`Organic animated blob (noise-displaced sphere) — modern hero banners.`,params:[e(`radius`,`Radius.`,1.2,0),e(`noise`,`Displacement amount.`,.3,0),e(`speed`,`Morph speed.`,.4,0),t(`detail`,`Smoothness.`,64,8,256),i(`colors`,`Colour ramp flowing over the surface (brand colours).`,[`#ff7eb3`,`#a78bfa`,`#60a5fa`,`#5eead4`])],cost:`detail^2*2`,material:`The whole blob; the morph keeps running with any material, shaders included (e.g. { "type": "shader", "shader": "gradientFlow" }, { "preset": "chrome" }). Without colour / preset / map the colour ramp is kept (e.g. { "type": "toon" }).`},{id:`waveGrid`,description:`Grid of points / bars rippling like a wave (tech / data banners).`,params:[t(`columns`,`Columns.`,60,2,400),t(`rows`,`Rows.`,30,2,400),e(`spacing`,`Spacing.`,.3,0),e(`amplitude`,`Wave height.`,.5,0),e(`speed`,`Speed.`,1,0),o(`shape`,`Element.`,[`dots`,`bars`,`lines`],`dots`),i(`colors`,`Colour ramp.`,[`#3a86ff`,`#ff006e`]),n(`pointerRipple`,`Ripple under the pointer.`,!0)],cost:`columns*rows*(1+shape_lines+11*shape_bars)`},{id:`maze`,description:`Grid maze walls from a seed (games).`,params:[t(`columns`,`Cells on X.`,10,2,60),t(`rows`,`Cells on Z.`,10,2,60),e(`cellSize`,`Cell size.`,2,0),e(`wallHeight`,`Wall height.`,1.5,0),r(`wallColor`,`Walls.`,`#5e548e`),r(`floorColor`,`Floor.`,`#e0b1cb`),n(`bodies`,`Add static physics bodies to walls.`,!0)],cost:`columns*rows*7`},{id:`road`,description:`Endless-runner road made of tiles that scroll toward the camera.`,params:[e(`width`,`Road width.`,6,0),e(`length`,`Visible length.`,60,0),t(`lanes`,`Lanes.`,3,1,8),r(`color`,`Asphalt.`,`#3d405b`),r(`lineColor`,`Lane lines.`,`#f4f1de`),e(`speed`,`Scroll speed (units/s), read by scripts as state.speed when set.`,10,0),i(`curbColors`,`Curb colours: two alternate (red / white kerbs); one = a solid curb (e.g. neon yellow).`,[`#e63946`,`#f1faee`]),n(`verge`,`Striped verges on both sides (false = road and curbs only, e.g. over a dark ground or a grid).`,!0),i(`vergeColor`,`Verge colours: two alternating stripes; one = that colour plus a slightly darker stripe.`,[`#7cc45a`,`#6bb44c`])],cost:`length*14+~220`},{id:`birds`,description:`Flock of stylised birds (one instanced draw call): V-shaped wings with a dihedral (a chevron from every angle), flapping in the shader and alternating with glides; boids-like flight (loose cloud or V formation, wander, banking into turns) that is a pure function of time. Modes: orbit (circle the area), path (closed loop through points), drift (cross the sky and wrap).`,params:[t(`count`,`Birds.`,12,1,500),o(`mode`,"Flight: orbit = flock circles an ellipse of radii area x/2, z/2 around the object position; path = closed loop through `points`; drift = crosses `area` x along `heading`, each bird wrapping around (keep the area wider than the view).",[`orbit`,`path`,`drift`],`orbit`),a(`area`,`Orbit ellipse (x, z = diameters) / drift length (x) and vertical drift range (y).`,[40,4,30]),{name:`points`,type:`array`,description:`path mode: [[x, y, z], …] (≥ 2 points, local to the object), flown as a closed smooth loop.`,default:[]},e(`heading`,`drift mode: direction in degrees around Y (0 = +x, left → right for a camera on +z; 180 = right → left; 90 = away from the camera).`,0),e(`speed`,`Flight speed (units/s).`,4,0),o(`formation`,"loose = a cloud of radius `spread` where each bird wanders; v = V formation (geese).",[`loose`,`v`],`loose`),e(`spread`,`loose formation radius.`,3,0),e(`size`,`Wingspan.`,1,.01),r(`color`,`Bird colour (each bird varies ±10 %). Dark reads as a silhouette against a bright sky.`,`#22252e`),e(`flapSpeed`,`Wing beats per second (each bird varies ±18 %).`,2.5,0)],example:{count:9,mode:`drift`,formation:`v`,area:[80,2,0],heading:10,speed:5,size:1.2},cost:`count*15`},{id:`floatingIsland`,description:`Stylised floating island diorama (hero favourite): grassy rolling top with a noisy outline, dirt band, rocky underside tapering to stalactite tips with coloured strata; optional trees, rocks, flowers, grass, a pond with a waterfall, floating debris and a slow bob.`,params:[e(`radius`,`Top radius.`,3,.1),e(`depth`,`Underside depth (top to tip).`,3.6,.1),e(`hills`,`Top relief (0 = flat lawn).`,1,0,4),i(`grassColors`,`Grass colours (dark → light).`,[`#4f9a3a`,`#7cc24a`,`#b5dd6a`]),r(`dirtColor`,`Dirt band colour.`,`#8a5a3c`),i(`rockColors`,`Rock strata colours of the underside.`,[`#7d6b5e`,`#93806f`,`#6a5a52`,`#a08c76`]),t(`trees`,`Trees planted on top.`,6,0,200),o(`treeStyle`,`Tree style.`,[`pine`,`round`,`palm`,`birch`,`dead`,`mixed`],`round`),i(`leafColors`,`Tree foliage colours.`,[`#2e7d32`,`#43a047`,`#7cb342`]),t(`rocks`,`Rocks on top.`,5,0,200),t(`flowers`,`Flowers on top.`,60,0,5e3),t(`grass`,`Grass blades on top.`,1500,0,3e4),n(`waterfall`,`Pond + waterfall pouring off the edge.`,!0),r(`waterColor`,`Pond / waterfall colour.`,`#4fc3f7`),t(`debris`,`Small rocks floating around.`,6,0,100),e(`float`,`Bob amplitude (0 = still).`,.12,0),n(`lowpoly`,`Faceted shading.`,!0)],cost:`~2500+7300*(1-lowpoly)+trees*220+grass*3+flowers*56`,material:`The island body (top + underside). Without colour / preset / map the vertex colours are kept.`},{id:`globe`,description:`Data globe for SaaS / network heroes: dot-matrix Earth (simplified continents), fresnel atmosphere, pulsing location markers and great-circle arcs with travelling light pulses between lat/lon points.`,params:[e(`radius`,`Radius.`,2,.1),t(`dots`,`Dot lattice density (dots on the whole sphere before the land mask).`,12e3,200,6e4),n(`continents`,`Dots only on land (simplified continents).`,!0),r(`dotColor`,`Land dot colour.`,`#7dd3fc`),r(`oceanDotColor`,`Ocean dot colour (same as baseColor = no ocean dots).`,`#0b1630`),r(`baseColor`,`Globe body colour.`,`#0b1630`),e(`dotSize`,`Dot size factor.`,1,0),{name:`points`,type:`array`,description:`Markers: [[lat, lon], …] or [{ "lat": 48.85, "lon": 2.35 }, …].`,default:[]},{name:`arcs`,type:`array`,description:`Arcs: [[[lat, lon], [lat, lon]], …] or [{ "from": [lat, lon], "to": [lat, lon] }, …]. Endpoints get markers.`,default:[]},r(`arcColor`,`Arc colour.`,`#f472b6`),e(`arcSpeed`,`Pulse speed along the arcs.`,1,0),e(`arcWidth`,`Arc thickness factor.`,1,0),r(`markerColor`,`Marker colour.`,`#fde68a`),e(`markerSize`,`Marker size factor.`,1,0),n(`atmosphere`,`Atmosphere glow.`,!0),r(`atmosphereColor`,`Atmosphere colour.`,`#38bdf8`),e(`spin`,`Rotation speed (deg/s).`,6),e(`longitude`,`Longitude facing the camera at t = 0 (degrees).`,0),e(`tilt`,`Axis tilt (degrees).`,12)],cost:`dots*(1.9+4.1*(1-continents))+~18000`,material:`The globe body sphere (dots, arcs and atmosphere keep theirs).`},{id:`crystals`,description:`Glowing gem crystals: faceted hexagonal prisms with pointed tips (cluster on a rock base, ring, or scatter), base → tip colour gradient, emissive fresnel glow that pulses. Pair with the bloom post effect.`,params:[t(`count`,`Crystals.`,14,1,400),e(`size`,`Height of a typical crystal.`,1.2,0),i(`colors`,`Gem colours (each crystal blends from one colour to the next).`,[`#7c3aed`,`#22d3ee`,`#f0abfc`]),o(`layout`,`Arrangement.`,[`cluster`,`ring`,`scatter`],`cluster`),e(`spread`,`Cluster radius / ring radius / scatter half-size.`,1,0),e(`glow`,`Emissive glow strength.`,.8,0),e(`pulse`,`Glow pulse amount (0 = steady).`,1,0),e(`opacity`,`Opacity (< 1 = translucent).`,1,0,1),n(`base`,`Rock base under a cluster.`,!0),r(`baseColor`,`Base rock colour.`,`#4b4560`)],cost:`count*16.5+~560*base*layout_cluster`,material:`The crystals (not the base). Without colour / preset / map the gradients are kept.`},{id:`galaxy`,description:`Spiral galaxy of soft additive stars: logarithmic arms, warm bulge, star-forming knots, glowing core and differential rotation (inner faster). Space / AI / tech heroes.`,params:[t(`count`,`Stars.`,4e4,100,3e5),e(`radius`,`Radius.`,6,.1),t(`arms`,`Spiral arms.`,3,1,8),e(`twist`,`Arm winding (radians from centre to rim).`,5,0),e(`thickness`,`Disc thickness (fraction of radius).`,.05,0),r(`coreColor`,`Core colour.`,`#ffd8a8`),r(`armColor`,`Outer arm colour.`,`#6d8bff`),r(`accentColor`,`Star-forming knots colour.`,`#ff7ac8`),e(`size`,`Star size.`,.035,0),e(`speed`,`Rotation speed.`,.3),e(`coreGlow`,`Core glow opacity.`,.9,0,1)],cost:`count`},{id:`bars3d`,description:`3D bar chart from data (row or grid) with rounded / box / cylinder bars, colour ramp by value / row / column, base plate and an eased staggered grow entrance (or a looping wave). Dashboards, stats, fintech heroes.`,params:[{name:`data`,type:`array`,description:`Values: [3, 5, 8] (one row) or [[3, 5], [4, 7]] (grid: rows go back in depth). Items may be { "value": n }.`,default:[3,5,4,7,6,9,8]},e(`barWidth`,`Bar width.`,.6,.01),e(`gap`,`Gap between bars.`,.25,0),e(`maxHeight`,`Height of the largest value.`,3,.01),i(`colors`,`Colour ramp (value) or palette (row / column).`,[`#93c5fd`,`#6366f1`,`#c026d3`]),o(`colorBy`,`What picks the colour.`,[`value`,`row`,`column`],`value`),o(`shape`,`Bar shape.`,[`rounded`,`box`,`cylinder`],`rounded`),o(`animation`,`grow = staggered entrance from t = 0; wave = looping ripple.`,[`grow`,`wave`,`none`],`grow`),e(`duration`,`Grow duration (s).`,1.6,.01),n(`base`,`Base plate.`,!0),r(`baseColor`,`Base plate colour.`,`#eef2ff`)],cost:`dataCells*(970*shape_rounded+12*shape_box+128*shape_cylinder)+~590`,material:`Every bar (per-bar colours are kept as instance colours).`},{id:`abstractShapes`,description:`Abstract Memphis / pastel composition for banners: spheres, tori, rings, pills, cones, cubes, half-discs, squiggles, triangles and stars evenly spread in a slab, gently floating and turning.`,params:[t(`count`,`Shapes.`,22,1,300),a(`area`,`Slab size (x, y, z).`,[10,4,2]),i(`colors`,`Palette.`,[`#ff8fab`,`#ffd166`,`#06d6a0`,`#118ab2`,`#a78bfa`,`#ff6b6b`]),{name:`shapes`,type:`array`,description:`Subset of shape kinds (default all): sphere, torus, ring, pill, cone, cube, halfDisc, squiggle, triangle, star.`,options:[`sphere`,`torus`,`ring`,`pill`,`cone`,`cube`,`halfDisc`,`squiggle`,`triangle`,`star`]},e(`minSize`,`Smallest shape size.`,.5,0),e(`maxSize`,`Largest shape size.`,1.6,0),o(`style`,`Material look.`,[`matte`,`glossy`,`toon`],`matte`),e(`motion`,`Float / spin amount (0 = still).`,1,0)],cost:`count*1250`,material:`Every shape (per-shape palette colours are kept as instance colours).`}],v=[`point`,`soft`,`square`,`circle`,`star`,`spark`,`streak`,`heart`,`bubble`,`smoke`,`petal`,`leaf`,`ring`],y=[t(`count`,`Number of particles (preset value when omitted; e.g. stars 900, snow 1200, fireflies 90).`,void 0,1,2e5),a(`area`,`Size [x, y, z] of the box the particles live in / are emitted from, centred on the object.`),{name:`size`,type:`number`,description:`Sprite size in units (world space).`,min:0},{name:`color`,type:`colors`,description:`A colour or a list of colours (each particle picks one), e.g. "#ffffff" or ["#ff006e", "#ffbe0b"].`},e(`speed`,"Speed in units/s along `direction` (0 = static).",void 0,0),a(`direction`,`Main direction of motion, e.g. [0, -1, 0] falls, [0, 1, 0] rises.`),e(`spread`,`Direction randomness 0 (parallel) … 1 (any direction).`,void 0,0,1),{name:`lifetime`,type:`number`,description:`Seconds a particle lives (emitters: sparks, embers, smoke…); omitted / 0 = forever (positions wrap inside the area).`,min:0},e(`opacity`,`Opacity 0…1.`,void 0,0,1),o(`blending`,`additive glows (sparks, magic, stars), normal keeps colours (snow, confetti, petals).`,[`normal`,`additive`]),o(`shape`,`Sprite shape.`,v),t(`seed`,`Random seed (same seed = same particles).`)],b=[{id:`stars`,description:`Twinkling static stars.`,params:y},{id:`snow`,description:`Falling soft snowflakes.`,params:y},{id:`rain`,description:`Falling rain streaks (velocity-stretched).`,params:y},{id:`fireflies`,description:`Glowing wandering dots.`,params:y},{id:`confetti`,description:`Colourful confetti falling and spinning.`,params:y},{id:`sparks`,description:`Sparks fountain: fast streaks arcing under gravity, cooling from yellow to red (additive). Small emitter area: place it at the source.`,params:y},{id:`dust`,description:`Slow floating dust motes.`,params:y},{id:`bubbles`,description:`Rising bubbles.`,params:y},{id:`embers`,description:`Rising glowing embers cooling to red.`,params:y},{id:`hearts`,description:`Rising little hearts.`,params:y},{id:`magic`,description:`Magic sparkles: twinkling star glints rising and shrinking (additive) — wands, reveals, product magic.`,params:y},{id:`smoke`,description:`Soft rising smoke puffs that grow and fade (noise-shaped). Small emitter area: place it at the chimney / source.`,params:y},{id:`fire`,description:`Flickering flame: additive noisy puffs rising fast, yellow → red, shrinking. Small emitter area: place it at the base of the fire.`,params:y},{id:`petals`,description:`Cherry-blossom petals drifting down, fluttering and spinning.`,params:y},{id:`leaves`,description:`Autumn leaves falling, fluttering and spinning.`,params:y},{id:`galaxyDust`,description:`Flat disc of twinkling cosmic dust slowly swirling (inner faster).`,params:y},{id:`bokeh`,description:`Big soft out-of-focus light orbs drifting (dreamy backgrounds).`,params:y}],x=[`none`,`cinematic`,`teal-orange`,`warm`,`cool`,`bleach`,`noir`,`vintage`,`pastel`],S=[`cinematic`,`product`,`dreamy`,`neon`,`retro`,`clean`],C={cinematic:{description:`Soft S-curve, slightly desaturated, teal shadows / warm highlights.`,values:{contrast:1.12,saturation:.92,vibrance:.1,shadows:`#2f6f86`,highlights:`#ffb27a`,toning:.32,lift:.015,gain:1.02}},"teal-orange":{description:`Blockbuster complementary split: teal shadows, orange skin / highlights.`,values:{contrast:1.18,saturation:1.05,vibrance:.2,shadows:`#1b6f8a`,highlights:`#ff9a4a`,toning:.55,gain:1.03}},warm:{description:`Golden-hour warmth.`,values:{temperature:.3,tint:.04,saturation:1.06,contrast:1.05,highlights:`#ffcf8f`,toning:.2}},cool:{description:`Crisp cool daylight / tech.`,values:{temperature:-.3,saturation:.96,contrast:1.06,shadows:`#2d5c9e`,toning:.22}},bleach:{description:`Bleach bypass: desaturated, punchy, metallic.`,values:{bleach:.65,saturation:.7,contrast:1.2}},noir:{description:`Black and white, deep contrast.`,values:{saturation:0,contrast:1.35,lift:-.02,gain:1.06}},vintage:{description:`Faded film print: lifted blacks, warm, muted greens.`,values:{saturation:.78,contrast:.92,lift:.07,gain:.96,temperature:.15,shadows:`#4f6a5a`,highlights:`#ffe0ae`,toning:.35}},pastel:{description:`Airy, soft and bright.`,values:{saturation:.82,contrast:.86,lift:.08,gamma:1.08,highlights:`#ffe3ef`,shadows:`#8a9fd8`,toning:.25}}},w={cinematic:{description:`Film-like: contact AO, restrained bloom, teal / orange grade, soft vignette, fine grain, supersampled stills.`,effects:[{type:`ao`,intensity:.9,radius:.6},{type:`bloom`,strength:.25,radius:.6,threshold:2.2,smoothing:.4},{type:`grading`,look:`cinematic`},{type:`vignette`,offset:1,darkness:.75},{type:`film`,intensity:.06},{type:`taa`,samples:8}]},product:{description:`Clean studio product shot: strong contact AO, crisp detail, neutral punchy grade, faint vignette, supersampled stills.`,effects:[{type:`ao`,intensity:1.1,radius:.5},{type:`bloom`,strength:.15,radius:.5,threshold:2.5,smoothing:.4},{type:`grading`,contrast:1.07,saturation:1.04,vibrance:.1},{type:`sharpen`,amount:.25},{type:`vignette`,offset:1.1,darkness:.4},{type:`taa`,samples:8}]},dreamy:{description:`Soft and glowing: wide bloom, pastel grade, gentle lens fringes, light vignette.`,effects:[{type:`bloom`,strength:.45,radius:.85,threshold:1,smoothing:.6},{type:`grading`,look:`pastel`},{type:`chromatic`,amount:.0015},{type:`vignette`,offset:1,darkness:.5},{type:`film`,intensity:.04}]},neon:{description:`Night-club neon: strong tight bloom, anamorphic streaks, saturated contrasty grade, deep vignette.`,effects:[{type:`bloom`,strength:1.3,radius:.55,threshold:.55,smoothing:.2},{type:`lensflare`,intensity:.45,threshold:1.4,streaks:1.2,ghosts:.2,halo:.1},{type:`grading`,contrast:1.15,saturation:1.2,vibrance:.2},{type:`chromatic`,amount:.001},{type:`vignette`,offset:.95,darkness:.95}]},retro:{description:`Old film / VHS: vintage faded grade, heavy grain + scanlines, fringes, strong vignette.`,effects:[{type:`grading`,look:`vintage`},{type:`film`,intensity:.3,scanlines:.25},{type:`chromatic`,amount:.0025,radial:!1},{type:`vignette`,offset:.9,darkness:1.2},{type:`bloom`,strength:.3,radius:.6,threshold:1.6,smoothing:.4}]},clean:{description:`Minimal polish for UI-like scenes: subtle contrast, light sharpening, faint vignette, supersampled stills. No FXAA (it softens small text; MSAA already smooths edges).`,effects:[{type:`grading`,contrast:1.04,saturation:1.02},{type:`sharpen`,amount:.15},{type:`vignette`,offset:1.2,darkness:.25},{type:`taa`,samples:8}]}},T=[{id:`look`,description:"Named look preset expanding into a tuned stack (`details.presets` lists exactly what each one expands to). Effects listed next to it override the matching expanded entry param by param.",params:[o(`preset`,`Look preset.`,S,`cinematic`),e(`intensity`,`Strength of the look (scales its effect amounts).`,1,0,1)],gpu:`medium`,example:{type:`look`,preset:`cinematic`},details:{presets:w}},{id:`bloom`,description:`Glow around bright / emissive parts (HDR threshold, 5-level mip blur).`,params:[e(`strength`,`Strength.`,.8,0),e(`radius`,`Radius / spread (0…1).`,.4,0),e(`threshold`,`Luminance threshold (HDR: >1 = only emissive / very bright parts).`,.85,0),e(`smoothing`,`Soft knee above the threshold (0 = hard cut).`,.1,0,1)],gpu:`medium`},{id:`ao`,description:`Ambient occlusion (GTAO): contact shading in creases and under objects — grounds them and makes scenes read as real. Best with a ground.`,params:[e(`intensity`,`Darkening amount.`,1,0,2),e(`radius`,`Sampling radius in scene units (≈ metres).`,.6,.01,10),e(`thickness`,`Assumed thickness of surfaces (larger = darker behind thin objects).`,1,.01,10),e(`falloff`,`Distance falloff (0 = none, 1 = smooth).`,1,0,1)],gpu:`high`,example:{type:`ao`,intensity:1,radius:.6}},{id:`outline`,description:`Cartoon outlines (toon look) from depth + normal edges.`,params:[r(`color`,`Line colour.`,`#000000`),e(`thickness`,`Thickness (CSS px).`,1,0)],gpu:`medium`},{id:`godrays`,description:`Light shafts (screen-space radial scattering) from the sky sun, a light or a point, occluded by objects.`,params:[{name:`source`,type:`string`,description:`Where the rays come from: "auto" (sky sun, else the first directional / spot light, else top centre), "sun", or a light id.`,default:`auto`},e(`intensity`,`Strength.`,.6,0,4),e(`length`,`Ray length (0…1 of the distance to the source).`,.85,0,1),e(`decay`,`Falloff along the ray.`,.96,.5,1),r(`color`,`Tint of the light source glow (default: the light / sun colour).`),e(`size`,`Size of the source glow (fraction of the screen).`,.1,0,1)],gpu:`medium`,example:{type:`godrays`,intensity:.7}},{id:`dof`,description:"Depth of field (bokeh disc blur). Blur = |depth − focus| × aperture (clamped to maxblur). `focusOn` keeps an object sharp wherever it moves.",params:[e(`focus`,`Focus distance from the camera (scene units).`,8,0),{name:`focusOn`,type:`string`,description:`Object id to autofocus on every frame (overrides focus).`},e(`aperture`,`Aperture: blur per unit of distance from the focus plane.`,.002,0),e(`maxblur`,`Max blur radius (fraction of the screen height).`,.01,0,.1)],gpu:`high`},{id:`lensflare`,description:`Procedural lens flare from HDR highlights: anamorphic streaks, ghosts and a halo (no textures).`,params:[e(`intensity`,`Overall strength.`,.5,0,4),e(`threshold`,`HDR luminance that flares (>1 = only very bright parts).`,1.2,0),e(`streaks`,`Anamorphic horizontal streaks amount.`,1,0,4),e(`ghosts`,`Ghost reflections amount.`,.5,0,4),e(`halo`,`Halo ring amount.`,.3,0,4),r(`tint`,`Streak colour.`,`#9fc4ff`)],gpu:`medium`,example:{type:`lensflare`,intensity:.6}},{id:`fxaa`,description:`Fast approximate antialiasing (smooths shader / texture edges MSAA misses). Cheap.`,params:[],gpu:`low`},{id:`smaa`,description:`Subpixel morphological antialiasing — sharper than FXAA.`,params:[],gpu:`medium`},{id:`taa`,description:"Supersampled stills: deterministic renders (agent3d render / poster / video), the reduced-motion still and paused frames accumulate `samples` sub-pixel-jittered frames (perfect edges, smooth AO / shadows). No cost while playing.",params:[t(`samples`,`Jittered frames per still.`,8,2,64)],gpu:`low`,example:{type:`taa`,samples:8}},{id:`tiltshift`,description:`Tilt-shift miniature look: blur above and below a sharp horizontal band.`,params:[e(`focus`,`Vertical centre of the sharp band (0 = bottom, 1 = top).`,.5,0,1),e(`width`,`Half height of the sharp band (fraction of the screen).`,.18,0,1),e(`blur`,`Blur strength.`,1,0,4)],gpu:`medium`},{id:`pixelate`,description:`Retro pixels.`,params:[t(`pixelSize`,`Pixel size (CSS px).`,4,1,32)],gpu:`low`},{id:`halftone`,description:`Print halftone dots (comic / risograph banners).`,params:[e(`size`,`Dot spacing (CSS px).`,6,2,64),e(`angle`,`Screen angle in degrees.`,45),n(`mono`,`Black ink only (else CMYK colour dots).`,!1)],gpu:`low`},{id:`ascii`,description:`ASCII-art characters (procedural 5×5 glyphs).`,params:[e(`size`,`Cell size (CSS px).`,8,4,64),n(`mono`,`Single ink colour instead of the scene colours.`,!1),r(`color`,`Ink colour when mono.`,`#33ff88`)],gpu:`low`},{id:`glitch`,description:`Digital glitch: block displacement, RGB split, scan jitter (deterministic, driven by time).`,params:[e(`amount`,`Strength (0…1).`,.5,0,1),e(`speed`,`Glitch bursts per second.`,1,0,20)],gpu:`low`},{id:`chromatic`,description:`Chromatic aberration: RGB fringes growing towards the edges (dreamy / lens).`,params:[e(`amount`,`Shift amount (fraction of the screen).`,.002,0,.05),n(`radial`,`Radial lens fringes (false = uniform diagonal shift).`,!0)],gpu:`low`},{id:`sharpen`,description:`Unsharp-mask sharpening (crisper details after AA / blur).`,params:[e(`amount`,`Strength.`,.3,0,2)],gpu:`low`},{id:`grading`,description:"Colour grading in one pass: a procedural `look` LUT + exposure, white balance, contrast, lift / gamma / gain, split toning, saturation.",params:[o(`look`,`Procedural look (see GRADING_LOOKS).`,x,`none`),e(`intensity`,`Strength of the look.`,1,0,1),e(`exposure`,`Exposure in stops.`,0,-5,5),e(`contrast`,`Contrast (S-curve, 1 = neutral).`,1,0,3),e(`saturation`,`Saturation (0 = grey).`,1,0,3),e(`vibrance`,`Saturates muted colours more than vivid ones.`,0,-1,1),e(`temperature`,`White balance: −1 cool … +1 warm.`,0,-1,1),e(`tint`,`White balance: −1 green … +1 magenta.`,0,-1,1),e(`lift`,`Raises (or crushes, < 0) the blacks.`,0,-.5,.5),e(`gamma`,`Midtones (>1 brighter).`,1,.2,5),e(`gain`,`Highlights multiplier.`,1,0,3),r(`shadows`,"Split toning: shadow tint colour (with `toning`)."),r(`highlights`,"Split toning: highlight tint colour (with `toning`)."),e(`toning`,`Split toning strength.`,0,0,1),e(`bleach`,`Bleach bypass (silver retention) amount.`,0,0,1)],gpu:`low`,example:{type:`grading`,look:`teal-orange`,intensity:.8},details:{looks:C}},{id:`vignette`,description:`Darker (or tinted) edges.`,params:[e(`offset`,`Size (bigger = smaller vignette).`,1,0),e(`darkness`,`Darkness.`,1.1,0),r(`color`,`Vignette colour.`,`#000000`)],gpu:`low`},{id:`film`,description:`Film grain (luma-weighted, deterministic) + optional scanlines.`,params:[e(`intensity`,`Grain.`,.35,0,1),n(`grayscale`,`Black and white.`,!1),e(`scanlines`,`Scanlines strength.`,0,0,1),e(`size`,`Grain size (CSS px).`,1.5,.5,8)],gpu:`low`}],E=[{id:`sans-bold`,description:`Inter Bold — clean neo-grotesk, the default: headlines, UI-like titles.`,params:[]},{id:`sans`,description:`Inter Regular — subtitles, taglines, small labels.`,params:[]},{id:`inter-black`,description:`Inter Black — heavy, punchy headlines (tech, sport, sales).`,params:[]},{id:`montserrat-extrabold`,description:`Montserrat ExtraBold — wide geometric sans: bold brand titles, posters.`,params:[]},{id:`space-grotesk-bold`,description:`Space Grotesk Bold — quirky tech grotesk (startups, crypto, dev tools).`,params:[]},{id:`bebas-neue`,description:`Bebas Neue — tall condensed all-caps display: banners, cinema, sport.`,params:[]},{id:`anton`,description:`Anton — heavy condensed impact display: loud banners, sales.`,params:[]},{id:`serif-bold`,description:`Playfair Display Bold — elegant high-contrast serif (luxury, editorial, food).`,params:[]},{id:`serif`,description:`Playfair Display Regular — refined serif for subtitles and quotes.`,params:[]},{id:`mono`,description:`JetBrains Mono Bold — monospace (tech, code, terminal looks); no kerning by design.`,params:[]},{id:`display`,description:`Fredoka SemiBold — rounded, friendly (kids, games, playful brands).`,params:[]},{id:`pacifico`,description:`Pacifico — brush script (retro, surf, cafés, handwritten feel).`,params:[]},{id:`lobster`,description:`Lobster — bold connected script (retro signage, bakery, vintage).`,params:[]}],D=[{id:`coin`,description:`Pickup / coin.`,params:[]},{id:`jump`,description:`Jump.`,params:[]},{id:`hit`,description:`Hit / damage.`,params:[]},{id:`explosion`,description:`Explosion.`,params:[]},{id:`click`,description:`UI click.`,params:[]},{id:`powerup`,description:`Power-up arpeggio.`,params:[]},{id:`laser`,description:`Laser shot.`,params:[]},{id:`win`,description:`Victory jingle.`,params:[]},{id:`lose`,description:`Game over.`,params:[]},{id:`whoosh`,description:`Whoosh.`,params:[]},{id:`ambient-pad`,description:`Soft looping pad (music).`,params:[]},{id:`chiptune-loop`,description:`Cheerful chiptune loop (music).`,params:[]}],O={geometries:c,materialPresets:l,shaders:u,textures:f,lightRigs:m,behaviours:g,generators:_,particlePresets:b,instanceLayouts:[{id:`grid`,description:`Regular 3D grid centred on the object: count [nx, ny, nz] copies spaced by spacing [sx, sy, sz] (use 1 / 0 for a flat axis).`,params:[{name:`count`,type:`vec3`,description:`Copies per axis [nx, ny, nz] (integers ≥ 1).`,required:!0},{name:`spacing`,type:`vec3`,description:`Distance between copies per axis [sx, sy, sz] in units.`,required:!0}],cost:`count[0]*count[1]*count[2] * geometry`,example:{type:`grid`,count:[8,1,8],spacing:[1.2,0,1.2]}},{id:`scatter`,description:`Random positions inside a box (seeded): forests of props, rocks, debris.`,params:[{...t(`count`,`Number of copies.`,void 0,1,2e5),required:!0},{name:`area`,type:`vec3`,description:`Box size [x, y, z] centred on the object (y 0 = on a plane).`,required:!0},e(`minScale`,`Smallest random uniform scale.`,1,0),e(`maxScale`,`Largest random uniform scale.`,1,0),n(`randomRotation`,`Random rotation around Y.`,!1),t(`seed`,`Random seed (same seed = same layout).`)],cost:`count * geometry`,example:{type:`scatter`,count:200,area:[20,0,20],minScale:.6,maxScale:1.4,randomRotation:!0,seed:3}},{id:`circle`,description:`Copies evenly spaced on a horizontal circle (XZ plane) around the object.`,params:[{...t(`count`,`Number of copies.`,void 0,1,2e5),required:!0},{...e(`radius`,`Circle radius in units.`,void 0,0),required:!0}],cost:`count * geometry`,example:{type:`circle`,count:12,radius:3}},{id:`list`,description:`Explicit transforms, one copy per item: [{ position, rotation?, scale? }] (rotation in degrees, scale a number or [x, y, z]).`,params:[{name:`items`,type:`array`,description:`Transforms [{ "position": [x, y, z], "rotation"?: [x, y, z], "scale"?: n | [x, y, z] }, …].`,required:!0}],cost:`items * geometry`,example:{type:`list`,items:[{position:[-1,0,0]},{position:[1,0,0],rotation:[0,45,0],scale:1.5}]}}],postfx:T,fonts:E,sounds:D};function k(e,t){return O[e].find(e=>e.id===t)}function A(e){return l.find(t=>t.id===e)}export{f as _,c as a,l as c,v as d,T as f,D as g,u as h,_ as i,y as l,S as m,O as n,C as o,w as p,E as r,m as s,g as t,b as u,k as v,A as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{OrbitControls as e}from"./OrbitControls-MlE9XiCg.js";import{Bt as t,En as n,Ft as r,Ht as i,I as a,In as o,It as s,Kt as c,Ln as l,N as u,Pt as d,Qt as f,Rt as p,St as m,T as h,an as g,at as _,bt as v,d as y,f as b,h as x,hn as ee,it as te,m as S,mn as C,nt as w,on as T,p as E,st as D,vt as O,w as ne,x as k,xt as A,yn as re,zt as ie}from"./three.module-CnI50X0U.js";import{r as ae}from"./camera-C0sxfRxy.js";import{a as j,i as M,n as N,o as oe}from"./index-C2nMYSoW.js";var P=new f,F=new l,I=new l,L=new c,se={X:new l(1,0,0),Y:new l(0,1,0),Z:new l(0,0,1)},R={type:`change`},z={type:`mouseDown`,mode:null},ce={type:`mouseUp`,mode:null},le={type:`objectChange`},ue=class extends ne{constructor(e,t=null){super(void 0,t);let n=new ve(this);this._root=n;let r=new ye;this._gizmo=r,n.add(r);let i=new be;this._plane=i,n.add(i);let a=this;function o(e,t){let n=t;Object.defineProperty(a,e,{get:function(){return n===void 0?t:n},set:function(t){n!==t&&(n=t,i[e]=t,r[e]=t,a.dispatchEvent({type:e+`-changed`,value:t}),a.dispatchEvent(R))}}),a[e]=t,i[e]=t,r[e]=t}o(`camera`,e),o(`object`,void 0),o(`enabled`,!0),o(`axis`,null),o(`mode`,`translate`),o(`translationSnap`,null),o(`rotationSnap`,null),o(`scaleSnap`,null),o(`space`,`world`),o(`size`,1),this.viewport=null,o(`dragging`,!1),o(`showX`,!0),o(`showY`,!0),o(`showZ`,!0),o(`showXY`,!0),o(`showYZ`,!0),o(`showXZ`,!0),o(`showXYZE`,!0),o(`showE`,!0),o(`minX`,-1/0),o(`maxX`,1/0),o(`minY`,-1/0),o(`maxY`,1/0),o(`minZ`,-1/0),o(`maxZ`,1/0);let s=new l,u=new l,d=new c,f=new c,p=new l,m=new c,h=new l,g=new l,_=new l,v=new l;o(`worldPosition`,s),o(`worldPositionStart`,u),o(`worldQuaternion`,d),o(`worldQuaternionStart`,f),o(`cameraPosition`,p),o(`cameraQuaternion`,m),o(`pointStart`,h),o(`pointEnd`,g),o(`rotationAxis`,_),o(`rotationAngle`,0),o(`eye`,v),this._offset=new l,this._startNorm=new l,this._endNorm=new l,this._cameraScale=new l,this._parentPosition=new l,this._parentQuaternion=new c,this._parentQuaternionInv=new c,this._parentScale=new l,this._worldScaleStart=new l,this._worldQuaternionInv=new c,this._worldScale=new l,this._positionStart=new l,this._quaternionStart=new c,this._scaleStart=new l,this._getPointer=de.bind(this),this._onPointerDown=pe.bind(this),this._onPointerHover=fe.bind(this),this._onPointerMove=me.bind(this),this._onPointerUp=he.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointermove`,this._onPointerHover),this.domElement.addEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointermove`,this._onPointerHover),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=``}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&P.setFromCamera(e,this.camera);let t=B(this._gizmo.picker[this.mode],P);this.axis=t?t.object.name:null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&P.setFromCamera(e,this.camera);let t=B(this._plane,P,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,z.mode=this.mode,this.dispatchEvent(z)}}pointerMove(e){let t=this.axis,n=this.mode,r=this.object,i=this.space;if(n===`scale`?i=`local`:(t===`E`||t===`XYZE`||t===`XYZ`)&&(i=`world`),r===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&P.setFromCamera(e,this.camera);let a=B(this._plane,P,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),n===`translate`)this._offset.copy(this.pointEnd).sub(this.pointStart),i===`local`&&t!==`XYZ`&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf(`X`)===-1&&(this._offset.x=0),t.indexOf(`Y`)===-1&&(this._offset.y=0),t.indexOf(`Z`)===-1&&(this._offset.z=0),i===`local`&&t!==`XYZ`?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i===`local`&&(r.position.applyQuaternion(L.copy(this._quaternionStart).invert()),t.search(`X`)!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),i===`world`&&(r.getWorldPosition(F),t.search(`X`)!==-1&&(F.x=Math.round(F.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(F.y=Math.round(F.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(F.z=Math.round(F.z/this.translationSnap)*this.translationSnap),r.position.copy(r.parent.worldToLocal(F)))),r.position.x=Math.max(this.minX,Math.min(this.maxX,r.position.x)),r.position.y=Math.max(this.minY,Math.min(this.maxY,r.position.y)),r.position.z=Math.max(this.minZ,Math.min(this.maxZ,r.position.z));else if(n===`scale`){if(t.search(`XYZ`)!==-1){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),I.set(e,e,e)}else F.copy(this.pointStart),I.copy(this.pointEnd),F.applyQuaternion(this._worldQuaternionInv),I.applyQuaternion(this._worldQuaternionInv),I.divide(F),t.search(`X`)===-1&&(I.x=1),t.search(`Y`)===-1&&(I.y=1),t.search(`Z`)===-1&&(I.z=1);r.scale.copy(this._scaleStart).multiply(I),this.scaleSnap&&(t.search(`X`)!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Y`)!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Z`)!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n===`rotate`){this._offset.copy(this.pointEnd).sub(this.pointStart);let e=20/this.worldPosition.distanceTo(F.setFromMatrixPosition(this.camera.matrixWorld)),n=!1;t===`XYZE`?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(F.copy(this.rotationAxis).cross(this.eye))*e):(t===`X`||t===`Y`||t===`Z`)&&(this.rotationAxis.copy(se[t]),F.copy(se[t]),i===`local`&&F.applyQuaternion(this.worldQuaternion),F.cross(this.eye),F.length()===0?n=!0:this.rotationAngle=this._offset.dot(F.normalize())*e),(t===`E`||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i===`local`&&t!==`E`&&t!==`XYZE`?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(L.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(L.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(R),this.dispatchEvent(le)}}pointerUp(e){(e===null||e.button===0)&&(this.dragging&&this.axis!==null&&(ce.mode=this.mode,this.dispatchEvent(ce)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(R),this.dispatchEvent(le),this.pointStart.copy(this.pointEnd))}getRaycaster(){return P}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}setColors(e,t,n,r){let i=this._gizmo.materialLib;i.xAxis.color.set(e),i.yAxis.color.set(t),i.zAxis.color.set(n),i.active.color.set(r),i.xAxisTransparent.color.set(e),i.yAxisTransparent.color.set(t),i.zAxisTransparent.color.set(n),i.activeTransparent.color.set(r),i.xAxis._color&&i.xAxis._color.set(e),i.yAxis._color&&i.yAxis._color.set(t),i.zAxis._color&&i.zAxis._color.set(n),i.active._color&&i.active._color.set(r),i.xAxisTransparent._color&&i.xAxisTransparent._color.set(e),i.yAxisTransparent._color&&i.yAxisTransparent._color.set(t),i.zAxisTransparent._color&&i.zAxisTransparent._color.set(n),i.activeTransparent._color&&i.activeTransparent._color.set(r)}};function de(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{let t=this.domElement.getBoundingClientRect(),n=this.viewport,r,i,a,o;return n===null?(r=0,i=0,a=t.width,o=t.height):(r=n.x,i=t.height-n.y-n.w,a=n.z,o=n.w),{x:(e.clientX-t.left-r)/a*2-1,y:-(e.clientY-t.top-i)/o*2+1,button:e.button}}}function fe(e){if(this.enabled)switch(e.pointerType){case`mouse`:case`pen`:this.pointerHover(this._getPointer(e))}}function pe(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function me(e){this.enabled&&this.pointerMove(this._getPointer(e))}function he(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.pointerUp(this._getPointer(e)))}function B(e,t,n){let r=t.intersectObject(e,!0);for(let e=0;e<r.length;e++)if(r[e].object.visible||n)return r[e];return!1}var V=new u,H=new l(0,1,0),ge=new l(0,0,0),_e=new v,U=new c,W=new c,G=new l,K=new v,q=new l(1,0,0),J=new l(0,1,0),Y=new l(0,0,1),X=new l,Z=new l,Q=new l,ve=class extends d{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){let t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error(`TransformControls: The attached 3D object must be a part of the scene graph.`):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),this.parent&&(K.copy(this.parent.matrixWorld).invert(),K.decompose(this.position,this.quaternion,this.scale)),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}},ye=class extends d{constructor(){super(),this.isTransformControlsGizmo=!0,this.type=`TransformControlsGizmo`;let e=new m({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new te({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;let o=t.clone();o.opacity=.5;let s=e.clone();s.color.setHex(16711680);let c=e.clone();c.color.setHex(65280);let l=e.clone();l.color.setHex(255);let u=e.clone();u.color.setHex(16711680),u.opacity=.5;let f=e.clone();f.color.setHex(65280),f.opacity=.5;let p=e.clone();p.color.setHex(255),p.opacity=.5;let g=e.clone();g.opacity=.25;let _=e.clone();_.color.setHex(16776960),_.opacity=.25;let v=e.clone();v.color.setHex(16776960);let y=e.clone();y.color.setHex(7895160),this.materialLib={xAxis:s,yAxis:c,zAxis:l,active:v,xAxisTransparent:u,yAxisTransparent:f,zAxisTransparent:p,activeTransparent:_};let b=new h(0,.04,.1,12);b.translate(0,.05,0);let S=new E(.08,.08,.08);S.translate(0,.04,0);let C=new x;C.setAttribute(`position`,new a([0,0,0,1,0,0],3));let T=new h(.0075,.0075,.5,3);T.translate(0,.25,0);function D(e,t){let r=new n(e,.0075,3,64,t*Math.PI*2);return r.rotateY(Math.PI/2),r.rotateX(Math.PI/2),r}function O(){let e=new x;return e.setAttribute(`position`,new a([0,0,0,1,1,1],3)),e}let ne={X:[[new A(b,s),[.5,0,0],[0,0,-Math.PI/2]],[new A(b,s),[-.5,0,0],[0,0,Math.PI/2]],[new A(T,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new A(b,c),[0,.5,0]],[new A(b,c),[0,-.5,0],[Math.PI,0,0]],[new A(T,c)]],Z:[[new A(b,l),[0,0,.5],[Math.PI/2,0,0]],[new A(b,l),[0,0,-.5],[-Math.PI/2,0,0]],[new A(T,l),null,[Math.PI/2,0,0]]],XYZ:[[new A(new r(.1,0),g),[0,0,0]]],XY:[[new A(new E(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new A(new E(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]]},k={X:[[new A(new h(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new A(new h(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new A(new h(.2,0,.6,4),i),[0,.3,0]],[new A(new h(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new A(new h(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new A(new h(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new A(new r(.2,0),i)]],XY:[[new A(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new A(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},re={START:[[new A(new r(.01,2),o),null,null,null,`helper`]],END:[[new A(new r(.01,2),o),null,null,null,`helper`]],DELTA:[[new w(O(),o),null,null,null,`helper`]],X:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new w(C,o),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new w(C,o),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]},ie={XYZE:[[new A(D(.5,1),y),null,[0,Math.PI/2,0]]],X:[[new A(D(.5,.5),s)]],Y:[[new A(D(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new A(D(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new A(D(.75,1),_),null,[0,Math.PI/2,0]]]},ae={AXIS:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]]},j={XYZE:[[new A(new ee(.25,10,8),i)]],X:[[new A(new n(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new A(new n(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new A(new n(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new A(new n(.75,.1,2,24),i)]]},M={X:[[new A(S,s),[.5,0,0],[0,0,-Math.PI/2]],[new A(T,s),[0,0,0],[0,0,-Math.PI/2]],[new A(S,s),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new A(S,c),[0,.5,0]],[new A(T,c)],[new A(S,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new A(S,l),[0,0,.5],[Math.PI/2,0,0]],[new A(T,l),[0,0,0],[Math.PI/2,0,0]],[new A(S,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new A(new E(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new A(new E(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new A(new E(.1,.1,.1),g)]]},N={X:[[new A(new h(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new A(new h(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new A(new h(.2,0,.6,4),i),[0,.3,0]],[new A(new h(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new A(new h(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new A(new h(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new A(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new A(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new A(new E(.2,.2,.2),i),[0,0,0]]]},oe={X:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new w(C,o),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new w(C,o),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]};function P(e){let t=new d;for(let n in e)for(let r=e[n].length;r--;){let i=e[n][r][0].clone(),a=e[n][r][1],o=e[n][r][2],s=e[n][r][3],c=e[n][r][4];i.name=n,i.tag=c,a&&i.position.set(a[0],a[1],a[2]),o&&i.rotation.set(o[0],o[1],o[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix();let l=i.geometry.clone();l.applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),t.add(i)}return t}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(ne)),this.add(this.gizmo.rotate=P(ie)),this.add(this.gizmo.scale=P(M)),this.add(this.picker.translate=P(k)),this.add(this.picker.rotate=P(j)),this.add(this.picker.scale=P(N)),this.add(this.helper.translate=P(re)),this.add(this.helper.rotate=P(ae)),this.add(this.helper.scale=P(oe)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){let t=(this.mode===`scale`?`local`:this.space)===`local`?this.worldQuaternion:W;this.gizmo.translate.visible=this.mode===`translate`,this.gizmo.rotate.visible=this.mode===`rotate`,this.gizmo.scale.visible=this.mode===`scale`,this.helper.translate.visible=this.mode===`translate`,this.helper.rotate.visible=this.mode===`rotate`,this.helper.scale.visible=this.mode===`scale`;let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let e=0;e<n.length;e++){let r=n[e];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let i;if(i=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(i*this.size/4),r.tag===`helper`)r.visible=!1,r.name===`AXIS`?(r.visible=!!this.axis,this.axis===`X`&&(L.setFromEuler(V.set(0,0,0)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Y`&&(L.setFromEuler(V.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Z`&&(L.setFromEuler(V.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`XYZE`&&(L.setFromEuler(V.set(0,Math.PI/2,0)),H.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(_e.lookAt(ge,H,J)),r.quaternion.multiply(L),r.visible=this.dragging),this.axis===`E`&&(r.visible=!1)):r.name===`START`?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name===`END`?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name===`DELTA`?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),F.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),F.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(F),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));else{if(r.quaternion.copy(t),this.mode===`translate`||this.mode===`scale`){let e=.99,n=.2;r.name===`X`&&Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Y`&&Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Z`&&Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XY`&&Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`YZ`&&Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XZ`&&Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)}else this.mode===`rotate`&&(U.copy(t),H.copy(this.eye).applyQuaternion(L.copy(t).invert()),r.name.search(`E`)!==-1&&r.quaternion.setFromRotationMatrix(_e.lookAt(this.eye,ge,J)),r.name===`X`&&(L.setFromAxisAngle(q,Math.atan2(-H.y,H.z)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)),r.name===`Y`&&(L.setFromAxisAngle(J,Math.atan2(H.x,H.z)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)),r.name===`Z`&&(L.setFromAxisAngle(Y,Math.atan2(H.y,H.x)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)));r.visible=r.visible&&(r.name.indexOf(`X`)===-1||this.showX),r.visible=r.visible&&(r.name.indexOf(`Y`)===-1||this.showY),r.visible=r.visible&&(r.name.indexOf(`Z`)===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf(`E`)===-1||this.showX&&this.showY&&this.showZ),r.visible=r.visible&&(r.name.indexOf(`XY`)===-1||this.showXY),r.visible=r.visible&&(r.name.indexOf(`YZ`)===-1||this.showYZ),r.visible=r.visible&&(r.name.indexOf(`XZ`)===-1||this.showXZ),r.visible=r.visible&&(r.name!==`E`||this.showE),r.visible=r.visible&&(r.name!==`XYZE`||this.showXYZE),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split(``).some(function(e){return r.name===e}))&&(r.material.color.copy(this.materialLib.active.color),r.material.opacity=1)}}super.updateMatrixWorld(e)}},be=class extends A{constructor(){super(new t(1e5,1e5,2,2),new m({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type=`TransformControlsPlane`}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode===`scale`&&(t=`local`),X.copy(q).applyQuaternion(t===`local`?this.worldQuaternion:W),Z.copy(J).applyQuaternion(t===`local`?this.worldQuaternion:W),Q.copy(Y).applyQuaternion(t===`local`?this.worldQuaternion:W),H.copy(Z),this.mode){case`translate`:case`scale`:switch(this.axis){case`X`:H.copy(this.eye).cross(X),G.copy(X).cross(H);break;case`Y`:H.copy(this.eye).cross(Z),G.copy(Z).cross(H);break;case`Z`:H.copy(this.eye).cross(Q),G.copy(Q).cross(H);break;case`XY`:G.copy(Q);break;case`YZ`:G.copy(X);break;case`XZ`:H.copy(Q),G.copy(Z);break;case`XYZ`:case`E`:G.set(0,0,0)}break;default:G.set(0,0,0)}G.length()===0?this.quaternion.copy(this.cameraQuaternion):(K.lookAt(F.set(0,0,0),G,H),this.quaternion.setFromRotationMatrix(K)),super.updateMatrixWorld(e)}},xe=`
|
|
1
|
+
import{OrbitControls as e}from"./OrbitControls-1xEm394I.js";import{Bt as t,En as n,Ft as r,Ht as i,I as a,In as o,It as s,Kt as c,Ln as l,N as u,Pt as d,Qt as f,Rt as p,St as m,T as h,an as g,at as _,bt as v,d as y,f as b,h as x,hn as ee,it as te,m as S,mn as C,nt as w,on as T,p as E,st as D,vt as O,w as ne,x as k,xt as A,yn as re,zt as ie}from"./three.module-B9FlcKtd.js";import{r as ae}from"./camera-DrubOxWu.js";import{a as j,i as M,n as N,o as oe}from"./index-BPVRhKVV.js";var P=new f,F=new l,I=new l,L=new c,se={X:new l(1,0,0),Y:new l(0,1,0),Z:new l(0,0,1)},R={type:`change`},z={type:`mouseDown`,mode:null},ce={type:`mouseUp`,mode:null},le={type:`objectChange`},ue=class extends ne{constructor(e,t=null){super(void 0,t);let n=new ve(this);this._root=n;let r=new ye;this._gizmo=r,n.add(r);let i=new be;this._plane=i,n.add(i);let a=this;function o(e,t){let n=t;Object.defineProperty(a,e,{get:function(){return n===void 0?t:n},set:function(t){n!==t&&(n=t,i[e]=t,r[e]=t,a.dispatchEvent({type:e+`-changed`,value:t}),a.dispatchEvent(R))}}),a[e]=t,i[e]=t,r[e]=t}o(`camera`,e),o(`object`,void 0),o(`enabled`,!0),o(`axis`,null),o(`mode`,`translate`),o(`translationSnap`,null),o(`rotationSnap`,null),o(`scaleSnap`,null),o(`space`,`world`),o(`size`,1),this.viewport=null,o(`dragging`,!1),o(`showX`,!0),o(`showY`,!0),o(`showZ`,!0),o(`showXY`,!0),o(`showYZ`,!0),o(`showXZ`,!0),o(`showXYZE`,!0),o(`showE`,!0),o(`minX`,-1/0),o(`maxX`,1/0),o(`minY`,-1/0),o(`maxY`,1/0),o(`minZ`,-1/0),o(`maxZ`,1/0);let s=new l,u=new l,d=new c,f=new c,p=new l,m=new c,h=new l,g=new l,_=new l,v=new l;o(`worldPosition`,s),o(`worldPositionStart`,u),o(`worldQuaternion`,d),o(`worldQuaternionStart`,f),o(`cameraPosition`,p),o(`cameraQuaternion`,m),o(`pointStart`,h),o(`pointEnd`,g),o(`rotationAxis`,_),o(`rotationAngle`,0),o(`eye`,v),this._offset=new l,this._startNorm=new l,this._endNorm=new l,this._cameraScale=new l,this._parentPosition=new l,this._parentQuaternion=new c,this._parentQuaternionInv=new c,this._parentScale=new l,this._worldScaleStart=new l,this._worldQuaternionInv=new c,this._worldScale=new l,this._positionStart=new l,this._quaternionStart=new c,this._scaleStart=new l,this._getPointer=de.bind(this),this._onPointerDown=pe.bind(this),this._onPointerHover=fe.bind(this),this._onPointerMove=me.bind(this),this._onPointerUp=he.bind(this),t!==null&&this.connect(t)}connect(e){super.connect(e),this.domElement.addEventListener(`pointerdown`,this._onPointerDown),this.domElement.addEventListener(`pointermove`,this._onPointerHover),this.domElement.addEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=`none`}disconnect(){this.domElement.removeEventListener(`pointerdown`,this._onPointerDown),this.domElement.removeEventListener(`pointermove`,this._onPointerHover),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.domElement.removeEventListener(`pointerup`,this._onPointerUp),this.domElement.style.touchAction=``}getHelper(){return this._root}pointerHover(e){if(this.object===void 0||this.dragging===!0)return;e!==null&&P.setFromCamera(e,this.camera);let t=B(this._gizmo.picker[this.mode],P);this.axis=t?t.object.name:null}pointerDown(e){if(!(this.object===void 0||this.dragging===!0||e!=null&&e.button!==0)&&this.axis!==null){e!==null&&P.setFromCamera(e,this.camera);let t=B(this._plane,P,!0);t&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(t.point).sub(this.worldPositionStart)),this.dragging=!0,z.mode=this.mode,this.dispatchEvent(z)}}pointerMove(e){let t=this.axis,n=this.mode,r=this.object,i=this.space;if(n===`scale`?i=`local`:(t===`E`||t===`XYZE`||t===`XYZ`)&&(i=`world`),r===void 0||t===null||this.dragging===!1||e!==null&&e.button!==-1)return;e!==null&&P.setFromCamera(e,this.camera);let a=B(this._plane,P,!0);if(a){if(this.pointEnd.copy(a.point).sub(this.worldPositionStart),n===`translate`)this._offset.copy(this.pointEnd).sub(this.pointStart),i===`local`&&t!==`XYZ`&&this._offset.applyQuaternion(this._worldQuaternionInv),t.indexOf(`X`)===-1&&(this._offset.x=0),t.indexOf(`Y`)===-1&&(this._offset.y=0),t.indexOf(`Z`)===-1&&(this._offset.z=0),i===`local`&&t!==`XYZ`?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),r.position.copy(this._offset).add(this._positionStart),this.translationSnap&&(i===`local`&&(r.position.applyQuaternion(L.copy(this._quaternionStart).invert()),t.search(`X`)!==-1&&(r.position.x=Math.round(r.position.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(r.position.y=Math.round(r.position.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(r.position.z=Math.round(r.position.z/this.translationSnap)*this.translationSnap),r.position.applyQuaternion(this._quaternionStart)),i===`world`&&(r.getWorldPosition(F),t.search(`X`)!==-1&&(F.x=Math.round(F.x/this.translationSnap)*this.translationSnap),t.search(`Y`)!==-1&&(F.y=Math.round(F.y/this.translationSnap)*this.translationSnap),t.search(`Z`)!==-1&&(F.z=Math.round(F.z/this.translationSnap)*this.translationSnap),r.position.copy(r.parent.worldToLocal(F)))),r.position.x=Math.max(this.minX,Math.min(this.maxX,r.position.x)),r.position.y=Math.max(this.minY,Math.min(this.maxY,r.position.y)),r.position.z=Math.max(this.minZ,Math.min(this.maxZ,r.position.z));else if(n===`scale`){if(t.search(`XYZ`)!==-1){let e=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(e*=-1),I.set(e,e,e)}else F.copy(this.pointStart),I.copy(this.pointEnd),F.applyQuaternion(this._worldQuaternionInv),I.applyQuaternion(this._worldQuaternionInv),I.divide(F),t.search(`X`)===-1&&(I.x=1),t.search(`Y`)===-1&&(I.y=1),t.search(`Z`)===-1&&(I.z=1);r.scale.copy(this._scaleStart).multiply(I),this.scaleSnap&&(t.search(`X`)!==-1&&(r.scale.x=Math.round(r.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Y`)!==-1&&(r.scale.y=Math.round(r.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),t.search(`Z`)!==-1&&(r.scale.z=Math.round(r.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if(n===`rotate`){this._offset.copy(this.pointEnd).sub(this.pointStart);let e=20/this.worldPosition.distanceTo(F.setFromMatrixPosition(this.camera.matrixWorld)),n=!1;t===`XYZE`?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(F.copy(this.rotationAxis).cross(this.eye))*e):(t===`X`||t===`Y`||t===`Z`)&&(this.rotationAxis.copy(se[t]),F.copy(se[t]),i===`local`&&F.applyQuaternion(this.worldQuaternion),F.cross(this.eye),F.length()===0?n=!0:this.rotationAngle=this._offset.dot(F.normalize())*e),(t===`E`||n)&&(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),i===`local`&&t!==`E`&&t!==`XYZE`?(r.quaternion.copy(this._quaternionStart),r.quaternion.multiply(L.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),r.quaternion.copy(L.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),r.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(R),this.dispatchEvent(le)}}pointerUp(e){(e===null||e.button===0)&&(this.dragging&&this.axis!==null&&(ce.mode=this.mode,this.dispatchEvent(ce)),this.dragging=!1,this.axis=null)}dispose(){this.disconnect(),this._root.dispose()}attach(e){return this.object=e,this._root.visible=!0,this}detach(){return this.object=void 0,this.axis=null,this._root.visible=!1,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(R),this.dispatchEvent(le),this.pointStart.copy(this.pointEnd))}getRaycaster(){return P}getMode(){return this.mode}setMode(e){this.mode=e}setTranslationSnap(e){this.translationSnap=e}setRotationSnap(e){this.rotationSnap=e}setScaleSnap(e){this.scaleSnap=e}setSize(e){this.size=e}setSpace(e){this.space=e}setColors(e,t,n,r){let i=this._gizmo.materialLib;i.xAxis.color.set(e),i.yAxis.color.set(t),i.zAxis.color.set(n),i.active.color.set(r),i.xAxisTransparent.color.set(e),i.yAxisTransparent.color.set(t),i.zAxisTransparent.color.set(n),i.activeTransparent.color.set(r),i.xAxis._color&&i.xAxis._color.set(e),i.yAxis._color&&i.yAxis._color.set(t),i.zAxis._color&&i.zAxis._color.set(n),i.active._color&&i.active._color.set(r),i.xAxisTransparent._color&&i.xAxisTransparent._color.set(e),i.yAxisTransparent._color&&i.yAxisTransparent._color.set(t),i.zAxisTransparent._color&&i.zAxisTransparent._color.set(n),i.activeTransparent._color&&i.activeTransparent._color.set(r)}};function de(e){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:e.button};{let t=this.domElement.getBoundingClientRect(),n=this.viewport,r,i,a,o;return n===null?(r=0,i=0,a=t.width,o=t.height):(r=n.x,i=t.height-n.y-n.w,a=n.z,o=n.w),{x:(e.clientX-t.left-r)/a*2-1,y:-(e.clientY-t.top-i)/o*2+1,button:e.button}}}function fe(e){if(this.enabled)switch(e.pointerType){case`mouse`:case`pen`:this.pointerHover(this._getPointer(e))}}function pe(e){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(e.pointerId),this.domElement.addEventListener(`pointermove`,this._onPointerMove),this.pointerHover(this._getPointer(e)),this.pointerDown(this._getPointer(e)))}function me(e){this.enabled&&this.pointerMove(this._getPointer(e))}function he(e){this.enabled&&(this.domElement.releasePointerCapture(e.pointerId),this.domElement.removeEventListener(`pointermove`,this._onPointerMove),this.pointerUp(this._getPointer(e)))}function B(e,t,n){let r=t.intersectObject(e,!0);for(let e=0;e<r.length;e++)if(r[e].object.visible||n)return r[e];return!1}var V=new u,H=new l(0,1,0),ge=new l(0,0,0),_e=new v,U=new c,W=new c,G=new l,K=new v,q=new l(1,0,0),J=new l(0,1,0),Y=new l(0,0,1),X=new l,Z=new l,Q=new l,ve=class extends d{constructor(e){super(),this.isTransformControlsRoot=!0,this.controls=e,this.visible=!1}updateMatrixWorld(e){let t=this.controls;t.object!==void 0&&(t.object.updateMatrixWorld(),t.object.parent===null?console.error(`TransformControls: The attached 3D object must be a part of the scene graph.`):t.object.parent.matrixWorld.decompose(t._parentPosition,t._parentQuaternion,t._parentScale),t.object.matrixWorld.decompose(t.worldPosition,t.worldQuaternion,t._worldScale),t._parentQuaternionInv.copy(t._parentQuaternion).invert(),t._worldQuaternionInv.copy(t.worldQuaternion).invert()),t.camera.updateMatrixWorld(),t.camera.matrixWorld.decompose(t.cameraPosition,t.cameraQuaternion,t._cameraScale),t.camera.isOrthographicCamera?t.camera.getWorldDirection(t.eye).negate():t.eye.copy(t.cameraPosition).sub(t.worldPosition).normalize(),this.parent&&(K.copy(this.parent.matrixWorld).invert(),K.decompose(this.position,this.quaternion,this.scale)),super.updateMatrixWorld(e)}dispose(){this.traverse(function(e){e.geometry&&e.geometry.dispose(),e.material&&e.material.dispose()})}},ye=class extends d{constructor(){super(),this.isTransformControlsGizmo=!0,this.type=`TransformControlsGizmo`;let e=new m({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),t=new te({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),i=e.clone();i.opacity=.15;let o=t.clone();o.opacity=.5;let s=e.clone();s.color.setHex(16711680);let c=e.clone();c.color.setHex(65280);let l=e.clone();l.color.setHex(255);let u=e.clone();u.color.setHex(16711680),u.opacity=.5;let f=e.clone();f.color.setHex(65280),f.opacity=.5;let p=e.clone();p.color.setHex(255),p.opacity=.5;let g=e.clone();g.opacity=.25;let _=e.clone();_.color.setHex(16776960),_.opacity=.25;let v=e.clone();v.color.setHex(16776960);let y=e.clone();y.color.setHex(7895160),this.materialLib={xAxis:s,yAxis:c,zAxis:l,active:v,xAxisTransparent:u,yAxisTransparent:f,zAxisTransparent:p,activeTransparent:_};let b=new h(0,.04,.1,12);b.translate(0,.05,0);let S=new E(.08,.08,.08);S.translate(0,.04,0);let C=new x;C.setAttribute(`position`,new a([0,0,0,1,0,0],3));let T=new h(.0075,.0075,.5,3);T.translate(0,.25,0);function D(e,t){let r=new n(e,.0075,3,64,t*Math.PI*2);return r.rotateY(Math.PI/2),r.rotateX(Math.PI/2),r}function O(){let e=new x;return e.setAttribute(`position`,new a([0,0,0,1,1,1],3)),e}let ne={X:[[new A(b,s),[.5,0,0],[0,0,-Math.PI/2]],[new A(b,s),[-.5,0,0],[0,0,Math.PI/2]],[new A(T,s),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new A(b,c),[0,.5,0]],[new A(b,c),[0,-.5,0],[Math.PI,0,0]],[new A(T,c)]],Z:[[new A(b,l),[0,0,.5],[Math.PI/2,0,0]],[new A(b,l),[0,0,-.5],[-Math.PI/2,0,0]],[new A(T,l),null,[Math.PI/2,0,0]]],XYZ:[[new A(new r(.1,0),g),[0,0,0]]],XY:[[new A(new E(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new A(new E(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]]},k={X:[[new A(new h(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new A(new h(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new A(new h(.2,0,.6,4),i),[0,.3,0]],[new A(new h(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new A(new h(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new A(new h(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new A(new r(.2,0),i)]],XY:[[new A(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new A(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]]},re={START:[[new A(new r(.01,2),o),null,null,null,`helper`]],END:[[new A(new r(.01,2),o),null,null,null,`helper`]],DELTA:[[new w(O(),o),null,null,null,`helper`]],X:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new w(C,o),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new w(C,o),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]},ie={XYZE:[[new A(D(.5,1),y),null,[0,Math.PI/2,0]]],X:[[new A(D(.5,.5),s)]],Y:[[new A(D(.5,.5),c),null,[0,0,-Math.PI/2]]],Z:[[new A(D(.5,.5),l),null,[0,Math.PI/2,0]]],E:[[new A(D(.75,1),_),null,[0,Math.PI/2,0]]]},ae={AXIS:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]]},j={XYZE:[[new A(new ee(.25,10,8),i)]],X:[[new A(new n(.5,.1,4,24),i),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new A(new n(.5,.1,4,24),i),[0,0,0],[Math.PI/2,0,0]]],Z:[[new A(new n(.5,.1,4,24),i),[0,0,0],[0,0,-Math.PI/2]]],E:[[new A(new n(.75,.1,2,24),i)]]},M={X:[[new A(S,s),[.5,0,0],[0,0,-Math.PI/2]],[new A(T,s),[0,0,0],[0,0,-Math.PI/2]],[new A(S,s),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new A(S,c),[0,.5,0]],[new A(T,c)],[new A(S,c),[0,-.5,0],[0,0,Math.PI]]],Z:[[new A(S,l),[0,0,.5],[Math.PI/2,0,0]],[new A(T,l),[0,0,0],[Math.PI/2,0,0]],[new A(S,l),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new A(new E(.15,.15,.01),p),[.15,.15,0]]],YZ:[[new A(new E(.15,.15,.01),u),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.15,.15,.01),f),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new A(new E(.1,.1,.1),g)]]},N={X:[[new A(new h(.2,0,.6,4),i),[.3,0,0],[0,0,-Math.PI/2]],[new A(new h(.2,0,.6,4),i),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new A(new h(.2,0,.6,4),i),[0,.3,0]],[new A(new h(.2,0,.6,4),i),[0,-.3,0],[0,0,Math.PI]]],Z:[[new A(new h(.2,0,.6,4),i),[0,0,.3],[Math.PI/2,0,0]],[new A(new h(.2,0,.6,4),i),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new A(new E(.2,.2,.01),i),[.15,.15,0]]],YZ:[[new A(new E(.2,.2,.01),i),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new A(new E(.2,.2,.01),i),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new A(new E(.2,.2,.2),i),[0,0,0]]]},oe={X:[[new w(C,o),[-1e3,0,0],null,[1e6,1,1],`helper`]],Y:[[new w(C,o),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],`helper`]],Z:[[new w(C,o),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],`helper`]]};function P(e){let t=new d;for(let n in e)for(let r=e[n].length;r--;){let i=e[n][r][0].clone(),a=e[n][r][1],o=e[n][r][2],s=e[n][r][3],c=e[n][r][4];i.name=n,i.tag=c,a&&i.position.set(a[0],a[1],a[2]),o&&i.rotation.set(o[0],o[1],o[2]),s&&i.scale.set(s[0],s[1],s[2]),i.updateMatrix();let l=i.geometry.clone();l.applyMatrix4(i.matrix),i.geometry=l,i.renderOrder=1/0,i.position.set(0,0,0),i.rotation.set(0,0,0),i.scale.set(1,1,1),t.add(i)}return t}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=P(ne)),this.add(this.gizmo.rotate=P(ie)),this.add(this.gizmo.scale=P(M)),this.add(this.picker.translate=P(k)),this.add(this.picker.rotate=P(j)),this.add(this.picker.scale=P(N)),this.add(this.helper.translate=P(re)),this.add(this.helper.rotate=P(ae)),this.add(this.helper.scale=P(oe)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(e){let t=(this.mode===`scale`?`local`:this.space)===`local`?this.worldQuaternion:W;this.gizmo.translate.visible=this.mode===`translate`,this.gizmo.rotate.visible=this.mode===`rotate`,this.gizmo.scale.visible=this.mode===`scale`,this.helper.translate.visible=this.mode===`translate`,this.helper.rotate.visible=this.mode===`rotate`,this.helper.scale.visible=this.mode===`scale`;let n=[];n=n.concat(this.picker[this.mode].children),n=n.concat(this.gizmo[this.mode].children),n=n.concat(this.helper[this.mode].children);for(let e=0;e<n.length;e++){let r=n[e];r.visible=!0,r.rotation.set(0,0,0),r.position.copy(this.worldPosition);let i;if(i=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),r.scale.set(1,1,1).multiplyScalar(i*this.size/4),r.tag===`helper`)r.visible=!1,r.name===`AXIS`?(r.visible=!!this.axis,this.axis===`X`&&(L.setFromEuler(V.set(0,0,0)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Y`&&(L.setFromEuler(V.set(0,0,Math.PI/2)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`Z`&&(L.setFromEuler(V.set(0,Math.PI/2,0)),r.quaternion.copy(t).multiply(L),Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))>.9&&(r.visible=!1)),this.axis===`XYZE`&&(L.setFromEuler(V.set(0,Math.PI/2,0)),H.copy(this.rotationAxis),r.quaternion.setFromRotationMatrix(_e.lookAt(ge,H,J)),r.quaternion.multiply(L),r.visible=this.dragging),this.axis===`E`&&(r.visible=!1)):r.name===`START`?(r.position.copy(this.worldPositionStart),r.visible=this.dragging):r.name===`END`?(r.position.copy(this.worldPosition),r.visible=this.dragging):r.name===`DELTA`?(r.position.copy(this.worldPositionStart),r.quaternion.copy(this.worldQuaternionStart),F.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),F.applyQuaternion(this.worldQuaternionStart.clone().invert()),r.scale.copy(F),r.visible=this.dragging):(r.quaternion.copy(t),this.dragging?r.position.copy(this.worldPositionStart):r.position.copy(this.worldPosition),this.axis&&(r.visible=this.axis.search(r.name)!==-1));else{if(r.quaternion.copy(t),this.mode===`translate`||this.mode===`scale`){let e=.99,n=.2;r.name===`X`&&Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Y`&&Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`Z`&&Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))>e&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XY`&&Math.abs(H.copy(Y).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`YZ`&&Math.abs(H.copy(q).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1),r.name===`XZ`&&Math.abs(H.copy(J).applyQuaternion(t).dot(this.eye))<n&&(r.scale.set(1e-10,1e-10,1e-10),r.visible=!1)}else this.mode===`rotate`&&(U.copy(t),H.copy(this.eye).applyQuaternion(L.copy(t).invert()),r.name.search(`E`)!==-1&&r.quaternion.setFromRotationMatrix(_e.lookAt(this.eye,ge,J)),r.name===`X`&&(L.setFromAxisAngle(q,Math.atan2(-H.y,H.z)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)),r.name===`Y`&&(L.setFromAxisAngle(J,Math.atan2(H.x,H.z)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)),r.name===`Z`&&(L.setFromAxisAngle(Y,Math.atan2(H.y,H.x)),L.multiplyQuaternions(U,L),r.quaternion.copy(L)));r.visible=r.visible&&(r.name.indexOf(`X`)===-1||this.showX),r.visible=r.visible&&(r.name.indexOf(`Y`)===-1||this.showY),r.visible=r.visible&&(r.name.indexOf(`Z`)===-1||this.showZ),r.visible=r.visible&&(r.name.indexOf(`E`)===-1||this.showX&&this.showY&&this.showZ),r.visible=r.visible&&(r.name.indexOf(`XY`)===-1||this.showXY),r.visible=r.visible&&(r.name.indexOf(`YZ`)===-1||this.showYZ),r.visible=r.visible&&(r.name.indexOf(`XZ`)===-1||this.showXZ),r.visible=r.visible&&(r.name!==`E`||this.showE),r.visible=r.visible&&(r.name!==`XYZE`||this.showXYZE),r.material._color=r.material._color||r.material.color.clone(),r.material._opacity=r.material._opacity||r.material.opacity,r.material.color.copy(r.material._color),r.material.opacity=r.material._opacity,this.enabled&&this.axis&&(r.name===this.axis||this.axis.split(``).some(function(e){return r.name===e}))&&(r.material.color.copy(this.materialLib.active.color),r.material.opacity=1)}}super.updateMatrixWorld(e)}},be=class extends A{constructor(){super(new t(1e5,1e5,2,2),new m({visible:!1,wireframe:!0,side:2,transparent:!0,opacity:.1,toneMapped:!1})),this.isTransformControlsPlane=!0,this.type=`TransformControlsPlane`}updateMatrixWorld(e){let t=this.space;switch(this.position.copy(this.worldPosition),this.mode===`scale`&&(t=`local`),X.copy(q).applyQuaternion(t===`local`?this.worldQuaternion:W),Z.copy(J).applyQuaternion(t===`local`?this.worldQuaternion:W),Q.copy(Y).applyQuaternion(t===`local`?this.worldQuaternion:W),H.copy(Z),this.mode){case`translate`:case`scale`:switch(this.axis){case`X`:H.copy(this.eye).cross(X),G.copy(X).cross(H);break;case`Y`:H.copy(this.eye).cross(Z),G.copy(Z).cross(H);break;case`Z`:H.copy(this.eye).cross(Q),G.copy(Q).cross(H);break;case`XY`:G.copy(Q);break;case`YZ`:G.copy(X);break;case`XZ`:H.copy(Q),G.copy(Z);break;case`XYZ`:case`E`:G.set(0,0,0)}break;default:G.set(0,0,0)}G.length()===0?this.quaternion.copy(this.cameraQuaternion):(K.lookAt(F.set(0,0,0),G,H),this.quaternion.setFromRotationMatrix(K)),super.updateMatrixWorld(e)}},xe=`
|
|
2
2
|
varying vec3 vWorld;
|
|
3
3
|
void main() {
|
|
4
4
|
vec4 w = modelMatrix * vec4(position, 1.0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as e,Ln as t,Lt as n,cn as r,h as i}from"./three.module-
|
|
1
|
+
import{I as e,Ln as t,Lt as n,cn as r,h as i}from"./three.module-B9FlcKtd.js";function a(e,t,n=4,r=256){let i=[];for(let a of e.curves){let e=a.isLineCurve?1:Math.max(n,Math.min(r,Math.ceil(a.getLength()/t))),o=a.getPoints(e);for(let e of o)i.length&&i[i.length-1].equals(e)||i.push(e)}return e.autoClose&&i.length>1&&!i[0].equals(i[i.length-1])&&i.push(i[0].clone()),i}function o(e,t,i=4,o=256){let s=e=>(e.length>2&&e[0].equals(e[e.length-1])&&e.pop(),e),c=new r(s(a(e,t,i,o)));return c.holes=e.holes.map(e=>new n(s(a(e,t,i,o)))),c}function s(e,n,r){let i=r.toCreasedNormals(e,n);i!==e&&e.dispose();let a=i.getAttribute(`position`),o=i.getAttribute(`normal`),s=new t,c=new t,l=new t;for(let e=0;e+2<a.count;e+=3){s.fromBufferAttribute(a,e),c.fromBufferAttribute(a,e+1).sub(s),l.fromBufferAttribute(a,e+2).sub(s);let t=c.cross(l),n=t.length();if(n<1e-12)continue;let r=t.z/n;if(Math.abs(r)>.9999)for(let t=0;t<3;t++)o.setXYZ(e+t,0,0,Math.sign(r))}return o.needsUpdate=!0,i}function c(t,n){let r=t.index?t.toNonIndexed():t,a=r.getAttribute(`position`),o=a.count-a.count%3;r.computeBoundingBox();let s=r.boundingBox,c=Math.max(s.max.x-s.min.x,s.max.y-s.min.y,1e-9)*1e-6,l=new Map,u=[],d=e=>{let t=a.getX(e),n=a.getY(e),r=`${Math.round(t/c)},${Math.round(n/c)}`,i=l.get(r);return i===void 0&&(i=u.length,l.set(r,i),u.push([t,n])),i},f=[];for(let e=0;e<o;e+=3){let t=d(e),n=d(e+1),r=d(e+2);if(t===n||n===r||t===r)continue;let i=(u[n][0]-u[t][0])*(u[r][1]-u[t][1])-(u[r][0]-u[t][0])*(u[n][1]-u[t][1]);Math.abs(i)<c*c||(i<0&&([n,r]=[r,n]),f.push([t,n,r]))}let p=new Map;for(let[e,t,n]of f)for(let[r,i]of[[e,t],[t,n],[n,e]]){let e=r<i?`${r}_${i}`:`${i}_${r}`,t=p.get(e);t?t.count++:p.set(e,{a:r,b:i,count:1})}let m=[],h=[],g=[],_=Math.max(s.max.x-s.min.x,1e-9),v=Math.max(s.max.y-s.min.y,1e-9),y=(e,t,n,r,i,a,o,c)=>{m.push(e,t,n),h.push(r,i,a),g.push(o??(e-s.min.x)/_,c??(t-s.min.y)/v)};for(let[e,t,r]of f){for(let i of[e,t,r])y(u[i][0],u[i][1],n,0,0,1);for(let n of[e,r,t])y(u[n][0],u[n][1],0,0,0,-1)}if(n>0)for(let e of p.values()){if(e.count!==1)continue;let[t,r]=u[e.a],[i,a]=u[e.b],o=i-t,s=a-r,l=Math.hypot(o,s);if(l<c)continue;let d=s/l,f=-o/l;y(t,r,0,d,f,0,0,0),y(i,a,0,d,f,0,1,0),y(i,a,n,d,f,0,1,1),y(t,r,0,d,f,0,0,0),y(i,a,n,d,f,0,1,1),y(t,r,n,d,f,0,0,1)}r!==t&&r.dispose();let b=new i;return b.setAttribute(`position`,new e(m,3)),b.setAttribute(`normal`,new e(h,3)),b.setAttribute(`uv`,new e(g,2)),b}export{s as i,a as n,o as r,c as t};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./physicsHost-EkPuIy04.js","./num-CQNAlL82.js","./three.module-B9FlcKtd.js","./rolldown-runtime-4tVxZq34.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./num-CQNAlL82.js";import{In as t,Ln as n,Qt as r,zt as i}from"./three.module-B9FlcKtd.js";import{a,g as o,y as s}from"./camera-DrubOxWu.js";import{T as c,g as l}from"./index-BPVRhKVV.js";function u(e,t,n){let r=null,i=null,a=!!e?.muted,o=null,s=new Map,c=null,u=!!e?.music,d=()=>l(()=>import(`./audio-JD1kyX0A.js`).then(e=>o=e.SOUND_IMPLS),[],import.meta.url).catch(()=>o={}),f=e=>{let i=s.get(e);if(!i&&r){let a=r;i=fetch(t(e)).then(e=>e.arrayBuffer()).then(e=>a.decodeAudioData(e)).catch(t=>(n(t.message,e),null)),s.set(e,i)}return i??Promise.resolve(null)},p=(e,t=!1)=>{if(!r||!i)return null;let n=e.volume??1;if(e.preset){let t=o?.[e.preset];return t?t.play(r,i,n):null}if(e.src){let a=r,o=i,s=null,c=!1;return f(e.src).then(e=>{if(!e||c)return;s=a.createBufferSource(),s.buffer=e,s.loop=t;let r=a.createGain();r.gain.value=n,s.connect(r).connect(o),s.start()}),{stop(){c=!0;try{s?.stop()}catch{}}}}return null},m=()=>{!c&&e?.music&&!a&&r&&(c=p(e.music,e.music.loop!==!1))};return d(),{play(t){if(a||!r)return;let n=e?.sounds?.[t];n?p(n):o?.[t]&&o[t].play(r,i,1)},music(e){u=e,e?m():(c?.stop(),c=null)},muted:()=>a,setMuted(t){a=t,i&&r&&i.gain.setTargetAtTime(+!t,r.currentTime,.02),t?(c?.stop(),c=null):(u||e?.music)&&(u=!0,m())},unlock(){if(r){r.state===`suspended`&&r.resume();return}let e=globalThis.AudioContext??globalThis.webkitAudioContext;if(e)try{r=new e,i=r.createGain(),i.gain.value=+!a,i.connect(r.destination),u&&m()}catch(e){n(e.message)}},dispose(){c?.stop(),r?.close().catch(()=>void 0),r=null}}}function d(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(/\s/.test(r)){n++;continue}if(/[0-9]/.test(r)||r===`-`&&/[0-9]/.test(e[n+1]??``)&&(t.length===0||t[t.length-1].t===`op`)){let r=n+1;for(;r<e.length&&/[0-9.]/.test(e[r]);)r++;t.push({t:`num`,v:Number(e.slice(n,r))}),n=r;continue}if(r===`'`||r===`"`){let i=n+1,a=``;for(;i<e.length&&e[i]!==r;)e[i]===`\\`&&i+1<e.length&&i++,a+=e[i++];if(i>=e.length)throw Error(`Unterminated string`);t.push({t:`str`,v:a}),n=i+1;continue}if(/[A-Za-z_$]/.test(r)){let r=n+1;for(;r<e.length&&/[A-Za-z0-9_$.]/.test(e[r]);)r++;t.push({t:`id`,v:e.slice(n,r)}),n=r;continue}let i=e.slice(n,n+3),a=e.slice(n,n+2);if(i===`===`||i===`!==`)t.push({t:`op`,v:i.slice(0,2)}),n+=3;else if([`==`,`!=`,`>=`,`<=`,`&&`,`||`].includes(a))t.push({t:`op`,v:a}),n+=2;else if(`!<>()`.includes(r))t.push({t:`op`,v:r}),n++;else throw Error(`Unexpected "${r}"`)}return t}var f=new Set([`__proto__`,`prototype`,`constructor`]);function p(e,t){let n=t.split(`.`);n[0]===`state`&&n.shift();let r=e;for(let e of n){if(f.has(e)||typeof r!=`object`||!r||!Object.prototype.hasOwnProperty.call(r,e))return;r=r[e]}return r}function m(e,t){let n=d(e),r=0,i=()=>n[r],a=e=>i()?.t===`op`&&i().v===e;function o(){let e=n[r++];if(!e)throw Error(`Unexpected end`);if(e.t===`num`||e.t===`str`)return e.v;if(e.t===`id`)return e.v===`true`?!0:e.v===`false`?!1:e.v===`null`||e.v===`undefined`?null:p(t,e.v);if(e.v===`(`){let e=u();if(!a(`)`))throw Error(`Missing )`);return r++,e}throw Error(`Unexpected "${e.v}"`)}function s(){let e=o(),t=i();if(t?.t===`op`&&[`==`,`!=`,`>`,`<`,`>=`,`<=`].includes(t.v)){r++;let n=o(),i=e,a=n;switch(t.v){case`==`:return e==n||e==null&&n==null;case`!=`:return e!=n;case`>`:return i>a;case`<`:return i<a;case`>=`:return i>=a;default:return i<=a}}return e}function c(){return a(`!`)?(r++,!c()):s()}function l(){let e=c();for(;a(`&&`);){r++;let t=c();e&&=t}return e}function u(){let e=l();for(;a(`||`);){r++;let t=l();e||=t}return e}let f=u();if(r<n.length)throw Error(`Unexpected "${n[r].v}"`);return f}function h(e,t){if(e===void 0)return!0;if(typeof e==`boolean`)return e;try{return!!m(e,t)}catch{return!1}}function g(e,t){return e.replace(/\{([^{}]+)\}/g,(e,n)=>{let r=n.trim(),i;try{i=/^[A-Za-z_$][A-Za-z0-9_$.]*$/.test(r)?p(t,r):m(r,t)}catch{i=void 0}return i==null?``:String(typeof i==`number`?Number.isInteger(i)?i:Math.round(i*100)/100:i)})}var _={"top-left":`grid-row:1;grid-column:1;align-items:flex-start;align-self:start;`,top:`grid-row:1;grid-column:2;align-items:center;align-self:start;text-align:center;`,"top-right":`grid-row:1;grid-column:3;align-items:flex-end;align-self:start;text-align:right;`,left:`grid-row:2;grid-column:1;align-items:flex-start;align-self:center;`,center:`grid-row:2;grid-column:2;align-items:center;align-self:center;text-align:center;`,right:`grid-row:2;grid-column:3;align-items:flex-end;align-self:center;text-align:right;`,"bottom-left":`grid-row:3;grid-column:1;align-items:flex-start;align-self:end;`,bottom:`grid-row:3;grid-column:2;align-items:center;align-self:end;text-align:center;`,"bottom-right":`grid-row:3;grid-column:3;align-items:flex-end;align-self:end;text-align:right;`},v=(e,t,n)=>`font-size:${n}px;font-size:clamp(${e}px,min(${t}cqw,${(t*1.6).toFixed(1)}cqh),${n}px)`,y=(e,t,n,r)=>`
|
|
3
|
+
.a3d-hud{position:absolute;inset:0;pointer-events:none;font-family:${e};color:${t};z-index:2;overflow:hidden;user-select:none;-webkit-user-select:none;container-type:size;display:grid;grid-template-columns:minmax(min-content,1fr) fit-content(56%) minmax(min-content,1fr);grid-template-rows:auto minmax(0,1fr) auto}
|
|
4
|
+
.a3d-zone{display:flex;flex-direction:column;gap:8px;gap:clamp(4px,1.6cqw,8px);padding:14px;padding:clamp(8px,2.6cqw,14px);min-width:0;max-width:100%;box-sizing:border-box}
|
|
5
|
+
.a3d-el{line-height:1.2;text-shadow:0 1px 3px rgba(0,0,0,.45);white-space:pre-line;overflow-wrap:break-word}
|
|
6
|
+
.a3d-plain{${v(11,3.2,15)};font-weight:600}
|
|
7
|
+
.a3d-pill{${v(11,3,14)};font-weight:700;padding:.43em 1em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;box-sizing:border-box;flex:none;border-radius:999px;background:rgba(0,0,0,.42);backdrop-filter:blur(6px);-webkit-backdrop-filter:blur(6px);text-shadow:none}
|
|
8
|
+
.a3d-title{${v(20,7,44)};font-weight:800;letter-spacing:-.01em}
|
|
9
|
+
.a3d-subtitle{${v(12,3.6,18)};font-weight:500;opacity:.9}
|
|
10
|
+
.a3d-panel{${v(13,3.6,18)};font-weight:600;line-height:1.45;padding:1.1em 1.6em;border-radius:18px;background:rgba(10,12,20,.72);backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px);box-shadow:0 10px 34px rgba(0,0,0,.35);text-shadow:none;max-width:100%;box-sizing:border-box}
|
|
11
|
+
.a3d-panel::first-line{font-size:1.45em;font-weight:800}
|
|
12
|
+
.a3d-btn{pointer-events:auto;cursor:pointer;border:0;font:inherit;${v(12,3.4,15)};font-weight:700;color:${r};background:${n};padding:.67em 1.47em;border-radius:999px;box-shadow:0 4px 14px rgba(0,0,0,.25);transition:transform .12s ease,filter .12s ease;text-shadow:none;min-height:36px}
|
|
13
|
+
.a3d-btn:hover{transform:translateY(-1px);filter:brightness(1.08)}.a3d-btn:active{transform:translateY(1px)}
|
|
14
|
+
.a3d-bar{width:160px;width:clamp(80px,30cqw,160px);height:10px;height:clamp(7px,2cqw,10px);border-radius:999px;background:rgba(0,0,0,.35);overflow:hidden}
|
|
15
|
+
.a3d-bar>i{display:block;height:100%;width:0;background:${n};border-radius:inherit}
|
|
16
|
+
.a3d-toast{position:absolute;left:50%;bottom:18%;transform:translateX(-50%);max-width:86%;box-sizing:border-box;text-align:center;padding:.53em 1.2em;border-radius:999px;background:rgba(0,0,0,.6);color:#fff;font-weight:700;${v(12,3.4,15)};transition:opacity .25s ease;text-shadow:none}
|
|
17
|
+
.a3d-mute{pointer-events:auto;width:34px;height:34px;width:clamp(28px,8cqw,34px);height:clamp(28px,8cqw,34px);border-radius:50%;border:0;background:rgba(0,0,0,.4);color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0;flex:none}
|
|
18
|
+
.a3d-mute svg{width:55%;height:55%}
|
|
19
|
+
`,b=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H2v6h4l5 4V5z"/><path d="M15.5 8.5a5 5 0 0 1 0 7"/><path d="M19 5a10 10 0 0 1 0 14"/></svg>`,x=`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 5 6 9H2v6h4l5 4V5z"/><path d="m23 9-6 6"/><path d="m17 9 6 6"/></svg>`;function S(e,t,n){let r=e.ownerDocument,i=r.createElement(`div`);i.className=`a3d-hud`,i.setAttribute(`aria-live`,`polite`);let a=r.createElement(`style`),o=t?.accent??`#ff006e`;a.textContent=y(t?.font??`system-ui,-apple-system,'Segoe UI',Roboto,sans-serif`,t?.color??`#ffffff`,o,t?.buttonText??c(o)),i.appendChild(a);let s=new Map,l=e=>{let t=s.get(e);return t||(t=r.createElement(`div`),t.className=`a3d-zone`,t.style.cssText=_[e]??_[`top-left`],t.dataset.anchor=e,i.appendChild(t),s.set(e,t)),t},u=[[`top-left`,`top`,`top-right`],[`left`,`center`,`right`],[`bottom-left`,`bottom`,`bottom-right`]],d=()=>{for(let[e,t,n]of u){let r=s.get(t);r&&(r.style.gridColumn=s.has(e)||s.has(n)?`2`:`1 / -1`)}},f=new Map;for(let e of t?.elements??[]){let t,i;if(e.type===`button`){let i=r.createElement(`button`);i.type=`button`,i.className=`a3d-btn`,i.addEventListener(`click`,t=>{t.stopPropagation(),e.action&&n(e.action)}),i.addEventListener(`pointerdown`,e=>e.stopPropagation()),t=i}else e.type===`bar`?(t=r.createElement(`div`),t.className=`a3d-bar`,i=r.createElement(`i`),t.appendChild(i)):(t=r.createElement(`div`),t.className=`a3d-el a3d-${e.style??`plain`}`);e.color&&(t.style.color=e.color,e.type===`bar`&&i&&(i.style.background=e.color)),e.background&&(t.style.background=e.background),e.type===`button`&&e.background&&!e.color&&(t.style.color=c(e.background)),t.dataset.id=e.id,l(e.anchor??`top-left`).appendChild(t),f.set(e.id,{def:e,node:t,fill:i,override:{},last:``})}d(),e.appendChild(i);let m=null,v=0,S=null,C=null,w=null;return{root:i,setTimeline(e){w=e},set(e,t){let n=f.get(e);n&&Object.assign(n.override,t)},toast(e,t=2){S={text:e,seconds:t}},update(e,t){let n=w&&!Object.prototype.hasOwnProperty.call(e,`timeline`)?{...e,timeline:w}:e;for(let e of f.values()){let t=e.override.visible??h(e.def.visible,n);if(e.node.style.display=t?``:`none`,!t)continue;if(e.def.type===`bar`){let t=e.override.value??Number(e.def.value?p(n,e.def.value):0),r=Math.max(0,Math.min(1,Number.isFinite(t)?t:0));e.fill.style.width=`${(r*100).toFixed(1)}%`;continue}let r=e.override.text??g(e.def.text??``,n);r!==e.last&&(e.node.textContent=r,e.last=r)}S&&=(m||(m=r.createElement(`div`),m.className=`a3d-toast`,i.appendChild(m)),m.textContent=S.text,m.style.opacity=`1`,v=t+S.seconds,null),m&&t>v&&(m.style.opacity=`0`)},setMuteButton(e,t){e===null?(C?.remove(),C=null):(C||(C=r.createElement(`button`),C.type=`button`,C.className=`a3d-mute`,C.addEventListener(`pointerdown`,e=>e.stopPropagation()),C.addEventListener(`click`,e=>{e.stopPropagation(),t?.()}),l(`bottom-right`).appendChild(C),d()),C.innerHTML=e?x:b,C.setAttribute(`aria-label`,e?`Unmute sound`:`Mute sound`))},dispose(){i.remove()}}}var C=null,w=()=>C??=l(()=>import(`./physicsHost-EkPuIy04.js`),__vite__mapDeps([0,1,2,3]),import.meta.url);function T(e,t=1,n){return{get x(){return e().x/t},set x(r){e().x=r*t,n?.()},get y(){return e().y/t},set y(r){e().y=r*t,n?.()},get z(){return e().z/t},set z(r){e().z=r*t,n?.()},set(r,i,a){e().set(r*t,i*t,a*t),n?.()}}}var E=new Map,D=class c{opts;world;physics=null;state={};hud=null;audio;instances=[];factories=[];objCache=new Map;handlers=new Map;collisionHandlers=[];collisionEndHandlers=[];triggerEnterHandlers=[];triggerExitHandlers=[];rng;simTime=0;acc=0;stepDt;pendingPressed=new Set;pendingJust=!1;pendingSwipe=null;stepPressed=new Set;stepJust=!1;stepSwipe=null;shake={intensity:0,duration:0,until:0};restartRequested=!1;cloneCounter=0;unlockListeners=null;api;constructor(e){this.opts=e,this.stepDt=Math.min(Math.max(e.scene.physics?.step??1/60,1/480),1/10),this.rng=a(e.scene.seed??1),this.audio=u(e.scene.audio,e.resolveAsset,(t,n)=>e.issue({code:`asset-load`,message:t,path:n})),this.api=this.createApi()}static async create(e,t){let n=new c(e);if(n.hud=e.scene.ui?.elements?.length||e.scene.audio?S(e.container,e.scene.ui,e=>n.emit(e)):null,e.scene.audio&&n.hud){let e=()=>n.hud.setMuteButton(n.audio.muted(),()=>{n.audio.unlock(),n.audio.setMuted(!n.audio.muted()),e()});e()}if(!e.deterministic){let t=()=>n.audio.unlock();e.container.addEventListener(`pointerdown`,t),e.container.addEventListener(`keydown`,t),n.unlockListeners=()=>{e.container.removeEventListener(`pointerdown`,t),e.container.removeEventListener(`keydown`,t)}}return await n.loadScripts(),await n.attach(t),n}async loadScripts(){let{scene:e,scriptSources:t,resolveAsset:n,issue:r}=this.opts;for(let i of e.scripts??[]){let e=t?.[i],a=e===void 0?n(i):`src:${i}:${e.length}:${e.slice(0,64)}`,o=E.get(a);o||(o=(async()=>{let t,r=null;e===void 0?t=n(i):(t=URL.createObjectURL(new Blob([e],{type:`text/javascript`})),r=t);try{let e=await import(t);if(typeof e.default!=`function`)throw Error(`the default export must be a function (api) => ({ start, update })`);return e.default}finally{r&&URL.revokeObjectURL(r)}})(),o.catch(()=>E.delete(a)),E.set(a,o));try{let e=await o;e&&this.factories.push({path:i,factory:e})}catch(e){r({code:`script-error`,message:`${i}: ${e.message}`,path:i})}}}async attach(e){this.world=e,this.objCache.clear(),this.physics?.dispose(),this.physics=null,e.scene.updateMatrixWorld(!0),this.needsPhysics(e)&&await this.ensurePhysics(),this.instances=[];for(let{path:e,factory:t}of this.factories)try{this.instances.push({path:e,inst:t(this.api)??{},failed:!1})}catch(t){this.opts.issue({code:`script-error`,message:`${e}: ${t.message}`,path:e})}for(let e of this.instances)try{await e.inst.start?.()}catch(t){e.failed=!0,this.opts.issue({code:`script-error`,message:`${e.path} start(): ${t.message}`,path:e.path})}this.hud?.update(this.state,0)}needsPhysics(e){if(this.opts.scene.physics?.joints?.length)return!0;for(let t of e.entries.values())if(t.kind!==`light`&&(t.def.body||Array.isArray(t.object.userData.bodies)))return!0;return!1}async ensurePhysics(){if(this.physics)return this.physics;let{PhysicsBridge:e}=await w(),t=new e(this.opts.scene.physics,this.world,e=>this.opts.issue(e));return t.engine.onCollision((e,t,n)=>this.dispatchContact(e.id,t.id,n)),t.engine.onCollisionEnd((e,t)=>this.dispatchContact(e.id,t.id,null)),this.physics=t,t.attachAll(),t}dispatchContact(e,t,n){let r=this.api.get(e),i=this.api.get(t);if(!r||!i||!this.physics)return;let a=this.physics.engine.get(e)?.type===`trigger`,o=this.physics.engine.get(t)?.type===`trigger`;if(n){for(let e of this.collisionHandlers)this.safe(()=>e(r,i,n),`onCollision`);for(let e of this.triggerEnterHandlers)a&&this.safe(()=>e(r,i),`onTriggerEnter`),o&&this.safe(()=>e(i,r),`onTriggerEnter`)}else{for(let e of this.collisionEndHandlers)this.safe(()=>e(r,i),`onCollisionEnd`);for(let e of this.triggerExitHandlers)a&&this.safe(()=>e(r,i),`onTriggerExit`),o&&this.safe(()=>e(i,r),`onTriggerExit`)}}async addBodies(e,t){let n=[];e.object.traverse(e=>{let t=e.userData.a3dId;t&&!n.includes(t)&&n.push(t)});let r=n.map(e=>this.world.entries.get(e)).filter(e=>!!e).filter(n=>n===e&&t||n.def.body);if(!r.length)return;let i=await this.ensurePhysics();for(let n of r)i.has(n.id)||i.addEntry(n,n===e?t:void 0)}requestRestart(){this.restartRequested=!0}get pendingRestart(){return this.restartRequested}async restart(){this.restartRequested=!1;for(let e of this.instances)this.safe(()=>e.inst.dispose?.(),`dispose`);for(let e of Object.keys(this.state))delete this.state[e];this.handlers.clear(),this.collisionHandlers=[],this.collisionEndHandlers=[],this.triggerEnterHandlers=[],this.triggerExitHandlers=[],this.rng=a(this.opts.scene.seed??1),this.simTime=0,this.acc=0,this.shake={intensity:0,duration:0,until:0};let e=await this.opts.rebuild();return await this.attach(e),e}time(){return this.simTime}advance(e){let t=this.opts.input;for(let e of t.pressed)this.pendingPressed.add(e);t.pointer.justPressed&&(this.pendingJust=!0),t.swipe&&(this.pendingSwipe=t.swipe),this.acc+=Math.min(e,.25);let n=0;for(;this.acc>=this.stepDt-1e-9&&n<30;)this.fixedStep(),this.acc-=this.stepDt,n++}advanceTo(e){let t=this.opts.input;for(let e of t.pressed)this.pendingPressed.add(e);for(t.pointer.justPressed&&(this.pendingJust=!0),t.swipe&&(this.pendingSwipe=t.swipe);this.simTime+this.stepDt<=e+1e-9;)this.fixedStep()}fixedStep(){this.stepPressed=this.pendingPressed,this.pendingPressed=new Set,this.stepJust=this.pendingJust,this.pendingJust=!1,this.stepSwipe=this.pendingSwipe,this.pendingSwipe=null;let e=this.stepDt;this.simTime+=e;for(let t of this.instances)if(!t.failed&&t.inst.update)try{t.inst.update(e,this.simTime)}catch(e){t.failed=!0,this.opts.issue({code:`script-error`,message:`${t.path} update(): ${e.message}`,path:t.path})}this.physics?.step(e),this.stepPressed=new Set,this.stepJust=!1,this.stepSwipe=null}afterFrame(){let e=this.world.rig,t=this.simTime;if(t<this.shake.until&&this.shake.duration>0){let n=(this.shake.until-t)/this.shake.duration*this.shake.intensity;e.shake.set((this.rng.next()-.5)*2*n,(this.rng.next()-.5)*2*n,(this.rng.next()-.5)*n)}else e.shake.set(0,0,0);this.hud?.update(this.state,t)}emit(e,t){for(let n of this.handlers.get(e)??[])this.safe(()=>n(t),`on(${e})`);for(let n of this.instances)!n.failed&&n.inst.onEvent&&this.safe(()=>n.inst.onEvent(e,t),`onEvent`)}safe(e,t){try{e()}catch(e){this.opts.issue({code:`script-error`,message:`${t}: ${e.message}`})}}dispose(){for(let e of this.instances)this.safe(()=>e.inst.dispose?.(),`dispose`);this.instances=[],this.physics?.dispose(),this.hud?.dispose(),this.audio.dispose(),this.unlockListeners?.()}wrap(t){let r=this.objCache.get(t.id);if(r)return r;let i=this,a=t.id,c=()=>i.world.entries.get(a)??t,l=()=>{let e=c();e.animated&&(e.rest.position.copy(e.object.position),e.rest.quaternion.copy(e.object.quaternion),e.rest.scale.copy(e.object.scale)),i.physics?.moved(a)},u=()=>i.physics?.engine.get(a)?.velocity??[0,0,0],d=(e,t)=>{let n=u();n[e]=t,i.physics?.engine.setVelocity(a,n)},f={id:a,position:T(()=>c().object.position,1,l),rotation:T(()=>c().object.rotation,e,l),scale:T(()=>c().object.scale,1,l),get visible(){return c().object.visible},set visible(e){let t=c();t.object.visible=e,t.rest.visible=e},velocity:{get x(){return u()[0]},set x(e){d(0,e)},get y(){return u()[1]},set y(e){d(1,e)},get z(){return u()[2]},set z(e){d(2,e)},set(e,t,n){i.physics?.engine.setVelocity(a,[e,t,n])}},get userData(){return c().object.userData},get tags(){return c().object.userData.tags??[]},setColor(e){let t=s(e);for(let e of o(c().object))e.color?.copy(t)},setOpacity(e){for(let t of o(c().object))t.opacity=e,e<1&&!t.transparent&&(t.transparent=!0,t.needsUpdate=!0)},playAnimation(e,t){c().animator?.play(e,t)},distanceTo(e){let t=c().object.getWorldPosition(new n),r=i.world.entries.get(e.id);return r?t.distanceTo(r.object.getWorldPosition(new n)):1/0},remove(){i.world.entries.get(a)?.object.traverse(e=>{let t=e.userData.a3dId;t&&i.physics?.remove(t)}),i.physics?.remove(a),i.world.removeEntry(a),i.objCache.delete(a)}};return this.objCache.set(a,f),f}idOf(e){return typeof e==`string`?e:e.id}createApi(){let a=this,o=()=>a.opts.input,s={id:`camera`,position:T(()=>a.world.rig.rest.position),rotation:T(()=>a.world.camera.rotation,e),scale:T(()=>a.world.camera.scale),visible:!0,velocity:T(()=>new n),userData:{},tags:[],setColor(){},setOpacity(){},playAnimation(){},distanceTo(e){let t=a.world.entries.get(e.id);return t?a.world.camera.position.distanceTo(t.object.getWorldPosition(new n)):1/0},remove(){},lookAt(e,t,n){a.world.rig.rest.target.set(e,t,n)},shake(e,t){a.shake={intensity:e,duration:t,until:a.simTime+t}}},c=new r,l={get:e=>{let t=a.world.entries.get(e);return t&&t.kind!==`light`?a.wrap(t):null},findByTag:e=>{let t=[];for(let n of a.world.entries.values())n.kind!==`light`&&(n.object.userData.tags??[]).includes(e)&&t.push(a.wrap(n));return t},spawn:async(e,t)=>{let n=t?a.world.entries.get(t):void 0,r=await a.world.addObject(e,n?.object??a.world.scene,n?.id,new Map);if(!r)throw Error(`spawn(${e.id}) failed`);return a.world.scene.updateMatrixWorld(!0),await a.addBodies(r),a.wrap(r)},clone:(e,t)=>{let n=a.world.entries.get(e);if(!n||n.kind===`light`)throw Error(`clone: unknown object "${e}"`);let r=t?.id;for(;!r||a.world.entries.has(r);)r=`${e}_${++a.cloneCounter}`;let i=n.object.clone(!0);i.traverse(e=>{let t=e;t.isMesh&&t.material&&(t.material=Array.isArray(t.material)?t.material.map(e=>e.clone()):t.material.clone()),e.userData.a3dId&&(e.userData={...e.userData})}),i.userData.a3dId=r,t?.position&&i.position.set(...t.position),(n.object.parent??a.world.scene).add(i);let o={...n.def,id:r,children:void 0},s={...n,id:r,def:o,object:i,rest:{position:i.position.clone(),quaternion:i.quaternion.clone(),scale:i.scale.clone(),visible:i.visible},runners:[],animator:void 0};return a.world.entries.set(r,s),a.world.scene.updateMatrixWorld(!0),o.body&&a.physics&&a.physics.addEntry(s),a.wrap(s)},camera:s,time:()=>a.simTime,random:()=>a.rng.next(),randomRange:(e,t)=>a.rng.range(e,t),input:{isDown:e=>o().keys.has(e),pressed:e=>a.stepPressed.has(e),get pointer(){let e=o().pointer;return{x:e.x,y:e.y,down:e.down,justPressed:a.stepJust}},swipe:()=>a.stepSwipe,pointerWorld:()=>{let e=o().pointer;c.setFromCamera(new t(e.x,e.y),a.world.camera);let r=[];for(let e of a.physics?.engine.bodies??[]){let t=a.world.entries.get(e.id);t&&r.push(t.object)}let s=r.length?c.intersectObjects(r,!0)[0]:void 0;if(s){let e=a.world.idsFor(s.object);return{x:s.point.x,y:s.point.y,z:s.point.z,objectId:e[0]}}let l=new n;return c.ray.intersectPlane(new i(new n(0,1,0),0),l)?{x:l.x,y:l.y,z:l.z}:null}},physics:{overlaps:(e,t)=>a.physics?.engine.overlaps(a.idOf(e),a.idOf(t))??!1,contacts:e=>(a.physics?.engine.contactsOf(a.idOf(e))??[]).map(e=>l.get(e.id)).filter(e=>!!e),raycast:(e,t,n,r)=>{let i=a.physics?.engine;if(!i)return null;let o=new Set((r?.ignore??[]).map(e=>a.idOf(e))),s=i.raycast(e,t,n??1/0,{ignore:o.size?e=>o.has(e.id):void 0,mask:r?.layers?i.layerMask(r.layers):void 0,triggers:r?.triggers});return s?{objectId:s.body.id,distance:s.distance,point:s.point,normal:s.normal}:null},applyImpulse:(e,t,n)=>a.physics?.engine.applyImpulse(a.idOf(e),t,n),applyForce:(e,t,n)=>a.physics?.engine.applyForce(a.idOf(e),t,n),applyTorque:(e,t)=>a.physics?.engine.applyTorque(a.idOf(e),t),setVelocity:(e,t)=>a.physics?.engine.setVelocity(a.idOf(e),t),getVelocity:e=>a.physics?.engine.get(a.idOf(e))?.velocity??[0,0,0],setAngularVelocity:(t,n)=>a.physics?.engine.setAngularVelocity(a.idOf(t),[n[0]*e,n[1]*e,n[2]*e]),getAngularVelocity:t=>{let n=a.physics?.engine.get(a.idOf(t))?.angularVelocity??[0,0,0];return[n[0]/e,n[1]/e,n[2]/e]},grounded:e=>a.physics?.engine.grounded(a.idOf(e))??!1,moveCharacter:(e,t,n)=>{let r=Array.isArray(t)?[t[0],t[1]]:[t.x,t.z];a.physics?.engine.moveCharacter(a.idOf(e),r,n)},jump:(e,t)=>a.physics?.engine.jump(a.idOf(e),t)??!1,wake:e=>a.physics?.engine.wake(a.idOf(e)),setMotorSpeed:(t,n)=>a.physics?.engine.setMotorSpeed(t,n*e),onCollision:e=>void a.collisionHandlers.push(e),onCollisionEnd:e=>void a.collisionEndHandlers.push(e),onTriggerEnter:e=>void a.triggerEnterHandlers.push(e),onTriggerExit:e=>void a.triggerExitHandlers.push(e)},state:a.state,ui:{set:(e,t)=>a.hud?.set(e,t),toast:(e,t)=>a.hud?.toast(e,t)},audio:{play:e=>a.audio.play(e),music:e=>a.audio.music(e)},on:(e,t)=>{let n=a.handlers.get(e)??[];n.push(t),a.handlers.set(e,n)},emit:(e,t)=>a.emit(e,t),storage:{get(e){try{let t=globalThis.localStorage?.getItem(`agent3d:${a.opts.scene.id}:${e}`);return t==null?void 0:JSON.parse(t)}catch{return}},set(e,t){try{globalThis.localStorage?.setItem(`agent3d:${a.opts.scene.id}:${e}`,JSON.stringify(t))}catch{}}},data:a.opts.scene.data??{},restart:()=>a.requestRestart(),log:(...e)=>console.log(`[agent3d]`,...e)};return l}};export{D as GameHost};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as e,i as t}from"./runtime-rd9RW3WH.js";import{t as n}from"./params-D-Ul6GSt.js";import{d as r,l as i,o as a,s as o,u as s}from"./camera-C0sxfRxy.js";import{n as c}from"./BufferGeometryUtils-CAlXAboW.js";import{An as l,Bn as u,Bt as d,C as f,Dt as p,E as m,En as h,I as g,In as _,J as v,Jt as y,K as b,Kt as x,Ln as S,M as C,Mn as w,N as T,Ot as E,P as D,Rn as O,St as k,T as A,U as j,Ut as M,W as N,Y as P,_ as F,_n as I,bn as L,bt as R,cn as z,ct as B,d as ee,fn as te,h as ne,hn as re,it as ie,jn as ae,kn as oe,lt as se,m as V,mn as ce,nn as le,on as ue,p as de,pn as fe,rn as pe,st as me,tn as he,tt as ge,v as _e,wn as ve,x as H,xn as ye,xt as U,y as be,yt as xe,zt as Se}from"./three.module-CnI50X0U.js";var Ce=class{pos=[];col=[];uv=[];wind=[];useUv=!1;useWind=!1;windFn=null;pushVertex(e,t,n,r,i=0,a=0){if(this.pos.push(e,t,n),this.col.push(r.r,r.g,r.b),this.useUv&&this.uv.push(i,a),this.useWind){let r=this.windFn?this.windFn(e,t,n):[0,0];this.wind.push(r[0],r[1])}}tri(e,t,n,r,i){this.pushVertex(e[0],e[1],e[2],r,i?.[0],i?.[1]),this.pushVertex(t[0],t[1],t[2],r,i?.[2],i?.[3]),this.pushVertex(n[0],n[1],n[2],r,i?.[4],i?.[5])}quad(e,t,n,r,i,a){this.tri(e,t,n,i,a?[a[0],a[1],a[2],a[3],a[4],a[5]]:void 0),this.tri(e,n,r,i,a?[a[0],a[1],a[4],a[5],a[6],a[7]]:void 0)}box(e,t,n,r=n,i={}){let[a,o,s]=e,[c,l,u]=t,d=(e,t,n)=>{if(!i.uv)return;let[r,a,o,s]=i.uv(e,t,n);return[r,a,o,a,o,s,r,s]},f=c-a,p=l-o,m=u-s;this.quad([a,o,u],[c,o,u],[c,l,u],[a,l,u],n,d(`z`,f,p)),this.quad([c,o,s],[a,o,s],[a,l,s],[c,l,s],n,d(`z`,f,p)),this.quad([c,o,u],[c,o,s],[c,l,s],[c,l,u],n,d(`x`,m,p)),this.quad([a,o,s],[a,o,u],[a,l,u],[a,l,s],n,d(`x`,m,p)),this.quad([a,l,u],[c,l,u],[c,l,s],[a,l,s],r,d(`y`,f,m)),i.bottom&&this.quad([a,o,s],[c,o,s],[c,o,u],[a,o,u],n,d(`y`,f,m))}add(e,t,n){let r=e.index?e.toNonIndexed():e,i=r.getAttribute(`position`),a=new S,o=[[0,0,0],[0,0,0],[0,0,0]],s=[[0,0,0],[0,0,0],[0,0,0]];for(let e=0;e<i.count/3;e++){for(let n=0;n<3;n++)a.fromBufferAttribute(i,e*3+n),s[n]=[a.x,a.y,a.z],a.applyMatrix4(t),o[n]=[a.x,a.y,a.z];let r=typeof n==`function`?n((s[0][0]+s[1][0]+s[2][0])/3,(s[0][1]+s[1][1]+s[2][1])/3,(s[0][2]+s[1][2]+s[2][2])/3,e):n;this.tri(o[0],o[1],o[2],r)}r!==e&&r.dispose()}get triangles(){return this.pos.length/9}build(){let e=new ne;return e.setAttribute(`position`,new g(this.pos,3)),e.setAttribute(`color`,new g(this.col,3)),this.useUv&&e.setAttribute(`uv`,new g(this.uv,2)),this.useWind&&e.setAttribute(`aWind`,new g(this.wind,2)),e.computeVertexNormals(),e.computeBoundingBox(),e.computeBoundingSphere(),e}};function we(e,t,n){let r=e.getAttribute(`position`),i=new Map;for(let e=0;e<r.count;e++){let a=`${r.getX(e).toFixed(4)},${r.getY(e).toFixed(4)},${r.getZ(e).toFixed(4)}`,o=i.get(a);o||(o=[(n()-.5)*t,(n()-.5)*t,(n()-.5)*t],i.set(a,o)),r.setXYZ(e,r.getX(e)+o[0],r.getY(e)+o[1],r.getZ(e)+o[2])}return r.needsUpdate=!0,e}var Te=(e,t,n,r=1,i=r,a=r,o=0,s=0,c=0)=>new R().compose(new S(e,t,n),new x().setFromEuler(new T(o,s,c)),new S(r,i,a)),Ee=(e,t)=>e.clone().multiplyScalar(t);function De(e,t,n=new H){if(e.length===1)return n.copy(e[0]);let r=Math.min(1,Math.max(0,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(r));return n.copy(e[i]).lerp(e[i+1],r-i)}var W=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};function Oe(e){let t=[...e.siblings.values()].filter(e=>e.heightAt&&e.object.userData.surface!==`water`),n=e.placement?.position??[0,0,0],r=e=>{let t=e.object.userData.size;if(typeof t!=`number`)return 1/0;let r=e.object.position,i=e.object.scale,a=t/2*Math.abs(i.x||1),o=t/2*Math.abs(i.z||1);return Math.abs(n[0]-r.x)<=a&&Math.abs(n[2]-r.z)<=o?a*o:-1},i=e=>{let t=r(e);return(t<0?2:0)+(e.object.userData.surface===`terrain`?0:1)+(t>0&&Number.isFinite(t)?t/1e9:.5)};t.sort((e,t)=>i(e)-i(t));for(let n of t){if(!n.heightAt)continue;let t=n.object.position,r=n.object.scale,i=e.placement?.position??[0,0,0],a=e.placement?.scale??[1,1,1],o=n.heightAt.bind(n),s=e=>(e-i[1])/(a[1]||1),c=typeof n.object.userData.waterLevel==`number`?s(n.object.userData.waterLevel*r.y+t.y):null;return{snow:typeof n.object.userData.snowLevel==`number`?s(n.object.userData.snowLevel*r.y+t.y):null,height:(e,n)=>{let c=i[0]+e*a[0],l=i[2]+n*a[2];return s(o((c-t.x)/(r.x||1),(l-t.z)/(r.z||1))*r.y+t.y)},water:c}}return null}function ke(e,t,n,r=.15,i=!0){let a=null,o={x:0,y:0,z:0};for(let s=0;s<12;s++){let c=(e.next()-.5)*t[0],l=(e.next()-.5)*t[2],u=n?n.height(c,l):(e.next()-.5)*t[1];if(s===0&&(o={x:c,y:u,z:l}),!n)return{x:c,y:u,z:l};let d=n.water===null||u>n.water+r,f=!i||n.snow===null||n.snow===void 0||u<n.snow;if(d&&f)return{x:c,y:u,z:l};d&&(!a||u<a.y)&&(a={x:c,y:u,z:l})}return a??o}function Ae(e={}){return new E({vertexColors:!0,flatShading:e.flat??!0,roughness:e.roughness??.9,metalness:e.metalness??0,side:e.side??0})}function je(e){e.traverse(e=>{let t=e;t.geometry&&t.geometry.dispose();let n=t.material?Array.isArray(t.material)?t.material:[t.material]:[];for(let e of n){for(let t of Object.values(e))t instanceof ve&&t.dispose();e.dispose()}})}function G(e,t={}){return{object:e,dispose:()=>je(e),...t}}var Me=[`sphere`,`torus`,`ring`,`pill`,`cone`,`cube`,`halfDisc`,`squiggle`,`triangle`,`star`];function Ne(e){switch(e){case`sphere`:return new re(.5,40,28);case`torus`:return new h(.38,.14,24,64);case`ring`:return new h(.42,.045,12,64);case`pill`:return new F(.2,.6,10,24).rotateZ(Math.PI/2);case`cone`:return new f(.4,.8,40);case`cube`:return new t(.7,.7,.7,4,.08);case`halfDisc`:{let e=new A(.5,.5,.18,40,1,!1,0,Math.PI);return e.rotateX(Math.PI/2),e}case`squiggle`:{let e=Array.from({length:9},(e,t)=>new S((t/8-.5)*1.3,Math.sin(t*1.4)*.16,0));return new oe(new _e(e),80,.06,12,!1)}case`triangle`:{let e=new z;for(let t=0;t<3;t++){let n=Math.PI/2+t/3*Math.PI*2;t===0?e.moveTo(Math.cos(n)*.5,Math.sin(n)*.5):e.lineTo(Math.cos(n)*.5,Math.sin(n)*.5)}let t=new D(e,{depth:.16,bevelEnabled:!0,bevelThickness:.04,bevelSize:.04,bevelSegments:4});return t.center(),t}case`star`:{let e=new z;for(let t=0;t<10;t++){let n=Math.PI/2+t/10*Math.PI*2,r=t%2?.22:.5;t===0?e.moveTo(Math.cos(n)*r,Math.sin(n)*r):e.lineTo(Math.cos(n)*r,Math.sin(n)*r)}let t=new D(e,{depth:.14,bevelEnabled:!0,bevelThickness:.04,bevelSize:.03,bevelSegments:3});return t.center(),t}}}var Pe=(t,r)=>{let i=n(`abstractShapes`,t,r),a=i.int(`count`),o=i.vec3(`area`),s=i.colors(`colors`),c=i.num(`minSize`),l=Math.max(c,i.num(`maxSize`)),u=i.str(`style`),d=i.num(`motion`),f=i.raw(`shapes`),m=Array.isArray(f)?f.filter(e=>Me.includes(e)):[],h=m.length?m:[...Me],g=r.rng,_=[];for(let e=0;e<a;e++){let t=new S,n=-1;for(let e=0;e<14;e++){let e=new S((g.next()-.5)*o[0],(g.next()-.5)*o[1],(g.next()-.5)*o[2]),r=1/0;for(let t of _)r=Math.min(r,e.distanceTo(t.pos)-t.s*.6);r>n&&(n=r,t=e)}let r=c+(l-c)*(1-e/Math.max(1,a))**1.5*g.range(.7,1);_.push({pos:t,s:r,kind:h[e%h.length],color:s[e%s.length],rot:new T(g.range(-.6,.6),g.next()*Math.PI*2,g.range(-.8,.8)),spin:new S(g.range(-.25,.25),g.range(-.35,.35),g.range(-.2,.2)),ph:g.next()*Math.PI*2})}for(let e=_.length-1;e>0;e--){let t=Math.floor(g.next()*(e+1)),n=_[e].color;_[e].color=_[t].color,_[t].color=n}let v=u===`toon`?e({color:16777215}):u===`glossy`?new p({color:16777215,roughness:.18,clearcoat:1,clearcoatRoughness:.08}):new E({color:16777215,roughness:.62,metalness:0}),y=new j;y.name=`abstractShapes`;let b=[];for(let e of h){let t=_.filter(t=>t.kind===e);if(!t.length)continue;let n=new P(Ne(e),v,t.length);n.name=`shapes-${e}`,n.castShadow=!0,n.receiveShadow=!0,n.userData.materialTarget=!0,t.forEach((e,t)=>n.setColorAt(t,e.color)),n.frustumCulled=!1,y.add(n),b.push({mesh:n,list:t})}let C=new R,w=new x,D=new T,O=new S,k=new S,A=e=>{for(let{mesh:t,list:n}of b)n.forEach((n,r)=>{O.copy(n.pos),O.y+=Math.sin(e*.8+n.ph)*.12*d*(.5+n.s*.5),D.set(n.rot.x+n.spin.x*e*d,n.rot.y+n.spin.y*e*d,n.rot.z+n.spin.z*e*d),w.setFromEuler(D),k.setScalar(n.s),t.setMatrixAt(r,C.compose(O,w,k))}),t.instanceMatrix.needsUpdate=!0};return A(0),G(y,{update:e=>A(e)})},Fe=e=>1+2.4*(e-1)**3+1.4*(e-1)**2;function Ie(e){if(!Array.isArray(e)||e.length===0)return[[3,5,4,7,6,9,8]];let t=e=>typeof e==`number`&&Number.isFinite(e)?e:e&&typeof e==`object`&&typeof e.value==`number`?e.value:0;return e.every(e=>Array.isArray(e))?e.map(e=>e.map(t)):[e.map(t)]}var Le=(e,r)=>{let i=n(`bars3d`,e,r),a=Ie(i.raw(`data`)),o=a.length,s=Math.max(...a.map(e=>e.length),1),c=i.num(`barWidth`),l=i.num(`gap`),u=i.num(`maxHeight`),d=i.colors(`colors`),f=i.str(`colorBy`),m=i.str(`shape`),h=i.str(`animation`),g=i.num(`duration`),_=Math.max(1e-6,...a.flat().map(e=>Math.abs(e))),v=c+l,y;y=m===`cylinder`?new A(.5,.5,1,32):m===`box`?new de(1,1,1):new t(1,1,1,4,.12),y.translate(0,.5,0);let b=o*s,C=new p({roughness:.32,metalness:0,clearcoat:.6,clearcoatRoughness:.25}),w=new P(y,C,b);w.name=`bars`,w.castShadow=!0,w.receiveShadow=!0,w.userData.materialTarget=!0;let T=[],D=new H,O=0;for(let e=0;e<o;e++)for(let t=0;t<s;t++){let n=a[e][t]??0,r=Math.max(1e-4,Math.abs(n)/_*u),i=(t-(s-1)/2)*v,c=(e-(o-1)/2)*v,l=f===`row`?o>1?e/(o-1):0:f===`column`?s>1?t/(s-1):0:Math.abs(n)/_;f===`value`?De(d,l,D):D.copy(d[(f===`row`?e:t)%d.length]),w.setColorAt(O,D),T.push({x:i,z:c,h:r,i:O,delay:(t+e*.6)/Math.max(1,s+o*.6)}),O++}let k=new R,M=new x,N=new S,F=new S,I=e=>{for(let t of T){let n=1;if(h===`grow`){let r=(e-t.delay*g*.6)/(g*.5);n=r<=0?1e-4:r>=1?1:Fe(Math.min(1,r)),r>0&&r<1&&(n=Math.max(1e-4,n))}else h===`wave`&&(n=.55+.45*(.5+.5*Math.sin(e*1.6-t.x*.9-t.z*.7)));N.set(t.x,0,t.z),F.set(c,t.h*n,c),w.setMatrixAt(t.i,k.compose(N,M,F))}w.instanceMatrix.needsUpdate=!0};I(0),w.computeBoundingSphere(),w.frustumCulled=!1;let L=new j;if(L.name=`bars3d`,L.add(w),i.bool(`base`)){let e=s*v+l,n=o*v+l,r=new U(new t(e,.12,n,3,.05),new E({color:i.color(`baseColor`),roughness:.6}));r.position.y=-.06,r.receiveShadow=!0,r.castShadow=!0,r.name=`bars-base`,L.add(r)}return G(L,{update:e=>I(e)})};function Re(){let e=[],t=[],n=(n,r,i,a)=>{e.push(...n,...r,...i),t.push(a,a,a)},r=[0,0,.42],i=[0,.01,-.34],a=[0,.07,.04],o=[0,-.06,.02],s=[-.075,0,.04],c=[.075,0,.04];for(let[e,t]of[[s,a],[a,c],[c,o],[o,s]])n(r,e,t,0),n(i,t,e,0);n([0,.01,-.3],[-.14,.02,-.58],[.14,.02,-.58],0);for(let e of[-1,1]){let t=[e*.05,.01,.14],r=[e*.05,.01,-.12],i=[e*.48,0,.1],a=[e*.48,0,-.14],o=[e*1,-.01,-.26];n(t,i,a,1),n(t,a,r,1),n(i,o,a,1)}let l=new ne;return l.setAttribute(`position`,new g(e,3)),l.setAttribute(`aWing`,new g(t,1)),l.computeVertexNormals(),l}var ze=(e,t)=>{let r=n(`birds`,e,t),a=r.int(`count`),o=r.str(`mode`),s=r.vec3(`area`),c=r.num(`speed`),l=r.num(`size`),u=r.num(`spread`),d=r.str(`formation`),f=r.num(`flapSpeed`),p=r.num(`heading`)*Math.PI/180,m=r.color(`color`),h=t.rng,g=Re();g.scale(l/2,l/2,l/2);let _=new Float32Array(a),y=new Float32Array(a);for(let e=0;e<a;e++)_[e]=h.next()*Math.PI*2,y[e]=f*h.range(.82,1.18);g.setAttribute(`aPhase`,new v(_,1)),g.setAttribute(`aRate`,new v(y,1));let b=new E({color:16777215,roughness:.9,metalness:0,flatShading:!0,side:2}),C={uTime:{value:0}};b.onBeforeCompile=e=>{Object.assign(e.uniforms,C),e.vertexShader=`uniform float uTime;
|
|
1
|
+
import{c as e,i as t}from"./runtime-5Ti8UJJR.js";import{t as n}from"./params-BZqUA__U.js";import{d as r,l as i,o as a,s as o,u as s}from"./camera-DrubOxWu.js";import{n as c}from"./BufferGeometryUtils-BbzK4rCj.js";import{An as l,Bn as u,Bt as d,C as f,Dt as p,E as m,En as h,I as g,In as _,J as v,Jt as y,K as b,Kt as x,Ln as S,M as C,Mn as w,N as T,Ot as E,P as D,Rn as O,St as k,T as A,U as j,Ut as M,W as N,Y as P,_ as F,_n as I,bn as L,bt as R,cn as z,ct as B,d as ee,fn as te,h as ne,hn as re,it as ie,jn as ae,kn as oe,lt as se,m as V,mn as ce,nn as le,on as ue,p as de,pn as fe,rn as pe,st as me,tn as he,tt as ge,v as _e,wn as ve,x as H,xn as ye,xt as U,y as be,yt as xe,zt as Se}from"./three.module-B9FlcKtd.js";var Ce=class{pos=[];col=[];uv=[];wind=[];useUv=!1;useWind=!1;windFn=null;pushVertex(e,t,n,r,i=0,a=0){if(this.pos.push(e,t,n),this.col.push(r.r,r.g,r.b),this.useUv&&this.uv.push(i,a),this.useWind){let r=this.windFn?this.windFn(e,t,n):[0,0];this.wind.push(r[0],r[1])}}tri(e,t,n,r,i){this.pushVertex(e[0],e[1],e[2],r,i?.[0],i?.[1]),this.pushVertex(t[0],t[1],t[2],r,i?.[2],i?.[3]),this.pushVertex(n[0],n[1],n[2],r,i?.[4],i?.[5])}quad(e,t,n,r,i,a){this.tri(e,t,n,i,a?[a[0],a[1],a[2],a[3],a[4],a[5]]:void 0),this.tri(e,n,r,i,a?[a[0],a[1],a[4],a[5],a[6],a[7]]:void 0)}box(e,t,n,r=n,i={}){let[a,o,s]=e,[c,l,u]=t,d=(e,t,n)=>{if(!i.uv)return;let[r,a,o,s]=i.uv(e,t,n);return[r,a,o,a,o,s,r,s]},f=c-a,p=l-o,m=u-s;this.quad([a,o,u],[c,o,u],[c,l,u],[a,l,u],n,d(`z`,f,p)),this.quad([c,o,s],[a,o,s],[a,l,s],[c,l,s],n,d(`z`,f,p)),this.quad([c,o,u],[c,o,s],[c,l,s],[c,l,u],n,d(`x`,m,p)),this.quad([a,o,s],[a,o,u],[a,l,u],[a,l,s],n,d(`x`,m,p)),this.quad([a,l,u],[c,l,u],[c,l,s],[a,l,s],r,d(`y`,f,m)),i.bottom&&this.quad([a,o,s],[c,o,s],[c,o,u],[a,o,u],n,d(`y`,f,m))}add(e,t,n){let r=e.index?e.toNonIndexed():e,i=r.getAttribute(`position`),a=new S,o=[[0,0,0],[0,0,0],[0,0,0]],s=[[0,0,0],[0,0,0],[0,0,0]];for(let e=0;e<i.count/3;e++){for(let n=0;n<3;n++)a.fromBufferAttribute(i,e*3+n),s[n]=[a.x,a.y,a.z],a.applyMatrix4(t),o[n]=[a.x,a.y,a.z];let r=typeof n==`function`?n((s[0][0]+s[1][0]+s[2][0])/3,(s[0][1]+s[1][1]+s[2][1])/3,(s[0][2]+s[1][2]+s[2][2])/3,e):n;this.tri(o[0],o[1],o[2],r)}r!==e&&r.dispose()}get triangles(){return this.pos.length/9}build(){let e=new ne;return e.setAttribute(`position`,new g(this.pos,3)),e.setAttribute(`color`,new g(this.col,3)),this.useUv&&e.setAttribute(`uv`,new g(this.uv,2)),this.useWind&&e.setAttribute(`aWind`,new g(this.wind,2)),e.computeVertexNormals(),e.computeBoundingBox(),e.computeBoundingSphere(),e}};function we(e,t,n){let r=e.getAttribute(`position`),i=new Map;for(let e=0;e<r.count;e++){let a=`${r.getX(e).toFixed(4)},${r.getY(e).toFixed(4)},${r.getZ(e).toFixed(4)}`,o=i.get(a);o||(o=[(n()-.5)*t,(n()-.5)*t,(n()-.5)*t],i.set(a,o)),r.setXYZ(e,r.getX(e)+o[0],r.getY(e)+o[1],r.getZ(e)+o[2])}return r.needsUpdate=!0,e}var Te=(e,t,n,r=1,i=r,a=r,o=0,s=0,c=0)=>new R().compose(new S(e,t,n),new x().setFromEuler(new T(o,s,c)),new S(r,i,a)),Ee=(e,t)=>e.clone().multiplyScalar(t);function De(e,t,n=new H){if(e.length===1)return n.copy(e[0]);let r=Math.min(1,Math.max(0,t))*(e.length-1),i=Math.min(e.length-2,Math.floor(r));return n.copy(e[i]).lerp(e[i+1],r-i)}var W=(e,t,n)=>{let r=Math.min(1,Math.max(0,(n-e)/(t-e)));return r*r*(3-2*r)};function Oe(e){let t=[...e.siblings.values()].filter(e=>e.heightAt&&e.object.userData.surface!==`water`),n=e.placement?.position??[0,0,0],r=e=>{let t=e.object.userData.size;if(typeof t!=`number`)return 1/0;let r=e.object.position,i=e.object.scale,a=t/2*Math.abs(i.x||1),o=t/2*Math.abs(i.z||1);return Math.abs(n[0]-r.x)<=a&&Math.abs(n[2]-r.z)<=o?a*o:-1},i=e=>{let t=r(e);return(t<0?2:0)+(e.object.userData.surface===`terrain`?0:1)+(t>0&&Number.isFinite(t)?t/1e9:.5)};t.sort((e,t)=>i(e)-i(t));for(let n of t){if(!n.heightAt)continue;let t=n.object.position,r=n.object.scale,i=e.placement?.position??[0,0,0],a=e.placement?.scale??[1,1,1],o=n.heightAt.bind(n),s=e=>(e-i[1])/(a[1]||1),c=typeof n.object.userData.waterLevel==`number`?s(n.object.userData.waterLevel*r.y+t.y):null;return{snow:typeof n.object.userData.snowLevel==`number`?s(n.object.userData.snowLevel*r.y+t.y):null,height:(e,n)=>{let c=i[0]+e*a[0],l=i[2]+n*a[2];return s(o((c-t.x)/(r.x||1),(l-t.z)/(r.z||1))*r.y+t.y)},water:c}}return null}function ke(e,t,n,r=.15,i=!0){let a=null,o={x:0,y:0,z:0};for(let s=0;s<12;s++){let c=(e.next()-.5)*t[0],l=(e.next()-.5)*t[2],u=n?n.height(c,l):(e.next()-.5)*t[1];if(s===0&&(o={x:c,y:u,z:l}),!n)return{x:c,y:u,z:l};let d=n.water===null||u>n.water+r,f=!i||n.snow===null||n.snow===void 0||u<n.snow;if(d&&f)return{x:c,y:u,z:l};d&&(!a||u<a.y)&&(a={x:c,y:u,z:l})}return a??o}function Ae(e={}){return new E({vertexColors:!0,flatShading:e.flat??!0,roughness:e.roughness??.9,metalness:e.metalness??0,side:e.side??0})}function je(e){e.traverse(e=>{let t=e;t.geometry&&t.geometry.dispose();let n=t.material?Array.isArray(t.material)?t.material:[t.material]:[];for(let e of n){for(let t of Object.values(e))t instanceof ve&&t.dispose();e.dispose()}})}function G(e,t={}){return{object:e,dispose:()=>je(e),...t}}var Me=[`sphere`,`torus`,`ring`,`pill`,`cone`,`cube`,`halfDisc`,`squiggle`,`triangle`,`star`];function Ne(e){switch(e){case`sphere`:return new re(.5,40,28);case`torus`:return new h(.38,.14,24,64);case`ring`:return new h(.42,.045,12,64);case`pill`:return new F(.2,.6,10,24).rotateZ(Math.PI/2);case`cone`:return new f(.4,.8,40);case`cube`:return new t(.7,.7,.7,4,.08);case`halfDisc`:{let e=new A(.5,.5,.18,40,1,!1,0,Math.PI);return e.rotateX(Math.PI/2),e}case`squiggle`:{let e=Array.from({length:9},(e,t)=>new S((t/8-.5)*1.3,Math.sin(t*1.4)*.16,0));return new oe(new _e(e),80,.06,12,!1)}case`triangle`:{let e=new z;for(let t=0;t<3;t++){let n=Math.PI/2+t/3*Math.PI*2;t===0?e.moveTo(Math.cos(n)*.5,Math.sin(n)*.5):e.lineTo(Math.cos(n)*.5,Math.sin(n)*.5)}let t=new D(e,{depth:.16,bevelEnabled:!0,bevelThickness:.04,bevelSize:.04,bevelSegments:4});return t.center(),t}case`star`:{let e=new z;for(let t=0;t<10;t++){let n=Math.PI/2+t/10*Math.PI*2,r=t%2?.22:.5;t===0?e.moveTo(Math.cos(n)*r,Math.sin(n)*r):e.lineTo(Math.cos(n)*r,Math.sin(n)*r)}let t=new D(e,{depth:.14,bevelEnabled:!0,bevelThickness:.04,bevelSize:.03,bevelSegments:3});return t.center(),t}}}var Pe=(t,r)=>{let i=n(`abstractShapes`,t,r),a=i.int(`count`),o=i.vec3(`area`),s=i.colors(`colors`),c=i.num(`minSize`),l=Math.max(c,i.num(`maxSize`)),u=i.str(`style`),d=i.num(`motion`),f=i.raw(`shapes`),m=Array.isArray(f)?f.filter(e=>Me.includes(e)):[],h=m.length?m:[...Me],g=r.rng,_=[];for(let e=0;e<a;e++){let t=new S,n=-1;for(let e=0;e<14;e++){let e=new S((g.next()-.5)*o[0],(g.next()-.5)*o[1],(g.next()-.5)*o[2]),r=1/0;for(let t of _)r=Math.min(r,e.distanceTo(t.pos)-t.s*.6);r>n&&(n=r,t=e)}let r=c+(l-c)*(1-e/Math.max(1,a))**1.5*g.range(.7,1);_.push({pos:t,s:r,kind:h[e%h.length],color:s[e%s.length],rot:new T(g.range(-.6,.6),g.next()*Math.PI*2,g.range(-.8,.8)),spin:new S(g.range(-.25,.25),g.range(-.35,.35),g.range(-.2,.2)),ph:g.next()*Math.PI*2})}for(let e=_.length-1;e>0;e--){let t=Math.floor(g.next()*(e+1)),n=_[e].color;_[e].color=_[t].color,_[t].color=n}let v=u===`toon`?e({color:16777215}):u===`glossy`?new p({color:16777215,roughness:.18,clearcoat:1,clearcoatRoughness:.08}):new E({color:16777215,roughness:.62,metalness:0}),y=new j;y.name=`abstractShapes`;let b=[];for(let e of h){let t=_.filter(t=>t.kind===e);if(!t.length)continue;let n=new P(Ne(e),v,t.length);n.name=`shapes-${e}`,n.castShadow=!0,n.receiveShadow=!0,n.userData.materialTarget=!0,t.forEach((e,t)=>n.setColorAt(t,e.color)),n.frustumCulled=!1,y.add(n),b.push({mesh:n,list:t})}let C=new R,w=new x,D=new T,O=new S,k=new S,A=e=>{for(let{mesh:t,list:n}of b)n.forEach((n,r)=>{O.copy(n.pos),O.y+=Math.sin(e*.8+n.ph)*.12*d*(.5+n.s*.5),D.set(n.rot.x+n.spin.x*e*d,n.rot.y+n.spin.y*e*d,n.rot.z+n.spin.z*e*d),w.setFromEuler(D),k.setScalar(n.s),t.setMatrixAt(r,C.compose(O,w,k))}),t.instanceMatrix.needsUpdate=!0};return A(0),G(y,{update:e=>A(e)})},Fe=e=>1+2.4*(e-1)**3+1.4*(e-1)**2;function Ie(e){if(!Array.isArray(e)||e.length===0)return[[3,5,4,7,6,9,8]];let t=e=>typeof e==`number`&&Number.isFinite(e)?e:e&&typeof e==`object`&&typeof e.value==`number`?e.value:0;return e.every(e=>Array.isArray(e))?e.map(e=>e.map(t)):[e.map(t)]}var Le=(e,r)=>{let i=n(`bars3d`,e,r),a=Ie(i.raw(`data`)),o=a.length,s=Math.max(...a.map(e=>e.length),1),c=i.num(`barWidth`),l=i.num(`gap`),u=i.num(`maxHeight`),d=i.colors(`colors`),f=i.str(`colorBy`),m=i.str(`shape`),h=i.str(`animation`),g=i.num(`duration`),_=Math.max(1e-6,...a.flat().map(e=>Math.abs(e))),v=c+l,y;y=m===`cylinder`?new A(.5,.5,1,32):m===`box`?new de(1,1,1):new t(1,1,1,4,.12),y.translate(0,.5,0);let b=o*s,C=new p({roughness:.32,metalness:0,clearcoat:.6,clearcoatRoughness:.25}),w=new P(y,C,b);w.name=`bars`,w.castShadow=!0,w.receiveShadow=!0,w.userData.materialTarget=!0;let T=[],D=new H,O=0;for(let e=0;e<o;e++)for(let t=0;t<s;t++){let n=a[e][t]??0,r=Math.max(1e-4,Math.abs(n)/_*u),i=(t-(s-1)/2)*v,c=(e-(o-1)/2)*v,l=f===`row`?o>1?e/(o-1):0:f===`column`?s>1?t/(s-1):0:Math.abs(n)/_;f===`value`?De(d,l,D):D.copy(d[(f===`row`?e:t)%d.length]),w.setColorAt(O,D),T.push({x:i,z:c,h:r,i:O,delay:(t+e*.6)/Math.max(1,s+o*.6)}),O++}let k=new R,M=new x,N=new S,F=new S,I=e=>{for(let t of T){let n=1;if(h===`grow`){let r=(e-t.delay*g*.6)/(g*.5);n=r<=0?1e-4:r>=1?1:Fe(Math.min(1,r)),r>0&&r<1&&(n=Math.max(1e-4,n))}else h===`wave`&&(n=.55+.45*(.5+.5*Math.sin(e*1.6-t.x*.9-t.z*.7)));N.set(t.x,0,t.z),F.set(c,t.h*n,c),w.setMatrixAt(t.i,k.compose(N,M,F))}w.instanceMatrix.needsUpdate=!0};I(0),w.computeBoundingSphere(),w.frustumCulled=!1;let L=new j;if(L.name=`bars3d`,L.add(w),i.bool(`base`)){let e=s*v+l,n=o*v+l,r=new U(new t(e,.12,n,3,.05),new E({color:i.color(`baseColor`),roughness:.6}));r.position.y=-.06,r.receiveShadow=!0,r.castShadow=!0,r.name=`bars-base`,L.add(r)}return G(L,{update:e=>I(e)})};function Re(){let e=[],t=[],n=(n,r,i,a)=>{e.push(...n,...r,...i),t.push(a,a,a)},r=[0,0,.42],i=[0,.01,-.34],a=[0,.07,.04],o=[0,-.06,.02],s=[-.075,0,.04],c=[.075,0,.04];for(let[e,t]of[[s,a],[a,c],[c,o],[o,s]])n(r,e,t,0),n(i,t,e,0);n([0,.01,-.3],[-.14,.02,-.58],[.14,.02,-.58],0);for(let e of[-1,1]){let t=[e*.05,.01,.14],r=[e*.05,.01,-.12],i=[e*.48,0,.1],a=[e*.48,0,-.14],o=[e*1,-.01,-.26];n(t,i,a,1),n(t,a,r,1),n(i,o,a,1)}let l=new ne;return l.setAttribute(`position`,new g(e,3)),l.setAttribute(`aWing`,new g(t,1)),l.computeVertexNormals(),l}var ze=(e,t)=>{let r=n(`birds`,e,t),a=r.int(`count`),o=r.str(`mode`),s=r.vec3(`area`),c=r.num(`speed`),l=r.num(`size`),u=r.num(`spread`),d=r.str(`formation`),f=r.num(`flapSpeed`),p=r.num(`heading`)*Math.PI/180,m=r.color(`color`),h=t.rng,g=Re();g.scale(l/2,l/2,l/2);let _=new Float32Array(a),y=new Float32Array(a);for(let e=0;e<a;e++)_[e]=h.next()*Math.PI*2,y[e]=f*h.range(.82,1.18);g.setAttribute(`aPhase`,new v(_,1)),g.setAttribute(`aRate`,new v(y,1));let b=new E({color:16777215,roughness:.9,metalness:0,flatShading:!0,side:2}),C={uTime:{value:0}};b.onBeforeCompile=e=>{Object.assign(e.uniforms,C),e.vertexShader=`uniform float uTime;
|
|
2
2
|
attribute float aWing;
|
|
3
3
|
attribute float aPhase;
|
|
4
4
|
attribute float aRate;
|