@konfigure/sdk 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import {a as a$1,c,e,b,d}from'./chunk-OOVVLYAY.js';import {a}from'./chunk-XUSV3KOD.js';import {BufferGeometry,Matrix4,Vector3,Vector4,MeshBasicMaterial,BufferAttribute,Mesh,ShaderMaterial,NoBlending,Vector2,WebGLRenderTarget,NearestFilter,RGBAFormat,FloatType,PerspectiveCamera,HalfFloatType,DataTexture,LinearFilter,RepeatWrapping,RedFormat,ClampToEdgeWrapping,DataUtils,Quaternion,DataArrayTexture,DoubleSide,BackSide,FrontSide,Color,WebGLArrayRenderTarget,UnsignedByteType,NoToneMapping,Spherical,EquirectangularReflectionMapping,LinearMipMapLinearFilter,Clock,Scene,AdditiveBlending,NormalBlending,Camera,SpotLight,RectAreaLight,PMREMGenerator,MeshStandardMaterial,Matrix3,Source,RGFormat}from'three';import {FullScreenQuad}from'three/examples/jsm/postprocessing/Pass.js';function ee(i,e,t=0){if(i.isInterleavedBufferAttribute){let a=i.itemSize;for(let o=0,s=i.count;o<s;o++){let r=o+t;e.setX(r,i.getX(o)),a>=2&&e.setY(r,i.getY(o)),a>=3&&e.setZ(r,i.getZ(o)),a>=4&&e.setW(r,i.getW(o));}}else {let a=e.array,o=a.constructor,s=a.BYTES_PER_ELEMENT*i.itemSize*t;new o(a.buffer,s,i.array.length).set(i.array);}}a(ee,"copyAttributeContents");function A(i,e=null){let t=i.array.constructor,a=i.normalized,o=i.itemSize,s=e===null?i.count:e;return new BufferAttribute(new t(o*s),o,a)}a(A,"createAttributeClone");function F(i,e){if(!i&&!e)return true;if(!!i!=!!e)return false;let t=i.count===e.count,a=i.normalized===e.normalized,o=i.array.constructor===e.array.constructor,s=i.itemSize===e.itemSize;return !(!t||!a||!o||!s)}a(F,"validateAttributes");function Xr(i){let e=i[0].index!==null,t=new Set(Object.keys(i[0].attributes));if(!i[0].getAttribute("position"))throw new Error("StaticGeometryGenerator: position attribute is required.");for(let a=0;a<i.length;++a){let o=i[a],s=0;if(e!==(o.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(let r in o.attributes){if(!t.has(r))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+r+'" attribute exists among all geometries, or in none of them.');s++;}if(s!==t.size)throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.")}}a(Xr,"validateMergeability");function Kr(i){let e=0;for(let t=0,a=i.length;t<a;t++)e+=i[t].getIndex().count;return e}a(Kr,"getTotalIndexCount");function Zr(i){let e=0;for(let t=0,a=i.length;t<a;t++)e+=i[t].getAttribute("position").count;return e}a(Zr,"getTotalAttributeCount");function Jr(i,e,t){i.index&&i.index.count!==e&&i.setIndex(null);let a=i.attributes;for(let o in a)a[o].count!==t&&i.deleteAttribute(o);}a(Jr,"trimMismatchedAttributes");function dt(i,e={},t=new BufferGeometry){let{useGroups:a=false,forceUpdate:o=false,skipAssigningAttributes:s=[],overwriteIndex:r=true}=e;Xr(i);let l=i[0].index!==null,f=l?Kr(i):-1,d=Zr(i);if(Jr(t,f,d),a){let u=0;for(let n=0,x=i.length;n<x;n++){let p=i[n],g;l?g=p.getIndex().count:g=p.getAttribute("position").count,t.addGroup(u,g,n),u+=g;}}if(l){let u=false;if(t.index||(t.setIndex(new BufferAttribute(new Uint32Array(f),1,false)),u=true),u||r){let n=0,x=0,p=t.getIndex();for(let g=0,c=i.length;g<c;g++){let b=i[g],v=b.getIndex();if(!(!o&&!u&&s[g]))for(let T=0;T<v.count;++T)p.setX(n+T,v.getX(T)+x);n+=v.count,x+=b.getAttribute("position").count;}}}let m=Object.keys(i[0].attributes);for(let u=0,n=m.length;u<n;u++){let x=false,p=m[u];if(!t.getAttribute(p)){let b=i[0].getAttribute(p);t.setAttribute(p,A(b,d)),x=true;}let g=0,c=t.getAttribute(p);for(let b=0,v=i.length;b<v;b++){let y=i[b],T=!o&&!x&&s[b],w=y.getAttribute(p);if(!T)if(p==="color"&&c.itemSize!==w.itemSize)for(let I=g,M=w.count;I<M;I++)w.setXYZW(I,c.getX(I),c.getY(I),c.getZ(I),1);else ee(w,c,g);g+=w.count;}}}a(dt,"mergeGeometries");function pt(i,e,t){let a=i.index,s=i.attributes.position.count,r=a?a.count:s,l=i.groups;l.length===0&&(l=[{count:r,start:0,materialIndex:0}]);let f=i.getAttribute("materialIndex");if(!f||f.count!==s){let m;t.length<=255?m=new Uint8Array(s):m=new Uint16Array(s),f=new BufferAttribute(m,1,false),i.deleteAttribute("materialIndex"),i.setAttribute("materialIndex",f);}let d=f.array;for(let m=0;m<l.length;m++){let u=l[m],n=u.start,x=u.count,p=Math.min(x,r-n),g=Array.isArray(e)?e[u.materialIndex]:e,c=t.indexOf(g);for(let b=0;b<p;b++){let v=n+b;a&&(v=a.getX(v)),d[v]=c;}}}a(pt,"updateMaterialIndexAttribute");function gt(i,e){if(!i.index){let t=i.attributes.position.count,a=new Array(t);for(let o=0;o<t;o++)a[o]=o;i.setIndex(a);}if(!i.attributes.normal&&e&&e.includes("normal")&&i.computeVertexNormals(),!i.attributes.uv&&e&&e.includes("uv")){let t=i.attributes.position.count;i.setAttribute("uv",new BufferAttribute(new Float32Array(t*2),2,false));}if(!i.attributes.uv2&&e&&e.includes("uv2")){let t=i.attributes.position.count;i.setAttribute("uv2",new BufferAttribute(new Float32Array(t*2),2,false));}if(!i.attributes.tangent&&e&&e.includes("tangent"))if(i.attributes.uv&&i.attributes.normal)i.computeTangents();else {let t=i.attributes.position.count;i.setAttribute("tangent",new BufferAttribute(new Float32Array(t*4),4,false));}if(!i.attributes.color&&e&&e.includes("color")){let t=i.attributes.position.count,a=new Float32Array(t*4);a.fill(1),i.setAttribute("color",new BufferAttribute(a,4));}}a(gt,"setCommonAttributes");function O(i){let e=0;if(i.byteLength!==0){let t=new Uint8Array(i);for(let a=0;a<i.byteLength;a++){let o=t[a];e=(e<<5)-e+o,e|=0;}}return e}a(O,"bufferToHash");function vt(i){let e=i.uuid,t=Object.values(i.attributes);i.index&&(t.push(i.index),e+=`index|${i.index.version}`);let a=Object.keys(t).sort();for(let o of a){let s=t[o];e+=`${o}_${s.version}|`;}return e}a(vt,"getGeometryHash");function xt(i){let e=i.skeleton;return e?(e.boneTexture||e.computeBoneTexture(),`${O(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`):null}a(xt,"getSkeletonHash");var te=class{static{a(this,"MeshDiff");}constructor(e=null){this.matrixWorld=new Matrix4,this.geometryHash=null,this.skeletonHash=null,this.primitiveCount=-1,e!==null&&this.updateFrom(e);}updateFrom(e){let t=e.geometry,a=(t.index?t.index.count:t.attributes.position.count)/3;this.matrixWorld.copy(e.matrixWorld),this.geometryHash=vt(t),this.primitiveCount=a,this.skeletonHash=xt(e);}didChange(e){let t=e.geometry,a=(t.index?t.index.count:t.attributes.position.count)/3;return !(this.matrixWorld.equals(e.matrixWorld)&&this.geometryHash===vt(t)&&this.skeletonHash===xt(e)&&this.primitiveCount===a)}};var P=new Vector3,D=new Vector3,E=new Vector3,bt=new Vector4,re=new Vector3,We=new Vector3,yt=new Vector4,Tt=new Vector4,ae=new Matrix4,wt=new Matrix4;function St(i,e,t){let a=i.skeleton,o=i.geometry,s=a.bones,r=a.boneInverses;yt.fromBufferAttribute(o.attributes.skinIndex,e),Tt.fromBufferAttribute(o.attributes.skinWeight,e),ae.elements.fill(0);for(let l=0;l<4;l++){let f=Tt.getComponent(l);if(f!==0){let d=yt.getComponent(l);wt.multiplyMatrices(s[d].matrixWorld,r[d]),aa(ae,wt,f);}}return ae.multiply(i.bindMatrix).premultiply(i.bindMatrixInverse),t.transformDirection(ae),t}a(St,"boneNormalTransform");function He(i,e,t,a,o){re.set(0,0,0);for(let s=0,r=i.length;s<r;s++){let l=e[s],f=i[s];l!==0&&(We.fromBufferAttribute(f,a),t?re.addScaledVector(We,l):re.addScaledVector(We.sub(o),l));}o.add(re);}a(He,"applyMorphTarget");function aa(i,e,t){let a=i.elements,o=e.elements;for(let s=0,r=o.length;s<r;s++)a[s]+=o[s]*t;}a(aa,"addScaledMatrix");function ia(i){let{index:e,attributes:t}=i;if(e)for(let a=0,o=e.count;a<o;a+=3){let s=e.getX(a),r=e.getX(a+2);e.setX(a,r),e.setX(a+2,s);}else for(let a in t){let o=t[a],s=o.itemSize;for(let r=0,l=o.count;r<l;r+=3)for(let f=0;f<s;f++){let d=o.getComponent(r,f),m=o.getComponent(r+2,f);o.setComponent(r,f,m),o.setComponent(r+2,f,d);}}return i}a(ia,"invertGeometry");function Rt(i,e={},t=new BufferGeometry){e={applyWorldTransforms:true,attributes:[],...e};let a=i.geometry,o=e.applyWorldTransforms,s=e.attributes.includes("normal"),r=e.attributes.includes("tangent"),l=a.attributes,f=t.attributes;for(let v in t.attributes)(!e.attributes.includes(v)||!(v in a.attributes))&&t.deleteAttribute(v);!t.index&&a.index&&(t.index=a.index.clone()),f.position||t.setAttribute("position",A(l.position)),s&&!f.normal&&l.normal&&t.setAttribute("normal",A(l.normal)),r&&!f.tangent&&l.tangent&&t.setAttribute("tangent",A(l.tangent)),F(a.index,t.index),F(l.position,f.position),s&&F(l.normal,f.normal),r&&F(l.tangent,f.tangent);let d=l.position,m=s?l.normal:null,u=r?l.tangent:null,n=a.morphAttributes.position,x=a.morphAttributes.normal,p=a.morphAttributes.tangent,g=a.morphTargetsRelative,c=i.morphTargetInfluences,b=new Matrix3;b.getNormalMatrix(i.matrixWorld),a.index&&t.index.array.set(a.index.array);for(let v=0,y=l.position.count;v<y;v++)P.fromBufferAttribute(d,v),m&&D.fromBufferAttribute(m,v),u&&(bt.fromBufferAttribute(u,v),E.fromBufferAttribute(u,v)),c&&(n&&He(n,c,g,v,P),x&&He(x,c,g,v,D),p&&He(p,c,g,v,E)),i.isSkinnedMesh&&(i.applyBoneTransform(v,P),m&&St(i,v,D),u&&St(i,v,E)),o&&P.applyMatrix4(i.matrixWorld),f.position.setXYZ(v,P.x,P.y,P.z),m&&(o&&D.applyNormalMatrix(b),f.normal.setXYZ(v,D.x,D.y,D.z)),u&&(o&&E.transformDirection(i.matrixWorld),f.tangent.setXYZW(v,E.x,E.y,E.z,bt.w));for(let v in e.attributes){let y=e.attributes[v];y==="position"||y==="tangent"||y==="normal"||!(y in l)||(f[y]||t.setAttribute(y,A(l[y])),F(l[y],f[y]),ee(l[y],f[y]));}return i.matrixWorld.determinant()<0&&ia(t),t}a(Rt,"convertToStaticGeometry");var ie=class extends BufferGeometry{static{a(this,"BakedGeometry");}constructor(){super(),this.version=0,this.hash=null,this._diff=new te;}isCompatible(e,t){let a=e.geometry;for(let o=0;o<t.length;o++){let s=t[o],r=a.attributes[s],l=this.attributes[s];if(r&&!F(r,l))return false}return true}updateFrom(e,t){let a=this._diff;return a.didChange(e)?(Rt(e,t,this),a.updateFrom(e),this.version++,this.hash=`${this.uuid}_${this.version}`,true):false}};var se=0,Ge=1,Ue=2;function la(i,e){for(let t=0,a=i.length;t<a;t++)i[t].traverseVisible(s=>{s.isMesh&&e(s);});}a(la,"flatTraverseMeshes");function ca(i){let e=[];for(let t=0,a=i.length;t<a;t++){let o=i[t];Array.isArray(o.material)?e.push(...o.material):e.push(o.material);}return e}a(ca,"getMaterials");function ua(i,e,t){if(i.length===0){e.setIndex(null);let a=e.attributes;for(let o in a)e.deleteAttribute(o);for(let o in t.attributes)e.setAttribute(t.attributes[o],new BufferAttribute(new Float32Array(0),4,false));}else dt(i,t,e);for(let a in e.attributes)e.attributes[a].needsUpdate=true;}a(ua,"mergeGeometryList");var oe=class{static{a(this,"StaticGeometryGenerator");}constructor(e){this.objects=null,this.useGroups=true,this.applyWorldTransforms=true,this.generateMissingAttributes=true,this.overwriteIndex=true,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Map,this._geometryMergeSets=new WeakMap,this._mergeOrder=[],this._dummyMesh=null,this.setObjects(e||[]);}_getDummyMesh(){if(!this._dummyMesh){let e=new MeshBasicMaterial,t=new BufferGeometry;t.setAttribute("position",new BufferAttribute(new Float32Array(9),3)),this._dummyMesh=new Mesh(t,e);}return this._dummyMesh}_getMeshes(){let e=[];return la(this.objects,t=>{e.push(t);}),e.sort((t,a)=>t.uuid>a.uuid?1:t.uuid<a.uuid?-1:0),e.length===0&&e.push(this._getDummyMesh()),e}_updateIntermediateGeometries(){let{_intermediateGeometry:e}=this,t=this._getMeshes(),a=new Set(e.keys()),o={attributes:this.attributes,applyWorldTransforms:this.applyWorldTransforms};for(let s=0,r=t.length;s<r;s++){let l=t[s],f=l.uuid;a.delete(f);let d=e.get(f);(!d||!d.isCompatible(l,this.attributes))&&(d&&d.dispose(),d=new ie,e.set(f,d)),d.updateFrom(l,o)&&this.generateMissingAttributes&&gt(d,this.attributes);}a.forEach(s=>{e.delete(s);});}setObjects(e){Array.isArray(e)?this.objects=[...e]:this.objects=[e];}generate(e=new BufferGeometry){let{useGroups:t,overwriteIndex:a,_intermediateGeometry:o,_geometryMergeSets:s}=this,r=this._getMeshes(),l=[],f=[],d=s.get(e)||[];this._updateIntermediateGeometries();let m=false;r.length!==d.length&&(m=true);for(let n=0,x=r.length;n<x;n++){let p=r[n],g=o.get(p.uuid);f.push(g);let c=d[n];!c||c.uuid!==g.uuid?(l.push(false),m=true):c.version!==g.version?l.push(false):l.push(true);}ua(f,e,{useGroups:t,forceUpdate:m,skipAssigningAttributes:l,overwriteIndex:a}),m&&e.dispose(),s.set(e,f.map(n=>({version:n.version,uuid:n.uuid})));let u=se;return m?u=Ue:l.includes(false)&&(u=Ge),{changeType:u,materials:ca(r),geometry:e}}};function ma(i){let e=new Set;for(let t=0,a=i.length;t<a;t++){let o=i[t];for(let s in o){let r=o[s];r&&r.isTexture&&e.add(r);}}return Array.from(e)}a(ma,"getTextures");function da(i){let e=[],t=new Set;for(let o=0,s=i.length;o<s;o++)i[o].traverse(r=>{r.visible&&(r.isRectAreaLight||r.isSpotLight||r.isPointLight||r.isDirectionalLight)&&(e.push(r),r.iesMap&&t.add(r.iesMap));});let a=Array.from(t).sort((o,s)=>o.uuid<s.uuid?1:o.uuid>s.uuid?-1:0);return {lights:e,iesTextures:a}}a(da,"getLights");var z=class{static{a(this,"PathTracingSceneGenerator");}get initialized(){return !!this.bvh}constructor(e){this.bvhOptions={},this.attributes=["position","normal","tangent","color","uv","uv2"],this.generateBVH=true,this.bvh=null,this.geometry=new BufferGeometry,this.staticGeometryGenerator=new oe(e),this._bvhWorker=null,this._pendingGenerate=null,this._buildAsync=false,this._materialUuids=null;}setObjects(e){this.staticGeometryGenerator.setObjects(e);}setBVHWorker(e){this._bvhWorker=e;}async generateAsync(e=null){if(!this._bvhWorker)throw new Error('PathTracingSceneGenerator: "setBVHWorker" must be called before "generateAsync" can be called.');if(this.bvh instanceof Promise)return this._pendingGenerate||(this._pendingGenerate=new Promise(async()=>(await this.bvh,this._pendingGenerate=null,this.generateAsync(e)))),this._pendingGenerate;{this._buildAsync=true;let t=this.generate(e);return this._buildAsync=false,t.bvh=this.bvh=await t.bvh,t}}generate(e=null){let{staticGeometryGenerator:t,geometry:a,attributes:o}=this,s=t.objects;t.attributes=o,s.forEach(n=>{n.traverse(x=>{x.isSkinnedMesh&&x.skeleton&&x.skeleton.update();});});let r=t.generate(a),l=r.materials,f=r.changeType!==se||this._materialUuids===null||this._materialUuids.length!==length;if(!f){for(let n=0,x=l.length;n<x;n++)if(l[n].uuid!==this._materialUuids[n]){f=true;break}}let d=ma(l),{lights:m,iesTextures:u}=da(s);if(f&&(pt(a,l,l),this._materialUuids=l.map(n=>n.uuid)),this.generateBVH){if(this.bvh instanceof Promise)throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");if(r.changeType===Ue){let n={strategy:2,maxLeafTris:1,indirect:true,onProgress:e,...this.bvhOptions};this._buildAsync?this.bvh=this._bvhWorker.generate(a,n):this.bvh=new a$1(a,n);}else r.changeType===Ge&&this.bvh.refit();}return {bvhChanged:r.changeType!==se,bvh:this.bvh,needsMaterialIndexUpdate:f,lights:m,iesTextures:u,geometry:a,materials:l,textures:d,objects:s}}},Ft=class extends z{static{a(this,"DynamicPathTracingSceneGenerator");}constructor(...e){super(...e),console.warn('DynamicPathTracingSceneGenerator has been deprecated and renamed to "PathTracingSceneGenerator".');}},Ct=class extends z{static{a(this,"PathTracingSceneWorker");}constructor(...e){super(...e),console.warn('PathTracingSceneWorker has been deprecated and renamed to "PathTracingSceneGenerator".');}};var _=class extends ShaderMaterial{static{a(this,"MaterialBase");}set needsUpdate(e){super.needsUpdate=true,this.dispatchEvent({type:"recompilation"});}constructor(e){super(e);for(let t in this.uniforms)Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(a){this.uniforms[t].value=a;}});}setDefine(e,t=void 0){if(t==null){if(e in this.defines)return delete this.defines[e],this.needsUpdate=true,true}else if(this.defines[e]!==t)return this.defines[e]=t,this.needsUpdate=true,true;return false}};var ne=class extends _{static{a(this,"BlendMaterial");}constructor(e){super({blending:NoBlending,uniforms:{target1:{value:null},target2:{value:null},opacity:{value:1}},vertexShader:`
1
+ import {a as a$1,d,f,c,e}from'./chunk-XR6EHOK2.js';import {a}from'./chunk-XUSV3KOD.js';import {BufferGeometry,Matrix4,Vector3,Vector4,MeshBasicMaterial,BufferAttribute,Mesh,ShaderMaterial,NoBlending,Vector2,WebGLRenderTarget,NearestFilter,RGBAFormat,FloatType,PerspectiveCamera,HalfFloatType,DataTexture,LinearFilter,RepeatWrapping,RedFormat,ClampToEdgeWrapping,DataUtils,Quaternion,DataArrayTexture,DoubleSide,BackSide,FrontSide,Color,WebGLArrayRenderTarget,UnsignedByteType,NoToneMapping,Spherical,EquirectangularReflectionMapping,LinearMipMapLinearFilter,Clock,Scene,AdditiveBlending,NormalBlending,Camera,SpotLight,RectAreaLight,PMREMGenerator,MeshStandardMaterial,Matrix3,Source,RGFormat}from'three';import {FullScreenQuad}from'three/examples/jsm/postprocessing/Pass.js';function ee(i,e,t=0){if(i.isInterleavedBufferAttribute){let a=i.itemSize;for(let o=0,s=i.count;o<s;o++){let r=o+t;e.setX(r,i.getX(o)),a>=2&&e.setY(r,i.getY(o)),a>=3&&e.setZ(r,i.getZ(o)),a>=4&&e.setW(r,i.getW(o));}}else {let a=e.array,o=a.constructor,s=a.BYTES_PER_ELEMENT*i.itemSize*t;new o(a.buffer,s,i.array.length).set(i.array);}}a(ee,"copyAttributeContents");function A(i,e=null){let t=i.array.constructor,a=i.normalized,o=i.itemSize,s=e===null?i.count:e;return new BufferAttribute(new t(o*s),o,a)}a(A,"createAttributeClone");function F(i,e){if(!i&&!e)return true;if(!!i!=!!e)return false;let t=i.count===e.count,a=i.normalized===e.normalized,o=i.array.constructor===e.array.constructor,s=i.itemSize===e.itemSize;return !(!t||!a||!o||!s)}a(F,"validateAttributes");function Xr(i){let e=i[0].index!==null,t=new Set(Object.keys(i[0].attributes));if(!i[0].getAttribute("position"))throw new Error("StaticGeometryGenerator: position attribute is required.");for(let a=0;a<i.length;++a){let o=i[a],s=0;if(e!==(o.index!==null))throw new Error("StaticGeometryGenerator: All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them.");for(let r in o.attributes){if(!t.has(r))throw new Error('StaticGeometryGenerator: All geometries must have compatible attributes; make sure "'+r+'" attribute exists among all geometries, or in none of them.');s++;}if(s!==t.size)throw new Error("StaticGeometryGenerator: All geometries must have the same number of attributes.")}}a(Xr,"validateMergeability");function Kr(i){let e=0;for(let t=0,a=i.length;t<a;t++)e+=i[t].getIndex().count;return e}a(Kr,"getTotalIndexCount");function Zr(i){let e=0;for(let t=0,a=i.length;t<a;t++)e+=i[t].getAttribute("position").count;return e}a(Zr,"getTotalAttributeCount");function Jr(i,e,t){i.index&&i.index.count!==e&&i.setIndex(null);let a=i.attributes;for(let o in a)a[o].count!==t&&i.deleteAttribute(o);}a(Jr,"trimMismatchedAttributes");function dt(i,e={},t=new BufferGeometry){let{useGroups:a=false,forceUpdate:o=false,skipAssigningAttributes:s=[],overwriteIndex:r=true}=e;Xr(i);let l=i[0].index!==null,f=l?Kr(i):-1,d=Zr(i);if(Jr(t,f,d),a){let u=0;for(let n=0,x=i.length;n<x;n++){let p=i[n],g;l?g=p.getIndex().count:g=p.getAttribute("position").count,t.addGroup(u,g,n),u+=g;}}if(l){let u=false;if(t.index||(t.setIndex(new BufferAttribute(new Uint32Array(f),1,false)),u=true),u||r){let n=0,x=0,p=t.getIndex();for(let g=0,c=i.length;g<c;g++){let b=i[g],v=b.getIndex();if(!(!o&&!u&&s[g]))for(let T=0;T<v.count;++T)p.setX(n+T,v.getX(T)+x);n+=v.count,x+=b.getAttribute("position").count;}}}let m=Object.keys(i[0].attributes);for(let u=0,n=m.length;u<n;u++){let x=false,p=m[u];if(!t.getAttribute(p)){let b=i[0].getAttribute(p);t.setAttribute(p,A(b,d)),x=true;}let g=0,c=t.getAttribute(p);for(let b=0,v=i.length;b<v;b++){let y=i[b],T=!o&&!x&&s[b],w=y.getAttribute(p);if(!T)if(p==="color"&&c.itemSize!==w.itemSize)for(let I=g,M=w.count;I<M;I++)w.setXYZW(I,c.getX(I),c.getY(I),c.getZ(I),1);else ee(w,c,g);g+=w.count;}}}a(dt,"mergeGeometries");function pt(i,e,t){let a=i.index,s=i.attributes.position.count,r=a?a.count:s,l=i.groups;l.length===0&&(l=[{count:r,start:0,materialIndex:0}]);let f=i.getAttribute("materialIndex");if(!f||f.count!==s){let m;t.length<=255?m=new Uint8Array(s):m=new Uint16Array(s),f=new BufferAttribute(m,1,false),i.deleteAttribute("materialIndex"),i.setAttribute("materialIndex",f);}let d=f.array;for(let m=0;m<l.length;m++){let u=l[m],n=u.start,x=u.count,p=Math.min(x,r-n),g=Array.isArray(e)?e[u.materialIndex]:e,c=t.indexOf(g);for(let b=0;b<p;b++){let v=n+b;a&&(v=a.getX(v)),d[v]=c;}}}a(pt,"updateMaterialIndexAttribute");function gt(i,e){if(!i.index){let t=i.attributes.position.count,a=new Array(t);for(let o=0;o<t;o++)a[o]=o;i.setIndex(a);}if(!i.attributes.normal&&e&&e.includes("normal")&&i.computeVertexNormals(),!i.attributes.uv&&e&&e.includes("uv")){let t=i.attributes.position.count;i.setAttribute("uv",new BufferAttribute(new Float32Array(t*2),2,false));}if(!i.attributes.uv2&&e&&e.includes("uv2")){let t=i.attributes.position.count;i.setAttribute("uv2",new BufferAttribute(new Float32Array(t*2),2,false));}if(!i.attributes.tangent&&e&&e.includes("tangent"))if(i.attributes.uv&&i.attributes.normal)i.computeTangents();else {let t=i.attributes.position.count;i.setAttribute("tangent",new BufferAttribute(new Float32Array(t*4),4,false));}if(!i.attributes.color&&e&&e.includes("color")){let t=i.attributes.position.count,a=new Float32Array(t*4);a.fill(1),i.setAttribute("color",new BufferAttribute(a,4));}}a(gt,"setCommonAttributes");function O(i){let e=0;if(i.byteLength!==0){let t=new Uint8Array(i);for(let a=0;a<i.byteLength;a++){let o=t[a];e=(e<<5)-e+o,e|=0;}}return e}a(O,"bufferToHash");function vt(i){let e=i.uuid,t=Object.values(i.attributes);i.index&&(t.push(i.index),e+=`index|${i.index.version}`);let a=Object.keys(t).sort();for(let o of a){let s=t[o];e+=`${o}_${s.version}|`;}return e}a(vt,"getGeometryHash");function xt(i){let e=i.skeleton;return e?(e.boneTexture||e.computeBoneTexture(),`${O(e.boneTexture.image.data.buffer)}_${e.boneTexture.uuid}`):null}a(xt,"getSkeletonHash");var te=class{static{a(this,"MeshDiff");}constructor(e=null){this.matrixWorld=new Matrix4,this.geometryHash=null,this.skeletonHash=null,this.primitiveCount=-1,e!==null&&this.updateFrom(e);}updateFrom(e){let t=e.geometry,a=(t.index?t.index.count:t.attributes.position.count)/3;this.matrixWorld.copy(e.matrixWorld),this.geometryHash=vt(t),this.primitiveCount=a,this.skeletonHash=xt(e);}didChange(e){let t=e.geometry,a=(t.index?t.index.count:t.attributes.position.count)/3;return !(this.matrixWorld.equals(e.matrixWorld)&&this.geometryHash===vt(t)&&this.skeletonHash===xt(e)&&this.primitiveCount===a)}};var P=new Vector3,D=new Vector3,E=new Vector3,bt=new Vector4,re=new Vector3,We=new Vector3,yt=new Vector4,Tt=new Vector4,ae=new Matrix4,wt=new Matrix4;function St(i,e,t){let a=i.skeleton,o=i.geometry,s=a.bones,r=a.boneInverses;yt.fromBufferAttribute(o.attributes.skinIndex,e),Tt.fromBufferAttribute(o.attributes.skinWeight,e),ae.elements.fill(0);for(let l=0;l<4;l++){let f=Tt.getComponent(l);if(f!==0){let d=yt.getComponent(l);wt.multiplyMatrices(s[d].matrixWorld,r[d]),aa(ae,wt,f);}}return ae.multiply(i.bindMatrix).premultiply(i.bindMatrixInverse),t.transformDirection(ae),t}a(St,"boneNormalTransform");function He(i,e,t,a,o){re.set(0,0,0);for(let s=0,r=i.length;s<r;s++){let l=e[s],f=i[s];l!==0&&(We.fromBufferAttribute(f,a),t?re.addScaledVector(We,l):re.addScaledVector(We.sub(o),l));}o.add(re);}a(He,"applyMorphTarget");function aa(i,e,t){let a=i.elements,o=e.elements;for(let s=0,r=o.length;s<r;s++)a[s]+=o[s]*t;}a(aa,"addScaledMatrix");function ia(i){let{index:e,attributes:t}=i;if(e)for(let a=0,o=e.count;a<o;a+=3){let s=e.getX(a),r=e.getX(a+2);e.setX(a,r),e.setX(a+2,s);}else for(let a in t){let o=t[a],s=o.itemSize;for(let r=0,l=o.count;r<l;r+=3)for(let f=0;f<s;f++){let d=o.getComponent(r,f),m=o.getComponent(r+2,f);o.setComponent(r,f,m),o.setComponent(r+2,f,d);}}return i}a(ia,"invertGeometry");function Rt(i,e={},t=new BufferGeometry){e={applyWorldTransforms:true,attributes:[],...e};let a=i.geometry,o=e.applyWorldTransforms,s=e.attributes.includes("normal"),r=e.attributes.includes("tangent"),l=a.attributes,f=t.attributes;for(let v in t.attributes)(!e.attributes.includes(v)||!(v in a.attributes))&&t.deleteAttribute(v);!t.index&&a.index&&(t.index=a.index.clone()),f.position||t.setAttribute("position",A(l.position)),s&&!f.normal&&l.normal&&t.setAttribute("normal",A(l.normal)),r&&!f.tangent&&l.tangent&&t.setAttribute("tangent",A(l.tangent)),F(a.index,t.index),F(l.position,f.position),s&&F(l.normal,f.normal),r&&F(l.tangent,f.tangent);let d=l.position,m=s?l.normal:null,u=r?l.tangent:null,n=a.morphAttributes.position,x=a.morphAttributes.normal,p=a.morphAttributes.tangent,g=a.morphTargetsRelative,c=i.morphTargetInfluences,b=new Matrix3;b.getNormalMatrix(i.matrixWorld),a.index&&t.index.array.set(a.index.array);for(let v=0,y=l.position.count;v<y;v++)P.fromBufferAttribute(d,v),m&&D.fromBufferAttribute(m,v),u&&(bt.fromBufferAttribute(u,v),E.fromBufferAttribute(u,v)),c&&(n&&He(n,c,g,v,P),x&&He(x,c,g,v,D),p&&He(p,c,g,v,E)),i.isSkinnedMesh&&(i.applyBoneTransform(v,P),m&&St(i,v,D),u&&St(i,v,E)),o&&P.applyMatrix4(i.matrixWorld),f.position.setXYZ(v,P.x,P.y,P.z),m&&(o&&D.applyNormalMatrix(b),f.normal.setXYZ(v,D.x,D.y,D.z)),u&&(o&&E.transformDirection(i.matrixWorld),f.tangent.setXYZW(v,E.x,E.y,E.z,bt.w));for(let v in e.attributes){let y=e.attributes[v];y==="position"||y==="tangent"||y==="normal"||!(y in l)||(f[y]||t.setAttribute(y,A(l[y])),F(l[y],f[y]),ee(l[y],f[y]));}return i.matrixWorld.determinant()<0&&ia(t),t}a(Rt,"convertToStaticGeometry");var ie=class extends BufferGeometry{static{a(this,"BakedGeometry");}constructor(){super(),this.version=0,this.hash=null,this._diff=new te;}isCompatible(e,t){let a=e.geometry;for(let o=0;o<t.length;o++){let s=t[o],r=a.attributes[s],l=this.attributes[s];if(r&&!F(r,l))return false}return true}updateFrom(e,t){let a=this._diff;return a.didChange(e)?(Rt(e,t,this),a.updateFrom(e),this.version++,this.hash=`${this.uuid}_${this.version}`,true):false}};var se=0,Ge=1,Ue=2;function la(i,e){for(let t=0,a=i.length;t<a;t++)i[t].traverseVisible(s=>{s.isMesh&&e(s);});}a(la,"flatTraverseMeshes");function ca(i){let e=[];for(let t=0,a=i.length;t<a;t++){let o=i[t];Array.isArray(o.material)?e.push(...o.material):e.push(o.material);}return e}a(ca,"getMaterials");function ua(i,e,t){if(i.length===0){e.setIndex(null);let a=e.attributes;for(let o in a)e.deleteAttribute(o);for(let o in t.attributes)e.setAttribute(t.attributes[o],new BufferAttribute(new Float32Array(0),4,false));}else dt(i,t,e);for(let a in e.attributes)e.attributes[a].needsUpdate=true;}a(ua,"mergeGeometryList");var oe=class{static{a(this,"StaticGeometryGenerator");}constructor(e){this.objects=null,this.useGroups=true,this.applyWorldTransforms=true,this.generateMissingAttributes=true,this.overwriteIndex=true,this.attributes=["position","normal","color","tangent","uv","uv2"],this._intermediateGeometry=new Map,this._geometryMergeSets=new WeakMap,this._mergeOrder=[],this._dummyMesh=null,this.setObjects(e||[]);}_getDummyMesh(){if(!this._dummyMesh){let e=new MeshBasicMaterial,t=new BufferGeometry;t.setAttribute("position",new BufferAttribute(new Float32Array(9),3)),this._dummyMesh=new Mesh(t,e);}return this._dummyMesh}_getMeshes(){let e=[];return la(this.objects,t=>{e.push(t);}),e.sort((t,a)=>t.uuid>a.uuid?1:t.uuid<a.uuid?-1:0),e.length===0&&e.push(this._getDummyMesh()),e}_updateIntermediateGeometries(){let{_intermediateGeometry:e}=this,t=this._getMeshes(),a=new Set(e.keys()),o={attributes:this.attributes,applyWorldTransforms:this.applyWorldTransforms};for(let s=0,r=t.length;s<r;s++){let l=t[s],f=l.uuid;a.delete(f);let d=e.get(f);(!d||!d.isCompatible(l,this.attributes))&&(d&&d.dispose(),d=new ie,e.set(f,d)),d.updateFrom(l,o)&&this.generateMissingAttributes&&gt(d,this.attributes);}a.forEach(s=>{e.delete(s);});}setObjects(e){Array.isArray(e)?this.objects=[...e]:this.objects=[e];}generate(e=new BufferGeometry){let{useGroups:t,overwriteIndex:a,_intermediateGeometry:o,_geometryMergeSets:s}=this,r=this._getMeshes(),l=[],f=[],d=s.get(e)||[];this._updateIntermediateGeometries();let m=false;r.length!==d.length&&(m=true);for(let n=0,x=r.length;n<x;n++){let p=r[n],g=o.get(p.uuid);f.push(g);let c=d[n];!c||c.uuid!==g.uuid?(l.push(false),m=true):c.version!==g.version?l.push(false):l.push(true);}ua(f,e,{useGroups:t,forceUpdate:m,skipAssigningAttributes:l,overwriteIndex:a}),m&&e.dispose(),s.set(e,f.map(n=>({version:n.version,uuid:n.uuid})));let u=se;return m?u=Ue:l.includes(false)&&(u=Ge),{changeType:u,materials:ca(r),geometry:e}}};function ma(i){let e=new Set;for(let t=0,a=i.length;t<a;t++){let o=i[t];for(let s in o){let r=o[s];r&&r.isTexture&&e.add(r);}}return Array.from(e)}a(ma,"getTextures");function da(i){let e=[],t=new Set;for(let o=0,s=i.length;o<s;o++)i[o].traverse(r=>{r.visible&&(r.isRectAreaLight||r.isSpotLight||r.isPointLight||r.isDirectionalLight)&&(e.push(r),r.iesMap&&t.add(r.iesMap));});let a=Array.from(t).sort((o,s)=>o.uuid<s.uuid?1:o.uuid>s.uuid?-1:0);return {lights:e,iesTextures:a}}a(da,"getLights");var z=class{static{a(this,"PathTracingSceneGenerator");}get initialized(){return !!this.bvh}constructor(e){this.bvhOptions={},this.attributes=["position","normal","tangent","color","uv","uv2"],this.generateBVH=true,this.bvh=null,this.geometry=new BufferGeometry,this.staticGeometryGenerator=new oe(e),this._bvhWorker=null,this._pendingGenerate=null,this._buildAsync=false,this._materialUuids=null;}setObjects(e){this.staticGeometryGenerator.setObjects(e);}setBVHWorker(e){this._bvhWorker=e;}async generateAsync(e=null){if(!this._bvhWorker)throw new Error('PathTracingSceneGenerator: "setBVHWorker" must be called before "generateAsync" can be called.');if(this.bvh instanceof Promise)return this._pendingGenerate||(this._pendingGenerate=new Promise(async()=>(await this.bvh,this._pendingGenerate=null,this.generateAsync(e)))),this._pendingGenerate;{this._buildAsync=true;let t=this.generate(e);return this._buildAsync=false,t.bvh=this.bvh=await t.bvh,t}}generate(e=null){let{staticGeometryGenerator:t,geometry:a,attributes:o}=this,s=t.objects;t.attributes=o,s.forEach(n=>{n.traverse(x=>{x.isSkinnedMesh&&x.skeleton&&x.skeleton.update();});});let r=t.generate(a),l=r.materials,f=r.changeType!==se||this._materialUuids===null||this._materialUuids.length!==length;if(!f){for(let n=0,x=l.length;n<x;n++)if(l[n].uuid!==this._materialUuids[n]){f=true;break}}let d=ma(l),{lights:m,iesTextures:u}=da(s);if(f&&(pt(a,l,l),this._materialUuids=l.map(n=>n.uuid)),this.generateBVH){if(this.bvh instanceof Promise)throw new Error("PathTracingSceneGenerator: BVH is already building asynchronously.");if(r.changeType===Ue){let n={strategy:2,maxLeafTris:1,indirect:true,onProgress:e,...this.bvhOptions};this._buildAsync?this.bvh=this._bvhWorker.generate(a,n):this.bvh=new a$1(a,n);}else r.changeType===Ge&&this.bvh.refit();}return {bvhChanged:r.changeType!==se,bvh:this.bvh,needsMaterialIndexUpdate:f,lights:m,iesTextures:u,geometry:a,materials:l,textures:d,objects:s}}},Ft=class extends z{static{a(this,"DynamicPathTracingSceneGenerator");}constructor(...e){super(...e),console.warn('DynamicPathTracingSceneGenerator has been deprecated and renamed to "PathTracingSceneGenerator".');}},Ct=class extends z{static{a(this,"PathTracingSceneWorker");}constructor(...e){super(...e),console.warn('PathTracingSceneWorker has been deprecated and renamed to "PathTracingSceneGenerator".');}};var _=class extends ShaderMaterial{static{a(this,"MaterialBase");}set needsUpdate(e){super.needsUpdate=true,this.dispatchEvent({type:"recompilation"});}constructor(e){super(e);for(let t in this.uniforms)Object.defineProperty(this,t,{get(){return this.uniforms[t].value},set(a){this.uniforms[t].value=a;}});}setDefine(e,t=void 0){if(t==null){if(e in this.defines)return delete this.defines[e],this.needsUpdate=true,true}else if(this.defines[e]!==t)return this.defines[e]=t,this.needsUpdate=true,true;return false}};var ne=class extends _{static{a(this,"BlendMaterial");}constructor(e){super({blending:NoBlending,uniforms:{target1:{value:null},target2:{value:null},opacity:{value:1}},vertexShader:`
2
2
 
3
3
  varying vec2 vUv;
4
4
 
@@ -254,7 +254,7 @@ import {a as a$1,c,e,b,d}from'./chunk-OOVVLYAY.js';import {a}from'./chunk-XUSV3K
254
254
  gl_FragColor = generateSobolPoint( index );
255
255
 
256
256
  }
257
- `});}},fe=class{static{a(this,"SobolNumberMapGenerator");}generate(e,t=256){let a=new WebGLRenderTarget(t,t,{type:FloatType,format:RGBAFormat,minFilter:NearestFilter,magFilter:NearestFilter,generateMipmaps:false}),o=e.getRenderTarget();e.setRenderTarget(a);let s=new FullScreenQuad(new Ve);return s.material.resolution.set(t,t),s.render(e),e.setRenderTarget(o),s.dispose(),a}};var he=class extends PerspectiveCamera{static{a(this,"PhysicalCamera");}set bokehSize(e){this.fStop=this.getFocalLength()/e;}get bokehSize(){return this.getFocalLength()/this.fStop}constructor(...e){super(...e),this.fStop=1.4,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=25,this.anamorphicRatio=1;}copy(e,t){return super.copy(e,t),this.fStop=e.fStop,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio,this}};var me=class{static{a(this,"PhysicalCameraUniform");}constructor(){this.bokehSize=0,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=10,this.anamorphicRatio=1;}updateFrom(e){e instanceof he?(this.bokehSize=e.bokehSize,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio):(this.bokehSize=0,this.apertureRotation=0,this.apertureBlades=0,this.focusDistance=10,this.anamorphicRatio=1);}};function de(i){let e=new Uint16Array(i.length);for(let t=0,a=i.length;t<a;++t)e[t]=DataUtils.toHalfFloat(i[t]);return e}a(de,"toHalfFloatArray");function kt(i,e,t=0,a=i.length){let o=t,s=t+a-1;for(;o<s;){let r=o+s>>1;i[r]<e?o=r+1:s=r;}return o-t}a(kt,"binarySearchFindClosestIndexOf");function Ca(i,e,t){return .2126*i+.7152*e+.0722*t}a(Ca,"colorToLuminance");function Aa(i,e=HalfFloatType){let t=i.clone();t.source=new Source({...t.image});let{width:a,height:o,data:s}=t.image,r=s;if(t.type!==e){e===HalfFloatType?r=new Uint16Array(s.length):r=new Float32Array(s.length);let l;s instanceof Int8Array||s instanceof Int16Array||s instanceof Int32Array?l=2**(8*s.BYTES_PER_ELEMENT-1)-1:l=2**(8*s.BYTES_PER_ELEMENT)-1;for(let f=0,d=s.length;f<d;f++){let m=s[f];t.type===HalfFloatType&&(m=DataUtils.fromHalfFloat(s[f])),t.type!==FloatType&&t.type!==HalfFloatType&&(m/=l),e===HalfFloatType&&(r[f]=DataUtils.toHalfFloat(m));}t.image.data=r,t.type=e;}if(t.flipY){let l=r;r=r.slice();for(let f=0;f<o;f++)for(let d=0;d<a;d++){let m=o-f-1,u=4*(f*a+d),n=4*(m*a+d);r[n+0]=l[u+0],r[n+1]=l[u+1],r[n+2]=l[u+2],r[n+3]=l[u+3];}t.flipY=false,t.image.data=r;}return t}a(Aa,"preprocessEnvMap");var pe=class{static{a(this,"EquirectHdrInfoUniform");}constructor(){let e=new DataTexture(de(new Float32Array([0,0,0,0])),1,1);e.type=HalfFloatType,e.format=RGBAFormat,e.minFilter=LinearFilter,e.magFilter=LinearFilter,e.wrapS=RepeatWrapping,e.wrapT=RepeatWrapping,e.generateMipmaps=false,e.needsUpdate=true;let t=new DataTexture(de(new Float32Array([0,1])),1,2);t.type=HalfFloatType,t.format=RedFormat,t.minFilter=LinearFilter,t.magFilter=LinearFilter,t.generateMipmaps=false,t.needsUpdate=true;let a=new DataTexture(de(new Float32Array([0,0,1,1])),2,2);a.type=HalfFloatType,a.format=RedFormat,a.minFilter=LinearFilter,a.magFilter=LinearFilter,a.generateMipmaps=false,a.needsUpdate=true,this.map=e,this.marginalWeights=t,this.conditionalWeights=a,this.totalSum=0;}dispose(){this.marginalWeights.dispose(),this.conditionalWeights.dispose(),this.map.dispose();}updateFrom(e){let t=Aa(e);t.wrapS=RepeatWrapping,t.wrapT=ClampToEdgeWrapping;let{width:a,height:o,data:s}=t.image,r=new Float32Array(a*o),l=new Float32Array(a*o),f=new Float32Array(o),d=new Float32Array(o),m=0,u=0;for(let c=0;c<o;c++){let b=0;for(let v=0;v<a;v++){let y=c*a+v,T=DataUtils.fromHalfFloat(s[4*y+0]),w=DataUtils.fromHalfFloat(s[4*y+1]),I=DataUtils.fromHalfFloat(s[4*y+2]),M=Ca(T,w,I);b+=M,m+=M,r[y]=M,l[y]=b;}if(b!==0)for(let v=c*a,y=c*a+a;v<y;v++)r[v]/=b,l[v]/=b;u+=b,f[c]=b,d[c]=u;}if(u!==0)for(let c=0,b=f.length;c<b;c++)f[c]/=u,d[c]/=u;let n=new Uint16Array(o),x=new Uint16Array(a*o);for(let c=0;c<o;c++){let b=(c+1)/o,v=kt(d,b);n[c]=DataUtils.toHalfFloat((v+.5)/o);}for(let c=0;c<o;c++)for(let b=0;b<a;b++){let v=c*a+b,y=(b+1)/a,T=kt(l,y,c*a,a);x[v]=DataUtils.toHalfFloat((T+.5)/a);}this.dispose();let{marginalWeights:p,conditionalWeights:g}=this;p.image={width:o,height:1,data:n},p.needsUpdate=true,g.image={width:a,height:o,data:x},g.needsUpdate=true,this.totalSum=m,this.map=t;}};var je=6,Oa=0,za=1,Ba=2,Wa=3,Ha=4,R=new Vector3,S=new Vector3,zt=new Matrix4,W=new Quaternion,Bt=new Vector3,H=new Vector3,Na=new Vector3(0,1,0),ge=class{static{a(this,"LightsInfoUniformStruct");}constructor(){let e=new DataTexture(new Float32Array(4),1,1);e.format=RGBAFormat,e.type=FloatType,e.wrapS=ClampToEdgeWrapping,e.wrapT=ClampToEdgeWrapping,e.generateMipmaps=false,e.minFilter=NearestFilter,e.magFilter=NearestFilter,this.tex=e,this.count=0;}updateFrom(e,t=[]){let a=this.tex,o=Math.max(e.length*je,1),s=Math.ceil(Math.sqrt(o));a.image.width!==s&&(a.dispose(),a.image.data=new Float32Array(s*s*4),a.image.width=s,a.image.height=s);let r=a.image.data;for(let f=0,d=e.length;f<d;f++){let m=e[f],u=f*je*4,n=0;for(let p=0;p<je*4;p++)r[u+p]=0;m.getWorldPosition(S),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z;let x=Oa;if(m.isRectAreaLight&&m.isCircular?x=za:m.isSpotLight?x=Ba:m.isDirectionalLight?x=Wa:m.isPointLight&&(x=Ha),r[u+n++]=x,r[u+n++]=m.color.r,r[u+n++]=m.color.g,r[u+n++]=m.color.b,r[u+n++]=m.intensity,m.getWorldQuaternion(W),m.isRectAreaLight)R.set(m.width,0,0).applyQuaternion(W),r[u+n++]=R.x,r[u+n++]=R.y,r[u+n++]=R.z,n++,S.set(0,m.height,0).applyQuaternion(W),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z,r[u+n++]=R.cross(S).length()*(m.isCircular?Math.PI/4:1);else if(m.isSpotLight){let p=m.radius||0;Bt.setFromMatrixPosition(m.matrixWorld),H.setFromMatrixPosition(m.target.matrixWorld),zt.lookAt(Bt,H,Na),W.setFromRotationMatrix(zt),R.set(1,0,0).applyQuaternion(W),r[u+n++]=R.x,r[u+n++]=R.y,r[u+n++]=R.z,n++,S.set(0,1,0).applyQuaternion(W),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z,r[u+n++]=Math.PI*p*p,r[u+n++]=p,r[u+n++]=m.decay,r[u+n++]=m.distance,r[u+n++]=Math.cos(m.angle),r[u+n++]=Math.cos(m.angle*(1-m.penumbra)),r[u+n++]=m.iesMap?t.indexOf(m.iesMap):-1;}else if(m.isPointLight){let p=R.setFromMatrixPosition(m.matrixWorld);r[u+n++]=p.x,r[u+n++]=p.y,r[u+n++]=p.z,n++,n+=4,n+=1,r[u+n++]=m.decay,r[u+n++]=m.distance;}else if(m.isDirectionalLight){let p=R.setFromMatrixPosition(m.matrixWorld),g=S.setFromMatrixPosition(m.target.matrixWorld);H.subVectors(p,g).normalize(),r[u+n++]=H.x,r[u+n++]=H.y,r[u+n++]=H.z;}}this.count=e.length;let l=O(r.buffer);return this.hash!==l?(this.hash=l,a.needsUpdate=true,true):false}};function Wt(i,e,t,a,o){if(e>a)throw new Error;let s=i.length/e,r=i.constructor.BYTES_PER_ELEMENT*8,l=1;switch(i.constructor){case Uint8Array:case Uint16Array:case Uint32Array:l=2**r-1;break;case Int8Array:case Int16Array:case Int32Array:l=2**(r-1)-1;break}for(let f=0;f<s;f++){let d=4*f,m=e*f;for(let u=0;u<a;u++)t[o+d+u]=e>=u+1?i[m+u]/l:0;}}a(Wt,"copyArrayToArray");var ve=class extends DataArrayTexture{static{a(this,"FloatAttributeTextureArray");}constructor(){super(),this._textures=[],this.type=FloatType,this.format=RGBAFormat,this.internalFormat="RGBA32F";}updateAttribute(e,t){let a=this._textures[e];a.updateFrom(t);let o=a.image,s=this.image;if(o.width!==s.width||o.height!==s.height)throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");let{width:r,height:l,data:f}=s,m=r*l*4*e,u=t.itemSize;u===3&&(u=4),Wt(a.image.data,u,f,4,m),this.dispose(),this.needsUpdate=true;}setAttributes(e){let t=e[0].count,a=e.length;for(let u=0,n=a;u<n;u++)if(e[u].count!==t)throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");let o=this._textures;for(;o.length<a;){let u=new c;o.push(u);}for(;o.length>a;)o.pop();for(let u=0,n=a;u<n;u++)o[u].updateFrom(e[u]);let r=o[0].image,l=this.image;(r.width!==l.width||r.height!==l.height||r.depth!==a)&&(l.width=r.width,l.height=r.height,l.depth=a,l.data=new Float32Array(l.width*l.height*l.depth*4));let{data:f,width:d,height:m}=l;for(let u=0,n=a;u<n;u++){let x=o[u],g=d*m*4*u,c=e[u].itemSize;c===3&&(c=4),Wt(x.image.data,c,f,4,g);}this.dispose(),this.needsUpdate=true;}};var xe=class extends ve{static{a(this,"AttributesTextureArray");}updateNormalAttribute(e){this.updateAttribute(0,e);}updateTangentAttribute(e){this.updateAttribute(1,e);}updateUvAttribute(e){this.updateAttribute(2,e);}updateColorAttribute(e){this.updateAttribute(3,e);}updateFrom(e,t,a,o){this.setAttributes([e,t,a,o]);}};function Ye(i,e){return i.uuid<e.uuid?1:i.uuid>e.uuid?-1:0}a(Ye,"uuidSort");function be(i){return `${i.source.uuid}:${i.colorSpace}`}a(be,"getTextureHash");function qa(i){let e=new Set,t=[];for(let a=0,o=i.length;a<o;a++){let s=i[a],r=be(s);e.has(r)||(e.add(r),t.push(s));}return t}a(qa,"reduceTexturesToUniqueSources");function Ht(i){let e=i.map(a=>a.iesMap||null).filter(a=>a),t=new Set(e);return Array.from(t).sort(Ye)}a(Ht,"getIesTextures");function Nt(i){let e=new Set;for(let a=0,o=i.length;a<o;a++){let s=i[a];for(let r in s){let l=s[r];l&&l.isTexture&&e.add(l);}}let t=Array.from(e);return qa(t).sort(Ye)}a(Nt,"getTextures");function Gt(i){let e=[];return i.traverse(t=>{t.visible&&(t.isRectAreaLight||t.isSpotLight||t.isPointLight||t.isDirectionalLight)&&e.push(t);}),e.sort(Ye)}a(Gt,"getLights");var Te=47,qt=Te*4,Qe=class{static{a(this,"MaterialFeatures");}constructor(){this._features={};}isUsed(e){return e in this._features}setUsed(e,t=true){t===false?delete this._features[e]:this._features[e]=true;}reset(){this._features={};}},ye=class extends DataTexture{static{a(this,"MaterialsTexture");}constructor(){super(new Float32Array(4),1,1),this.format=RGBAFormat,this.type=FloatType,this.wrapS=ClampToEdgeWrapping,this.wrapT=ClampToEdgeWrapping,this.minFilter=NearestFilter,this.magFilter=NearestFilter,this.generateMipmaps=false,this.features=new Qe;}updateFrom(e,t){function a$1(p,g,c=-1){if(g in p&&p[g]){let b=be(p[g]);return u[b]}else return c}a(a$1,"getTexture");function o(p,g,c){return g in p?p[g]:c}a(o,"getField");function s(p,g,c,b){let v=p[g]&&p[g].isTexture?p[g]:null;if(v){v.matrixAutoUpdate&&v.updateMatrix();let y=v.matrix.elements,T=0;c[b+T++]=y[0],c[b+T++]=y[3],c[b+T++]=y[6],T++,c[b+T++]=y[1],c[b+T++]=y[4],c[b+T++]=y[7],T++;}return 8}a(s,"writeTextureMatrixToArray");let r=0,l=e.length*Te,f=Math.ceil(Math.sqrt(l))||1,{image:d,features:m}=this,u={};for(let p=0,g=t.length;p<g;p++)u[be(t[p])]=p;d.width!==f&&(this.dispose(),d.data=new Float32Array(f*f*4),d.width=f,d.height=f);let n=d.data;m.reset();for(let p=0,g=e.length;p<g;p++){let c=e[p];if(c.isFogVolumeMaterial){m.setUsed("FOG");for(let y=0;y<qt;y++)n[r+y]=0;n[r+0+0]=c.color.r,n[r+0+1]=c.color.g,n[r+0+2]=c.color.b,n[r+8+3]=o(c,"emissiveIntensity",0),n[r+12+0]=c.emissive.r,n[r+12+1]=c.emissive.g,n[r+12+2]=c.emissive.b,n[r+52+1]=c.density,n[r+52+3]=0,n[r+56+2]=4,r+=qt;continue}n[r++]=c.color.r,n[r++]=c.color.g,n[r++]=c.color.b,n[r++]=a$1(c,"map"),n[r++]=o(c,"metalness",0),n[r++]=a$1(c,"metalnessMap"),n[r++]=o(c,"roughness",0),n[r++]=a$1(c,"roughnessMap"),n[r++]=o(c,"ior",1.5),n[r++]=o(c,"transmission",0),n[r++]=a$1(c,"transmissionMap"),n[r++]=o(c,"emissiveIntensity",0),"emissive"in c?(n[r++]=c.emissive.r,n[r++]=c.emissive.g,n[r++]=c.emissive.b):(n[r++]=0,n[r++]=0,n[r++]=0),n[r++]=a$1(c,"emissiveMap"),n[r++]=a$1(c,"normalMap"),"normalScale"in c?(n[r++]=c.normalScale.x,n[r++]=c.normalScale.y):(n[r++]=1,n[r++]=1),n[r++]=o(c,"clearcoat",0),n[r++]=a$1(c,"clearcoatMap"),n[r++]=o(c,"clearcoatRoughness",0),n[r++]=a$1(c,"clearcoatRoughnessMap"),n[r++]=a$1(c,"clearcoatNormalMap"),"clearcoatNormalScale"in c?(n[r++]=c.clearcoatNormalScale.x,n[r++]=c.clearcoatNormalScale.y):(n[r++]=1,n[r++]=1),r++,n[r++]=o(c,"sheen",0),"sheenColor"in c?(n[r++]=c.sheenColor.r,n[r++]=c.sheenColor.g,n[r++]=c.sheenColor.b):(n[r++]=0,n[r++]=0,n[r++]=0),n[r++]=a$1(c,"sheenColorMap"),n[r++]=o(c,"sheenRoughness",0),n[r++]=a$1(c,"sheenRoughnessMap"),n[r++]=a$1(c,"iridescenceMap"),n[r++]=a$1(c,"iridescenceThicknessMap"),n[r++]=o(c,"iridescence",0),n[r++]=o(c,"iridescenceIOR",1.3);let b=o(c,"iridescenceThicknessRange",[100,400]);n[r++]=b[0],n[r++]=b[1],"specularColor"in c?(n[r++]=c.specularColor.r,n[r++]=c.specularColor.g,n[r++]=c.specularColor.b):(n[r++]=1,n[r++]=1,n[r++]=1),n[r++]=a$1(c,"specularColorMap"),n[r++]=o(c,"specularIntensity",1),n[r++]=a$1(c,"specularIntensityMap");let v=o(c,"thickness",0)===0&&o(c,"attenuationDistance",1/0)===1/0;if(n[r++]=Number(v),r++,"attenuationColor"in c?(n[r++]=c.attenuationColor.r,n[r++]=c.attenuationColor.g,n[r++]=c.attenuationColor.b):(n[r++]=1,n[r++]=1,n[r++]=1),n[r++]=o(c,"attenuationDistance",1/0),n[r++]=a$1(c,"alphaMap"),n[r++]=c.opacity,n[r++]=c.alphaTest,!v&&c.transmission>0)n[r++]=0;else switch(c.side){case FrontSide:n[r++]=1;break;case BackSide:n[r++]=-1;break;case DoubleSide:n[r++]=0;break}n[r++]=Number(o(c,"matte",false)),n[r++]=Number(o(c,"castShadow",true)),n[r++]=Number(c.vertexColors)|Number(c.flatShading)<<1,n[r++]=Number(c.transparent),r+=s(c,"map",n,r),r+=s(c,"metalnessMap",n,r),r+=s(c,"roughnessMap",n,r),r+=s(c,"transmissionMap",n,r),r+=s(c,"emissiveMap",n,r),r+=s(c,"normalMap",n,r),r+=s(c,"clearcoatMap",n,r),r+=s(c,"clearcoatNormalMap",n,r),r+=s(c,"clearcoatRoughnessMap",n,r),r+=s(c,"sheenColorMap",n,r),r+=s(c,"sheenRoughnessMap",n,r),r+=s(c,"iridescenceMap",n,r),r+=s(c,"iridescenceThicknessMap",n,r),r+=s(c,"specularColorMap",n,r),r+=s(c,"specularIntensityMap",n,r),r+=s(c,"alphaMap",n,r);}let x=O(n.buffer);return this.hash!==x?(this.hash=x,this.needsUpdate=true,true):false}};var Yt=new Color;function oi(i){return i?`${i.uuid}:${i.version}`:null}a(oi,"getTextureHash");function si(i,e){for(let t in e)t in i&&(i[t]=e[t]);}a(si,"assignOptions");var j=class extends WebGLArrayRenderTarget{static{a(this,"RenderTarget2DArray");}constructor(e,t,a){let o={format:RGBAFormat,type:UnsignedByteType,minFilter:LinearFilter,magFilter:LinearFilter,wrapS:RepeatWrapping,wrapT:RepeatWrapping,generateMipmaps:false,...a};super(e,t,1,o),si(this.texture,o),this.texture.setTextures=(...r)=>{this.setTextures(...r);},this.hashes=[null];let s=new FullScreenQuad(new Xe);this.fsQuad=s;}setTextures(e,t,a=this.width,o=this.height){let s=e.getRenderTarget(),r=e.toneMapping,l=e.getClearAlpha();e.getClearColor(Yt);let f=t.length||1;(a!==this.width||o!==this.height||this.depth!==f)&&(this.setSize(a,o,f),this.hashes=new Array(f).fill(null)),e.setClearColor(0,0),e.toneMapping=NoToneMapping;let d=this.fsQuad,m=this.hashes,u=false;for(let n=0,x=f;n<x;n++){let p=t[n],g=oi(p);p&&(m[n]!==g||p.isWebGLRenderTarget)&&(p.matrixAutoUpdate=false,p.matrix.identity(),d.material.map=p,e.setRenderTarget(this,n),d.render(e),p.updateMatrix(),p.matrixAutoUpdate=true,m[n]=g,u=true);}return d.material.map=null,e.setClearColor(Yt,l),e.setRenderTarget(s),e.toneMapping=r,u}dispose(){super.dispose(),this.fsQuad.dispose();}},Xe=class extends ShaderMaterial{static{a(this,"CopyMaterial");}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e;}constructor(){super({uniforms:{map:{value:null}},vertexShader:`
257
+ `});}},fe=class{static{a(this,"SobolNumberMapGenerator");}generate(e,t=256){let a=new WebGLRenderTarget(t,t,{type:FloatType,format:RGBAFormat,minFilter:NearestFilter,magFilter:NearestFilter,generateMipmaps:false}),o=e.getRenderTarget();e.setRenderTarget(a);let s=new FullScreenQuad(new Ve);return s.material.resolution.set(t,t),s.render(e),e.setRenderTarget(o),s.dispose(),a}};var he=class extends PerspectiveCamera{static{a(this,"PhysicalCamera");}set bokehSize(e){this.fStop=this.getFocalLength()/e;}get bokehSize(){return this.getFocalLength()/this.fStop}constructor(...e){super(...e),this.fStop=1.4,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=25,this.anamorphicRatio=1;}copy(e,t){return super.copy(e,t),this.fStop=e.fStop,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio,this}};var me=class{static{a(this,"PhysicalCameraUniform");}constructor(){this.bokehSize=0,this.apertureBlades=0,this.apertureRotation=0,this.focusDistance=10,this.anamorphicRatio=1;}updateFrom(e){e instanceof he?(this.bokehSize=e.bokehSize,this.apertureBlades=e.apertureBlades,this.apertureRotation=e.apertureRotation,this.focusDistance=e.focusDistance,this.anamorphicRatio=e.anamorphicRatio):(this.bokehSize=0,this.apertureRotation=0,this.apertureBlades=0,this.focusDistance=10,this.anamorphicRatio=1);}};function de(i){let e=new Uint16Array(i.length);for(let t=0,a=i.length;t<a;++t)e[t]=DataUtils.toHalfFloat(i[t]);return e}a(de,"toHalfFloatArray");function kt(i,e,t=0,a=i.length){let o=t,s=t+a-1;for(;o<s;){let r=o+s>>1;i[r]<e?o=r+1:s=r;}return o-t}a(kt,"binarySearchFindClosestIndexOf");function Ca(i,e,t){return .2126*i+.7152*e+.0722*t}a(Ca,"colorToLuminance");function Aa(i,e=HalfFloatType){let t=i.clone();t.source=new Source({...t.image});let{width:a,height:o,data:s}=t.image,r=s;if(t.type!==e){e===HalfFloatType?r=new Uint16Array(s.length):r=new Float32Array(s.length);let l;s instanceof Int8Array||s instanceof Int16Array||s instanceof Int32Array?l=2**(8*s.BYTES_PER_ELEMENT-1)-1:l=2**(8*s.BYTES_PER_ELEMENT)-1;for(let f=0,d=s.length;f<d;f++){let m=s[f];t.type===HalfFloatType&&(m=DataUtils.fromHalfFloat(s[f])),t.type!==FloatType&&t.type!==HalfFloatType&&(m/=l),e===HalfFloatType&&(r[f]=DataUtils.toHalfFloat(m));}t.image.data=r,t.type=e;}if(t.flipY){let l=r;r=r.slice();for(let f=0;f<o;f++)for(let d=0;d<a;d++){let m=o-f-1,u=4*(f*a+d),n=4*(m*a+d);r[n+0]=l[u+0],r[n+1]=l[u+1],r[n+2]=l[u+2],r[n+3]=l[u+3];}t.flipY=false,t.image.data=r;}return t}a(Aa,"preprocessEnvMap");var pe=class{static{a(this,"EquirectHdrInfoUniform");}constructor(){let e=new DataTexture(de(new Float32Array([0,0,0,0])),1,1);e.type=HalfFloatType,e.format=RGBAFormat,e.minFilter=LinearFilter,e.magFilter=LinearFilter,e.wrapS=RepeatWrapping,e.wrapT=RepeatWrapping,e.generateMipmaps=false,e.needsUpdate=true;let t=new DataTexture(de(new Float32Array([0,1])),1,2);t.type=HalfFloatType,t.format=RedFormat,t.minFilter=LinearFilter,t.magFilter=LinearFilter,t.generateMipmaps=false,t.needsUpdate=true;let a=new DataTexture(de(new Float32Array([0,0,1,1])),2,2);a.type=HalfFloatType,a.format=RedFormat,a.minFilter=LinearFilter,a.magFilter=LinearFilter,a.generateMipmaps=false,a.needsUpdate=true,this.map=e,this.marginalWeights=t,this.conditionalWeights=a,this.totalSum=0;}dispose(){this.marginalWeights.dispose(),this.conditionalWeights.dispose(),this.map.dispose();}updateFrom(e){let t=Aa(e);t.wrapS=RepeatWrapping,t.wrapT=ClampToEdgeWrapping;let{width:a,height:o,data:s}=t.image,r=new Float32Array(a*o),l=new Float32Array(a*o),f=new Float32Array(o),d=new Float32Array(o),m=0,u=0;for(let c=0;c<o;c++){let b=0;for(let v=0;v<a;v++){let y=c*a+v,T=DataUtils.fromHalfFloat(s[4*y+0]),w=DataUtils.fromHalfFloat(s[4*y+1]),I=DataUtils.fromHalfFloat(s[4*y+2]),M=Ca(T,w,I);b+=M,m+=M,r[y]=M,l[y]=b;}if(b!==0)for(let v=c*a,y=c*a+a;v<y;v++)r[v]/=b,l[v]/=b;u+=b,f[c]=b,d[c]=u;}if(u!==0)for(let c=0,b=f.length;c<b;c++)f[c]/=u,d[c]/=u;let n=new Uint16Array(o),x=new Uint16Array(a*o);for(let c=0;c<o;c++){let b=(c+1)/o,v=kt(d,b);n[c]=DataUtils.toHalfFloat((v+.5)/o);}for(let c=0;c<o;c++)for(let b=0;b<a;b++){let v=c*a+b,y=(b+1)/a,T=kt(l,y,c*a,a);x[v]=DataUtils.toHalfFloat((T+.5)/a);}this.dispose();let{marginalWeights:p,conditionalWeights:g}=this;p.image={width:o,height:1,data:n},p.needsUpdate=true,g.image={width:a,height:o,data:x},g.needsUpdate=true,this.totalSum=m,this.map=t;}};var je=6,Oa=0,za=1,Ba=2,Wa=3,Ha=4,R=new Vector3,S=new Vector3,zt=new Matrix4,W=new Quaternion,Bt=new Vector3,H=new Vector3,Na=new Vector3(0,1,0),ge=class{static{a(this,"LightsInfoUniformStruct");}constructor(){let e=new DataTexture(new Float32Array(4),1,1);e.format=RGBAFormat,e.type=FloatType,e.wrapS=ClampToEdgeWrapping,e.wrapT=ClampToEdgeWrapping,e.generateMipmaps=false,e.minFilter=NearestFilter,e.magFilter=NearestFilter,this.tex=e,this.count=0;}updateFrom(e,t=[]){let a=this.tex,o=Math.max(e.length*je,1),s=Math.ceil(Math.sqrt(o));a.image.width!==s&&(a.dispose(),a.image.data=new Float32Array(s*s*4),a.image.width=s,a.image.height=s);let r=a.image.data;for(let f=0,d=e.length;f<d;f++){let m=e[f],u=f*je*4,n=0;for(let p=0;p<je*4;p++)r[u+p]=0;m.getWorldPosition(S),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z;let x=Oa;if(m.isRectAreaLight&&m.isCircular?x=za:m.isSpotLight?x=Ba:m.isDirectionalLight?x=Wa:m.isPointLight&&(x=Ha),r[u+n++]=x,r[u+n++]=m.color.r,r[u+n++]=m.color.g,r[u+n++]=m.color.b,r[u+n++]=m.intensity,m.getWorldQuaternion(W),m.isRectAreaLight)R.set(m.width,0,0).applyQuaternion(W),r[u+n++]=R.x,r[u+n++]=R.y,r[u+n++]=R.z,n++,S.set(0,m.height,0).applyQuaternion(W),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z,r[u+n++]=R.cross(S).length()*(m.isCircular?Math.PI/4:1);else if(m.isSpotLight){let p=m.radius||0;Bt.setFromMatrixPosition(m.matrixWorld),H.setFromMatrixPosition(m.target.matrixWorld),zt.lookAt(Bt,H,Na),W.setFromRotationMatrix(zt),R.set(1,0,0).applyQuaternion(W),r[u+n++]=R.x,r[u+n++]=R.y,r[u+n++]=R.z,n++,S.set(0,1,0).applyQuaternion(W),r[u+n++]=S.x,r[u+n++]=S.y,r[u+n++]=S.z,r[u+n++]=Math.PI*p*p,r[u+n++]=p,r[u+n++]=m.decay,r[u+n++]=m.distance,r[u+n++]=Math.cos(m.angle),r[u+n++]=Math.cos(m.angle*(1-m.penumbra)),r[u+n++]=m.iesMap?t.indexOf(m.iesMap):-1;}else if(m.isPointLight){let p=R.setFromMatrixPosition(m.matrixWorld);r[u+n++]=p.x,r[u+n++]=p.y,r[u+n++]=p.z,n++,n+=4,n+=1,r[u+n++]=m.decay,r[u+n++]=m.distance;}else if(m.isDirectionalLight){let p=R.setFromMatrixPosition(m.matrixWorld),g=S.setFromMatrixPosition(m.target.matrixWorld);H.subVectors(p,g).normalize(),r[u+n++]=H.x,r[u+n++]=H.y,r[u+n++]=H.z;}}this.count=e.length;let l=O(r.buffer);return this.hash!==l?(this.hash=l,a.needsUpdate=true,true):false}};function Wt(i,e,t,a,o){if(e>a)throw new Error;let s=i.length/e,r=i.constructor.BYTES_PER_ELEMENT*8,l=1;switch(i.constructor){case Uint8Array:case Uint16Array:case Uint32Array:l=2**r-1;break;case Int8Array:case Int16Array:case Int32Array:l=2**(r-1)-1;break}for(let f=0;f<s;f++){let d=4*f,m=e*f;for(let u=0;u<a;u++)t[o+d+u]=e>=u+1?i[m+u]/l:0;}}a(Wt,"copyArrayToArray");var ve=class extends DataArrayTexture{static{a(this,"FloatAttributeTextureArray");}constructor(){super(),this._textures=[],this.type=FloatType,this.format=RGBAFormat,this.internalFormat="RGBA32F";}updateAttribute(e,t){let a=this._textures[e];a.updateFrom(t);let o=a.image,s=this.image;if(o.width!==s.width||o.height!==s.height)throw new Error("FloatAttributeTextureArray: Attribute must be the same dimensions when updating single layer.");let{width:r,height:l,data:f}=s,m=r*l*4*e,u=t.itemSize;u===3&&(u=4),Wt(a.image.data,u,f,4,m),this.dispose(),this.needsUpdate=true;}setAttributes(e){let t=e[0].count,a=e.length;for(let u=0,n=a;u<n;u++)if(e[u].count!==t)throw new Error("FloatAttributeTextureArray: All attributes must have the same item count.");let o=this._textures;for(;o.length<a;){let u=new d;o.push(u);}for(;o.length>a;)o.pop();for(let u=0,n=a;u<n;u++)o[u].updateFrom(e[u]);let r=o[0].image,l=this.image;(r.width!==l.width||r.height!==l.height||r.depth!==a)&&(l.width=r.width,l.height=r.height,l.depth=a,l.data=new Float32Array(l.width*l.height*l.depth*4));let{data:f,width:d$1,height:m}=l;for(let u=0,n=a;u<n;u++){let x=o[u],g=d$1*m*4*u,c=e[u].itemSize;c===3&&(c=4),Wt(x.image.data,c,f,4,g);}this.dispose(),this.needsUpdate=true;}};var xe=class extends ve{static{a(this,"AttributesTextureArray");}updateNormalAttribute(e){this.updateAttribute(0,e);}updateTangentAttribute(e){this.updateAttribute(1,e);}updateUvAttribute(e){this.updateAttribute(2,e);}updateColorAttribute(e){this.updateAttribute(3,e);}updateFrom(e,t,a,o){this.setAttributes([e,t,a,o]);}};function Ye(i,e){return i.uuid<e.uuid?1:i.uuid>e.uuid?-1:0}a(Ye,"uuidSort");function be(i){return `${i.source.uuid}:${i.colorSpace}`}a(be,"getTextureHash");function qa(i){let e=new Set,t=[];for(let a=0,o=i.length;a<o;a++){let s=i[a],r=be(s);e.has(r)||(e.add(r),t.push(s));}return t}a(qa,"reduceTexturesToUniqueSources");function Ht(i){let e=i.map(a=>a.iesMap||null).filter(a=>a),t=new Set(e);return Array.from(t).sort(Ye)}a(Ht,"getIesTextures");function Nt(i){let e=new Set;for(let a=0,o=i.length;a<o;a++){let s=i[a];for(let r in s){let l=s[r];l&&l.isTexture&&e.add(l);}}let t=Array.from(e);return qa(t).sort(Ye)}a(Nt,"getTextures");function Gt(i){let e=[];return i.traverse(t=>{t.visible&&(t.isRectAreaLight||t.isSpotLight||t.isPointLight||t.isDirectionalLight)&&e.push(t);}),e.sort(Ye)}a(Gt,"getLights");var Te=47,qt=Te*4,Qe=class{static{a(this,"MaterialFeatures");}constructor(){this._features={};}isUsed(e){return e in this._features}setUsed(e,t=true){t===false?delete this._features[e]:this._features[e]=true;}reset(){this._features={};}},ye=class extends DataTexture{static{a(this,"MaterialsTexture");}constructor(){super(new Float32Array(4),1,1),this.format=RGBAFormat,this.type=FloatType,this.wrapS=ClampToEdgeWrapping,this.wrapT=ClampToEdgeWrapping,this.minFilter=NearestFilter,this.magFilter=NearestFilter,this.generateMipmaps=false,this.features=new Qe;}updateFrom(e,t){function a$1(p,g,c=-1){if(g in p&&p[g]){let b=be(p[g]);return u[b]}else return c}a(a$1,"getTexture");function o(p,g,c){return g in p?p[g]:c}a(o,"getField");function s(p,g,c,b){let v=p[g]&&p[g].isTexture?p[g]:null;if(v){v.matrixAutoUpdate&&v.updateMatrix();let y=v.matrix.elements,T=0;c[b+T++]=y[0],c[b+T++]=y[3],c[b+T++]=y[6],T++,c[b+T++]=y[1],c[b+T++]=y[4],c[b+T++]=y[7],T++;}return 8}a(s,"writeTextureMatrixToArray");let r=0,l=e.length*Te,f=Math.ceil(Math.sqrt(l))||1,{image:d,features:m}=this,u={};for(let p=0,g=t.length;p<g;p++)u[be(t[p])]=p;d.width!==f&&(this.dispose(),d.data=new Float32Array(f*f*4),d.width=f,d.height=f);let n=d.data;m.reset();for(let p=0,g=e.length;p<g;p++){let c=e[p];if(c.isFogVolumeMaterial){m.setUsed("FOG");for(let y=0;y<qt;y++)n[r+y]=0;n[r+0+0]=c.color.r,n[r+0+1]=c.color.g,n[r+0+2]=c.color.b,n[r+8+3]=o(c,"emissiveIntensity",0),n[r+12+0]=c.emissive.r,n[r+12+1]=c.emissive.g,n[r+12+2]=c.emissive.b,n[r+52+1]=c.density,n[r+52+3]=0,n[r+56+2]=4,r+=qt;continue}n[r++]=c.color.r,n[r++]=c.color.g,n[r++]=c.color.b,n[r++]=a$1(c,"map"),n[r++]=o(c,"metalness",0),n[r++]=a$1(c,"metalnessMap"),n[r++]=o(c,"roughness",0),n[r++]=a$1(c,"roughnessMap"),n[r++]=o(c,"ior",1.5),n[r++]=o(c,"transmission",0),n[r++]=a$1(c,"transmissionMap"),n[r++]=o(c,"emissiveIntensity",0),"emissive"in c?(n[r++]=c.emissive.r,n[r++]=c.emissive.g,n[r++]=c.emissive.b):(n[r++]=0,n[r++]=0,n[r++]=0),n[r++]=a$1(c,"emissiveMap"),n[r++]=a$1(c,"normalMap"),"normalScale"in c?(n[r++]=c.normalScale.x,n[r++]=c.normalScale.y):(n[r++]=1,n[r++]=1),n[r++]=o(c,"clearcoat",0),n[r++]=a$1(c,"clearcoatMap"),n[r++]=o(c,"clearcoatRoughness",0),n[r++]=a$1(c,"clearcoatRoughnessMap"),n[r++]=a$1(c,"clearcoatNormalMap"),"clearcoatNormalScale"in c?(n[r++]=c.clearcoatNormalScale.x,n[r++]=c.clearcoatNormalScale.y):(n[r++]=1,n[r++]=1),r++,n[r++]=o(c,"sheen",0),"sheenColor"in c?(n[r++]=c.sheenColor.r,n[r++]=c.sheenColor.g,n[r++]=c.sheenColor.b):(n[r++]=0,n[r++]=0,n[r++]=0),n[r++]=a$1(c,"sheenColorMap"),n[r++]=o(c,"sheenRoughness",0),n[r++]=a$1(c,"sheenRoughnessMap"),n[r++]=a$1(c,"iridescenceMap"),n[r++]=a$1(c,"iridescenceThicknessMap"),n[r++]=o(c,"iridescence",0),n[r++]=o(c,"iridescenceIOR",1.3);let b=o(c,"iridescenceThicknessRange",[100,400]);n[r++]=b[0],n[r++]=b[1],"specularColor"in c?(n[r++]=c.specularColor.r,n[r++]=c.specularColor.g,n[r++]=c.specularColor.b):(n[r++]=1,n[r++]=1,n[r++]=1),n[r++]=a$1(c,"specularColorMap"),n[r++]=o(c,"specularIntensity",1),n[r++]=a$1(c,"specularIntensityMap");let v=o(c,"thickness",0)===0&&o(c,"attenuationDistance",1/0)===1/0;if(n[r++]=Number(v),r++,"attenuationColor"in c?(n[r++]=c.attenuationColor.r,n[r++]=c.attenuationColor.g,n[r++]=c.attenuationColor.b):(n[r++]=1,n[r++]=1,n[r++]=1),n[r++]=o(c,"attenuationDistance",1/0),n[r++]=a$1(c,"alphaMap"),n[r++]=c.opacity,n[r++]=c.alphaTest,!v&&c.transmission>0)n[r++]=0;else switch(c.side){case FrontSide:n[r++]=1;break;case BackSide:n[r++]=-1;break;case DoubleSide:n[r++]=0;break}n[r++]=Number(o(c,"matte",false)),n[r++]=Number(o(c,"castShadow",true)),n[r++]=Number(c.vertexColors)|Number(c.flatShading)<<1,n[r++]=Number(c.transparent),r+=s(c,"map",n,r),r+=s(c,"metalnessMap",n,r),r+=s(c,"roughnessMap",n,r),r+=s(c,"transmissionMap",n,r),r+=s(c,"emissiveMap",n,r),r+=s(c,"normalMap",n,r),r+=s(c,"clearcoatMap",n,r),r+=s(c,"clearcoatNormalMap",n,r),r+=s(c,"clearcoatRoughnessMap",n,r),r+=s(c,"sheenColorMap",n,r),r+=s(c,"sheenRoughnessMap",n,r),r+=s(c,"iridescenceMap",n,r),r+=s(c,"iridescenceThicknessMap",n,r),r+=s(c,"specularColorMap",n,r),r+=s(c,"specularIntensityMap",n,r),r+=s(c,"alphaMap",n,r);}let x=O(n.buffer);return this.hash!==x?(this.hash=x,this.needsUpdate=true,true):false}};var Yt=new Color;function oi(i){return i?`${i.uuid}:${i.version}`:null}a(oi,"getTextureHash");function si(i,e){for(let t in e)t in i&&(i[t]=e[t]);}a(si,"assignOptions");var j=class extends WebGLArrayRenderTarget{static{a(this,"RenderTarget2DArray");}constructor(e,t,a){let o={format:RGBAFormat,type:UnsignedByteType,minFilter:LinearFilter,magFilter:LinearFilter,wrapS:RepeatWrapping,wrapT:RepeatWrapping,generateMipmaps:false,...a};super(e,t,1,o),si(this.texture,o),this.texture.setTextures=(...r)=>{this.setTextures(...r);},this.hashes=[null];let s=new FullScreenQuad(new Xe);this.fsQuad=s;}setTextures(e,t,a=this.width,o=this.height){let s=e.getRenderTarget(),r=e.toneMapping,l=e.getClearAlpha();e.getClearColor(Yt);let f=t.length||1;(a!==this.width||o!==this.height||this.depth!==f)&&(this.setSize(a,o,f),this.hashes=new Array(f).fill(null)),e.setClearColor(0,0),e.toneMapping=NoToneMapping;let d=this.fsQuad,m=this.hashes,u=false;for(let n=0,x=f;n<x;n++){let p=t[n],g=oi(p);p&&(m[n]!==g||p.isWebGLRenderTarget)&&(p.matrixAutoUpdate=false,p.matrix.identity(),d.material.map=p,e.setRenderTarget(this,n),d.render(e),p.updateMatrix(),p.matrixAutoUpdate=true,m[n]=g,u=true);}return d.material.map=null,e.setClearColor(Yt,l),e.setRenderTarget(s),e.toneMapping=r,u}dispose(){super.dispose(),this.fsQuad.dispose();}},Xe=class extends ShaderMaterial{static{a(this,"CopyMaterial");}get map(){return this.uniforms.map.value}set map(e){this.uniforms.map.value=e;}constructor(){super({uniforms:{map:{value:null}},vertexShader:`
258
258
  varying vec2 vUv;
259
259
  void main() {
260
260
 
@@ -3133,7 +3133,7 @@ bool bvhIntersectFogVolumeHit(
3133
3133
 
3134
3134
  }
3135
3135
 
3136
- `;var Fe=class extends _{static{a(this,"PhysicalPathTracingMaterial");}onBeforeRender(){this.setDefine("FEATURE_DOF",this.physicalCamera.bokehSize===0?0:1),this.setDefine("FEATURE_BACKGROUND_MAP",this.backgroundMap?1:0),this.setDefine("FEATURE_FOG",this.materials.features.isUsed("FOG")?1:0);}constructor(e$1){super({transparent:true,depthWrite:false,defines:{FEATURE_MIS:1,FEATURE_RUSSIAN_ROULETTE:1,FEATURE_DOF:1,FEATURE_BACKGROUND_MAP:0,FEATURE_FOG:1,RANDOM_TYPE:2,CAMERA_TYPE:0,DEBUG_MODE:0,ATTR_NORMAL:0,ATTR_TANGENT:1,ATTR_UV:2,ATTR_COLOR:3,MATERIAL_PIXELS:Te},uniforms:{resolution:{value:new Vector2},opacity:{value:1},bounces:{value:10},transmissiveBounces:{value:10},filterGlossyFactor:{value:0},physicalCamera:{value:new me},cameraWorldMatrix:{value:new Matrix4},invProjectionMatrix:{value:new Matrix4},bvh:{value:new d},attributesArray:{value:new xe},materialIndexAttribute:{value:new b},materials:{value:new ye},textures:{value:new j().texture},lights:{value:new ge},iesProfiles:{value:new j(360,180,{type:HalfFloatType,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping}).texture},environmentIntensity:{value:1},environmentRotation:{value:new Matrix4},envMapInfo:{value:new pe},backgroundBlur:{value:0},backgroundMap:{value:null},backgroundAlpha:{value:1},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix4},seed:{value:0},sobolTexture:{value:null},stratifiedTexture:{value:new _e},stratifiedOffsetTexture:{value:new Ie(64,1)}},vertexShader:`
3136
+ `;var Fe=class extends _{static{a(this,"PhysicalPathTracingMaterial");}onBeforeRender(){this.setDefine("FEATURE_DOF",this.physicalCamera.bokehSize===0?0:1),this.setDefine("FEATURE_BACKGROUND_MAP",this.backgroundMap?1:0),this.setDefine("FEATURE_FOG",this.materials.features.isUsed("FOG")?1:0);}constructor(e$1){super({transparent:true,depthWrite:false,defines:{FEATURE_MIS:1,FEATURE_RUSSIAN_ROULETTE:1,FEATURE_DOF:1,FEATURE_BACKGROUND_MAP:0,FEATURE_FOG:1,RANDOM_TYPE:2,CAMERA_TYPE:0,DEBUG_MODE:0,ATTR_NORMAL:0,ATTR_TANGENT:1,ATTR_UV:2,ATTR_COLOR:3,MATERIAL_PIXELS:Te},uniforms:{resolution:{value:new Vector2},opacity:{value:1},bounces:{value:10},transmissiveBounces:{value:10},filterGlossyFactor:{value:0},physicalCamera:{value:new me},cameraWorldMatrix:{value:new Matrix4},invProjectionMatrix:{value:new Matrix4},bvh:{value:new e},attributesArray:{value:new xe},materialIndexAttribute:{value:new c},materials:{value:new ye},textures:{value:new j().texture},lights:{value:new ge},iesProfiles:{value:new j(360,180,{type:HalfFloatType,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping}).texture},environmentIntensity:{value:1},environmentRotation:{value:new Matrix4},envMapInfo:{value:new pe},backgroundBlur:{value:0},backgroundMap:{value:null},backgroundAlpha:{value:1},backgroundIntensity:{value:1},backgroundRotation:{value:new Matrix4},seed:{value:0},sobolTexture:{value:null},stratifiedTexture:{value:new _e},stratifiedOffsetTexture:{value:new Ie(64,1)}},vertexShader:`
3137
3137
 
3138
3138
  varying vec2 vUv;
3139
3139
  void main() {
@@ -3157,9 +3157,9 @@ bool bvhIntersectFogVolumeHit(
3157
3157
  #include <common>
3158
3158
 
3159
3159
  // bvh intersection
3160
- ${e.common_functions}
3161
- ${e.bvh_struct_definitions}
3162
- ${e.bvh_ray_functions}
3160
+ ${f.common_functions}
3161
+ ${f.bvh_struct_definitions}
3162
+ ${f.bvh_ray_functions}
3163
3163
 
3164
3164
  // uniform structs
3165
3165
  ${er}
package/dist/view.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Scene, PerspectiveCamera, WebGLRenderer, Vector3Tuple, Material, Mesh } from 'three';
2
2
  import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
3
- import { a as Configurator } from './configurator-6ISAZiAx.js';
3
+ import { e as Configurator } from './configurator-CnGR3YDW.js';
4
4
 
5
5
  declare const ScenePreset: {
6
6
  readonly ROOM: "room";