@jdultra/threedtiles 13.0.30 → 13.0.31

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.
@@ -9,6 +9,7 @@ export class SplatsMesh extends Mesh<import("three").BufferGeometry<import("thre
9
9
  numTextures: number;
10
10
  batchSize: number;
11
11
  maxSplats: number;
12
+ numSplatsRendered: number;
12
13
  colorRenderTarget: WebGL3DRenderTarget;
13
14
  positionRenderTarget: WebGL3DRenderTarget;
14
15
  cov1RenderTarget: WebGL3DRenderTarget;
@@ -10,7 +10,7 @@
10
10
  * @author Kirk Qi
11
11
  * @copyright Copyright (c) 2022 Kirk Qi <qilinaus@gmail.com>
12
12
  * @license MIT License
13
- */class ne extends tA{constructor(a=[],t){super(t);ie(this,"_elements",[]);ie(this,"_DEFAULT_COMPARATOR",(a,t)=>{if(typeof a=="object"||typeof t=="object")throw TypeError("When comparing object types, a custom comparator must be defined in the constructor's options parameter.");return a>t?1:a<t?-1:0});ie(this,"_comparator",this._DEFAULT_COMPARATOR);if(t){const{comparator:A}=t;A&&(this._comparator=A)}if(a)for(const A of a)this.toElementFn?this.add(this.toElementFn(A)):this.add(A)}get elements(){return this._elements}get size(){return this.elements.length}get leaf(){return this.elements[this.size-1]??void 0}static heapify(a,t){return new ne(a,t)}add(a){return this._elements.push(a),this._bubbleUp(this.elements.length-1)}poll(){if(this.elements.length===0)return;const a=this.elements[0],t=this.elements.pop();return this.elements.length&&(this.elements[0]=t,this._sinkDown(0,this.elements.length>>1)),a}peek(){return this.elements[0]}isEmpty(){return this.size===0}clear(){this._elements=[]}refill(a){return this._elements=a,this.fix()}has(a){return this.elements.includes(a)}delete(a){const t=this.elements.indexOf(a);return!(t<0)&&(t===0?this.poll():t===this.elements.length-1?this.elements.pop():(this.elements.splice(t,1,this.elements.pop()),this._bubbleUp(t),this._sinkDown(t,this.elements.length>>1)),!0)}dfs(a="PRE"){const t=[],A=i=>{const s=2*i+1,r=s+1;i<this.size&&(a==="IN"?(A(s),t.push(this.elements[i]),A(r)):a==="PRE"?(t.push(this.elements[i]),A(s),A(r)):a==="POST"&&(A(s),A(r),t.push(this.elements[i])))};return A(0),t}toArray(){return[...this.elements]}clone(){return new ne(this,{comparator:this.comparator,toElementFn:this.toElementFn})}sort(){const a=[],t=new ne(this,{comparator:this.comparator});for(;t.size!==0;){const A=t.poll();A!==void 0&&a.push(A)}return a}fix(){const a=[];for(let t=Math.floor(this.size/2);t>=0;t--)a.push(this._sinkDown(t,this.elements.length>>1));return a}filter(a,t){const A=new ne([],{toElementFn:this.toElementFn,comparator:this.comparator});let i=0;for(const s of this)a.call(t,s,i,this)&&A.add(s),i++;return A}map(a,t,A,i){const s=new ne([],{comparator:t,toElementFn:A});let r=0;for(const c of this)s.add(a.call(i,c,r,this)),r++;return s}get comparator(){return this._comparator}*_getIterator(){for(const a of this.elements)yield a}_bubbleUp(a){const t=this.elements[a];for(;a>0;){const A=a-1>>1,i=this.elements[A];if(this.comparator(i,t)<=0)break;this.elements[a]=i,a=A}return this.elements[a]=t,!0}_sinkDown(a,t){const A=this.elements[a];for(;a<t;){let i=a<<1|1;const s=i+1;let r=this.elements[i];if(s<this.elements.length&&this.comparator(r,this.elements[s])>0&&(i=s,r=this.elements[s]),this.comparator(r,A)>=0)break;this.elements[a]=r,a=i}return this.elements[a]=A,!0}}(function(o){o[o.VISIT=0]="VISIT",o[o.PROCESS=1]="PROCESS"})(ya||(ya={}));class Ee extends ne{constructor(e=[],a){super(e,a)}clone(){return new Ee(this,{comparator:this.comparator,toElementFn:this.toElementFn})}filter(e,a){const t=new Ee([],{toElementFn:this.toElementFn,comparator:this.comparator});let A=0;for(const i of this)e.call(a,i,A,this)&&t.add(i),A++;return t}map(e,a,t,A){const i=new Ee([],{comparator:a,toElementFn:t});let s=0;for(const r of this)i.add(e.call(A,r,s,this)),s++;return i}}class Qe extends Ee{constructor(e=[],a){super(e,a)}clone(){return new Qe(this,{comparator:this.comparator,toElementFn:this.toElementFn})}filter(e,a){const t=new Qe([],{toElementFn:this.toElementFn,comparator:this.comparator});let A=0;for(const i of this)e.call(a,i,A,this)&&t.add(i),A++;return t}map(e,a,t,A){const i=new Qe([],{comparator:a,toElementFn:t});let s=0;for(const r of this)i.add(e.call(A,r,s,this)),s++;return i}}function AA(o){return new Worker(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/PointsManager.worker-5fpGpVvf.js").href:new URL("assets/PointsManager.worker-5fpGpVvf.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:o==null?void 0:o.name})}new d.Box3,new d.Vector3,new d.Vector3,new d.Vector3,new d.Vector3;const je=new d.Vector3,iA=new d.Vector3,et=new d.Matrix3;et.set(1,0,0,0,0,1,0,-1,0);class sA extends d.Mesh{constructor(e,a){const A=Math.min(Math.ceil(8)*512,Math.pow(512,2));let i=1*Math.pow(512,2);i=Math.floor(i/A)*A;const s=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,depthBuffer:!1,resolveDepthBuffer:!1});e.initRenderTarget(s);const r=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});r.texture.type=d.FloatType,e.initRenderTarget(r);const c=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});c.texture.type=d.FloatType,e.initRenderTarget(c);const n=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});n.texture.type=d.FloatType,e.initRenderTarget(n);const b=new d.ShaderMaterial({uniforms:{textureSize:{value:512},numSlices:{value:1},cov1Texture:{value:c.texture},cov2Texture:{value:n.texture},colorTexture:{value:s.texture},positionTexture:{value:r.texture},zUpToYUpMatrix3x3:{value:et},sizeMultiplier:{value:1},cropRadius:{value:Number.MAX_VALUE},cameraNear:{value:.01},cameraFar:{value:10},computeLinearDepth:{value:!0}},vertexShader:at(),fragmentShader:a||tt(),transparent:!0,side:d.FrontSide,depthTest:!1,depthWrite:!1}),l=new d.InstancedBufferGeometry,f=new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]);l.setIndex([0,2,1,2,3,1]),l.setAttribute("position",new d.BufferAttribute(f,3));const h=new Uint32Array(i),g=new d.InstancedBufferAttribute(h,1,!1);g.needsUpdate=!0,g.setUsage(d.DynamicDrawUsage),l.setAttribute("order",g),l.instanceCount=0,super(l,b),this.numBatches=0,this.numVisibleBatches=0,this.orderAttribute=g,this.textureSize=512,this.numTextures=1,this.batchSize=A,this.maxSplats=i,this.colorRenderTarget=s,this.positionRenderTarget=r,this.cov1RenderTarget=c,this.cov2RenderTarget=n,this.renderer=e,this.sortID=0,this.freeAddresses=new Qe;for(let p=0;p<this.maxSplats;p+=A)this.freeAddresses.add(p);this.worker=new AA({type:"module"}),this.sortListeners=[],this.worker.onmessage=p=>{const B=new Uint32Array(p.data.order);if(B.length>this.orderAttribute.count){const I=new d.InstancedBufferGeometry,m=new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),C=[0,2,1,2,3,1];I.setIndex(C),I.setAttribute("position",new d.BufferAttribute(m,3));const w=new Uint32Array(this.maxSplats),k=new d.InstancedBufferAttribute(w,1,!1);k.needsUpdate=!0,k.setUsage(d.DynamicDrawUsage),I.setAttribute("order",k),I.instanceCount=0,this.geometry.dispose(),this.geometry=I,this.orderAttribute=k}this.orderAttribute.clearUpdateRanges(),this.orderAttribute.set(B),this.orderAttribute.addUpdateRange(0,B.length),this.orderAttribute.needsUpdate=!0,this.geometry.instanceCount=p.data.count,this.geometry.needsUpdate=!0;for(let I=this.sortListeners.length-1;I>=0;I--)this.sortListeners[I](p.data.id)&&this.sortListeners.splice(I,1)},this.cameraPosition=new d.Vector3(0,0,0),this.rotateOnAxis(new d.Vector3(1,0,0),.5*Math.PI),this.frustumCulled=!1,this.copyMaterial2D=new d.ShaderMaterial({uniforms:{sourceTexture:{}},vertexShader:wa(),fragmentShader:`
13
+ */class ne extends tA{constructor(a=[],t){super(t);ie(this,"_elements",[]);ie(this,"_DEFAULT_COMPARATOR",(a,t)=>{if(typeof a=="object"||typeof t=="object")throw TypeError("When comparing object types, a custom comparator must be defined in the constructor's options parameter.");return a>t?1:a<t?-1:0});ie(this,"_comparator",this._DEFAULT_COMPARATOR);if(t){const{comparator:A}=t;A&&(this._comparator=A)}if(a)for(const A of a)this.toElementFn?this.add(this.toElementFn(A)):this.add(A)}get elements(){return this._elements}get size(){return this.elements.length}get leaf(){return this.elements[this.size-1]??void 0}static heapify(a,t){return new ne(a,t)}add(a){return this._elements.push(a),this._bubbleUp(this.elements.length-1)}poll(){if(this.elements.length===0)return;const a=this.elements[0],t=this.elements.pop();return this.elements.length&&(this.elements[0]=t,this._sinkDown(0,this.elements.length>>1)),a}peek(){return this.elements[0]}isEmpty(){return this.size===0}clear(){this._elements=[]}refill(a){return this._elements=a,this.fix()}has(a){return this.elements.includes(a)}delete(a){const t=this.elements.indexOf(a);return!(t<0)&&(t===0?this.poll():t===this.elements.length-1?this.elements.pop():(this.elements.splice(t,1,this.elements.pop()),this._bubbleUp(t),this._sinkDown(t,this.elements.length>>1)),!0)}dfs(a="PRE"){const t=[],A=i=>{const s=2*i+1,r=s+1;i<this.size&&(a==="IN"?(A(s),t.push(this.elements[i]),A(r)):a==="PRE"?(t.push(this.elements[i]),A(s),A(r)):a==="POST"&&(A(s),A(r),t.push(this.elements[i])))};return A(0),t}toArray(){return[...this.elements]}clone(){return new ne(this,{comparator:this.comparator,toElementFn:this.toElementFn})}sort(){const a=[],t=new ne(this,{comparator:this.comparator});for(;t.size!==0;){const A=t.poll();A!==void 0&&a.push(A)}return a}fix(){const a=[];for(let t=Math.floor(this.size/2);t>=0;t--)a.push(this._sinkDown(t,this.elements.length>>1));return a}filter(a,t){const A=new ne([],{toElementFn:this.toElementFn,comparator:this.comparator});let i=0;for(const s of this)a.call(t,s,i,this)&&A.add(s),i++;return A}map(a,t,A,i){const s=new ne([],{comparator:t,toElementFn:A});let r=0;for(const c of this)s.add(a.call(i,c,r,this)),r++;return s}get comparator(){return this._comparator}*_getIterator(){for(const a of this.elements)yield a}_bubbleUp(a){const t=this.elements[a];for(;a>0;){const A=a-1>>1,i=this.elements[A];if(this.comparator(i,t)<=0)break;this.elements[a]=i,a=A}return this.elements[a]=t,!0}_sinkDown(a,t){const A=this.elements[a];for(;a<t;){let i=a<<1|1;const s=i+1;let r=this.elements[i];if(s<this.elements.length&&this.comparator(r,this.elements[s])>0&&(i=s,r=this.elements[s]),this.comparator(r,A)>=0)break;this.elements[a]=r,a=i}return this.elements[a]=A,!0}}(function(o){o[o.VISIT=0]="VISIT",o[o.PROCESS=1]="PROCESS"})(ya||(ya={}));class Ee extends ne{constructor(e=[],a){super(e,a)}clone(){return new Ee(this,{comparator:this.comparator,toElementFn:this.toElementFn})}filter(e,a){const t=new Ee([],{toElementFn:this.toElementFn,comparator:this.comparator});let A=0;for(const i of this)e.call(a,i,A,this)&&t.add(i),A++;return t}map(e,a,t,A){const i=new Ee([],{comparator:a,toElementFn:t});let s=0;for(const r of this)i.add(e.call(A,r,s,this)),s++;return i}}class Qe extends Ee{constructor(e=[],a){super(e,a)}clone(){return new Qe(this,{comparator:this.comparator,toElementFn:this.toElementFn})}filter(e,a){const t=new Qe([],{toElementFn:this.toElementFn,comparator:this.comparator});let A=0;for(const i of this)e.call(a,i,A,this)&&t.add(i),A++;return t}map(e,a,t,A){const i=new Qe([],{comparator:a,toElementFn:t});let s=0;for(const r of this)i.add(e.call(A,r,s,this)),s++;return i}}function AA(o){return new Worker(""+(typeof document>"u"?require("url").pathToFileURL(__dirname+"/assets/PointsManager.worker-5fpGpVvf.js").href:new URL("assets/PointsManager.worker-5fpGpVvf.js",document.currentScript&&document.currentScript.tagName.toUpperCase()==="SCRIPT"&&document.currentScript.src||document.baseURI).href),{type:"module",name:o==null?void 0:o.name})}new d.Box3,new d.Vector3,new d.Vector3,new d.Vector3,new d.Vector3;const je=new d.Vector3,iA=new d.Vector3,et=new d.Matrix3;et.set(1,0,0,0,0,1,0,-1,0);class sA extends d.Mesh{constructor(e,a){const A=Math.min(Math.ceil(8)*512,Math.pow(512,2));let i=1*Math.pow(512,2);i=Math.floor(i/A)*A;const s=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,depthBuffer:!1,resolveDepthBuffer:!1});e.initRenderTarget(s);const r=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});r.texture.type=d.FloatType,e.initRenderTarget(r);const c=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});c.texture.type=d.FloatType,e.initRenderTarget(c);const n=new d.WebGL3DRenderTarget(512,512,1,{magFilter:d.NearestFilter,minFilter:d.NearestFilter,anisotropy:0,type:d.FloatType,depthBuffer:!1,resolveDepthBuffer:!1});n.texture.type=d.FloatType,e.initRenderTarget(n);const b=new d.ShaderMaterial({uniforms:{textureSize:{value:512},numSlices:{value:1},cov1Texture:{value:c.texture},cov2Texture:{value:n.texture},colorTexture:{value:s.texture},positionTexture:{value:r.texture},zUpToYUpMatrix3x3:{value:et},sizeMultiplier:{value:1},cropRadius:{value:Number.MAX_VALUE},cameraNear:{value:.01},cameraFar:{value:10},computeLinearDepth:{value:!0}},vertexShader:at(),fragmentShader:a||tt(),transparent:!0,side:d.FrontSide,depthTest:!1,depthWrite:!1}),l=new d.InstancedBufferGeometry,f=new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]);l.setIndex([0,2,1,2,3,1]),l.setAttribute("position",new d.BufferAttribute(f,3));const h=new Uint32Array(i),g=new d.InstancedBufferAttribute(h,1,!1);g.needsUpdate=!0,g.setUsage(d.DynamicDrawUsage),l.setAttribute("order",g),l.instanceCount=0,super(l,b),this.numBatches=0,this.numVisibleBatches=0,this.orderAttribute=g,this.textureSize=512,this.numTextures=1,this.batchSize=A,this.maxSplats=i,this.numSplatsRendered=0,this.colorRenderTarget=s,this.positionRenderTarget=r,this.cov1RenderTarget=c,this.cov2RenderTarget=n,this.renderer=e,this.sortID=0,this.freeAddresses=new Qe;for(let p=0;p<this.maxSplats;p+=A)this.freeAddresses.add(p);this.worker=new AA({type:"module"}),this.sortListeners=[],this.worker.onmessage=p=>{const B=new Uint32Array(p.data.order);if(this.numSplatsRendered=B.length,B.length>this.orderAttribute.count){const I=new d.InstancedBufferGeometry,m=new Float32Array([-.5,.5,0,.5,.5,0,-.5,-.5,0,.5,-.5,0]),C=[0,2,1,2,3,1];I.setIndex(C),I.setAttribute("position",new d.BufferAttribute(m,3));const w=new Uint32Array(this.maxSplats),k=new d.InstancedBufferAttribute(w,1,!1);k.needsUpdate=!0,k.setUsage(d.DynamicDrawUsage),I.setAttribute("order",k),I.instanceCount=0,this.geometry.dispose(),this.geometry=I,this.orderAttribute=k}this.orderAttribute.clearUpdateRanges(),this.orderAttribute.set(B),this.orderAttribute.addUpdateRange(0,B.length),this.orderAttribute.needsUpdate=!0,this.geometry.instanceCount=p.data.count,this.geometry.needsUpdate=!0;for(let I=this.sortListeners.length-1;I>=0;I--)this.sortListeners[I](p.data.id)&&this.sortListeners.splice(I,1)},this.cameraPosition=new d.Vector3(0,0,0),this.rotateOnAxis(new d.Vector3(1,0,0),.5*Math.PI),this.frustumCulled=!1,this.copyMaterial2D=new d.ShaderMaterial({uniforms:{sourceTexture:{}},vertexShader:wa(),fragmentShader:`
14
14
  precision highp float;
15
15
 
16
16
  uniform sampler2D sourceTexture;