gl-draw 0.15.19 → 0.15.21

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/dist/index2.js DELETED
@@ -1,149 +0,0 @@
1
- "use strict";var fe=Object.defineProperty,de=Object.defineProperties;var pe=Object.getOwnPropertyDescriptors;var X=Object.getOwnPropertySymbols;var me=Object.prototype.hasOwnProperty,ve=Object.prototype.propertyIsEnumerable;var J=Math.pow,Y=(r,e,t)=>e in r?fe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,E=(r,e)=>{for(var t in e||(e={}))me.call(e,t)&&Y(r,t,e[t]);if(X)for(var t of X(e))ve.call(e,t)&&Y(r,t,e[t]);return r},q=(r,e)=>de(r,pe(e));var ee=(r,e,t)=>new Promise((i,s)=>{var l=c=>{try{n(t.next(c))}catch(o){s(o)}},u=c=>{try{n(t.throw(c))}catch(o){s(o)}},n=c=>c.done?i(c.value):Promise.resolve(c.value).then(l,u);n((t=t.apply(r,e)).next())});const a=require("three"),ge=require("three/examples/jsm/renderers/CSS2DRenderer"),te=require("three/examples/jsm/renderers/CSS3DRenderer"),O=require("d3-geo");require("d3-geo-projection");const $=require("./parseVector.js"),be=require("three/examples/jsm/lines/LineSegmentsGeometry"),T=require("d3-array"),K=require("earcut"),ye=require("@turf/boolean-clockwise"),Me=require("delaunator"),xe=require("@turf/boolean-point-in-polygon"),we=require("d3-geo-voronoi"),ie=require("d3-scale"),Pe=0,Ae=1,Se=2,je=!1;class ue{constructor(){this.resources=new Set,this.disposeMaterial=!0,this.disposeVideo=!0}track(e){if(!e)return e;if(Array.isArray(e))return e.forEach(t=>this.track(t)),e;if(!this.disposeMaterial&&e instanceof a.Material)return e;if(e instanceof Q?(e.disposeTrack&&e.object3d?this.track(e.object3d):this.resources.add(e),Object.values(e.materialList).map(t=>this.track(t))):(e instanceof a.Object3D||Reflect.has(e,"dispose"))&&this.resources.add(e),e instanceof Q)e.children.forEach(t=>{t.disposeTrack=!1}),this.track(e.children);else if(e instanceof a.Object3D){const t=e;this.track(t.geometry),this.track(t.material),this.track(t.children)}else if(e instanceof a.Material){for(const i of Object.values(e))i instanceof a.Texture&&this.track(i);const t=e;if(t.uniforms){for(const i of Object.values(t.uniforms))if(i){const s=i.value;(s instanceof a.Texture||Array.isArray(s))&&this.track(s)}}}else this.disposeVideo&&e instanceof a.VideoTexture&&e.source.data&&this.resources.add(e.source.data);return e}dispose(){const e=[];for(const t of this.resources)t instanceof a.Object3D?e.push(t):t instanceof HTMLVideoElement&&t.pause(),Reflect.has(t,"dispose")&&t.dispose();e.forEach(t=>{t.removeFromParent()}),e.length=0,this.resources.clear()}}const Ce=(r,e=1)=>{const t=new a.BufferGeometry;t.setAttribute("position",new a.Float32BufferAttribute(new Array(e*3).fill(0),3)),t.setAttribute("scaleAtt",new a.Float32BufferAttribute(new Array(e).fill(1),1));const i=r.material,s=new a.PointsMaterial({size:10,map:i.map,alphaMap:i.alphaMap,color:i.color,blending:i.blending,depthTest:i.depthTest,depthWrite:!1,opacity:i.opacity,transparent:!0,alphaTest:i.alphaTest,sizeAttenuation:!1});return s.onBeforeCompile=l=>{l.vertexShader=`
2
- attribute float scaleAtt;
3
- ${l.vertexShader.replace("gl_PointSize = size;","gl_PointSize = size * scaleAtt;")}
4
- `},new a.Points(t,s)},Be=(r,e)=>{const t=new a.Object3D;e.forEach((i,s)=>{const l=$.parseVector3(i.position),u=$.parseVector3(i.scale||[1,1,1]);t.position.copy(l),t.scale.copy(u),t.updateMatrix();const n=t.matrix.clone();if(r instanceof a.InstancedMesh||r.isInstantiate)r.setMatrixAt(s,n);else if(r instanceof a.Points||r.type==="Points"){const o=r.geometry,p=o.attributes.position.array,f=o.attributes.scaleAtt.array,m=new a.Vector3,h=new a.Vector3,v=new a.Quaternion,d=s*3,b=s*1;n.decompose(m,v,h),p[d]=m.x,p[d+1]=m.y,p[d+2]=m.z,f[b]=Math.max(h.x,h.y,h.z),o.attributes.position.needsUpdate=!0,o.attributes.scaleAtt.needsUpdate=!0}})};class De{constructor(){this.onPointerIndex=[]}onPointerEvent(e,t){const i=this.lead.handlePick([this],e,t);this.onPointerIndex.push(i)}onClick(e){this.onPointerEvent("click",e)}onPointerEnter(e){this.onPointerEvent("enter",e)}onPointerLeave(e){this.onPointerEvent("leave",e)}onPointerMove(e){this.onPointerEvent("move",e)}onPointerDown(e){this.onPointerEvent("down",e)}dispose(){this.onPointerIndex.forEach(e=>{this.lead.removePick(e)})}}class Ve extends De{constructor(){super(...arguments),this.userData={},this.materialList={},this.useMaterialType="origin",this.disposeMaterialIfNotUsed=!0}cloneMaterial(){const e=this.object3d;if(!e||!e.material)return;const t=e.material;if(Array.isArray(t))return t.map(i=>{const s=i.userData;i.userData={};const l=i.clone();return i.userData=s,l});{const i=t.userData;t.userData={};const s=t.clone();return t.userData=i,s}}setMaterialList(e,t){const i=this.object3d;if(!i||!i.material)return;this.materialList.origin||(this.materialList.origin=i.material);const s=t==="clone"?this.cloneMaterial():Array.isArray(t)?t.slice():t;return this.materialList[e]=s,s}useMaterial(e){const t=this.object3d;!t||!t.material||this.useMaterialType===e||!this.materialList[e]||(this.useMaterialType=e,t.material=this.materialList[e])}useMListById(e,t){if(!this.mList)return;const i=this.mList.get(e);if(!i)return;const s=this.object3d;Array.isArray(s.material)&&t!==void 0?s.material[t]=i:s.material=i}useMListByName(e,t){if(!this.mList)return;const i=this.mList.getKeyByName(e);i&&this.useMListById(i,t)}dispose(){super.dispose(),this.mList.rmBaseObjectMap(this,void 0,this.disposeMaterialIfNotUsed)}}class Q extends Ve{constructor(){super(...arguments),this.objectType="BaseObject",this.userData={},this.prefab=!1,this.isInstantiate=!1,this.isBloom=!1,this.disposeTrack=!0}get parent(){const e=this.object3d.parent;return e&&this.lead.objMap.get(e)||null}get children(){return this.object3d.children.map(e=>this.lead.objMap.get(e)).filter(e=>!!e)}get position(){return this.object3d.position}get rotation(){return this.object3d.rotation}get scale(){return this.object3d.scale}get lookAt(){return this.object3d.lookAt}add(...e){[...e].forEach(t=>{this.lead.objMap.get(t)?this.object3d.add(t):this.lead.createBaseObject(t,{target:this})})}remove(...e){[...e].forEach(t=>{var i;this.lead.objMap.get(t)?(i=this.lead.objMap.get(t))==null||i.erase():this.object3d.remove(t)})}get visible(){return this.object3d.visible}get visibleWithAncestors(){if(this.visible){let e=this.parent;for(;e;){if(!e.visible)return!1;e=e.parent}return!0}else return!1}create(){this.createGroup()}render(){}update(e,t){}resize(e,t){}show(){return this.object3d.visible=!0,this.object3d.layers.set(Pe),this}hide(){return this.object3d.visible=!1,this.object3d.layers.set(Se),this}createGroup(){return this.object3d=new a.Group,this}createMesh(...e){return this.object3d=new a.Mesh(...e),this}createPoints(...e){return this.object3d=new a.Points(...e),this}createCSS2DObject(e){return this.object3d=new ge.CSS2DObject(e),this}createCSS3DObject(e){return this.object3d=new te.CSS3DObject(e),this}createCSS3DSprite(e){return this.object3d=new te.CSS3DSprite(e),this}createSprite(e){return this.object3d=new a.Sprite(e),this}attach(...e){return[...e].forEach(t=>{this.object3d.attach(t.object3d)}),this}getSize(){const e=new a.Box3().setFromObject(this.object3d);return{min:e.min,max:e.max,size:e.getSize(new a.Vector3),center:e.getCenter(new a.Vector3)}}setTop(e){this.object3d&&(this.object3d.renderOrder=e)}traverse(e){e(this),this.children.forEach(t=>{t.traverse(e)})}instantiate(e){return ee(this,null,function*(){var c;const t=(c=e==null?void 0:e.recursive)!=null?c:!0,{objectType:i,objectOptions:s}=this,[,l]=i.split("#");let u=e==null?void 0:e.create;u===void 0&&(u=o=>{var p;if(this.object3d){if((p=e==null?void 0:e.instancedAttr)!=null&&p.length){const f=e.instancedAttr.length;if(this.object3d instanceof a.Sprite)o.object3d=Ce(this.object3d,f);else{const m=this.object3d,h=this.cloneMaterial();o.object3d=new a.InstancedMesh(m.geometry,h,f)}Be(o.object3d,e==null?void 0:e.instancedAttr)}else o.object3d=this.object3d.clone(!1),o.object3d.material&&(o.object3d.material=this.cloneMaterial());o.object3d.userData.prefab&&delete o.object3d.userData.prefab}});const n=yield this.lead.draw(l,q(E({},s||{}),{create:u,prefab:!1,key:(e==null?void 0:e.key)||(s==null?void 0:s.key),target:(e==null?void 0:e.target)||(s==null?void 0:s.target)}));return this.isBloom&&n.enableBloom(),t&&(yield Promise.all(this.children.map(o=>o.instantiate({target:n})))),n.isInstantiate=!0,n})}erase(){this.lead.erase(this)}enableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!0),this.isBloom=!0}disableBloom(){var e;(e=this.pencil.composerController)==null||e.setBloomSelection(this,!1),this.isBloom=!1}dispose(){var e;if(super.dispose(),(e=this.pencil.composerController)==null||e.bloomSelection.delete(this),this.lead&&(this.lead.objects.delete(this.key),this.lead.objectWrapChindIdMap.delete(this),this.object3d&&this.lead.objMap.delete(this.object3d)),this.disposeTrack){const t=new ue;t.disposeMaterial=!1,t.track(this),t.dispose()}}}const F=new a.Vector4,se=new a.Vector3,re=new a.Vector3,y=new a.Vector4,M=new a.Vector4,V=new a.Vector4,N=new a.Vector3,Z=new a.Matrix4,x=new a.Line3,ne=new a.Vector3,k=new a.Box3,R=new a.Sphere,I=new a.Vector4;let _,L;function ae(r,e,t){return I.set(0,0,-e,1).applyMatrix4(r.projectionMatrix),I.multiplyScalar(1/I.w),I.x=L/t.width,I.y=L/t.height,I.applyMatrix4(r.projectionMatrixInverse),I.multiplyScalar(1/I.w),Math.abs(Math.max(I.x,I.y))}function Ie(r,e){const t=r.matrixWorld,i=r.geometry,s=i.attributes.instanceStart,l=i.attributes.instanceEnd,u=Math.min(i.instanceCount,s.count);for(let n=0,c=u;n<c;n++){x.start.fromBufferAttribute(s,n),x.end.fromBufferAttribute(l,n),x.applyMatrix4(t);const o=new a.Vector3,p=new a.Vector3;_.distanceSqToSegment(x.start,x.end,p,o),p.distanceTo(o)<L*.5&&e.push({point:p,pointOnLine:o,distance:_.origin.distanceTo(p),object:r,face:null,faceIndex:n,uv:null,uv1:null})}}function _e(r,e,t){const i=e.projectionMatrix,l=r.material.resolution,u=r.matrixWorld,n=r.geometry,c=n.attributes.instanceStart,o=n.attributes.instanceEnd,p=Math.min(n.instanceCount,c.count),f=-e.near;_.at(1,V),V.w=1,V.applyMatrix4(e.matrixWorldInverse),V.applyMatrix4(i),V.multiplyScalar(1/V.w),V.x*=l.x/2,V.y*=l.y/2,V.z=0,N.copy(V),Z.multiplyMatrices(e.matrixWorldInverse,u);for(let m=0,h=p;m<h;m++){if(y.fromBufferAttribute(c,m),M.fromBufferAttribute(o,m),y.w=1,M.w=1,y.applyMatrix4(Z),M.applyMatrix4(Z),y.z>f&&M.z>f)continue;if(y.z>f){const D=y.z-M.z,P=(y.z-f)/D;y.lerp(M,P)}else if(M.z>f){const D=M.z-y.z,P=(M.z-f)/D;M.lerp(y,P)}y.applyMatrix4(i),M.applyMatrix4(i),y.multiplyScalar(1/y.w),M.multiplyScalar(1/M.w),y.x*=l.x/2,y.y*=l.y/2,M.x*=l.x/2,M.y*=l.y/2,x.start.copy(y),x.start.z=0,x.end.copy(M),x.end.z=0;const d=x.closestPointToPointParameter(N,!0);x.at(d,ne);const b=a.MathUtils.lerp(y.z,M.z,d),C=b>=-1&&b<=1,B=N.distanceTo(ne)<L*.5;if(C&&B){x.start.fromBufferAttribute(c,m),x.end.fromBufferAttribute(o,m),x.start.applyMatrix4(u),x.end.applyMatrix4(u);const D=new a.Vector3,P=new a.Vector3;_.distanceSqToSegment(x.start,x.end,P,D),t.push({point:P,pointOnLine:D,distance:_.origin.distanceTo(P),object:r,face:null,faceIndex:m,uv:null,uv1:null})}}}class ze extends a.Mesh{constructor(e=new be.LineSegmentsGeometry,t){super(e,t),this.isLineSegments2=!0,this.type="LineSegments2"}computeLineDistances(){const e=this.geometry,t=e.attributes.instanceStart,i=e.attributes.instanceEnd,s=new Float32Array(2*t.count);for(let u=0,n=0,c=t.count;u<c;u++,n+=2)se.fromBufferAttribute(t,u),re.fromBufferAttribute(i,u),s[n]=n===0?0:s[n-1],s[n+1]=s[n]+se.distanceTo(re);const l=new a.InstancedInterleavedBuffer(s,2,1);return e.setAttribute("instanceDistanceStart",new a.InterleavedBufferAttribute(l,1,0)),e.setAttribute("instanceDistanceEnd",new a.InterleavedBufferAttribute(l,1,1)),this}raycast(e,t){const i=this.material.worldUnits,s=e.camera;s===null&&!i&&console.error('LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.');const l=e.params.Line2!==void 0&&e.params.Line2.threshold||0;_=e.ray;const u=this.matrixWorld,n=this.geometry,c=this.material;L=c.linewidth+l,n.boundingSphere===null&&n.computeBoundingSphere(),R.copy(n.boundingSphere).applyMatrix4(u);let o;if(i)o=L*.5;else{const f=Math.max(s.near,R.distanceToPoint(_.origin));o=ae(s,f,c.resolution)}if(R.radius+=o,_.intersectsSphere(R)===!1)return;n.boundingBox===null&&n.computeBoundingBox(),k.copy(n.boundingBox).applyMatrix4(u);let p;if(i)p=L*.5;else{const f=Math.max(s.near,k.distanceToPoint(_.origin));p=ae(s,f,c.resolution)}k.expandByScalar(p),_.intersectsBox(k)!==!1&&(i?Ie(this,t):_e(this,s,t))}onBeforeRender(e){const t=this.material.uniforms;t&&t.resolution&&(e.getViewport(F),this.material.uniforms.resolution.value.set(F.z,F.w))}}const oe=["encodings_fragment","colorspace_fragment"],Le=`
5
- #include <common>
6
- #include <logdepthbuf_pars_vertex>
7
- #include <fog_pars_vertex>
8
-
9
- attribute vec3 previous;
10
- attribute vec3 next;
11
- attribute float side;
12
- attribute float width;
13
- attribute float counters;
14
-
15
- uniform vec2 resolution;
16
- uniform float lineWidth;
17
- uniform vec3 color;
18
- uniform float opacity;
19
- uniform float sizeAttenuation;
20
- uniform vec2 offset;
21
-
22
- uniform float time;
23
- uniform vec3 lightColor;
24
- uniform vec2 uCenter;
25
- uniform float size;
26
- uniform float speed;
27
- uniform float lightWidth;
28
- uniform float lineLightAnimation;
29
-
30
- varying vec2 vUV;
31
- varying vec4 vColor;
32
- varying float vCounters;
33
- varying vec2 vHighPrecisionZW;
34
-
35
- vec2 fix(vec4 i, float aspect) {
36
- vec2 res = i.xy / i.w;
37
- res.x *= aspect;
38
- vCounters = counters;
39
- return res;
40
- }
41
-
42
- void main() {
43
- float aspect = resolution.x / resolution.y;
44
- if (lineLightAnimation == 1.0) {
45
- vec2 vWorld=position.xy;
46
- float r_time=mod(time/(speed*size),2.);
47
- float l=distance(vWorld, uCenter)/size;
48
- float r_opacity=smoothstep(r_time-lightWidth*2.,r_time-lightWidth,l)-smoothstep(r_time-lightWidth,r_time,l);
49
- vColor=vec4(mix(color,lightColor,r_opacity),opacity);
50
- } else {
51
- vColor=vec4(color,opacity);
52
- }
53
-
54
- vUV=uv+offset;
55
-
56
- mat4 m = projectionMatrix * modelViewMatrix;
57
- vec4 finalPosition = m * vec4(position, 1.0);
58
- vec4 prevPos = m * vec4(previous, 1.0);
59
- vec4 nextPos = m * vec4(next, 1.0);
60
-
61
- vec2 currentP = fix(finalPosition, aspect);
62
- vec2 prevP = fix(prevPos, aspect);
63
- vec2 nextP = fix(nextPos, aspect);
64
-
65
- float w = lineWidth * width;
66
-
67
- vec2 dir;
68
- if (nextP == currentP) dir = normalize(currentP - prevP);
69
- else if (prevP == currentP) dir = normalize(nextP - currentP);
70
- else {
71
- vec2 dir1 = normalize(currentP - prevP);
72
- vec2 dir2 = normalize(nextP - currentP);
73
- dir = normalize(dir1 + dir2);
74
-
75
- vec2 perp = vec2(-dir1.y, dir1.x);
76
- vec2 miter = vec2(-dir.y, dir.x);
77
- //w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
78
- }
79
-
80
- //vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
81
- vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
82
- normal.xy *= .5 * w;
83
- //normal *= projectionMatrix;
84
- if (sizeAttenuation == 0.) {
85
- normal.xy *= finalPosition.w;
86
- normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy;
87
- }
88
-
89
- finalPosition.xy += normal.xy * side;
90
- gl_Position = finalPosition;
91
- #include <logdepthbuf_vertex>
92
- #include <fog_vertex>
93
- vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
94
- vHighPrecisionZW = finalPosition.zw;
95
- #include <fog_vertex>
96
- }
97
- `,Te=`
98
- #include <packing>
99
- #include <fog_pars_fragment>
100
- #include <logdepthbuf_pars_fragment>
101
-
102
- uniform sampler2D map;
103
- uniform sampler2D alphaMap;
104
- uniform float useMap;
105
- uniform float useAlphaMap;
106
- uniform float useDash;
107
- uniform float dashArray;
108
- uniform float dashOffset;
109
- uniform float dashRatio;
110
- uniform float visibility;
111
- uniform float alphaTest;
112
- uniform vec2 repeat;
113
- uniform float useDepth;
114
- uniform float offsetLoop;
115
-
116
- varying vec2 vUV;
117
- varying vec4 vColor;
118
- varying float vCounters;
119
- varying vec2 vHighPrecisionZW;
120
-
121
- void main() {
122
- #include <logdepthbuf_fragment>
123
- vec4 c = vColor;
124
- if (useMap == 1.) c *= texture2D(map, vUV * repeat);
125
- if (useAlphaMap == 1.) c.a *= texture2D(alphaMap, vUV * repeat).a;
126
- if(offsetLoop!=1.0){
127
- if(vUV.x>1.0 || vUV.x<0.0){
128
- c.a = 0.0;
129
- }
130
- }
131
-
132
- if (c.a < alphaTest) discard;
133
- if (useDash == 1.) {
134
- c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
135
- }
136
- if (useDepth == 1.) {
137
- float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;
138
- gl_FragColor = packDepthToRGBA( fragCoordZ );
139
- }else{
140
- gl_FragColor = c;
141
- gl_FragColor.a *= step(vCounters, visibility);
142
- }
143
-
144
-
145
- #include <fog_fragment>
146
- #include <tonemapping_fragment>
147
- #include <${+a.REVISION<154?oe[0]:oe[1]}>
148
- }
149
- `;class Ee extends a.ShaderMaterial{constructor(e){super({uniforms:q(E({},a.UniformsLib.fog),{lineWidth:{value:1},map:{value:null},useMap:{value:0},alphaMap:{value:null},useAlphaMap:{value:0},color:{value:new a.Color(16777215)},opacity:{value:1},resolution:{value:new a.Vector2(1,1)},sizeAttenuation:{value:1},dashArray:{value:0},dashOffset:{value:0},dashRatio:{value:.5},useDash:{value:0},useDepth:{value:0},visibility:{value:1},alphaTest:{value:0},repeat:{value:new a.Vector2(1,1)},offset:{value:new a.Vector2(0,0)},offsetLoop:{value:1},lineLightAnimation:{value:0},time:{value:0},size:{value:300},speed:{value:.3},lightWidth:{value:.1},uCenter:{value:new a.Vector2(0,0)},lightColor:{value:new a.Color(16777215)}}),vertexShader:Le,fragmentShader:Te}),this.type="MeshLineMaterial",Object.defineProperties(this,{lineWidth:{enumerable:!0,get(){return this.uniforms.lineWidth.value},set(t){this.uniforms.lineWidth.value=t}},map:{enumerable:!0,get(){return this.uniforms.map.value},set(t){this.uniforms.map.value=t}},useMap:{enumerable:!0,get(){return this.uniforms.useMap.value},set(t){this.uniforms.useMap.value=t}},alphaMap:{enumerable:!0,get(){return this.uniforms.alphaMap.value},set(t){this.uniforms.alphaMap.value=t}},useAlphaMap:{enumerable:!0,get(){return this.uniforms.useAlphaMap.value},set(t){this.uniforms.useAlphaMap.value=t}},color:{enumerable:!0,get(){return this.uniforms.color.value},set(t){this.uniforms.color.value=t}},opacity:{enumerable:!0,get(){return this.uniforms.opacity.value},set(t){this.uniforms.opacity.value=t}},resolution:{enumerable:!0,get(){return this.uniforms.resolution.value},set(t){this.uniforms.resolution.value.copy(t)}},sizeAttenuation:{enumerable:!0,get(){return this.uniforms.sizeAttenuation.value},set(t){this.uniforms.sizeAttenuation.value=t}},dashArray:{enumerable:!0,get(){return this.uniforms.dashArray.value},set(t){this.uniforms.dashArray.value=t,this.useDash=t!==0?1:0}},dashOffset:{enumerable:!0,get(){return this.uniforms.dashOffset.value},set(t){this.uniforms.dashOffset.value=t}},dashRatio:{enumerable:!0,get(){return this.uniforms.dashRatio.value},set(t){this.uniforms.dashRatio.value=t}},useDash:{enumerable:!0,get(){return this.uniforms.useDash.value},set(t){this.uniforms.useDash.value=t}},useDepth:{enumerable:!0,get(){return this.uniforms.useDepth.value},set(t){this.uniforms.useDepth.value=t}},visibility:{enumerable:!0,get(){return this.uniforms.visibility.value},set(t){this.uniforms.visibility.value=t}},alphaTest:{enumerable:!0,get(){return this.uniforms.alphaTest.value},set(t){this.uniforms.alphaTest.value=t}},repeat:{enumerable:!0,get(){return this.uniforms.repeat.value},set(t){this.uniforms.repeat.value.copy(t)}},lineLightAnimation:{enumerable:!0,get:function(){return this.uniforms.lineLightAnimation.value},set:function(t){this.uniforms.lineLightAnimation.value=t}},time:{enumerable:!0,get:function(){return this.uniforms.time.value},set:function(t){this.uniforms.time.value=t}},size:{enumerable:!0,get:function(){return this.uniforms.size.value},set:function(t){this.uniforms.size.value=t}},speed:{enumerable:!0,get:function(){return this.uniforms.speed.value},set:function(t){this.uniforms.speed.value=t}},lightWidth:{enumerable:!0,get:function(){return this.uniforms.lightWidth.value},set:function(t){this.uniforms.lightWidth.value=t}},uCenter:{enumerable:!0,get:function(){return this.uniforms.uCenter.value},set:function(t){this.uniforms.uCenter.value=t}},lightColor:{enumerable:!0,get:function(){return this.uniforms.lightColor.value},set:function(t){t&&(this.uniforms.lightColor.value=t)}}}),this.setValues(e)}copy(e){return super.copy(e),this.lineWidth=e.lineWidth,this.map=e.map,this.useMap=e.useMap,this.alphaMap=e.alphaMap,this.useAlphaMap=e.useAlphaMap,this.color.copy(e.color),this.opacity=e.opacity,this.resolution.copy(e.resolution),this.sizeAttenuation=e.sizeAttenuation,this.dashArray=e.dashArray,this.dashOffset=e.dashOffset,this.dashRatio=e.dashRatio,this.useDash=e.useDash,this.visibility=e.visibility,this.alphaTest=e.alphaTest,this.repeat.copy(e.repeat),this}}function Oe(r,e){return r.map(t=>{const i=[];let s;return t.forEach(l=>{if(s){const u=O.geoDistance(l,s)*180/Math.PI;if(u>e){const n=O.geoInterpolate(s,l),c=1/Math.ceil(u/e);let o=c;for(;o<1;)i.push(n(o)),o+=c}}i.push(s=l)}),i})}function We(r,{minLng:e,maxLng:t,minLat:i,maxLat:s}={}){const l=Math.round(J(360/r,2)/Math.PI),u=(1+Math.sqrt(5))/2,n=h=>h/u*360%360-180,c=h=>Math.acos(2*h/l-1)/Math.PI*180-90,o=h=>l*(Math.cos((h+90)*Math.PI/180)+1)/2,p=[s!==void 0?Math.ceil(o(s)):0,i!==void 0?Math.floor(o(i)):l-1],f=e===void 0&&t===void 0?()=>!0:e===void 0?h=>h<=t:t===void 0?h=>h>=e:t>=e?h=>h>=e&&h<=t:h=>h>=e||h<=t,m=[];for(let h=p[0];h<=p[1];h++){const v=n(h);f(v)&&m.push([v,c(h)])}return m}function H(r,e,t=!1){return t?O.geoContains(e,r):xe(r,e)}function ke(r,e){const t={type:"Polygon",coordinates:r},[[i,s],[l,u]]=O.geoBounds(t);if(Math.min(Math.abs(l-i),Math.abs(u-s))<e)return[];const n=i>l||u>=89||s<=-89;return We(e,{minLng:i,maxLng:l,minLat:s,maxLat:u}).filter(c=>H(c,t,n))}function Re(r,{resolution:e=1/0,bbox:t,projection:i}={}){const s=Oe(r,e),l=T.merge(s),u=ke(r,e),n=[...l,...u],c={type:"Polygon",coordinates:r},[[o,p],[f,m]]=O.geoBounds(c),h=o>f||m>=89||p<=-89;let v=[];if(h){const g=we.geoVoronoi(n).triangles(),w=new Map(n.map(([A,S],z)=>[`${A}-${S}`,z]));g.features.forEach(A=>{const S=A.geometry.coordinates[0].slice(0,3).reverse(),z=[];if(S.forEach(([j,G])=>{const W=`${j}-${G}`;w.has(W)&&z.push(w.get(W))}),z.length===3){if(z.some(j=>j<l.length)){const j=A.properties.circumcenter;if(!H(j,c,h))return}v.push(...z)}})}else if(u.length){const g=Me.from(n);for(let w=0,A=g.triangles.length;w<A;w+=3){const S=[2,1,0].map(j=>g.triangles[w+j]),z=S.map(j=>n[j]);if(S.some(j=>j<l.length)){const j=[0,1].map(G=>T.mean(z,W=>W[G]));if(!H(j,c,h))continue}v.push(...S)}}else{const{vertices:g,holes:w=[]}=K.flatten(s);v=K(g,w,2)}let d=t?[t[0],t[2]]:T.extent(n,g=>g[0]),b=t?[t[1],t[3]]:T.extent(n,g=>g[1]);if(i){const[g,w]=i([d[0],b[0]]),[A,S]=i([d[1],b[1]]);d=[g,A],b=[-w,-S]}const C=ie.scaleLinear(d,[0,1]),B=ie.scaleLinear(b,[0,1]),D=n.map(([g,w])=>{if(i){const[A,S]=i([g,w]);return[C(A),B(-S)]}else return[C(g),B(w)]});return{contour:s,triangles:{points:n,indices:v,uvs:D}}}const le=new a.BufferGeometry().setAttribute?"setAttribute":"addAttribute";function U(r,e,t,i){const s=r.map(l=>l.map(([u,n])=>{if(i){const[c,o]=i([u,n]);return[c,-o,e]}return t?$.polar2Cartesian(u,n,e):[u,n,e]}));return K.flatten(s)}function Ue(r,e,t,i,s){const{vertices:l,holes:u}=U(r,e,i,s),{vertices:n}=U(r,t,i,s),c=T.merge([n,l]),o=Math.round(n.length/3),p=new Set(u);let f=0;const m=[];for(let v=0;v<o;v++){let d=v+1;if(d===o)d=f;else if(p.has(d)){const b=d;d=f,f=b}m.push(v,v+o,d+o),m.push(d+o,d,v)}const h=[];for(let v=1;v>=0;v--)for(let d=0;d<o;d+=1)h.push(d/(o-1),v);return{indices:m,vertices:c,uvs:h,topVerts:n}}function ce(r,e,t,i,s,l){return{indices:i?r.indices:r.indices.slice().reverse(),vertices:U([r.points],e,s,l).vertices,uvs:t}}const he=({polygonGeoJson:r,startHeight:e,endHeight:t,curvatureResolution:i=1,cartesian:s=!0,hasSide:l=!0,hasBottom:u=!1,hasTop:n=!1,projection:c,bbox:o})=>{r.forEach(C=>{ye(C)||C.reverse()});const{contour:p,triangles:f}=Re(r,{resolution:i,bbox:o,projection:c});let m={},h;l&&(m=Ue(p,e!=null?e:t,t!=null?t:e,s,c),h=m.topVerts);let v=[];(u||n)&&(v=T.merge(f.uvs));let d={};u&&(d=ce(f,e,v,!1,s,c));let b={};return n&&(b=ce(f,t,v,!0,s,c)),{contour:p,triangles:f,sideTorso:m,bottomCap:d,topCap:b,topVerts:h}};class Ge extends a.BufferGeometry{constructor(e,t={}){super(),this.type="PolygonBufferGeometry",this.parameters=E({polygonGeoJson:e,startHeight:0,endHeight:1,hasTop:!0,topFirst:!1,hasBottom:!0,hasSide:!0,curvatureResolution:1,cartesian:!0,userDataRsoOffset:0},t);const{endHeight:i,hasTop:s,topFirst:l,hasBottom:u,hasSide:n,cartesian:c,userDataRsoOffset:o,projection:p}=this.parameters,{contour:f,sideTorso:m,topVerts:h,bottomCap:v,topCap:d}=he(E({},this.parameters));let b=[],C=[],B=[],D=0;const P=g=>{const w=Math.round(b.length/3),A=B.length;b=b.concat(g.vertices),C=C.concat(g.uvs),B=B.concat(w?g.indices.map(S=>S+w):g.indices),this.addGroup(A,B.length-A,D++)};s&&l&&P(d),n&&(P(m),this.userData.topVerts=o?U(f,i+o,c,p).vertices:h),u&&P(v),s&&!l&&P(d),this.setIndex(B),this[le]("position",new a.Float32BufferAttribute(b,3)),this[le]("uv",new a.Float32BufferAttribute(C,2)),this.computeVertexNormals()}}exports.BLOOM_SCENE=Ae;exports.BaseObject=Q;exports.IS_DEV=je;exports.LineSegments2=ze;exports.MeshLineMaterial=Ee;exports.PolygonGeometry=Ge;exports.ResourceTracker=ue;exports.getMetas=he;