@volter/model-editor 0.5.66
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/BUNDLED_NOTICES +6748 -0
- package/LICENSE +686 -0
- package/LICENSE-BLENDER +1409 -0
- package/LICENSE-MCP +21 -0
- package/NOTICE +20 -0
- package/dist/.vite/manifest.json +1954 -0
- package/dist/assets/AudioViewer-CRWsJVYN.js +1 -0
- package/dist/assets/BVHLoader-xUHWsz84.js +1 -0
- package/dist/assets/ColladaLoader-Ccy_gHsu.js +3 -0
- package/dist/assets/EntityModelDocument-Dal8YnLK.js +1 -0
- package/dist/assets/EnvironmentAssetDocument-DFOFYX5v.js +1 -0
- package/dist/assets/FBXLoader-Dh0pOBW2.js +1 -0
- package/dist/assets/GameplaySessionTimeline-HJLZUV4Q.js +142 -0
- package/dist/assets/ImageViewer-BzqBpqL-.js +1 -0
- package/dist/assets/InspectorCanvasPreview-CLDhscy0.js +1 -0
- package/dist/assets/InspectorObjectPreview-BUZEp4xS.js +1 -0
- package/dist/assets/JsonAssetDocument-DCkqRS0N.js +2 -0
- package/dist/assets/LineSegments2-C8H20K8w.js +370 -0
- package/dist/assets/LiveModuleDocument-CuOBVz3A.js +2 -0
- package/dist/assets/LutAssetDocument-IyEir1rq.js +1 -0
- package/dist/assets/MTLLoader-C-rA0fNF.js +2 -0
- package/dist/assets/ModelAssetDocument-DNStNyCc.js +1 -0
- package/dist/assets/NonThreeAuthoringBootstrap-BE15Wpmw.js +2 -0
- package/dist/assets/OBJLoader-CopWRneC.js +5 -0
- package/dist/assets/Object3DDocumentToolbar-5Dv_8caG.js +1 -0
- package/dist/assets/Object3DPreview-C09u9uQZ.js +2 -0
- package/dist/assets/OnlineAssetDetail-DOPUI1iu.js +1 -0
- package/dist/assets/OrbitControls-DrFzvAAB.js +1 -0
- package/dist/assets/PLYLoader-D_esTZ2f.js +2 -0
- package/dist/assets/QuarksAssetDocument-BbSJ970L.js +2 -0
- package/dist/assets/RectAreaLightUniformsLib-u1ciScuw.js +1 -0
- package/dist/assets/STLLoader-Cl5I0sAi.js +1 -0
- package/dist/assets/ShaderAssetDocument-qlLeb2S3.js +12 -0
- package/dist/assets/SourceAssetViewer-DwhuqbA4.js +1 -0
- package/dist/assets/StageHost-D-o8MsFS.js +1122 -0
- package/dist/assets/TDSLoader-KKBg8ef1.js +1 -0
- package/dist/assets/ToolObject3DPreview-ILbch3kN.js +1 -0
- package/dist/assets/Toolbar-DYJjJKTt.js +1 -0
- package/dist/assets/TransientHint-D94hsJSR.js +1 -0
- package/dist/assets/VideoViewer-Bx3FPbgE.js +1 -0
- package/dist/assets/ViewportShadingMenu-B3N6hSdN.js +1 -0
- package/dist/assets/_commonjsHelpers-D6-XlEtG.js +1 -0
- package/dist/assets/agx-base-srgb-BjWZJgrZ.lut +0 -0
- package/dist/assets/agx-look-medium-high-contrast-D5F_ob1L.lut +0 -0
- package/dist/assets/agx-look-punchy-dxsnycNs.lut +0 -0
- package/dist/assets/animation-mixers.service-N9HxGOMf.js +1 -0
- package/dist/assets/asset-editor-persistence-DGD05u26.js +1 -0
- package/dist/assets/blender-emscripten-engine-CEsWgnR7.js +2 -0
- package/dist/assets/blender-node-editor.document-BT2M622g.js +1 -0
- package/dist/assets/blender-properties-tab-C5tUuCSv.js +3 -0
- package/dist/assets/blender-runtime-host-4ufXy47O.js +4 -0
- package/dist/assets/blender-runtime-skin-DMq0XAvO.js +7138 -0
- package/dist/assets/blender-runtime.document-DeFQQsF6.js +8 -0
- package/dist/assets/blender-timeline.document-BnlSdxy0.js +1 -0
- package/dist/assets/blender-uv-editor.document-UC-XeNn0.js +1 -0
- package/dist/assets/blender-version.status-BZP39oH7.js +1 -0
- package/dist/assets/blender-wali-engine-D3iKpzn9.js +2 -0
- package/dist/assets/blender.command-IGP5wuda.js +1 -0
- package/dist/assets/blender.environment-CG-pC7sk.js +1 -0
- package/dist/assets/blender.keymap-GAQgeklK.js +1 -0
- package/dist/assets/blender.status-ujwGU6dU.js +1 -0
- package/dist/assets/blender.style-CxfbTFcE.js +1 -0
- package/dist/assets/browserAll-2r3AVaAO.js +14 -0
- package/dist/assets/canvas-preview-frames-CO60PDM7.js +5 -0
- package/dist/assets/city-EkhAOo5s.exr +0 -0
- package/dist/assets/client-DNXj_opT.js +25 -0
- package/dist/assets/clip-planes-CnAI6DZn.js +1 -0
- package/dist/assets/courtyard-DqlebbpC.exr +0 -0
- package/dist/assets/editor-presentation-activity-C7SNSmTd.js +1 -0
- package/dist/assets/filmic-srgb-Ct35FIH6.lut +0 -0
- package/dist/assets/forest-P_CQY3b_.exr +0 -0
- package/dist/assets/hosted-asset-materialization-BXM49Qkc.js +2 -0
- package/dist/assets/index-B4bmKkgY.css +1 -0
- package/dist/assets/index-BP6wv2A0.js +5 -0
- package/dist/assets/index-Bge9JUr6.js +1 -0
- package/dist/assets/index-BncK9THk.js +1 -0
- package/dist/assets/index-BtfYaG4D.js +952 -0
- package/dist/assets/index-CJbYy-CF.js +3 -0
- package/dist/assets/index-CanA16PU.js +2 -0
- package/dist/assets/index-CinJrH5C.js +9 -0
- package/dist/assets/index-CtzuWnCS.js +1 -0
- package/dist/assets/index-D2LwEE0L.js +562 -0
- package/dist/assets/index-DUqP1RMl.js +1 -0
- package/dist/assets/index-D_NuPfjr.js +9 -0
- package/dist/assets/index-DaQZGF7d.js +1 -0
- package/dist/assets/index-DgapqSPi.js +7 -0
- package/dist/assets/index-IEjydI9d.js +1 -0
- package/dist/assets/index-cpXNKgvz.js +1498 -0
- package/dist/assets/index-gHZae-lw.js +13 -0
- package/dist/assets/interior-Bo_lba15.exr +0 -0
- package/dist/assets/jsx-runtime-DPjLkJKQ.js +9 -0
- package/dist/assets/live-mixers-BRkRHd6g.js +1 -0
- package/dist/assets/material-preview.view-DqNcpd_b.js +1 -0
- package/dist/assets/model-inspection-JC6gbV8Q.js +1 -0
- package/dist/assets/model.layout-BpZE1W9V.js +1 -0
- package/dist/assets/models.finder-BplPGS4I.js +1 -0
- package/dist/assets/night-CvV4Gybt.exr +0 -0
- package/dist/assets/product-CfZaqLpw.js +1 -0
- package/dist/assets/properties-bone-constraints.inspector-Di8kNtAi.js +1 -0
- package/dist/assets/properties-bone.inspector-CqAIKNsE.js +1 -0
- package/dist/assets/properties-collection.inspector-DpHC_fXW.js +1 -0
- package/dist/assets/properties-constraints.inspector-C7G7NOZU.js +1 -0
- package/dist/assets/properties-data.inspector-D1sUUst6.js +1 -0
- package/dist/assets/properties-material.inspector-BUSjc8tl.js +1 -0
- package/dist/assets/properties-modifiers.inspector-Sq9bcfFz.js +1 -0
- package/dist/assets/properties-object.inspector-BzqiU_29.js +1 -0
- package/dist/assets/properties-output.inspector-BWpFqvfT.js +1 -0
- package/dist/assets/properties-particles.inspector-DO1KoaTz.js +1 -0
- package/dist/assets/properties-physics.inspector-BgkrTNSA.js +1 -0
- package/dist/assets/properties-render.inspector-BU5NOVoQ.js +1 -0
- package/dist/assets/properties-scene.inspector-DbMErJ48.js +1 -0
- package/dist/assets/properties-texture.inspector-toPpEwqp.js +1 -0
- package/dist/assets/properties-view-layer.inspector-COpx9iEK.js +1 -0
- package/dist/assets/properties-world.inspector-CxU0DrYX.js +1 -0
- package/dist/assets/react-18-DyywM-Z2.js +1 -0
- package/dist/assets/react-story-board-B9V-j_Y5.js +1 -0
- package/dist/assets/react-three-rapier.esm-CN6t4A7c.js +1 -0
- package/dist/assets/regions-DWeEBnE2.js +1 -0
- package/dist/assets/sculpt.layout-D-K5cLw6.js +1 -0
- package/dist/assets/session-CsR0lApe.js +4886 -0
- package/dist/assets/shading.layout-CZZHKBer.js +1 -0
- package/dist/assets/sky-precompute-worker-ChN7J87v.js +1 -0
- package/dist/assets/spark.module-gG1EsWx8.js +12120 -0
- package/dist/assets/stage-keyboard-CzlqI0nh.js +1 -0
- package/dist/assets/stage-overlay-set-DQeskS16.js +1 -0
- package/dist/assets/stage-presence-markers-S1lMOwIa.js +1 -0
- package/dist/assets/stage-transform-tools-Cqtv-ZQ1.js +1 -0
- package/dist/assets/story-capture-DmIUyEQn.js +1 -0
- package/dist/assets/story-mount-turn-2IYGgHob.js +1 -0
- package/dist/assets/story-pixi-preview-aw8xQhvF.js +1 -0
- package/dist/assets/story-three-preview-DDmMjlI8.js +37 -0
- package/dist/assets/studio-CysTBGIb.exr +0 -0
- package/dist/assets/sunrise-Dj0psFrf.exr +0 -0
- package/dist/assets/sunset-Bw3x2Bot.exr +0 -0
- package/dist/assets/texture.layout-DASpHVht.js +1 -0
- package/dist/assets/three.module-ZILb6uB7.js +3840 -0
- package/dist/assets/transform-mode-request-DSPwviXs.js +1 -0
- package/dist/assets/uv-editing.layout-A8RA-cbM.js +1 -0
- package/dist/assets/vgai-shared-fontawesome-CFSkqz69.js +1 -0
- package/dist/assets/vgai-shared-jsx-dev-runtime-DFDKL7fx.js +1 -0
- package/dist/assets/vgai-shared-jsx-runtime-DIqBpTut.js +1 -0
- package/dist/assets/vgai-shared-react-CdM3D1mG.js +1 -0
- package/dist/assets/vgai-shared-react-dom-DFajMqMT.js +1 -0
- package/dist/assets/vgai-shared-react-dom-client-S0ozfl6_.js +1 -0
- package/dist/assets/vgai-shared-three-DzfWDqlp.js +1 -0
- package/dist/assets/viewport-pick-context-DkawXbEi.js +1 -0
- package/dist/assets/viewport-surface-status-DuININWe.js +20 -0
- package/dist/assets/webworkerAll-CqQUotBj.js +101 -0
- package/dist/assets/worker-B7zhIsFh.js +2 -0
- package/dist/assets/world-documents-DkBqH8VU.js +3 -0
- package/dist/vgai-shared-react.json +10 -0
- package/dist/vgai-shared-three.json +3 -0
- package/dist-node/cli.js +19722 -0
- package/dist-node/create.js +14102 -0
- package/package.json +61 -0
- package/presets.mjs +2 -0
- package/src/contributions.d.ts +4 -0
- package/src/index.ts +10 -0
- package/starter/cube.blend +0 -0
- package/starter/cube.py +81 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{b as B,c as H,p as W,r as M,T as v,B as P,d as h,f as F}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";function Q({assetPath:i,displayName:l}){const{sheetPath:n,frameName:t}=B(i),s=`/${n}`,[r,a]=o.useState(null),[x,p]=o.useState(t),[m,u]=o.useState("fit"),[j,I]=o.useState(null),w=o.useRef(null),[y,N]=o.useState({w:320,h:240}),f=x??t,g=f?r?.frames.find(c=>c.name===f)??null:null;o.useEffect(()=>{p(t),u("fit")},[t]),o.useEffect(()=>{if(!t){a(null);return}let c=!1;return fetch(`/${H(n)}`).then(d=>d.ok?d.text():null).then(d=>{c||!d||a(W(d))}).catch(()=>{c||a(null)}),()=>{c=!0}},[t,n]),o.useEffect(()=>{const c=w.current;if(!c)return;const d=new ResizeObserver(R=>{const S=R[0]?.contentRect;S&&N({w:Math.max(1,S.width-24),h:Math.max(1,S.height-24)})});return d.observe(c),()=>d.disconnect()},[]);const b=g?.sourceWidth??j?.w??0,$=g?.sourceHeight??j?.h??0,k=M(m,b,$,y.w,y.h),E=l??f??n.split("/").pop()??i;return e.jsxs("div",{"data-testid":"image-asset-document",style:{height:"100%",minHeight:240,display:"flex",flexDirection:"column",minWidth:0},children:[e.jsx(T,{title:E,srcWidth:b,srcHeight:$,scaleMode:m,scale:k,onScaleMode:u}),e.jsx(z,{stageRef:w,frameName:t,frame:g,sheet:r,sheetUrl:s,title:E,scale:k,onNatural:I}),r&&r.frames.length>1?e.jsx(C,{sheetUrl:s,frames:r.frames,activeName:f,onPick:p}):null]})}function T({title:i,srcWidth:l,srcHeight:n,scaleMode:t,scale:s,onScaleMode:r}){return e.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:6,padding:"6px 8px"},children:[e.jsx(v,{tone:"dim",variant:"label",children:i}),l>0&&e.jsxs(v,{tone:"muted",variant:"code",children:[l," × ",n,t==="fit"?` · ${O(s)}`:""]}),e.jsx("span",{style:{flex:1}}),[1,4,8,"fit"].map(a=>e.jsx(P,{type:"button",size:"compact",shape:"segment","aria-pressed":t===a,variant:t===a?"primary":"secondary",onClick:()=>r(a),children:a==="fit"?"Fit":`${a}×`},String(a)))]})}function z({stageRef:i,frameName:l,frame:n,sheet:t,sheetUrl:s,title:r,scale:a,onNatural:x}){let p;return l&&!n?p=e.jsx(v,{tone:"muted",variant:"body",children:t?`No sprite named ${l}`:"Loading sprite…"}):n?p=e.jsx(F,{sheetUrl:s,frame:n,scale:a}):p=e.jsx("img",{src:s,alt:r,style:{imageRendering:"pixelated",display:"block",transform:`scale(${a})`,transformOrigin:"center center"},onLoad:m=>{const u=m.currentTarget;x({w:u.naturalWidth,h:u.naturalHeight})}}),e.jsx("div",{ref:i,className:"vgai-asset-transparency-well","data-testid":"sprite-stage",style:{flex:1,minHeight:0,display:"flex",alignItems:"center",justifyContent:"center",overflow:"auto"},children:p})}function C({sheetUrl:i,frames:l,activeName:n,onPick:t}){return e.jsx("div",{"data-testid":"sprite-filmstrip",style:{display:"flex",gap:6,overflowX:"auto",padding:"8px 8px 10px",borderTop:`1px solid ${h[3]}`},children:l.map(s=>{const r=s.name===n;return e.jsxs("button",{type:"button",title:s.name,"aria-pressed":r,onClick:()=>t(s.name),style:{border:r?`1px solid ${h[1]}`:"1px solid transparent",background:"transparent",padding:2,cursor:"pointer",flex:"0 0 auto"},children:[e.jsx(F,{sheetUrl:i,frame:s,maxEdge:40}),e.jsx("div",{style:{fontSize:9,color:r?h[1]:h[3],maxWidth:56,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name})]},s.name)})})}function O(i){return i>=1?`${i}×`:`1/${Math.round(1/i)}×`}export{Q as ImageViewer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{r as o}from"./index-DaQZGF7d.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";function f({capture:r,previewKey:s,size:l}){const[n,e]=o.useState(null);return o.useEffect(()=>{let t=!1;return e(null),r(l).then(a=>{t||e(a)},()=>{t||e(null)}),()=>{t=!0}},[r,s,l]),n?i.jsx("img",{src:n,alt:"Selected object preview",className:"vgai-component-thumbnail"}):null}export{f as InspectorCanvasPreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{Object3DSnapshotDocument as p}from"./EntityModelDocument-Dal8YnLK.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-cpXNKgvz.js";import"./index-DaQZGF7d.js";import"./index-D_NuPfjr.js";import"./index-CtzuWnCS.js";import"./index-CinJrH5C.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";import"./live-mixers-BRkRHd6g.js";import"./StageHost-D-o8MsFS.js";import"./viewport-surface-status-DuININWe.js";import"./model-inspection-JC6gbV8Q.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-DrFzvAAB.js";import"./LineSegments2-C8H20K8w.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function B({previewKey:i,object:o,displayName:r,fill:e=!1}){return t.jsx("div",{"data-testid":"inspector-object-preview",style:e?{position:"absolute",inset:0,overflow:"hidden"}:{width:"100%",height:220,minHeight:220,borderBottom:"1px solid var(--vgai-structural-divider)",overflow:"hidden",position:"relative"},children:t.jsx(p,{documentId:`inspector-preview:${i}`,source:o,displayName:r,active:!0,chromeless:!0})})}export{B as InspectorObjectPreview};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DgapqSPi.js","assets/index-BP6wv2A0.js","assets/index-CJbYy-CF.js","assets/index-CanA16PU.js","assets/index-Bge9JUr6.js","assets/index-gHZae-lw.js","assets/index-BncK9THk.js","assets/index-IEjydI9d.js","assets/index-DUqP1RMl.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a}from"./jsx-runtime-DPjLkJKQ.js";import{r as m}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{t as n,a$ as b,bt as z,S as F,bu as M,A as J}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";const P={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"typescript",jsx:"typescript",mjs:"typescript",cjs:"typescript",json:"json",jsonc:"json",json5:"json"};function ie(e){const o=e.split("/").pop()??e,t=o.lastIndexOf(".");return t<0?"text":P[o.slice(t+1).toLowerCase()]??"text"}let T=null;function W(){return T??=Promise.all([b(()=>import("./index-BP6wv2A0.js"),[]),b(()=>import("./index-DgapqSPi.js").then(e=>e.i),__vite__mapDeps([0,1])),b(()=>import("./index-CJbYy-CF.js").then(e=>e.w),__vite__mapDeps([2,1,0])),b(()=>import("./index-CanA16PU.js"),__vite__mapDeps([3,0,1])),b(()=>import("./index-Bge9JUr6.js"),__vite__mapDeps([4,1,0,2])),b(()=>import("./index-gHZae-lw.js"),__vite__mapDeps([5,6,2,1,0])),b(()=>import("./index-IEjydI9d.js"),__vite__mapDeps([7,6,2,1,0])),b(()=>import("./index-DUqP1RMl.js"),__vite__mapDeps([8,0,1,2]))]).then(([e,o,t,r,c,s,l,d])=>({state:e,view:o,language:t,search:r,commands:c,javascript:s,json:l,oneDark:d})),T}function S(e){return typeof e=="number"?`${e}px`:e}function R(e){return typeof e=="string"&&e.trim().endsWith("%")}function G(e,o){let t=0;for(;t<e.length&&t<o.length&&e[t]===o[t];)t++;let r=e.length,c=o.length;for(;r>t&&c>t&&e[r-1]===o[c-1];)r--,c--;return{from:t,oldEnd:r,newEnd:c}}const L=1800,k=`color-mix(in srgb, ${n.semantic.warning} 42%, transparent)`,C=`color-mix(in srgb, ${n.semantic.warning} 18%, transparent)`;function U(e){class o extends e.view.WidgetType{constructor(s){super(),this.revision=s}eq(s){return this.revision===s.revision}toDOM(){const s=document.createElement("span");return s.className=`cm-source-deletion cm-source-change cm-source-change-${this.revision%2}`,s.setAttribute("aria-hidden","true"),s}}const t=e.state.StateEffect.define(),r=e.state.StateField.define({create:()=>e.view.Decoration.none,update(c,s){let l=c.map(s.changes);for(const d of s.effects){if(!d.is(t))continue;if(!d.value){l=e.view.Decoration.none;continue}const{from:g,to:i,revision:y}=d.value,f=g===i?e.view.Decoration.widget({widget:new o(y),side:-1}).range(g):e.view.Decoration.mark({class:`cm-source-change cm-source-change-${y%2}`}).range(g,i);l=e.view.Decoration.set([f])}return l},provide:c=>e.view.EditorView.decorations.from(c)});return{mark:t,field:r}}function K(e,o,t){return e.view.EditorView.theme({"&":{color:n.content.primary,backgroundColor:"transparent",fontSize:`${o}px`,...R(t)?{height:S(t)}:{}},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:n.typography.mono,padding:"2px 0",caretColor:"transparent"},".cm-scroller":{fontFamily:n.typography.mono,lineHeight:"1.5",overflow:"auto",...t===void 0?{}:{maxHeight:S(t)}},".cm-gutters":{backgroundColor:"transparent",color:n.content.dim,border:"none",userSelect:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",minWidth:"2ch"},".cm-content ::selection":{backgroundColor:n.selection.background},".cm-panels":{backgroundColor:n.surface.raised,color:n.content.primary,border:"none",fontFamily:n.typography.sans},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${n.boundary.default}`},".cm-textfield":{backgroundColor:n.surface.inset,color:n.content.primary,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},".cm-button":{backgroundColor:n.surface.raised,backgroundImage:"none",color:n.content.primary,border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small},".cm-searchMatch":{backgroundColor:n.accent.muted},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:n.accent.default,color:n.content.onAccent},".cm-source-change":{backgroundColor:k,borderRadius:"2px"},".cm-line:has(.cm-source-change)":{backgroundColor:C},".cm-source-change, .cm-line:has(.cm-source-change)":{animationDuration:`${L}ms`,animationTimingFunction:"ease-out",animationFillMode:"forwards"},".cm-source-deletion":{display:"inline-block",width:"0",position:"relative"},".cm-source-deletion::after":{content:'""',position:"absolute",left:"-2px",bottom:"0",width:"4px",height:"1em",backgroundColor:"inherit",borderRadius:"2px"},".cm-source-change-0":{animationName:"vgai-source-change-even"},".cm-source-change-1":{animationName:"vgai-source-change-odd"},".cm-line:has(.cm-source-change-0)":{animationName:"vgai-source-line-even"},".cm-line:has(.cm-source-change-1)":{animationName:"vgai-source-line-odd"},"@keyframes vgai-source-line-even":{"0%, 40%":{backgroundColor:C},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-line-odd":{"0%, 40%":{backgroundColor:C},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-even":{"0%, 40%":{backgroundColor:k},"100%":{backgroundColor:"transparent"}},"@keyframes vgai-source-change-odd":{"0%, 40%":{backgroundColor:k},"100%":{backgroundColor:"transparent"}},"@media (prefers-reduced-motion: reduce)":{".cm-source-change, .cm-line:has(.cm-source-change)":{animation:"none"}},".cm-matchingBracket, &.cm-focused .cm-matchingBracket":{backgroundColor:n.neutralOverlay.active,outline:`1px solid ${n.boundary.strong}`}},{dark:!0})}function H(e,o,t,r){const c=o==="typescript"?[e.javascript.javascript({typescript:!0,jsx:!0})]:o==="json"?[e.json.json()]:[];return[e.view.lineNumbers(),e.view.highlightSpecialChars(),e.language.bracketMatching(),e.language.syntaxHighlighting(e.oneDark.oneDarkHighlightStyle),e.search.search({top:!0}),e.view.keymap.of([...e.commands.standardKeymap,...e.search.searchKeymap]),e.view.EditorView.lineWrapping,e.state.EditorState.readOnly.of(!0),e.view.EditorView.editable.of(!1),e.view.EditorView.contentAttributes.of({tabindex:"0"}),...c,K(e,t,r)]}function q({value:e,language:o,fontSize:t=11,maxHeight:r,ariaLabel:c,followChanges:s=!1}){const l=m.useRef(null),d=m.useRef(null),g=m.useRef(null),i=m.useRef(null),y=m.useRef(0),f=m.useRef(e);f.current=e;const[p,I]=m.useState(null),[$,N]=m.useState(!1);m.useEffect(()=>{let u=!1;return W().then(h=>{u||I(h)},()=>{u||N(!0)}),()=>{u=!0}},[]),m.useEffect(()=>{const u=l.current;if(!u||!p)return;const h=U(p),w=new p.view.EditorView({parent:u,state:p.state.EditorState.create({doc:f.current,extensions:[H(p,o,t,r),h.field]})});return d.current=w,g.current=h,()=>{i.current!==null&&clearTimeout(i.current),i.current=null,g.current=null,d.current=null,w.destroy()}},[p,o,t,r]),m.useEffect(()=>{const u=d.current;if(!u)return;const h=u.state.toText(e).toString(),w=u.state.doc.toString();if(w===h)return;const{from:x,oldEnd:B,newEnd:D}=G(w,h),A=u.state.changes({from:x,to:B,insert:h.slice(x,D)}),v=g.current,E=[];if(s&&p&&v){const _=u.coordsAtPos(x),j=u.scrollDOM.getBoundingClientRect(),O=_&&_.top>=j.top&&_.bottom<=j.bottom&&_.left>=j.left&&_.right<=j.right?u.scrollSnapshot().map(A):p.view.EditorView.scrollIntoView(x,{y:"nearest",x:"nearest"});O&&E.push(O),E.push(v.mark.of({from:x,to:D,revision:++y.current}))}else v&&E.push(v.mark.of(null));u.dispatch({changes:A,effects:E}),i.current!==null&&clearTimeout(i.current),i.current=null,s&&v&&(i.current=setTimeout(()=>{d.current===u&&u.dispatch({effects:v.mark.of(null)}),i.current=null},L))},[e,s,p]);const V=R(r)?{height:"100%",minHeight:0}:{};return p?a.jsx("div",{ref:l,role:"group","aria-label":c,style:{minWidth:0,...V}}):a.jsxs("div",{role:"group","aria-label":c,style:{minWidth:0,...V},children:[$&&a.jsx("div",{style:{color:n.semantic.warning,fontSize:10,marginBottom:4},children:"Syntax highlighting failed to load — showing plain text."}),a.jsx("pre",{style:{margin:0,fontFamily:n.typography.mono,fontSize:t,lineHeight:1.5,color:n.content.primary,whiteSpace:"pre-wrap",wordBreak:"break-word",overflow:"auto",...r===void 0?{}:{maxHeight:S(r)},...R(r)?{height:S(r)}:{}},children:e})]})}const X={fontSize:11,color:n.content.muted,marginBottom:2};function Y({assetPath:e}){const[o,t]=m.useState(null),[r,c]=m.useState("json"),[s,l]=m.useState(!1),d=e.split("/").pop()??e;return m.useEffect(()=>{let g=!1;return t(null),l(!1),fetch(z(e)).then(i=>i.text()).then(i=>{try{const y=JSON.parse(i);g||(c("json"),t(JSON.stringify(y,null,2)))}catch{g||(c("text"),t(i))}}).catch(()=>{g||l(!0)}),()=>{g=!0}},[e]),a.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[a.jsx("div",{style:{fontWeight:600,fontSize:12,color:n.content.primary,wordBreak:"break-all"},children:d}),a.jsx("div",{className:"vgai-content-frost",style:{border:`1px solid ${n.boundary.default}`,borderRadius:n.shape.small,padding:8,overflow:"hidden",maxHeight:500},children:s?a.jsx("span",{style:{color:n.semantic.danger,fontSize:11},children:"Failed to load file"}):o===null?a.jsx("span",{style:{color:n.content.muted,fontSize:11},children:"Loading..."}):a.jsx(q,{value:o,language:r,fontSize:10,maxHeight:484,ariaLabel:`Contents of ${d}`})}),a.jsx(F,{label:"Info",defaultOpen:!1,children:a.jsxs("div",{children:[a.jsx("div",{style:X,children:"Path"}),a.jsx("div",{style:{fontSize:11,color:n.content.primary,wordBreak:"break-all"},children:e})]})})]})}function Q({documentId:e,assetPath:o,displayName:t,active:r,sections:c,status:s}){const[l,d]=m.useState({kind:"loading"}),g=M();if(m.useEffect(()=>{if(!r){d({kind:"loading"});return}const i=new AbortController;return d({kind:"loading"}),(async()=>{for(const f of g){const p=await f.recognize(o,i.signal);if(p!==null)return{kind:"content",viewer:f,content:p}}return{kind:"generic"}})().then(f=>{i.signal.aborted||d(f)},f=>{i.signal.aborted||d({kind:"error",message:f instanceof Error?f.message:String(f)})}),()=>i.abort()},[r,o,g]),l.kind==="content"){const{Viewer:i}=l.viewer;return a.jsx(i,{documentId:e,assetPath:o,displayName:t,active:r,content:l.content})}return a.jsx(J,{documentId:e,active:r,type:"json",title:t,sections:c,status:s,children:l.kind==="loading"?a.jsxs("div",{style:{padding:20,color:n.content.muted},children:["Inspecting ",t,"…"]}):l.kind==="error"?a.jsx("div",{role:"alert",style:{padding:20,color:n.semantic.danger},children:l.message}):a.jsx(Y,{assetPath:o})})}const ce=Object.freeze(Object.defineProperty({__proto__:null,JsonAssetDocument:Q},Symbol.toStringTag,{value:"Module"}));export{q as C,Q as J,ce as a,ie as c};
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import{r as K,bi as B,bj as G,a as X,bd as M,aw as $,aK as I,bk as O,bl as _,bm as Q,B as C,bn as V,V as g,k as Y,o as E,bo as Z,d as ee,b as te}from"./three.module-ZILb6uB7.js";M.line={worldUnits:{value:1},linewidth:{value:1},resolution:{value:new X(1,1)},dashOffset:{value:0},dashScale:{value:1},dashSize:{value:1},gapSize:{value:1}};B.line={uniforms:G.merge([M.common,M.fog,M.line]),vertexShader:`
|
|
2
|
+
#include <common>
|
|
3
|
+
#include <color_pars_vertex>
|
|
4
|
+
#include <fog_pars_vertex>
|
|
5
|
+
#include <logdepthbuf_pars_vertex>
|
|
6
|
+
#include <clipping_planes_pars_vertex>
|
|
7
|
+
|
|
8
|
+
uniform float linewidth;
|
|
9
|
+
uniform vec2 resolution;
|
|
10
|
+
|
|
11
|
+
attribute vec3 instanceStart;
|
|
12
|
+
attribute vec3 instanceEnd;
|
|
13
|
+
|
|
14
|
+
attribute vec3 instanceColorStart;
|
|
15
|
+
attribute vec3 instanceColorEnd;
|
|
16
|
+
|
|
17
|
+
#ifdef WORLD_UNITS
|
|
18
|
+
|
|
19
|
+
varying vec4 worldPos;
|
|
20
|
+
varying vec3 worldStart;
|
|
21
|
+
varying vec3 worldEnd;
|
|
22
|
+
|
|
23
|
+
#ifdef USE_DASH
|
|
24
|
+
|
|
25
|
+
varying vec2 vUv;
|
|
26
|
+
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
#else
|
|
30
|
+
|
|
31
|
+
varying vec2 vUv;
|
|
32
|
+
|
|
33
|
+
#endif
|
|
34
|
+
|
|
35
|
+
#ifdef USE_DASH
|
|
36
|
+
|
|
37
|
+
uniform float dashScale;
|
|
38
|
+
attribute float instanceDistanceStart;
|
|
39
|
+
attribute float instanceDistanceEnd;
|
|
40
|
+
varying float vLineDistance;
|
|
41
|
+
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
void trimSegment( const in vec4 start, inout vec4 end ) {
|
|
45
|
+
|
|
46
|
+
// trim end segment so it terminates between the camera plane and the near plane
|
|
47
|
+
|
|
48
|
+
// conservative estimate of the near plane
|
|
49
|
+
float a = projectionMatrix[ 2 ][ 2 ]; // 3nd entry in 3th column
|
|
50
|
+
float b = projectionMatrix[ 3 ][ 2 ]; // 3nd entry in 4th column
|
|
51
|
+
float nearEstimate = - 0.5 * b / a;
|
|
52
|
+
|
|
53
|
+
float alpha = ( nearEstimate - start.z ) / ( end.z - start.z );
|
|
54
|
+
|
|
55
|
+
end.xyz = mix( start.xyz, end.xyz, alpha );
|
|
56
|
+
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void main() {
|
|
60
|
+
|
|
61
|
+
#ifdef USE_COLOR
|
|
62
|
+
|
|
63
|
+
vColor.xyz = ( position.y < 0.5 ) ? instanceColorStart : instanceColorEnd;
|
|
64
|
+
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#ifdef USE_DASH
|
|
68
|
+
|
|
69
|
+
vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
|
|
70
|
+
vUv = uv;
|
|
71
|
+
|
|
72
|
+
#endif
|
|
73
|
+
|
|
74
|
+
float aspect = resolution.x / resolution.y;
|
|
75
|
+
|
|
76
|
+
// camera space
|
|
77
|
+
vec4 start = modelViewMatrix * vec4( instanceStart, 1.0 );
|
|
78
|
+
vec4 end = modelViewMatrix * vec4( instanceEnd, 1.0 );
|
|
79
|
+
|
|
80
|
+
#ifdef WORLD_UNITS
|
|
81
|
+
|
|
82
|
+
worldStart = start.xyz;
|
|
83
|
+
worldEnd = end.xyz;
|
|
84
|
+
|
|
85
|
+
#else
|
|
86
|
+
|
|
87
|
+
vUv = uv;
|
|
88
|
+
|
|
89
|
+
#endif
|
|
90
|
+
|
|
91
|
+
// special case for perspective projection, and segments that terminate either in, or behind, the camera plane
|
|
92
|
+
// clearly the gpu firmware has a way of addressing this issue when projecting into ndc space
|
|
93
|
+
// but we need to perform ndc-space calculations in the shader, so we must address this issue directly
|
|
94
|
+
// perhaps there is a more elegant solution -- WestLangley
|
|
95
|
+
|
|
96
|
+
bool perspective = ( projectionMatrix[ 2 ][ 3 ] == - 1.0 ); // 4th entry in the 3rd column
|
|
97
|
+
|
|
98
|
+
if ( perspective ) {
|
|
99
|
+
|
|
100
|
+
if ( start.z < 0.0 && end.z >= 0.0 ) {
|
|
101
|
+
|
|
102
|
+
trimSegment( start, end );
|
|
103
|
+
|
|
104
|
+
} else if ( end.z < 0.0 && start.z >= 0.0 ) {
|
|
105
|
+
|
|
106
|
+
trimSegment( end, start );
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// clip space
|
|
113
|
+
vec4 clipStart = projectionMatrix * start;
|
|
114
|
+
vec4 clipEnd = projectionMatrix * end;
|
|
115
|
+
|
|
116
|
+
// ndc space
|
|
117
|
+
vec3 ndcStart = clipStart.xyz / clipStart.w;
|
|
118
|
+
vec3 ndcEnd = clipEnd.xyz / clipEnd.w;
|
|
119
|
+
|
|
120
|
+
// direction
|
|
121
|
+
vec2 dir = ndcEnd.xy - ndcStart.xy;
|
|
122
|
+
|
|
123
|
+
// account for clip-space aspect ratio
|
|
124
|
+
dir.x *= aspect;
|
|
125
|
+
dir = normalize( dir );
|
|
126
|
+
|
|
127
|
+
#ifdef WORLD_UNITS
|
|
128
|
+
|
|
129
|
+
vec3 worldDir = normalize( end.xyz - start.xyz );
|
|
130
|
+
vec3 tmpFwd = normalize( mix( start.xyz, end.xyz, 0.5 ) );
|
|
131
|
+
vec3 worldUp = normalize( cross( worldDir, tmpFwd ) );
|
|
132
|
+
vec3 worldFwd = cross( worldDir, worldUp );
|
|
133
|
+
worldPos = position.y < 0.5 ? start: end;
|
|
134
|
+
|
|
135
|
+
// height offset
|
|
136
|
+
float hw = linewidth * 0.5;
|
|
137
|
+
worldPos.xyz += position.x < 0.0 ? hw * worldUp : - hw * worldUp;
|
|
138
|
+
|
|
139
|
+
// don't extend the line if we're rendering dashes because we
|
|
140
|
+
// won't be rendering the endcaps
|
|
141
|
+
#ifndef USE_DASH
|
|
142
|
+
|
|
143
|
+
// cap extension
|
|
144
|
+
worldPos.xyz += position.y < 0.5 ? - hw * worldDir : hw * worldDir;
|
|
145
|
+
|
|
146
|
+
// add width to the box
|
|
147
|
+
worldPos.xyz += worldFwd * hw;
|
|
148
|
+
|
|
149
|
+
// endcaps
|
|
150
|
+
if ( position.y > 1.0 || position.y < 0.0 ) {
|
|
151
|
+
|
|
152
|
+
worldPos.xyz -= worldFwd * 2.0 * hw;
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
#endif
|
|
157
|
+
|
|
158
|
+
// project the worldpos
|
|
159
|
+
vec4 clip = projectionMatrix * worldPos;
|
|
160
|
+
|
|
161
|
+
// shift the depth of the projected points so the line
|
|
162
|
+
// segments overlap neatly
|
|
163
|
+
vec3 clipPose = ( position.y < 0.5 ) ? ndcStart : ndcEnd;
|
|
164
|
+
clip.z = clipPose.z * clip.w;
|
|
165
|
+
|
|
166
|
+
#else
|
|
167
|
+
|
|
168
|
+
vec2 offset = vec2( dir.y, - dir.x );
|
|
169
|
+
// undo aspect ratio adjustment
|
|
170
|
+
dir.x /= aspect;
|
|
171
|
+
offset.x /= aspect;
|
|
172
|
+
|
|
173
|
+
// sign flip
|
|
174
|
+
if ( position.x < 0.0 ) offset *= - 1.0;
|
|
175
|
+
|
|
176
|
+
// endcaps
|
|
177
|
+
if ( position.y < 0.0 ) {
|
|
178
|
+
|
|
179
|
+
offset += - dir;
|
|
180
|
+
|
|
181
|
+
} else if ( position.y > 1.0 ) {
|
|
182
|
+
|
|
183
|
+
offset += dir;
|
|
184
|
+
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// adjust for linewidth
|
|
188
|
+
offset *= linewidth;
|
|
189
|
+
|
|
190
|
+
// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
|
|
191
|
+
offset /= resolution.y;
|
|
192
|
+
|
|
193
|
+
// select end
|
|
194
|
+
vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
|
|
195
|
+
|
|
196
|
+
// back to clip space
|
|
197
|
+
offset *= clip.w;
|
|
198
|
+
|
|
199
|
+
clip.xy += offset;
|
|
200
|
+
|
|
201
|
+
#endif
|
|
202
|
+
|
|
203
|
+
gl_Position = clip;
|
|
204
|
+
|
|
205
|
+
vec4 mvPosition = ( position.y < 0.5 ) ? start : end; // this is an approximation
|
|
206
|
+
|
|
207
|
+
#include <logdepthbuf_vertex>
|
|
208
|
+
#include <clipping_planes_vertex>
|
|
209
|
+
#include <fog_vertex>
|
|
210
|
+
|
|
211
|
+
}
|
|
212
|
+
`,fragmentShader:`
|
|
213
|
+
uniform vec3 diffuse;
|
|
214
|
+
uniform float opacity;
|
|
215
|
+
uniform float linewidth;
|
|
216
|
+
|
|
217
|
+
#ifdef USE_DASH
|
|
218
|
+
|
|
219
|
+
uniform float dashOffset;
|
|
220
|
+
uniform float dashSize;
|
|
221
|
+
uniform float gapSize;
|
|
222
|
+
|
|
223
|
+
#endif
|
|
224
|
+
|
|
225
|
+
varying float vLineDistance;
|
|
226
|
+
|
|
227
|
+
#ifdef WORLD_UNITS
|
|
228
|
+
|
|
229
|
+
varying vec4 worldPos;
|
|
230
|
+
varying vec3 worldStart;
|
|
231
|
+
varying vec3 worldEnd;
|
|
232
|
+
|
|
233
|
+
#ifdef USE_DASH
|
|
234
|
+
|
|
235
|
+
varying vec2 vUv;
|
|
236
|
+
|
|
237
|
+
#endif
|
|
238
|
+
|
|
239
|
+
#else
|
|
240
|
+
|
|
241
|
+
varying vec2 vUv;
|
|
242
|
+
|
|
243
|
+
#endif
|
|
244
|
+
|
|
245
|
+
#include <common>
|
|
246
|
+
#include <color_pars_fragment>
|
|
247
|
+
#include <fog_pars_fragment>
|
|
248
|
+
#include <logdepthbuf_pars_fragment>
|
|
249
|
+
#include <clipping_planes_pars_fragment>
|
|
250
|
+
|
|
251
|
+
vec2 closestLineToLine(vec3 p1, vec3 p2, vec3 p3, vec3 p4) {
|
|
252
|
+
|
|
253
|
+
float mua;
|
|
254
|
+
float mub;
|
|
255
|
+
|
|
256
|
+
vec3 p13 = p1 - p3;
|
|
257
|
+
vec3 p43 = p4 - p3;
|
|
258
|
+
|
|
259
|
+
vec3 p21 = p2 - p1;
|
|
260
|
+
|
|
261
|
+
float d1343 = dot( p13, p43 );
|
|
262
|
+
float d4321 = dot( p43, p21 );
|
|
263
|
+
float d1321 = dot( p13, p21 );
|
|
264
|
+
float d4343 = dot( p43, p43 );
|
|
265
|
+
float d2121 = dot( p21, p21 );
|
|
266
|
+
|
|
267
|
+
float denom = d2121 * d4343 - d4321 * d4321;
|
|
268
|
+
|
|
269
|
+
float numer = d1343 * d4321 - d1321 * d4343;
|
|
270
|
+
|
|
271
|
+
mua = numer / denom;
|
|
272
|
+
mua = clamp( mua, 0.0, 1.0 );
|
|
273
|
+
mub = ( d1343 + d4321 * ( mua ) ) / d4343;
|
|
274
|
+
mub = clamp( mub, 0.0, 1.0 );
|
|
275
|
+
|
|
276
|
+
return vec2( mua, mub );
|
|
277
|
+
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
void main() {
|
|
281
|
+
|
|
282
|
+
float alpha = opacity;
|
|
283
|
+
vec4 diffuseColor = vec4( diffuse, alpha );
|
|
284
|
+
|
|
285
|
+
#include <clipping_planes_fragment>
|
|
286
|
+
|
|
287
|
+
#ifdef USE_DASH
|
|
288
|
+
|
|
289
|
+
if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
|
|
290
|
+
|
|
291
|
+
if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
|
|
292
|
+
|
|
293
|
+
#endif
|
|
294
|
+
|
|
295
|
+
#ifdef WORLD_UNITS
|
|
296
|
+
|
|
297
|
+
// Find the closest points on the view ray and the line segment
|
|
298
|
+
vec3 rayEnd = normalize( worldPos.xyz ) * 1e5;
|
|
299
|
+
vec3 lineDir = worldEnd - worldStart;
|
|
300
|
+
vec2 params = closestLineToLine( worldStart, worldEnd, vec3( 0.0, 0.0, 0.0 ), rayEnd );
|
|
301
|
+
|
|
302
|
+
vec3 p1 = worldStart + lineDir * params.x;
|
|
303
|
+
vec3 p2 = rayEnd * params.y;
|
|
304
|
+
vec3 delta = p1 - p2;
|
|
305
|
+
float len = length( delta );
|
|
306
|
+
float norm = len / linewidth;
|
|
307
|
+
|
|
308
|
+
#ifndef USE_DASH
|
|
309
|
+
|
|
310
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
311
|
+
|
|
312
|
+
float dnorm = fwidth( norm );
|
|
313
|
+
alpha = 1.0 - smoothstep( 0.5 - dnorm, 0.5 + dnorm, norm );
|
|
314
|
+
|
|
315
|
+
#else
|
|
316
|
+
|
|
317
|
+
if ( norm > 0.5 ) {
|
|
318
|
+
|
|
319
|
+
discard;
|
|
320
|
+
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
#endif
|
|
324
|
+
|
|
325
|
+
#endif
|
|
326
|
+
|
|
327
|
+
#else
|
|
328
|
+
|
|
329
|
+
#ifdef USE_ALPHA_TO_COVERAGE
|
|
330
|
+
|
|
331
|
+
// artifacts appear on some hardware if a derivative is taken within a conditional
|
|
332
|
+
float a = vUv.x;
|
|
333
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
334
|
+
float len2 = a * a + b * b;
|
|
335
|
+
float dlen = fwidth( len2 );
|
|
336
|
+
|
|
337
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
338
|
+
|
|
339
|
+
alpha = 1.0 - smoothstep( 1.0 - dlen, 1.0 + dlen, len2 );
|
|
340
|
+
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
#else
|
|
344
|
+
|
|
345
|
+
if ( abs( vUv.y ) > 1.0 ) {
|
|
346
|
+
|
|
347
|
+
float a = vUv.x;
|
|
348
|
+
float b = ( vUv.y > 0.0 ) ? vUv.y - 1.0 : vUv.y + 1.0;
|
|
349
|
+
float len2 = a * a + b * b;
|
|
350
|
+
|
|
351
|
+
if ( len2 > 1.0 ) discard;
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
#endif
|
|
356
|
+
|
|
357
|
+
#endif
|
|
358
|
+
|
|
359
|
+
#include <logdepthbuf_fragment>
|
|
360
|
+
#include <color_fragment>
|
|
361
|
+
|
|
362
|
+
gl_FragColor = vec4( diffuseColor.rgb, alpha );
|
|
363
|
+
|
|
364
|
+
#include <tonemapping_fragment>
|
|
365
|
+
#include <colorspace_fragment>
|
|
366
|
+
#include <fog_fragment>
|
|
367
|
+
#include <premultiplied_alpha_fragment>
|
|
368
|
+
|
|
369
|
+
}
|
|
370
|
+
`};class ie extends K{constructor(e){super({type:"LineMaterial",uniforms:G.clone(B.line.uniforms),vertexShader:B.line.vertexShader,fragmentShader:B.line.fragmentShader,clipping:!0}),this.isLineMaterial=!0,this.setValues(e)}get color(){return this.uniforms.diffuse.value}set color(e){this.uniforms.diffuse.value=e}get worldUnits(){return"WORLD_UNITS"in this.defines}set worldUnits(e){e===!0?this.defines.WORLD_UNITS="":delete this.defines.WORLD_UNITS}get linewidth(){return this.uniforms.linewidth.value}set linewidth(e){this.uniforms.linewidth&&(this.uniforms.linewidth.value=e)}get dashed(){return"USE_DASH"in this.defines}set dashed(e){e===!0!==this.dashed&&(this.needsUpdate=!0),e===!0?this.defines.USE_DASH="":delete this.defines.USE_DASH}get dashScale(){return this.uniforms.dashScale.value}set dashScale(e){this.uniforms.dashScale.value=e}get dashSize(){return this.uniforms.dashSize.value}set dashSize(e){this.uniforms.dashSize.value=e}get dashOffset(){return this.uniforms.dashOffset.value}set dashOffset(e){this.uniforms.dashOffset.value=e}get gapSize(){return this.uniforms.gapSize.value}set gapSize(e){this.uniforms.gapSize.value=e}get opacity(){return this.uniforms.opacity.value}set opacity(e){this.uniforms&&(this.uniforms.opacity.value=e)}get resolution(){return this.uniforms.resolution.value}set resolution(e){this.uniforms.resolution.value.copy(e)}get alphaToCoverage(){return"USE_ALPHA_TO_COVERAGE"in this.defines}set alphaToCoverage(e){this.defines&&(e===!0!==this.alphaToCoverage&&(this.needsUpdate=!0),e===!0?this.defines.USE_ALPHA_TO_COVERAGE="":delete this.defines.USE_ALPHA_TO_COVERAGE)}}const j=new C,z=new g;class ne extends ${constructor(){super(),this.isLineSegmentsGeometry=!0,this.type="LineSegmentsGeometry";const e=[-1,2,0,1,2,0,-1,1,0,1,1,0,-1,0,0,1,0,0,-1,-1,0,1,-1,0],t=[-1,2,1,2,-1,1,1,1,-1,-1,1,-1,-1,-2,1,-2],i=[0,2,1,2,3,1,2,4,3,4,5,3,4,6,5,6,7,5];this.setIndex(i),this.setAttribute("position",new I(e,3)),this.setAttribute("uv",new I(t,2))}applyMatrix4(e){const t=this.attributes.instanceStart,i=this.attributes.instanceEnd;return t!==void 0&&(t.applyMatrix4(e),i.applyMatrix4(e),t.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}setPositions(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceStart",new _(i,3,0)),this.setAttribute("instanceEnd",new _(i,3,3)),this.instanceCount=this.attributes.instanceStart.count,this.computeBoundingBox(),this.computeBoundingSphere(),this}setColors(e){let t;e instanceof Float32Array?t=e:Array.isArray(e)&&(t=new Float32Array(e));const i=new O(t,6,1);return this.setAttribute("instanceColorStart",new _(i,3,0)),this.setAttribute("instanceColorEnd",new _(i,3,3)),this}fromWireframeGeometry(e){return this.setPositions(e.attributes.position.array),this}fromEdgesGeometry(e){return this.setPositions(e.attributes.position.array),this}fromMesh(e){return this.fromWireframeGeometry(new Q(e.geometry)),this}fromLineSegments(e){const t=e.geometry;return this.setPositions(t.attributes.position.array),this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new C);const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;e!==void 0&&t!==void 0&&(this.boundingBox.setFromBufferAttribute(e),j.setFromBufferAttribute(t),this.boundingBox.union(j))}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new V),this.boundingBox===null&&this.computeBoundingBox();const e=this.attributes.instanceStart,t=this.attributes.instanceEnd;if(e!==void 0&&t!==void 0){const i=this.boundingSphere.center;this.boundingBox.getCenter(i);let s=0;for(let r=0,l=e.count;r<l;r++)z.fromBufferAttribute(e,r),s=Math.max(s,i.distanceToSquared(z)),z.fromBufferAttribute(t,r),s=Math.max(s,i.distanceToSquared(z));this.boundingSphere.radius=Math.sqrt(s),isNaN(this.boundingSphere.radius)&&console.error("THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.",this)}}toJSON(){}}const L=new E,H=new g,R=new g,o=new E,a=new E,m=new E,D=new g,T=new ee,d=new Z,N=new g,U=new C,A=new V,v=new E;let y,x;function F(c,e,t){return v.set(0,0,-e,1).applyMatrix4(c.projectionMatrix),v.multiplyScalar(1/v.w),v.x=x/t.width,v.y=x/t.height,v.applyMatrix4(c.projectionMatrixInverse),v.multiplyScalar(1/v.w),Math.abs(Math.max(v.x,v.y))}function se(c,e){const t=c.matrixWorld,i=c.geometry,s=i.attributes.instanceStart,r=i.attributes.instanceEnd,l=Math.min(i.instanceCount,s.count);for(let n=0,f=l;n<f;n++){d.start.fromBufferAttribute(s,n),d.end.fromBufferAttribute(r,n),d.applyMatrix4(t);const p=new g,h=new g;y.distanceSqToSegment(d.start,d.end,h,p),h.distanceTo(p)<x*.5&&e.push({point:h,pointOnLine:p,distance:y.origin.distanceTo(h),object:c,face:null,faceIndex:n,uv:null,uv1:null})}}function re(c,e,t){const i=e.projectionMatrix,r=c.material.resolution,l=c.matrixWorld,n=c.geometry,f=n.attributes.instanceStart,p=n.attributes.instanceEnd,h=Math.min(n.instanceCount,f.count),u=-e.near;y.at(1,m),m.w=1,m.applyMatrix4(e.matrixWorldInverse),m.applyMatrix4(i),m.multiplyScalar(1/m.w),m.x*=r.x/2,m.y*=r.y/2,m.z=0,D.copy(m),T.multiplyMatrices(e.matrixWorldInverse,l);for(let S=0,q=h;S<q;S++){if(o.fromBufferAttribute(f,S),a.fromBufferAttribute(p,S),o.w=1,a.w=1,o.applyMatrix4(T),a.applyMatrix4(T),o.z>u&&a.z>u)continue;if(o.z>u){const b=o.z-a.z,w=(o.z-u)/b;o.lerp(a,w)}else if(a.z>u){const b=a.z-o.z,w=(a.z-u)/b;a.lerp(o,w)}o.applyMatrix4(i),a.applyMatrix4(i),o.multiplyScalar(1/o.w),a.multiplyScalar(1/a.w),o.x*=r.x/2,o.y*=r.y/2,a.x*=r.x/2,a.y*=r.y/2,d.start.copy(o),d.start.z=0,d.end.copy(a),d.end.z=0;const P=d.closestPointToPointParameter(D,!0);d.at(P,N);const W=te.lerp(o.z,a.z,P),k=W>=-1&&W<=1,J=D.distanceTo(N)<x*.5;if(k&&J){d.start.fromBufferAttribute(f,S),d.end.fromBufferAttribute(p,S),d.start.applyMatrix4(l),d.end.applyMatrix4(l);const b=new g,w=new g;y.distanceSqToSegment(d.start,d.end,w,b),t.push({point:w,pointOnLine:b,distance:y.origin.distanceTo(w),object:c,face:null,faceIndex:S,uv:null,uv1:null})}}}class de extends Y{constructor(e=new ne,t=new ie({color:Math.random()*16777215})){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let l=0,n=0,f=t.count;l<f;l++,n+=2)H.fromBufferAttribute(t,l),R.fromBufferAttribute(i,l),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+H.distanceTo(R);const r=new O(s,2,1);return e.setAttribute("instanceDistanceStart",new _(r,1,0)),e.setAttribute("instanceDistanceEnd",new _(r,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const r=e.params.Line2!==void 0&&e.params.Line2.threshold||0;y=e.ray;const l=this.matrixWorld,n=this.geometry,f=this.material;x=f.linewidth+r,n.boundingSphere===null&&n.computeBoundingSphere(),A.copy(n.boundingSphere).applyMatrix4(l);let p;if(i)p=x*.5;else{const u=Math.max(s.near,A.distanceToPoint(y.origin));p=F(s,u,f.resolution)}if(A.radius+=p,y.intersectsSphere(A)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),U.copy(n.boundingBox).applyMatrix4(l);let h;if(i)h=x*.5;else{const u=Math.max(s.near,U.distanceToPoint(y.origin));h=F(s,u,f.resolution)}U.expandByScalar(h),y.intersectsBox(U)!==!1&&(i?se(this,t):re(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(L),this.material.uniforms.resolution.value.set(L.z,L.w))}}export{ne as L,ie as a,de as b};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/StageHost-D-o8MsFS.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-ZILb6uB7.js","assets/index-B4bmKkgY.css","assets/viewport-surface-status-DuININWe.js","assets/live-mixers-BRkRHd6g.js","assets/model-inspection-JC6gbV8Q.js","assets/clip-planes-CnAI6DZn.js","assets/OrbitControls-DrFzvAAB.js","assets/LineSegments2-C8H20K8w.js","assets/viewport-pick-context-DkawXbEi.js","assets/editor-presentation-activity-C7SNSmTd.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as o}from"./jsx-runtime-DPjLkJKQ.js";import{bR as W,bS as P,a$ as q,bT as J,t as g,u as X,X as G,E as M,bU as K,bV as Q,br as Y,bW as Z,bX as ee}from"./index-cpXNKgvz.js";import{r as c}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{V as te,O as re,S as ne}from"./viewport-surface-status-DuININWe.js";import{aJ as oe,B as se}from"./three.module-ZILb6uB7.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class w extends Error{constructor(t){super(t.message),this.refusal=t,this.name="LiveModuleError"}}function ie(e){return Object.keys(e).filter(t=>t!=="__esModule"&&t!=="Symbol.toStringTag")}function T(e){return typeof e=="object"&&e!==null&&e.isObject3D===!0}function ae(e){if("default"in e)return{name:"default",value:e.default};const t=ie(e);return t.length===0?{kind:"not-a-model",message:"This module exports nothing."}:t.length>1?{kind:"not-a-model",message:`This module has no default export and ${t.length} named exports (${t.join(", ")}), so there is no single subject to build. A model module default-exports its builder.`}:{name:t[0],value:e[t[0]]}}function _(e){if(T(e))return{root:e};if(!e||typeof e!="object")return;const t=e;if(!T(t.root))return;const r=t.root;return Array.isArray(t.animations)&&r.animations.length===0&&(r.animations=t.animations),{root:r,...typeof t.dispose=="function"?{dispose:()=>t.dispose.call(e)}:{}}}function L(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e!="object")return typeof e;if(Array.isArray(e))return"an array";const t=Object.keys(e);return t.length>0?`an object with keys ${t.slice(0,8).join(", ")}`:"an object with no own keys"}const $="a model module returns a THREE.Object3D, or a build result `{ root, animations?, dispose? }` whose `root` is one.";async function ce(e,t){const r=_(t);if(r)return{...r,exportName:e};if(typeof t!="function")return{kind:"not-a-model",message:`Export '${e}' is ${L(t)}, not a function and not a model — `+$};let l;try{l=await t()}catch(s){return{kind:"import-failed",message:`Export '${e}' threw while building: ${N(s)}`,...s instanceof Error&&s.stack?{stack:s.stack}:{}}}const u=_(l);return u?{...u,exportName:e}:{kind:"not-a-model",message:`Export '${e}' ran but returned ${L(l)} — ${$}`}}function N(e){return e instanceof Error?e.message:String(e)}async function le(e,t,r){let l;try{l=await import(W(e,t,r))}catch(d){throw new w({kind:"import-failed",message:N(d),...d instanceof Error&&d.stack?{stack:d.stack}:{}})}const u=ae(l);if("kind"in u)throw new w(u);const s=await ce(u.name,u.value);if("kind"in s)throw new w(s);return s}const ue=c.lazy(async()=>({default:(await q(()=>import("./StageHost-D-o8MsFS.js").then(t=>t.S),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19]))).Object3DDocumentViewport}));function de(e){return me(e.documentId,e.chromeless),o.jsx(c.Suspense,{fallback:o.jsx(te,{testId:"object3d-document-loading",children:re}),children:o.jsx(ue,{...e})})}function me(e,t=!1){c.useEffect(()=>{if(!t)return P(e)},[e,t])}const R={height:"100%",width:"100%",minHeight:0,display:"flex",position:"relative"},C={flex:1,minWidth:0,minHeight:0,display:"flex"};function fe(e,t){if(e.kind!=="import-failed")return{message:e.message};const r=ee(t);return r?{message:r,stack:e.message}:{message:e.message,stack:e.stack}}function De({documentId:e,projectRoot:t,modulePath:r,displayName:l,active:u,fallback:s}){const[d,v]=c.useState({status:"probing"}),[h,E]=c.useState(null),m=c.useMemo(()=>{const i=new oe;return i.name=r.split("/").pop()??r,i},[r]),D=c.useRef(!1);c.useEffect(()=>{let i=!1,y=0,f=null,p=Promise.resolve(),x=null,j=null;const S=()=>{f&&(m.remove(f),m.animations=[],j?j():M(f),f=null,j=null)},I=(n,b)=>{S(),f=n,j=b,m.add(n),m.animations=n.animations,Z(e)},V=(n,b)=>{if(n.kind==="not-a-model"&&!b){v({status:"fallback",reason:n.message});return}const a=fe(n,r);E(a),Y.error(`${r}: ${a.message}`,"live-module"),b||v({status:"fallback",reason:n.message})},O=n=>i||n!==y,H=async()=>{y+=1;const n=y,b=Q();let a;try{a=await le(t,r,b)}catch(k){if(O(n))return;if(!(k instanceof w))throw k;x=k,V(k.refusal,f!==null);return}if(O(n)){a.dispose?a.dispose():M(a.root);return}I(a.root,a.dispose??null),x=null,K(r),E(null),v({status:"live",exportName:a.exportName})},A=()=>(p=H(),p),z=J(e,async()=>{let n=A();for(;;){if(await n,i)throw new Error(`Document closed while rebuilding: ${r}`);if(n===p)break;n=p}if(x)throw x});A();const U=X();return()=>{i=!0,z(),U(),S()}},[m,e,r,t]),c.useEffect(()=>{if(d.status!=="live"||D.current)return;let i=0,y=0;const f=()=>{const p=G(e);if(p){D.current=!0,new se().setFromObject(m).isEmpty()||p.frame();return}++y>60||(i=requestAnimationFrame(f))};return i=requestAnimationFrame(f),()=>cancelAnimationFrame(i)},[m,e,d.status]);const B=c.useCallback(()=>({root:m,dispose(){}}),[m]);return d.status==="probing"?o.jsxs("div",{style:{padding:20,color:g.content.muted},children:["Inspecting ",l,"…"]}):d.status==="fallback"?o.jsxs("div",{style:R,children:[h?o.jsx(F,{failure:h}):null,o.jsx("div",{style:{...C,overflow:"auto"},children:s})]}):o.jsxs("div",{style:R,children:[o.jsx("div",{style:{...C,opacity:h?.35:1},children:o.jsx(de,{documentId:e,sourcePath:r,displayName:l,build:B,active:u,assetType:"model module",cameraDirection:ne,modelSource:{kind:"project-file",path:r}})}),h?o.jsx(F,{failure:h}):null]})}function F({failure:e}){return o.jsxs("div",{role:"alert","data-testid":"live-module-error",style:{position:"absolute",top:8,left:8,right:8,zIndex:2,maxHeight:"60%",overflow:"auto",padding:"8px 10px",borderRadius:g.shape.small,background:g.surface.raised,border:`1px solid ${g.semantic.danger}`,color:g.semantic.danger,fontFamily:g.typography.mono,fontSize:11,lineHeight:1.5,whiteSpace:"pre-wrap",wordBreak:"break-word",pointerEvents:"auto"},children:[o.jsx("div",{style:{fontWeight:600},children:"This module did not build — showing the last good model."}),o.jsx("div",{style:{marginTop:4},children:e.message}),e.stack?o.jsx("div",{style:{marginTop:6,color:g.content.muted},children:e.stack}):null]})}export{De as LiveModuleDocument};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as i}from"./jsx-runtime-DPjLkJKQ.js";import{P as U,b9 as A,L as N,M as k,t as y,A as M,ba as I,Q as C,C as P}from"./index-cpXNKgvz.js";import{r as w}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{EffectComposer as F,LUT3DEffect as _,RenderPass as $,EffectPass as B}from"./index-BtfYaG4D.js";import{a0 as O,w as T,a2 as G,V as v,$ as H,L as R,a3 as L,W as V,e as W,A as q,f as X,h as D,g as Z,a_ as Q,a$ as J,l as j,m as K,b3 as Y,i as ee,k as te}from"./three.module-ZILb6uB7.js";import{s as re}from"./asset-editor-persistence-DGD05u26.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";class ne extends O{constructor(t){super(t),this.type=T}setType(t){return this.type=t,this}load(t,a,f,g){const n=new G(this.manager);n.setPath(this.path),n.setResponseType("text"),n.load(t,c=>{try{a(this.parse(c))}catch(e){g?g(e):console.error(e),this.manager.itemError(t)}},f,g)}parse(t){const a=/TITLE +"([^"]*)"/,f=/LUT_3D_SIZE +(\d+)/,g=/DOMAIN_MIN +([\d.]+) +([\d.]+) +([\d.]+)/,n=/DOMAIN_MAX +([\d.]+) +([\d.]+) +([\d.]+)/,c=/^([\d.e+-]+) +([\d.e+-]+) +([\d.e+-]+) *$/gm;let e=a.exec(t);const p=e!==null?e[1]:null;if(e=f.exec(t),e===null)throw new Error("LUTCubeLoader: Missing LUT_3D_SIZE information");const s=Number(e[1]),u=s**3*4,o=this.type===T?new Uint8Array(u):new Float32Array(u),d=new v(0,0,0),m=new v(1,1,1);if(e=g.exec(t),e!==null&&d.set(Number(e[1]),Number(e[2]),Number(e[3])),e=n.exec(t),e!==null&&m.set(Number(e[1]),Number(e[2]),Number(e[3])),d.x>m.x||d.y>m.y||d.z>m.z)throw new Error("LUTCubeLoader: Invalid input domain");const x=this.type===T?255:1;let h=0;for(;(e=c.exec(t))!==null;)o[h++]=Number(e[1])*x,o[h++]=Number(e[2])*x,o[h++]=Number(e[3])*x,o[h++]=x;const l=new H;return l.image.data=o,l.image.width=s,l.image.height=s,l.image.depth=s,l.type=this.type,l.magFilter=R,l.minFilter=R,l.wrapS=L,l.wrapT=L,l.wrapR=L,l.generateMipmaps=!1,l.needsUpdate=!0,{title:p,size:s,domainMin:d,domainMax:m,texture3D:l}}}function b(r){return r.split("/").pop()??r}function E(r,t,a){return Math.min(a,Math.max(t,r))}function z(r){return[r.x,r.y,r.z].map(t=>t.toFixed(2)).join(", ")}function se(){const r=new X;r.background=new D("#171a22");const t=new Z(34,1,.1,100);t.position.set(6.6,4.6,8.8),t.lookAt(0,.7,0),r.add(new Q("#dce8ff","#322a27",2.1));const a=new J("#fff3db",3.8);a.position.set(4,7,5),r.add(a);const f=[],g=[],n=(s,u,o)=>{f.push(s),g.push(u);const d=new te(s,u);return d.position.set(...o),d.castShadow=!0,d.receiveShadow=!0,r.add(d),d},c=[["#e64d45",-2.4],["#e5ad42",-1.2],["#55b86a",0],["#47a9d8",1.2],["#8a68d7",2.4]];for(const[s,u]of c)n(new K(.48,48,32),new j({color:s,roughness:.3,metalness:.08}),[u,.65,0]);[.06,.18,.5,.82,1].forEach((s,u)=>{const o=Math.round(s*255);n(new Y(.78,.78,.78),new j({color:new D(`rgb(${o}, ${o}, ${o})`),roughness:.72}),[-2.4+u*1.2,1.85,-.1])});const p=n(new ee(9,6),new j({color:"#777b86",roughness:.92}),[0,.08,-1.8]);return p.rotation.x=-Math.PI/2,{scene:r,camera:t,dispose:()=>{for(const s of f)s.dispose();for(const s of g)s.dispose()}}}function oe({lut:r,settingsRef:t}){const a=w.useRef(null);return w.useEffect(()=>{const f=a.current;if(!f)return;let g=!1,n=0;const c=document.createElement("canvas");c.setAttribute("aria-label","LUT before and after preview"),c.style.width="100%",c.style.height="100%",c.style.display="block",f.replaceChildren(c);const e=new V({canvas:c,antialias:!0});e.outputColorSpace=W,e.toneMapping=q,e.toneMappingExposure=1,e.shadowMap.enabled=!0;const p=se(),s=new F(e),u=new _(r.texture3D,{tetrahedralInterpolation:!0});s.addPass(new $(p.scene,p.camera)),s.addPass(new B(p.camera,u));const o={width:1,height:1},d=()=>{const l=t.current,S=Math.round(o.width*E(l.split,.05,.95));u.blendMode.opacity.value=E(l.intensity,0,1),u.tetrahedralInterpolation=l.tetrahedral,e.setScissorTest(!1),e.setRenderTarget(null),e.clear(),e.setScissorTest(!0),e.setScissor(0,0,S,o.height),e.render(p.scene,p.camera),e.setScissor(S,0,o.width-S,o.height),s.render(),e.setScissorTest(!1)},m=()=>{const l=f.getBoundingClientRect();o.width=Math.max(1,Math.floor(l.width)),o.height=Math.max(1,Math.floor(l.height)),e.setPixelRatio(Math.min(window.devicePixelRatio||1,2)),e.setSize(o.width,o.height,!1),s.setSize(o.width,o.height),p.camera.aspect=o.width/o.height,p.camera.updateProjectionMatrix()};m(),d();const x=new ResizeObserver(()=>{m(),d()});x.observe(f);const h=()=>{g||(d(),n=requestAnimationFrame(h))};return n=requestAnimationFrame(h),()=>{g=!0,cancelAnimationFrame(n),x.disconnect(),s.dispose(),u.dispose(),p.dispose(),e.dispose(),c.remove()}},[r,t]),i.jsx("div",{ref:a,"data-testid":"lut-preview",style:{width:"100%",height:"100%",minHeight:260,background:"#171a22"}})}function ie({settings:r,onChange:t}){return i.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,padding:4},children:[i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Intensity",i.jsx(C,{value:r.intensity,onChange:a=>t({...r,intensity:E(a,0,1)}),step:.01,precision:2})]}),i.jsxs("label",{style:{display:"flex",flexDirection:"column",gap:5,fontSize:11},children:["Comparison split",i.jsx(C,{value:r.split,onChange:a=>t({...r,split:E(a,.05,.95)}),step:.01,precision:2})]}),i.jsxs("label",{style:{display:"flex",alignItems:"center",gap:7,fontSize:11},children:[i.jsx(P,{checked:r.tetrahedral,onChange:a=>t({...r,tetrahedral:a.target.checked})}),"Tetrahedral interpolation"]}),i.jsx("div",{style:{color:y.content.muted,fontSize:10,lineHeight:1.45},children:"Preview controls are session-only. Bind the LUT and accepted intensity in the owning TSX post-processing composition."})]})}async function ae(r){const t=await I(r);if(t===null)throw new Error(`CUBE LUT not found: ${r}`);return new ne().parse(t)}function be({documentId:r,assetPath:t,active:a=!0}){const[f,g]=w.useState(0),[n,c]=w.useState(null),[e,p]=w.useState(null),[s,u]=w.useState({intensity:1,split:.5,tetrahedral:!0}),o=w.useRef(s);o.current=s,w.useEffect(()=>{if(a)return re(t,()=>g(m=>m+1))},[a,t]),w.useEffect(()=>{if(!a)return;let m=!1,x=null;return c(null),p(null),ae(t).then(h=>{if(x=h,m){h.texture3D.dispose();return}c(h)},h=>{m||p(h instanceof Error?h.message:String(h))}),()=>{m=!0,x?.texture3D.dispose()}},[a,t,f]);const d=w.useMemo(()=>[{id:"lut-profile",title:"Color Grade",icon:A,order:U,body:{kind:"custom",...n?{data:{title:n.title,size:n.size,domainMin:n.domainMin.toArray(),domainMax:n.domainMax.toArray()}}:{},render:()=>i.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto 1fr",gap:"6px 10px"},children:[i.jsx("span",{style:{color:y.content.muted},children:"Title"}),i.jsx("span",{children:n?.title||b(t)}),i.jsx("span",{style:{color:y.content.muted},children:"Cube"}),i.jsx("span",{children:n?`${n.size}³`:"—"}),i.jsx("span",{style:{color:y.content.muted},children:"Domain"}),i.jsx("span",{children:n?`${z(n.domainMin)} → ${z(n.domainMax)}`:"—"})]})}},{id:"lut-preview-settings",title:"Preview",icon:k,order:N,body:{kind:"custom",data:{...s},render:()=>i.jsx(ie,{settings:s,onChange:u})}}],[t,n,s]);return e?i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),status:"CUBE LUT unavailable",children:i.jsx("div",{role:"alert",style:{padding:20,color:y.semantic.danger},children:e})}):n?i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),sections:d,status:`CUBE LUT · ${n.size}³`,fill:!0,children:i.jsxs("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,background:"#171a22"},children:[i.jsx(oe,{lut:n,settingsRef:o}),i.jsx("div",{style:{position:"absolute",left:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:"Original"}),i.jsx("div",{style:{position:"absolute",right:12,top:12,padding:"4px 7px",borderRadius:4,background:"rgba(12,14,20,0.72)",color:"#f2f4f8",fontSize:10,pointerEvents:"none"},children:n.title||"Graded"})]})}):i.jsx(M,{documentId:r,active:a,type:"color grade",title:b(t),status:"Loading CUBE LUT",children:i.jsx("div",{style:{padding:20,color:y.content.muted},children:"Loading color grade…"})})}export{be as LutAssetDocument};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a0 as b,aQ as w,a2 as M,a9 as x,q as F,aR as d,h as u,e as f,aN as O,a as g,aS as y,aT as L}from"./three.module-ZILb6uB7.js";class S extends b{constructor(s){super(s)}load(s,o,p,e){const a=this,n=this.path===""?w.extractUrlBase(s):this.path,r=new M(this.manager);r.setPath(this.path),r.setRequestHeader(this.requestHeader),r.setWithCredentials(this.withCredentials),r.load(s,function(t){try{o(a.parse(t,n))}catch(i){e?e(i):console.error(i),a.manager.itemError(s)}},p,e)}setMaterialOptions(s){return this.materialOptions=s,this}parse(s,o){const p=s.split(`
|
|
2
|
+
`);let e={};const a=/\s+/,n={};for(let t=0;t<p.length;t++){let i=p[t];if(i=i.trim(),i.length===0||i.charAt(0)==="#")continue;const c=i.indexOf(" ");let l=c>=0?i.substring(0,c):i;l=l.toLowerCase();let h=c>=0?i.substring(c+1):"";if(h=h.trim(),l==="newmtl")e={name:h},n[h]=e;else if(l==="ka"||l==="kd"||l==="ks"||l==="ke"){const m=h.split(a,3);e[l]=[parseFloat(m[0]),parseFloat(m[1]),parseFloat(m[2])]}else e[l]=h}const r=new C(this.resourcePath||o,this.materialOptions);return r.setCrossOrigin(this.crossOrigin),r.setManager(this.manager),r.setMaterials(n),r}}class C{constructor(s="",o={}){this.baseUrl=s,this.options=o,this.materialsInfo={},this.materials={},this.materialsArray=[],this.nameLookup={},this.crossOrigin="anonymous",this.side=this.options.side!==void 0?this.options.side:x,this.wrap=this.options.wrap!==void 0?this.options.wrap:F}setCrossOrigin(s){return this.crossOrigin=s,this}setManager(s){this.manager=s}setMaterials(s){this.materialsInfo=this.convert(s),this.materials={},this.materialsArray=[],this.nameLookup={}}convert(s){if(!this.options)return s;const o={};for(const p in s){const e=s[p],a={};o[p]=a;for(const n in e){let r=!0,t=e[n];const i=n.toLowerCase();switch(i){case"kd":case"ka":case"ks":this.options&&this.options.normalizeRGB&&(t=[t[0]/255,t[1]/255,t[2]/255]),this.options&&this.options.ignoreZeroRGBs&&t[0]===0&&t[1]===0&&t[2]===0&&(r=!1);break}r&&(a[i]=t)}}return o}preload(){for(const s in this.materialsInfo)this.create(s)}getIndex(s){return this.nameLookup[s]}getAsArray(){let s=0;for(const o in this.materialsInfo)this.materialsArray[s]=this.create(o),this.nameLookup[o]=s,s++;return this.materialsArray}create(s){return this.materials[s]===void 0&&this.createMaterial_(s),this.materials[s]}createMaterial_(s){const o=this,p=this.materialsInfo[s],e={name:s,side:this.side};function a(r,t){return typeof t!="string"||t===""?"":/^https?:\/\//i.test(t)?t:r+t}function n(r,t){if(e[r])return;const i=o.getTextureParams(t,e),c=o.loadTexture(a(o.baseUrl,i.url));c.repeat.copy(i.scale),c.offset.copy(i.offset),c.wrapS=o.wrap,c.wrapT=o.wrap,(r==="map"||r==="emissiveMap")&&(c.colorSpace=f),e[r]=c}for(const r in p){const t=p[r];let i;if(t!=="")switch(r.toLowerCase()){case"kd":e.color=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ks":e.specular=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"ke":e.emissive=d.colorSpaceToWorking(new u().fromArray(t),f);break;case"map_kd":n("map",t);break;case"map_ks":n("specularMap",t);break;case"map_ke":n("emissiveMap",t);break;case"norm":n("normalMap",t);break;case"map_bump":case"bump":n("bumpMap",t);break;case"disp":n("displacementMap",t);break;case"map_d":n("alphaMap",t),e.transparent=!0;break;case"ns":e.shininess=parseFloat(t);break;case"d":i=parseFloat(t),i<1&&(e.opacity=i,e.transparent=!0);break;case"tr":i=parseFloat(t),this.options&&this.options.invertTrProperty&&(i=1-i),i>0&&(e.opacity=1-i,e.transparent=!0);break}}return this.materials[s]=new O(e),this.materials[s]}getTextureParams(s,o){const p={scale:new g(1,1),offset:new g(0,0)},e=s.split(/\s+/);let a;return a=e.indexOf("-bm"),a>=0&&(o.bumpScale=parseFloat(e[a+1]),e.splice(a,2)),a=e.indexOf("-mm"),a>=0&&(o.displacementBias=parseFloat(e[a+1]),o.displacementScale=parseFloat(e[a+2]),e.splice(a,3)),a=e.indexOf("-s"),a>=0&&(p.scale.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),a=e.indexOf("-o"),a>=0&&(p.offset.set(parseFloat(e[a+1]),parseFloat(e[a+2])),e.splice(a,4)),p.url=e.join(" ").trim(),p}loadTexture(s,o,p,e,a){const n=this.manager!==void 0?this.manager:y;let r=n.getHandler(s);r===null&&(r=new L(n)),r.setCrossOrigin&&r.setCrossOrigin(this.crossOrigin);const t=r.load(s,p,e,a);return o!==void 0&&(t.mapping=o),t}}export{S as MTLLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as u}from"./jsx-runtime-DPjLkJKQ.js";import{r as i}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{x,y as E,z as w,D as S,E as a,t as f}from"./index-cpXNKgvz.js";import"./index-D2LwEE0L.js";import{O as M}from"./StageHost-D-o8MsFS.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./client-DNXj_opT.js";import"./three.module-ZILb6uB7.js";import"./viewport-surface-status-DuININWe.js";import"./live-mixers-BRkRHd6g.js";import"./model-inspection-JC6gbV8Q.js";import"./clip-planes-CnAI6DZn.js";import"./OrbitControls-DrFzvAAB.js";import"./LineSegments2-C8H20K8w.js";import"./viewport-pick-context-DkawXbEi.js";import"./editor-presentation-activity-C7SNSmTd.js";function J({documentId:g,assetPath:o,displayName:d,active:l}){const[b,s]=i.useState(null),[p,c]=i.useState(null);i.useEffect(()=>{if(!l){s(null);return}const n=new AbortController;let m=null;s(null),c(null);const t=x(o);return(t==="glb"||t==="gltf"||t==="spz"?E(o,n.signal):t?w({url:o,format:t}).then(S).then(r=>({root:r,sourceBytes:null})):Promise.reject(new Error(`No native Three.js model loader supports ${o}.`))).then(r=>{if(n.signal.aborted){a(r.root);return}m=r.root,s(r)},r=>{n.signal.aborted||c(r instanceof Error?r.message:String(r))}),()=>{n.abort(),m&&a(m)}},[l,o]);const e=b?.root??null,j=i.useCallback(()=>{if(!e)throw new Error(`Model asset ${o} is not loaded.`);return{root:e,animations:e.animations,dispose(){}}},[o,e]);return p?u.jsx("div",{role:"alert",style:{padding:20,color:f.semantic.danger},children:p}):e?u.jsx(M,{documentId:g,sourcePath:o,displayName:d,build:j,active:l,assetType:"model",modelSource:{kind:"project-file",path:o}}):u.jsxs("div",{style:{padding:20,color:f.content.muted},children:["Loading ",d,"…"]})}export{J as ModelAssetDocument};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/world-documents-DkBqH8VU.js","assets/jsx-runtime-DPjLkJKQ.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/index-D_NuPfjr.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/three.module-ZILb6uB7.js","assets/index-B4bmKkgY.css","assets/Toolbar-DYJjJKTt.js","assets/transform-mode-request-DSPwviXs.js","assets/TransientHint-D94hsJSR.js","assets/react-story-board-B9V-j_Y5.js","assets/viewport-pick-context-DkawXbEi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as z}from"./index-DaQZGF7d.js";import{c9 as I,br as l,ca as D,cb as N,cc as H,cd as W,ce as F,cf as y,j as C,cg as m,ch as $,ci as B,cj as T,v as x,ck as E,cl as q,cm as S,cn as V,co as G,cp as L,cq as J,a$ as K,cr as U,bh as Z}from"./index-cpXNKgvz.js";const h=new WeakMap,Q=new Set;function P(){for(const t of Q)t()}function X(t){const e=(h.get(t)?.generation??0)+1;return h.set(t,{generation:e,settled:!1}),P(),()=>{const r=h.get(t);!r||r.generation!==e||r.settled||(h.set(t,{generation:e,settled:!0}),P())}}const Y={transform:!1,inspectorFields:!1,persist:!1};class ee{capabilities=Y;provenance={source:"boundary",label:"read-only",detail:"Declared world without a live editing surface in this viewport — disclosed, not simulated; rows are read-only."};world;reason;store;pickable;constructor(e,r,s,o){this.store=e,this.world=r,this.reason=s??null,o&&(this.pickable={pick:o})}get label(){return this.world.entryOrScenePath?.split("/").pop()??this.world.id}get node(){return{id:this.world.id,label:this.label,secondaryLabel:this.reason?"Unavailable":"Read-only",role:"boundary",kind:this.world.kind,parentId:null,childIds:[]}}hierarchy={roots:()=>[this.node],node:e=>e===this.world.id?this.node:null};selection={get:()=>[...this.store.selectedEntityIds],set:e=>this.store.selectMultiple(e)};inspector={properties:e=>{if(e!==this.world.id)return[];const r=[{path:"kind",label:"Kind",type:"string",readonly:!0}];return this.world.adapter!==void 0&&r.push({path:"adapter",label:"Adapter",type:"string",readonly:!0}),this.world.entryOrScenePath!==void 0&&r.push({path:"path",label:"Entry / Scene",type:"string",readonly:!0}),r.push({path:"zOrder",label:"Z Order",type:"number",readonly:!0},{path:"pausable",label:"Pausable",type:"boolean",readonly:!0}),this.reason&&r.push({path:"reason",label:"Reason",type:"string",readonly:!0}),r},get:(e,r)=>{if(e===this.world.id)switch(r){case"kind":return this.world.kind;case"adapter":return this.world.adapter;case"path":return this.world.entryOrScenePath;case"zOrder":return this.world.zOrder;case"pausable":return this.world.pausable;case"reason":return this.reason??void 0;default:return}},set:(e,r,s)=>{}}}const te="(invalid manifest)";let j=!1,w=!1,v=!1,c=null;function g(){if(w||v||!j||!c)return;w=!0;const t=c;queueMicrotask(()=>{if(w=!1,c!==t){g();return}j=!1,v=!0,Promise.resolve().then(t).catch(e=>{l.error(`Edit-mode rebuild failed: ${e instanceof Error?e.message:String(e)}`,"authoring")}).finally(()=>{v=!1,g()})})}function re(t){return c=t,g(),()=>{c===t&&(c=null)}}function be(){j=!0,g()}const se=new Set(["three","canvas","dom"]);function d(t){return typeof t=="string"?t:void 0}function ie(t){const e=t.world;if(!e||typeof e!="object")return;const r=d(e.entry);if(r)return{entry:r,export:d(e.export)}}function ne(t){if(t!=null){if(typeof t=="string")return t;if(typeof t=="object"){const e=t;if(typeof e.module=="string")return`module:${e.module}`;const r=e.ingest;if(r&&typeof r=="object")return"ingest"}}}function oe(t){if(!t||typeof t!="object")return null;const e=t.roots;return e===void 0||!Array.isArray(e)?null:{roots:e.map((s,o)=>{const i=s&&typeof s=="object"?s:{},a=i.zOrder,n=i.pausable;return{id:d(i.id)??`(world ${o})`,surface:(typeof i.adapter=="string"?d(i.adapter):void 0)??d(i.adapter&&typeof i.adapter=="object"?i.adapter.surface:void 0)??"(missing adapter surface)",adapter:ne(i.adapter),scene:d(i.scene),entry:d(i.entry),zOrder:typeof a=="number"?a:void 0,pausable:typeof n=="boolean"?n:void 0,dev:i.dev===!0,world:ie(i)}})}}function ae(t){return se.has(t.surface)?!t.scene&&!t.entry?`World "${t.id}" declares neither \`scene\` nor \`entry\` — nothing to mount.`:null:`Unknown world surface "${t.surface}" — expected one of: three, canvas, react.`}function p(t,e){const r=t.roots;if(Array.isArray(r))return r.find(s=>!!s&&typeof s=="object"&&s.id===e)}function k(t,e){return p(t,e)}class de{raw;synthesizedValue;store;fileHistory;unsubscribeHistory;constructor(e,r,s){this.raw=e,this.synthesizedValue=r,this.store=s;const o=s.projectHistory;this.fileHistory=o?C(o,m(),"project-manifest"):null,this.unsubscribeHistory=this.fileHistory?this.fileHistory.subscribeAll(i=>{i==="vgai.project.json"&&m().readBytes(i).then(a=>JSON.parse(new TextDecoder().decode(a))).then(a=>{for(const n of Object.keys(this.raw))delete this.raw[n];Object.assign(this.raw,a),this.store.notifyIngestEdit()}).catch(()=>{})}):null}getGameName(){const e=this.raw.name;return typeof e=="string"?e:""}get synthesized(){return this.synthesizedValue}setGameName(e){this.raw.name=e,this.persist("Rename Game")}getRootContentSource(e){const r=p(this.raw,e);if(!r)return;const s=r.scene;if(typeof s=="string")return`Scene · ${s}`;const o=r.entry;return typeof o=="string"?`Entry · ${o}`:"Adapter-owned runtime content"}getRootZOrder(e){const r=p(this.raw,e)?.zOrder;return typeof r=="number"?r:0}setRootZOrder(e,r){const s=k(this.raw,e);s&&(s.zOrder=r,this.persist("Change World Order"))}getRootPausable(e){const r=p(this.raw,e)?.pausable;return typeof r=="boolean"?r:!0}setRootPausable(e,r){const s=k(this.raw,e);s&&(s.pausable=r,this.persist("Change World Pausing"))}async materialize(){const e=await this.write("Create Game Manifest");return e&&(this.synthesizedValue=!1),e}dispose(){this.unsubscribeHistory?.()}persist(e){this.synthesized||this.write(e)}async write(e){const r=JSON.stringify(this.raw,null,2);try{if(this.fileHistory)return await this.fileHistory.write("vgai.project.json",r,{label:e,kind:"manifest",contentType:"application/json"}),this.store.notifyIngestEdit(),!0;const s=async()=>{const o=await fetch("/__editor/manifest",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:"vgai.project.json",content:r,...$()})});B(o,"Write vgai.project.json failed"),o.ok||await T(o,{label:"Write vgai.project.json",attempted:{"vgai.project.json":r},reapply:s})};return await s(),this.store.notifyIngestEdit(),!0}catch(s){return this.fileHistory&&m().readBytes("vgai.project.json").then(o=>JSON.parse(new TextDecoder().decode(o))).then(o=>{for(const i of Object.keys(this.raw))delete this.raw[i];Object.assign(this.raw,o),this.store.notifyIngestEdit()}).catch(()=>{}),l.error(`Failed to write vgai.project.json: ${s}`,"project"),!1}}}let A=null,u=null;function ce(t,e,r){const s=D(e).map(n=>{const b=n.zOrder??0,R=N(n.surface);if(R)return{worldId:n.id,kind:n.surface,adapter:R(t,n.id),zOrder:b};const M=ae(n),_={id:n.id,kind:n.surface,adapter:n.adapter,entryOrScenePath:n.scene??n.entry,zOrder:b,pausable:n.pausable??!0};return{worldId:n.id,kind:n.surface,adapter:new ee(t,_,M??void 0),zOrder:b}}),o=r&&s.length>=1?new de(r.raw,r.synthesized,t):void 0;A=o??null;const i=H(x()?.config),a=new W(s,o,i);if(s.length>=1){if(E()&&!q())return l.warn("Edit-mode authoring not installed: a foreign session (ingest/play) owns the authoring override.","authoring"),a;F(a),y(a),t.notifyIngestEdit()}else E()||(u=V(t,"No world yet","Declare a root in vgai.project.json"),y(u),t.notifyIngestEdit());return a}function f(t){t&&S()===t&&y(null),u&&S()===u&&y(null),u=null,A?.dispose(),A=null}async function ue(t){const e=X(t);let r,s;try{const o=await I(),i=o!==null&&oe(o);if(i)r=i,s={raw:o,synthesized:!1};else throw new Error("manifest has no `roots` array (zero roots is fine; a missing field is not)")}catch(o){const i=o instanceof Error?o.message:String(o);l.error(`Failed to load vgai.project.json: ${i}`,"project"),r={roots:[{id:"manifest",surface:te,adapter:i}]}}try{return ce(t,r,s)}finally{e()}}class le{constructor(e){this.store=e,this.unbind=re(()=>this.rebuild()),this.ready=this.rebuild()}references=0;disposed=!1;composite;disposeDocuments;stages=new Set;tail=Promise.resolve();unbind;ready;retain(){return this.references++,()=>{--this.references>0||(this.disposed=!0,this.unbind(),this.disposeDocuments?.(),f(this.composite),O.delete(this.store))}}attach(e){const r=this.retain();return this.stages.add(e),{ready:this.composite?e(this.composite):this.tail,dispose:()=>{this.stages.delete(e),r()}}}rebuild(){const e=this.tail.then(async()=>{if(this.disposed)return;const r=Z(),s=new Set(L().map(n=>n.descriptor.id)),o=this.composite?J().map(n=>n.descriptor.id).filter(n=>s.has(n)):[];this.disposeDocuments?.(),this.disposeDocuments=void 0,f(this.composite),this.composite=void 0;const i=await ue(this.store);if(this.disposed){f(i);return}const{installRootDocuments:a}=await K(async()=>{const{installRootDocuments:n}=await import("./world-documents-DkBqH8VU.js");return{installRootDocuments:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]));if(this.disposed){f(i);return}this.composite=i,this.disposeDocuments=a(this.store,i);for(const n of o)U(n,n===r);await Promise.all([...this.stages].map(n=>n(i)))});return this.tail=e.catch(()=>{}),e}}const O=new Map;function he(t){let e=O.get(t);return e||(e=new le(t),O.set(t,e)),e}function fe(t){const e=he(t);return{ready:e.ready.then(()=>G()),dispose:e.retain()}}function pe({store:t}){return z.useEffect(()=>{const e=fe(t);return e.ready.catch(r=>{l.error(`Authoring session failed: ${r instanceof Error?r.message:String(r)}`,"authoring")}),e.dispose},[t]),null}const me=Object.freeze(Object.defineProperty({__proto__:null,ProjectAuthoringBootstrap:pe},Symbol.toStringTag,{value:"Module"}));export{ee as B,te as I,me as N,be as q};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a0 as N,a2 as R,h as k,e as H,aJ as J,ak as A,aK as w,aL as C,aj as U,aM as L,aN as T,aO as D,aP as z,k as O,V}from"./three.module-ZILb6uB7.js";const q=/^[og]\s*(.+)?/,K=/^mtllib /,W=/^usemtl /,Q=/^usemap /,S=/\s+/,B=new V,F=new V,E=new V,G=new V,j=new V,_=new k;function X(){const M={objects:[],object:{},vertices:[],normals:[],colors:[],uvs:[],materials:{},materialLibraries:[],startObject:function(s,e){if(this.object&&this.object.fromDeclaration===!1){this.object.name=s,this.object.fromDeclaration=e!==!1;return}const n=this.object&&typeof this.object.currentMaterial=="function"?this.object.currentMaterial():void 0;if(this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0),this.object={name:s||"",fromDeclaration:e!==!1,geometry:{vertices:[],normals:[],colors:[],uvs:[],hasUVIndices:!1},materials:[],smooth:!0,startMaterial:function(t,i){const a=this._finalize(!1);a&&(a.inherited||a.groupCount<=0)&&this.materials.splice(a.index,1);const d={index:this.materials.length,name:t||"",mtllib:Array.isArray(i)&&i.length>0?i[i.length-1]:"",smooth:a!==void 0?a.smooth:this.smooth,groupStart:a!==void 0?a.groupEnd:0,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(g){const r={index:typeof g=="number"?g:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return r.clone=this.clone.bind(r),r}};return this.materials.push(d),d},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(t){const i=this.currentMaterial();if(i&&i.groupEnd===-1&&(i.groupEnd=this.geometry.vertices.length/3,i.groupCount=i.groupEnd-i.groupStart,i.inherited=!1),t&&this.materials.length>1)for(let a=this.materials.length-1;a>=0;a--)this.materials[a].groupCount<=0&&this.materials.splice(a,1);return t&&this.materials.length===0&&this.materials.push({name:"",smooth:this.smooth}),i}},n&&n.name&&typeof n.clone=="function"){const t=n.clone(0);t.inherited=!0,this.object.materials.push(t)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize=="function"&&this.object._finalize(!0)},parseVertexIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseNormalIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/3)*3},parseUVIndex:function(s,e){const n=parseInt(s,10);return(n>=0?n-1:n+e/2)*2},addVertex:function(s,e,n){const t=this.vertices,i=this.object.geometry.vertices;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addVertexPoint:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addVertexLine:function(s){const e=this.vertices;this.object.geometry.vertices.push(e[s+0],e[s+1],e[s+2])},addNormal:function(s,e,n){const t=this.normals,i=this.object.geometry.normals;i.push(t[s+0],t[s+1],t[s+2]),i.push(t[e+0],t[e+1],t[e+2]),i.push(t[n+0],t[n+1],t[n+2])},addFaceNormal:function(s,e,n){const t=this.vertices,i=this.object.geometry.normals;B.fromArray(t,s),F.fromArray(t,e),E.fromArray(t,n),j.subVectors(E,F),G.subVectors(B,F),j.cross(G),j.normalize(),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z),i.push(j.x,j.y,j.z)},addColor:function(s,e,n){const t=this.colors,i=this.object.geometry.colors;t[s]!==void 0&&i.push(t[s+0],t[s+1],t[s+2]),t[e]!==void 0&&i.push(t[e+0],t[e+1],t[e+2]),t[n]!==void 0&&i.push(t[n+0],t[n+1],t[n+2])},addUV:function(s,e,n){const t=this.uvs,i=this.object.geometry.uvs;i.push(t[s+0],t[s+1]),i.push(t[e+0],t[e+1]),i.push(t[n+0],t[n+1])},addDefaultUV:function(){const s=this.object.geometry.uvs;s.push(0,0),s.push(0,0),s.push(0,0)},addUVLine:function(s){const e=this.uvs;this.object.geometry.uvs.push(e[s+0],e[s+1])},addFace:function(s,e,n,t,i,a,d,g,r){const h=this.vertices.length;let o=this.parseVertexIndex(s,h),l=this.parseVertexIndex(e,h),u=this.parseVertexIndex(n,h);if(this.addVertex(o,l,u),this.addColor(o,l,u),d!==void 0&&d!==""){const m=this.normals.length;o=this.parseNormalIndex(d,m),l=this.parseNormalIndex(g,m),u=this.parseNormalIndex(r,m),this.addNormal(o,l,u)}else this.addFaceNormal(o,l,u);if(t!==void 0&&t!==""){const m=this.uvs.length;o=this.parseUVIndex(t,m),l=this.parseUVIndex(i,m),u=this.parseUVIndex(a,m),this.addUV(o,l,u),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(s){this.object.geometry.type="Points";const e=this.vertices.length;for(let n=0,t=s.length;n<t;n++){const i=this.parseVertexIndex(s[n],e);this.addVertexPoint(i),this.addColor(i)}},addLineGeometry:function(s,e){this.object.geometry.type="Line";const n=this.vertices.length,t=this.uvs.length;for(let i=0,a=s.length;i<a;i++)this.addVertexLine(this.parseVertexIndex(s[i],n));for(let i=0,a=e.length;i<a;i++)this.addUVLine(this.parseUVIndex(e[i],t))}};return M.startObject("",!1),M}class Z extends N{constructor(s){super(s),this.materials=null}load(s,e,n,t){const i=this,a=new R(this.manager);a.setPath(this.path),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(s,function(d){try{e(i.parse(d))}catch(g){t?t(g):console.error(g),i.manager.itemError(s)}},n,t)}setMaterials(s){return this.materials=s,this}parse(s){const e=new X;s.indexOf(`\r
|
|
2
|
+
`)!==-1&&(s=s.replace(/\r\n/g,`
|
|
3
|
+
`)),s.indexOf(`\\
|
|
4
|
+
`)!==-1&&(s=s.replace(/\\\n/g,""));const n=s.split(`
|
|
5
|
+
`);let t=[];for(let d=0,g=n.length;d<g;d++){const r=n[d].trimStart();if(r.length===0)continue;const h=r.charAt(0);if(h!=="#")if(h==="v"){const o=r.split(S);switch(o[0]){case"v":e.vertices.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3])),o.length>=7?(_.setRGB(parseFloat(o[4]),parseFloat(o[5]),parseFloat(o[6]),H),e.colors.push(_.r,_.g,_.b)):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(o[1]),parseFloat(o[2]),parseFloat(o[3]));break;case"vt":e.uvs.push(parseFloat(o[1]),parseFloat(o[2]));break}}else if(h==="f"){const l=r.slice(1).trim().split(S),u=[];for(let c=0,p=l.length;c<p;c++){const b=l[c];if(b.length>0){const v=b.split("/");u.push(v)}}const m=u[0];for(let c=1,p=u.length-1;c<p;c++){const b=u[c],v=u[c+1];e.addFace(m[0],b[0],v[0],m[1],b[1],v[1],m[2],b[2],v[2])}}else if(h==="l"){const o=r.substring(1).trim().split(" ");let l=[];const u=[];if(r.indexOf("/")===-1)l=o;else for(let m=0,c=o.length;m<c;m++){const p=o[m].split("/");p[0]!==""&&l.push(p[0]),p[1]!==""&&u.push(p[1])}e.addLineGeometry(l,u)}else if(h==="p"){const l=r.slice(1).trim().split(" ");e.addPointGeometry(l)}else if((t=q.exec(r))!==null){const o=(" "+t[0].slice(1).trim()).slice(1);e.startObject(o)}else if(W.test(r))e.object.startMaterial(r.substring(7).trim(),e.materialLibraries);else if(K.test(r))e.materialLibraries.push(r.substring(7).trim());else if(Q.test(r))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(h==="s"){if(t=r.split(" "),t.length>1){const l=t[1].trim().toLowerCase();e.object.smooth=l!=="0"&&l!=="off"}else e.object.smooth=!0;const o=e.object.currentMaterial();o&&(o.smooth=e.object.smooth)}else{if(r==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+r+'"')}}e.finalize();const i=new J;if(i.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let d=0,g=e.objects.length;d<g;d++){const r=e.objects[d],h=r.geometry,o=r.materials,l=h.type==="Line",u=h.type==="Points";let m=!1;if(h.vertices.length===0)continue;const c=new A;c.setAttribute("position",new w(h.vertices,3)),h.normals.length>0&&c.setAttribute("normal",new w(h.normals,3)),h.colors.length>0&&(m=!0,c.setAttribute("color",new w(h.colors,3))),h.hasUVIndices===!0&&c.setAttribute("uv",new w(h.uvs,2));const p=[];for(let v=0,I=o.length;v<I;v++){const y=o[v],P=y.name+"_"+y.smooth+"_"+m;let f=e.materials[P];if(this.materials!==null){if(f=this.materials.create(y.name),l&&f&&!(f instanceof C)){const x=new C;U.prototype.copy.call(x,f),x.color.copy(f.color),f=x}else if(u&&f&&!(f instanceof L)){const x=new L({size:10,sizeAttenuation:!1});U.prototype.copy.call(x,f),x.color.copy(f.color),x.map=f.map,f=x}}f===void 0&&(l?f=new C:u?f=new L({size:1,sizeAttenuation:!1}):f=new T,f.name=y.name,f.flatShading=!y.smooth,f.vertexColors=m,e.materials[P]=f),p.push(f)}let b;if(p.length>1){for(let v=0,I=o.length;v<I;v++){const y=o[v];c.addGroup(y.groupStart,y.groupCount,v)}l?b=new D(c,p):u?b=new z(c,p):b=new O(c,p)}else l?b=new D(c,p[0]):u?b=new z(c,p[0]):b=new O(c,p[0]);b.name=r.name,i.add(b)}else if(e.vertices.length>0){const d=new L({size:1,sizeAttenuation:!1}),g=new A;g.setAttribute("position",new w(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(g.setAttribute("color",new w(e.colors,3)),d.vertexColors=!0);const r=new z(g,d);i.add(r)}return i}}export{Z as OBJLoader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./jsx-runtime-DPjLkJKQ.js";import{V as K,W as P,X,Y,Z as D,_ as Z,$ as T,a0 as J,a1 as Q,a2 as I,a3 as O,a4 as ee,a5 as se,a6 as M,a7 as R,a8 as g,a9 as b,aa as n,ab as ae,B as N,ac as ie,ad as te,ae as z,af as d,ag as B,ah as oe,ai as re,aj as ne,ak as W,al as $,am as le,an as ce,ao as A,ap as de,T as F,aq as pe,ar as L,as as ue,at as he,au as me,av as ge,aw as ve,ax as xe,ay as be,az as je}from"./index-cpXNKgvz.js";import{r as t}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{s as we}from"./model-inspection-JC6gbV8Q.js";import{v as fe,V as Se,a as ye,b as Ce,c as Ve}from"./ViewportShadingMenu-B3N6hSdN.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-ZILb6uB7.js";const U=()=>()=>{},v=()=>0,Ee=[{key:"skeletons",label:"Bones"},{key:"weights",label:"Weights"}];function Ae({documentId:i,assetPath:p}){t.useSyncExternalStore(K,P,P);const a=X(i);t.useSyncExternalStore(Y,D,D),t.useSyncExternalStore(a?.subscribe??U,a?.getSnapshot??v,a?.getSnapshot??v),t.useSyncExternalStore(Z,T,T);const l=J(i);t.useSyncExternalStore(l?.subscribe??U,l?.getSnapshot??v,l?.getSnapshot??v);const H=Q(i),[j,w]=t.useState(null),[f,h]=t.useState(null),[S,m]=t.useState(!1),[y,c]=t.useState(!1),C=t.useRef(null),V=t.useRef(null);if(t.useSyncExternalStore(I,O,O),!a)return null;const o=a.presentation(),{lighting:u}=ee(i),_=se(i)?.documentLayer?.all?.lighting?.studioPreset===M.id,x=new Set(we(a.root).filter(s=>s.available).map(s=>s.mode)),G=[...fe,...x.has("uv")?[{mode:"uv",label:"UV",description:"UV coordinates as surface color"}]:[],...x.has("vertex-colors")?[{mode:"vertex-colors",label:"Vertex colors",description:"Authored color attributes without textures"}]:[]],E=async s=>{if(p){h(null);try{await je().saveThumbnailFraming(p,s?void 0:a.cameraPose())}catch(r){h(r instanceof Error?r.message:String(r))}}},q=async()=>{h(null);try{const s={background:o.background},r=p?.toLowerCase().endsWith(".spz")?await xe(p,s):be(a.root,s);w(`data:image/png;base64,${r.contactSheet.base64}`)}catch(s){h(s instanceof Error?s.message:String(s))}},k=a.selection().length>0?"Frame selection":"Frame all";return e.jsxs("div",{className:"vgai-model-document-header",children:[e.jsxs(R,{compact:!0,label:"Viewport view controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--view",children:[e.jsx(g,{text:k,children:e.jsx(b,{"aria-label":k,onClick:()=>a.frame(),children:e.jsx(n,{icon:ae,size:"md"})})}),e.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[e.jsx(g,{text:"Camera orientation and projection",children:e.jsxs(N,{ref:C,type:"button",size:"compact",variant:"secondary","aria-label":`Camera view: ${o.projection}`,"aria-haspopup":"menu","aria-expanded":S,onClick:()=>m(s=>!s),className:"vgai-model-toolbar-labelled-control",children:[e.jsx(n,{icon:ie,size:"sm"}),e.jsx("span",{children:o.projection==="perspective"?"Perspective":"Orthographic"}),e.jsx(n,{icon:te,size:"xs"})]})}),S&&e.jsxs(z,{anchorRef:C,align:"start",clamp:!0,"aria-label":"Camera view",onDismiss:()=>m(!1),style:{minWidth:210},children:[["front","right","top","isometric"].map(s=>e.jsx(d,{onSelect:()=>{a.setViewPreset(s),m(!1)},children:s==="isometric"?"Perspective 3/4":`${s[0]?.toUpperCase()}${s.slice(1)} view`},s)),e.jsx(B,{}),["perspective","orthographic"].map(s=>e.jsxs(d,{role:"menuitemradio","aria-checked":o.projection===s,onSelect:()=>{a.setProjection(s),m(!1)},children:[e.jsx("span",{className:"vgai-menu-check",children:o.projection===s&&e.jsx(n,{icon:oe,size:"xs"})}),s==="perspective"?"Perspective":"Orthographic"]},s))]})]}),x.has("skeleton")?e.jsx(g,{text:`Rig: ${o.skeleton?"Visible":"Hidden"}`,children:e.jsx(b,{"aria-label":"Toggle rig overlay","aria-pressed":o.skeleton,onClick:()=>a.setSkeleton(!o.skeleton),children:e.jsx(n,{icon:re,size:"md"})})}):null,ne("object3d-document").map(({id:s,Component:r})=>e.jsx(r,{documentId:i},s))]}),e.jsxs(R,{compact:!0,label:"Viewport preview controls",className:"vgai-model-viewport-toolbar vgai-model-viewport-toolbar--preview",children:[e.jsxs(Se,{mode:o.mode,onChange:s=>a.setMode(s),choices:G,segments:ye,children:[W().length>0?e.jsxs("label",{children:[e.jsx("span",{children:"View"}),e.jsxs($,{"aria-label":"View preset",value:"",onChange:s=>{s.target.value&&le(i,s.target.value)},children:[e.jsx("option",{value:"",children:"Choose…"}),W().map(s=>e.jsx("option",{value:s.id,children:s.title},s.id))]})]}):null,e.jsxs("label",{children:[e.jsx("span",{children:"Lighting"}),e.jsxs($,{"aria-label":"Lighting",value:u.source==="studio"?`studio:${u.studioPreset}`:u.source,onChange:s=>{const r=s.target.value;A(i,r.startsWith("studio:")?{all:{lighting:{source:"studio",studioPreset:r.slice(7)}}}:{all:{lighting:{source:r}}})},children:[ce().filter(s=>s.id!==M.id||_).map(s=>e.jsx("option",{value:`studio:${s.id}`,children:s.title},s.id)),e.jsx("option",{value:"scene",children:"Scene lights"})]})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Exposure"}),e.jsx(de,{"aria-label":"Preview exposure",type:"range",min:"0.2",max:"2",step:"0.1",value:u.tone.exposure,onChange:s=>A(i,{all:{lighting:{tone:{exposure:Number(s.target.value)}}}})}),e.jsx(F,{as:"span",variant:"caption",children:u.tone.exposure.toFixed(1)})]})]}),e.jsx(Ce,{glyph:e.jsx(Ve,{}),choices:[{id:"grid",label:"Grid",enabled:L(i),onToggle:()=>pe(i,!L(i))},{id:"bounds",label:"Bounds",enabled:o.bounds,onToggle:()=>a.setBounds(!o.bounds)},...l===null?[]:Ee.filter(s=>H.includes(s.key)).map(s=>({id:s.key,label:s.label,enabled:l.helperVisibility[s.key],onToggle:()=>l.toggleHelperType(s.key)}))]}),e.jsxs("div",{className:"vgai-viewport-popover-anchor",children:[e.jsx(g,{text:"Asset preview actions",children:e.jsx(b,{ref:V,"aria-label":"Asset preview actions","aria-haspopup":"menu","aria-expanded":y,onClick:()=>c(s=>!s),children:e.jsx(n,{icon:ue,size:"md"})})}),y&&e.jsxs(z,{anchorRef:V,clamp:!0,"aria-label":"Asset preview actions",onDismiss:()=>c(!1),style:{minWidth:210},children:[e.jsxs(d,{onSelect:()=>{c(!1),q()},children:[e.jsx(n,{icon:he,size:"sm"}),"Capture preview"]}),p?e.jsxs(e.Fragment,{children:[e.jsx(d,{onSelect:()=>{c(!1),E(!1)},children:"Save thumbnail framing"}),e.jsx(d,{onSelect:()=>{c(!1),E(!0)},children:"Reset thumbnail framing"})]}):null,e.jsx(B,{}),e.jsxs(d,{onSelect:()=>{a.resetPresentation(),c(!1)},children:[e.jsx(n,{icon:me,size:"sm"}),"Reset viewport settings"]})]})]})]}),j?e.jsxs(ge,{className:"vgai-model-capture-preview",children:[e.jsxs("div",{children:[e.jsx(F,{as:"strong",variant:"label",children:"Deterministic views"}),e.jsx(N,{type:"button",variant:"ghost",onClick:()=>w(null),children:"Close"})]}),e.jsx("img",{src:j,alt:"Front, right, top, and three-quarter model preview"})]}):null,f?e.jsx(ve,{className:"vgai-model-toolbar-error",tone:"error",children:f}):null]})}export{Ae as Object3DDocumentToolbar};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/spark.module-gG1EsWx8.js","assets/three.module-ZILb6uB7.js","assets/index-cpXNKgvz.js","assets/index-DaQZGF7d.js","assets/_commonjsHelpers-D6-XlEtG.js","assets/index-D_NuPfjr.js","assets/jsx-runtime-DPjLkJKQ.js","assets/index-CtzuWnCS.js","assets/index-CinJrH5C.js","assets/index-D2LwEE0L.js","assets/client-DNXj_opT.js","assets/index-B4bmKkgY.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{aX as te,t as A,aY as re,x as ne,aZ as ie,z as oe,D as ae,E as Y,a_ as se,a$ as le,b0 as ce,b1 as de,b2 as pe}from"./index-cpXNKgvz.js";import{a as E}from"./jsx-runtime-DPjLkJKQ.js";import{r as C}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import"./index-D2LwEE0L.js";import{W as me,f as ue,g as fe,e as we,A as be,a_ as ge,a$ as he,b0 as ve,ao as xe,b1 as ye,V as Ae,b2 as Ee}from"./three.module-ZILb6uB7.js";import{O as Ce}from"./OrbitControls-DrFzvAAB.js";import{s as Me,i as F}from"./editor-presentation-activity-C7SNSmTd.js";import"./client-DNXj_opT.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";const v={webglContext:0,animationFrame:0,resizeObserver:0,objectUrl:0},Z={...v};function _(r){v[r]++,Z[r]=Math.max(Z[r],v[r]);let a=!1;return()=>{a||(a=!0,v[r]=Math.max(0,v[r]-1))}}function Se(r){const a=r.animations[0];if(!a)return null;const m=new Ee(r),b=m.clipAction(a).play();return b.paused=!0,m.update(0),m}let je=0;function qe({assetPath:r,materialPath:a,displayName:m="Object3D preview",active:b=!0,sourceFactory:M,showSkeleton:D=!1,background:z,cameraDirection:S,showGrid:H=!0,useDefaultLighting:L=!0,exposure:T=1,setupPreview:k}){const W=C.useRef(null),[j,$]=C.useState(null),[q,R]=C.useState(!0);return C.useEffect(()=>{if(!b)return;const o=W.current;if(!o)return;const x=new AbortController,J=te({id:`preview-card:${++je}`,label:`${m} (preview card)`,contentClock:()=>0}),t=new me({antialias:!0,alpha:!0}),K=_("webglContext"),N=_("animationFrame"),Q=_("resizeObserver"),s=new ue,u=new fe(35,1,.01,1e3),f=new Ce(u,t.domElement),V=new xe;let I=null,w=null,y=null,c,l=null,g=null;const O=[];let d=0,p=!1;if($(null),R(!0),t.outputColorSpace=we,t.toneMapping=be,t.toneMappingExposure=T,t.shadowMap.enabled=!0,t.setClearColor(z??2106410,1),t.setPixelRatio(Math.min(window.devicePixelRatio,2)),t.domElement.style.width="100%",t.domElement.style.height="100%",t.domElement.style.display="block",o.appendChild(t.domElement),f.enableDamping=!0,f.dampingFactor=.1,L){s.add(new ge(16777215,3489874,1.8));const e=new he(16777215,2.2);e.position.set(3,5,4),s.add(e)}if(H){const e=new ve(10,20,5333103,3423044);s.add(e),O.push(e)}const U=(e,n)=>{if(!g)return;const i=S?new Ae(...S):void 0,h=de(g,Math.max(e,1)/Math.max(n,1),i);u.copy(h,!1),f.target.copy(g.center),f.update()},G=async e=>{if(p)return;s.add(e);let n=!1;if(e.traverse(i=>{se(i,"gaussianSplat")&&(n=!0)}),n){const{SparkRenderer:i}=await le(async()=>{const{SparkRenderer:h}=await import("./spark.module-gG1EsWx8.js");return{SparkRenderer:h}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]));if(p)return;l=new i({renderer:t,enableLod:!1})}if(g=ce(e,"perspective"),U(o.clientWidth,o.clientHeight),I=Se(e),D){const i=new ye(e);i.name="__compact_preview_skeleton",s.add(i),O.push(i)}c=k?.({scene:s,camera:u,renderer:t,model:e}),c?.resize?.(Math.max(o.clientWidth,1),Math.max(o.clientHeight,1),t.getPixelRatio()),R(!1)};(async()=>{try{if(M){y=re(M),await G(y.root);return}if(!r)throw new Error("Compact Object3D preview has no source.");const e=ne(r);if(!e)throw new Error(`No native Three.js loader supports ${r}.`);const n=e==="glb"||e==="gltf"||e==="spz"?await ie(r,x.signal):await oe({url:r,format:e,...a?{materialUrl:a}:{}});if(w=ae(n),x.signal.aborted||p){Y(w),w=null;return}await G(w)}catch(e){!x.signal.aborted&&!p&&($(e instanceof Error?e.message:String(e)),R(!1))}})();const B=()=>{const e=Math.max(o.clientWidth,1),n=Math.max(o.clientHeight,1);t.setSize(e,n,!1),g&&!c?U(e,n):(u.aspect=e/n,u.updateProjectionMatrix()),c?.resize?.(e,n,t.getPixelRatio())},X=new ResizeObserver(B);X.observe(o),B();const P=()=>{if(d=0,p||!F())return;const e=Math.min(V.getDelta(),.1);f.update(),l&&s.add(l);try{c?.render?c.render(e):t.render(s,u)}finally{l?.removeFromParent()}d=requestAnimationFrame(P)},ee=Me(()=>{F()?!p&&d===0&&(V.getDelta(),P()):(cancelAnimationFrame(d),d=0)});return F()&&(d=requestAnimationFrame(P)),()=>{p=!0,ee(),J(),x.abort(new Error("Compact Object3D preview closed.")),cancelAnimationFrame(d),X.disconnect(),I?.stopAllAction(),c?.dispose(),f.dispose(),l&&(l.removeFromParent(),pe(l),l=null),t.dispose(),t.forceContextLoss();for(const e of O){const n=e;n.geometry?.dispose();const i=n.material;if(Array.isArray(i))for(const h of i)h.dispose();else i?.dispose()}y&&y.dispose(),w&&Y(w),o.contains(t.domElement)&&o.removeChild(t.domElement),Q(),N(),K()}},[b,r,z,S,T,a,k,H,D,M,L]),E.jsxs("div",{ref:W,"data-testid":"object3d-compact-preview",role:"region","aria-label":`Interactive 3D preview: ${m}`,"aria-busy":q,style:{width:"100%",height:"100%",minHeight:220,overflow:"hidden",position:"relative",background:A.surface.inset},children:[q&&!j?E.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Loading…"}):null,b?null:E.jsx("span",{style:{position:"absolute",padding:10,color:A.content.muted},children:"Preview suspended while inactive."}),j?E.jsx("div",{role:"alert",style:{position:"absolute",padding:10,color:A.semantic.danger},children:j}):null]})}export{qe as Object3DPreview};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as t}from"./jsx-runtime-DPjLkJKQ.js";import{b3 as L,b4 as U,b5 as R,b6 as W,aC as M,t as i,aa as b,b7 as w,n as N,S as k,al as J,B as V,ah as _,b8 as G}from"./index-cpXNKgvz.js";import{r}from"./index-DaQZGF7d.js";import"./index-CtzuWnCS.js";import{d as K}from"./asset-editor-persistence-DGD05u26.js";import"./_commonjsHelpers-D6-XlEtG.js";import"./index-D2LwEE0L.js";import"./client-DNXj_opT.js";import"./index-D_NuPfjr.js";import"./index-CinJrH5C.js";import"./three.module-ZILb6uB7.js";const S=new Map,q=new Set;function I(){for(const e of q)e()}function Q(e,l){const n=S.get(e);if(n?.status==="running")return n;const f={id:e,label:l,stage:"fetch",loaded:0,total:0,status:"running",controller:new AbortController};return S.set(e,f),I(),f}function y(e,l){const n=S.get(e);n&&(Object.assign(n,l),I())}const X={width:"100%"};function Y(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function de({online:e,mode:l="full",showPreview:n=!1,onResolved:f}){const[h,z]=r.useState([]),[o,B]=r.useState(null),[$,v]=r.useState(!0),[A,D]=r.useState(null),[m,F]=r.useState(null),[O,p]=r.useState(!1),[T,x]=r.useState(!1),[j,E]=r.useState(!1),[c,g]=r.useState("idle");r.useEffect(()=>{if(l==="preview"){v(!1);return}let s=!1;return v(!0),D(null),L(e.source,e.id).then(a=>{s||(z(a),a.length>0&&B(a[0]))}).catch(a=>{s||(z([]),D(a instanceof U?R(a.code):a instanceof Error?a.message:"Asset delivery metadata is unavailable while offline."))}).finally(()=>{s||v(!1)}),()=>{s=!0}},[l,e.source,e.id]);const C=e.source==="local"&&(e.type==="model"||e.type==="animation"||e.type==="source");r.useEffect(()=>{if(l==="inspector"&&!n){p(!1);return}let s=!1;if(F(null),x(!1),E(!1),!C){p(!1);return}return p(!0),W(e.source,e.id).then(a=>{s||(F(a),x(!a))}).catch(()=>{s||x(!0)}).finally(()=>{s||p(!1)}),()=>{s=!0}},[l,e.id,e.source,n,C]);const H=r.useCallback(async()=>{if(!o)return;const s=`single:${e.source}:${e.id}`,a=Q(s,e.name);y(s,{stage:"fetch",loaded:0,total:o.sizeBytes??0,status:"running"}),g("downloading");try{const d={source:e.source,id:e.id,name:e.name,url:o.url,format:o.format,jobId:s,signal:a.controller.signal};o.includes&&(d.includes=o.includes);const u=await K(d);u.ok&&u.path?(y(s,{stage:"commit",loaded:o.sizeBytes??1,total:o.sizeBytes??1,status:u.alreadyExists?"skipped":"imported",message:u.path}),g("done"),M(`${e.name} added to Content — drag it from there into the viewport to place it.`),f?.(`/${u.path}`)):(y(s,{status:"failed",message:u.error??"The import was rejected."}),g("error"))}catch(d){y(s,{status:a.controller.signal.aborted?"cancelled":"failed",message:d instanceof Error?d.message:String(d)}),g("error")}},[e,o,f]),P=t.jsx("img",{src:j?"/__editor/asset-library/local-placeholder.svg":e.thumbnailUrl,alt:j?`${e.name} preview unavailable`:e.name,onError:()=>E(!0),style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"}});return t.jsxs("div",{style:{padding:8,display:"flex",flexDirection:"column",gap:8},children:[l!=="preview"&&t.jsx("div",{style:{fontWeight:600,fontSize:12,color:i.content.primary,wordBreak:"break-all"},children:e.name}),(l!=="inspector"||n)&&t.jsxs(t.Fragment,{children:[t.jsx("div",{style:{width:"100%",height:"100%",minHeight:l==="inspector"?160:240,background:i.surface.shell,borderRadius:i.shape.small,overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center"},children:O?t.jsxs("div",{style:{color:i.content.muted,fontSize:11},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:5}}),"Loading Asset Editor preview…"]}):m?t.jsx(r.Suspense,{fallback:t.jsx("span",{style:{color:i.content.muted},children:"Loading preview…"}),children:t.jsx(N,{route:"model-preview",documentId:"",assetPath:m.path,...m.materialPath?{materialPath:m.materialPath}:{},displayName:e.name,active:!0,whenUnregistered:P})}):P}),j&&t.jsx("div",{role:"status",style:{color:i.content.dim,fontSize:10},children:"The catalog preview could not be loaded; showing the typed fallback."}),T&&t.jsx("div",{style:{color:i.content.dim,fontSize:10},children:"Interactive preview is unavailable for this variant; showing its catalog thumbnail."})]}),l!=="preview"&&t.jsxs(t.Fragment,{children:[t.jsx(k,{label:"Info",children:t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:4},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.content.dim,marginBottom:2},children:"Source"}),t.jsx("div",{style:{fontSize:11,color:i.content.primary},children:e.source==="polyhaven"?"Poly Haven":e.source==="ambientcg"?"ambientCG":"Full Catalog"})]}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.content.dim,marginBottom:2},children:"Type"}),t.jsx("div",{style:{fontSize:11,color:i.content.primary},children:e.type})]}),e.tags.length>0&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.content.dim,marginBottom:2},children:"Tags"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:3},children:e.tags.slice(0,12).map(s=>t.jsx("span",{style:{fontSize:10,padding:"1px 5px",background:i.surface.raised,borderRadius:i.shape.small,color:i.content.muted},children:s},s))})]}),e.author&&t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,color:i.content.dim,marginBottom:2},children:"Author"}),t.jsx("div",{style:{fontSize:11,color:i.content.primary},children:e.author})]})]})}),t.jsx(k,{label:"Add to Project",children:t.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6},children:$?t.jsxs("div",{style:{fontSize:11,color:i.content.dim},children:[t.jsx(b,{icon:w,spin:!0,style:{marginRight:4}}),"Loading options..."]}):A?t.jsxs("div",{role:"alert",style:{fontSize:11,color:i.content.muted},children:["Delivery unavailable: ",A]}):h.length>0?t.jsxs(t.Fragment,{children:[t.jsx(J,{"aria-label":"Asset delivery",value:o?h.indexOf(o):0,onChange:s=>B(h[Number(s.target.value)]??null),style:X,children:h.map((s,a)=>t.jsxs("option",{value:a,children:[s.label,s.sizeBytes?` (${Y(s.sizeBytes)})`:""]},a))}),t.jsxs(V,{type:"button",variant:c==="done"?"success":"primary",size:"comfortable",onClick:H,disabled:c==="downloading",style:{width:"100%"},children:[t.jsx(b,{icon:c==="done"?_:c==="downloading"?w:G,spin:c==="downloading",style:{fontSize:10}}),c==="done"?"Downloaded":c==="downloading"?"Downloading...":c==="error"?"Retry":"Add to Project"]})]}):t.jsx("div",{role:"status",style:{fontSize:11,color:i.content.dim},children:e.source==="local"?"No healthy SSD or cloud delivery is available for this asset.":"This provider has no compatible remote delivery for the selected asset."})})}),t.jsxs("div",{style:{fontSize:10,color:i.content.dim,padding:"4px 0"},children:["License: ",e.license??"CC0 (Public Domain)"]})]})]})}export{de as OnlineAssetDetail};
|