three-live 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/three-author-engine.js +57 -39
- package/dist/three-author.cjs +52 -34
- package/dist/three-author.d.ts +2 -1
- package/dist/three-author.js +52 -34
- package/dist/three-convert.cjs +55 -37
- package/dist/three-convert.d.ts +2 -1
- package/dist/three-convert.js +55 -37
- package/dist/three-live-animation.cjs +7 -7
- package/dist/three-live-animation.d.ts +2 -1
- package/dist/three-live-animation.js +7 -7
- package/dist/three-live-animation.min.js +7 -7
- package/dist/three-live-cad.cjs +2 -2
- package/dist/three-live-cad.d.ts +2 -1
- package/dist/three-live-cad.js +2 -2
- package/dist/three-live-cad.min.js +2 -2
- package/dist/three-live-element.cjs +24 -6
- package/dist/three-live-element.d.ts +2 -1
- package/dist/three-live-element.js +24 -6
- package/dist/three-live-full.cjs +81 -63
- package/dist/three-live-full.js +81 -63
- package/dist/three-live-full.min.js +81 -63
- package/dist/three-live-studio.cjs +18 -18
- package/dist/three-live-studio.d.ts +2 -1
- package/dist/three-live-studio.js +18 -18
- package/dist/three-live-studio.min.js +18 -18
- package/dist/three-live-viewer.cjs +24 -6
- package/dist/three-live-viewer.d.ts +2 -1
- package/dist/three-live-viewer.js +24 -6
- package/dist/three-live-viewer.min.js +24 -6
- package/dist/three-live.cjs +55 -37
- package/dist/three-live.js +55 -37
- package/dist/three-live.min.js +55 -37
- package/dist/three-view.cjs +24 -6
- package/dist/three-view.d.ts +2 -1
- package/dist/three-view.js +24 -6
- package/dist/three-xr.cjs +49 -31
- package/dist/three-xr.d.ts +2 -1
- package/dist/three-xr.js +49 -31
- package/package.json +1 -1
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
"use strict";var
|
|
18
|
-
out vec2 vNDC;void main(){vec2 p=vec2((gl_VertexID<<1)&2,gl_VertexID&2);vNDC=p*2.-1.;gl_Position=vec4(vNDC,.999999,1.);}`)),t.attachShader(
|
|
19
|
-
precision highp float;in vec2 vNDC;uniform mat4 uInvVP;uniform vec3 uCameraPos;uniform sampler2D uSkyboxMap;uniform float uExposure;out vec4 fragColor;vec2 eqUV(vec3 d){return vec2(atan(d.x,d.z)/6.2831853+.5,asin(clamp(d.y,-1.,1.))/3.1415926+.5);}void main(){vec4 fp=uInvVP*vec4(vNDC,1.,1.);vec3 dir=normalize(fp.xyz/fp.w-uCameraPos);fragColor=vec4(pow(texture(uSkyboxMap,eqUV(dir)).rgb*uExposure,vec3(1./2.2)),1.);}`)),t.linkProgram(
|
|
17
|
+
"use strict";var Oe=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Zt=Object.getOwnPropertyNames;var Jt=Object.prototype.hasOwnProperty;var en=(e,t)=>{for(var n in t)Oe(e,n,{get:t[n],enumerable:!0})},tn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zt(t))!Jt.call(e,o)&&o!==n&&Oe(e,o,{get:()=>t[o],enumerable:!(r=Qt(t,o))||r.enumerable});return e};var nn=e=>tn(Oe({},"__esModule",{value:!0}),e);var Wn={};en(Wn,{InteractivityVM:()=>be,applyMeshoptFilter:()=>Ze,computeOutlineClipOffset:()=>Wt,contactShadowPlugin:()=>at,decodeMeshoptBuffer:()=>Je,decodeMeshoptGLB:()=>Pe,encodeMeshoptBuffer:()=>Dt,environmentMapPlugin:()=>Ge,evaluateKawaseBloom:()=>Ht,extractMaterialVariants:()=>st,extractPrimitiveVariantMappings:()=>$t,getEnvironmentSH:()=>ht,getInteractivityVM:()=>Ie,hotspotPlugin:()=>We,interactivityPlugin:()=>qe,materialsPlugin:()=>Qe,meshoptDecoder:()=>Ue,meshoptPlugin:()=>et,parseHexRgb:()=>rt,parseSafeGltfPointer:()=>pe,postprocessingPlugin:()=>ot,registerMaterialShader:()=>St,selectMaterialVariant:()=>jt,sendInteractivityEvent:()=>Ye,setEnvironmentSH:()=>ve,variantsPlugin:()=>ct,webxrPlugin:()=>ut});module.exports=nn(Wn);var Ae="__THREE_LIVE_REGISTRY__";function ce(){let e=typeof globalThis<"u"?globalThis:{};if(!e[Ae]){let t={plugins:[],decoders:new Map};try{Object.defineProperty(e,Ae,{value:t,writable:!1,configurable:!1,enumerable:!1})}catch{e[Ae]=t}}return e[Ae]}var $n=ce().plugins;function Z(e){let t=ce().plugins;t.some(n=>n.name===e.name)||t.push(e),e.onRegister?.()}function mt(){return ce().plugins}function ue(){let e=new Float32Array(16);return e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function le(e,t,n){let r=t[0],o=t[1],a=t[2],m=t[3],c=t[4],i=t[5],u=t[6],s=t[7],f=t[8],l=t[9],b=t[10],d=t[11],p=t[12],g=t[13],M=t[14],I=t[15],v=n[0],R=n[1],E=n[2],N=n[3];return e[0]=v*r+R*c+E*f+N*p,e[1]=v*o+R*i+E*l+N*g,e[2]=v*a+R*u+E*b+N*M,e[3]=v*m+R*s+E*d+N*I,v=n[4],R=n[5],E=n[6],N=n[7],e[4]=v*r+R*c+E*f+N*p,e[5]=v*o+R*i+E*l+N*g,e[6]=v*a+R*u+E*b+N*M,e[7]=v*m+R*s+E*d+N*I,v=n[8],R=n[9],E=n[10],N=n[11],e[8]=v*r+R*c+E*f+N*p,e[9]=v*o+R*i+E*l+N*g,e[10]=v*a+R*u+E*b+N*M,e[11]=v*m+R*s+E*d+N*I,v=n[12],R=n[13],E=n[14],N=n[15],e[12]=v*r+R*c+E*f+N*p,e[13]=v*o+R*i+E*l+N*g,e[14]=v*a+R*u+E*b+N*M,e[15]=v*m+R*s+E*d+N*I,e}function rn(e,t,n,r){let o=t[0],a=t[1],m=t[2],c=t[3],i=o+o,u=a+a,s=m+m,f=o*i,l=o*u,b=o*s,d=a*u,p=a*s,g=m*s,M=c*i,I=c*u,v=c*s,R=r[0],E=r[1],N=r[2];return e[0]=(1-(d+g))*R,e[1]=(l+v)*R,e[2]=(b-I)*R,e[3]=0,e[4]=(l-v)*E,e[5]=(1-(f+g))*E,e[6]=(p+M)*E,e[7]=0,e[8]=(b+I)*N,e[9]=(p-M)*N,e[10]=(1-(f+d))*N,e[11]=0,e[12]=n[0],e[13]=n[1],e[14]=n[2],e[15]=1,e}function fe(e,t){let n=t[0],r=t[1],o=t[2],a=t[4],m=t[5],c=t[6],i=t[8],u=t[9],s=t[10],f=s*m-c*u,l=-s*a+c*i,b=u*a-m*i,d=n*f+r*l+o*b;return d&&(d=1/d,e[0]=f*d,e[1]=l*d,e[2]=b*d,e[3]=(-s*r+o*u)*d,e[4]=(s*n-o*i)*d,e[5]=(-u*n+r*i)*d,e[6]=(c*r-o*m)*d,e[7]=(-c*n+o*a)*d,e[8]=(m*n-r*a)*d),e}function dt(e,t){let n=t[0],r=t[1],o=t[2],a=t[3],m=t[4],c=t[5],i=t[6],u=t[7],s=t[8],f=t[9],l=t[10],b=t[11],d=t[12],p=t[13],g=t[14],M=t[15],I=n*c-r*m,v=n*i-o*m,R=n*u-a*m,E=r*i-o*c,N=r*u-a*c,O=o*u-a*i,k=s*p-f*d,C=s*g-l*d,U=s*M-b*d,V=f*g-l*p,B=f*M-b*p,W=l*M-b*g,G=I*W-v*B+R*V+E*U-N*C+O*k;return G?(G=1/G,e[0]=(c*W-i*B+u*V)*G,e[1]=(o*B-r*W-a*V)*G,e[2]=(p*O-g*N+M*E)*G,e[3]=(l*N-f*O-b*E)*G,e[4]=(i*U-m*W-u*C)*G,e[5]=(n*W-o*U+a*C)*G,e[6]=(g*R-d*O-M*v)*G,e[7]=(s*O-l*R+b*v)*G,e[8]=(m*B-c*U+u*k)*G,e[9]=(r*U-n*B-a*k)*G,e[10]=(d*N-p*R+M*I)*G,e[11]=(f*R-s*N-b*I)*G,e[12]=(c*C-m*V-i*k)*G,e[13]=(n*V-r*C+o*k)*G,e[14]=(p*v-d*E-g*I)*G,e[15]=(s*E-f*v+l*I)*G,e):null}function Fe(e,t){let n=Array.isArray(e?.nodes)?e.nodes.length:0,r=[];for(let s=0;s<n;s++)r.push(ue());if(n===0)return r;let o=new Set;for(let s of e.nodes)if(Array.isArray(s.children))for(let f of s.children)o.add(f);let a=new Set,m=128,c=(s,f,l=0)=>{if(l>m||s<0||s>=n||a.has(s))return;a.add(s);let b=e.nodes[s];if(!b)return;let d=ue();if(t&&t[s])d.set(t[s]);else if(b.matrix&&b.matrix.length===16)d.set(b.matrix);else{let g=b.translation||[0,0,0],M=b.rotation||[0,0,0,1],I=b.scale||[1,1,1];rn(d,M,g,I)}let p=r[s];if(f?le(p,f,d):p.set(d),Array.isArray(b.children))for(let g of b.children)typeof g=="number"&&c(g,p,l+1)},i=[],u=e.scenes&&e.scenes[e.scene!==void 0?e.scene:0];if(u&&Array.isArray(u.nodes))i.push(...u.nodes);else for(let s=0;s<n;s++)o.has(s)||i.push(s);for(let s of i)c(s,null);for(let s=0;s<n;s++)!o.has(s)&&!i.includes(s)&&c(s,null);return r}var Be=new WeakMap;function ve(e,t){let n=t instanceof Float32Array?t:new Float32Array(t);Be.set(e,n)}function ht(e){return Be.get(e)}async function on(e,t){if(!t)return null;let n;if(typeof t=="string")if(typeof fetch<"u"&&typeof createImageBitmap=="function"){let a=await(await fetch(t)).blob();n=await createImageBitmap(a)}else if(typeof Image<"u")n=await new Promise((o,a)=>{let m=new Image;m.crossOrigin="anonymous",m.onload=()=>o(m),m.onerror=a,m.src=t});else return null;else n=t;let r=e.createTexture();return e.bindTexture(3553,r),e.texImage2D(3553,0,6408,6408,5121,n),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071),e.texParameteri(3553,10241,9987),e.texParameteri(3553,10240,9729),e.generateMipmap(3553),r}var De=new WeakMap,pt=new Float32Array(16);async function bt(e,t,n){let r=n?await on(e.gl,n):null;e[t]&&e.gl.deleteTexture(e[t]),e[t]=r}var Ge={name:"environment-map",onContextRestored(e){De.delete(e)},setEnvironmentImage(e,t){return bt(e,"environmentTexture",t)},setSkyboxImage(e,t){return bt(e,"skyboxTexture",t)},onBeforeDrawScene(e,t,n,r,o){if(!e.skyboxTexture||typeof t.createProgram!="function")return;let a=De.get(t);if(!a){let f=(d,p)=>{let g=t.createShader(d);return t.shaderSource(g,p),t.compileShader(g),g},l=t.createProgram();t.attachShader(l,f(35633,`#version 300 es
|
|
18
|
+
out vec2 vNDC;void main(){vec2 p=vec2((gl_VertexID<<1)&2,gl_VertexID&2);vNDC=p*2.-1.;gl_Position=vec4(vNDC,.999999,1.);}`)),t.attachShader(l,f(35632,`#version 300 es
|
|
19
|
+
precision highp float;in vec2 vNDC;uniform mat4 uInvVP;uniform vec3 uCameraPos;uniform sampler2D uSkyboxMap;uniform float uExposure;out vec4 fragColor;vec2 eqUV(vec3 d){return vec2(atan(d.x,d.z)/6.2831853+.5,asin(clamp(d.y,-1.,1.))/3.1415926+.5);}void main(){vec4 fp=uInvVP*vec4(vNDC,1.,1.);vec3 dir=normalize(fp.xyz/fp.w-uCameraPos);fragColor=vec4(pow(texture(uSkyboxMap,eqUV(dir)).rgb*uExposure,vec3(1./2.2)),1.);}`)),t.linkProgram(l);let b=typeof t.createVertexArray=="function"?t.createVertexArray():null;a={program:l,vao:b},De.set(t,a)}let m=dt(pt,n)||pt;t.depthMask(!1),t.useProgram(a.program),a.vao&&t.bindVertexArray(a.vao),t.activeTexture(33984),t.bindTexture(3553,e.skyboxTexture);let c=t.getUniformLocation(a.program,"uSkyboxMap");c&&t.uniform1i(c,0);let i=t.getUniformLocation(a.program,"uInvVP");i&&t.uniformMatrix4fv(i,!1,m);let u=t.getUniformLocation(a.program,"uCameraPos");u&&t.uniform3f(u,r[0],r[1],r[2]);let s=t.getUniformLocation(a.program,"uExposure");s&&t.uniform1f(s,e.exposure??1),t.drawArrays(4,0,3),t.depthMask(!0)},onResolveShader(e,t,n,r){if(r.includes("evalSHIrradiance"))return null;let o=r.replace("out vec4 fragColor;",`uniform vec3 uSH[9];
|
|
20
20
|
uniform int uHasSH;
|
|
21
21
|
out vec4 fragColor;`).replace("void main(){",`vec3 integrateBRDFApprox(vec3 f0,float r,float NoV){vec4 c0=vec4(-1.,-.0275,-.572,.022),c1=vec4(1.,.0425,1.04,-.04),rv=r*c0+c1;float a=min(rv.x*rv.x,exp2(-9.28*NoV))*rv.x+rv.y;vec2 ab=vec2(-1.04,1.04)*a+rv.zw;return f0*ab.x+vec3(ab.y);}
|
|
22
22
|
vec3 evalSHIrradiance(vec3 n){return max(vec3(0.),uSH[0]+uSH[1]*n.y+uSH[2]*n.z+uSH[3]*n.x+uSH[4]*(n.x*n.y)+uSH[5]*(n.y*n.z)+uSH[6]*(3.*n.z*n.z-1.)+uSH[7]*(n.x*n.z)+uSH[8]*(n.x*n.x-n.y*n.y));}
|
|
23
|
-
void main(){`);return
|
|
23
|
+
void main(){`);return o=o.replace(`if(uHasEnvironmentMap==1){
|
|
24
24
|
specularIBL=texture(uEnvironmentMap,equirectangularUV(R)).rgb*(F*brdf.x+brdf.y);
|
|
25
25
|
envDiffuse=texture(uEnvironmentMap,equirectangularUV(N)).rgb;
|
|
26
26
|
}`,`if(uHasEnvironmentMap==1){
|
|
@@ -29,15 +29,15 @@ envDiffuse=uHasSH==1?evalSHIrradiance(N):textureLod(uEnvironmentMap,equirectangu
|
|
|
29
29
|
}else if(uHasSH==1){
|
|
30
30
|
specularIBL=getStudioRadiance(R,roughness)*integrateBRDFApprox(F,roughness,NoV);
|
|
31
31
|
envDiffuse=evalSHIrradiance(N);
|
|
32
|
-
}`),{vs:n,fs:r}},onBeforeDrawPrimitive(e,t,n,o,r,i){let l=ke.get(e),a=e.getUniformLocation(t,"uHasSH");if(l&&l.length>=27){a&&e.uniform1i(a,1);let u=e.getUniformLocation(t,"uSH");u&&e.uniform3fv(u,l)}else a&&e.uniform1i(a,0)},onAttributeChanged(e,t,n,o){t==="environment-image"&&e.viewer?this.setEnvironmentImage?.(e.viewer,o):t==="skybox-image"&&e.viewer&&this.setSkyboxImage?.(e.viewer,o)}};var Ue=new WeakMap;function Fe(e,t){let n=t||e.viewer;if(!n||typeof n.projectPointToScreen!="function")return;let o=e.mockHotspots||e.querySelectorAll('[slot^="hotspot-"], [data-position]');for(let r=0;r<o.length;r++){let i=o[r],l=i.getAttribute("data-position");if(!l)continue;let a=l.trim().split(/\s+/).map(s=>parseFloat(s.replace(/m$/,"")));if(a.length<3||a.some(isNaN))continue;let u=i.getAttribute("data-normal"),f;if(u){let s=u.trim().split(/\s+/).map(p=>parseFloat(p));s.length>=3&&!s.some(isNaN)&&(f=[s[0],s[1],s[2]])}let c=n.projectPointToScreen([a[0],a[1],a[2]],f);i.style.position="absolute",i.style.left="0",i.style.top="0",i.style.transform=`translate(-50%, -50%) translate3d(${c.x}px, ${c.y}px, 0)`,i.style.zIndex="3",c.visible?(i.style.opacity="1",i.style.pointerEvents="auto",i.removeAttribute("data-occluded")):(i.style.opacity="0",i.style.pointerEvents="none",i.setAttribute("data-occluded",""))}}var Ce={name:"hotspots",updateHotspotsForElement:Fe,onElementConnected(e){if(typeof MutationObserver>"u"||!e)return;let t=new MutationObserver(()=>{Fe(e)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-position","data-normal"]}),Ue.set(e,t)},onCameraChange(e,t){t&&Fe(t,e)},onElementDisconnected(e){let t=Ue.get(e);t&&(t.disconnect(),Ue.delete(e))}};function Q(e,t,n,o){let r=typeof e=="number"&&Number.isFinite(e)?e:o;return Math.max(t,Math.min(n,r))}function Xt(e){return Array.isArray(e)&&e.length>=3&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&Number.isFinite(e[2])}function Oe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function Wt(e,t=256){return typeof e=="string"&&e.length>0?e.slice(0,t):void 0}function mt(e){let t=Oe(e);if(!t)return null;let n=t.target;return{target:Xt(n)?[n[0],n[1],n[2]]:typeof n=="string"&&n.length>0&&n.length<=256?n:[0,0,0],radius:Q(t.radius,.01,50,.5),speed:Q(t.speed,-20,20,.5),height:Q(t.height,-10,10,0),phase:Q(t.phase,-1e6,1e6,0),faceCenter:t.faceCenter===!0}}function he(e,t){let n=Wt(e,16)?.trim();if(!n)return t;let o=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n);return o?`#${o[1].toLowerCase()}`:t}function De(e){if(e===!1||e===null||e===void 0)return null;if(typeof e=="number")return!Number.isFinite(e)||e<=0?null:{enabled:!0,strength:Q(e,0,5,.35),threshold:.8,radius:.5};if(e===!0)return{enabled:!0,strength:.35,threshold:.8,radius:.5};let t=Oe(e);if(!t||t.enabled===!1)return null;let n=Q(t.strength??t.intensity,0,5,.35);return n<=0?null:{enabled:!0,strength:n,threshold:Q(t.threshold,0,4,.8),radius:Q(t.radius,0,2,.5)}}function ye(e){if(!e)return null;if(typeof e=="string")return{enabled:!0,color:he(e,"#38bdf8"),thickness:3,pulse:!1};if(e===!0)return{enabled:!0,color:"#38bdf8",thickness:3,pulse:!1};let t=Oe(e);return!t||t.enabled===!1?null:{enabled:!0,color:he(t.color,"#38bdf8"),thickness:Q(t.thickness??t.width,.5,20,3),pulse:t.pulse===!0}}function dt(e,t,n,o){let r=t[0],i=t[1],l=t[2],a=t[3],u=n[0],f=n[1],c=n[2],s=n[3],p=r*u+i*f+l*c+a*s;if(p<0&&(u=-u,f=-f,c=-c,s=-s,p=-p),Math.abs(p)>=1)return e[0]=r,e[1]=i,e[2]=l,e[3]=a,e;let v=Math.acos(p),h=Math.sqrt(1-p*p);if(Math.abs(h)<.001)return e[0]=.5*(r+u),e[1]=.5*(i+f),e[2]=.5*(l+c),e[3]=.5*(a+s),e;let b=Math.sin((1-o)*v)/h,T=Math.sin(o*v)/h;return e[0]=r*b+u*T,e[1]=i*b+f*T,e[2]=l*b+c*T,e[3]=a*b+s*T,e}var pt=1024,Be=256,xe=2048,$t=128,jt=64,Kt=16,qt=1e4,Yt=8,Z=new Set(["__proto__","constructor","prototype"]),bt={neg:e=>-e,abs:Math.abs,sign:Math.sign,floor:Math.floor,ceil:Math.ceil,round:Math.round,trunc:Math.trunc,fract:e=>e-Math.floor(e),sqrt:e=>Math.sqrt(Math.max(0,e)),cbrt:Math.cbrt,exp:Math.exp,log:e=>e>0?Math.log(e):0,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:e=>Math.asin(Math.max(-1,Math.min(1,e))),acos:e=>Math.acos(Math.max(-1,Math.min(1,e))),atan:Math.atan,rad:e=>e*Math.PI/180,deg:e=>e*180/Math.PI,saturate:e=>Math.max(0,Math.min(1,e))},ht={add:(e,t)=>e+t,sub:(e,t)=>e-t,mul:(e,t)=>e*t,div:(e,t)=>Math.abs(t)<1e-12?0:e/t,rem:(e,t)=>Math.abs(t)<1e-12?0:e%t,mod:(e,t)=>Math.abs(t)<1e-12?0:e%t,min:Math.min,max:Math.max,pow:Math.pow,atan2:Math.atan2},ge={translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]},Te=(e,t)=>e!==null&&typeof e=="object"&&!Z.has(t)&&Object.prototype.hasOwnProperty.call(e,t),W=e=>Array.isArray(e)?[...e]:e,Tt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&Te(e,"value")?e.value:e,z=(e,t)=>Te(e.configuration,t)?Tt(e.configuration[t]):void 0,R=(e,t=0)=>{let n=Number(e);return Number.isFinite(n)?n:t},ee=e=>Math.max(0,Math.min(1,e)),$=e=>typeof e=="boolean"?e:typeof e=="number"?e!==0&&!Number.isNaN(e):typeof e=="string"?e.length>0&&e!=="false":!!e;function se(e){if(typeof e!="string"||!e.startsWith("/"))return null;let t=[];for(let n of e.slice(1).split("/")){let o=n.replace(/~1/g,"/").replace(/~0/g,"~");if(!o||Z.has(o)||Z.has(n))return null;t.push(o)}return{segments:t}}var ae=(e,t)=>{if(e===void 0||!/^\d+$/.test(e))return-1;let n=Number(e);return Number.isSafeInteger(n)&&n>=0&&n<t?n:-1},yt=e=>{let t=R(e[0]),n=R(e[1]),o=R(e[2]),r=R(e[3],1),i=Math.hypot(t,n,o,r);return i>1e-8?[t/i,n/i,o/i,r/i]:[0,0,0,1]},xt=(e,t,n,o)=>{if(typeof e=="number"&&typeof t=="number")return e+(t-e)*n;if(Array.isArray(e)&&Array.isArray(t)){if(o&&e.length===4&&t.length===4){let r=[0,0,0,1];return dt(r,yt(e),yt(t),n),r}return e.slice(0,t.length).map((r,i)=>r+(t[i]-r)*n)}return n>=.5?t:e},ze=(e,t,n)=>Array.isArray(e)&&Array.isArray(t)?e.slice(0,t.length).map((o,r)=>n(R(o),R(t[r]))):Array.isArray(e)?e.map(o=>n(R(o),R(t))):Array.isArray(t)?t.map(o=>n(R(e),R(o))):n(R(e),R(t)),Qt=(e,t)=>Array.isArray(e)?e.map(n=>t(R(n))):t(R(e)),gt=(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,o)=>Math.abs(n-t[o])<=1e-6):e===t,ue=class{constructor(t,n,o){let r=Array.isArray(o.nodes)?o.nodes:[];if(r.length>pt)throw new Error(`SecurityError: Exceeds MAX_GRAPH_NODES (${pt})`);let i=Array.isArray(o.variables)?o.variables:[];if(i.length>Be)throw new Error(`SecurityError: Exceeds MAX_VARIABLES (${Be})`);let l=Array.isArray(o.declarations)?o.declarations:[],a=Array.isArray(o.events)?o.events:[],u=new Map,f=new Map,c=new Map,s=new Map,p=new Map,v=new Map,h=[],b=[],T=new Map,k=1,S=0,A=0,L=0,P=0,_=!1,N=!1,D=!1;i.forEach((x,g)=>{if(!x||typeof x!="object")return;let E=W(Tt(x.value));u.set(g,E);let w=x.id??x.name;typeof w=="string"&&w&&!Z.has(w)&&u.set(w,E)}),(n?.nodes||[]).forEach((x,g)=>{for(let E of x?.children||[])typeof E=="number"&&T.set(E,g)});let V=x=>x.op||typeof x.declaration=="number"&&l[x.declaration]?.op||"",O=(x,g,E)=>{if(Z.has(g))return;let w=f.get(x);w||f.set(x,w=Object.create(null)),w[g]=E},j=(x,g)=>{if(typeof x!="number"&&typeof x!="string"||typeof x=="string"&&Z.has(x)||!u.has(x)&&u.size>=Be*2)return;let E=W(g);if(u.set(x,E),typeof x=="number"){let w=i[x]?.id??i[x]?.name;typeof w=="string"&&!Z.has(w)&&u.set(w,E)}},X=x=>typeof x=="number"?a[x]?.id??String(x):typeof x=="string"?/^\d+$/.test(x)&&a[Number(x)]?.id?a[Number(x)].id:x:"",J=(x,g)=>{for(let E=x,w=0;E!==void 0&&E>=0&&w<128;E=T.get(E),w++)if(E===g)return!0;return!1},G=x=>{for(let g=h.length-1;g>=0;g--)h[g].key===x&&h.splice(g,1)},rt=x=>{G(x.key),h.length>=$t&&h.shift(),h.push(x)},_e=x=>{let g=se(x)?.segments;if(g){if(g[0]==="nodes"&&Array.isArray(n?.nodes)){let E=n.nodes[ae(g[1],n.nodes.length)];if(!E)return;let w=g[2];if(w in ge){let y=ge[w],m=E[w]||y;return y.map((d,M)=>R(m[M],d))}if(w==="weights"){let y=Array.isArray(E.weights)?E.weights:[0],m=g.length===4?ae(g[3],64):-2;return m===-2?y.map(d=>R(d)):m>=0?R(y[m]):void 0}if(w==="visible"||w==="extensions"&&g[3]==="KHR_node_visibility"&&g[4]==="visible")return E.extensions?.KHR_node_visibility?.visible??E.visible??!0}else if(g[0]==="materials"&&Array.isArray(n?.materials)){let E=n.materials[ae(g[1],n.materials.length)];if(!E)return;let w=E.pbrMetallicRoughness||{};if(g[2]==="pbrMetallicRoughness"){if(g[3]==="baseColorFactor"){let y=w.baseColorFactor||[1,1,1,1];return[R(y[0],1),R(y[1],1),R(y[2],1),R(y[3],1)]}if(g[3]==="metallicFactor"||g[3]==="roughnessFactor")return R(w[g[3]],1)}if(g[2]==="emissiveFactor"){let y=E.emissiveFactor||[0,0,0];return[R(y[0]),R(y[1]),R(y[2])]}if(g[2]==="alphaCutoff")return R(E.alphaCutoff,.5)}}},fe=(x,g)=>{let E=se(x)?.segments;if(!E)return!1;if(E[0]==="nodes"&&Array.isArray(n?.nodes)){let w=ae(E[1],n.nodes.length),y=n.nodes[w];if(!y)return!1;let m=E[2];if(m in ge&&Array.isArray(g)){let d=ge[m];if(g.length<d.length)return!1;let M=d.map((C,B)=>R(g[B],C));if(m==="rotation"){let C=Math.hypot(...M);M=C>1e-8?M.map(B=>B/C):[0,0,0,1]}y[m]=M,delete y.matrix;let F=t?.initialNodeTransforms?.[w];return F&&(F[m[0]]=[...M]),_=!0,!0}if(m==="weights"){Array.isArray(y.weights)||(y.weights=[]);let d=(M,F)=>{for(let C of t?.meshes||[])if(C.nodeIndex===w)for(let B of C.primitives||[])B.pluginData?.morph?.weights&&(B.pluginData.morph.weights[M]=F)};if(E.length===4){let M=ae(E[3],64);if(M<0)return!1;d(M,y.weights[M]=R(g))}else if(Array.isArray(g))y.weights=g.slice(0,64).map(M=>R(M)),y.weights.forEach((M,F)=>d(F,M));else return!1;return D=!0,!0}if(m==="visible"||m==="extensions"&&E[3]==="KHR_node_visibility"&&E[4]==="visible"){let d=$(g);return y.visible=d,(!y.extensions||typeof y.extensions!="object")&&(y.extensions={}),y.extensions.KHR_node_visibility={visible:d},N=!0,!0}}else if(E[0]==="materials"&&Array.isArray(n?.materials)){let w=ae(E[1],n.materials.length),y=n.materials[w];if(!y)return!1;let m=y.pbrMetallicRoughness||(y.pbrMetallicRoughness={}),d=M=>{for(let F of t?.meshes||[])for(let C of F.primitives||[])(C.materialIndex??0)===w&&M(C)};if(E[2]==="pbrMetallicRoughness"){if(E[3]==="baseColorFactor"&&Array.isArray(g)&&g.length>=3){let M=[ee(R(g[0],1)),ee(R(g[1],1)),ee(R(g[2],1)),g[3]!==void 0?ee(R(g[3],1)):m.baseColorFactor?.[3]??1];return m.baseColorFactor=M,d(F=>F.baseColor=[...M]),D=!0}if(E[3]==="metallicFactor"||E[3]==="roughnessFactor"){let M=E[3]==="metallicFactor",F=ee(R(g,M?0:.5));return m[E[3]]=F,d(C=>C[M?"metallic":"roughness"]=F),D=!0}}if(E[2]==="emissiveFactor"&&Array.isArray(g)&&g.length>=3)return y.emissiveFactor=[0,1,2].map(M=>Math.max(0,R(g[M]))),D=!0;if(E[2]==="alphaCutoff")return y.alphaCutoff=ee(R(g,.5)),D=!0}return!1},Ie=(x,g,E=new Set)=>{let w=z(g,"pointer");if(typeof w!="string"||!w.startsWith("/"))return null;let y=w.replace(/\{([a-zA-Z0-9_]+)\}/g,(m,d)=>{let M=Math.trunc(Number(me(x,d,void 0,E)??z(g,d)));return Number.isSafeInteger(M)&&M>=0?String(M):"-1"});return se(y)?y:null},me=(x,g,E,w)=>{let y=r[x]?.values;if(!Te(y,g))return E;let m=y[g];if(m==null)return E;if(typeof m!="object"||Array.isArray(m))return W(m);let d=m;return typeof d.node=="number"?Vt(d.node,d.socket||"value",w):Te(d,"value")?W(d.value):E},Vt=(x,g,E)=>{if(x<0||x>=r.length||E.has(x)||E.size>128||++L>qt)return;let w=r[x],y=V(w);if(/^(event\/|pointer\/on|scene\/on|flow\/)/.test(y))return W(f.get(x)?.[g]);E.add(x);try{let m=(d,M=0)=>me(x,d,M,E);if(y==="variable/get"){let d=z(w,"variable")??z(w,"id");return typeof d=="number"||typeof d=="string"?W(u.get(d)):void 0}if(y==="pointer/get"){let d=Ie(x,w,E);return d?_e(d):void 0}if(y.startsWith("math/")){let d=y.slice(5);if(d in bt)return Qt(m("a"),bt[d]);if(d in ht){let M=/^(mul|div|rem|mod|pow)$/.test(d)?1:0;return ze(m("a",d==="mul"?1:0),m("b",M),ht[d])}if(d==="pi")return Math.PI;if(d==="e")return Math.E;if(d==="random")return Math.random();if(d==="clamp")return ze(ze(m("a"),m("b",m("min",0)),Math.max),m("c",m("max",1)),Math.min);if(d==="mix"||d==="quatSlerp")return xt(m("a",0),m("b",1),R(m("c",m("t",.5)),.5),d==="quatSlerp");if(d==="dot"){let M=m("a"),F=m("b");return Array.isArray(M)&&Array.isArray(F)?M.reduce((C,B,I)=>C+(B||0)*(F[I]||0),0):R(M)*R(F)}if(d==="cross"){let M=m("a",[0,0,0]),F=m("b",[0,0,0]);return Array.isArray(M)&&Array.isArray(F)?[(M[1]||0)*(F[2]||0)-(M[2]||0)*(F[1]||0),(M[2]||0)*(F[0]||0)-(M[0]||0)*(F[2]||0),(M[0]||0)*(F[1]||0)-(M[1]||0)*(F[0]||0)]:[0,0,0]}if(d==="length"){let M=m("a");return Array.isArray(M)?Math.hypot(...M):Math.abs(R(M))}if(d==="distance"){let M=m("a"),F=m("b");return Array.isArray(M)&&Array.isArray(F)?Math.hypot(...M.map((C,B)=>(C||0)-(F[B]||0))):Math.abs(R(M)-R(F))}if(d==="normalize"){let M=m("a");if(!Array.isArray(M))return R(M)>=0?1:-1;let F=Math.hypot(...M);return F>1e-8?M.map(C=>C/F):M.map(()=>0)}if(d.startsWith("combine"))return["a","b","c","d"].slice(0,Number(d[7])||2).map(M=>R(m(M)));if(d.startsWith("extract")){let M=m("a");return Array.isArray(M)?M[g==="0"||g==="x"?0:g==="1"||g==="y"?1:g==="2"||g==="z"?2:3]??0:0}if(d==="eq")return gt(m("a"),m("b"));if(d==="ne")return!gt(m("a"),m("b"));if(d==="lt")return R(m("a"))<R(m("b"));if(d==="le")return R(m("a"))<=R(m("b"));if(d==="gt")return R(m("a"))>R(m("b"));if(d==="ge")return R(m("a"))>=R(m("b"));if(d==="isNaN")return Number.isNaN(Number(m("a")));if(d==="isInf"){let M=Number(m("a"));return!Number.isFinite(M)&&!Number.isNaN(M)}return d==="and"?$(m("a",!1))&&$(m("b",!1)):d==="or"?$(m("a",!1))||$(m("b",!1)):d==="xor"?$(m("a",!1))!==$(m("b",!1)):d==="not"?!$(m("a",!1)):d==="select"?W($(m("condition",!1))?m("a"):m("b")):void 0}return y==="type/boolToInt"||y==="type/boolToFloat"?$(m("a",!1))?1:0:y==="type/intToBool"||y==="type/floatToBool"?R(m("a",0))!==0:y==="type/intToFloat"?R(m("a",0)):y==="type/floatToInt"?Math.trunc(R(m("a",0))):void 0}finally{E.delete(x)}},de=()=>{if(_){_=!1,D=!0;let x=Ne(n);if(t){t.worldMatrices=x;for(let g of t.meshes||[])g.nodeIndex>=0&&g.nodeIndex<x.length&&(g.transform.set(x[g.nodeIndex]),ie(g.normalMatrix,g.transform))}}if(N){N=!1,D=!0;let x=n?.nodes;if(Array.isArray(t?.meshes)&&Array.isArray(x))for(let g of t.meshes){let E=!0;for(let w=g.nodeIndex,y=0;w!==void 0&&w>=0&&y<128;w=T.get(w),y++){let m=x[w];if(m?.visible===!1||m?.extensions?.KHR_node_visibility?.visible===!1){E=!1;break}}g.visible=E}}D&&(D=!1,t?.render?.())},te=(x,g={steps:0})=>{if(!x||typeof x.node!="number")return;g.steps===0&&(L=0);let E=[x],w=y=>{E.length+g.steps<xe&&E.push(y)};for(;E.length>0&&g.steps<xe;){g.steps++;let y=E.shift();if(!y||y.node<0||y.node>=r.length)continue;let m=y.node,d=r[m];if(!d)continue;let M=y.socket||"in",F=V(d),C=(I,U=void 0)=>me(m,I,U,new Set),B=(I="out")=>{let U=d.flows?.[I];U&&w(U)};switch(F){case"flow/branch":B($(C("condition",!1))?"true":"false");break;case"flow/sequence":for(let I of Object.keys(d.flows||{}).sort((U,H)=>Number(U)-Number(H)||U.localeCompare(H)))B(I);break;case"flow/switch":{let I=d.flows?.[String(C("selection",C("value",0)))]??d.flows?.default;I&&w(I);break}case"flow/for":{let I=Math.trunc(R(C("startIndex",0))),U=Math.trunc(R(C("endIndex",0))),H=Math.max(1,Math.trunc(R(C("step",1),1))),K=d.flows?.body;if(K&&U>I&&P<Yt){let Ut=Math.min(Math.ceil((U-I)/H),xe);P++;try{for(let Le=0;Le<Ut&&g.steps<xe;Le++)O(m,"index",I+Le*H),te(K,g)}finally{P--}}let it=d.flows?.completed??d.flows?.out;it&&w(it);break}case"flow/doN":{let I=M==="reset"?0:(c.get(m)||0)+1;if(c.set(m,I),O(m,"currentCount",I),O(m,"count",I),M!=="reset"){let U=Math.trunc(R(C("n",z(d,"stopIterations")??z(d,"n")??1),1));I<=U&&B()}break}case"flow/multiGate":{if(M==="reset"){v.set(m,0);break}let I=Object.keys(d.flows||{}).sort();if(!I.length)break;let U=z(d,"isRandom")?Math.floor(Math.random()*I.length):v.get(m)||0;U<I.length&&(B(I[U]),v.set(m,z(d,"isLoop")!==!1?(U+1)%I.length:U+1));break}case"flow/waitAll":{if(M==="reset"){s.delete(m);break}let I=s.get(m);I||s.set(m,I=new Set),I.add(M),I.size>=Math.max(1,Math.trunc(Number(z(d,"inputFlows")??2)||2))&&(I.clear(),B("out"),B("completed"));break}case"flow/throttle":{if(M==="reset"){p.delete(m);break}let I=Math.max(0,R(C("duration",0))),U=p.get(m);U===void 0||S-U>=I?(p.set(m,S),O(m,"lastRemainingTime",0),B()):O(m,"lastRemainingTime",Math.max(0,I-(S-U)));break}case"flow/delay":case"flow/setDelay":{if(M==="cancel"){for(let K=b.length-1;K>=0;K--)b[K].nodeIdx===m&&b.splice(K,1);O(m,"lastDelayIndex",-1);break}let I=Math.max(0,R(C("duration",z(d,"duration")??0))),U=d.flows?.done??d.flows?.out;if(I<=0){O(m,"lastDelayIndex",-1),U&&w(U);break}b.length>=jt&&b.shift();let H=k++;O(m,"lastDelayIndex",H),b.push({id:H,nodeIdx:m,rem:I,done:U}),F==="flow/setDelay"&&d.flows?.out&&d.flows?.done&&B("out");break}case"flow/cancelDelay":{let I=Math.trunc(R(C("delayIndex",-1),-1));if(I<0)b.length=0;else for(let U=b.length-1;U>=0;U--)b[U].id===I&&b.splice(U,1);B();break}case"variable/set":j(z(d,"variable")??z(d,"id"),C("value")),B();break;case"variable/interpolate":{let I=z(d,"variable")??z(d,"id"),U=C("value",C("target")),H=Math.max(0,R(C("duration",z(d,"duration")??.3),.3));I!==void 0&&U!==void 0&&rt({key:`var:${String(I)}`,varKey:I,from:W(C("from")??u.get(I)??0),to:W(U),dur:H,elapsed:0,quat:!1,linear:z(d,"easing")==="linear",done:d.flows?.done}),B();break}case"pointer/set":{let I=Ie(m,d),U=C("value");I&&U!==void 0&&(G(`ptr:${I}`),fe(I,U)),B();break}case"pointer/interpolate":{let I=Ie(m,d),U=C("value",C("target")),H=Math.max(0,R(C("duration",z(d,"duration")??.3),.3));if(I&&U!==void 0){let K=C("from")??_e(I);K!==void 0&&(H<=0?(fe(I,U),B("done")):rt({key:`ptr:${I}`,ptr:I,from:W(K),to:W(U),dur:H,elapsed:0,quat:I.endsWith("/rotation"),linear:z(d,"easing")==="linear",done:d.flows?.done}))}B();break}case"animation/start":{let I=C("animation")??z(d,"animation")??z(d,"clipName"),U=typeof I=="number"?t?.animations?.[I]?.name??n?.animations?.[I]?.name:typeof I=="string"?I:void 0;t?.playAnimation?.(U),D=!0,B();break}case"animation/stop":case"animation/resetAt":t?.pauseAnimation?.(),F==="animation/resetAt"&&t?.evaluateAnimation?.(R(C("time",0))),D=!0,B();break;case"event/send":case"customEvent/send":{let I=X(z(d,"event")??z(d,"id")),U={};for(let H of Object.keys(d.values||{}))Z.has(H)||(U[H]=C(H));I&&(typeof CustomEvent<"u"&&typeof t?.container?.dispatchEvent=="function"&&t.container.dispatchEvent(new CustomEvent("interactivityEvent",{bubbles:!0,composed:!0,detail:{id:I,values:U}})),ot(I,U,g)),B();break}default:B();break}}};this.readScenePointer=_e,this.writeScenePointer=fe,this.fireOnStart=()=>{r.forEach(x=>{V(x)==="event/onStart"&&te(x.flows?.out)}),de()},this.fireOnSelect=x=>{if(!x)return;let g=typeof x.meshIndex=="number"?x.meshIndex:-1,E=typeof x.nodeIndex=="number"?x.nodeIndex:t?.meshes?.[g]?.nodeIndex??-1;r.forEach((w,y)=>{if(!/^(pointer|event|scene)\/onSelect$/.test(V(w)))return;let m=z(w,"nodeIndex")??z(w,"node")??me(y,"nodeIndex",void 0,new Set),d=z(w,"meshName");if(typeof d=="string"&&d?x.meshName===d:m==null||Number(m)<0||Number.isNaN(Number(m))||J(E,Math.trunc(Number(m)))){if(O(y,"nodeIndex",E),O(y,"meshIndex",g),Array.isArray(x.hitPoint)){let F=[R(x.hitPoint[0]),R(x.hitPoint[1]),R(x.hitPoint[2])];O(y,"hitPoint",F),O(y,"point",F),O(y,"intersectionPoint",F)}if(Array.isArray(x.normal)){let F=[R(x.normal[0]),R(x.normal[1],1),R(x.normal[2])];O(y,"normal",F),O(y,"hitNormal",F)}typeof x.distance=="number"&&O(y,"distance",x.distance),te(w.flows?.out)}}),de()},this.receiveCustomEvent=(x,g={})=>ot(x,g,{steps:0});function ot(x,g,E){if(!(A>=Kt)){A++;try{let w=X(x);r.forEach((y,m)=>{if(!/^(customE|e)vent\/receive$/.test(V(y)))return;let d=z(y,"event")??z(y,"id");if(!(X(d)!==w&&String(d)!==String(x))){for(let[M,F]of Object.entries(g))Z.has(M)||O(m,M,W(F));te(y.flows?.out,E)}}),de()}finally{A--}}}this.tick=x=>{if(!Number.isFinite(x)||x<0)return;let g=Math.min(x,.25);S+=g,r.forEach((w,y)=>{V(w)==="event/onTick"&&(O(y,"timeDelta",g),O(y,"dt",g),O(y,"timeElapsed",S),te(w.flows?.out))});let E=[];for(let w=h.length-1;w>=0;w--){let y=h[w];y.elapsed+=g;let m=y.dur>1e-6?ee(y.elapsed/y.dur):1,d=y.linear?m:m*m*(3-2*m),M=xt(y.from,y.to,d,y.quat);y.ptr?fe(y.ptr,M):y.varKey!==void 0&&j(y.varKey,M),m>=1&&(h.splice(w,1),y.done&&E.push(y.done))}for(let w=b.length-1;w>=0;w--){let y=b[w];y.rem-=g,y.rem<=0&&(b.splice(w,1),y.done&&E.push(y.done))}for(let w of E)te(w);de()},this.dispose=()=>{h.length=0,b.length=0,u.clear(),f.clear(),c.clear(),s.clear(),p.clear(),v.clear()}}},Y=new WeakMap,ve=new WeakMap;function Zt(e,t){if(!e||typeof e!="object"||!Number.isFinite(t)||t<=0||at().some(u=>u.name==="xr-live-head-follow")||(typeof e.getAutoRotate=="function"?e.getAutoRotate():e.autoRotate)===!1)return;let o=e.gltf,r=o?.nodes;if(!Array.isArray(r)||r.length===0)return;let i=Math.min(t,.1),l=(ve.get(e)||0)+i,a=!1;for(let u=0;u<r.length;u++){let f=r[u],c=mt(f?.extras?.xr?.orbit);if(!c)continue;let s=0,p=0,v=0;if(Array.isArray(c.target))s=c.target[0],p=c.target[1],v=c.target[2];else if(typeof c.target=="string"&&c.target!=="head"){let S=r.find(A=>A?.name===c.target);Array.isArray(S?.translation)&&(s=R(S.translation[0]),p=R(S.translation[1]),v=R(S.translation[2]))}let h=c.phase+c.speed*l,b=s+Math.cos(h)*c.radius,T=p+c.height,k=v+Math.sin(h)*c.radius;if(f.translation=[b,T,k],c.faceCenter){let S=Math.atan2(s-b,v-k);f.rotation=[0,Math.sin(S*.5),0,Math.cos(S*.5)]}a=!0}if(a){ve.set(e,l);let u=Ne(o);e.worldMatrices=u;for(let f of e.meshes||[])f.nodeIndex>=0&&f.nodeIndex<u.length&&(f.transform.set(u[f.nodeIndex]),ie(f.normalMatrix,f.transform))}}function Ae(e){if(!(!e||typeof e!="object"))return Y.get(e)||Y.get(e.viewer)||Y.get(e._view)}function Ge(e,t,n){let o=Ae(e);return o?(o.receiveCustomEvent(t,n),!0):!1}var He={name:"khr-interactivity",sendInteractivityEvent:Ge,getInteractivityVM:Ae,onLoadModel(e,t){if(!e||typeof e!="object")return;Y.get(e)?.dispose(),Y.delete(e),ve.delete(e);let n=t?.extensions?.KHR_interactivity,o=Array.isArray(n?.graphs)?n.graphs[n.graph??0]:n;if(!o||!Array.isArray(o.nodes))return;let r=new ue(e,t,o);Y.set(e,r),r.fireOnStart()},onMeshSelect(e,t){Y.get(e)?.fireOnSelect(t)},onUpdate(e,t){Y.get(e)?.tick(t),Zt(e,t)},onDestroy(e,t){Y.get(t)?.dispose(),Y.delete(t),ve.delete(t)}};var le=new Map,Xe=new WeakMap;function vt(e,t){le.set(e,t)}var We={name:"materials",onBuildPrimitiveVAO(e,t,n,o,r){return(((o?.materials&&n.material!==void 0?o.materials[n.material]:null)?.extensions||{}).KHR_materials_transmission?.transmissionFactor??0)>0?{isTransmissive:!0}:null},onBeforeTransmissivePass(e,t){let n=Xe.get(e);n||(n=e.createTexture(),Xe.set(e,n));let o=Math.max(1,t.canvas.width),r=Math.max(1,t.canvas.height);e.activeTexture(33990),e.bindTexture(3553,n),e.copyTexImage2D(3553,0,6408,0,0,o,r,0),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071),e.texParameteri(3553,10241,9987),e.texParameteri(3553,10240,9729),e.generateMipmap(3553)},onResolveShader(e,t,n,o){if(!t)return null;if(t.name&&le.has(t.name)){let h=le.get(t.name);return{vs:h.vs||n,fs:h.fs||o}}let r=t.extensions||{},i=r.KHR_materials_clearcoat,l=r.KHR_materials_sheen,a=!!r.KHR_materials_transmission,u=!!r.KHR_materials_ior,f=r.KHR_materials_iridescence;if(!i&&!l&&!r.KHR_materials_unlit&&!a&&!r.KHR_materials_volume&&!u&&!r.KHR_materials_dispersion&&!f)return null;if(r.KHR_materials_unlit)return{vs:n,fs:o.replace("fragColor=vec4(color,outAlpha);","fragColor=vec4(base.rgb,outAlpha);").replace("fragColor=vec4(color,base.a);","fragColor=vec4(base.rgb,base.a);")};let c=o;if(a){let h=c.includes("uniform vec2 uViewportSize;")?"":`uniform vec2 uViewportSize;
|
|
33
|
-
`;
|
|
34
|
-
${
|
|
35
|
-
vec2 sUV=gl_FragCoord.xy/max(uViewportSize,vec2(1.));float iorB=${
|
|
32
|
+
}`),{vs:n,fs:o}},onBeforeDrawPrimitive(e,t,n,r,o,a){let m=Be.get(e),c=e.getUniformLocation(t,"uHasSH");if(m&&m.length>=27){c&&e.uniform1i(c,1);let i=e.getUniformLocation(t,"uSH");i&&e.uniform3fv(i,m)}else c&&e.uniform1i(c,0)},onAttributeChanged(e,t,n,r){t==="environment-image"&&e.viewer?this.setEnvironmentImage?.(e.viewer,r):t==="skybox-image"&&e.viewer&&this.setSkyboxImage?.(e.viewer,r)}};var ze=new WeakMap;function He(e,t){let n=t||e.viewer;if(!n||typeof n.projectPointToScreen!="function")return;let r=e.mockHotspots||e.querySelectorAll('[slot^="hotspot-"], [data-position]');for(let o=0;o<r.length;o++){let a=r[o],m=a.getAttribute("data-position");if(!m)continue;let c=m.trim().split(/\s+/).map(f=>parseFloat(f.replace(/m$/,"")));if(c.length<3||c.some(isNaN))continue;let i=a.getAttribute("data-normal"),u;if(i){let f=i.trim().split(/\s+/).map(l=>parseFloat(l));f.length>=3&&!f.some(isNaN)&&(u=[f[0],f[1],f[2]])}let s=n.projectPointToScreen([c[0],c[1],c[2]],u);a.style.position="absolute",a.style.left="0",a.style.top="0",a.style.transform=`translate(-50%, -50%) translate3d(${s.x}px, ${s.y}px, 0)`,a.style.zIndex="3",s.visible?(a.style.opacity="1",a.style.pointerEvents="auto",a.removeAttribute("data-occluded")):(a.style.opacity="0",a.style.pointerEvents="none",a.setAttribute("data-occluded",""))}}var We={name:"hotspots",updateHotspotsForElement:He,onElementConnected(e){if(typeof MutationObserver>"u"||!e)return;let t=new MutationObserver(()=>{He(e)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-position","data-normal"]}),ze.set(e,t)},onCameraChange(e,t){t&&He(t,e)},onElementDisconnected(e){let t=ze.get(e);t&&(t.disconnect(),ze.delete(e))}};function te(e,t,n,r){let o=typeof e=="number"&&Number.isFinite(e)?e:r;return Math.max(t,Math.min(n,o))}function an(e){return Array.isArray(e)&&e.length>=3&&Number.isFinite(e[0])&&Number.isFinite(e[1])&&Number.isFinite(e[2])}function Xe(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:null}function sn(e,t=256){return typeof e=="string"&&e.length>0?e.slice(0,t):void 0}function yt(e){let t=Xe(e);if(!t)return null;let n=t.target;return{target:an(n)?[n[0],n[1],n[2]]:typeof n=="string"&&n.length>0&&n.length<=256?n:[0,0,0],radius:te(t.radius,.01,50,.5),speed:te(t.speed,-20,20,.5),height:te(t.height,-10,10,0),phase:te(t.phase,-1e6,1e6,0),faceCenter:t.faceCenter===!0}}function Ee(e,t){let n=sn(e,16)?.trim();if(!n)return t;let r=/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(n);return r?`#${r[1].toLowerCase()}`:t}function $e(e){if(e===!1||e===null||e===void 0)return null;if(typeof e=="number")return!Number.isFinite(e)||e<=0?null:{enabled:!0,strength:te(e,0,5,.35),threshold:.8,radius:.5};if(e===!0)return{enabled:!0,strength:.35,threshold:.8,radius:.5};let t=Xe(e);if(!t||t.enabled===!1)return null;let n=te(t.strength??t.intensity,0,5,.35);return n<=0?null:{enabled:!0,strength:n,threshold:te(t.threshold,0,4,.8),radius:te(t.radius,0,2,.5)}}function Me(e){if(!e)return null;if(typeof e=="string")return{enabled:!0,color:Ee(e,"#38bdf8"),thickness:3,pulse:!1};if(e===!0)return{enabled:!0,color:"#38bdf8",thickness:3,pulse:!1};let t=Xe(e);if(!t||t.enabled===!1)return null;let n=t.thickness??t.width;return{enabled:!0,color:Ee(t.color,"#38bdf8"),thickness:te(typeof n=="number"&&n>0&&n<.25?Math.max(1.5,n*140):n,.5,20,3),pulse:t.pulse===!0}}function xt(e,t,n,r){let o=t[0],a=t[1],m=t[2],c=t[3],i=n[0],u=n[1],s=n[2],f=n[3],l=o*i+a*u+m*s+c*f;if(l<0&&(i=-i,u=-u,s=-s,f=-f,l=-l),Math.abs(l)>=1)return e[0]=o,e[1]=a,e[2]=m,e[3]=c,e;let b=Math.acos(l),d=Math.sqrt(1-l*l);if(Math.abs(d)<.001)return e[0]=.5*(o+i),e[1]=.5*(a+u),e[2]=.5*(m+s),e[3]=.5*(c+f),e;let p=Math.sin((1-r)*b)/d,g=Math.sin(r*b)/d;return e[0]=o*p+i*g,e[1]=a*p+u*g,e[2]=m*p+s*g,e[3]=c*p+f*g,e}var gt=1024,je=256,Re=2048,cn=128,un=64,ln=16,fn=1e4,mn=8,ne=new Set(["__proto__","constructor","prototype"]),Tt={neg:e=>-e,abs:Math.abs,sign:Math.sign,floor:Math.floor,ceil:Math.ceil,round:Math.round,trunc:Math.trunc,fract:e=>e-Math.floor(e),sqrt:e=>Math.sqrt(Math.max(0,e)),cbrt:Math.cbrt,exp:Math.exp,log:e=>e>0?Math.log(e):0,sin:Math.sin,cos:Math.cos,tan:Math.tan,asin:e=>Math.asin(Math.max(-1,Math.min(1,e))),acos:e=>Math.acos(Math.max(-1,Math.min(1,e))),atan:Math.atan,rad:e=>e*Math.PI/180,deg:e=>e*180/Math.PI,saturate:e=>Math.max(0,Math.min(1,e))},At={add:(e,t)=>e+t,sub:(e,t)=>e-t,mul:(e,t)=>e*t,div:(e,t)=>Math.abs(t)<1e-12?0:e/t,rem:(e,t)=>Math.abs(t)<1e-12?0:e%t,mod:(e,t)=>Math.abs(t)<1e-12?0:e%t,min:Math.min,max:Math.max,pow:Math.pow,atan2:Math.atan2},Se={translation:[0,0,0],rotation:[0,0,0,1],scale:[1,1,1]},we=(e,t)=>e!==null&&typeof e=="object"&&!ne.has(t)&&Object.prototype.hasOwnProperty.call(e,t),Y=e=>Array.isArray(e)?[...e]:e,Rt=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&we(e,"value")?e.value:e,j=(e,t)=>we(e.configuration,t)?Rt(e.configuration[t]):void 0,L=(e,t=0)=>{let n=Number(e);return Number.isFinite(n)?n:t},ae=e=>Math.max(0,Math.min(1,e)),q=e=>typeof e=="boolean"?e:typeof e=="number"?e!==0&&!Number.isNaN(e):typeof e=="string"?e.length>0&&e!=="false":!!e;function pe(e){if(typeof e!="string"||!e.startsWith("/"))return null;let t=[];for(let n of e.slice(1).split("/")){let r=n.replace(/~1/g,"/").replace(/~0/g,"~");if(!r||ne.has(r)||ne.has(n))return null;t.push(r)}return{segments:t}}var me=(e,t)=>{if(e===void 0||!/^\d+$/.test(e))return-1;let n=Number(e);return Number.isSafeInteger(n)&&n>=0&&n<t?n:-1},vt=e=>{let t=L(e[0]),n=L(e[1]),r=L(e[2]),o=L(e[3],1),a=Math.hypot(t,n,r,o);return a>1e-8?[t/a,n/a,r/a,o/a]:[0,0,0,1]},Et=(e,t,n,r)=>{if(typeof e=="number"&&typeof t=="number")return e+(t-e)*n;if(Array.isArray(e)&&Array.isArray(t)){if(r&&e.length===4&&t.length===4){let o=[0,0,0,1];return xt(o,vt(e),vt(t),n),o}return e.slice(0,t.length).map((o,a)=>o+(t[a]-o)*n)}return n>=.5?t:e},Ke=(e,t,n)=>Array.isArray(e)&&Array.isArray(t)?e.slice(0,t.length).map((r,o)=>n(L(r),L(t[o]))):Array.isArray(e)?e.map(r=>n(L(r),L(t))):Array.isArray(t)?t.map(r=>n(L(e),L(r))):n(L(e),L(t)),dn=(e,t)=>Array.isArray(e)?e.map(n=>t(L(n))):t(L(e)),Mt=(e,t)=>Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((n,r)=>Math.abs(n-t[r])<=1e-6):e===t,be=class{constructor(t,n,r){let o=Array.isArray(r.nodes)?r.nodes:[];if(o.length>gt)throw new Error(`SecurityError: Exceeds MAX_GRAPH_NODES (${gt})`);let a=Array.isArray(r.variables)?r.variables:[];if(a.length>je)throw new Error(`SecurityError: Exceeds MAX_VARIABLES (${je})`);let m=Array.isArray(r.declarations)?r.declarations:[],c=Array.isArray(r.events)?r.events:[],i=new Map,u=new Map,s=new Map,f=new Map,l=new Map,b=new Map,d=[],p=[],g=new Map,M=1,I=0,v=0,R=0,E=0,N=!1,O=!1,k=!1;a.forEach((T,A)=>{if(!T||typeof T!="object")return;let w=Y(Rt(T.value));i.set(A,w);let _=T.id??T.name;typeof _=="string"&&_&&!ne.has(_)&&i.set(_,w)}),(n?.nodes||[]).forEach((T,A)=>{for(let w of T?.children||[])typeof w=="number"&&g.set(w,A)});let C=T=>T.op||typeof T.declaration=="number"&&m[T.declaration]?.op||"",U=(T,A,w)=>{if(ne.has(A))return;let _=u.get(T);_||u.set(T,_=Object.create(null)),_[A]=w},V=(T,A)=>{if(typeof T!="number"&&typeof T!="string"||typeof T=="string"&&ne.has(T)||!i.has(T)&&i.size>=je*2)return;let w=Y(A);if(i.set(T,w),typeof T=="number"){let _=a[T]?.id??a[T]?.name;typeof _=="string"&&!ne.has(_)&&i.set(_,w)}},B=T=>typeof T=="number"?c[T]?.id??String(T):typeof T=="string"?/^\d+$/.test(T)&&c[Number(T)]?.id?c[Number(T)].id:T:"",W=(T,A)=>{for(let w=T,_=0;w!==void 0&&w>=0&&_<128;w=g.get(w),_++)if(w===A)return!0;return!1},G=T=>{for(let A=d.length-1;A>=0;A--)d[A].key===T&&d.splice(A,1)},oe=T=>{G(T.key),d.length>=cn&&d.shift(),d.push(T)},re=T=>{let A=pe(T)?.segments;if(A){if(A[0]==="nodes"&&Array.isArray(n?.nodes)){let w=n.nodes[me(A[1],n.nodes.length)];if(!w)return;let _=A[2];if(_ in Se){let x=Se[_],h=w[_]||x;return x.map((y,S)=>L(h[S],y))}if(_==="weights"){let x=Array.isArray(w.weights)?w.weights:[0],h=A.length===4?me(A[3],64):-2;return h===-2?x.map(y=>L(y)):h>=0?L(x[h]):void 0}if(_==="visible"||_==="extensions"&&A[3]==="KHR_node_visibility"&&A[4]==="visible")return w.extensions?.KHR_node_visibility?.visible??w.visible??!0}else if(A[0]==="materials"&&Array.isArray(n?.materials)){let w=n.materials[me(A[1],n.materials.length)];if(!w)return;let _=w.pbrMetallicRoughness||{};if(A[2]==="pbrMetallicRoughness"){if(A[3]==="baseColorFactor"){let x=_.baseColorFactor||[1,1,1,1];return[L(x[0],1),L(x[1],1),L(x[2],1),L(x[3],1)]}if(A[3]==="metallicFactor"||A[3]==="roughnessFactor")return L(_[A[3]],1)}if(A[2]==="emissiveFactor"){let x=w.emissiveFactor||[0,0,0];return[L(x[0]),L(x[1]),L(x[2])]}if(A[2]==="alphaCutoff")return L(w.alphaCutoff,.5)}}},ie=(T,A)=>{let w=pe(T)?.segments;if(!w)return!1;if(w[0]==="nodes"&&Array.isArray(n?.nodes)){let _=me(w[1],n.nodes.length),x=n.nodes[_];if(!x)return!1;let h=w[2];if(h in Se&&Array.isArray(A)){let y=Se[h];if(A.length<y.length)return!1;let S=y.map((z,$)=>L(A[$],z));if(h==="rotation"){let z=Math.hypot(...S);S=z>1e-8?S.map($=>$/z):[0,0,0,1]}x[h]=S,delete x.matrix;let D=t?.initialNodeTransforms?.[_];return D&&(D[h[0]]=[...S]),N=!0,!0}if(h==="weights"){Array.isArray(x.weights)||(x.weights=[]);let y=(S,D)=>{for(let z of t?.meshes||[])if(z.nodeIndex===_)for(let $ of z.primitives||[])$.pluginData?.morph?.weights&&($.pluginData.morph.weights[S]=D)};if(w.length===4){let S=me(w[3],64);if(S<0)return!1;y(S,x.weights[S]=L(A))}else if(Array.isArray(A))x.weights=A.slice(0,64).map(S=>L(S)),x.weights.forEach((S,D)=>y(D,S));else return!1;return k=!0,!0}if(h==="visible"||h==="extensions"&&w[3]==="KHR_node_visibility"&&w[4]==="visible"){let y=q(A);return x.visible=y,(!x.extensions||typeof x.extensions!="object")&&(x.extensions={}),x.extensions.KHR_node_visibility={visible:y},O=!0,!0}}else if(w[0]==="materials"&&Array.isArray(n?.materials)){let _=me(w[1],n.materials.length),x=n.materials[_];if(!x)return!1;let h=x.pbrMetallicRoughness||(x.pbrMetallicRoughness={}),y=S=>{for(let D of t?.meshes||[])for(let z of D.primitives||[])(z.materialIndex??0)===_&&S(z)};if(w[2]==="pbrMetallicRoughness"){if(w[3]==="baseColorFactor"&&Array.isArray(A)&&A.length>=3){let S=[ae(L(A[0],1)),ae(L(A[1],1)),ae(L(A[2],1)),A[3]!==void 0?ae(L(A[3],1)):h.baseColorFactor?.[3]??1];return h.baseColorFactor=S,y(D=>D.baseColor=[...S]),k=!0}if(w[3]==="metallicFactor"||w[3]==="roughnessFactor"){let S=w[3]==="metallicFactor",D=ae(L(A,S?0:.5));return h[w[3]]=D,y(z=>z[S?"metallic":"roughness"]=D),k=!0}}if(w[2]==="emissiveFactor"&&Array.isArray(A)&&A.length>=3)return x.emissiveFactor=[0,1,2].map(S=>Math.max(0,L(A[S]))),k=!0;if(w[2]==="alphaCutoff")return x.alphaCutoff=ae(L(A,.5)),k=!0}return!1},Ve=(T,A,w=new Set)=>{let _=j(A,"pointer");if(typeof _!="string"||!_.startsWith("/"))return null;let x=_.replace(/\{([a-zA-Z0-9_]+)\}/g,(h,y)=>{let S=Math.trunc(Number(ge(T,y,void 0,w)??j(A,y)));return Number.isSafeInteger(S)&&S>=0?String(S):"-1"});return pe(x)?x:null},ge=(T,A,w,_)=>{let x=o[T]?.values;if(!we(x,A))return w;let h=x[A];if(h==null)return w;if(typeof h!="object"||Array.isArray(h))return Y(h);let y=h;return typeof y.node=="number"?Yt(y.node,y.socket||"value",_):we(y,"value")?Y(y.value):w},Yt=(T,A,w)=>{if(T<0||T>=o.length||w.has(T)||w.size>128||++R>fn)return;let _=o[T],x=C(_);if(/^(event\/|pointer\/on|scene\/on|flow\/)/.test(x))return Y(u.get(T)?.[A]);w.add(T);try{let h=(y,S=0)=>ge(T,y,S,w);if(x==="variable/get"){let y=j(_,"variable")??j(_,"id");return typeof y=="number"||typeof y=="string"?Y(i.get(y)):void 0}if(x==="pointer/get"){let y=Ve(T,_,w);return y?re(y):void 0}if(x.startsWith("math/")){let y=x.slice(5);if(y in Tt)return dn(h("a"),Tt[y]);if(y in At){let S=/^(mul|div|rem|mod|pow)$/.test(y)?1:0;return Ke(h("a",y==="mul"?1:0),h("b",S),At[y])}if(y==="pi")return Math.PI;if(y==="e")return Math.E;if(y==="random")return Math.random();if(y==="clamp")return Ke(Ke(h("a"),h("b",h("min",0)),Math.max),h("c",h("max",1)),Math.min);if(y==="mix"||y==="quatSlerp")return Et(h("a",0),h("b",1),L(h("c",h("t",.5)),.5),y==="quatSlerp");if(y==="dot"){let S=h("a"),D=h("b");return Array.isArray(S)&&Array.isArray(D)?S.reduce((z,$,P)=>z+($||0)*(D[P]||0),0):L(S)*L(D)}if(y==="cross"){let S=h("a",[0,0,0]),D=h("b",[0,0,0]);return Array.isArray(S)&&Array.isArray(D)?[(S[1]||0)*(D[2]||0)-(S[2]||0)*(D[1]||0),(S[2]||0)*(D[0]||0)-(S[0]||0)*(D[2]||0),(S[0]||0)*(D[1]||0)-(S[1]||0)*(D[0]||0)]:[0,0,0]}if(y==="length"){let S=h("a");return Array.isArray(S)?Math.hypot(...S):Math.abs(L(S))}if(y==="distance"){let S=h("a"),D=h("b");return Array.isArray(S)&&Array.isArray(D)?Math.hypot(...S.map((z,$)=>(z||0)-(D[$]||0))):Math.abs(L(S)-L(D))}if(y==="normalize"){let S=h("a");if(!Array.isArray(S))return L(S)>=0?1:-1;let D=Math.hypot(...S);return D>1e-8?S.map(z=>z/D):S.map(()=>0)}if(y.startsWith("combine"))return["a","b","c","d"].slice(0,Number(y[7])||2).map(S=>L(h(S)));if(y.startsWith("extract")){let S=h("a");return Array.isArray(S)?S[A==="0"||A==="x"?0:A==="1"||A==="y"?1:A==="2"||A==="z"?2:3]??0:0}if(y==="eq")return Mt(h("a"),h("b"));if(y==="ne")return!Mt(h("a"),h("b"));if(y==="lt")return L(h("a"))<L(h("b"));if(y==="le")return L(h("a"))<=L(h("b"));if(y==="gt")return L(h("a"))>L(h("b"));if(y==="ge")return L(h("a"))>=L(h("b"));if(y==="isNaN")return Number.isNaN(Number(h("a")));if(y==="isInf"){let S=Number(h("a"));return!Number.isFinite(S)&&!Number.isNaN(S)}return y==="and"?q(h("a",!1))&&q(h("b",!1)):y==="or"?q(h("a",!1))||q(h("b",!1)):y==="xor"?q(h("a",!1))!==q(h("b",!1)):y==="not"?!q(h("a",!1)):y==="select"?Y(q(h("condition",!1))?h("a"):h("b")):void 0}return x==="type/boolToInt"||x==="type/boolToFloat"?q(h("a",!1))?1:0:x==="type/intToBool"||x==="type/floatToBool"?L(h("a",0))!==0:x==="type/intToFloat"?L(h("a",0)):x==="type/floatToInt"?Math.trunc(L(h("a",0))):void 0}finally{w.delete(T)}},Te=()=>{if(N){N=!1,k=!0;let T=Fe(n);if(t){t.worldMatrices=T;for(let A of t.meshes||[])A.nodeIndex>=0&&A.nodeIndex<T.length&&(A.transform.set(T[A.nodeIndex]),fe(A.normalMatrix,A.transform))}}if(O){O=!1,k=!0;let T=n?.nodes;if(Array.isArray(t?.meshes)&&Array.isArray(T))for(let A of t.meshes){let w=!0;for(let _=A.nodeIndex,x=0;_!==void 0&&_>=0&&x<128;_=g.get(_),x++){let h=T[_];if(h?.visible===!1||h?.extensions?.KHR_node_visibility?.visible===!1){w=!1;break}}A.visible=w}}k&&(k=!1,t?.render?.())},se=(T,A={steps:0})=>{if(!T||typeof T.node!="number")return;A.steps===0&&(R=0);let w=[T],_=x=>{w.length+A.steps<Re&&w.push(x)};for(;w.length>0&&A.steps<Re;){A.steps++;let x=w.shift();if(!x||x.node<0||x.node>=o.length)continue;let h=x.node,y=o[h];if(!y)continue;let S=x.socket||"in",D=C(y),z=(P,F=void 0)=>ge(h,P,F,new Set),$=(P="out")=>{let F=y.flows?.[P];F&&_(F)};switch(D){case"flow/branch":$(q(z("condition",!1))?"true":"false");break;case"flow/sequence":for(let P of Object.keys(y.flows||{}).sort((F,K)=>Number(F)-Number(K)||F.localeCompare(K)))$(P);break;case"flow/switch":{let P=y.flows?.[String(z("selection",z("value",0)))]??y.flows?.default;P&&_(P);break}case"flow/for":{let P=Math.trunc(L(z("startIndex",0))),F=Math.trunc(L(z("endIndex",0))),K=Math.max(1,Math.trunc(L(z("step",1),1))),Q=y.flows?.body;if(Q&&F>P&&E<mn){let qt=Math.min(Math.ceil((F-P)/K),Re);E++;try{for(let ke=0;ke<qt&&A.steps<Re;ke++)U(h,"index",P+ke*K),se(Q,A)}finally{E--}}let ft=y.flows?.completed??y.flows?.out;ft&&_(ft);break}case"flow/doN":{let P=S==="reset"?0:(s.get(h)||0)+1;if(s.set(h,P),U(h,"currentCount",P),U(h,"count",P),S!=="reset"){let F=Math.trunc(L(z("n",j(y,"stopIterations")??j(y,"n")??1),1));P<=F&&$()}break}case"flow/multiGate":{if(S==="reset"){b.set(h,0);break}let P=Object.keys(y.flows||{}).sort();if(!P.length)break;let F=j(y,"isRandom")?Math.floor(Math.random()*P.length):b.get(h)||0;F<P.length&&($(P[F]),b.set(h,j(y,"isLoop")!==!1?(F+1)%P.length:F+1));break}case"flow/waitAll":{if(S==="reset"){f.delete(h);break}let P=f.get(h);P||f.set(h,P=new Set),P.add(S),P.size>=Math.max(1,Math.trunc(Number(j(y,"inputFlows")??2)||2))&&(P.clear(),$("out"),$("completed"));break}case"flow/throttle":{if(S==="reset"){l.delete(h);break}let P=Math.max(0,L(z("duration",0))),F=l.get(h);F===void 0||I-F>=P?(l.set(h,I),U(h,"lastRemainingTime",0),$()):U(h,"lastRemainingTime",Math.max(0,P-(I-F)));break}case"flow/delay":case"flow/setDelay":{if(S==="cancel"){for(let Q=p.length-1;Q>=0;Q--)p[Q].nodeIdx===h&&p.splice(Q,1);U(h,"lastDelayIndex",-1);break}let P=Math.max(0,L(z("duration",j(y,"duration")??0))),F=y.flows?.done??y.flows?.out;if(P<=0){U(h,"lastDelayIndex",-1),F&&_(F);break}p.length>=un&&p.shift();let K=M++;U(h,"lastDelayIndex",K),p.push({id:K,nodeIdx:h,rem:P,done:F}),D==="flow/setDelay"&&y.flows?.out&&y.flows?.done&&$("out");break}case"flow/cancelDelay":{let P=Math.trunc(L(z("delayIndex",-1),-1));if(P<0)p.length=0;else for(let F=p.length-1;F>=0;F--)p[F].id===P&&p.splice(F,1);$();break}case"variable/set":V(j(y,"variable")??j(y,"id"),z("value")),$();break;case"variable/interpolate":{let P=j(y,"variable")??j(y,"id"),F=z("value",z("target")),K=Math.max(0,L(z("duration",j(y,"duration")??.3),.3));P!==void 0&&F!==void 0&&oe({key:`var:${String(P)}`,varKey:P,from:Y(z("from")??i.get(P)??0),to:Y(F),dur:K,elapsed:0,quat:!1,linear:j(y,"easing")==="linear",done:y.flows?.done}),$();break}case"pointer/set":{let P=Ve(h,y),F=z("value");P&&F!==void 0&&(G(`ptr:${P}`),ie(P,F)),$();break}case"pointer/interpolate":{let P=Ve(h,y),F=z("value",z("target")),K=Math.max(0,L(z("duration",j(y,"duration")??.3),.3));if(P&&F!==void 0){let Q=z("from")??re(P);Q!==void 0&&(K<=0?(ie(P,F),$("done")):oe({key:`ptr:${P}`,ptr:P,from:Y(Q),to:Y(F),dur:K,elapsed:0,quat:P.endsWith("/rotation"),linear:j(y,"easing")==="linear",done:y.flows?.done}))}$();break}case"animation/start":{let P=z("animation")??j(y,"animation")??j(y,"clipName"),F=typeof P=="number"?t?.animations?.[P]?.name??n?.animations?.[P]?.name:typeof P=="string"?P:void 0;t?.playAnimation?.(F),k=!0,$();break}case"animation/stop":case"animation/resetAt":t?.pauseAnimation?.(),D==="animation/resetAt"&&t?.evaluateAnimation?.(L(z("time",0))),k=!0,$();break;case"event/send":case"customEvent/send":{let P=B(j(y,"event")??j(y,"id")),F={};for(let K of Object.keys(y.values||{}))ne.has(K)||(F[K]=z(K));P&&(typeof CustomEvent<"u"&&typeof t?.container?.dispatchEvent=="function"&&t.container.dispatchEvent(new CustomEvent("interactivityEvent",{bubbles:!0,composed:!0,detail:{id:P,values:F}})),lt(P,F,A)),$();break}default:$();break}}};this.readScenePointer=re,this.writeScenePointer=ie,this.fireOnStart=()=>{o.forEach(T=>{C(T)==="event/onStart"&&se(T.flows?.out)}),Te()},this.fireOnSelect=T=>{if(!T)return;let A=typeof T.meshIndex=="number"?T.meshIndex:-1,w=typeof T.nodeIndex=="number"?T.nodeIndex:t?.meshes?.[A]?.nodeIndex??-1;o.forEach((_,x)=>{if(!/^(pointer|event|scene)\/onSelect$/.test(C(_)))return;let h=j(_,"nodeIndex")??j(_,"node")??ge(x,"nodeIndex",void 0,new Set),y=j(_,"meshName");if(typeof y=="string"&&y?T.meshName===y:h==null||Number(h)<0||Number.isNaN(Number(h))||W(w,Math.trunc(Number(h)))){if(U(x,"nodeIndex",w),U(x,"meshIndex",A),Array.isArray(T.hitPoint)){let D=[L(T.hitPoint[0]),L(T.hitPoint[1]),L(T.hitPoint[2])];U(x,"hitPoint",D),U(x,"point",D),U(x,"intersectionPoint",D)}if(Array.isArray(T.normal)){let D=[L(T.normal[0]),L(T.normal[1],1),L(T.normal[2])];U(x,"normal",D),U(x,"hitNormal",D)}typeof T.distance=="number"&&U(x,"distance",T.distance),se(_.flows?.out)}}),Te()},this.receiveCustomEvent=(T,A={})=>lt(T,A,{steps:0});function lt(T,A,w){if(!(v>=ln)){v++;try{let _=B(T);o.forEach((x,h)=>{if(!/^(customE|e)vent\/receive$/.test(C(x)))return;let y=j(x,"event")??j(x,"id");if(!(B(y)!==_&&String(y)!==String(T))){for(let[S,D]of Object.entries(A))ne.has(S)||U(h,S,Y(D));se(x.flows?.out,w)}}),Te()}finally{v--}}}this.tick=T=>{if(!Number.isFinite(T)||T<0)return;let A=Math.min(T,.25);I+=A,o.forEach((_,x)=>{C(_)==="event/onTick"&&(U(x,"timeDelta",A),U(x,"dt",A),U(x,"timeElapsed",I),se(_.flows?.out))});let w=[];for(let _=d.length-1;_>=0;_--){let x=d[_];x.elapsed+=A;let h=x.dur>1e-6?ae(x.elapsed/x.dur):1,y=x.linear?h:h*h*(3-2*h),S=Et(x.from,x.to,y,x.quat);x.ptr?ie(x.ptr,S):x.varKey!==void 0&&V(x.varKey,S),h>=1&&(d.splice(_,1),x.done&&w.push(x.done))}for(let _=p.length-1;_>=0;_--){let x=p[_];x.rem-=A,x.rem<=0&&(p.splice(_,1),x.done&&w.push(x.done))}for(let _ of w)se(_);Te()},this.dispose=()=>{d.length=0,p.length=0,i.clear(),u.clear(),s.clear(),f.clear(),l.clear(),b.clear()}}},J=new WeakMap,_e=new WeakMap;function pn(e,t){if(!e||typeof e!="object"||!Number.isFinite(t)||t<=0||mt().some(i=>i.name==="xr-live-head-follow")||(typeof e.getAutoRotate=="function"?e.getAutoRotate():e.autoRotate)===!1)return;let r=e.gltf,o=r?.nodes;if(!Array.isArray(o)||o.length===0)return;let a=Math.min(t,.1),m=(_e.get(e)||0)+a,c=!1;for(let i=0;i<o.length;i++){let u=o[i],s=yt(u?.extras?.xr?.orbit);if(!s)continue;let f=0,l=0,b=0;if(Array.isArray(s.target))f=s.target[0],l=s.target[1],b=s.target[2];else if(typeof s.target=="string"&&s.target!=="head"){let I=o.find(v=>v?.name===s.target);Array.isArray(I?.translation)&&(f=L(I.translation[0]),l=L(I.translation[1]),b=L(I.translation[2]))}let d=s.phase+s.speed*m,p=f+Math.cos(d)*s.radius,g=l+s.height,M=b+Math.sin(d)*s.radius;if(u.translation=[p,g,M],s.faceCenter){let I=Math.atan2(f-p,b-M);u.rotation=[0,Math.sin(I*.5),0,Math.cos(I*.5)]}c=!0}if(c){_e.set(e,m);let i=Fe(r);e.worldMatrices=i;for(let u of e.meshes||[])u.nodeIndex>=0&&u.nodeIndex<i.length&&(u.transform.set(i[u.nodeIndex]),fe(u.normalMatrix,u.transform))}}function Ie(e){if(!(!e||typeof e!="object"))return J.get(e)||J.get(e.viewer)||J.get(e._view)}function Ye(e,t,n){let r=Ie(e);return r?(r.receiveCustomEvent(t,n),!0):!1}var qe={name:"khr-interactivity",sendInteractivityEvent:Ye,getInteractivityVM:Ie,onLoadModel(e,t){if(!e||typeof e!="object")return;J.get(e)?.dispose(),J.delete(e),_e.delete(e);let n=t?.extensions?.KHR_interactivity,r=Array.isArray(n?.graphs)?n.graphs[n.graph??0]:n;if(!r||!Array.isArray(r.nodes))return;let o=new be(e,t,r);J.set(e,o),o.fireOnStart()},onMeshSelect(e,t){J.get(e)?.fireOnSelect(t)},onUpdate(e,t){J.get(e)?.tick(t),pn(e,t)},onDestroy(e,t){J.get(t)?.dispose(),J.delete(t),_e.delete(t)}};var he=new Map,Le=new WeakMap;function St(e,t){he.set(e,t)}var Qe={name:"materials",onContextRestored(e){Le.delete(e)},onBuildPrimitiveVAO(e,t,n,r,o){return(((r?.materials&&n.material!==void 0?r.materials[n.material]:null)?.extensions||{}).KHR_materials_transmission?.transmissionFactor??0)>0?{isTransmissive:!0}:null},onBeforeTransmissivePass(e,t){let n=Le.get(e);n||(n=e.createTexture(),Le.set(e,n));let r=Math.max(1,t.canvas.width),o=Math.max(1,t.canvas.height);e.activeTexture(33990),e.bindTexture(3553,n),e.copyTexImage2D(3553,0,6408,0,0,r,o,0),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071),e.texParameteri(3553,10241,9987),e.texParameteri(3553,10240,9729),e.generateMipmap(3553)},onResolveShader(e,t,n,r){if(!t)return null;if(t.name&&he.has(t.name)){let d=he.get(t.name);return{vs:d.vs||n,fs:d.fs||r}}let o=t.extensions||{},a=o.KHR_materials_clearcoat,m=o.KHR_materials_sheen,c=!!o.KHR_materials_transmission,i=!!o.KHR_materials_ior,u=o.KHR_materials_iridescence;if(!a&&!m&&!o.KHR_materials_unlit&&!c&&!o.KHR_materials_volume&&!i&&!o.KHR_materials_dispersion&&!u)return null;if(o.KHR_materials_unlit)return{vs:n,fs:r.replace("fragColor=vec4(color,outAlpha);","fragColor=vec4(base.rgb,outAlpha);").replace("fragColor=vec4(color,base.a);","fragColor=vec4(base.rgb,base.a);")};let s=r;if(c){let d=s.includes("uniform vec2 uViewportSize;")?"":`uniform vec2 uViewportSize;
|
|
33
|
+
`;s=s.replace("out vec4 fragColor;",`uniform sampler2D uTransmissionTex;
|
|
34
|
+
${d}out vec4 fragColor;`)}let f=(d,p,g=0,M=1e6,I=3)=>{let v=Number(d);return(Number.isFinite(v)?Math.min(M,Math.max(g,v)):p).toFixed(I)},l=Number(o.KHR_materials_ior?.ior??1.5),b=Number.isFinite(l)?Math.min(10,Math.max(1,l)):1.5;if(i){let d=Math.pow((b-1)/(b+1),2);s=s.replace("vec3 F0=mix(vec3(0.04),base.rgb,metallic);",`vec3 F0=mix(vec3(${f(d,.04,0,1,4)}),base.rgb,metallic);`)}if(u){let d=f(u.iridescenceFactor,1,0,1),p=f(u.iridescenceIor,1.3,1,10);s=s.replace("vec3 F=F_SchlickRoughness(F0,roughness,NoV);",`vec3 F=F_SchlickRoughness(F0,roughness,NoV);vec3 iridColor=.5+.5*cos(800.*${p}*NoV*vec3(.015,.018,.022));F=mix(F,iridColor,${d}*pow(1.-NoV,2.));`)}if(c){let d=f(o.KHR_materials_transmission?.transmissionFactor,1,0,1),p=o.KHR_materials_volume||{},g=f(p.thicknessFactor,.5,0,1e4),M=f(p.attenuationDistance,1,.001,1e6),I=Array.isArray(p.attenuationColor)?p.attenuationColor:[1,1,1],v=f(o.KHR_materials_dispersion?.dispersion,0,0,10);s=s.replace("vec3 diffuseIBL=kD*base.rgb*(uAmbientColor+envDiffuse*0.5)*occ;",`vec3 diffuseIBL=kD*base.rgb*(uAmbientColor+envDiffuse*0.5)*occ;
|
|
35
|
+
vec2 sUV=gl_FragCoord.xy/max(uViewportSize,vec2(1.));float iorB=${f(b,1.5,1,10)},dV=${v},tV=${g},lod=clamp(roughness*5.,0.,5.),sc=.06*(1.+tV);
|
|
36
36
|
vec3 refractedR=refract(-V,N,1./(iorB-.02*dV)),rG=refract(-V,N,1./iorB),refractedB=refract(-V,N,1./(iorB+.02*dV));
|
|
37
37
|
vec3 tr=vec3(textureLod(uTransmissionTex,clamp(sUV+refractedR.xy*sc,.001,.999),lod).r,textureLod(uTransmissionTex,clamp(sUV+rG.xy*sc,.001,.999),lod).g,textureLod(uTransmissionTex,clamp(sUV+refractedB.xy*sc,.001,.999),lod).b);
|
|
38
|
-
vec3 aCol=vec3(${
|
|
39
|
-
vec3 volumeAtten=exp(-tV*(vec3(1.)-aCol)/max(${
|
|
40
|
-
diffuseIBL=mix(diffuseIBL,tr*volumeAtten*base.rgb,${h});`)}if(i&&!o.includes("uClearcoat")){let h=s(i.clearcoatFactor,1,0,1),b=s(i.clearcoatRoughnessFactor,0,0,1);c=c.replace("fragColor=vec4(color,base.a);",`vec3 ccF=F_SchlickRoughness(vec3(.04),${b},NoV)*${h};color=color*(vec3(1.)-ccF)+getStudioRadiance(R,${b})*ccF;fragColor=vec4(color,base.a);`)}if(l){let h=Array.isArray(l.sheenColorFactor)?l.sheenColorFactor:[1,1,1],b=`color+=vec3(${s(h[0],1,0,1)},${s(h[1],1,0,1)},${s(h[2],1,0,1)})*pow(1.-NoV,4.)*.5;`;c.includes("color=applyToneMapping(color,uToneMapping);")?c=c.replace("color=applyToneMapping(color,uToneMapping);",`${b}color=applyToneMapping(color,uToneMapping);`):c=c.replace("fragColor=vec4(color,base.a);",`${b}fragColor=vec4(color,base.a);`)}return{vs:n,fs:c}},onBeforeDrawPrimitive(e,t,n,o,r,i){let l=n.materialIndex;if(l!==void 0&&i?.materials){let a=i.materials[l];a?.name&&le.has(a.name)&&le.get(a.name).onBindUniforms?.(e,t,n)}if(n.isTransmissive){let a=Xe.get(e);if(a){e.activeTexture(33990),e.bindTexture(3553,a);let u=e.getUniformLocation(t,"uTransmissionTex");u&&e.uniform1i(u,6);let f=e.getUniformLocation(t,"uViewportSize");f&&e.uniform2f(f,e.drawingBufferWidth||1,e.drawingBufferHeight||1)}}}};var At=64*1024*1024,Mt=128*1024*1024,Jt=16777216;function en(e){let t=e<<24>>24;return(t<<1^t>>7)&255}function $e(e){return(e>>>1^-(e&1))&255}function tn(e){return(e<<1^e>>31)>>>0}function nn(e){return e>>>1^-(e&1)}function Me(e,t,n,o="NONE"){if(!o||o==="NONE"||t<=0)return;let r=new DataView(e.buffer,e.byteOffset,e.byteLength);if(o==="OCTAHEDRAL"){if(n!==4&&n!==8)throw new Error(`EXT_meshopt_compression: OCTAHEDRAL filter requires byteStride 4 or 8 (got ${n})`);let i=n===4?127:32767;for(let l=0;l<t;l++){let a=l*n,u=n===4?r.getInt8(a):r.getInt16(a,!0),f=n===4?r.getInt8(a+1):r.getInt16(a+2,!0),c=n===4?r.getInt8(a+2):r.getInt16(a+4,!0),s=c===0?1:c,p=u/s,v=f/s,h=1-Math.abs(p)-Math.abs(v),b=Math.max(-h,0);p+=p>=0?-b:b,v+=v>=0?-b:b;let T=Math.hypot(p,v,h)||1,k=Math.max(-i,Math.min(i,Math.round(p/T*i))),S=Math.max(-i,Math.min(i,Math.round(v/T*i))),A=Math.max(-i,Math.min(i,Math.round(h/T*i)));n===4?(r.setInt8(a,k),r.setInt8(a+1,S),r.setInt8(a+2,A)):(r.setInt16(a,k,!0),r.setInt16(a+2,S,!0),r.setInt16(a+4,A,!0))}return}if(o==="QUATERNION"){if(n!==8)throw new Error(`EXT_meshopt_compression: QUATERNION filter requires byteStride 8 (got ${n})`);for(let i=0;i<t;i++){let l=i*8,a=r.getInt16(l,!0),u=r.getInt16(l+2,!0),f=r.getInt16(l+4,!0),c=r.getInt16(l+6,!0),s=c&3,p=c|3,v=Math.SQRT1_2/(p===0?1:p),h=a*v,b=u*v,T=f*v,k=Math.sqrt(Math.max(0,1-h*h-b*b-T*T)),S=Math.hypot(h,b,T,k)||1,A=[0,0,0,0];A[s+1&3]=Math.max(-32767,Math.min(32767,Math.round(h/S*32767))),A[s+2&3]=Math.max(-32767,Math.min(32767,Math.round(b/S*32767))),A[s+3&3]=Math.max(-32767,Math.min(32767,Math.round(T/S*32767))),A[s]=Math.max(-32767,Math.min(32767,Math.round(k/S*32767))),r.setInt16(l,A[0],!0),r.setInt16(l+2,A[1],!0),r.setInt16(l+4,A[2],!0),r.setInt16(l+6,A[3],!0)}return}if(o==="EXPONENTIAL"){if(n<4||n%4!==0)throw new Error(`EXT_meshopt_compression: EXPONENTIAL filter requires byteStride multiple of 4 (got ${n})`);let i=t*n>>>2;for(let l=0;l<i;l++){let a=l*4,u=r.getInt32(a,!0),f=u>>24,c=u<<8>>8,s=Math.pow(2,f)*c;r.setFloat32(a,s,!0)}}}function Et(e){let t=Math.floor(8192/e)&-16;return t<32?32:t>256?256:t}function je(e,t,n,o,r="NONE"){if(!Number.isInteger(t)||t<0||t>Jt||!Number.isInteger(n)||n<=0||n>256)throw new Error(`EXT_meshopt_compression: invalid count (${t}) or byteStride (${n})`);let i=t*n;if(i>At)throw new Error(`EXT_meshopt_compression: decompressed size (${i}) exceeds MAX_MESHOPT_BUFFER_BYTES (${At})`);if(t===0)return new Uint8Array(0);let l=new Uint8Array(i),a=e.length>0?e[0]:0;if(o==="ATTRIBUTES"){if(n%4!==0)throw new Error(`EXT_meshopt_compression: ATTRIBUTES byteStride must be a multiple of 4 (got ${n})`);if(a!==160){if(e.byteLength===i)return l.set(e),Me(l,t,n,r),l;throw new Error(`EXT_meshopt_compression: unsupported ATTRIBUTES header 0x${a.toString(16)}`)}if(e.byteLength<1+n)throw new Error("EXT_meshopt_compression: truncated ATTRIBUTES stream");let u=e.byteLength-n,f=new Uint8Array(n);f.set(e.subarray(u,u+n));let c=Et(n),s=1,p=0;for(;p<t;){let v=Math.min(t-p,c),h=v+15>>>4,b=h+3>>>2;for(let T=0;T<n;T++){if(s+b>u)throw new Error("EXT_meshopt_compression: truncated ATTRIBUTES control header");let k=s;s+=b;let S=f[T];for(let A=0;A<h;A++){let L=e[k+(A>>>2)]>>>(A&3)*2&3,P=A*16,_=Math.min(16,v-P);if(L===0)for(let N=0;N<_;N++)l[(p+P+N)*n+T]=S;else if(L===1){if(s+4>u)throw new Error("EXT_meshopt_compression: truncated ATTRIBUTES 2-bit group");for(let N=0;N<16;N++){let V=e[s+(N>>>2)]>>>(N&3)*2&3;S=S+$e(V)&255,N<_&&(l[(p+P+N)*n+T]=S)}s+=4}else if(L===2){if(s+8>u)throw new Error("EXT_meshopt_compression: truncated ATTRIBUTES 4-bit group");for(let N=0;N<16;N++){let V=e[s+(N>>>1)]>>>(N&1)*4&15;S=S+$e(V)&255,N<_&&(l[(p+P+N)*n+T]=S)}s+=8}else{if(s+16>u)throw new Error("EXT_meshopt_compression: truncated ATTRIBUTES 8-bit group");for(let N=0;N<16;N++){let D=e[s+N];S=S+$e(D)&255,N<_&&(l[(p+P+N)*n+T]=S)}s+=16}}f[T]=S}p+=v}return Me(l,t,n,r),l}if(o==="TRIANGLES"||o==="INDICES"){if(n!==2&&n!==4)throw new Error(`EXT_meshopt_compression: ${o} byteStride must be 2 or 4 (got ${n})`);if(o==="TRIANGLES"&&t%3!==0)throw new Error(`EXT_meshopt_compression: TRIANGLES count must be divisible by 3 (got ${t})`);let u=o==="TRIANGLES"?176:192;if((a&240)!==u){if(e.byteLength===i)return l.set(e),l;throw new Error(`EXT_meshopt_compression: unsupported ${o} header 0x${a.toString(16)}`)}let f=new DataView(l.buffer,l.byteOffset,l.byteLength),c=1,s=0;for(let p=0;p<t;p++){let v=0,h=0;for(;;){if(c>=e.byteLength)throw new Error(`EXT_meshopt_compression: truncated ${o} stream`);let b=e[c++];if(v|=(b&127)<<h,!(b&128))break;if(h+=7,h>28)throw new Error(`EXT_meshopt_compression: varint overflow in ${o}`)}s=s+nn(v)>>>0,n===2?f.setUint16(p*2,s&65535,!0):f.setUint32(p*4,s,!0)}return l}throw new Error(`EXT_meshopt_compression: unknown mode "${String(o)}"`)}function wt(e,t,n,o){let r=t*n;if(e.byteLength<r)throw new Error(`encodeMeshoptBuffer: raw buffer (${e.byteLength}) smaller than count * byteStride (${r})`);if(t===0)return new Uint8Array([o==="ATTRIBUTES"?160:176]);if(o==="ATTRIBUTES"){let u=Et(n),f=[160],c=new Uint8Array(n),s=0;for(;s<t;){let p=Math.min(t-s,u),v=p+15>>>4,h=v+3>>>2;for(let b=0;b<n;b++){let T=new Uint8Array(h),k=[],S=c[b];for(let A=0;A<v;A++){let L=A*16,P=Math.min(16,p-L),_=new Uint8Array(16),N=0;for(let V=0;V<16;V++)if(V<P){let O=e[(s+L+V)*n+b],j=O-S<<24>>24,X=en(j);_[V]=X,X>N&&(N=X),S=O}else _[V]=0;let D=0;if(N===0)D=0;else if(N<=3){D=1;for(let V=0;V<16;V+=4)k.push(_[V]&3|(_[V+1]&3)<<2|(_[V+2]&3)<<4|(_[V+3]&3)<<6)}else if(N<=15){D=2;for(let V=0;V<16;V+=2)k.push(_[V]&15|(_[V+1]&15)<<4)}else{D=3;for(let V=0;V<16;V++)k.push(_[V])}T[A>>>2]|=D<<(A&3)*2}for(let A=0;A<T.length;A++)f.push(T[A]);for(let A=0;A<k.length;A++)f.push(k[A]);c[b]=S}s+=p}for(let p=0;p<n;p++)f.push(0);return new Uint8Array(f)}let i=new DataView(e.buffer,e.byteOffset,e.byteLength),l=[o==="TRIANGLES"?176:192],a=0;for(let u=0;u<t;u++){let f=n===2?i.getUint16(u*2,!0):i.getUint32(u*4,!0),c=f-a|0;a=f;let s=tn(c);for(;s>=128;)l.push(s&127|128),s>>>=7;l.push(s&127)}return new Uint8Array(l)}function ce(e,t){let n=t&&typeof t=="object"?t:e,o=t&&typeof t=="object"?e:n?.gltf;if(!o||!Array.isArray(o.bufferViews))return;let r=new Uint8Array(n.bin),i=[],l=0;for(let s=0;s<o.bufferViews.length;s++){let v=o.bufferViews[s]?.extensions?.EXT_meshopt_compression;if(!v||typeof v!="object")continue;let h=Number(v.count),b=Number(v.byteStride),T=Number(v.byteOffset??0),k=Number(v.byteLength??0),S=v.mode||"ATTRIBUTES",A=v.filter||"NONE";if(!Number.isInteger(T)||T<0||!Number.isInteger(k)||k<0||T+k>r.byteLength)throw new Error(`EXT_meshopt_compression: bufferView ${s} compressed range [${T}, ${T+k}] out of bounds (${r.byteLength})`);let L=h*b;if(l+=L,l>Mt)throw new Error(`EXT_meshopt_compression: total decompressed size (${l}) exceeds MAX_MESHOPT_TOTAL_BYTES (${Mt})`);let P=r.subarray(T,T+k),_=je(P,h,b,S,A);i.push({index:s,bytes:_,ext:v})}if(i.length===0)return;let a=r.byteLength+3&-4,u=0;for(let s of i)u+=s.bytes.byteLength+3&-4;let f=new Uint8Array(a+u);f.set(r,0);let c=a;for(let s of i){f.set(s.bytes,c);let p=o.bufferViews[s.index];p.byteOffset=c,p.byteLength=s.bytes.byteLength,p._decoded=s.bytes,s.ext.mode==="ATTRIBUTES"&&p.byteStride===void 0&&(p.byteStride=Number(s.ext.byteStride)),p.extensions&&delete p.extensions.EXT_meshopt_compression,c+=s.bytes.byteLength+3&-4}n.bin=f.buffer}var Ee={decodeBufferViews(e,t){ce(t)},decodePrimitive(e,t,n){let o=t?.extensions;o?.EXT_meshopt_compression&&delete o.EXT_meshopt_compression,ce({gltf:e,bin:n})}};ne().decoders.set("meshopt",Ee);var Ke={name:"meshopt",onParseGLB(e){ne().decoders.set("meshopt",Ee),ce(e)}};var rn=`#version 300 es
|
|
38
|
+
vec3 aCol=vec3(${f(I[0],1,0,1)},${f(I[1],1,0,1)},${f(I[2],1,0,1)});
|
|
39
|
+
vec3 volumeAtten=exp(-tV*(vec3(1.)-aCol)/max(${M},.001));
|
|
40
|
+
diffuseIBL=mix(diffuseIBL,tr*volumeAtten*base.rgb,${d});`)}if(a&&!r.includes("uClearcoat")){let d=f(a.clearcoatFactor,1,0,1),p=f(a.clearcoatRoughnessFactor,0,0,1);s=s.replace("fragColor=vec4(color,base.a);",`vec3 ccF=F_SchlickRoughness(vec3(.04),${p},NoV)*${d};color=color*(vec3(1.)-ccF)+getStudioRadiance(R,${p})*ccF;fragColor=vec4(color,base.a);`)}if(m){let d=Array.isArray(m.sheenColorFactor)?m.sheenColorFactor:[1,1,1],p=`color+=vec3(${f(d[0],1,0,1)},${f(d[1],1,0,1)},${f(d[2],1,0,1)})*pow(1.-NoV,4.)*.5;`;s.includes("color=applyToneMapping(color,uToneMapping);")?s=s.replace("color=applyToneMapping(color,uToneMapping);",`${p}color=applyToneMapping(color,uToneMapping);`):s=s.replace("fragColor=vec4(color,base.a);",`${p}fragColor=vec4(color,base.a);`)}return{vs:n,fs:s}},onBeforeDrawPrimitive(e,t,n,r,o,a){let m=n.materialIndex;if(m!==void 0&&a?.materials){let c=a.materials[m];c?.name&&he.has(c.name)&&he.get(c.name).onBindUniforms?.(e,t,n)}if(n.isTransmissive){let c=Le.get(e);if(c){e.activeTexture(33990),e.bindTexture(3553,c);let i=e.getUniformLocation(t,"uTransmissionTex");i&&e.uniform1i(i,6);let u=e.getUniformLocation(t,"uViewportSize");u&&e.uniform2f(u,e.drawingBufferWidth||1,e.drawingBufferHeight||1)}}}};var wt=64*1024*1024,_t=128*1024*1024,bn=16777216;function hn(e){return(e>>>1^-(e&1))&255}function yn(e){return(e>>>1^-(e&1))&65535}function xn(e){let t=e<<24>>24;return(t<<1^t>>7)&255}function It(e){return(e<<1^e>>31)>>>0}function Pt(e){if(e!==void 0&&e!=="NONE"&&e!=="OCTAHEDRAL"&&e!=="QUATERNION"&&e!=="EXPONENTIAL"&&e!=="COLOR")throw X(`unknown filter "${String(e)}"`)}var H=Math.fround;function de(e){return Math.trunc(H(e+(e>=0?.5:-.5)))}function Ze(e,t,n,r="NONE"){if(Pt(r),!r||r==="NONE"||t<=0)return;let o=new DataView(e.buffer,e.byteOffset,e.byteLength);if(r==="OCTAHEDRAL"){if(n!==4&&n!==8)throw X(`OCTAHEDRAL filter requires byteStride 4 or 8 (got ${n})`);let f=n===8,l=f?32767:127,b=g=>f?o.getInt16(g,!0):o.getInt8(g),d=(g,M)=>f?o.setInt16(g,M,!0):o.setInt8(g,M<<24>>24),p=f?2:1;for(let g=0;g<t;g++){let M=g*n,I=b(M),v=b(M+p),R=H(b(M+2*p)-Math.abs(I)-Math.abs(v)),E=R>=0?0:R;I=H(I+(I>=0?E:-E)),v=H(v+(v>=0?E:-E));let N=H(Math.sqrt(H(H(H(I*I)+H(v*v))+H(R*R))));if(N===0){d(M,0),d(M+p,0),d(M+2*p,l);continue}let O=H(l/N);d(M,de(H(I*O))),d(M+p,de(H(v*O))),d(M+2*p,de(H(R*O)))}return}if(r==="QUATERNION"){if(n!==8)throw X(`QUATERNION filter requires byteStride 8 (got ${n})`);let f=H(32767/H(Math.SQRT2));for(let l=0;l<t;l++){let b=l*8,d=o.getInt16(b+6,!0),p=d|3,g=o.getInt16(b,!0),M=o.getInt16(b+2,!0),I=o.getInt16(b+4,!0),v=H(p*p),R=H(H(H(H(v*2)-H(g*g))-H(M*M))-H(I*I)),E=H(Math.sqrt(R>=0?R:0)),N=H(f/p),O=d&3,k=[0,0,0,0];k[O+1&3]=de(H(g*N)),k[O+2&3]=de(H(M*N)),k[O+3&3]=de(H(I*N)),k[O]=Math.trunc(H(H(E*N)+.5));for(let C=0;C<4;C++)o.setInt16(b+C*2,k[C]<<16>>16,!0)}return}if(r==="EXPONENTIAL"){if(n<4||n%4!==0)throw X(`EXPONENTIAL filter requires byteStride multiple of 4 (got ${n})`);let f=t*n>>>2;for(let l=0;l<f;l++){let b=l*4,d=o.getUint32(b,!0),p=d<<8>>8,g=d>>24;o.setUint32(b,g+127<<23>>>0,!0);let M=o.getFloat32(b,!0);o.setFloat32(b,H(M*p),!0)}return}if(n!==4&&n!==8)throw new Error(`KHR_meshopt_compression: COLOR filter requires byteStride 4 or 8 (got ${n})`);let a=n===8,m=a?65535:255,c=f=>a?o.getUint16(f,!0):o.getUint8(f),i=f=>a?o.getInt16(f,!0):o.getInt8(f),u=(f,l)=>a?o.setUint16(f,l&65535,!0):o.setUint8(f,l&255),s=a?2:1;for(let f=0;f<t;f++){let l=f*n,b=c(l+3*s);b|=b>>1,b|=b>>2,b|=b>>4,b|=b>>8;let d=c(l),p=i(l+s),g=i(l+2*s),M=d+p-g,I=d+g,v=d-p-g,R=c(l+3*s);R=R<<1&b|R&1;let E=b===0?0:H(m/b);u(l,Math.trunc(H(H(M*E)+.5))),u(l+s,Math.trunc(H(H(I*E)+.5))),u(l+2*s,Math.trunc(H(H(v*E)+.5))),u(l+3*s,Math.trunc(H(H(R*E)+.5)))}}var Ut=160,ee=16,gn=24,Ct=32,Tn=24,An=[0,2,4,8],vn=[0,1,2,4,8];function Vt(e){let t=Math.floor(8192/e)&~(ee-1);return t<256?t:256}function X(e){return new Error(`EXT_meshopt_compression: ${e}`)}function En(e,t,n,r,o){if(o===0)return n.fill(0,r,r+ee),t;if(o===8)return n.set(e.subarray(t,t+ee),r),t+ee;let a=(1<<o)-1,m=8/o,c=t+ee*o/8;for(let i=0;i<ee;i++){let u=e[t+Math.floor(i/m)],s=i%m,f=o===1?u>>s&1:u>>8-o-s*o&a;n[r+i]=f===a?e[c++]:f}return c}function Lt(e,t,n,r,o,a,m,c){let i=a/ee,u=i+3>>2;if(n-t<u)throw X("truncated ATTRIBUTES stream");let s=t;t+=u;for(let f=0;f<i;f++){if(n-t<gn)throw X("truncated ATTRIBUTES stream");let l=e[s+(f>>2)]>>(f&3)*2&3;t=En(e,t,r,o+f*ee,m[c+l])}return t}function Mn(e,t,n,r){if(n%4!==0||n>256)throw X(`ATTRIBUTES byteStride must be a multiple of 4 and <= 256 (got ${n})`);let o=e.byteLength;if(o<1)throw X("truncated ATTRIBUTES stream");let a=e[0];if((a&240)!==Ut)throw X(`unsupported ATTRIBUTES header 0x${a.toString(16)}`);let m=a&15;if(m>1)throw X(`unsupported ATTRIBUTES codec version ${m}`);let c=n+(m===0?0:n/4),i=m===0?Ct:Tn,u=c<i?i:c;if(o-1<u)throw X("truncated ATTRIBUTES stream");let s=o-c,f=e.slice(s,s+n),l=s+n,b=Vt(n),d=new Uint8Array(256*4),p=1;for(let g=0;g<t;){let M=Math.min(b,t-g),I=M+ee-1&~(ee-1),v=m===0?0:n/4;if(o-p<v)throw X("truncated ATTRIBUTES stream");let R=p;p+=v;for(let E=0;E<n;E+=4){let N=m===0?0:e[R+E/4];for(let C=0;C<4;C++){let U=N>>C*2&3;if(U===3){if(o-p<M)throw X("truncated ATTRIBUTES stream");d.set(e.subarray(p,p+M),C*M),p+=M}else U===2?d.fill(0,C*M,C*M+M):p=m===0?Lt(e,p,o,d,C*M,I,An,0):Lt(e,p,o,d,C*M,I,vn,U)}let O=m===0?0:e[l+E/4],k=O&3;if(k===0)for(let C=0;C<4;C++){let U=f[E+C];for(let V=0;V<M;V++)U=hn(d[C*M+V])+U&255,r[(g+V)*n+E+C]=U}else if(k===1)for(let C=0;C<4;C+=2){let U=f[E+C]|f[E+C+1]<<8,V=C*M;for(let B=0;B<M;B++){let W=d[V+B]|d[V+M+B]<<8;U=yn(W)+U&65535;let G=(g+B)*n+E+C;r[G]=U&255,r[G+1]=U>>8}}else if(k===2){let C=32-(O>>4)&31,U=(f[E]|f[E+1]<<8|f[E+2]<<16|f[E+3]<<24)>>>0;for(let V=0;V<M;V++){let B=(d[V]|d[M+V]<<8|d[2*M+V]<<16|d[3*M+V]<<24)>>>0;B=((B<<C|B>>>(32-C&31))^U)>>>0,U=B;let W=(g+V)*n+E;r[W]=B&255,r[W+1]=B>>>8&255,r[W+2]=B>>>16&255,r[W+3]=B>>>24}}else throw X(`invalid ATTRIBUTES channel ${O}`)}f.set(r.subarray((g+M-1)*n,(g+M)*n)),g+=M}if(o-p!==u)throw X("ATTRIBUTES trailing data")}var kt=224,Ot=208;function Ft(e,t){let n=e[t.pos++]??0;if(n<128)return n;let r=n&127,o=7;for(let a=0;a<4;a++){let m=e[t.pos++]??0;if(r=(r|(m&127)<<o)>>>0,o+=7,m<128)break}return r>>>0}function Ne(e,t,n){let r=Ft(e,t),o=r>>>1^-(r&1);return n+o>>>0}function Rn(e,t,n){if(t%3!==0)throw X(`TRIANGLES count must be divisible by 3 (got ${t})`);let r=t/3;if(e.byteLength<1+r+16)throw X("truncated TRIANGLES stream");let o=e[0];if((o&240)!==kt)throw X(`unsupported TRIANGLES header 0x${o.toString(16)}`);let a=o&15;if(a>1)throw X(`unsupported TRIANGLES codec version ${a}`);let m=new Uint32Array(16).fill(4294967295),c=new Uint32Array(16).fill(4294967295),i=new Uint32Array(16).fill(4294967295),u=0,s=0,f=(N,O)=>{m[u]=N,c[u]=O,u=u+1&15},l=(N,O=1)=>{i[s]=N,s=s+O&15},b=0,d=0,p=a>=1?13:15,g=1+r,M=e.byteLength-16,I=M,v={pos:g},R=0,E=(N,O,k)=>{n(R++,N),n(R++,O),n(R++,k)};for(let N=1;N<g;N++){let O=e[N];if(O<240){let k=O>>4,C=u-1-k&15,U=m[C],V=c[C],B=0,W=O&15;if(W<p){let G=i[s-1-W&15];B=W===0?b:G;let oe=W===0?1:0;b=b+oe>>>0,l(B,oe)}else{if(v.pos>M)throw X("truncated TRIANGLES stream");B=W!==15?d+(W*2-27)>>>0:Ne(e,v,d),d=B,l(B)}f(B,V),f(U,B),E(U,V,B)}else if(O<254){let k=e[I+(O&15)],C=k>>4,U=k&15,V=b;b=b+1>>>0;let B=i[s-C&15],W=C===0?b:B,G=C===0?1:0;b=b+G>>>0;let oe=i[s-U&15],re=U===0?b:oe,ie=U===0?1:0;b=b+ie>>>0,E(V,W,re),l(V),l(W,G),l(re,ie),f(W,V),f(re,W),f(V,re)}else{if(v.pos>M)throw X("truncated TRIANGLES stream");let k=e[v.pos++],C=O===254?0:15,U=k>>4,V=k&15;k===0&&(b=0);let B=0;C===0&&(B=b,b=b+1>>>0);let W;U===0?(W=b,b=b+1>>>0):W=i[s-U&15];let G;V===0?(G=b,b=b+1>>>0):G=i[s-V&15],C===15&&(d=B=Ne(e,v,d)),U===15&&(d=W=Ne(e,v,d)),V===15&&(d=G=Ne(e,v,d)),E(B,W,G),l(B),l(W,U===0||U===15?1:0),l(G,V===0||V===15?1:0),f(W,B),f(G,W),f(B,G)}}if(v.pos!==M)throw X("TRIANGLES trailing data")}function Sn(e,t,n){if(e.byteLength<1+t+4)throw X("truncated INDICES stream");let r=e[0];if((r&240)!==Ot)throw X(`unsupported INDICES header 0x${r.toString(16)}`);let o=r&15;if(o>1)throw X(`unsupported INDICES codec version ${o}`);let a=e.byteLength-4,m=[0,0],c={pos:1};for(let i=0;i<t;i++){if(c.pos>=a)throw X("truncated INDICES stream");let u=Ft(e,c),s=u&1;u>>>=1;let f=u>>>1^-(u&1),l=m[s]+f>>>0;m[s]=l,n(i,l)}if(c.pos!==a)throw X("INDICES trailing data")}function Je(e,t,n,r,o="NONE"){if(Pt(o),!Number.isInteger(t)||t<0||t>bn||!Number.isInteger(n)||n<=0||n>256)throw X(`invalid count (${t}) or byteStride (${n})`);let a=t*n;if(a>wt)throw X(`decompressed size (${a}) exceeds MAX_MESHOPT_BUFFER_BYTES (${wt})`);if(t===0)return new Uint8Array(0);let m=new Uint8Array(a);if(r==="ATTRIBUTES")return Mn(e,t,n,m),Ze(m,t,n,o),m;if(r==="TRIANGLES"||r==="INDICES"){if(n!==2&&n!==4)throw X(`${r} byteStride must be 2 or 4 (got ${n})`);if(o&&o!=="NONE")throw X(`filter ${o} is only valid for ATTRIBUTES`);let c=new DataView(m.buffer),i=n===2?(u,s)=>c.setUint16(u*2,s&65535,!0):(u,s)=>c.setUint32(u*4,s>>>0,!0);return r==="TRIANGLES"?Rn(e,t,i):Sn(e,t,i),m}throw X(`unknown mode "${String(r)}"`)}function Nt(e,t){t>>>=0;do e.push(t&127|(t>127?128:0)),t>>>=7;while(t)}function Dt(e,t,n,r){let o=t*n;if(e.byteLength<o)throw new Error(`encodeMeshoptBuffer: raw buffer (${e.byteLength}) smaller than count * byteStride (${o})`);if(r==="ATTRIBUTES"){if(n%4!==0||n>256)throw new Error(`encodeMeshoptBuffer: ATTRIBUTES byteStride must be a multiple of 4 and <= 256 (got ${n})`);let c=[Ut],i=Vt(n),u=new Uint8Array(n);t>0&&u.set(e.subarray(0,n));let s=u.slice(),f=new Uint8Array(256);for(let l=0;l<t;){let b=Math.min(i,t-l),d=b+15&-16;for(let p=0;p<n;p++){f.fill(0);let g=u[p];for(let v=0;v<b;v++){let R=e[(l+v)*n+p];f[v]=xn(R-g&255),g=R}u[p]=g;let M=d/16,I=c.length;for(let v=0;v<M+3>>2;v++)c.push(0);for(let v=0;v<M;v++){let R=f.subarray(v*16,v*16+16);if(!R.every(E=>E===0)){c[I+(v>>2)]|=3<<(v&3)*2;for(let E of R)c.push(E)}}}l+=b}for(let l=n;l<Ct;l++)c.push(0);for(let l=0;l<n;l++)c.push(s[l]);return new Uint8Array(c)}if(n!==2&&n!==4)throw new Error(`encodeMeshoptBuffer: ${r} byteStride must be 2 or 4 (got ${n})`);let a=new DataView(e.buffer,e.byteOffset,e.byteLength),m=c=>n===2?a.getUint16(c*2,!0):a.getUint32(c*4,!0);if(r==="INDICES"){let c=[Ot|1],i=0;for(let u=0;u<t;u++){let s=m(u),f=s-i|0;i=s,Nt(c,It(f)<<1>>>0)}return c.push(0,0,0,0),new Uint8Array(c)}if(r==="TRIANGLES"){if(t%3!==0)throw new Error(`encodeMeshoptBuffer: TRIANGLES count must be divisible by 3 (got ${t})`);let c=t/3,i=[kt|1];for(let s=0;s<c;s++)i.push(255);let u=0;for(let s=0;s<c;s++){i.push(255);for(let f=0;f<3;f++){let l=m(s*3+f);Nt(i,It(l-u|0)),u=l}}for(let s=0;s<16;s++)i.push(0);return new Uint8Array(i)}throw new Error(`encodeMeshoptBuffer: unknown mode "${String(r)}"`)}function Pe(e,t){let n=t&&typeof t=="object"?t:e,r=t&&typeof t=="object"?e:n?.gltf;if(!r||!Array.isArray(r.bufferViews))return;let o=new Uint8Array(n.bin),a=[],m=0;for(let f=0;f<r.bufferViews.length;f++){let l=r.bufferViews[f],b=l?.extensions?.KHR_meshopt_compression,d=b??l?.extensions?.EXT_meshopt_compression;if(!d||typeof d!="object")continue;let p=b?"KHR_meshopt_compression":"EXT_meshopt_compression",g=Number(d.count),M=Number(d.byteStride),I=Number(d.byteOffset??0),v=Number(d.byteLength??0),R=d.mode||"ATTRIBUTES",E=d.filter||"NONE";if(E==="COLOR"&&!b)throw X(`bufferView ${f} uses the COLOR filter, which requires KHR_meshopt_compression`);if(Number(d.buffer??0)!==0)throw new Error(`${p}: bufferView ${f} references buffer ${String(d.buffer)}; only the GLB BIN chunk (buffer 0) is supported`);if(!Number.isInteger(I)||I<0||!Number.isInteger(v)||v<0||I+v>o.byteLength)throw new Error(`${p}: bufferView ${f} compressed range [${I}, ${I+v}] out of bounds (${o.byteLength})`);let N=g*M;if(m+=N,m>_t)throw X(`total decompressed size (${m}) exceeds MAX_MESHOPT_TOTAL_BYTES (${_t})`);let O=o.subarray(I,I+v),k=Je(O,g,M,R,E);a.push({index:f,bytes:k,ext:d})}if(a.length===0)return;let c=o.byteLength+3&-4,i=0;for(let f of a)i+=f.bytes.byteLength+3&-4;let u=new Uint8Array(c+i);u.set(o,0);let s=c;for(let f of a){u.set(f.bytes,s);let l=r.bufferViews[f.index];l.buffer=0,l.byteOffset=s,l.byteLength=f.bytes.byteLength,l._decoded=f.bytes,f.ext.mode==="ATTRIBUTES"&&l.byteStride===void 0&&(l.byteStride=Number(f.ext.byteStride)),l.extensions&&(delete l.extensions.EXT_meshopt_compression,delete l.extensions.KHR_meshopt_compression),s+=f.bytes.byteLength+3&-4}n.bin=u.buffer}var Ue={decodeBufferViews(e,t){Pe(t)},decodePrimitive(e,t,n){let r=t?.extensions;r?.EXT_meshopt_compression&&delete r.EXT_meshopt_compression,r?.KHR_meshopt_compression&&delete r.KHR_meshopt_compression}};ce().decoders.set("meshopt",Ue);var et={name:"meshopt",onParseGLB(e){ce().decoders.set("meshopt",Ue),Pe(e)}};function tt(e,t){let n=e?.trim(),r=n?Number(n):NaN;return Number.isFinite(r)?r:t}var In=`#version 300 es
|
|
41
41
|
layout(location=0) in vec3 aPosition;
|
|
42
42
|
layout(location=1) in vec3 aNormal;
|
|
43
43
|
uniform mat4 uMVP,uVP;
|
|
@@ -58,19 +58,19 @@ vec2 pxOffset=dir*(uOutlineThickness*2.0/max(uViewportSize,vec2(1.0)))*clipPos.w
|
|
|
58
58
|
clipPos.xy+=pxOffset;
|
|
59
59
|
clipPos.z+=1e-4*clipPos.w;
|
|
60
60
|
gl_Position=clipPos;
|
|
61
|
-
}`,
|
|
61
|
+
}`,Ln=`#version 300 es
|
|
62
62
|
precision highp float;
|
|
63
63
|
uniform vec4 uOutlineColor;
|
|
64
64
|
out vec4 fragColor;
|
|
65
65
|
void main(){
|
|
66
66
|
fragColor=uOutlineColor;
|
|
67
|
-
}`,
|
|
67
|
+
}`,Bt=`#version 300 es
|
|
68
68
|
out vec2 vUV;
|
|
69
69
|
void main(){
|
|
70
70
|
vec2 pos=vec2((gl_VertexID<<1)&2,gl_VertexID&2);
|
|
71
71
|
vUV=pos;
|
|
72
72
|
gl_Position=vec4(pos*2.0-1.0,0.0,1.0);
|
|
73
|
-
}`,
|
|
73
|
+
}`,Nn=`#version 300 es
|
|
74
74
|
precision highp float;
|
|
75
75
|
in vec2 vUV;
|
|
76
76
|
uniform sampler2D uSourceTex;
|
|
@@ -93,7 +93,7 @@ c+=prefilter(texture(uSourceTex,vUV+vec2(h.x,-h.y)).rgb)*0.125;
|
|
|
93
93
|
c+=prefilter(texture(uSourceTex,vUV+vec2(-h.x,h.y)).rgb)*0.125;
|
|
94
94
|
c+=prefilter(texture(uSourceTex,vUV+vec2(h.x,h.y)).rgb)*0.125;
|
|
95
95
|
fragColor=vec4(c,1.0);
|
|
96
|
-
}`,
|
|
96
|
+
}`,Pn=`#version 300 es
|
|
97
97
|
precision highp float;
|
|
98
98
|
in vec2 vUV;
|
|
99
99
|
uniform sampler2D uBloomTex;
|
|
@@ -115,6 +115,6 @@ sum+=texture(uBloomTex,vUV+vec2(-d.x,-d.y)).rgb*2.0;
|
|
|
115
115
|
vec3 bloom=(sum/12.0)*uStrength;
|
|
116
116
|
float a=clamp(min(bloom.r,min(bloom.g,bloom.b)),0.0,1.0);
|
|
117
117
|
fragColor=vec4(bloom,a);
|
|
118
|
-
}`,
|
|
119
|
-
layout(location=0) in vec3 aPosition;layout(location=1) in vec2 aUV;uniform mat4 uMVP;out vec2 vUV;void main(){vUV=aUV;gl_Position=uMVP*vec4(aPosition,1.);}`,
|
|
120
|
-
precision highp float;in vec2 vUV;uniform float uShadowIntensity,uShadowSoftness;out vec4 fragColor;void main(){vec2 p=(vUV-.5)*2.;float d=clamp(length(p),0.,1.);fragColor=vec4(0.,0.,0.,pow(1.-d*d,mix(1.2,2.8,uShadowSoftness))*smoothstep(1.,.85-uShadowSoftness*.6,d)*uShadowIntensity);}`,
|
|
118
|
+
}`,Ce=3,ye=new WeakMap;function rt(e,t=[.22,.74,.97]){let n=Ee(e,"");if(!n.startsWith("#"))return[t[0],t[1],t[2]];let r=n.slice(1);if(r.length===3){let o=+("0x"+r[0]+r[0])/255,a=+("0x"+r[1]+r[1])/255,m=+("0x"+r[2]+r[2])/255;return[o,a,m]}if(r.length===6){let o=+("0x"+r.slice(0,2))/255,a=+("0x"+r.slice(2,4))/255,m=+("0x"+r.slice(4,6))/255;return[o,a,m]}return[t[0],t[1],t[2]]}function Ht(e,t,n=.8,r=.5){let o=Number.isFinite(t)?Math.max(0,t):0;if(o<=0)return[0,0,0];let a=Math.max(0,Number(e[0])||0),m=Math.max(0,Number(e[1])||0),c=Math.max(0,Number(e[2])||0),i=Math.max(a,m,c);if(i<=1e-6)return[0,0,0];let u=Number.isFinite(n)?Math.max(0,n):.8,s=Math.max(u*Math.max(0,r),1e-4),f=Math.max(0,Math.min(2*s,i-u+s)),l=f*f/(4*s+1e-4),d=Math.min(1,Math.max(0,Math.max(l,i-u)/Math.max(i,1e-4)))*o;return[a*d,m*d,c*d]}function Wt(e,t,n,r){let o=Number(e[0])||0,a=Number(e[1])||0,m=Math.hypot(o,a);if(m<=1e-5||t<=0||n<=0)return[0,0];let c=Math.max(1,Number(r[0])||1),i=Math.max(1,Number(r[1])||1),u=Math.max(0,n)*2*t;return[o/m*(u/c),a/m*(u/i)]}function nt(e,t,n){let r=e.createProgram();if(!r)return null;let o=[];for(let[a,m]of[[35633,t],[35632,n]]){let c=e.createShader(a);c&&(e.shaderSource(c,m),e.compileShader(c),e.attachShader(r,c),o.push(c))}e.linkProgram(r);for(let a of o)e.detachShader?.(r,a),e.deleteShader?.(a);return o.length<2||typeof e.getProgramParameter=="function"&&!e.getProgramParameter(r,35714)?(e.deleteProgram?.(r),null):r}var Gt=new WeakSet;function zt(e){let t=ye.get(e);if(t){if(typeof e.isProgram!="function"||e.isProgram(t.outlineProg))return t;ye.delete(e)}if(Gt.has(e)||e.isContextLost?.())return null;let n=nt(e,In,Ln),r=nt(e,Bt,Nn),o=nt(e,Bt,Pn);if(!n||!r||!o){for(let m of[n,r,o])m&&e.deleteProgram(m);return Gt.add(e),null}let a=typeof e.createVertexArray=="function"?e.createVertexArray():null;return t={outlineProg:n,uOutlineMVP:e.getUniformLocation(n,"uMVP"),uOutlineVP:e.getUniformLocation(n,"uVP"),uOutlineNormalMatrix:e.getUniformLocation(n,"uNormalMatrix"),uOutlineViewportSize:e.getUniformLocation(n,"uViewportSize"),uOutlineThickness:e.getUniformLocation(n,"uOutlineThickness"),uOutlineColor:e.getUniformLocation(n,"uOutlineColor"),downProg:r,uDownSourceTex:e.getUniformLocation(r,"uSourceTex"),uDownTexelSize:e.getUniformLocation(r,"uTexelSize"),uDownThreshold:e.getUniformLocation(r,"uThreshold"),upProg:o,uUpBloomTex:e.getUniformLocation(o,"uBloomTex"),uUpTexelSize:e.getUniformLocation(o,"uTexelSize"),uUpRadius:e.getUniformLocation(o,"uRadius"),uUpStrength:e.getUniformLocation(o,"uStrength"),fsVao:a,sceneTex:null,bloomTex:[],bloomFbo:[],mipWidth:[],mipHeight:[],texWidth:0,texHeight:0},ye.set(e,t),t}function Un(e,t,n,r){if(typeof e.createFramebuffer!="function"||typeof e.copyTexSubImage2D!="function")return!1;let o=Math.max(2,n|0),a=Math.max(2,r|0);if(t.sceneTex&&t.bloomFbo.length===Ce&&t.texWidth===o&&t.texHeight===a)return!0;t.sceneTex||(t.sceneTex=e.createTexture()),e.bindTexture(3553,t.sceneTex),e.texImage2D(3553,0,6408,o,a,0,6408,5121,null),e.texParameteri(3553,10241,9729),e.texParameteri(3553,10240,9729),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071);let m=o,c=a;for(let i=0;i<Ce;i++)m=Math.max(1,m>>1),c=Math.max(1,c>>1),t.mipWidth[i]=m,t.mipHeight[i]=c,t.bloomTex[i]||(t.bloomTex[i]=e.createTexture()),e.bindTexture(3553,t.bloomTex[i]),e.texImage2D(3553,0,6408,m,c,0,6408,5121,null),e.texParameteri(3553,10241,9729),e.texParameteri(3553,10240,9729),e.texParameteri(3553,10242,33071),e.texParameteri(3553,10243,33071),t.bloomFbo[i]||(t.bloomFbo[i]=e.createFramebuffer()),e.bindFramebuffer(36160,t.bloomFbo[i]),e.framebufferTexture2D(36160,36064,3553,t.bloomTex[i],0);return e.bindFramebuffer(36160,null),t.texWidth=o,t.texHeight=a,!0}function Cn(e){let t=e.container;if(t&&typeof t.getAttribute=="function"){let r=t.getAttribute("bloom");if(r!==null){let o=r.trim().toLowerCase();if(o==="false"||o==="0"||o==="none")return null;let a=o===""||o==="true"?.35:Number(o);if(!Number.isFinite(a)||a<=0)return null;let m=$e({strength:a,threshold:tt(t.getAttribute("bloom-threshold"),.62),radius:tt(t.getAttribute("bloom-radius"),.75)});if(m)return m}}let n=null;for(let r of e.meshes||[]){if(r.visible===!1)continue;let o=r?.extras?.xr?.bloom??r?.userData?.xr?.bloom,a=$e(o);a&&(!n||a.strength>n.strength)&&(n=a)}return n}function Vn(e,t){if(e==null)return null;let n=e.trim(),r=n.toLowerCase();if(r==="false"||r==="0"||r==="none")return null;let o=t,a=3.5,m=!1;if(n&&r!=="true"){let c=n.split(/\s+/);for(let i of c)if(i.startsWith("#"))o=i;else if(i.toLowerCase()==="pulse")m=!0;else{let u=Number(i);Number.isFinite(u)&&u>0&&(a=u)}}return Me({color:o,thickness:a,pulse:m})}var kn=new Set(["floor","pedestal","ground","table","grid","pad"]);function On(e){return e.replace(/([a-z\d])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z]+/).some(t=>kn.has(t))}function Fn(e,t){let n=e.container,r=typeof n?.getAttribute=="function"?n.getAttribute("outline"):null;if(r!=null){let s=r.trim().toLowerCase();if(s==="false"||s==="0"||s==="none")return null}let o=t?.extras?.xr?.outline??t?.userData?.xr?.outline,a=Me(o);if(a)return a;let m=typeof n?.getAttribute=="function"&&n.getAttribute("outline-color")||"#38bdf8",c=Vn(r,m),i=n!=null&&typeof n.hasAttribute=="function"&&n.hasAttribute("outline-selected")&&n.getAttribute("outline-selected")!=="false",u=e.getSelectedMesh?.()||"";if(u)return t.name!==u?null:c||(i?Me({color:m,thickness:3,pulse:!1}):null);if(c){let s=t.name||"";return On(s)?null:c}return null}var ot={name:"postprocessing",onAttributeChanged(e,t){(t==="bloom"||t==="bloom-threshold"||t==="bloom-radius"||t==="outline"||t==="outline-selected"||t==="outline-color"||t==="selected-mesh")&&e.viewer?.render?.()},onAfterRender(e,t,n){if(!t.meshes||t.meshes.length===0)return;let r=Math.max(1,t.canvas?.width||300),o=Math.max(1,t.canvas?.height||150),a=[];for(let l of t.meshes){if(l.visible===!1)continue;let b=Fn(t,l);b&&a.push({mesh:l,trait:b})}let m=a.length>0?zt(e):null;if(m){let l=m,b=ue(),d=ue(),p=new Float32Array(9),g=(typeof performance<"u"?performance.now():Date.now())*.001,M=typeof e.getParameter=="function"?e.getParameter(e.VIEWPORT):null,I=Math.max(1,M?.[2]||r),v=Math.max(1,M?.[3]||o);e.useProgram(l.outlineProg),l.uOutlineViewportSize&&e.uniform2f(l.uOutlineViewportSize,I,v),l.uOutlineVP&&e.uniformMatrix4fv(l.uOutlineVP,!1,n),e.enable(e.CULL_FACE),e.cullFace(e.FRONT),e.enable(2929),e.depthFunc(e.LEQUAL),e.depthMask(!1);for(let{mesh:R,trait:E}of a){let[N,O,k]=rt(E.color),C=E.pulse?.8+.25*Math.sin(g*4):1;l.uOutlineColor&&e.uniform4f(l.uOutlineColor,N,O,k,1),l.uOutlineThickness&&e.uniform1f(l.uOutlineThickness,E.thickness*C),R.worldSpace===!0?b.set(R.transform):le(b,t.modelRootMatrix,R.transform);let U=R.instanceMatrices;for(let V of R.primitives)if(!(V.pluginData?.skinning?.hasSkin||V.pluginData?.morph?.hasMorph))if(e.bindVertexArray(V.vao),U&&U.length>=16){let B=U.length>>4,W=ue();for(let G=0;G<B;G++)le(W,b,U.subarray(G*16,G*16+16)),le(d,n,W),fe(p,W),e.uniformMatrix4fv(l.uOutlineMVP,!1,d),e.uniformMatrix3fv(l.uOutlineNormalMatrix,!1,p),V.indices?e.drawElements(4,V.indexCount,V.indexType,0):e.drawArrays(4,0,V.indexCount)}else le(d,n,b),fe(p,b),e.uniformMatrix4fv(l.uOutlineMVP,!1,d),e.uniformMatrix3fv(l.uOutlineNormalMatrix,!1,p),V.indices?e.drawElements(4,V.indexCount,V.indexType,0):e.drawArrays(4,0,V.indexCount)}e.bindVertexArray(null),e.cullFace(e.BACK),e.disable(e.CULL_FACE),e.depthFunc(e.LESS),e.depthMask(!0)}if(t.xrSessionActive||t.stereoSBS)return;let c=Cn(t);if(!c||c.strength<=0)return;let i=zt(e);if(!i||!Un(e,i,r,o)||!i.fsVao)return;e.activeTexture(33984),e.bindTexture(3553,i.sceneTex),e.copyTexSubImage2D(3553,0,0,0,0,0,r,o),e.disable(2929),e.depthMask(!1),e.disable(3042),e.useProgram(i.downProg),e.uniform1i(i.uDownSourceTex,0),e.bindVertexArray(i.fsVao);let u=i.sceneTex,s=r,f=o;for(let l=0;l<Ce;l++){let b=i.mipWidth[l],d=i.mipHeight[l];e.bindFramebuffer(36160,i.bloomFbo[l]),e.viewport(0,0,b,d),e.bindTexture(3553,u),e.uniform2f(i.uDownTexelSize,1/s,1/f),e.uniform1f(i.uDownThreshold,l===0?c.threshold:0),e.drawArrays(4,0,3),u=i.bloomTex[l],s=b,f=d}e.enable(3042),typeof e.blendFuncSeparate=="function"?e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,771):e.blendFunc(e.ONE,e.ONE),e.useProgram(i.upProg),e.uniform1i(i.uUpBloomTex,0),e.uniform1f(i.uUpRadius,c.radius);for(let l=Ce-1;l>=1;l--){let b=l-1;e.bindFramebuffer(36160,i.bloomFbo[b]),e.viewport(0,0,i.mipWidth[b],i.mipHeight[b]),e.bindTexture(3553,i.bloomTex[l]),e.uniform2f(i.uUpTexelSize,1/i.mipWidth[l],1/i.mipHeight[l]),e.uniform1f(i.uUpStrength,.85),e.drawArrays(4,0,3)}e.bindFramebuffer(36160,null),e.viewport(0,0,r,o),e.bindTexture(3553,i.bloomTex[0]),e.uniform2f(i.uUpTexelSize,1/i.mipWidth[0],1/i.mipHeight[0]),e.uniform1f(i.uUpStrength,c.strength),e.drawArrays(4,0,3),e.bindVertexArray(null),e.blendFunc(770,771),e.disable(3042),e.depthMask(!0),e.enable(2929)},onDestroy(e){let t=ye.get(e);if(t){e.deleteProgram(t.outlineProg),e.deleteProgram(t.downProg),e.deleteProgram(t.upProg),t.fsVao&&e.deleteVertexArray(t.fsVao),t.sceneTex&&e.deleteTexture(t.sceneTex);for(let n of t.bloomTex)n&&e.deleteTexture(n);for(let n of t.bloomFbo)n&&e.deleteFramebuffer(n);ye.delete(e)}}};var Bn=`#version 300 es
|
|
119
|
+
layout(location=0) in vec3 aPosition;layout(location=1) in vec2 aUV;uniform mat4 uMVP;out vec2 vUV;void main(){vUV=aUV;gl_Position=uMVP*vec4(aPosition,1.);}`,Gn=`#version 300 es
|
|
120
|
+
precision highp float;in vec2 vUV;uniform float uShadowIntensity,uShadowSoftness;out vec4 fragColor;void main(){vec2 p=(vUV-.5)*2.;float d=clamp(length(p),0.,1.);fragColor=vec4(0.,0.,0.,pow(1.-d*d,mix(1.2,2.8,uShadowSoftness))*smoothstep(1.,.85-uShadowSoftness*.6,d)*uShadowIntensity);}`,xe=new WeakMap,Xt=new Float32Array(20);function it(e,t){let[n,r,o,a,m,c]=t;return[e[0]*n+e[4]*r+e[8]*o+e[12],e[1]*n+e[5]*r+e[9]*o+e[13],e[2]*n+e[6]*r+e[10]*o+e[14],Math.abs(e[0])*a+Math.abs(e[4])*m+Math.abs(e[8])*c,Math.abs(e[1])*a+Math.abs(e[5])*m+Math.abs(e[9])*c,Math.abs(e[2])*a+Math.abs(e[6])*m+Math.abs(e[10])*c]}function zn(e){if(e._lb!==void 0)return e._lb;let t=1e9,n=1e9,r=1e9,o=-1e9,a=-1e9,m=-1e9;for(let c of e.primitives||[]){let i=c.positions;if(i)for(let u=0;u<i.length;u+=3)i[u]<t&&(t=i[u]),i[u+1]<n&&(n=i[u+1]),i[u+2]<r&&(r=i[u+2]),i[u]>o&&(o=i[u]),i[u+1]>a&&(a=i[u+1]),i[u+2]>m&&(m=i[u+2])}return e._lb=t<=o?[(t+o)*.5,(n+a)*.5,(r+m)*.5,(o-t)*.5,(a-n)*.5,(m-r)*.5]:null}function Hn(e){let t=xe.get(e);if(t)return t;let n=(c,i)=>{let u=e.createShader(c);return e.shaderSource(u,i),e.compileShader(u),u},r=e.createProgram();e.attachShader(r,n(35633,Bn)),e.attachShader(r,n(35632,Gn)),e.linkProgram(r);let o=e.createVertexArray(),a=e.createBuffer(),m=e.createBuffer();return e.bindVertexArray(o),e.bindBuffer(34962,a),e.bufferData(34962,80,35048),e.enableVertexAttribArray(0),e.vertexAttribPointer(0,3,5126,!1,20,0),e.enableVertexAttribArray(1),e.vertexAttribPointer(1,2,5126,!1,20,12),e.bindBuffer(34963,m),e.bufferData(34963,new Uint16Array([0,1,2,0,2,3]),35044),e.bindVertexArray(null),t={prog:r,vao:o,vbo:a,ibo:m,uMVP:e.getUniformLocation(r,"uMVP"),uIntensity:e.getUniformLocation(r,"uShadowIntensity"),uSoftness:e.getUniformLocation(r,"uShadowSoftness")},xe.set(e,t),t}var at={name:"contact-shadow",onContextRestored(e){xe.delete(e)},onAfterRender(e,t,n){let r=t.shadowIntensity;if(r<=0||!t.bounds)return;let o=Hn(e),a=!t.xrSessionActive&&(t.backdropMeshes?.length??0)>0,m=[],c=[];for(let p of t.meshes||[]){if(!p||p.visible===!1||p.isPluginMesh||p.name==="__xr_reticle__"||p.name?.startsWith("__xr_slot_"))continue;let g=zn(p);if(!g)continue;p.transform&&(g=it(p.transform,g)),t.modelRootMatrix&&(g=it(t.modelRootMatrix,g));let[M,I,v,R,E,N]=g,O=[M,v,R,N,I-E,I+E];/floor|table|pedestal|ground|base|plane/i.test(p.name||"")||E<.14&&Math.min(R,N)>.45?c.push(O):m.push(O)}let i=[],u=t.bounds.center||[0,0,0],s=Math.max(.05,Number(t.bounds.radius)||.5),f=t.bounds.min,l=f?[u[0],u[1],u[2],s,Math.max(.01,u[1]-f[1]),s]:[u[0],u[1],u[2],s,s,s];t.modelRootMatrix&&(l=it(t.modelRootMatrix,l));let d=t.xrSessionActive&&c.length===0&&String(t.container?.tagName||"").toLowerCase()==="xr-live"?(t.modelRootMatrix?t.modelRootMatrix[5]*-.25+t.modelRootMatrix[13]:-.25)+.002:l[1]-l[4]+.002;for(let[p,g,M,I,v]of m){let R=-1/0;for(let[N,O,k,C,,U]of c)v>=U-.08&&Math.abs(p-N)<=k&&Math.abs(g-O)<=C&&U+.002>R&&(R=U+.002);a&&(R=Math.max(R,p>=.04&&p<=.36&&g>=-.34&&g<=-.04&&v>=.01?.036:Math.hypot(p,g)<=.66&&v>=-.06?.003:-.477)),isFinite(R)||(R=d);let E=i.find(N=>Math.hypot(p-N[0],g-N[1])<.06&&Math.abs(R-N[5])<.05);E?(E[2]=Math.max(E[2],M*.78),E[3]=Math.max(E[3],I*.78),E[4]=Math.min(E[4],v)):i.push([p,g,M,I,v,R])}if(i.length===0){let p=Math.max(.1,l[3]*1.5)/1.45;i.push([l[0],l[2],p,p,d,d])}e.useProgram(o.prog),e.uniformMatrix4fv(o.uMVP,!1,n),e.enable(3042),(e.blendFuncSeparate||e.blendFunc).call(e,770,771,1,771),e.depthMask(!1),e.bindVertexArray(o.vao),e.bindBuffer(34962,o.vbo);for(let[p,g,M,I,v,R]of i){let E=Math.max(0,v-R),N=r/(1+E*2);if(N<.02)continue;let O=1+Math.min(.75,E*.85),k=Math.max(.045,M*1.45*O),C=Math.max(.045,I*1.45*O);Xt.set([p-k,R,g-C,0,0,p+k,R,g-C,1,0,p+k,R,g+C,1,1,p-k,R,g+C,0,1]),e.bufferSubData(34962,0,Xt),e.uniform1f(o.uIntensity,N),e.uniform1f(o.uSoftness,Math.min(1,t.shadowSoftness+Math.min(.45,E*.6))),e.drawElements(4,6,5123,0)}e.bindVertexArray(null),e.depthMask(!0),e.disable(3042)},onDestroy(e){let t=xe.get(e);t&&(e.deleteVertexArray(t.vao),e.deleteBuffer(t.vbo),e.deleteBuffer(t.ibo),e.deleteProgram(t.prog),xe.delete(e))}};function st(e){let n=e?.extensions?.KHR_materials_variants?.variants;if(!Array.isArray(n))return[];let r=[];for(let o=0;o<n.length&&r.length<256;o++){let a=n[o]?.name;r.push(typeof a=="string"&&a.length>0?a:`Variant_${o}`)}return r}function $t(e){let n=e?.extensions?.KHR_materials_variants?.mappings;if(!Array.isArray(n))return[];let r=[];for(let o of n){if(!o||typeof o!="object")continue;let a=o,m=Number(a.material);if(!Number.isInteger(m)||m<0)continue;let c=[];if(Array.isArray(a.variants))for(let i of a.variants){let u=Number(i);Number.isInteger(u)&&u>=0&&c.push(u)}c.length>0&&r.push({material:m,variants:c})}return r}function jt(e,t,n,r=0){let o=e;if(o&&typeof o.selectVariant=="function"&&!Array.isArray(t))return o.selectVariant(typeof t=="string"?t:null);let a=e,m=Array.isArray(t)?t:[],c=n??null;if(!c)return r;let u=st(a).indexOf(c);if(u<0)return r;for(let s of m)if(s.variants.includes(u))return s.material;return r}var ct={name:"variants",onLoadModel(e,t){let n=e.getVariantName?.();n&&e.selectVariant(n)}};var Kt=new WeakMap,ut={name:"webxr-suite",onConfigureXRSessionInit(e,t){let n=new Set(t.optionalFeatures||[]);n.add("hit-test"),n.add("light-estimation");let r=e?.querySelector?.('[slot="ar-overlay"]')||null;r&&(n.add("dom-overlay"),t.domOverlay={root:r},r.addEventListener?.("beforexrselect",o=>{o.preventDefault()})),t.optionalFeatures=Array.from(n)},onXRFrame(e,t,n,r){if(!e||!t||!n||!r)return;let o=Kt.get(t);if(o||(o={lightProbe:null},Kt.set(t,o),typeof t.requestLightProbe=="function"&&t.requestLightProbe().then(a=>{o&&a&&(o.lightProbe=a)}).catch(()=>{})),o.lightProbe&&typeof n.getLightEstimate=="function"){let a=n.getLightEstimate(o.lightProbe);if(a){let m=a.primaryLightDirection,c=a.primaryLightIntensity;if(m&&c&&Array.isArray(e.lights)){let i=e.lights.find(s=>s.type==="directional");i||(i={type:"directional",direction:[.5,1,.8],color:[1,1,1],intensity:1},e.lights.push(i)),i.direction=[m.x,m.y,m.z];let u=Math.max(c.x,c.y,c.z,.001);i.color=[c.x/u,c.y/u,c.z/u],i.intensity=u}a.sphericalHarmonicsCoefficients&&e.gl&&ve(e.gl,a.sphericalHarmonicsCoefficients)}}}};Z(at);Z(We);Z(Ge);Z(Qe);Z(ut);Z(qe);Z(et);Z(ct);Z(ot);
|
|
@@ -53,6 +53,7 @@ export {
|
|
|
53
53
|
installCadExtension,
|
|
54
54
|
MAX_BSP_DEPTH,
|
|
55
55
|
MAX_CSG_TRIANGLES,
|
|
56
|
+
MAX_SHAPE_POINTS,
|
|
56
57
|
MAX_TEXT_GEOMETRY_CHARS,
|
|
57
58
|
type ExtrudeGeometryOptions,
|
|
58
59
|
type TextGeometryOptions,
|
|
@@ -298,7 +299,7 @@ export interface XRLiveAttributes extends ThreeLiveAttributes {
|
|
|
298
299
|
'peer-name'?: string;
|
|
299
300
|
/** Local avatar visor & laser color (`#rrggbb`) in `shared-room`. */
|
|
300
301
|
'peer-color'?: string;
|
|
301
|
-
/** Opt-in WebRTC
|
|
302
|
+
/** Opt-in WebRTC voice signaling relay (offer/answer/ICE) and `voiceGain` helpers in `shared-room`. Apps own `RTCPeerConnection` and audio. */
|
|
302
303
|
'shared-room-voice'?: boolean | string;
|
|
303
304
|
/** xr-live-sim: character camera mode, or `none` to disable the character. */
|
|
304
305
|
'character-controller'?:
|