@fleox/agent3d 0.4.0 → 0.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/README.md +45 -14
  2. package/changelog.json +24 -0
  3. package/dist/agent/agent3d.mjs +779 -85
  4. package/dist/agent/chunks/{assets-YBkgdfgy.mjs → assets-DdzHgVcn.mjs} +2 -2
  5. package/dist/agent/chunks/{browser-Dil7VM5m.mjs → browser-nFaRUETt.mjs} +1 -1
  6. package/dist/agent/chunks/{cdp-DLEis_Z3.mjs → cdp-6vF_gP-H.mjs} +1 -1
  7. package/dist/agent/chunks/{check-DP9fRYbK.mjs → check-E7GdPxTt.mjs} +14 -2
  8. package/dist/agent/chunks/{depth-CD_ql3QJ.mjs → depth-Bf7cHwod.mjs} +4 -4
  9. package/dist/agent/chunks/{depth-BZT4gseQ.mjs → depth-DEaogEAi.mjs} +4 -114
  10. package/dist/agent/chunks/{export-CEX5DFLo.mjs → export-BSOqVfPT.mjs} +8 -4
  11. package/dist/agent/chunks/{imageCodec-DeGfmBp3.mjs → imageCodec-DXxqkEQA.mjs} +53 -4
  12. package/dist/agent/chunks/{objects-DuytRxiC.mjs → objects-DvzrcVmK.mjs} +2 -2
  13. package/dist/agent/chunks/{optimizeSizing-B-BBiUkD.mjs → optimizeSizing-Dd8vaSnE.mjs} +24 -1
  14. package/dist/agent/chunks/{package-DjRnLzcU.mjs → package-Bn7PKfXn.mjs} +1 -1
  15. package/dist/agent/chunks/photoPlacement-D-k3mD0T.mjs +138 -0
  16. package/dist/agent/chunks/plate-Cwl35I2T.mjs +604 -0
  17. package/dist/agent/chunks/pngEncode-BMc3U9QC.mjs +119 -0
  18. package/dist/agent/chunks/{render-B05DU4Q5.mjs → render-CCKciCgu.mjs} +76 -11
  19. package/dist/agent/chunks/{scene-DWgXH6As.mjs → scene-DSjsun-3.mjs} +22 -5
  20. package/dist/agent/chunks/{server-Dt_YFvN7.mjs → server-CLvLORgA.mjs} +1 -1
  21. package/dist/agent/chunks/{tools-CZyIc4zw.mjs → tools-Vs74Xopx.mjs} +142 -13
  22. package/dist/runtime/agent3d-photo.js +51 -10
  23. package/dist/runtime/agent3d-runtime.js +23 -23
  24. package/dist/runtime/agent3d-runtime.single.js +405 -134
  25. package/dist/runtime/chunks/photo-Dq-AKlfw.js +526 -0
  26. package/dist/studio/assets/BufferGeometryUtils-BbzK4rCj.js +1 -0
  27. package/dist/studio/assets/{EXRLoader-BKkzlNd8.js → EXRLoader-CuDOo1xG.js} +1 -1
  28. package/dist/studio/assets/{FontLoader-Bzjx8mXt.js → FontLoader-DlBfss5q.js} +1 -1
  29. package/dist/studio/assets/{GLTFLoader-1Zd9N406.js → GLTFLoader-bl1eymL4.js} +1 -1
  30. package/dist/studio/assets/{GroundedSkybox-BEMqNCBD.js → GroundedSkybox-cLn9JVlt.js} +1 -1
  31. package/dist/studio/assets/{HDRLoader-DxB0kxPH.js → HDRLoader-8EiZoQQP.js} +1 -1
  32. package/dist/studio/assets/{OrbitControls-MlE9XiCg.js → OrbitControls-1xEm394I.js} +1 -1
  33. package/dist/studio/assets/{RectAreaLightUniformsLib-ClHrtYY6.js → RectAreaLightUniformsLib-S0AelTmO.js} +1 -1
  34. package/dist/studio/assets/{RoomEnvironment-MJ-jIEC8.js → RoomEnvironment-v4QurKxu.js} +1 -1
  35. package/dist/studio/assets/{SVGLoader-CIYl0nEy.js → SVGLoader-KDBVv02P.js} +1 -1
  36. package/dist/studio/assets/{Sky-DNMfpp92.js → Sky-D8Lp9Zh3.js} +1 -1
  37. package/dist/studio/assets/assets-DICv7P37.js +2 -0
  38. package/dist/studio/assets/camera-HsMeC1mn.js +2 -0
  39. package/dist/studio/assets/catalog-DDg904x2.js +1 -0
  40. package/dist/studio/assets/{editor-DzyukvQl.js → editor-BZLIZJC8.js} +1 -1
  41. package/dist/studio/assets/{extrude-9bG8hr2C.js → extrude-BpJda0hq.js} +1 -1
  42. package/dist/studio/assets/game-DnnuBk26.js +19 -0
  43. package/dist/studio/assets/{generators-BuVeRXnC.js → generators-C4n9MsXd.js} +1 -1
  44. package/dist/studio/assets/index-D-TPNQMQ.css +1 -0
  45. package/dist/studio/assets/index-cDbmaVDl.js +479 -0
  46. package/dist/studio/assets/model-CkPfLOl0.js +2 -0
  47. package/dist/studio/assets/params-BZqUA__U.js +1 -0
  48. package/dist/studio/assets/photo-CPGGCRa-.js +526 -0
  49. package/dist/studio/assets/{physicsHost-z9qn_mpg.js → physicsHost-EkPuIy04.js} +1 -1
  50. package/dist/studio/assets/{postfx-B3jDEaEK.js → postfx-Dp7mgfGJ.js} +2 -2
  51. package/dist/studio/assets/rolldown-runtime-4tVxZq34.js +1 -0
  52. package/dist/studio/assets/runtime-ByR4qfyV.js +572 -0
  53. package/dist/studio/assets/{shaders-bFhELLmD.js → shaders-DoRMwJE_.js} +1 -1
  54. package/dist/studio/assets/svg-n3rkKAm5.js +2 -0
  55. package/dist/studio/assets/text-BkPPDghK.js +3 -0
  56. package/dist/studio/assets/three.module-B9FlcKtd.js +4225 -0
  57. package/dist/studio/index.html +5 -3
  58. package/package.json +1 -1
  59. package/plugin/.claude-plugin/plugin.json +1 -1
  60. package/plugin/skills/agent3d-assets/SKILL.md +42 -27
  61. package/plugin/skills/agent3d-create/SKILL.md +77 -29
  62. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  63. package/plugin/skills/agent3d-create/references/recipes.md +6 -6
  64. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  65. package/plugin/skills/agent3d-edit/references/patch-ops.md +3 -3
  66. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  67. package/plugin/skills/agent3d-publish/SKILL.md +30 -23
  68. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  69. package/templates/hero-scroll-story/README.md +1 -1
  70. package/templates/photo-scroll-story/README.md +29 -0
  71. package/templates/photo-scroll-story/agent3d.json +8 -0
  72. package/templates/photo-scroll-story/assets/depth/lake-depth.png +0 -0
  73. package/templates/photo-scroll-story/assets/depth/street-depth.png +0 -0
  74. package/templates/photo-scroll-story/assets/manifest.json +46 -0
  75. package/templates/photo-scroll-story/assets/textures/lake.webp +0 -0
  76. package/templates/photo-scroll-story/assets/textures/street.webp +0 -0
  77. package/templates/photo-scroll-story/preview.png +0 -0
  78. package/templates/photo-scroll-story/scene.json +112 -0
  79. package/templates/photo-scroll-story/template.json +8 -0
  80. package/templates/photo-title-inside/README.md +31 -0
  81. package/templates/photo-title-inside/agent3d.json +8 -0
  82. package/templates/photo-title-inside/assets/depth/street-depth.png +0 -0
  83. package/templates/photo-title-inside/assets/manifest.json +25 -0
  84. package/templates/photo-title-inside/assets/textures/street.webp +0 -0
  85. package/templates/photo-title-inside/preview.png +0 -0
  86. package/templates/photo-title-inside/scene.json +80 -0
  87. package/templates/photo-title-inside/template.json +8 -0
  88. package/dist/runtime/chunks/photo-w6dwHX7j.js +0 -255
  89. package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +0 -1
  90. package/dist/studio/assets/assets--ehPZf8R.js +0 -1
  91. package/dist/studio/assets/camera-C0sxfRxy.js +0 -2
  92. package/dist/studio/assets/game-DNpTN_Ga.js +0 -19
  93. package/dist/studio/assets/index-BQT0otii.css +0 -1
  94. package/dist/studio/assets/index-C2nMYSoW.js +0 -479
  95. package/dist/studio/assets/model-DQgOrTs4.js +0 -2
  96. package/dist/studio/assets/params-D-Ul6GSt.js +0 -1
  97. package/dist/studio/assets/photo-Dx2IBJ11.js +0 -255
  98. package/dist/studio/assets/runtime-rd9RW3WH.js +0 -572
  99. package/dist/studio/assets/svg-BkV9LeqP.js +0 -2
  100. package/dist/studio/assets/text-Dp8gdjSA.js +0 -3
  101. package/dist/studio/assets/three.module-CnI50X0U.js +0 -4225
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./GLTFLoader-bl1eymL4.js","./three.module-B9FlcKtd.js","./rolldown-runtime-4tVxZq34.js","./BufferGeometryUtils-BbzK4rCj.js","./SkeletonUtils-CG5akqME.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./num-CQNAlL82.js";import{Ln as t,U as n,c as r,d as i,ht as a,mt as o}from"./three.module-B9FlcKtd.js";import{o as s}from"./runtime-ByR4qfyV.js";import{g as c}from"./index-cDbmaVDl.js";var l=new Map;function u(e){let t=new Uint8Array(e),n;if(t.byteLength>=20&&new DataView(e).getUint32(0,!0)===1179937895){let r=new DataView(e).getUint32(12,!0);n=new TextDecoder().decode(t.subarray(20,20+r))}else n=new TextDecoder().decode(t);try{let e=JSON.parse(n);return Array.isArray(e.extensionsUsed)?e.extensionsUsed.filter(e=>typeof e==`string`):[]}catch{return[]}}async function d(e){let t=l.get(e);return t||(t=(async()=>{let[{GLTFLoader:t},n]=await Promise.all([c(()=>import(`./GLTFLoader-bl1eymL4.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),fetch(e)]);if(!n.ok)throw Error(`HTTP ${n.status} for ${e}`);let r=await n.arrayBuffer(),i=u(r);if(i.includes(`KHR_draco_mesh_compression`))throw Error(`${e} uses Draco compression (KHR_draco_mesh_compression), which the Agent3D runtime does not decode. Re-export it without Draco (Blender: uncheck "Compression"), or convert it to meshopt with gltfpack (\`gltfpack -i in.glb -o out.glb -cc\`), then run \`agent3d assets optimize\`.`);let a=new t;if(i.includes(`EXT_meshopt_compression`)){let{MeshoptDecoder:e}=await c(async()=>{let{MeshoptDecoder:e}=await import(`./meshopt_decoder.module-DXTYc6wn.js`);return{MeshoptDecoder:e}},[],import.meta.url);await e.ready,a.setMeshoptDecoder(e)}let o=e.slice(0,e.lastIndexOf(`/`)+1);return a.parseAsync(r,/^data:/.test(e)?``:o)})(),t.catch(()=>l.delete(e)),l.set(e,t)),t}function f(e,t){e.traverse(e=>{let n=e;if(n.isMesh&&n.morphTargetDictionary&&n.morphTargetInfluences)for(let[e,r]of Object.entries(t)){let t=n.morphTargetDictionary[e];t!==void 0&&typeof r==`number`&&(n.morphTargetInfluences[t]=r)}})}async function p(l,u){let p=await d(u.resolveAsset(l.src)),{clone:m}=await c(async()=>{let{clone:e}=await import(`./SkeletonUtils-CG5akqME.js`);return{clone:e}},[],import.meta.url),h=m(p.scene),g=new n;g.add(h),h.updateMatrixWorld(!0);let _=new i().setFromObject(h);if(!_.isEmpty()){let e=_.getSize(new t),n=Math.max(e.x,e.y,e.z),r=l.fit&&n>0?l.fit/n:1;if(h.scale.multiplyScalar(r),l.center!==!1){let e=_.getCenter(new t);h.position.set(-e.x*r,-_.min.y*r,-e.z*r)}}h.traverse(e=>{let t=e;t.isMesh&&(t.castShadow=l.castShadow??!0,t.receiveShadow=l.receiveShadow??!1)}),l.material&&await s(h,l.material,u),l.morph&&f(h,l.morph);let v;if(p.animations.length){let t=new r(h),n=null,i=e=>typeof e==`number`||/^\d+$/.test(String(e))?p.animations[Number(e)]:p.animations.find(t=>t.name===e)??p.animations.find(t=>t.name.toLowerCase().includes(String(e).toLowerCase())),s=new Set,c=e=>{let t=i(e);return!t&&!s.has(String(e))&&(s.add(String(e)),u.issue(`asset-load`,`Model ${l.id} has no animation clip "${e}" (clips: ${p.animations.map(e=>e.name).join(`, `)})`,`objects#${l.id}.animation.clip`)),t},d=(r,i={})=>{let s=c(r);if(!s)return;let l=t.clipAction(s);l.setLoop(i.loop===!1?o:a,1/0),l.clampWhenFinished=i.loop===!1,l.timeScale=e(i.speed,1),l.enabled=!0,n&&n!==l?(l.reset().setEffectiveWeight(1).play(),n.crossFadeTo(l,e(i.crossfade,.3),!1)):l.setEffectiveWeight(1).play(),n=l},f=e=>{let n=c(e);if(!n)return null;let r=t.clipAction(n);return r.isRunning()||(r.enabled=!0,r.setLoop(a,1/0),r.play()),r},m={weight(e,t){f(e)?.setEffectiveWeight(Math.max(0,t))},speed(e,t){let n=f(e);n&&(n.timeScale=t)},time(e,t){let n=f(e);n&&(n.paused=!0,n.time=Math.max(0,t))}},g=l.animation??{},_=()=>{t.stopAllAction(),n=null,d(g.clip??0,g),g.offset&&n&&(n.time=Math.max(0,g.offset));for(let[e,t]of Object.entries(g.blend??{}))m.weight(e,t);t.update(0)};v={mixer:t,clips:p.animations,play:d,control:m,reset:_},_()}return{object:g,animator:v}}export{p as buildModel};
@@ -0,0 +1 @@
1
+ import{h as e,i as t}from"./catalog-DDg904x2.js";import{x as n}from"./three.module-B9FlcKtd.js";var r=(e,t)=>{try{return e?e.color(t).clone():new n(t)}catch{return new n(t)}};function i(e,t,n){let i=t??{},a=t=>{let n=e.params.find(e=>e.name===t);if(!n)throw Error(`${e.id}: no catalog param "${t}"`);return n},o=e=>{let t=a(e),n=i[e];return n===void 0?t.default:n},s=(e,t)=>{let n=a(e);return n.min!==void 0&&t<n.min&&(t=n.min),n.max!==void 0&&t>n.max&&(t=n.max),t},c=e=>{let t=o(e);return typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isFinite(t)||(t=a(e).default),s(e,typeof t==`number`?t:0)};return{num:c,numOrNull:e=>i[e]===null?null:c(e),int:e=>Math.round(c(e)),bool:e=>{let t=o(e);return typeof t==`boolean`?t:!!a(e).default},str:e=>{let t=a(e),n=o(e);return typeof n==`string`&&(!t.options||t.options.includes(n))?n:t.default},color:e=>{let t=o(e);return r(n,typeof t==`string`?t:String(a(e).default??`#ffffff`))},colors:e=>{let t=o(e);return typeof t==`string`&&(t=[t]),Array.isArray(t)&&t.length!==0||(t=a(e).default),t.map(e=>r(n,typeof e==`string`?e:`#ffffff`))},vec3:e=>{let t=o(e),n=a(e).default??[0,0,0];return Array.isArray(t)?[0,1,2].map(e=>typeof t[e]==`number`?t[e]:n[e]):[...n]},raw:e=>o(e)}}var a=(e,t)=>{let n=e.find(e=>e.id===t);if(!n)throw Error(`unknown catalog id ${t}`);return n},o=(e,n,r)=>i(a(t,e),n,r),s=(t,n,r)=>i(a(e,t),n,r);export{i as n,s as r,o as t};
@@ -0,0 +1,526 @@
1
+ import{r as e}from"./assets-DICv7P37.js";import{Bt as t,In as n,Ln as r,Rn as i,St as a,U as o,bt as s,ct as c,d as l,h as u,kt as d,lt as f,m as p,mn as ee,on as m,rn as te,x as ne,xt as h,yt as re}from"./three.module-B9FlcKtd.js";import{n as g,r as _,t as ie}from"./num-CQNAlL82.js";import{C as v,f as y,w as b}from"./index-cDbmaVDl.js";var x={width:4,strength:.5,focus:.5,segments:256,layers:6,edgeCut:.08,speed:1,smoothing:.9};function ae(e,t,n){let r=t>0&&n>0?t/n:1,i=typeof e.width==`number`&&e.width>0?e.width:void 0,a=typeof e.height==`number`&&e.height>0?e.height:void 0;if(i!==void 0&&a!==void 0)return{width:i,height:a};if(a!==void 0)return{width:a*r,height:a};let o=i??x.width;return{width:o,height:o/r}}var S=[`zoom`,`dolly`,`pan`,`rise`,`vertigo`],C=[`pan`,`rise`];function w(e,t){let n=g(t,0,1),r=2*Math.PI*n;switch(e??`sway`){case`sway`:return{x:.9*Math.sin(r),y:.35*Math.sin(2*r),zoom:0};case`orbit`:return{x:.8*Math.sin(r),y:.8*Math.cos(r),zoom:0};case`zoom`:return{x:0,y:0,zoom:n};case`dolly`:return{x:0,y:.12*n,zoom:1.1*n,push:.12*n};case`pan`:return{x:.85*(2*n-1),y:0,zoom:.15,push:.03};case`rise`:return{x:0,y:.8*(2*n-1),zoom:.2+.25*n,push:.03+.03*n};case`vertigo`:return{x:0,y:0,zoom:0,push:.03*n,vertigo:n};default:return{x:0,y:0,zoom:0}}}function oe(e,t,n,r={}){let i=e??`sway`;if(i===`none`)return{x:0,y:0,zoom:0};let a=Math.max(0,t);if(r.loop===!1){let e=r.duration&&r.duration>0?r.duration:a>0?10/a:0,t=e>0?g(n/e,0,1):0;return w(i,.5-.5*Math.cos(Math.PI*t))}let o=2*Math.PI*a/10*n;if(i===`orbit`){let e=Math.min(1,o/Math.PI),t=.8*e*e*(3-2*e);return{x:t*Math.sin(o),y:t*Math.cos(o),zoom:0}}return S.includes(i)?w(i,C.includes(i)?.5+.5*Math.sin(o):.5-.5*Math.cos(o)):w(i,o/(2*Math.PI)%1)}function se(e){let t=g(_(e?.pointer,1),0,1);return{pointer:t,scroll:g(_(e?.scroll,0),0,1),gyro:typeof e?.gyro==`boolean`?e.gyro:t>0,auto:e?.auto??`sway`,speed:Math.max(0,_(e?.speed,x.speed)),smoothing:g(_(e?.smoothing,x.smoothing),0,.99),loop:e?.loop!==!1,duration:Math.max(0,_(e?.duration,0)),progress:typeof e?.progress==`number`&&Number.isFinite(e.progress)?g(e.progress,0,1):null}}function T(e,t){let n=t.progress??e.progress,r=n!==null,i=t.reduced?{x:0,y:0,zoom:0}:r?w(e.auto,n):oe(e.auto,e.speed,t.t,e),a=e.pointer*(t.reduced?.5:1),o=0,s=0,c=0;t.gyro&&e.gyro&&t.pointer.weight<.5?(o=t.gyro.x,s=t.gyro.y,c=+(a>0)):a>0&&(o=t.pointer.x,s=t.pointer.y,c=g(t.pointer.weight,0,1));let l=i.x*(1-c)+o*a*c,u=i.y*(1-c)+s*a*c;e.scroll>0&&(u+=(g(t.scroll,0,1)*2-1)*e.scroll);let d=r?1:1-c,f={x:g(l,-1,1),y:g(u,-1,1),zoom:i.zoom*d};return i.push&&(f.push=i.push*d),i.vertigo&&(f.vertigo=i.vertigo*d),f}var E=1.5;function ce(e,t){let n=e.zoom-E*(e.vertigo??0),r=(1-.06*e.zoom)/((1+(e.push??0))*(1-.06*n));return{zoom:n,inset:[t[0]*r,t[1]*r]}}function D(e,t,n,r){if(r<=0||n<=0)return n<=0&&r>0?e:t;let i=1-g(r,0,.99)**(n*60),a=e+(t-e)*i;return Math.abs(t-a)<1e-4?t:a}function O(e,t,n){let r=g(e,0,1),i=Math.min(t,n),a=i/t,o=i/n;return{maxOffset:[r*.06*a,r*.06*o],inset:[1/(1+r*.1*a),1/(1+r*.1*o)]}}function k(e,t,n,r){let i=t-n.gamma,a=e-n.beta,o=(Math.round(r/90)%4+4)%4;return o===1?[i,a]=[a,-i]:o===2?[i,a]=[-i,-a]:o===3&&([i,a]=[-a,i]),{x:g(i/20,-1,1),y:g(-a/20,-1,1)}}function le(e,t){return Math.max(8,Math.round((e===`low`?12:e===`medium`?20:e===`ultra`?48:32)*(.5+.5*Math.min(1,Math.max(0,t)/.6))))}function ue(e,t){let{live:n}=t,r={x:0,y:0,weight:0,init:!1},i=null,a=null,o=null;if(n&&e.gyro&&e.pointer>0&&!t.flat&&typeof window<`u`&&typeof window.addEventListener==`function`){let e=e=>{if(e.beta===null||e.gamma===null)return;a??={beta:e.beta,gamma:e.gamma};let t=typeof screen<`u`&&screen.orientation?.angle||0;i=k(e.beta,e.gamma,a,t)};window.addEventListener(`deviceorientation`,e),o=()=>window.removeEventListener(`deviceorientation`,e)}return{offset(t,a,o){let s=o.pointer,c=s.inside?g(s.x,-1,1):0,l=s.inside?g(s.y,-1,1):0,u=+!!s.inside;return!n||!r.init?(r.x=c,r.y=l,r.weight=u,r.init=n):(r.x=D(r.x,c,a,e.smoothing),r.y=D(r.y,l,a,e.smoothing),r.weight=D(r.weight,u,a,e.smoothing)),T(e,{t,pointer:r,gyro:n?i:null,scroll:o.scroll,reduced:o.reduced,progress:o.progress})},dispose(){o?.(),o=null}}}var A=`
2
+ uniform sampler2D uMap;
3
+ uniform vec3 uTint;
4
+ uniform float uOpacity;
5
+ uniform float uIntensity;
6
+ vec4 shade(vec4 c, float a) {
7
+ return vec4(c.rgb * uTint * uIntensity, c.a * a * uOpacity);
8
+ }
9
+ `,j=`
10
+ uniform sampler2D uDepth;
11
+ uniform sampler2D uPlate;
12
+ uniform sampler2D uPlateDepth;
13
+ uniform float uPlateOn;
14
+ uniform vec2 uView;
15
+ uniform float uZoom;
16
+ uniform vec2 uMaxOffset;
17
+ uniform vec2 uInset;
18
+ uniform float uFocus;
19
+ uniform float uWallSlope;
20
+ const int STEPS = __STEPS__;
21
+ vec2 pxUv;
22
+ // Depth-map value of the texel parallaxTexel() returned (read by occluding
23
+ // photos to write their true depth, ./photo.ts PHOTO_OCCLUDE).
24
+ float photoHitDepth = 0.0;
25
+ vec4 parallaxTexel(vec2 vUv) {
26
+ // the zoom drift also pushes in slightly (stays inside the inset margin)
27
+ vec2 base = 0.5 + (vUv - 0.5) * uInset * (1.0 - 0.06 * uZoom);
28
+ vec2 v = uView - (vUv - 0.5) * 2.0 * uZoom;
29
+ vec2 dir = v * uMaxOffset;
30
+ vec2 uv = base;
31
+ bool onPlate = false;
32
+ if (dot(dir, dir) > 1e-10) {
33
+ float stepH = 1.0 / float(STEPS);
34
+ float h = 1.0;
35
+ float prevH = 1.0 + stepH;
36
+ bool hit = false;
37
+ for (int i = 0; i <= STEPS; i++) {
38
+ h = 1.0 - float(i) * stepH;
39
+ float d = textureLod(uDepth, base + (h - uFocus) * dir, 0.0).r;
40
+ if (d >= h) { hit = true; break; }
41
+ prevH = h;
42
+ }
43
+ float lo = h, hi = min(prevH, 1.0);
44
+ if (hit) {
45
+ for (int j = 0; j < 6; j++) {
46
+ float mid = 0.5 * (lo + hi);
47
+ float d = textureLod(uDepth, base + (mid - uFocus) * dir, 0.0).r;
48
+ if (d >= mid) lo = mid; else hi = mid;
49
+ }
50
+ }
51
+ uv = base + (lo - uFocus) * dir;
52
+ // Disocclusion: the ray hit the steep "wall" of a depth edge. Stretching
53
+ // the foreground edge colour reads as a smear: take the colour from just
54
+ // past the edge on the far side instead (the background continues).
55
+ vec2 texel = 1.0 / vec2(textureSize(uDepth, 0));
56
+ vec4 dh = textureLod(uDepth, uv, 0.0);
57
+ vec2 grad = vec2(
58
+ textureLod(uDepth, uv + vec2(texel.x * 1.5, 0.0), 0.0).r - textureLod(uDepth, uv - vec2(texel.x * 1.5, 0.0), 0.0).r,
59
+ textureLod(uDepth, uv + vec2(0.0, texel.y * 1.5), 0.0).r - textureLod(uDepth, uv - vec2(0.0, texel.y * 1.5), 0.0).r) / 3.0;
60
+ float g = length(grad);
61
+ vec2 toNear = grad / max(g, 1e-6);
62
+ float dNear = textureLod(uDepth, uv + toNear * texel * 3.0, 0.0).r;
63
+ if (hit && (g > uWallSlope || dh.a < 0.5) && dNear > lo + 0.04 && uPlateOn > 0.5) {
64
+ // continue the march below the wall against the plate (background) depth
65
+ float ph = lo, pprev = lo;
66
+ bool phit = false;
67
+ for (int i = 0; i <= STEPS; i++) {
68
+ ph = lo - float(i) * stepH;
69
+ if (textureLod(uPlateDepth, base + (ph - uFocus) * dir, 0.0).r >= ph) { phit = true; break; }
70
+ pprev = ph;
71
+ }
72
+ float plo = max(ph, 0.0), phi = pprev;
73
+ if (phit) {
74
+ for (int j = 0; j < 5; j++) {
75
+ float mid = 0.5 * (plo + phi);
76
+ if (textureLod(uPlateDepth, base + (mid - uFocus) * dir, 0.0).r >= mid) plo = mid; else phi = mid;
77
+ }
78
+ }
79
+ uv = base + (plo - uFocus) * dir;
80
+ onPlate = true;
81
+ } else if (hit && (g > uWallSlope || dh.a < 0.5) && dNear > lo + 0.04) {
82
+ vec2 away = -toNear;
83
+ vec2 probe = uv;
84
+ for (int k = 1; k <= 6; k++) {
85
+ vec2 q = uv + away * texel * float(k * 2);
86
+ probe = q;
87
+ if (textureLod(uDepth, q, 0.0).r < lo - 0.05) break;
88
+ }
89
+ uv = probe + away * texel * 2.0;
90
+ }
91
+ }
92
+ pxUv = uv;
93
+ photoHitDepth = onPlate ? textureLod(uPlateDepth, uv, 0.0).r : textureLod(uDepth, uv, 0.0).r;
94
+ vec2 gx = dFdx(base), gy = dFdy(base);
95
+ return onPlate ? textureGrad(uPlate, uv, gx, gy) : textureGrad(uMap, uv, gx, gy);
96
+ }
97
+ `,de=.02;function M(e,t){let n={};for(let r of b){let i=e?.[r],a=v[r];if(!i||typeof i!=`object`||a.needsDepth&&!t.depth)continue;let o={};for(let[e,n]of Object.entries(a.params)){let r=i[e]??n.default;r!==void 0&&(o[e]=n.type===`color`?t.color(typeof r==`string`?r:String(n.default)):n.type===`vec2`?Array.isArray(r)?[_(r[0],0),_(r[1],0)]:typeof r==`number`?[r,r]:[...n.default]:n.type===`enum`?typeof r==`string`&&n.options?.includes(r)?r:n.default:_(r,_(n.default,0)))}r===`blur`&&(o.focus??=g(_(t.focus,.5),0,1)),n[r]=o}return n}var N=`
98
+ uniform float uFxTime;
99
+ uniform float uFxAspect;
100
+ `,P=`
101
+ uniform vec3 uLightColor;
102
+ uniform vec3 uLightPos;
103
+ uniform vec4 uLight;
104
+ `,F=`
105
+ float fxZ(vec2 p, float lod) { return (textureLod(uDepth, p, lod).r - 1.0) * 0.5 * uLight.z; }
106
+ // normal samples: a nearer object next to this point is an occluder, not a
107
+ // slope of this surface (no halo on a wall around the subjects)
108
+ float fxN(vec2 p, float lod, float zc) {
109
+ float z = fxZ(p, lod);
110
+ return mix(z, zc, smoothstep(0.01, 0.04, (z - zc) / max(uLight.z, 1e-3)));
111
+ }
112
+ `,I=e=>`
113
+ {
114
+ vec3 L = vec3(uLightPos.xy * vec2(uFxAspect, 1.0), uLightPos.z);
115
+ vec3 n = vec3(0.0, 0.0, 1.0);
116
+ vec3 S = vec3(q, 0.0);
117
+ float sh = 0.0;
118
+ ${e?L:``}
119
+ vec3 tl = L - S;
120
+ vec3 l = normalize(tl);
121
+ float att = 1.0 / (1.0 + max(dot(tl, tl) - L.z * L.z, 0.0) / max(uLight.y * uLight.y, 1e-4));
122
+ att *= att * 1.6;
123
+ float df = max(dot(n, l), 0.0) * (1.0 - 0.6 * sh);
124
+ float sp = pow(max(dot(n, normalize(l + vec3(0.0, 0.0, 1.0))), 0.0), 40.0) * uLight.w * (1.0 - sh);
125
+ vec3 lit = c.rgb * (uLight.x + df * att * uLightColor) + uLightColor * sp * att * 0.35;
126
+ vec3 k = vec3(0.78);
127
+ c.rgb = mix(lit, k + (1.0 - k) * (1.0 - exp((k - lit) / (1.0 - k))), step(k, lit));
128
+ }
129
+ `,L=`
130
+ // Normals from a smoothed depth: a Sobel gradient on the mip level whose
131
+ // texels are ~1/160 of the image (estimated depth maps carry fine noise
132
+ // that would light up as ripples on flat walls), below a noise floor the
133
+ // surface stays flat; real curvature (round bodies, silhouettes) remains.
134
+ vec2 ts = vec2(textureSize(uDepth, 0));
135
+ float lod = max(log2(max(ts.x, ts.y) / 160.0), 0.0);
136
+ vec2 e = exp2(lod) * 1.5 / ts;
137
+ S.z = fxZ(uv, lod);
138
+ float z0 = fxN(uv + vec2(-e.x, e.y), lod, S.z), z1 = fxN(uv + vec2(0.0, e.y), lod, S.z), z2 = fxN(uv + e, lod, S.z);
139
+ float z3 = fxN(uv - vec2(e.x, 0.0), lod, S.z), z5 = fxN(uv + vec2(e.x, 0.0), lod, S.z);
140
+ float z6 = fxN(uv - e, lod, S.z), z7 = fxN(uv - vec2(0.0, e.y), lod, S.z), z8 = fxN(uv + vec2(e.x, -e.y), lod, S.z);
141
+ vec2 sl = vec2(z2 + 2.0 * z5 + z8 - z0 - 2.0 * z3 - z6, z0 + 2.0 * z1 + z2 - z6 - 2.0 * z7 - z8) / (16.0 * e * vec2(uFxAspect, 1.0));
142
+ sl *= smoothstep(0.015, 0.05, length(sl));
143
+ // exaggerated 3× over the true slope: depth maps are smooth
144
+ n = normalize(vec3(-3.0 * sl, 1.0));
145
+ vec3 sd = normalize(L - S);
146
+ for (int i = 1; i <= 8; i++) {
147
+ vec3 P = S + sd * (float(i) * 0.035);
148
+ // local relief only: an occluder well above this surface is another
149
+ // object (a doll before the wall, a facade before the sky), no shadow
150
+ float zo = fxZ(P.xy / vec2(uFxAspect, 1.0) * 0.5 + 0.5, lod);
151
+ sh = max(sh, clamp((zo - P.z) * 24.0, 0.0, 1.0) * (1.0 - smoothstep(0.01, 0.03, (zo - S.z) / max(uLight.z, 1e-3))));
152
+ }
153
+ `,R=`
154
+ uniform vec3 uFogColor;
155
+ uniform vec4 uFog;
156
+ float fxHash(vec2 p) { return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453); }
157
+ float fxNoise(vec2 p) {
158
+ vec2 i = floor(p);
159
+ vec2 f = fract(p);
160
+ f = f * f * (3.0 - 2.0 * f);
161
+ return mix(mix(fxHash(i), fxHash(i + vec2(1.0, 0.0)), f.x), mix(fxHash(i + vec2(0.0, 1.0)), fxHash(i + 1.0), f.x), f.y);
162
+ }
163
+ `,z=`
164
+ {
165
+ float k = clamp((uFog.y - d) * uFog.z, 0.0, 1.0);
166
+ float s = uFxTime * uFog.w;
167
+ float w = 0.65 * fxNoise(q * vec2(1.4, 2.6) + vec2(s * 0.4, s * 0.06)) + 0.35 * fxNoise(q * vec2(3.6, 6.0) - vec2(s * 0.7, -s * 0.1));
168
+ c.rgb = mix(c.rgb, uFogColor, clamp(uFog.x * k * k * (3.0 - 2.0 * k) * (0.6 + 0.8 * w), 0.0, 1.0));
169
+ }
170
+ `,B=`
171
+ uniform vec3 uReveal;
172
+ `,V=`
173
+ c.a *= 1.0 - smoothstep(uReveal.x - uReveal.z, uReveal.x + uReveal.z, uReveal.y > 0.5 ? 1.0 - d : d);
174
+ `,H=`
175
+ uniform vec4 uBlur;
176
+ float fxCoc(float z) { return clamp((abs(z - uBlur.x) - uBlur.y) * uBlur.w, 0.0, 1.0); }
177
+ `,U=`
178
+ vec2 gc = 0.5 + (s - 0.5) * uInset * (1.0 - 0.06 * uZoom) + (d - uFocus) * (uView - (s - 0.5) * 2.0 * uZoom) * uMaxOffset;
179
+ `,fe=`
180
+ if (textureLod(uDepth, uv, 0.0).a < 0.5) {
181
+ vec2 de = 2.0 / vec2(textureSize(uDepth, 0));
182
+ dc = max(max(textureLod(uDepth, uv + vec2(de.x, 0.0), 0.0).r, textureLod(uDepth, uv - vec2(de.x, 0.0), 0.0).r), max(textureLod(uDepth, uv + vec2(0.0, de.y), 0.0).r, textureLod(uDepth, uv - vec2(0.0, de.y), 0.0).r));
183
+ }
184
+ `,W=(e,t,n)=>`
185
+ {
186
+ ${n?U:`vec2 gc = uv;`}
187
+ float dc = d;
188
+ ${e?fe:``}
189
+ float cc = fxCoc(dc);
190
+ vec2 R = vec2(uBlur.z, uBlur.z * uFxAspect);
191
+ float rs = max(cc, 0.35);
192
+ float lod = log2(max(rs * uBlur.z * float(textureSize(uMap, 0).x) * ${(.6*(3.14159265/t)**.5).toFixed(3)}, 1.0));
193
+ vec3 acc = mix(c.rgb, textureLod(uMap, gc, lod * cc).rgb, cc);
194
+ float ws = 1.0;
195
+ for (int i = 0; i < ${t}; i++) {
196
+ float fi = float(i) + 0.5;
197
+ float r = sqrt(fi / ${t}.0) * rs;
198
+ vec2 p = gc + vec2(cos(fi * 2.39996), sin(fi * 2.39996)) * r * R;
199
+ vec2 dt = ${e?`textureLod(uDepth, p, 0.0).ra`:`vec2(d, 1.0)`};
200
+ float ct = fxCoc(dt.x);
201
+ float w = clamp(((dt.x < dc - 0.03 ? min(ct, cc) : ct) - r) * 20.0 + 0.5, 0.0, 1.0) * step(0.5, dt.y);
202
+ vec3 sc = textureLod(uMap, p, lod).rgb;
203
+ w *= 1.0 + 3.0 * max(dot(sc, vec3(0.2126, 0.7152, 0.0722)) - 0.7, 0.0);
204
+ acc += sc * w;
205
+ ws += w;
206
+ }
207
+ c.rgb = acc / ws;
208
+ }
209
+ `,pe=`
210
+ uniform vec4 uFrame;
211
+ uniform vec4 uFrameB;
212
+ uniform vec3 uFrameColor;
213
+ float fxBox(vec2 p, vec2 h) { vec2 e = abs(p) - h; return length(max(e, 0.0)) + min(max(e.x, e.y), 0.0); }
214
+ // popped content fades out near the photo's own edges (no hard photo cut on the page)
215
+ float fxEdge(vec2 p, float w) { return smoothstep(0.0, w, -fxBox(p, vec2(uFxAspect, 1.0))); }
216
+ `,me=`
217
+ float ks = 0.0;
218
+ // per-pixel rotation (interleaved gradient noise): grain, not banded copies
219
+ float jr = 6.2832 * fract(52.9829 * fract(dot(gl_FragCoord.xy, vec2(0.06711, 0.00584))));
220
+ for (int i = 0; i < 8; i++) {
221
+ float fi = float(i) + 0.5;
222
+ vec2 o = so + 0.04 * sqrt(fi / 8.0) * vec2(cos(fi * 2.39996 + jr), sin(fi * 2.39996 + jr));
223
+ ks += fxEdge(qs - o, 0.25) * smoothstep(uFrameB.x - uFrame.w, uFrameB.x + uFrame.w, textureLod(uDepth, 0.5 + (s - 0.5 - o / vec2(2.0 * uFxAspect, 2.0)) * uFrameB.zw, 0.0).r);
224
+ }
225
+ sh = max(sh, 0.1 * ks);
226
+ `,G=`
227
+ vec2 et = 3.0 / vec2(textureSize(uDepth, 0));
228
+ dp = min(dp, min(min(textureLod(uDepth, uv + vec2(et.x, 0.0), 0.0).r, textureLod(uDepth, uv - vec2(et.x, 0.0), 0.0).r), min(textureLod(uDepth, uv + vec2(0.0, et.y), 0.0).r, textureLod(uDepth, uv - vec2(0.0, et.y), 0.0).r)));
229
+ `,he=e=>`
230
+ {
231
+ vec2 qs = (s * 2.0 - 1.0) * vec2(uFxAspect, 1.0);
232
+ float aa = max(length(fwidth(qs)), 1e-5);
233
+ float din = fxBox(qs, uFrame.xy);
234
+ float inner = clamp(0.5 - din / aa, 0.0, 1.0);
235
+ float outer = clamp(0.5 - (din - uFrame.z) / aa, 0.0, 1.0);
236
+ float dp = d;
237
+ ${e?G:``}
238
+ float pop = smoothstep(uFrameB.x - uFrame.w, uFrameB.x + uFrame.w, dp) * fxEdge(qs, 0.08);
239
+ vec2 so = vec2(0.03, -0.045);
240
+ float sh = 1.0 - smoothstep(-0.03, 0.1, fxBox(qs - so, uFrame.xy + uFrame.z));
241
+ ${e?me:``}
242
+ vec4 o = mix(vec4(0.0, 0.0, 0.0, uFrameB.y * sh * fxEdge(qs, 0.25)), vec4(uFrameColor, 1.0), outer);
243
+ // composed premultiplied (coverage cross-fades), back to straight alpha
244
+ vec4 cp = vec4(c.rgb * c.a, c.a);
245
+ o = mix(mix(o, cp, inner), cp, pop);
246
+ c = vec4(o.rgb / max(o.a, 1e-4), o.a);
247
+ }
248
+ `,ge=e=>e===`low`?8:e===`medium`?12:16;function K(e,t,n,r=!1){if(!q(e))return``;let i=N,a=``;return e.blur&&(i+=H,a+=W(t,ge(n),r&&t)),e.light&&(i+=P+(t?F:``),a+=I(t)),e.fog&&(i+=R,a+=z),e.reveal&&(i+=B,a+=V),e.frame&&(i+=pe,a+=he(t)),`${i}vec4 photoFx(vec4 c, vec2 uv, float d, vec2 s) {
249
+ vec2 q = (uv * 2.0 - 1.0) * vec2(uFxAspect, 1.0);
250
+ ${a} return c;
251
+ }
252
+ `}var q=e=>b.some(t=>e[t]),_e=.3;function J(e,t,n){let r=2*Math.PI*Math.max(0,t)/10*n;return[g(e[0]-.7*Math.sin(r),-1,1),g(e[1]-.35*(1-Math.cos(2*r)),-1,1)]}function ve(e,t){let n=Math.max(t,.001);return-n+g(e,0,1)*(1+2*n)}function ye(e,t,n,r,i,a=!1){if(typeof t!=`number`||typeof n!=`number`||n<=0||a)return e;let o=Math.max(0,i-r)/n;return e+(t-e)*(.5-.5*Math.cos(Math.PI*o))}function be(e,t){let n=M(e,t),r=q(n),i=!!t.live,a={x:0,y:0,w:0,init:!1},o=0,s=!1;return{state:n,glsl:K(n,t.depth,t.quality,t.parallax),alpha:b.some(e=>n[e]&&v[e].alpha),depthMips:!!n.light&&t.depth,call:(e,n,i=e)=>r?`c = photoFx(c, ${e}, ${t.depth?n:`0.5`}, ${i});`:``,frame:(e,n,r)=>{o=e,s=r.reduced;let c=r.pointer,l=c.inside?g(c.x,-1,1):a.x,u=c.inside?g(c.y,-1,1):a.y,d=+!!c.inside;if(!i||!a.init)a.x=l,a.y=u,a.w=d,a.init=i;else{let e=g(_(t.smoothing,.9),0,.99);a.x=D(a.x,l,n,e),a.y=D(a.y,u,n,e),a.w=D(a.w,d,n,e)}},uniforms:()=>{let e={uFxTime:[o],uFxAspect:[t.aspect]},r=n.light;if(r){let n=r.color,i=r.intensity,c=r.position,l=c;if(!s&&r.follow!==`none`){let e=J(c,_(t.speed,1),o);l=r.follow===`auto`?e:[e[0]+(a.x-e[0])*a.w,e[1]+(a.y-e[1])*a.w]}e.uLightColor=[n[0]*i,n[1]*i,n[2]*i],e.uLightPos=[l[0],l[1],Math.max(.02,r.height)],e.uLight=[g(r.ambient,0,1),Math.max(.001,r.radius),r.relief,g(r.specular,0,1)]}let i=n.fog;if(i){let t=i.start,n=t-i.end;e.uFogColor=i.color.slice(0,3),e.uFog=[g(i.amount,0,1),t,1/(Math.abs(n)<.001?n<0?-.001:.001:n),Math.max(0,i.drift)]}let c=n.reveal;if(c){let t=c.duration,n=c.progress;if(typeof t==`number`){let e=s||t<=0?1:g((o-c.delay)/t,0,1);n=e*e*(3-2*e)}let r=Math.max(.001,c.softness);e.uReveal=[ve(n,r),+(c.from===`near`),r]}let l=n.blur;if(l){let t=g(l.range,0,1);e.uBlur=[ye(l.focus,l.to,l.duration,l.delay,o,s),t,Math.max(0,l.amount)/100,1/_e]}let u=n.frame;if(u){let n=u.inset,r=t.aspect;e.uFrame=[Math.max(0,1-2*g(n[0],0,.5))*r,Math.max(0,1-2*g(n[1],0,.5)),Math.max(0,u.border)*2*r,Math.max(.001,u.softness)],e.uFrameB=[u.threshold,g(u.shadow,0,1),...t.inset??[1,1]],e.uFrameColor=u.color.slice(0,3)}return e},get(e,t){let r=n[e],[i,a]=t.split(`.`),o=r?.[i];return a&&Array.isArray(o)?o[+(a===`y`)]:Array.isArray(o)?[...o]:o},set(e,t,r){let i=n[e],[a,o]=t.split(`.`);if(!i||!(a in i)&&!(a in(v[e]?.params??{})))return!1;let s=i[a];if(o&&Array.isArray(s)&&typeof r==`number`)s[+(o===`y`)]=r;else if(Array.isArray(s)&&typeof r==`number`)i[a]=s.map(()=>r);else if(Array.isArray(r))i[a]=r.slice(0,Array.isArray(s)?s.length:r.length);else if(typeof r==`number`&&Number.isFinite(r))i[a]=r;else return!1;return!0}}}function xe(e,t,n){let r=Math.round(g(_(e,x.segments),2,1024));return t>=n?[r,Math.max(1,Math.round(r*n/t))]:[Math.max(1,Math.round(r*t/n)),r]}function Y(e,t){return y(e,t)}function Se(e,t,n){let r=n.distance,i=Y(n.strength,n.width);if(!(r>0)||i<=0)return{x:0,y:0,dolly:0,magnify:1};if(e===`mesh`){let e=r*Math.tan(g(n.strength,0,1)*8*ie);return{x:t.x*e,y:t.y*e,dolly:t.zoom*i*.5,magnify:NaN}}let a=O(n.strength,n.width,n.height),o=a.maxOffset[0]/a.inset[0]*n.width,s=a.maxOffset[1]/a.inset[1]*n.height,c=.5*(a.maxOffset[0]/a.inset[0]+a.maxOffset[1]/a.inset[1]),l=2*t.zoom*c*r/i;return{x:t.x*o*r/i,y:t.y*s*r/i,dolly:l*r/(1+l),magnify:1/(1-.06*t.zoom)}}function Ce(e,t,n,r){let i=Math.round(g(_(e,x.layers),2,16)),a=[],o=g(n,0,1)*r*.1;for(let e=0;e<i;e++){let n=e/i,s=(e+1)/i,c=(n+s)/2;a.push({lo:n,hi:s,center:c,feather:.35/i,z:(c-t)*o+e*.001*r,background:e===0})}return a}var X=A,we=`
253
+ varying vec2 vUv;
254
+ #ifdef PHOTO_OCCLUDE
255
+ varying vec3 vLocal;
256
+ varying vec3 vRay;
257
+ #endif
258
+ void main() {
259
+ vUv = uv;
260
+ #ifdef PHOTO_OCCLUDE
261
+ // camera ray through this vertex, in the object's space
262
+ mat4 inv = inverse(modelViewMatrix);
263
+ vLocal = position;
264
+ vRay = isOrthographic ? (inv * vec4(0.0, 0.0, -1.0, 0.0)).xyz : position - (inv * vec4(0.0, 0.0, 0.0, 1.0)).xyz;
265
+ #endif
266
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
267
+ }
268
+ `,Te=`
269
+ #ifdef PHOTO_OCCLUDE
270
+ uniform mat4 projectionMatrix;
271
+ uniform mat4 modelViewMatrix;
272
+ uniform float uZRange;
273
+ uniform float uZDist;
274
+ varying vec3 vLocal;
275
+ varying vec3 vRay;
276
+ void photoDepthOut(float d) {
277
+ float lin = (d - uFocus) * uZRange;
278
+ float z = lin * uZDist / (uZDist + lin);
279
+ float rz = abs(vRay.z) > 1e-6 ? vRay.z : 1e-6;
280
+ vec3 p = vLocal + vRay * ((z - vLocal.z) / rz);
281
+ vec4 clip = projectionMatrix * modelViewMatrix * vec4(p, 1.0);
282
+ gl_FragDepth = clamp(0.5 + 0.5 * clip.z / clip.w, 0.0, 1.0);
283
+ }
284
+ #endif
285
+ `,Ee=e=>`
286
+ ${X}
287
+ ${j}
288
+ ${e.glsl}
289
+ ${Te}
290
+ varying vec2 vUv;
291
+ void main() {
292
+ vec4 c = parallaxTexel(vUv);
293
+ ${e.call(`pxUv`,`photoHitDepth`,`vUv`)}
294
+ if (c.a * uOpacity < 0.004) discard;
295
+ #ifdef PHOTO_OCCLUDE
296
+ if (c.a < 0.5) discard;
297
+ photoDepthOut(photoHitDepth);
298
+ #endif
299
+ gl_FragColor = shade(c, 1.0);
300
+ #include <tonemapping_fragment>
301
+ #include <colorspace_fragment>
302
+ }
303
+ `,De=`
304
+ uniform sampler2D uDepth;
305
+ uniform float uRange;
306
+ uniform float uFocus;
307
+ uniform float uEdgeCut;
308
+ uniform vec3 uCam;
309
+ uniform float uPerspective;
310
+ attribute vec4 uvOther;
311
+ varying vec2 vUv;
312
+ varying float vDepth;
313
+ varying float vCut;
314
+ varying float vMotion;
315
+ vec3 displaced(vec3 p, float z) {
316
+ if (uPerspective > 0.5 && uCam.z > z + 1e-3) p.xy = mix(p.xy, uCam.xy, z / uCam.z);
317
+ p.z = z;
318
+ return p;
319
+ }
320
+ void main() {
321
+ vUv = uv;
322
+ vec4 d0 = textureLod(uDepth, uv, 0.0);
323
+ vec4 d1 = textureLod(uDepth, uvOther.xy, 0.0);
324
+ vec4 d2 = textureLod(uDepth, uvOther.zw, 0.0);
325
+ float jump = max(max(abs(d0.r - d1.r), abs(d1.r - d2.r)), abs(d0.r - d2.r));
326
+ bool cut = min(d0.a, min(d1.a, d2.a)) < 0.5 || (uEdgeCut > 0.0 && jump > uEdgeCut);
327
+ vCut = cut ? 1.0 : 0.0;
328
+ vDepth = d0.r;
329
+ vec4 c = projectionMatrix * modelViewMatrix * vec4(displaced(position, (d0.r - uFocus) * uRange), 1.0);
330
+ vMotion = 0.0;
331
+ if (cut) {
332
+ vec4 a = projectionMatrix * modelViewMatrix * vec4(displaced(position, -uFocus * uRange), 1.0);
333
+ vec4 b = projectionMatrix * modelViewMatrix * vec4(displaced(position, (1.0 - uFocus) * uRange), 1.0);
334
+ vMotion = length(b.xy / b.w - a.xy / a.w);
335
+ }
336
+ gl_Position = c;
337
+ }
338
+ `,Oe=e=>`
339
+ ${X}
340
+ uniform sampler2D uDepth;
341
+ ${e.glsl}
342
+ varying vec2 vUv;
343
+ varying float vDepth;
344
+ varying float vCut;
345
+ varying float vMotion;
346
+ void main() {
347
+ if (vCut > 0.5) {
348
+ float d = textureLod(uDepth, vUv, 0.0).r;
349
+ if (abs(d - vDepth) * vMotion > 0.004) discard;
350
+ }
351
+ vec4 c = texture2D(uMap, vUv);
352
+ ${e.call(`vUv`,`textureLod(uDepth, vUv, 0.0).r`)}
353
+ if (c.a * uOpacity < 0.004) discard;
354
+ gl_FragColor = shade(c, 1.0);
355
+ #include <tonemapping_fragment>
356
+ #include <colorspace_fragment>
357
+ }
358
+ `,ke=`
359
+ uniform sampler2D uDepth;
360
+ uniform sampler2D uPlateDepth;
361
+ uniform float uPlateOn;
362
+ uniform float uRange;
363
+ uniform float uFocus;
364
+ uniform vec3 uCam;
365
+ uniform float uPerspective;
366
+ uniform vec2 uReach;
367
+ varying vec2 vUv;
368
+ varying float vDepth;
369
+ void main() {
370
+ vUv = uv;
371
+ float d = textureLod(uDepth, uv, 0.0).r;
372
+ // with a plate: its depth is the background behind the foreground
373
+ if (uPlateOn > 0.5) d = min(d, textureLod(uPlateDepth, uv, 0.0).r);
374
+ else for (int i = 1; i <= 2; i++) {
375
+ vec2 r = uReach * float(i) * 0.5;
376
+ d = min(d, textureLod(uDepth, uv + vec2(r.x, 0.0), 0.0).r);
377
+ d = min(d, textureLod(uDepth, uv - vec2(r.x, 0.0), 0.0).r);
378
+ d = min(d, textureLod(uDepth, uv + vec2(0.0, r.y), 0.0).r);
379
+ d = min(d, textureLod(uDepth, uv - vec2(0.0, r.y), 0.0).r);
380
+ d = min(d, textureLod(uDepth, uv + r, 0.0).r);
381
+ d = min(d, textureLod(uDepth, uv - r, 0.0).r);
382
+ d = min(d, textureLod(uDepth, uv + vec2(r.x, -r.y), 0.0).r);
383
+ d = min(d, textureLod(uDepth, uv + vec2(-r.x, r.y), 0.0).r);
384
+ }
385
+ vDepth = d;
386
+ float z = (d - uFocus) * uRange - uRange * 0.02;
387
+ vec3 p = position;
388
+ if (uPerspective > 0.5 && uCam.z > z + 1e-3) p.xy = mix(p.xy, uCam.xy, z / uCam.z);
389
+ p.z = z;
390
+ gl_Position = projectionMatrix * modelViewMatrix * vec4(p, 1.0);
391
+ }
392
+ `,Ae=e=>`
393
+ ${X}
394
+ uniform sampler2D uDepth;
395
+ ${e.glsl}
396
+ uniform sampler2D uPlate;
397
+ uniform float uPlateOn;
398
+ varying vec2 vUv;
399
+ varying float vDepth;
400
+ void main() {
401
+ vec2 uv = vUv;
402
+ float d = textureLod(uDepth, uv, 0.0).r;
403
+ if (uPlateOn > 0.5) {
404
+ vec4 pc = texture2D(uPlate, uv);
405
+ if (pc.a * uOpacity < 0.004) discard;
406
+ gl_FragColor = shade(pc, 1.0);
407
+ #include <tonemapping_fragment>
408
+ #include <colorspace_fragment>
409
+ return;
410
+ }
411
+ if (d > vDepth + 0.04) {
412
+ vec2 texel = 1.0 / vec2(textureSize(uDepth, 0));
413
+ vec2 grad = vec2(
414
+ textureLod(uDepth, uv + vec2(texel.x * 2.0, 0.0), 0.0).r - textureLod(uDepth, uv - vec2(texel.x * 2.0, 0.0), 0.0).r,
415
+ textureLod(uDepth, uv + vec2(0.0, texel.y * 2.0), 0.0).r - textureLod(uDepth, uv - vec2(0.0, texel.y * 2.0), 0.0).r);
416
+ vec2 away = length(grad) > 1e-5 ? -normalize(grad) : vec2(0.0);
417
+ // walk towards the background until the depth reaches this surface's
418
+ for (int k = 1; k <= 24; k++) {
419
+ uv = vUv + away * texel * float(k * 3);
420
+ if (textureLod(uDepth, uv, 0.0).r <= vDepth + 0.04) break;
421
+ }
422
+ uv += away * texel * 2.0;
423
+ }
424
+ vec4 c = texture2D(uMap, uv);
425
+ ${e.call(`uv`,`textureLod(uDepth, uv, 0.0).r`,`vUv`)}
426
+ if (c.a * uOpacity < 0.004) discard;
427
+ gl_FragColor = shade(c, 1.0);
428
+ #include <tonemapping_fragment>
429
+ #include <colorspace_fragment>
430
+ }
431
+ `,je=e=>`
432
+ ${X}
433
+ uniform sampler2D uDepth;
434
+ ${e.glsl}
435
+ uniform vec2 uView;
436
+ uniform float uZoom;
437
+ uniform vec2 uMaxOffset;
438
+ uniform vec2 uInset;
439
+ uniform float uFocus;
440
+ uniform float uCenter;
441
+ uniform float uLo;
442
+ uniform float uHi;
443
+ uniform float uFeather;
444
+ uniform float uBackground;
445
+ ${Te}
446
+ uniform sampler2D uPlate;
447
+ uniform sampler2D uPlateDepth;
448
+ uniform float uPlateOn;
449
+ varying vec2 vUv;
450
+ void main() {
451
+ // the zoom drift also pushes in slightly (stays inside the inset margin)
452
+ vec2 base = 0.5 + (vUv - 0.5) * uInset * (1.0 - 0.06 * uZoom);
453
+ vec2 v = uView - (vUv - 0.5) * 2.0 * uZoom;
454
+ // Each layer moves with the depth it shows, clamped to its band: a smooth
455
+ // surface crossing two bands stays continuous (no tear at the band edge);
456
+ // only real depth jumps separate the layers. Fixed-point solve, from the
457
+ // band centre.
458
+ vec2 dir = v * uMaxOffset;
459
+ vec2 uv = base + (uCenter - uFocus) * dir;
460
+ for (int i = 0; i < 3; i++) {
461
+ float di = clamp(textureLod(uDepth, uv, 0.0).r, uLo, uHi);
462
+ uv = base + (di - uFocus) * dir;
463
+ }
464
+ vec4 dd = textureLod(uDepth, uv, 0.0);
465
+ float d = dd.r;
466
+ // soft slice edges, but hard on marked depth edges (alpha 0): a blend of
467
+ // two layers there would draw a thin double outline
468
+ float a = uBackground > 0.5 ? 1.0 : dd.a < 0.5 ? step(uLo, d) : smoothstep(uLo - uFeather, uLo + uFeather, d);
469
+ if (a < 0.004) discard;
470
+ vec2 cuv = uv;
471
+ bool onPlate = false;
472
+ // covered by nearer content
473
+ if (d > uHi + uFeather && uPlateOn > 0.5) {
474
+ // the plate holds what is behind the foreground: this layer's surface
475
+ // continues there when the plate depth falls in its band
476
+ vec2 puv = base + (uCenter - uFocus) * dir;
477
+ for (int i = 0; i < 3; i++) puv = base + (clamp(textureLod(uPlateDepth, puv, 0.0).r, uLo, uHi) - uFocus) * dir;
478
+ float pd = textureLod(uPlateDepth, puv, 0.0).r;
479
+ // (the background layer always takes the plate: its best guess)
480
+ if (uBackground > 0.5 || (pd <= uHi + uFeather && pd >= uLo - uFeather)) {
481
+ cuv = puv;
482
+ onPlate = true;
483
+ } else discard;
484
+ } else if (d > uHi + uFeather) {
485
+ bool found = false;
486
+ vec2 reach = v * uMaxOffset * 1.25;
487
+ for (int k = 1; k <= 16; k++) {
488
+ vec2 q = uv + reach * (float(k) / 16.0);
489
+ vec4 dq = textureLod(uDepth, q, 0.0);
490
+ if (dq.r <= uHi && dq.a >= 0.5 && (uBackground > 0.5 || dq.r >= uLo - uFeather)) {
491
+ // step past the edge's blended texels
492
+ vec2 texel = 1.0 / vec2(textureSize(uMap, 0));
493
+ cuv = q + normalize(reach) * texel * 3.0;
494
+ found = true;
495
+ break;
496
+ }
497
+ }
498
+ // Nothing of this band to extend: let the layers below show (the
499
+ // background keeps the source texel).
500
+ if (!found && uBackground < 0.5) discard;
501
+ }
502
+ vec2 gx = dFdx(base), gy = dFdy(base);
503
+ vec4 c = onPlate ? textureGrad(uPlate, cuv, gx, gy) : textureGrad(uMap, cuv, gx, gy);
504
+ ${e.call(`cuv`,`textureLod(uDepth, cuv, 0.0).r`,`vUv`)}
505
+ gl_FragColor = shade(c, a);
506
+ if (gl_FragColor.a < 0.004) discard;
507
+ #ifdef PHOTO_OCCLUDE
508
+ // the depth this layer's surface moves with
509
+ photoDepthOut(uBackground > 0.5 ? textureLod(uDepth, cuv, 0.0).r : clamp(textureLod(uDepth, cuv, 0.0).r, uLo, uHi));
510
+ #endif
511
+ #include <tonemapping_fragment>
512
+ #include <colorspace_fragment>
513
+ }
514
+ `,Me=e=>`
515
+ ${X}
516
+ ${e.glsl}
517
+ varying vec2 vUv;
518
+ void main() {
519
+ vec4 c = texture2D(uMap, vUv);
520
+ ${e.call(`vUv`,`0.5`)}
521
+ if (c.a * uOpacity < 0.004) discard;
522
+ gl_FragColor = shade(c, 1.0);
523
+ #include <tonemapping_fragment>
524
+ #include <colorspace_fragment>
525
+ }
526
+ `;function Ne(e){let t=e.image;return{w:t?.naturalWidth||t?.width||1,h:t?.naturalHeight||t?.height||1}}function Z(e,t,n){let r=t.material??{};return{uMap:{value:e},uTint:{value:r.color?n.color(r.color):new ne(1,1,1)},uOpacity:{value:g(_(r.opacity,1),0,1)},uIntensity:{value:Math.max(0,_(r.emissiveIntensity,1))}}}function Q(e,t,n,r){let i=new m({vertexShader:e,fragmentShader:t,uniforms:n,transparent:r,toneMapped:!1,fog:!1,side:0});return i.depthWrite=!r,typeof n.uOpacity?.value==`number`&&(i.opacity=n.uOpacity.value),i}function Pe(e,t,n,r){let i=n*r*2,a=new Float32Array(i*9),o=new Float32Array(i*6),s=new Float32Array(i*12),c=0,l=(n,r,i)=>{let l=[n,r,i];for(let n=0;n<3;n++){let[r,i]=l[n],u=l[(n+1)%3],d=l[(n+2)%3];a.set([(r-.5)*e,(i-.5)*t,0],c*3),o.set([r,i],c*2),s.set([u[0],u[1],d[0],d[1]],c*4),c++}};for(let e=0;e<r;e++)for(let t=0;t<n;t++){let i=t/n,a=(t+1)/n,o=e/r,s=(e+1)/r;l([i,o],[a,o],[a,s]),l([i,o],[a,s],[i,s])}let d=new u;return d.setAttribute(`position`,new p(a,3)),d.setAttribute(`uv`,new p(o,2)),d.setAttribute(`uvOther`,new p(s,4)),d}async function $(u,p){let m=(t,n,r,i)=>t?e(p.resolveAsset(t)).catch(e=>(p.issue(`asset-load`,`${u.id}: ${n}: ${e.message} — ${i}`,`objects#${u.id}.${r}`),null)):Promise.resolve(null),ne=!!(u.depth&&u.plate&&u.plateDepth),[v,y,b,S]=await Promise.all([e(p.resolveAsset(u.src)),m(u.depth,`depth map`,`depth`,`showing the photo flat`),m(ne?u.plate:void 0,`plate`,`plate`,`edges use the photo`),m(ne?u.plateDepth:void 0,`plate depth`,`plateDepth`,`edges use the photo`)]);v.colorSpace=te,v.wrapS=v.wrapT=d,v.anisotropy=4,v.needsUpdate=!0,y&&(y.colorSpace=``,y.premultiplyAlpha=!1,y.wrapS=y.wrapT=d,y.generateMipmaps=!1,y.minFilter=c,y.magFilter=c,y.needsUpdate=!0);let C=y&&b&&S?{map:b,depth:S}:null;if(!C)b?.dispose(),S?.dispose();else for(let[e,t]of[[C.map,!1],[C.depth,!0]])e.wrapS=e.wrapT=d,t?(e.colorSpace=``,e.premultiplyAlpha=!1,e.generateMipmaps=!1,e.minFilter=c,e.magFilter=c):(e.colorSpace=te,e.anisotropy=4),e.needsUpdate=!0;let w=()=>({uPlate:{value:C?.map??v},uPlateDepth:{value:C?.depth??y},uPlateOn:{value:+!!C}}),oe=Ne(v),{width:T,height:E}=ae(u,oe.w,oe.h),D=g(_(u.strength,x.strength),0,1),k=g(_(u.focus,x.focus),0,1),A=g(_(u.material?.opacity,1),0,1),j=se(u.motion),M=y?u.mode??`parallax`:`flat`,N=u.occlude===!0&&M!==`flat`,P=A<1||!N&&/\.(png|webp)$/i.test(u.src),F=be(u.effects,{depth:!!y,color:e=>p.color(e).toArray(),aspect:T/E,live:!p.deterministic,smoothing:j.smoothing,speed:j.speed,focus:k,quality:p.quality,parallax:M===`parallax`,inset:M===`parallax`||M===`layers`?O(D,T,E).inset:void 0}),I={},L=()=>{for(let[e,t]of Object.entries(F.uniforms())){let a=I[e]??={value:t.length===1?0:t.length===2?new n:t.length===3?new r:new i};t.length===1?a.value=t[0]:a.value.fromArray(t)}};L(),y&&F.depthMips&&(y.generateMipmaps=!0,y.minFilter=f,y.needsUpdate=!0);let R=P||F.alpha,z=new o,B=new o;z.add(B);let V=[],H=[],U=[],fe=[],W=null,pe=[],me=(e,t)=>{let n={uZRange:{value:Y(D,T)},uZDist:{value:1e6}};Object.assign(t,n),e.uniforms=t,pe.push(n),e.defines={...e.defines,PHOTO_OCCLUDE:``},e.depthWrite=!0},G=()=>{let e=new t(T,E);return H.push(e),e};if(M===`flat`&&F.glsl){let e=Q(we,Me(F),{...Z(v,u,p),...I},R);V.push(e),B.add(new h(G(),e))}else if(M===`flat`){let e=u.material??{},t=new a({map:v,transparent:P,opacity:A,toneMapped:!1,fog:!1});e.color&&t.color.copy(p.color(e.color)),t.color.multiplyScalar(Math.max(0,_(e.emissiveIntensity,1))),P&&(t.alphaTest=A<1?0:.004),V.push(t),B.add(new h(G(),t))}else if(M===`parallax`){let e=O(D,T,E),t={...Z(v,u,p),uDepth:{value:y},uView:{value:new n},uZoom:{value:0},uMaxOffset:{value:new n(...e.maxOffset)},uInset:{value:new n(...e.inset)},uFocus:{value:k},uWallSlope:{value:de},...I,...w()},r=Q(we,Ee(F).replace(`__STEPS__`,String(le(p.quality,D))),t,R);N&&me(r,t),V.push(r),U.push(r),B.add(new h(G(),r))}else if(M===`mesh`){let[e,i]=xe(_(u.segments,x.segments),T,E),a=Y(D,T),o=Pe(T,E,e,i);o.boundingBox=new l(new r(-T/2,-E/2,-k*a),new r(T/2,E/2,(1-k)*a)),o.boundingSphere=o.boundingBox.getBoundingSphere(new ee),H.push(o);let s={...Z(v,u,p),uDepth:{value:y},uRange:{value:a},uFocus:{value:k},uEdgeCut:{value:g(_(u.edgeCut,x.edgeCut),0,1)},uCam:{value:new r(0,0,1e6)},uPerspective:{value:0},...I};W=s;let c=Q(De,Oe(F),s,A<1||F.alpha);N&&(c.depthWrite=!0),c.side=2,V.push(c);let d=new h(o,c);d.renderOrder=1,B.add(d);{let r=new t(T,E,Math.max(1,Math.round(e/2)),Math.max(1,Math.round(i/2)));r.boundingBox=o.boundingBox.clone(),r.boundingSphere=o.boundingSphere.clone(),H.push(r);let a=new n(6/e,6/i),c=Q(ke,Ae(F),{...s,uReach:{value:a},...w()},A<1||F.alpha);N&&(c.depthWrite=!0),c.side=2,V.push(c);let l=new h(r,c);l.renderOrder=0,l.raycast=()=>void 0,B.add(l)}}else{let e=O(D,T,E),t=G(),r=Ce(_(u.layers,x.layers),k,D,T),i=g(_(u.edgeCut,x.edgeCut),0,1);r.forEach((r,a)=>{let o={...Z(v,u,p),uDepth:{value:y},uView:{value:new n},uZoom:{value:0},uMaxOffset:{value:new n(...e.maxOffset)},uInset:{value:new n(...e.inset)},uFocus:{value:k},uCenter:{value:r.center},uLo:{value:r.lo},uHi:{value:r.hi},uFeather:{value:i>0?Math.min(r.feather,i):.002},uBackground:{value:+!!r.background},...I,...w()},s=Q(we,je(F),o,!r.background||R);N&&me(s,o),V.push(s),U.push(s);let c=new h(t,s);c.position.z=N?0:r.z,c.renderOrder=N?a-1e3:a,c.userData.a3dPhotoLayer=a,B.add(c),fe.push({mesh:c,band:r})})}let he={x:0,y:0,zoom:0},ge=ue(j,{live:!p.deterministic,flat:M===`flat`}),K=new r,q=!1,_e=D*8*ie,J={progress:j.progress};z.userData.a3dPhotoMotion=J;let ve=O(D,T,E).inset,ye=(e,t,n)=>{F.glsl&&(F.frame(e,t,n),L());for(let e of V){let t=e.uniforms?.uOpacity;t&&(t.value=e.opacity)}if(M===`flat`)return;let r=ge.offset(e,t,{...n,progress:typeof J.progress==`number`?g(J.progress,0,1):null});he=r;let i=ce(r,ve);for(let e of U)e.uniforms.uView.value.set(r.x,r.y),e.uniforms.uZoom.value=i.zoom,e.uniforms.uInset.value.set(i.inset[0],i.inset[1]);let a=!!n.camera&&!!n.camera.isPerspectiveCamera;n.camera&&!q&&M!==`parallax`&&(n.camera.updateMatrixWorld(),z.updateWorldMatrix(!0,!1),K.setFromMatrixPosition(n.camera.matrixWorld),z.worldToLocal(K),q=!0);let o=0;if(!(M===`mesh`&&N)&&M===`mesh`){B.rotation.set(r.y*_e,-r.x*_e,0);let e=a&&q?K.z:0,t=e>0?(r.vertigo??0)*.6*e:0;o=t;let n=(1+(r.push??0))*(e>0?(e+t)/e:1);B.scale.set(n,n,1),B.position.set(K.x*(1-n),K.y*(1-n),r.zoom*Y(D,T)*.5-t)}if(M===`mesh`&&W)W.uCam.value.set(K.x,K.y,K.z+o),W.uPerspective.value=a&&K.z>0?1:0;else if(M===`layers`&&q&&!N){let e=K.z;for(let{mesh:t,band:n}of fe)if(a&&e>n.z+.001){let r=(e-n.z)/e;t.scale.set(r,r,1),t.position.set(K.x*n.z/e,K.y*n.z/e,n.z)}else t.scale.set(1,1,1),t.position.set(0,0,n.z)}},X=new r,Te=new r,$=new re,Fe=new s;return{object:z,update:ye,effects:{get:(e,t)=>F.get(e,t),set(e,t,n){F.set(e,t,n)&&L()}},...N?{applyCamera:(e,t)=>{let n=!!e.isPerspectiveCamera;z.updateWorldMatrix(!0,!1),e.updateMatrixWorld(),X.setFromMatrixPosition(e.matrixWorld),z.worldToLocal(X);let i=n&&X.z>.001?X.z:0,a=i>0?i:1e6;for(let e of pe)e.uZDist.value=a;if(B.scale.set(1,1,1),!t||!i)return;let o=e;o.updateProjectionMatrix();let s=Se(M===`mesh`?`mesh`:M===`layers`?`layers`:`parallax`,he,{strength:D,width:T,height:E,distance:i});if(!s.x&&!s.y&&!s.dolly&&s.magnify===1)return;$.setFromMatrix4(z.matrixWorld);let c=Te.set(s.x,s.y,-s.dolly).applyMatrix3($),l=-new r().setFromMatrixPosition(z.matrixWorld).applyMatrix4(e.matrixWorldInverse).z,u=c.clone().applyMatrix3($.setFromMatrix4(e.matrixWorldInverse));if(e.position.add(c),e.updateMatrixWorld(),!(l>.001))return;let d=l+u.z;if(!(d>.001))return;let f=(Number.isNaN(s.magnify)?l/d:s.magnify)*d/l;Fe.set(f,0,-f*u.x/d,0,0,f,-f*u.y/d,0,0,0,1,0,0,0,0,1),o.projectionMatrix.multiply(Fe),o.projectionMatrixInverse.copy(o.projectionMatrix).invert(),!Number.isNaN(s.magnify)&&s.magnify!==1&&B.scale.set(1/s.magnify,1/s.magnify,1)}}:{},dispose(){ge.dispose();for(let e of V)e.dispose();for(let e of H)e.dispose();v.dispose(),y?.dispose(),C?.map.dispose(),C?.depth.dispose()}}}export{$ as buildPhoto};