@liveroom-tech/react-immersive 5.2.0 → 5.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +10 -6
- package/README.md +106 -3856
- package/dist/binding-builder.css +1 -1
- package/dist/binding-builder.js +64 -17
- package/dist/binding-builder.mjs +1 -1
- package/dist/chunk-4FDMYUGT.mjs +3 -0
- package/dist/chunk-CV4E7DOO.mjs +79 -0
- package/dist/chunk-F4WT3HEK.mjs +1 -0
- package/dist/chunk-FPJZDEON.mjs +1 -0
- package/dist/chunk-JHKMRMJH.mjs +1 -0
- package/dist/chunk-TW2M4UXT.mjs +1 -0
- package/dist/chunk-W24UP6NM.mjs +1 -0
- package/dist/hosted.css +1 -1
- package/dist/hosted.d.mts +8 -6
- package/dist/hosted.d.ts +8 -6
- package/dist/hosted.js +63 -16
- package/dist/hosted.mjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.mts +18 -10
- package/dist/index.d.ts +18 -10
- package/dist/index.js +62 -15
- package/dist/index.mjs +1 -1
- package/dist/{materialVariants-DnZe9eMC.d.mts → materialVariants-DjTuiWmN.d.mts} +6 -1
- package/dist/{materialVariants-DnZe9eMC.d.ts → materialVariants-DjTuiWmN.d.ts} +6 -1
- package/dist/{modelInfo-XfUQO7C_.d.ts → modelInfo-BQ5UZu95.d.ts} +1 -1
- package/dist/{modelInfo-BYebMPdZ.d.mts → modelInfo-CcYpydB7.d.mts} +1 -1
- package/dist/{modelViewerProps-CIZ2R_Fv.d.ts → modelViewerProps-BalkRDni.d.ts} +54 -5
- package/dist/{modelViewerProps-DoRiTZMn.d.mts → modelViewerProps-DdsJDRB7.d.mts} +54 -5
- package/dist/{rendererBackend-QwMzISTn.d.mts → rendererBackend-C_Jb4_Jy.d.mts} +15 -1
- package/dist/{rendererBackend-QwMzISTn.d.ts → rendererBackend-C_Jb4_Jy.d.ts} +15 -1
- package/dist/simple-model-viewer.d.mts +4 -4
- package/dist/simple-model-viewer.d.ts +4 -4
- package/dist/simple-model-viewer.js +3 -3
- package/dist/simple-model-viewer.mjs +1 -1
- package/dist/utils.d.mts +3 -3
- package/dist/utils.d.ts +3 -3
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +2 -1
- package/dist/chunk-4NLJSD3S.mjs +0 -1
- package/dist/chunk-B7REIGDG.mjs +0 -1
- package/dist/chunk-HYFJ5DYJ.mjs +0 -1
- package/dist/chunk-QC3NT76G.mjs +0 -3
- package/dist/chunk-SEESCGUS.mjs +0 -1
- package/dist/chunk-T3M3BQ7H.mjs +0 -32
- package/dist/chunk-ZPK67UG7.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{b as qe,d as Ye}from"./chunk-SEESCGUS.mjs";import{a as Qe}from"./chunk-MMO7KCYU.mjs";import{a as ce,b as je,c as Se,d as Be,e as It}from"./chunk-HYFJ5DYJ.mjs";import{A as et,B as ve,b as $e,c as jt,n as ye,x as Xe,y as Ze,z as Oe}from"./chunk-T3M3BQ7H.mjs";import{a as ze,b as Ge,u as We}from"./chunk-ZPK67UG7.mjs";import{A as At,C as Et,D as Tt,E as Lt,F as Je,I as kt,J as Dt,a as St,c as Bt,g as W,p as vt,q as pe,t as Ke,u as ne,v as Ce,x as Rt,y as xt,z as Pt}from"./chunk-B7REIGDG.mjs";import{a as Ot,w as Mt}from"./chunk-4NLJSD3S.mjs";import"./chunk-JR557W27.mjs";import{jsx as Ht}from"react/jsx-runtime";function le(e){return Qe("model-viewer","ModelViewer"),Ht(Xe,{...Ye(e,qe)})}import{useCallback as Ut,useEffect as tt,useMemo as nt,useRef as _t,useState as it}from"react";import{jsx as K,jsxs as rt}from"react/jsx-runtime";function ot(e){return K(ze,{labels:e.labels,children:K(Ft,{...e})})}function Ft({before:e,after:t,layout:n="slider",split:s,onSplitChange:l,reveal:h="auto",...d}){let M=Ge(),[C,p]=it(h==="auto");tt(()=>{h==="auto"&&p(!0)},[h]);let[O,m]=it(.5),A=Oe(s??O),x=Ut(I=>{let E=Oe(I);s===void 0&&m(E),l?.(E)},[s,l]),v=nt(()=>Ze(),[]);tt(()=>()=>v.detach(),[v]);let T=[e,t],_=nt(()=>[0,1].map(I=>E=>{v.attach(I,E.raw.controls,E.invalidate)}),[v]),u=T.map((I,E)=>{let{label:H,...b}=I,F={preset:"minimal",...d,...b},w=b.onViewerReady??d.onViewerReady;return{...F,onViewerReady:o=>{_[E](o),w?.(o)}}}),V=[e.label??M("compareBefore"),t.label??M("compareAfter")];(!u[0].modelUrl||!u[1].modelUrl)&&console.error("[react-immersive] CompareViewer needs a modelUrl, shared or on each side.");let R=_t(null);if(!C)return K(We,{className:"ri-compare",background:$e(d.backgroundColor,d.sceneConfig),poster:d.poster??t.poster??e.poster,onReveal:()=>p(!0)});if(n==="side-by-side")return K("div",{className:"ri-compare ri-compare--sideBySide",children:u.map((I,E)=>rt("div",{className:"ri-compare__pane",children:[K(le,{...I}),K("span",{className:"ri-compare__label",children:V[E]})]},E))});let y=`${A*100}%`;return rt("div",{ref:R,className:"ri-compare ri-compare--slider",style:{"--ri-compare-split":y},children:[K("div",{className:"ri-compare__layer",children:K(le,{...u[0]})}),K("div",{className:"ri-compare__layer ri-compare__layer--after",children:K(le,{...u[1]})}),K(et,{split:A,onSplitChange:x,labels:[V[0],V[1]],containerRef:R})]})}import{useCallback as Ve,useRef as mt}from"react";import{useCallback as k,useMemo as st,useState as Nt}from"react";var at={baseColor:"texture",metalness:"metalnessMap",roughness:"roughnessMap",emissive:"emissiveMap",alpha:"alphaMap",normal:"normalMap",bump:"bumpMap",ao:"aoMap",displacement:"displacementMap",clearcoat:"clearcoatMap",clearcoatRoughness:"clearcoatRoughnessMap",clearcoatNormal:"clearcoatNormalMap",anisotropy:"anisotropyMap",transmission:"transmissionMap",thickness:"thicknessMap",sheenColor:"sheenColorMap",sheenRoughness:"sheenRoughnessMap",specularIntensity:"specularIntensityMap",specularColor:"specularColorMap"};function ct(e){if(e)return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n&&typeof n=="object"?{...n}:n]))}function zt(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t.visible===!1).map(([t])=>[t,!0]))}function Me(e){let[t,n]=Nt(e),s=k((o,a)=>{n(g=>a===void 0?ce(g,o):ce(g,o,a))},[]),l=k((o,a)=>s(o,je(a)),[s]),h=k((o,a)=>l(o,{baseColor:a}),[l]),d=k((o,a,g="baseColor")=>{let j=at[g],S=typeof a=="string"?{path:a}:a;s(o,{style:{material:{[j]:S}}})},[s]),M=k((o,a="baseColor")=>{let g=at[a];s(o,{style:{material:{[g]:void 0}}})},[s]),C=k((o,a)=>{n(g=>{let j=W(g,o);if(!j)return g;let S=ct(g[j]?.style?.material),N=ne(g,a);if(N.length===0)return g;let q=g;for(let i of N){let r=g[i];r&&(q===g&&(q={...g}),q[i]={...r,style:{...r.style,material:ct(S)}})}return q})},[]),p=k(o=>s(o,{style:{material:void 0}}),[s]),O=k((o,a)=>s(o,{transform:a}),[s]),m=k(o=>s(o,{transform:void 0}),[s]),A=k((o,a)=>s(o,{metadata:a}),[s]),x=k((o,a)=>{n(g=>{let j=g;for(let S of ne(g,o)){let N=g[S],q=a(N.decals??[]);j===g&&(j={...g}),j[S]={...N,decals:q.length>0?q:void 0}}return j})},[]),v=k((o,a)=>{let g=a.id??`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return x(o,j=>[...j.filter(S=>S.id!==g),{...a,id:g}]),g},[x]),T=k((o,a,g)=>x(o,j=>j.map(S=>S.id===a?{...S,...g}:S)),[x]),_=k((o,a)=>x(o,g=>g.filter(j=>j.id!==a)),[x]),u=k(o=>Ce(t,o),[t]),V=k(o=>ne(t,o).map(a=>t[a]?.id??a),[t]),R=k(o=>{let a=W(t,o);return a?t[a]?.style?.material??null:null},[t]),y=k(o=>s(o,{visible:!1}),[s]),I=k(o=>s(o,{visible:!0}),[s]),E=k(o=>{n(a=>{let g=ne(a,o).reduce((j,S)=>{let N=a[S];return N&&j.push({ids:S,patch:{visible:N.visible===!1}}),j},[]);return ce(a,g)})},[n]),H=k(()=>{n(o=>ce(o,Object.keys(o),{visible:!0}))},[n]),b=st(()=>zt(t),[t]),F=st(()=>Object.keys(b).map(o=>t[o]?.id??o),[b,t]),w=k(o=>{let a=W(t,o);return a?t[a]?.visible===!1:!1},[t]);return{objectBindings:t,setObjectBindings:n,updateObjectBindings:s,setMaterial:l,setBaseColor:h,setTexture:d,clearTexture:M,copyMaterial:C,resetMaterial:p,getMaterial:R,setTransform:O,resetTransform:m,updateMetadata:A,addDecal:v,updateDecal:T,removeDecal:_,selectObjectBindings:u,selectObjectBindingIds:V,hiddenObjects:b,hiddenObjectIds:F,hideObject:y,showObject:I,toggleObjectVisibility:E,isObjectHidden:w,clearHiddenObjects:H}}import{useCallback as $,useMemo as Gt,useRef as Wt,useState as $t}from"react";function Re(e){let t=Wt(null),[n,s]=$t(()=>{let u=typeof e=="function"?e():e;return t.current=u,u}),l=$(u=>{s(V=>{let R=typeof u=="function"?u(V):u;return Se(V,R)})},[]),h=$(()=>{let u=t.current;u&&s(u)},[]),d=$((u,V)=>{l(R=>({lighting:{lights:R.lighting.lights.map(y=>y.id===u?{...y,...V}:y)}}))},[l]),M=$(u=>{l(V=>V.lighting.lights.some(R=>R.id===u.id)?{}:{lighting:{lights:[...V.lighting.lights,Be(u)]}})},[l]),C=$(u=>{l(V=>({lighting:{lights:V.lighting.lights.filter(R=>R.id!==u)}}))},[l]),p=$((u,V)=>d(u,{intensity:V}),[d]),O=$((u,V)=>d(u,{color:V}),[d]),m=$(u=>d(u,{visible:!0}),[d]),A=$(u=>d(u,{visible:!1}),[d]),x=$(u=>{l(V=>({lighting:{lights:V.lighting.lights.map(R=>R.id===u?{...R,visible:!R.visible}:R)}}))},[l]),v=$((u,V)=>d(u,{attachment:V,attachedToCamera:!1}),[d]),T=$(u=>d(u,{attachment:void 0}),[d]),_=Gt(()=>({items:n.lighting.lights,get:u=>n.lighting.lights.find(V=>V.id===u),add:M,update:d,remove:C,setIntensity:p,setColor:O,show:m,hide:A,toggle:x,attach:v,detach:T}),[n.lighting.lights,M,d,C,p,O,m,A,x,v,T]);return{sceneConfig:n,setSceneConfig:s,updateSceneConfig:l,resetSceneConfig:h,lights:_}}import{useCallback as xe}from"react";function Pe({bindings:e,scene:t,camera:n,animations:s,isolation:l,onAction:h}){let{objectBindings:d,updateObjectBindings:M,showObject:C,hideObject:p,toggleObjectVisibility:O}=e,m=t?.updateSceneConfig,A=n?.focusObject,x=n?.fitScene,v=n?.resetView,T=n?.setCameraTarget,_=n?.setCameraState,u=s?.play,V=s?.pause,R=s?.stop,y=s?.setSpeed,I=s?.seek,E=l?.handleIsolationChange,H=xe(w=>{let o=W(d,w);return o?d[o]?.actions??[]:[]},[d]),b=xe(async w=>{for(let o of w.action.effects??[]){if("objectBindings"in o){M(o.target,o.objectBindings);continue}if("sceneConfig"in o){m?.(o.sceneConfig);continue}if("isolation"in o){E?.(o.isolation);continue}if("visibility"in o){o.visibility==="show"?C(o.target):o.visibility==="hide"?p(o.target):O(o.target);continue}if("camera"in o){let g=o.camera;g.type==="focus-object"?await A?.(g.objectId??w.objectId):g.type==="fit-scene"?await x?.():g.type==="reset"?await v?.():g.type==="set-target"?await T?.(g.target,g.transition??!0):await _?.(g.state,g.transition??!0);continue}let a=o.animation;if(a.type==="play"){let{type:g,clip:j,...S}=a;u?.(j,S)}else a.type==="pause"?V?.(a.clip):a.type==="stop"?R?.(a.clip):a.type==="set-speed"?y?.(a.speed,a.clip):I?.(a.time,a.clip)}await h?.(w)},[x,A,p,h,V,u,v,I,y,_,T,E,C,R,O,M,m]),F=xe(async(w,o)=>{let a=W(d,w);if(!a)return null;let g=d[a],j=g?.actions?.find(N=>N.id===o);if(!g||!j)return null;let S={objectId:a,action:j,binding:g};return await b(S),S},[b,d]);return{getActionsForObject:H,handleAction:b,runAction:F}}import{useCallback as ue,useRef as lt}from"react";function Kt(e){return typeof e=="function"?e:e?.handleViewerReady??null}function Ae(...e){let t=lt(null),n=lt(e);n.current=e;let s=ue(C=>{t.current=C;let p=new Set;for(let O of n.current){let m=Kt(O);m&&!p.has(m)&&(p.add(m),m(C))}},[]),l=ue(()=>t.current,[]),h=ue(C=>{let p=t.current;return p?p.captureImage(C):Promise.reject(new Error("ModelViewer is not ready yet."))},[]),d=ue(()=>{let C=t.current;return C?(C.invalidate(),!0):!1},[]),M=ue(C=>{let p=t.current;return p?p.captureVideo(C):Promise.reject(new Error("ModelViewer is not ready yet."))},[]);return{handleViewerReady:s,getViewer:l,captureImage:h,captureVideo:M,invalidate:d}}import{useCallback as L,useEffect as Jt,useRef as X}from"react";import{Material as Xt,PointLight as qt,Vector3 as Yt}from"three";var Le=["emissiveIntensity","opacity","metalness","roughness","transmission","clearcoat","clearcoatRoughness","ior","thickness"],me=1;function be(e){return typeof e=="string"?[e]:e}function we(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function Ee(e,t){return e+Math.random()*(t-e)}function dt([e,t],n){return e+(t-e)*n}function Te([e,t],n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ut(e,t){let n=we(e);switch(t){case"ease-in":return n*n;case"ease-out":return 1-(1-n)*(1-n);case"ease-in-out":return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2;default:return n}}function Qt(e){let t=e.material;return t?(Array.isArray(t)?t:[t]).filter(n=>n instanceof Xt):[]}function Zt(e){let t={opacity:e.opacity,transparent:e.transparent};e.color&&(t.baseColor=`#${e.color.getHexString()}`),e.emissive&&(t.emissive=`#${e.emissive.getHexString()}`);for(let n of Le){let s=e[n];typeof s=="number"&&(t[n]=s)}return t}function ft(e,t){t.baseColor!==void 0&&e.color&&e.color.set(t.baseColor),t.emissive!==void 0&&e.emissive&&e.emissive.set(t.emissive);for(let n of Le){let s=t[n];s!==void 0&&typeof e[n]=="number"&&(e[n]=s)}t.transparent!==void 0&&(e.transparent=t.transparent),e.needsUpdate=!0}function en(e){return{position:[e.position.x,e.position.y,e.position.z],rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:[e.scale.x,e.scale.y,e.scale.z],visible:e.visible}}function tn(e,t){if(t.position&&e.position.set(...t.position),t.rotation&&e.rotation.set(...t.rotation),t.scale!==void 0){let n=typeof t.scale=="number"?[t.scale,t.scale,t.scale]:t.scale;e.scale.set(...n)}t.visible!==void 0&&(e.visible=t.visible),e.updateMatrix(),e.updateMatrixWorld(!0)}function Ie(e={}){let t=X(e);t.current=e;let n=X(null),s=X(null),l=X(null),h=X(new Map),d=X(new Map),M=X(new Map),C=X(new Map),p=L(i=>{let r=n.current;if(!r)return null;let f=W(r.objectBindings,i);return r.raw.nodes[i]??(f?r.raw.nodes[f]:null)??(r.raw.scene?Ke(r.raw.scene,i):null)??null},[]),O=L(i=>{let r=n.current;return r?typeof i=="object"&&!Array.isArray(i)?ne(r.objectBindings,i):be(i).map(f=>W(r.objectBindings,f)??f):typeof i=="string"?[i]:Array.isArray(i)?i:[]},[]),m=L(()=>{n.current?.invalidate()},[]),A=L((i,r)=>{let f=!1;for(let c of O(i)){let B=p(c);if(B)for(let D of Qt(B))M.current.has(D)||M.current.set(D,Zt(D)),ft(D,r),f=!0}return f},[p,O]),x=L((i,r)=>{let f=A(i,r);return f&&m(),f},[m,A]),v=L((i,r)=>{let f=!1;for(let c of O(i)){let B=p(c);B&&(C.current.has(B)||C.current.set(B,en(B)),tn(B,r),f=!0)}return f},[p,O]),T=L((i,r)=>{let f=v(i,r);return f&&m(),f},[m,v]),_=L(i=>{let r=p(i);if(!r)return null;r.updateWorldMatrix(!0,!1);let f=r.getWorldPosition(new Yt);return[f.x,f.y,f.z]},[p]),u=L(i=>{let r=d.current.get(i);return r?(r.light.removeFromParent(),r.light.dispose(),d.current.delete(i),m(),!0):!1},[m]),V=L(i=>{let r=p(i.target);if(!r)return!1;let f=d.current.get(i.id),c=f?.light??new qt;return f&&f.target!==i.target&&c.removeFromParent(),c.name=`react-immersive-runtime-light:${i.id}`,c.color.set(i.color??"#ffffff"),c.intensity=i.intensity??1,c.distance=i.distance??0,c.decay=i.decay??2,c.castShadow=i.castShadow??!1,c.position.set(...i.offset??[0,0,0]),c.parent!==r&&r.add(c),d.current.set(i.id,{light:c,target:i.target}),m(),!0},[m,p]),R=L((i,r)=>{let f=d.current.get(i);if(!f)return!1;if(r.target&&r.target!==f.target){let c=p(r.target);if(!c)return!1;f.light.removeFromParent(),c.add(f.light),f.target=r.target}return r.color!==void 0&&f.light.color.set(r.color),r.intensity!==void 0&&(f.light.intensity=r.intensity),r.distance!==void 0&&(f.light.distance=r.distance),r.decay!==void 0&&(f.light.decay=r.decay),r.offset!==void 0&&f.light.position.set(...r.offset),r.castShadow!==void 0&&(f.light.castShadow=r.castShadow),m(),!0},[m,p]),y=L((i,r)=>{let f=c=>r[c%r.length]??0;for(let c of i.materials??[])O(c.targets).forEach((B,D)=>{let P=f(D),U={};for(let J of Le){let z=c.values[J];z&&(U[J]=dt(z,P))}A(B,U)});for(let c of i.transforms??[])O(c.targets).forEach((B,D)=>{let P=f(D),U={};c.values.position&&(U.position=Te(c.values.position,P)),c.values.rotation&&(U.rotation=Te(c.values.rotation,P)),c.values.scale&&(U.scale=Te(c.values.scale,P)),v(B,U)});for(let c of i.lights??[])be(c.lights).forEach((B,D)=>{let P=d.current.get(B);P&&(P.light.intensity=dt(c.intensity,f(D)))})},[O,A,v]),I=X(()=>{}),E=X(()=>{});E.current=i=>{l.current=null;let r=!1;for(let[f,c]of h.current){c.startedAt===null&&(c.startedAt=i);let B=c.lastFrameAt??i;c.lastFrameAt=i;let D=c.override&&c.override.until>i?c.override.level:null;c.override&&D===null&&(c.override=null);let P=c.update(i,i-c.startedAt,Math.min(100,i-B),D);r=!0,P||(h.current.delete(f),c.onComplete?.())}r&&m(),h.current.size>0&&I.current()},I.current=()=>{l.current!==null||typeof requestAnimationFrame>"u"||(l.current=requestAnimationFrame(i=>E.current(i)))};let H=L(i=>(h.current.set(i.id,i),I.current(),i.id),[]),b=L((i,r={})=>{let f=r.id??`transition-${me++}`,c=Math.max(1,r.duration??400),B=r.easing??"ease-in-out";return H({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(D,P,U,J)=>{let z=J??ut(P/c,B);return y(i,[z]),P<c}})},[y,H]),F=L((i,r={})=>{let f=r.id??`pulse-${me++}`,c=Math.max(1,r.duration??1e3),B=r.minLevel??0,D=r.maxLevel??1,P=r.repeat??1/0,U=r.synchronized??!0,J=Math.max(1,...[...i.materials??[],...i.transforms??[]].map(z=>O(z.targets).length),...(i.lights??[]).map(z=>be(z.lights).length));return H({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(z,oe,se,Y)=>{let G=oe/c,Q=Array.from({length:U?1:J},(ae,re)=>{if(Y!==null)return Y;let ge=G+(U?0:re/J),te=.5-Math.cos(ge%1*Math.PI*2)/2;return B+(D-B)*te});return y(i,Q),P===1/0||G<P}})},[y,H,O]),w=L((i,r={})=>{let f=r.id??`timeline-${me++}`,c=r.repeat??1,B=i.map(P=>({...P,duration:Math.max(1,P.duration),hold:Math.max(0,P.hold??0)})),D=Math.max(1,B.reduce((P,U)=>P+U.duration+U.hold,0));return H({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(P,U,J,z)=>{if(B.length===0||c<=0)return!1;let oe=U/D;if(c!==1/0&&oe>=c){for(let G of B)y(G.channels,[1]);return!1}let se=U%D,Y=0;for(let G of B){let Q=Y+G.duration,ae=Q+G.hold;if(se>=Q){y(G.channels,[z??1]),Y=ae;continue}if(se>=Y){let re=z??ut((se-Y)/G.duration,G.easing??"ease-in-out");y(G.channels,[re]);break}}return!0}})},[y,H]),o=L((i,r={})=>{let f=r.id??`flicker-${me++}`,c=r.synchronized??!0,B=r.minLevel??.15,D=r.maxLevel??1,P=r.interval??[45,160],U=typeof P=="number"?[P,P]:P,J=[Math.max(1,Math.min(...U)),Math.max(1,Math.max(...U))],z=we(r.response??.7,.01,1),oe=we(r.blackoutChance??.08),se=we(r.flashChance??.12),Y=r.flashLevel??1.15,G=Math.max(1,...[...i.materials??[],...i.transforms??[]].map(te=>O(te.targets).length),...(i.lights??[]).map(te=>be(te.lights).length)),Q=c?1:G,ae=Array.from({length:Q},()=>B),re=Array.from({length:Q},()=>B),ge=Array.from({length:Q},()=>0);return H({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(te,Vt,yt,Fe)=>{for(let Z=0;Z<Q;Z+=1){if(Fe!==null)re[Z]=Fe;else if(te>=ge[Z]){let Ne=Math.random();re[Z]=Ne<oe?Ee(0,Math.min(.04,B)):Ne<oe+se?Y:Ee(B,D),ge[Z]=te+Ee(...J)}let Ct=1-Math.pow(1-z,Math.max(1,yt)/16.67);ae[Z]+=(re[Z]-ae[Z])*Ct}return y(i,ae),r.duration===void 0||Vt<r.duration}})},[y,H,O]),a=L((i,r,f)=>{let c=h.current.get(i);if(!c)return!1;let B=typeof performance>"u"?Date.now():performance.now();return c.override={level:r,until:B+Math.max(0,f)},I.current(),!0},[]),g=L(i=>h.current.delete(i),[]),j=L(()=>{h.current.clear(),l.current!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(l.current),l.current=null)},[]),S=L(()=>{for(let[i,r]of M.current)ft(i,r);M.current.clear();for(let[i,r]of C.current)i.position.set(...r.position),i.rotation.set(...r.rotation),i.scale.set(...r.scale),i.visible=r.visible,i.updateMatrix(),i.updateMatrixWorld(!0);C.current.clear();for(let i of d.current.values())i.light.removeFromParent(),i.light.dispose();d.current.clear(),m()},[m]),N=L(()=>{j(),S()},[S,j]),q=L(i=>{s.current&&s.current!==i.raw.scene&&S(),n.current=i,s.current=i.raw.scene,t.current.onViewerReady?.(i)},[S]);return Jt(()=>()=>{N(),n.current=null,s.current=null},[N]),{handleViewerReady:q,setMaterial:x,setTransform:T,getWorldPosition:_,addPointLight:V,updatePointLight:R,removePointLight:u,transition:b,timeline:w,pulse:F,flicker:o,overrideEffect:a,stopEffect:g,stopAllEffects:j,resetRuntime:N}}import{useCallback as nn,useState as rn}from"react";function ke(){let[e,t]=rn(null),n=nn(s=>{t(s)},[t]);return{hoveredObjectBinding:e,handleHoveredObject:n}}import{useCallback as gt,useState as on}from"react";function De(e=null){let[t,n]=on(e),s=gt((h,d)=>n({...d,target:h}),[]),l=gt(()=>n(null),[]);return{isolation:t,isolate:s,clearIsolation:l,handleIsolationChange:n}}import{useCallback as he,useState as ie}from"react";function He(){let[e,t]=ie(!0),[n,s]=ie(!1),[l,h]=ie(null),[d,M]=ie(null),[C,p]=ie(0),[O,m]=ie([]),[A,x]=ie([]),[v,T]=ie([]),_=he(y=>{M(y.bounds),p(y.objectCount),m(y.materialVariants),x(y.materialVariantGroups),h(null),t(!1),s(!0)},[]),u=he(y=>T(y),[]),V=he(y=>{h(y),M(null),p(0),m([]),x([]),T([]),t(!1),s(!1)},[]),R=he(()=>{t(!0),s(!1),h(null),M(null),p(0),m([]),x([]),T([])},[]);return{isLoading:e,isReady:n,error:l,bounds:d,objectCount:C,materialVariants:O,materialVariantGroups:A,objects:v,handleModelLoaded:_,handleObjectCatalog:u,handleLoadError:V,resetModelState:R}}import{useCallback as pt,useState as sn}from"react";function Ue(e=null){let[t,n]=sn(e),s=pt(h=>{n(h)},[n]),l=pt(()=>{n(null)},[]);return{selectedObjectBinding:t,setSelectedObjectBinding:n,handleObjectSelect:s,clearSelection:l}}var an={};function cn(e={}){let t=mt(e);t.current=e;let n=mt(e.bindings===void 0||e.bindings==="auto"),s=Me(()=>{let b=t.current.bindings;return b===void 0||b==="auto"?an:typeof b=="function"?b():b}),l=Re(()=>{let b=t.current.sceneConfig;return b===void 0?pe:typeof b=="function"?b():b}),h=Ue(),d=ke(),M=ye(e.camera),C=He(),p=ve(),O=De(),m=Ie(),A=Ae(M,m),x=Pe({bindings:s,scene:l,camera:M,animations:p,isolation:O,onAction:e.onAction}),{setObjectBindings:v}=s,{handleObjectCatalog:T}=C,_=Ve(b=>{T(b),n.current&&v(F=>{let w=Je(b.map(o=>o.name));for(let o of Object.keys(w))F[o]&&(w[o]=F[o]);return w})},[T,v]),{handleObjectSelect:u}=h,V=Ve(b=>{u(b),t.current.onObjectSelect?.(b)},[u]),{handleHoveredObject:R}=d,y=Ve(b=>{R(b),t.current.onObjectHover?.(b)},[R]),{handleLoadError:I}=C,E=Ve(b=>{I(b),t.current.onLoadError?.(b)},[I]),H=e.sceneConfig!==void 0||l.sceneConfig!==pe;return{props:{objectBindings:s.objectBindings,onObjectBindingsChange:v,selectedObject:h.selectedObjectBinding,onObjectSelect:V,onObjectHover:y,onCameraChange:M.handleCameraChange,onViewerReady:A.handleViewerReady,onModelLoaded:C.handleModelLoaded,onLoadError:E,onObjectCatalog:_,onAnimationsReady:p.handleAnimationsReady,onAction:x.handleAction,onSceneConfigChange:l.setSceneConfig,isolation:O.isolation,onIsolationChange:O.handleIsolationChange,...H?{sceneConfig:l.sceneConfig}:{}},bindings:s,selection:h,hover:d,camera:M,model:C,animations:p,actions:x,scene:l,isolation:O,effects:m,connection:A}}import{useMemo as ln}from"react";function dn(e,t){return ln(()=>{if(!t)return null;let n=e[t];return n||(Object.values(e).find(s=>s.id===t||s.modelObjectId===t)??null)},[e,t])}import{useMemo as un}from"react";function fn(e){return un(()=>Object.values(e).map(t=>t.modelObjectId),[e])}import{useCallback as de,useEffect as _e,useRef as ee,useState as gn}from"react";function ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fe(e){return typeof e=="number"&&Number.isFinite(e)}function bt(e){return Array.isArray(e)&&e.length===3&&e.every(fe)}function pn(e){return!ht(e)||!bt(e.position)||!bt(e.target)||e.fov!==null&&!fe(e.fov)||!fe(e.zoom)||e.zoom<=0||e.azimuthAngle!==void 0&&!fe(e.azimuthAngle)||e.polarAngle!==void 0&&!fe(e.polarAngle)?null:{position:e.position,target:e.target,fov:e.fov,zoom:e.zoom,azimuthAngle:e.azimuthAngle,polarAngle:e.polarAngle}}function mn(e){if(!ht(e))return null;let t;if(e.camera!==void 0){let l=pn(e.camera);if(!l)return null;t=l}let n;if(e.hidden!==void 0){if(!Array.isArray(e.hidden)||!e.hidden.every(l=>typeof l=="string"))return null;n=e.hidden}let s;if(e.selected===null||typeof e.selected=="string")s=e.selected;else if(e.selected!==void 0)return null;return{camera:t,hidden:n,selected:s}}function wt(e,t,n){let s=Object.values(t).filter(l=>l.visible===!1).map(l=>l.id);return{camera:e??void 0,hidden:s,selected:n?.id??null}}function bn(e,t){if((!!e.hidden?.length||!!e.selected)&&Object.keys(t).length===0)return null;let s={};if(e.hidden){let l=new Set(e.hidden);s.bindings=Object.fromEntries(Object.entries(t).map(([h,d])=>[h,{...d,visible:!l.has(d.id)}]))}if(e.selected!==void 0){let l=e.selected?W(t,e.selected):null;s.selected=l?t[l]:null}return s}function wn({cameraState:e,setCameraState:t,objectBindings:n,onObjectBindingsChange:s,selectedObjectBinding:l,setSelectedObjectBinding:h,paramKey:d="view",debounceMs:M=400,autoSync:C=!0}){let p=ee(null),O=ee(null),m=ee(null),A=ee(null),x=ee(null),v=de(()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null),m.current=null,A.current=null},[]),T=de(()=>{let w=wt(e,n,l);return`${d}=${encodeURIComponent(JSON.stringify(w))}`},[e,n,l,d]),_=de(()=>{let w=new URL(window.location.href);return w.hash=T(),w.toString()},[T]),u=de(w=>{let o=new URL(window.location.href);o.hash=w,window.history.replaceState(null,"",o.toString()),O.current=w,p.current=new URLSearchParams(o.hash.slice(1)).get(d)},[d]),V=de(()=>{v(),u(T())},[T,v,u]),R=ee({cameraState:e,objectBindings:n,selectedObjectBinding:l});R.current={cameraState:e,objectBindings:n,selectedObjectBinding:l};let[y,I]=gn(!1);_e(()=>{if(!C||!y){v();return}let w=R.current,o=wt(w.cameraState,w.objectBindings,w.selectedObjectBinding),a=`${d}=${encodeURIComponent(JSON.stringify(o))}`;if(a===O.current){v();return}a===m.current&&M===A.current||(v(),m.current=a,A.current=M,x.current=window.setTimeout(()=>{x.current=null,m.current=null,A.current=null,u(a)},Math.max(0,M)))},[C,e,v,M,n,d,y,l,u]),_e(()=>v,[v]);let E=ee(null),H=ee(null),b=ee(null),F=de(async()=>{let w=S=>(I(!0),S),o=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,a=new URLSearchParams(o).get(d);if(!a)return E.current=null,w(!1);if(a===H.current)return!1;if(a===p.current||a===E.current)return w(!1);let g;try{g=JSON.parse(a)}catch{return w(!1)}let j=mn(g);if(!j)return w(!1);H.current=a;try{j.camera&&b.current!==a&&(await t(j.camera,!1),b.current=a);let S=bn(j,n);return S?(S.bindings&&s(S.bindings),S.selected!==void 0&&h(S.selected),E.current=a,w(!0)):!1}finally{H.current===a&&(H.current=null)}},[n,s,d,t,h]);return _e(()=>{let w=()=>{F().catch(()=>{})};return window.addEventListener("hashchange",w),()=>{window.removeEventListener("hashchange",w)}},[F]),{getShareUrl:_,syncUrl:V,restoreFromUrl:F}}export{St as ACTION_CATALOG,ot as CompareViewer,Ot as DEFAULT_MODEL_VIEWER_LABELS,pe as DEFAULT_SCENE_CONFIG,vt as DEFAULT_SECTION_CONFIG,Dt as MATERIAL_BLENDING_MODES,kt as MATERIAL_SIDES,jt as MODEL_VIEWER_PRESETS,le as ModelViewer,At as applyIsolation,xt as applyStyleRules,Lt as buildBindingsFromNodes,Mt as chooseMaterialVariant,Rt as colorScaleValue,Tt as createDefaultBinding,It as defineObjectBindings,Bt as findCatalogAction,Et as inferType,Pt as isolatedBindingKeys,je as material,ce as patchBindings,Se as patchSceneConfig,Be as sceneLight,ne as selectBindingKeys,Ce as selectBindings,dn as useObjectBinding,fn as useObjectBindingIds,Me as useObjectBindings,Re as useSceneConfig,wn as useShareableViewerState,cn as useViewer,Pe as useViewerActions,ve as useViewerAnimations,ye as useViewerCamera,Ae as useViewerConnection,Ie as useViewerEffects,ke as useViewerHover,De as useViewerIsolation,He as useViewerModel,Ue as useViewerSelection};
|
|
1
|
+
"use client";import{b as Ye,d as qe}from"./chunk-TW2M4UXT.mjs";import{a as Qe}from"./chunk-MMO7KCYU.mjs";import{a as ce,b as je,c as Se,d as Be,e as kt}from"./chunk-FPJZDEON.mjs";import{A as Ze,B as Oe,C as et,D as ve,b as $e,d as St,r as ye,z as Xe}from"./chunk-CV4E7DOO.mjs";import{a as ze,b as Ge,u as We}from"./chunk-F4WT3HEK.mjs";import{A as Pt,B as At,C as Et,E as Tt,F as Lt,G as It,H as Je,K as Dt,L as Ut,a as Bt,c as vt,g as W,p as Mt,q as pe,v as Ke,w as ne,x as Ce,z as xt}from"./chunk-W24UP6NM.mjs";import{a as jt,w as Rt}from"./chunk-JHKMRMJH.mjs";import"./chunk-JR557W27.mjs";import{jsx as Ht}from"react/jsx-runtime";function le(e){return Qe("model-viewer","ModelViewer"),Ht(Xe,{...qe(e,Ye)})}import{useCallback as _t,useEffect as tt,useMemo as nt,useRef as Ft,useState as it}from"react";import{jsx as K,jsxs as rt}from"react/jsx-runtime";function ot(e){return K(ze,{labels:e.labels,children:K(Nt,{...e})})}function Nt({before:e,after:t,layout:n="slider",split:s,onSplitChange:c,reveal:b="auto",...l}){let O=Ge(),[w,p]=it(b==="auto");tt(()=>{b==="auto"&&p(!0)},[b]);let[j,m]=it(.5),A=Oe(s??j),x=_t(I=>{let E=Oe(I);s===void 0&&m(E),c?.(E)},[s,c]),M=nt(()=>Ze(),[]);tt(()=>()=>M.detach(),[M]);let T=[e,t],_=nt(()=>[0,1].map(I=>E=>{M.attach(I,E.raw.controls,E.invalidate)}),[M]),u=T.map((I,E)=>{let{label:U,...h}=I,F={preset:"minimal",...l,...h},V=h.onViewerReady??l.onViewerReady;return{...F,onViewerReady:o=>{_[E](o),V?.(o)}}}),y=[e.label??O("compareBefore"),t.label??O("compareAfter")];(!u[0].modelUrl||!u[1].modelUrl)&&console.error("[react-immersive] CompareViewer needs a modelUrl, shared or on each side.");let R=Ft(null);if(!w)return K(We,{className:"ri-compare",background:$e(l.backgroundColor,l.sceneConfig),poster:l.poster??t.poster??e.poster,onReveal:()=>p(!0)});if(n==="side-by-side")return K("div",{className:"ri-compare ri-compare--sideBySide",children:u.map((I,E)=>rt("div",{className:"ri-compare__pane",children:[K(le,{...I}),K("span",{className:"ri-compare__label",children:y[E]})]},E))});let C=`${A*100}%`;return rt("div",{ref:R,className:"ri-compare ri-compare--slider",style:{"--ri-compare-split":C},children:[K("div",{className:"ri-compare__layer",children:K(le,{...u[0]})}),K("div",{className:"ri-compare__layer ri-compare__layer--after",children:K(le,{...u[1]})}),K(et,{split:A,onSplitChange:x,labels:[y[0],y[1]],containerRef:R})]})}import{useCallback as Ve,useRef as mt}from"react";import{useCallback as k,useMemo as st,useState as zt}from"react";var at={baseColor:"texture",metalness:"metalnessMap",roughness:"roughnessMap",emissive:"emissiveMap",alpha:"alphaMap",normal:"normalMap",bump:"bumpMap",ao:"aoMap",displacement:"displacementMap",clearcoat:"clearcoatMap",clearcoatRoughness:"clearcoatRoughnessMap",clearcoatNormal:"clearcoatNormalMap",anisotropy:"anisotropyMap",transmission:"transmissionMap",thickness:"thicknessMap",sheenColor:"sheenColorMap",sheenRoughness:"sheenRoughnessMap",specularIntensity:"specularIntensityMap",specularColor:"specularColorMap"};function ct(e){if(e)return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,n&&typeof n=="object"?{...n}:n]))}function Gt(e){return Object.fromEntries(Object.entries(e).filter(([,t])=>t.visible===!1).map(([t])=>[t,!0]))}function Me(e){let[t,n]=zt(e),s=k((o,a)=>{n(g=>a===void 0?ce(g,o):ce(g,o,a))},[]),c=k((o,a)=>s(o,je(a)),[s]),b=k((o,a)=>c(o,{baseColor:a}),[c]),l=k((o,a,g="baseColor")=>{let S=at[g],B=typeof a=="string"?{path:a}:a;s(o,{style:{material:{[S]:B}}})},[s]),O=k((o,a="baseColor")=>{let g=at[a];s(o,{style:{material:{[g]:void 0}}})},[s]),w=k((o,a)=>{n(g=>{let S=W(g,o);if(!S)return g;let B=ct(g[S]?.style?.material),N=ne(g,a);if(N.length===0)return g;let Y=g;for(let i of N){let r=g[i];r&&(Y===g&&(Y={...g}),Y[i]={...r,style:{...r.style,material:ct(B)}})}return Y})},[]),p=k(o=>s(o,{style:{material:void 0}}),[s]),j=k((o,a)=>s(o,{transform:a}),[s]),m=k(o=>s(o,{transform:void 0}),[s]),A=k((o,a)=>s(o,{metadata:a}),[s]),x=k((o,a)=>{n(g=>{let S=g;for(let B of ne(g,o)){let N=g[B],Y=a(N.decals??[]);S===g&&(S={...g}),S[B]={...N,decals:Y.length>0?Y:void 0}}return S})},[]),M=k((o,a)=>{let g=a.id??`decal-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;return x(o,S=>[...S.filter(B=>B.id!==g),{...a,id:g}]),g},[x]),T=k((o,a,g)=>x(o,S=>S.map(B=>B.id===a?{...B,...g}:B)),[x]),_=k((o,a)=>x(o,g=>g.filter(S=>S.id!==a)),[x]),u=k(o=>Ce(t,o),[t]),y=k(o=>ne(t,o).map(a=>t[a]?.id??a),[t]),R=k(o=>{let a=W(t,o);return a?t[a]?.style?.material??null:null},[t]),C=k(o=>s(o,{visible:!1}),[s]),I=k(o=>s(o,{visible:!0}),[s]),E=k(o=>{n(a=>{let g=ne(a,o).reduce((S,B)=>{let N=a[B];return N&&S.push({ids:B,patch:{visible:N.visible===!1}}),S},[]);return ce(a,g)})},[n]),U=k(()=>{n(o=>ce(o,Object.keys(o),{visible:!0}))},[n]),h=st(()=>Gt(t),[t]),F=st(()=>Object.keys(h).map(o=>t[o]?.id??o),[h,t]),V=k(o=>{let a=W(t,o);return a?t[a]?.visible===!1:!1},[t]);return{objectBindings:t,setObjectBindings:n,updateObjectBindings:s,setMaterial:c,setBaseColor:b,setTexture:l,clearTexture:O,copyMaterial:w,resetMaterial:p,getMaterial:R,setTransform:j,resetTransform:m,updateMetadata:A,addDecal:M,updateDecal:T,removeDecal:_,selectObjectBindings:u,selectObjectBindingIds:y,hiddenObjects:h,hiddenObjectIds:F,hideObject:C,showObject:I,toggleObjectVisibility:E,isObjectHidden:V,clearHiddenObjects:U}}import{useCallback as $,useMemo as Wt,useRef as $t,useState as Kt}from"react";function Re(e){let t=$t(null),[n,s]=Kt(()=>{let u=typeof e=="function"?e():e;return t.current=u,u}),c=$(u=>{s(y=>{let R=typeof u=="function"?u(y):u;return Se(y,R)})},[]),b=$(()=>{let u=t.current;u&&s(u)},[]),l=$((u,y)=>{c(R=>({lighting:{lights:R.lighting.lights.map(C=>C.id===u?{...C,...y}:C)}}))},[c]),O=$(u=>{c(y=>y.lighting.lights.some(R=>R.id===u.id)?{}:{lighting:{lights:[...y.lighting.lights,Be(u)]}})},[c]),w=$(u=>{c(y=>({lighting:{lights:y.lighting.lights.filter(R=>R.id!==u)}}))},[c]),p=$((u,y)=>l(u,{intensity:y}),[l]),j=$((u,y)=>l(u,{color:y}),[l]),m=$(u=>l(u,{visible:!0}),[l]),A=$(u=>l(u,{visible:!1}),[l]),x=$(u=>{c(y=>({lighting:{lights:y.lighting.lights.map(R=>R.id===u?{...R,visible:!R.visible}:R)}}))},[c]),M=$((u,y)=>l(u,{attachment:y,attachedToCamera:!1}),[l]),T=$(u=>l(u,{attachment:void 0}),[l]),_=Wt(()=>({items:n.lighting.lights,get:u=>n.lighting.lights.find(y=>y.id===u),add:O,update:l,remove:w,setIntensity:p,setColor:j,show:m,hide:A,toggle:x,attach:M,detach:T}),[n.lighting.lights,O,l,w,p,j,m,A,x,M,T]);return{sceneConfig:n,setSceneConfig:s,updateSceneConfig:c,resetSceneConfig:b,lights:_}}import{useCallback as xe}from"react";function Pe({bindings:e,scene:t,camera:n,animations:s,isolation:c,onAction:b}){let{objectBindings:l,updateObjectBindings:O,showObject:w,hideObject:p,toggleObjectVisibility:j}=e,m=t?.updateSceneConfig,A=n?.focusObject,x=n?.fitScene,M=n?.resetView,T=n?.setCameraTarget,_=n?.setCameraState,u=s?.play,y=s?.pause,R=s?.stop,C=s?.setSpeed,I=s?.seek,E=c?.handleIsolationChange,U=xe(V=>{let o=W(l,V);return o?l[o]?.actions??[]:[]},[l]),h=xe(async V=>{for(let o of V.action.effects??[]){if("objectBindings"in o){O(o.target,o.objectBindings);continue}if("sceneConfig"in o){m?.(o.sceneConfig);continue}if("isolation"in o){E?.(o.isolation);continue}if("visibility"in o){o.visibility==="show"?w(o.target):o.visibility==="hide"?p(o.target):j(o.target);continue}if("camera"in o){let g=o.camera;g.type==="focus-object"?await A?.(g.objectId??V.objectId):g.type==="fit-scene"?await x?.():g.type==="reset"?await M?.():g.type==="set-target"?await T?.(g.target,g.transition??!0):await _?.(g.state,g.transition??!0);continue}let a=o.animation;if(a.type==="play"){let{type:g,clip:S,...B}=a;u?.(S,B)}else a.type==="pause"?y?.(a.clip):a.type==="stop"?R?.(a.clip):a.type==="set-speed"?C?.(a.speed,a.clip):I?.(a.time,a.clip)}await b?.(V)},[x,A,p,b,y,u,M,I,C,_,T,E,w,R,j,O,m]),F=xe(async(V,o)=>{let a=W(l,V);if(!a)return null;let g=l[a],S=g?.actions?.find(N=>N.id===o);if(!g||!S)return null;let B={objectId:a,action:S,binding:g};return await h(B),B},[h,l]);return{getActionsForObject:U,handleAction:h,runAction:F}}import{useCallback as ue,useRef as lt}from"react";function Jt(e){return typeof e=="function"?e:e?.handleViewerReady??null}function Ae(...e){let t=lt(null),n=lt(e);n.current=e;let s=ue(w=>{t.current=w;let p=new Set;for(let j of n.current){let m=Jt(j);m&&!p.has(m)&&(p.add(m),m(w))}},[]),c=ue(()=>t.current,[]),b=ue(w=>{let p=t.current;return p?p.captureImage(w):Promise.reject(new Error("ModelViewer is not ready yet."))},[]),l=ue(()=>{let w=t.current;return w?(w.invalidate(),!0):!1},[]),O=ue(w=>{let p=t.current;return p?p.captureVideo(w):Promise.reject(new Error("ModelViewer is not ready yet."))},[]);return{handleViewerReady:s,getViewer:c,captureImage:b,captureVideo:O,invalidate:l}}import{useCallback as L,useEffect as Xt,useRef as X}from"react";import{Material as Yt,PointLight as qt,Vector3 as Qt}from"three";var Le=["emissiveIntensity","opacity","metalness","roughness","transmission","clearcoat","clearcoatRoughness","ior","thickness"],me=1;function be(e){return typeof e=="string"?[e]:e}function we(e,t=0,n=1){return Math.min(n,Math.max(t,e))}function Ee(e,t){return e+Math.random()*(t-e)}function dt([e,t],n){return e+(t-e)*n}function Te([e,t],n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n,e[2]+(t[2]-e[2])*n]}function ut(e,t){let n=we(e);switch(t){case"ease-in":return n*n;case"ease-out":return 1-(1-n)*(1-n);case"ease-in-out":return n<.5?2*n*n:1-Math.pow(-2*n+2,2)/2;default:return n}}function Zt(e){let t=e.material;return t?(Array.isArray(t)?t:[t]).filter(n=>n instanceof Yt):[]}function en(e){let t={opacity:e.opacity,transparent:e.transparent};e.color&&(t.baseColor=`#${e.color.getHexString()}`),e.emissive&&(t.emissive=`#${e.emissive.getHexString()}`);for(let n of Le){let s=e[n];typeof s=="number"&&(t[n]=s)}return t}function ft(e,t){t.baseColor!==void 0&&e.color&&e.color.set(t.baseColor),t.emissive!==void 0&&e.emissive&&e.emissive.set(t.emissive);for(let n of Le){let s=t[n];s!==void 0&&typeof e[n]=="number"&&(e[n]=s)}t.transparent!==void 0&&(e.transparent=t.transparent),e.needsUpdate=!0}function tn(e){return{position:[e.position.x,e.position.y,e.position.z],rotation:[e.rotation.x,e.rotation.y,e.rotation.z],scale:[e.scale.x,e.scale.y,e.scale.z],visible:e.visible}}function nn(e,t){if(t.position&&e.position.set(...t.position),t.rotation&&e.rotation.set(...t.rotation),t.scale!==void 0){let n=typeof t.scale=="number"?[t.scale,t.scale,t.scale]:t.scale;e.scale.set(...n)}t.visible!==void 0&&(e.visible=t.visible),e.updateMatrix(),e.updateMatrixWorld(!0)}function Ie(e={}){let t=X(e);t.current=e;let n=X(null),s=X(null),c=X(null),b=X(new Map),l=X(new Map),O=X(new Map),w=X(new Map),p=L(i=>{let r=n.current;if(!r)return null;let f=W(r.objectBindings,i);return r.raw.nodes[i]??(f?r.raw.nodes[f]:null)??(r.raw.scene?Ke(r.raw.scene,i):null)??null},[]),j=L(i=>{let r=n.current;return r?typeof i=="object"&&!Array.isArray(i)?ne(r.objectBindings,i):be(i).map(f=>W(r.objectBindings,f)??f):typeof i=="string"?[i]:Array.isArray(i)?i:[]},[]),m=L(()=>{n.current?.invalidate()},[]),A=L((i,r)=>{let f=!1;for(let d of j(i)){let v=p(d);if(v)for(let D of Zt(v))O.current.has(D)||O.current.set(D,en(D)),ft(D,r),f=!0}return f},[p,j]),x=L((i,r)=>{let f=A(i,r);return f&&m(),f},[m,A]),M=L((i,r)=>{let f=!1;for(let d of j(i)){let v=p(d);v&&(w.current.has(v)||w.current.set(v,tn(v)),nn(v,r),f=!0)}return f},[p,j]),T=L((i,r)=>{let f=M(i,r);return f&&m(),f},[m,M]),_=L(i=>{let r=p(i);if(!r)return null;r.updateWorldMatrix(!0,!1);let f=r.getWorldPosition(new Qt);return[f.x,f.y,f.z]},[p]),u=L(i=>{let r=l.current.get(i);return r?(r.light.removeFromParent(),r.light.dispose(),l.current.delete(i),m(),!0):!1},[m]),y=L(i=>{let r=p(i.target);if(!r)return!1;let f=l.current.get(i.id),d=f?.light??new qt;return f&&f.target!==i.target&&d.removeFromParent(),d.name=`react-immersive-runtime-light:${i.id}`,d.color.set(i.color??"#ffffff"),d.intensity=i.intensity??1,d.distance=i.distance??0,d.decay=i.decay??2,d.castShadow=i.castShadow??!1,d.position.set(...i.offset??[0,0,0]),d.parent!==r&&r.add(d),l.current.set(i.id,{light:d,target:i.target}),m(),!0},[m,p]),R=L((i,r)=>{let f=l.current.get(i);if(!f)return!1;if(r.target&&r.target!==f.target){let d=p(r.target);if(!d)return!1;f.light.removeFromParent(),d.add(f.light),f.target=r.target}return r.color!==void 0&&f.light.color.set(r.color),r.intensity!==void 0&&(f.light.intensity=r.intensity),r.distance!==void 0&&(f.light.distance=r.distance),r.decay!==void 0&&(f.light.decay=r.decay),r.offset!==void 0&&f.light.position.set(...r.offset),r.castShadow!==void 0&&(f.light.castShadow=r.castShadow),m(),!0},[m,p]),C=L((i,r)=>{let f=d=>r[d%r.length]??0;for(let d of i.materials??[])j(d.targets).forEach((v,D)=>{let P=f(D),H={};for(let J of Le){let z=d.values[J];z&&(H[J]=dt(z,P))}A(v,H)});for(let d of i.transforms??[])j(d.targets).forEach((v,D)=>{let P=f(D),H={};d.values.position&&(H.position=Te(d.values.position,P)),d.values.rotation&&(H.rotation=Te(d.values.rotation,P)),d.values.scale&&(H.scale=Te(d.values.scale,P)),M(v,H)});for(let d of i.lights??[])be(d.lights).forEach((v,D)=>{let P=l.current.get(v);P&&(P.light.intensity=dt(d.intensity,f(D)))})},[j,A,M]),I=X(()=>{}),E=X(()=>{});E.current=i=>{c.current=null;let r=!1;for(let[f,d]of b.current){d.startedAt===null&&(d.startedAt=i);let v=d.lastFrameAt??i;d.lastFrameAt=i;let D=d.override&&d.override.until>i?d.override.level:null;d.override&&D===null&&(d.override=null);let P=d.update(i,i-d.startedAt,Math.min(100,i-v),D);r=!0,P||(b.current.delete(f),d.onComplete?.())}r&&m(),b.current.size>0&&I.current()},I.current=()=>{c.current!==null||typeof requestAnimationFrame>"u"||(c.current=requestAnimationFrame(i=>E.current(i)))};let U=L(i=>(b.current.set(i.id,i),I.current(),i.id),[]),h=L((i,r={})=>{let f=r.id??`transition-${me++}`,d=Math.max(1,r.duration??400),v=r.easing??"ease-in-out";return U({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(D,P,H,J)=>{let z=J??ut(P/d,v);return C(i,[z]),P<d}})},[C,U]),F=L((i,r={})=>{let f=r.id??`pulse-${me++}`,d=Math.max(1,r.duration??1e3),v=r.minLevel??0,D=r.maxLevel??1,P=r.repeat??1/0,H=r.synchronized??!0,J=Math.max(1,...[...i.materials??[],...i.transforms??[]].map(z=>j(z.targets).length),...(i.lights??[]).map(z=>be(z.lights).length));return U({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(z,oe,se,q)=>{let G=oe/d,Q=Array.from({length:H?1:J},(ae,re)=>{if(q!==null)return q;let ge=G+(H?0:re/J),te=.5-Math.cos(ge%1*Math.PI*2)/2;return v+(D-v)*te});return C(i,Q),P===1/0||G<P}})},[C,U,j]),V=L((i,r={})=>{let f=r.id??`timeline-${me++}`,d=r.repeat??1,v=i.map(P=>({...P,duration:Math.max(1,P.duration),hold:Math.max(0,P.hold??0)})),D=Math.max(1,v.reduce((P,H)=>P+H.duration+H.hold,0));return U({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(P,H,J,z)=>{if(v.length===0||d<=0)return!1;let oe=H/D;if(d!==1/0&&oe>=d){for(let G of v)C(G.channels,[1]);return!1}let se=H%D,q=0;for(let G of v){let Q=q+G.duration,ae=Q+G.hold;if(se>=Q){C(G.channels,[z??1]),q=ae;continue}if(se>=q){let re=z??ut((se-q)/G.duration,G.easing??"ease-in-out");C(G.channels,[re]);break}}return!0}})},[C,U]),o=L((i,r={})=>{let f=r.id??`flicker-${me++}`,d=r.synchronized??!0,v=r.minLevel??.15,D=r.maxLevel??1,P=r.interval??[45,160],H=typeof P=="number"?[P,P]:P,J=[Math.max(1,Math.min(...H)),Math.max(1,Math.max(...H))],z=we(r.response??.7,.01,1),oe=we(r.blackoutChance??.08),se=we(r.flashChance??.12),q=r.flashLevel??1.15,G=Math.max(1,...[...i.materials??[],...i.transforms??[]].map(te=>j(te.targets).length),...(i.lights??[]).map(te=>be(te.lights).length)),Q=d?1:G,ae=Array.from({length:Q},()=>v),re=Array.from({length:Q},()=>v),ge=Array.from({length:Q},()=>0);return U({id:f,startedAt:null,lastFrameAt:null,override:null,onComplete:r.onComplete,update:(te,yt,Ct,Fe)=>{for(let Z=0;Z<Q;Z+=1){if(Fe!==null)re[Z]=Fe;else if(te>=ge[Z]){let Ne=Math.random();re[Z]=Ne<oe?Ee(0,Math.min(.04,v)):Ne<oe+se?q:Ee(v,D),ge[Z]=te+Ee(...J)}let Ot=1-Math.pow(1-z,Math.max(1,Ct)/16.67);ae[Z]+=(re[Z]-ae[Z])*Ot}return C(i,ae),r.duration===void 0||yt<r.duration}})},[C,U,j]),a=L((i,r,f)=>{let d=b.current.get(i);if(!d)return!1;let v=typeof performance>"u"?Date.now():performance.now();return d.override={level:r,until:v+Math.max(0,f)},I.current(),!0},[]),g=L(i=>b.current.delete(i),[]),S=L(()=>{b.current.clear(),c.current!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(c.current),c.current=null)},[]),B=L(()=>{for(let[i,r]of O.current)ft(i,r);O.current.clear();for(let[i,r]of w.current)i.position.set(...r.position),i.rotation.set(...r.rotation),i.scale.set(...r.scale),i.visible=r.visible,i.updateMatrix(),i.updateMatrixWorld(!0);w.current.clear();for(let i of l.current.values())i.light.removeFromParent(),i.light.dispose();l.current.clear(),m()},[m]),N=L(()=>{S(),B()},[B,S]),Y=L(i=>{s.current&&s.current!==i.raw.scene&&B(),n.current=i,s.current=i.raw.scene,t.current.onViewerReady?.(i)},[B]);return Xt(()=>()=>{N(),n.current=null,s.current=null},[N]),{handleViewerReady:Y,setMaterial:x,setTransform:T,getWorldPosition:_,addPointLight:y,updatePointLight:R,removePointLight:u,transition:h,timeline:V,pulse:F,flicker:o,overrideEffect:a,stopEffect:g,stopAllEffects:S,resetRuntime:N}}import{useCallback as rn,useState as on}from"react";function ke(){let[e,t]=on(null),n=rn(s=>{t(s)},[t]);return{hoveredObjectBinding:e,handleHoveredObject:n}}import{useCallback as gt,useState as sn}from"react";function De(e=null){let[t,n]=sn(e),s=gt((b,l)=>n({...l,target:b}),[]),c=gt(()=>n(null),[]);return{isolation:t,isolate:s,clearIsolation:c,handleIsolationChange:n}}import{useCallback as he,useState as ie}from"react";function Ue(){let[e,t]=ie(!0),[n,s]=ie(!1),[c,b]=ie(null),[l,O]=ie(null),[w,p]=ie(0),[j,m]=ie([]),[A,x]=ie([]),[M,T]=ie([]),_=he(C=>{O(C.bounds),p(C.objectCount),m(C.materialVariants),x(C.materialVariantGroups),b(null),t(!1),s(!0)},[]),u=he(C=>T(C),[]),y=he(C=>{b(C),O(null),p(0),m([]),x([]),T([]),t(!1),s(!1)},[]),R=he(()=>{t(!0),s(!1),b(null),O(null),p(0),m([]),x([]),T([])},[]);return{isLoading:e,isReady:n,error:c,bounds:l,objectCount:w,materialVariants:j,materialVariantGroups:A,objects:M,handleModelLoaded:_,handleObjectCatalog:u,handleLoadError:y,resetModelState:R}}import{useCallback as pt,useState as an}from"react";function He(e=null){let[t,n]=an(e),s=pt(b=>{n(b)},[n]),c=pt(()=>{n(null)},[]);return{selectedObjectBinding:t,setSelectedObjectBinding:n,handleObjectSelect:s,clearSelection:c}}var cn={};function ln(e={}){let t=mt(e);t.current=e;let n=mt(e.bindings===void 0||e.bindings==="auto"),s=Me(()=>{let h=t.current.bindings;return h===void 0||h==="auto"?cn:typeof h=="function"?h():h}),c=Re(()=>{let h=t.current.sceneConfig;return h===void 0?pe:typeof h=="function"?h():h}),b=He(),l=ke(),O=ye(e.camera),w=Ue(),p=ve(),j=De(),m=Ie(),A=Ae(O,m),x=Pe({bindings:s,scene:c,camera:O,animations:p,isolation:j,onAction:e.onAction}),{setObjectBindings:M}=s,{handleObjectCatalog:T}=w,_=Ve(h=>{T(h),n.current&&M(F=>{let V=Je(h.map(o=>o.name));for(let o of Object.keys(V))F[o]&&(V[o]=F[o]);return V})},[T,M]),{handleObjectSelect:u}=b,y=Ve(h=>{u(h),t.current.onObjectSelect?.(h)},[u]),{handleHoveredObject:R}=l,C=Ve(h=>{R(h),t.current.onObjectHover?.(h)},[R]),{handleLoadError:I}=w,E=Ve(h=>{I(h),t.current.onLoadError?.(h)},[I]),U=e.sceneConfig!==void 0||c.sceneConfig!==pe;return{props:{objectBindings:s.objectBindings,onObjectBindingsChange:M,selectedObject:b.selectedObjectBinding,onObjectSelect:y,onObjectHover:C,onCameraChange:O.handleCameraChange,onViewerReady:A.handleViewerReady,onModelLoaded:w.handleModelLoaded,onLoadError:E,onObjectCatalog:_,onAnimationsReady:p.handleAnimationsReady,onAction:x.handleAction,onSceneConfigChange:c.setSceneConfig,isolation:j.isolation,onIsolationChange:j.handleIsolationChange,...U?{sceneConfig:c.sceneConfig}:{}},bindings:s,selection:b,hover:l,camera:O,model:w,animations:p,actions:x,scene:c,isolation:j,effects:m,connection:A}}import{useMemo as dn}from"react";function un(e,t){return dn(()=>{if(!t)return null;let n=e[t];return n||(Object.values(e).find(s=>s.id===t||s.modelObjectId===t)??null)},[e,t])}import{useMemo as fn}from"react";function gn(e){return fn(()=>Object.values(e).map(t=>t.modelObjectId),[e])}import{useCallback as de,useEffect as _e,useRef as ee,useState as pn}from"react";function ht(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fe(e){return typeof e=="number"&&Number.isFinite(e)}function bt(e){return Array.isArray(e)&&e.length===3&&e.every(fe)}function mn(e){return!ht(e)||!bt(e.position)||!bt(e.target)||e.fov!==null&&!fe(e.fov)||!fe(e.zoom)||e.zoom<=0||e.azimuthAngle!==void 0&&!fe(e.azimuthAngle)||e.polarAngle!==void 0&&!fe(e.polarAngle)?null:{position:e.position,target:e.target,fov:e.fov,zoom:e.zoom,azimuthAngle:e.azimuthAngle,polarAngle:e.polarAngle}}function bn(e){if(!ht(e))return null;let t;if(e.camera!==void 0){let c=mn(e.camera);if(!c)return null;t=c}let n;if(e.hidden!==void 0){if(!Array.isArray(e.hidden)||!e.hidden.every(c=>typeof c=="string"))return null;n=e.hidden}let s;if(e.selected===null||typeof e.selected=="string")s=e.selected;else if(e.selected!==void 0)return null;return{camera:t,hidden:n,selected:s}}function wt(e,t,n){let s=Object.values(t).filter(c=>c.visible===!1).map(c=>c.id);return{camera:e??void 0,hidden:s,selected:n?.id??null}}function wn(e,t){if((!!e.hidden?.length||!!e.selected)&&Object.keys(t).length===0)return null;let s={};if(e.hidden){let c=new Set(e.hidden);s.bindings=Object.fromEntries(Object.entries(t).map(([b,l])=>[b,{...l,visible:!c.has(l.id)}]))}if(e.selected!==void 0){let c=e.selected?W(t,e.selected):null;s.selected=c?t[c]:null}return s}function hn({cameraState:e,setCameraState:t,objectBindings:n,onObjectBindingsChange:s,selectedObjectBinding:c,setSelectedObjectBinding:b,paramKey:l="view",debounceMs:O=400,autoSync:w=!0}){let p=ee(null),j=ee(null),m=ee(null),A=ee(null),x=ee(null),M=de(()=>{x.current!==null&&(window.clearTimeout(x.current),x.current=null),m.current=null,A.current=null},[]),T=de(()=>{let V=wt(e,n,c);return`${l}=${encodeURIComponent(JSON.stringify(V))}`},[e,n,c,l]),_=de(()=>{let V=new URL(window.location.href);return V.hash=T(),V.toString()},[T]),u=de(V=>{let o=new URL(window.location.href);o.hash=V,window.history.replaceState(null,"",o.toString()),j.current=V,p.current=new URLSearchParams(o.hash.slice(1)).get(l)},[l]),y=de(()=>{M(),u(T())},[T,M,u]),R=ee({cameraState:e,objectBindings:n,selectedObjectBinding:c});R.current={cameraState:e,objectBindings:n,selectedObjectBinding:c};let[C,I]=pn(!1);_e(()=>{if(!w||!C){M();return}let V=R.current,o=wt(V.cameraState,V.objectBindings,V.selectedObjectBinding),a=`${l}=${encodeURIComponent(JSON.stringify(o))}`;if(a===j.current){M();return}a===m.current&&O===A.current||(M(),m.current=a,A.current=O,x.current=window.setTimeout(()=>{x.current=null,m.current=null,A.current=null,u(a)},Math.max(0,O)))},[w,e,M,O,n,l,C,c,u]),_e(()=>M,[M]);let E=ee(null),U=ee(null),h=ee(null),F=de(async()=>{let V=B=>(I(!0),B),o=window.location.hash.startsWith("#")?window.location.hash.slice(1):window.location.hash,a=new URLSearchParams(o).get(l);if(!a)return E.current=null,V(!1);if(a===U.current)return!1;if(a===p.current||a===E.current)return V(!1);let g;try{g=JSON.parse(a)}catch{return V(!1)}let S=bn(g);if(!S)return V(!1);U.current=a;try{S.camera&&h.current!==a&&(await t(S.camera,!1),h.current=a);let B=wn(S,n);return B?(B.bindings&&s(B.bindings),B.selected!==void 0&&b(B.selected),E.current=a,V(!0)):!1}finally{U.current===a&&(U.current=null)}},[n,s,l,t,b]);return _e(()=>{let V=()=>{F().catch(()=>{})};return window.addEventListener("hashchange",V),()=>{window.removeEventListener("hashchange",V)}},[F]),{getShareUrl:_,syncUrl:y,restoreFromUrl:F}}import{useCallback as Vn,useState as Vt}from"react";var yn={};function Cn(e){let[t,n]=Vt(e),[s,c]=Vt(e[0]?.url??""),b=Vn(l=>{n(O=>O.map(w=>w.url===s?{...w,objectBindings:l}:w))},[s]);return{modelUrl:s,models:t,onModelChange:c,objectBindings:yn,onObjectBindingsChange:b}}export{Bt as ACTION_CATALOG,ot as CompareViewer,jt as DEFAULT_MODEL_VIEWER_LABELS,pe as DEFAULT_SCENE_CONFIG,Mt as DEFAULT_SECTION_CONFIG,Ut as MATERIAL_BLENDING_MODES,Dt as MATERIAL_SIDES,St as MODEL_VIEWER_PRESETS,le as ModelViewer,Et as applyIsolation,Pt as applyStyleRules,It as buildBindingsFromNodes,Rt as chooseMaterialVariant,xt as colorScaleValue,Lt as createDefaultBinding,kt as defineObjectBindings,vt as findCatalogAction,Tt as inferType,At as isolatedBindingKeys,je as material,ce as patchBindings,Se as patchSceneConfig,Be as sceneLight,ne as selectBindingKeys,Ce as selectBindings,un as useObjectBinding,gn as useObjectBindingIds,Me as useObjectBindings,Re as useSceneConfig,hn as useShareableViewerState,ln as useViewer,Pe as useViewerActions,ve as useViewerAnimations,ye as useViewerCamera,Ae as useViewerConnection,Ie as useViewerEffects,ke as useViewerHover,De as useViewerIsolation,Ue as useViewerModel,Cn as useViewerModels,He as useViewerSelection};
|
|
@@ -57,7 +57,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
57
57
|
readonly pointLock: "Point Lock";
|
|
58
58
|
readonly cameraController: "Camera controller";
|
|
59
59
|
readonly cameraControllerSettings: "Camera controller settings";
|
|
60
|
-
readonly downloadGLB: "Download GLB";
|
|
60
|
+
readonly downloadGLB: "Download static GLB";
|
|
61
|
+
readonly downloadGLBDescription: "All visible models and material edits in one static file. No animations, annotations or separate editor model slots. Duplicate mesh names may change on reimport.";
|
|
61
62
|
readonly downloadPNG: "Download PNG";
|
|
62
63
|
readonly downloadUVLayout: "Download UV Layout";
|
|
63
64
|
readonly videoFormat: "Video format";
|
|
@@ -83,6 +84,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
83
84
|
readonly angle: "Angle";
|
|
84
85
|
readonly area: "Area";
|
|
85
86
|
readonly pointToPlane: "Point to plane";
|
|
87
|
+
readonly wrap: "Circumference (Edge)";
|
|
88
|
+
readonly wrapHorizontal: "Circumference (Horizontal)";
|
|
86
89
|
readonly measurementSnapping: "Measurement snapping";
|
|
87
90
|
readonly noSnapping: "No snapping";
|
|
88
91
|
readonly snapAuto: "Snap: auto";
|
|
@@ -165,6 +168,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
165
168
|
readonly pointToPlanePointHint: "Pick a point to measure its perpendicular distance";
|
|
166
169
|
readonly pointToPlaneNewHint: "Pick a face to start a new measurement";
|
|
167
170
|
readonly distanceHint: "Pick points on the model to measure distances";
|
|
171
|
+
readonly wrapHint: "Click a point on the surface to measure its circumference, following the surface (best for limbs)";
|
|
172
|
+
readonly wrapHorizontalHint: "Click a point to measure a level circumference around it (best for the torso/waist)";
|
|
168
173
|
readonly visibleEntries: "{count} visible entries";
|
|
169
174
|
readonly objectCount: "{count} objects";
|
|
170
175
|
readonly annotationMarker: "Annotation {id}: {title}";
|
|
@@ -57,7 +57,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
57
57
|
readonly pointLock: "Point Lock";
|
|
58
58
|
readonly cameraController: "Camera controller";
|
|
59
59
|
readonly cameraControllerSettings: "Camera controller settings";
|
|
60
|
-
readonly downloadGLB: "Download GLB";
|
|
60
|
+
readonly downloadGLB: "Download static GLB";
|
|
61
|
+
readonly downloadGLBDescription: "All visible models and material edits in one static file. No animations, annotations or separate editor model slots. Duplicate mesh names may change on reimport.";
|
|
61
62
|
readonly downloadPNG: "Download PNG";
|
|
62
63
|
readonly downloadUVLayout: "Download UV Layout";
|
|
63
64
|
readonly videoFormat: "Video format";
|
|
@@ -83,6 +84,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
83
84
|
readonly angle: "Angle";
|
|
84
85
|
readonly area: "Area";
|
|
85
86
|
readonly pointToPlane: "Point to plane";
|
|
87
|
+
readonly wrap: "Circumference (Edge)";
|
|
88
|
+
readonly wrapHorizontal: "Circumference (Horizontal)";
|
|
86
89
|
readonly measurementSnapping: "Measurement snapping";
|
|
87
90
|
readonly noSnapping: "No snapping";
|
|
88
91
|
readonly snapAuto: "Snap: auto";
|
|
@@ -165,6 +168,8 @@ declare const DEFAULT_MODEL_VIEWER_LABELS: {
|
|
|
165
168
|
readonly pointToPlanePointHint: "Pick a point to measure its perpendicular distance";
|
|
166
169
|
readonly pointToPlaneNewHint: "Pick a face to start a new measurement";
|
|
167
170
|
readonly distanceHint: "Pick points on the model to measure distances";
|
|
171
|
+
readonly wrapHint: "Click a point on the surface to measure its circumference, following the surface (best for limbs)";
|
|
172
|
+
readonly wrapHorizontalHint: "Click a point to measure a level circumference around it (best for the torso/waist)";
|
|
168
173
|
readonly visibleEntries: "{count} visible entries";
|
|
169
174
|
readonly objectCount: "{count} objects";
|
|
170
175
|
readonly annotationMarker: "Annotation {id}: {title}";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as ReducedMotionSetting, c as ModelViewerLabels } from './materialVariants-DnZe9eMC.js';
|
|
3
|
-
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-XfUQO7C_.js';
|
|
4
|
-
import { r as ObjectBindingDecal, Q as ObjectSurfacePoint, o as ObjectBinding, S as RendererBackend, ap as ViewerCameraState, Y as SceneAnnotationMarker, ar as ViewerObjectInfo, P as ObjectPointerEvent, n as ObjectActionEvent, e as AnimationControls, ao as ViewerCameraConfig, a1 as SceneConfig, aq as ViewerIsolation } from './rendererBackend-QwMzISTn.js';
|
|
5
|
-
import { CameraControls } from '@react-three/drei';
|
|
6
2
|
import { Object3D } from 'three';
|
|
3
|
+
import { R as ReducedMotionSetting, c as ModelViewerLabels } from './materialVariants-DjTuiWmN.js';
|
|
4
|
+
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-BQ5UZu95.js';
|
|
5
|
+
import { r as ObjectBindingDecal, Q as ObjectSurfacePoint, o as ObjectBinding, S as RendererBackend, ap as ViewerCameraState, Y as SceneAnnotationMarker, ar as ViewerObjectInfo, P as ObjectPointerEvent, n as ObjectActionEvent, e as AnimationControls, ao as ViewerCameraConfig, a1 as SceneConfig, aq as ViewerIsolation } from './rendererBackend-C_Jb4_Jy.js';
|
|
6
|
+
import { CameraControls } from '@react-three/drei';
|
|
7
7
|
|
|
8
8
|
/** Engagement from deliberate viewer interactions, with model/session context. */
|
|
9
9
|
type ViewerEngagementEvent = {
|
|
@@ -374,6 +374,11 @@ declare function useViewerCamera(options?: UseViewerCameraOptions): ViewerCamera
|
|
|
374
374
|
|
|
375
375
|
type ObjectTransformSpace = "local" | "world";
|
|
376
376
|
|
|
377
|
+
type ModelMergeSource = {
|
|
378
|
+
url: string;
|
|
379
|
+
namePrefix: string;
|
|
380
|
+
};
|
|
381
|
+
|
|
377
382
|
type AnnotationMarker = SceneAnnotationMarker & {
|
|
378
383
|
markerId?: string;
|
|
379
384
|
};
|
|
@@ -435,6 +440,15 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
435
440
|
*/
|
|
436
441
|
objectBindings?: Record<string, ObjectBinding> | "auto";
|
|
437
442
|
selectedObject?: ObjectBinding | null;
|
|
443
|
+
/**
|
|
444
|
+
* Binding keys of several selected objects. Each is outlined in green.
|
|
445
|
+
* While set, the single-selection (blue) outline is hidden.
|
|
446
|
+
*/
|
|
447
|
+
multiSelectedKeys?: readonly string[];
|
|
448
|
+
/** Explicit nodes to outline together, overriding multiSelectedKeys. */
|
|
449
|
+
selectedObjectRefs?: Object3D[] | null;
|
|
450
|
+
/** Color of the multi-selection outlines. Defaults to green. */
|
|
451
|
+
selectedObjectOutlineColor?: string;
|
|
438
452
|
panelHoveredObject?: ObjectBinding | null;
|
|
439
453
|
onObjectBindingsChange?: (next: Record<string, ObjectBinding>) => void;
|
|
440
454
|
onObjectSelect?: (binding: ObjectBinding | null) => void;
|
|
@@ -445,6 +459,8 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
445
459
|
* texture positioning when that's enabled.
|
|
446
460
|
*/
|
|
447
461
|
onObjectDoubleClick?: (event: ObjectPointerEvent) => boolean | void;
|
|
462
|
+
/** A decal on the model was double-clicked (the editor uses this to enable Move). */
|
|
463
|
+
onDecalDoubleClick?: (binding: ObjectBinding, decalId: string) => void;
|
|
448
464
|
/**
|
|
449
465
|
* An object was right-clicked or, on touch screens, long-pressed. Use it to
|
|
450
466
|
* open your own menu at `clientX`/`clientY`. A right-drag still pans.
|
|
@@ -469,6 +485,7 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
469
485
|
onViewerReady?: (viewer: ViewerReadyState) => void;
|
|
470
486
|
onTextureUpload?: (file: File, objectId: string) => Promise<string>;
|
|
471
487
|
onAnimationsReady?: (controls: AnimationControls) => void;
|
|
488
|
+
onModelAnimationsReady?: (url: string, controls: AnimationControls) => void;
|
|
472
489
|
onAnnotationsChange?: (annotations: AnnotationMarker[]) => void;
|
|
473
490
|
activeAnnotation?: AnnotationMarker | null;
|
|
474
491
|
onActiveAnnotationChange?: (annotation: AnnotationMarker | null) => void;
|
|
@@ -498,6 +515,8 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
498
515
|
onAutoFit?: () => Promise<boolean>;
|
|
499
516
|
enableCameraControls?: boolean;
|
|
500
517
|
moveModeEnabled?: boolean;
|
|
518
|
+
/** Shows a draggable corner handle to resize the selected object, independently of moveModeEnabled. */
|
|
519
|
+
scaleModeEnabled?: boolean;
|
|
501
520
|
/** Aligns PivotControls to the scene or to the selected object. */
|
|
502
521
|
objectTransformSpace?: ObjectTransformSpace;
|
|
503
522
|
/** Enables canvas-focused camera shortcuts. Disabled by default. */
|
|
@@ -564,6 +583,36 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
564
583
|
* binding's `style.material.texture`.
|
|
565
584
|
*/
|
|
566
585
|
texturePositioning?: boolean | TexturePositioningControls;
|
|
586
|
+
extraModelUrls?: string[];
|
|
587
|
+
onExtraModelError?: (url: string, error: unknown) => void;
|
|
588
|
+
onExtraModelLoaded?: (url: string, scene: Object3D) => void;
|
|
589
|
+
originalNodePoses?: Record<string, {
|
|
590
|
+
position: [number, number, number];
|
|
591
|
+
rotation?: [number, number, number];
|
|
592
|
+
scale?: [number, number, number];
|
|
593
|
+
}>;
|
|
594
|
+
/** Each entry supplies its own bindings. Uncontrolled edits are kept per URL. */
|
|
595
|
+
models?: ModelViewerModelEntry[];
|
|
596
|
+
mergeModels?: ModelMergeSource[];
|
|
597
|
+
onMergeModelLoaded?: (url: string, mergedRoot: Object3D) => void;
|
|
598
|
+
onMergeModelError?: (url: string, error: unknown) => void;
|
|
599
|
+
/** Selects a model from the switcher. The switcher is hidden when omitted. */
|
|
600
|
+
onModelChange?: (url: string) => void;
|
|
601
|
+
};
|
|
602
|
+
type ModelViewerModelEntry = {
|
|
603
|
+
url: string;
|
|
604
|
+
/** Display name for the model switcher; falls back to the URL's filename. */
|
|
605
|
+
label?: string;
|
|
606
|
+
/** Bindings for this model; used in preference to top-level objectBindings. */
|
|
607
|
+
objectBindings: Record<string, ObjectBinding>;
|
|
608
|
+
originalNodePoses?: Record<string, {
|
|
609
|
+
position: [number, number, number];
|
|
610
|
+
rotation?: [number, number, number];
|
|
611
|
+
scale?: [number, number, number];
|
|
612
|
+
}>;
|
|
613
|
+
mergeModels?: ModelMergeSource[];
|
|
614
|
+
/** Scene settings for this slot while parked; the active slot uses the viewer's sceneConfig. */
|
|
615
|
+
sceneConfig?: SceneConfig;
|
|
567
616
|
};
|
|
568
617
|
|
|
569
|
-
export { type AnnotationMarker as A, type CameraControllerType as C, type DecalMoveTarget as D, type GroupedModelViewerProps as G, type HomeCameraState as H, MODEL_VIEWER_PRESETS as M, type ObjectTransformSpace as O, type PerformanceProfile as P, type TexturePositioningControls as T, type UseViewerCameraOptions as U, type ViewerCameraPreset as V, type XRScaleMode as X, type CameraLimits as a, type CaptureImageOptions as b, type CaptureVideoOptions as c, type CinematicConfig as d, type CinematicWaypoint as e, type CustomObjectBindingDataPanelProps as f, type CustomSceneObjectsPanelProps as g, type
|
|
618
|
+
export { type AnnotationMarker as A, type CameraControllerType as C, type DecalMoveTarget as D, type GroupedModelViewerProps as G, type HomeCameraState as H, MODEL_VIEWER_PRESETS as M, type ObjectTransformSpace as O, type PerformanceProfile as P, type TexturePositioningControls as T, type UseViewerCameraOptions as U, type ViewerCameraPreset as V, type XRScaleMode as X, type CameraLimits as a, type CaptureImageOptions as b, type CaptureVideoOptions as c, type CinematicConfig as d, type CinematicWaypoint as e, type CustomObjectBindingDataPanelProps as f, type CustomSceneObjectsPanelProps as g, type ModelMergeSource as h, type ModelViewerControlsOptions as i, type ModelViewerDecoderOptions as j, type ModelViewerModelEntry as k, type ModelViewerPerfOptions as l, type ModelViewerPreset as m, type ModelViewerProps as n, type ModelViewerTilesOptions as o, type ModelViewerToolsOptions as p, type ModelViewerUiOptions as q, type ModelViewerXrOptions as r, type MouseControllerPosition as s, type ViewerCameraProps as t, type ViewerEngagementEvent as u, type ViewerReadyState as v, useViewerCamera as w };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { R as ReducedMotionSetting, c as ModelViewerLabels } from './materialVariants-DnZe9eMC.mjs';
|
|
3
|
-
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-BYebMPdZ.mjs';
|
|
4
|
-
import { r as ObjectBindingDecal, Q as ObjectSurfacePoint, o as ObjectBinding, S as RendererBackend, ap as ViewerCameraState, Y as SceneAnnotationMarker, ar as ViewerObjectInfo, P as ObjectPointerEvent, n as ObjectActionEvent, e as AnimationControls, ao as ViewerCameraConfig, a1 as SceneConfig, aq as ViewerIsolation } from './rendererBackend-QwMzISTn.mjs';
|
|
5
|
-
import { CameraControls } from '@react-three/drei';
|
|
6
2
|
import { Object3D } from 'three';
|
|
3
|
+
import { R as ReducedMotionSetting, c as ModelViewerLabels } from './materialVariants-DjTuiWmN.mjs';
|
|
4
|
+
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-CcYpydB7.mjs';
|
|
5
|
+
import { r as ObjectBindingDecal, Q as ObjectSurfacePoint, o as ObjectBinding, S as RendererBackend, ap as ViewerCameraState, Y as SceneAnnotationMarker, ar as ViewerObjectInfo, P as ObjectPointerEvent, n as ObjectActionEvent, e as AnimationControls, ao as ViewerCameraConfig, a1 as SceneConfig, aq as ViewerIsolation } from './rendererBackend-C_Jb4_Jy.mjs';
|
|
6
|
+
import { CameraControls } from '@react-three/drei';
|
|
7
7
|
|
|
8
8
|
/** Engagement from deliberate viewer interactions, with model/session context. */
|
|
9
9
|
type ViewerEngagementEvent = {
|
|
@@ -374,6 +374,11 @@ declare function useViewerCamera(options?: UseViewerCameraOptions): ViewerCamera
|
|
|
374
374
|
|
|
375
375
|
type ObjectTransformSpace = "local" | "world";
|
|
376
376
|
|
|
377
|
+
type ModelMergeSource = {
|
|
378
|
+
url: string;
|
|
379
|
+
namePrefix: string;
|
|
380
|
+
};
|
|
381
|
+
|
|
377
382
|
type AnnotationMarker = SceneAnnotationMarker & {
|
|
378
383
|
markerId?: string;
|
|
379
384
|
};
|
|
@@ -435,6 +440,15 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
435
440
|
*/
|
|
436
441
|
objectBindings?: Record<string, ObjectBinding> | "auto";
|
|
437
442
|
selectedObject?: ObjectBinding | null;
|
|
443
|
+
/**
|
|
444
|
+
* Binding keys of several selected objects. Each is outlined in green.
|
|
445
|
+
* While set, the single-selection (blue) outline is hidden.
|
|
446
|
+
*/
|
|
447
|
+
multiSelectedKeys?: readonly string[];
|
|
448
|
+
/** Explicit nodes to outline together, overriding multiSelectedKeys. */
|
|
449
|
+
selectedObjectRefs?: Object3D[] | null;
|
|
450
|
+
/** Color of the multi-selection outlines. Defaults to green. */
|
|
451
|
+
selectedObjectOutlineColor?: string;
|
|
438
452
|
panelHoveredObject?: ObjectBinding | null;
|
|
439
453
|
onObjectBindingsChange?: (next: Record<string, ObjectBinding>) => void;
|
|
440
454
|
onObjectSelect?: (binding: ObjectBinding | null) => void;
|
|
@@ -445,6 +459,8 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
445
459
|
* texture positioning when that's enabled.
|
|
446
460
|
*/
|
|
447
461
|
onObjectDoubleClick?: (event: ObjectPointerEvent) => boolean | void;
|
|
462
|
+
/** A decal on the model was double-clicked (the editor uses this to enable Move). */
|
|
463
|
+
onDecalDoubleClick?: (binding: ObjectBinding, decalId: string) => void;
|
|
448
464
|
/**
|
|
449
465
|
* An object was right-clicked or, on touch screens, long-pressed. Use it to
|
|
450
466
|
* open your own menu at `clientX`/`clientY`. A right-drag still pans.
|
|
@@ -469,6 +485,7 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
469
485
|
onViewerReady?: (viewer: ViewerReadyState) => void;
|
|
470
486
|
onTextureUpload?: (file: File, objectId: string) => Promise<string>;
|
|
471
487
|
onAnimationsReady?: (controls: AnimationControls) => void;
|
|
488
|
+
onModelAnimationsReady?: (url: string, controls: AnimationControls) => void;
|
|
472
489
|
onAnnotationsChange?: (annotations: AnnotationMarker[]) => void;
|
|
473
490
|
activeAnnotation?: AnnotationMarker | null;
|
|
474
491
|
onActiveAnnotationChange?: (annotation: AnnotationMarker | null) => void;
|
|
@@ -498,6 +515,8 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
498
515
|
onAutoFit?: () => Promise<boolean>;
|
|
499
516
|
enableCameraControls?: boolean;
|
|
500
517
|
moveModeEnabled?: boolean;
|
|
518
|
+
/** Shows a draggable corner handle to resize the selected object, independently of moveModeEnabled. */
|
|
519
|
+
scaleModeEnabled?: boolean;
|
|
501
520
|
/** Aligns PivotControls to the scene or to the selected object. */
|
|
502
521
|
objectTransformSpace?: ObjectTransformSpace;
|
|
503
522
|
/** Enables canvas-focused camera shortcuts. Disabled by default. */
|
|
@@ -564,6 +583,36 @@ type ModelViewerProps = GroupedModelViewerProps & {
|
|
|
564
583
|
* binding's `style.material.texture`.
|
|
565
584
|
*/
|
|
566
585
|
texturePositioning?: boolean | TexturePositioningControls;
|
|
586
|
+
extraModelUrls?: string[];
|
|
587
|
+
onExtraModelError?: (url: string, error: unknown) => void;
|
|
588
|
+
onExtraModelLoaded?: (url: string, scene: Object3D) => void;
|
|
589
|
+
originalNodePoses?: Record<string, {
|
|
590
|
+
position: [number, number, number];
|
|
591
|
+
rotation?: [number, number, number];
|
|
592
|
+
scale?: [number, number, number];
|
|
593
|
+
}>;
|
|
594
|
+
/** Each entry supplies its own bindings. Uncontrolled edits are kept per URL. */
|
|
595
|
+
models?: ModelViewerModelEntry[];
|
|
596
|
+
mergeModels?: ModelMergeSource[];
|
|
597
|
+
onMergeModelLoaded?: (url: string, mergedRoot: Object3D) => void;
|
|
598
|
+
onMergeModelError?: (url: string, error: unknown) => void;
|
|
599
|
+
/** Selects a model from the switcher. The switcher is hidden when omitted. */
|
|
600
|
+
onModelChange?: (url: string) => void;
|
|
601
|
+
};
|
|
602
|
+
type ModelViewerModelEntry = {
|
|
603
|
+
url: string;
|
|
604
|
+
/** Display name for the model switcher; falls back to the URL's filename. */
|
|
605
|
+
label?: string;
|
|
606
|
+
/** Bindings for this model; used in preference to top-level objectBindings. */
|
|
607
|
+
objectBindings: Record<string, ObjectBinding>;
|
|
608
|
+
originalNodePoses?: Record<string, {
|
|
609
|
+
position: [number, number, number];
|
|
610
|
+
rotation?: [number, number, number];
|
|
611
|
+
scale?: [number, number, number];
|
|
612
|
+
}>;
|
|
613
|
+
mergeModels?: ModelMergeSource[];
|
|
614
|
+
/** Scene settings for this slot while parked; the active slot uses the viewer's sceneConfig. */
|
|
615
|
+
sceneConfig?: SceneConfig;
|
|
567
616
|
};
|
|
568
617
|
|
|
569
|
-
export { type AnnotationMarker as A, type CameraControllerType as C, type DecalMoveTarget as D, type GroupedModelViewerProps as G, type HomeCameraState as H, MODEL_VIEWER_PRESETS as M, type ObjectTransformSpace as O, type PerformanceProfile as P, type TexturePositioningControls as T, type UseViewerCameraOptions as U, type ViewerCameraPreset as V, type XRScaleMode as X, type CameraLimits as a, type CaptureImageOptions as b, type CaptureVideoOptions as c, type CinematicConfig as d, type CinematicWaypoint as e, type CustomObjectBindingDataPanelProps as f, type CustomSceneObjectsPanelProps as g, type
|
|
618
|
+
export { type AnnotationMarker as A, type CameraControllerType as C, type DecalMoveTarget as D, type GroupedModelViewerProps as G, type HomeCameraState as H, MODEL_VIEWER_PRESETS as M, type ObjectTransformSpace as O, type PerformanceProfile as P, type TexturePositioningControls as T, type UseViewerCameraOptions as U, type ViewerCameraPreset as V, type XRScaleMode as X, type CameraLimits as a, type CaptureImageOptions as b, type CaptureVideoOptions as c, type CinematicConfig as d, type CinematicWaypoint as e, type CustomObjectBindingDataPanelProps as f, type CustomSceneObjectsPanelProps as g, type ModelMergeSource as h, type ModelViewerControlsOptions as i, type ModelViewerDecoderOptions as j, type ModelViewerModelEntry as k, type ModelViewerPerfOptions as l, type ModelViewerPreset as m, type ModelViewerProps as n, type ModelViewerTilesOptions as o, type ModelViewerToolsOptions as p, type ModelViewerUiOptions as q, type ModelViewerXrOptions as r, type MouseControllerPosition as s, type ViewerCameraProps as t, type ViewerEngagementEvent as u, type ViewerReadyState as v, useViewerCamera as w };
|
|
@@ -593,6 +593,8 @@ type ViewerAnimationsProps = {
|
|
|
593
593
|
setSpeed: (speed: number, clipName?: string) => void;
|
|
594
594
|
seek: (time: number, clipName?: string) => void;
|
|
595
595
|
handleAnimationsReady: (controls: AnimationControls) => void;
|
|
596
|
+
/** Disconnect the previous model while the next one is loading. */
|
|
597
|
+
clearAnimations: () => void;
|
|
596
598
|
};
|
|
597
599
|
declare function useViewerAnimations(): ViewerAnimationsProps;
|
|
598
600
|
|
|
@@ -734,12 +736,23 @@ type ObjectBindingTextureSlot = {
|
|
|
734
736
|
};
|
|
735
737
|
type ObjectBindingTextureChannel = "baseColor" | "metalness" | "roughness" | "emissive" | "alpha" | "normal" | "bump" | "ao" | "displacement" | "clearcoat" | "clearcoatRoughness" | "clearcoatNormal" | "anisotropy" | "transmission" | "thickness" | "sheenColor" | "sheenRoughness" | "specularIntensity" | "specularColor";
|
|
736
738
|
type ObjectBindingTransform = {
|
|
737
|
-
/** Local
|
|
739
|
+
/** Local xy/xz/yz shear, applied between rotation and scale. Preserves rigid world edits under non-uniform parents. */
|
|
740
|
+
shear?: [number, number, number];
|
|
741
|
+
/** Local-space node-origin position, or the reference-pose position when pivot is set. */
|
|
738
742
|
position?: [number, number, number];
|
|
739
743
|
/** Local-space Euler rotation in radians. */
|
|
740
744
|
rotation?: [number, number, number];
|
|
741
745
|
/** Local-space scale. */
|
|
742
746
|
scale?: [number, number, number];
|
|
747
|
+
/**
|
|
748
|
+
* Opt-in centered editing. Legacy transforms without this field remain direct
|
|
749
|
+
* local P/R/S. The reference offset keeps position independent of later
|
|
750
|
+
* rotation/scale edits: rendered origin = position + offset - R * H * S * point (H is shear).
|
|
751
|
+
*/
|
|
752
|
+
pivot?: {
|
|
753
|
+
point: [number, number, number];
|
|
754
|
+
offset: [number, number, number];
|
|
755
|
+
};
|
|
743
756
|
};
|
|
744
757
|
declare const MATERIAL_SIDES: readonly ["front", "back", "double"];
|
|
745
758
|
type ObjectBindingMaterialSide = (typeof MATERIAL_SIDES)[number];
|
|
@@ -844,6 +857,7 @@ type ObjectBinding = {
|
|
|
844
857
|
group?: string;
|
|
845
858
|
tags?: string[];
|
|
846
859
|
status?: ObjectBindingStatus;
|
|
860
|
+
removed?: boolean;
|
|
847
861
|
visible?: boolean;
|
|
848
862
|
selectable?: boolean;
|
|
849
863
|
hoverable?: boolean;
|
|
@@ -593,6 +593,8 @@ type ViewerAnimationsProps = {
|
|
|
593
593
|
setSpeed: (speed: number, clipName?: string) => void;
|
|
594
594
|
seek: (time: number, clipName?: string) => void;
|
|
595
595
|
handleAnimationsReady: (controls: AnimationControls) => void;
|
|
596
|
+
/** Disconnect the previous model while the next one is loading. */
|
|
597
|
+
clearAnimations: () => void;
|
|
596
598
|
};
|
|
597
599
|
declare function useViewerAnimations(): ViewerAnimationsProps;
|
|
598
600
|
|
|
@@ -734,12 +736,23 @@ type ObjectBindingTextureSlot = {
|
|
|
734
736
|
};
|
|
735
737
|
type ObjectBindingTextureChannel = "baseColor" | "metalness" | "roughness" | "emissive" | "alpha" | "normal" | "bump" | "ao" | "displacement" | "clearcoat" | "clearcoatRoughness" | "clearcoatNormal" | "anisotropy" | "transmission" | "thickness" | "sheenColor" | "sheenRoughness" | "specularIntensity" | "specularColor";
|
|
736
738
|
type ObjectBindingTransform = {
|
|
737
|
-
/** Local
|
|
739
|
+
/** Local xy/xz/yz shear, applied between rotation and scale. Preserves rigid world edits under non-uniform parents. */
|
|
740
|
+
shear?: [number, number, number];
|
|
741
|
+
/** Local-space node-origin position, or the reference-pose position when pivot is set. */
|
|
738
742
|
position?: [number, number, number];
|
|
739
743
|
/** Local-space Euler rotation in radians. */
|
|
740
744
|
rotation?: [number, number, number];
|
|
741
745
|
/** Local-space scale. */
|
|
742
746
|
scale?: [number, number, number];
|
|
747
|
+
/**
|
|
748
|
+
* Opt-in centered editing. Legacy transforms without this field remain direct
|
|
749
|
+
* local P/R/S. The reference offset keeps position independent of later
|
|
750
|
+
* rotation/scale edits: rendered origin = position + offset - R * H * S * point (H is shear).
|
|
751
|
+
*/
|
|
752
|
+
pivot?: {
|
|
753
|
+
point: [number, number, number];
|
|
754
|
+
offset: [number, number, number];
|
|
755
|
+
};
|
|
743
756
|
};
|
|
744
757
|
declare const MATERIAL_SIDES: readonly ["front", "back", "double"];
|
|
745
758
|
type ObjectBindingMaterialSide = (typeof MATERIAL_SIDES)[number];
|
|
@@ -844,6 +857,7 @@ type ObjectBinding = {
|
|
|
844
857
|
group?: string;
|
|
845
858
|
tags?: string[];
|
|
846
859
|
status?: ObjectBindingStatus;
|
|
860
|
+
removed?: boolean;
|
|
847
861
|
visible?: boolean;
|
|
848
862
|
selectable?: boolean;
|
|
849
863
|
hoverable?: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { c as ModelViewerLabels, R as ReducedMotionSetting } from './materialVariants-
|
|
3
|
-
export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey } from './materialVariants-
|
|
4
|
-
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-
|
|
5
|
-
export { a as ViewerModelBounds } from './modelInfo-
|
|
2
|
+
import { c as ModelViewerLabels, R as ReducedMotionSetting } from './materialVariants-DjTuiWmN.mjs';
|
|
3
|
+
export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey } from './materialVariants-DjTuiWmN.mjs';
|
|
4
|
+
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-CcYpydB7.mjs';
|
|
5
|
+
export { a as ViewerModelBounds } from './modelInfo-CcYpydB7.mjs';
|
|
6
6
|
import { PresetsType } from '@react-three/drei/helpers/environment-assets';
|
|
7
7
|
|
|
8
8
|
type SimpleModelViewerProps = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { c as ModelViewerLabels, R as ReducedMotionSetting } from './materialVariants-
|
|
3
|
-
export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey } from './materialVariants-
|
|
4
|
-
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-
|
|
5
|
-
export { a as ViewerModelBounds } from './modelInfo-
|
|
2
|
+
import { c as ModelViewerLabels, R as ReducedMotionSetting } from './materialVariants-DjTuiWmN.js';
|
|
3
|
+
export { D as DEFAULT_MODEL_VIEWER_LABELS, M as MaterialVariantGroup, a as MaterialVariantOption, b as ModelViewerLabelKey } from './materialVariants-DjTuiWmN.js';
|
|
4
|
+
import { V as ViewerLoading, c as ViewerReveal, M as ModelFormat, b as ViewerModelInfo } from './modelInfo-BQ5UZu95.js';
|
|
5
|
+
export { a as ViewerModelBounds } from './modelInfo-BQ5UZu95.js';
|
|
6
6
|
import { PresetsType } from '@react-three/drei/helpers/environment-assets';
|
|
7
7
|
|
|
8
8
|
type SimpleModelViewerProps = {
|