gl-draw 0.15.0-beta.3 → 0.15.0-beta.30
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/constants.d.ts +1 -0
- package/dist/core/BaseObject/PointerEvent.d.ts +13 -0
- package/dist/core/BaseObject/UseMaterial.d.ts +23 -0
- package/dist/core/{BaseObject.d.ts → BaseObject/index.d.ts} +24 -29
- package/dist/core/Composer.d.ts +5 -5
- package/dist/core/Lead/Lead.d.ts +17 -10
- package/dist/core/Lead/Pick.d.ts +2 -1
- package/dist/core/MList/MList.d.ts +11 -5
- package/dist/core/Pencil.d.ts +12 -10
- package/dist/core/Renderer.d.ts +0 -1
- package/dist/core/ResourceTracker.d.ts +4 -6
- package/dist/index.js +23 -23
- package/dist/index.module.js +1702 -1562
- package/dist/index.module2.js +641 -787
- package/dist/index2.js +130 -140
- package/dist/objects/conicPolygon/geometry/index.d.ts +4 -4
- package/dist/objects/extrudePolygon/ExtrudeGeometry.d.ts +1 -1
- package/dist/objects/extrudePolygon/createGeometry.d.ts +9 -13
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +811 -783
- package/dist/objects/line/createGeometry.d.ts +2 -2
- package/dist/objects/line/index.d.ts +4 -4
- package/dist/objects/line/meshLine/MeshLineGeometry.d.ts +16 -35
- package/dist/objects/line/meshLine/MeshLineMaterial.d.ts +59 -40
- package/dist/objects/line/meshLine/fragment.d.ts +1 -0
- package/dist/objects/line/meshLine/utils.d.ts +4 -0
- package/dist/objects/line/meshLine/vertex.d.ts +1 -0
- package/dist/objects/line2/WebGPULineSegments2.d.ts +1 -1
- package/dist/objects/line2/createGeometry.d.ts +1 -1
- package/dist/objects/pie/index.d.ts +9 -13
- package/dist/plugins/Worker/createGeometry.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +36 -36
- package/dist/utils/Sprite2Points.d.ts +1 -1
- package/dist/utils/setInstancedAttr.d.ts +6 -0
- package/package.json +1 -1
- package/dist/objects/scene/index.d.ts +0 -11
package/dist/index.module2.js
CHANGED
|
@@ -1,94 +1,106 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Pt = Object.defineProperty, It = Object.defineProperties;
|
|
2
|
+
var Dt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var k = Object.getOwnPropertySymbols;
|
|
4
|
+
var it = Object.prototype.hasOwnProperty, st = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var nt = Math.pow, et = (n, t, e) => t in n ? Pt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e, E = (n, t) => {
|
|
6
6
|
for (var e in t || (t = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var e of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, q = (
|
|
13
|
-
var
|
|
14
|
-
var
|
|
7
|
+
it.call(t, e) && et(n, e, t[e]);
|
|
8
|
+
if (k)
|
|
9
|
+
for (var e of k(t))
|
|
10
|
+
st.call(t, e) && et(n, e, t[e]);
|
|
11
|
+
return n;
|
|
12
|
+
}, q = (n, t) => It(n, Dt(t));
|
|
13
|
+
var ot = (n, t) => {
|
|
14
|
+
var e = {};
|
|
15
|
+
for (var i in n)
|
|
16
|
+
it.call(n, i) && t.indexOf(i) < 0 && (e[i] = n[i]);
|
|
17
|
+
if (n != null && k)
|
|
18
|
+
for (var i of k(n))
|
|
19
|
+
t.indexOf(i) < 0 && st.call(n, i) && (e[i] = n[i]);
|
|
20
|
+
return e;
|
|
21
|
+
};
|
|
22
|
+
var rt = (n, t, e) => new Promise((i, s) => {
|
|
23
|
+
var a = (c) => {
|
|
15
24
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
s(
|
|
25
|
+
o(e.next(c));
|
|
26
|
+
} catch (r) {
|
|
27
|
+
s(r);
|
|
19
28
|
}
|
|
20
|
-
},
|
|
29
|
+
}, l = (c) => {
|
|
21
30
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
s(
|
|
31
|
+
o(e.throw(c));
|
|
32
|
+
} catch (r) {
|
|
33
|
+
s(r);
|
|
25
34
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
35
|
+
}, o = (c) => c.done ? i(c.value) : Promise.resolve(c.value).then(a, l);
|
|
36
|
+
o((e = e.apply(n, t)).next());
|
|
28
37
|
});
|
|
29
|
-
import { Material as
|
|
30
|
-
import { CSS2DObject as
|
|
31
|
-
import { CSS3DObject as
|
|
32
|
-
import { geoBounds as
|
|
38
|
+
import { Material as at, Object3D as R, Texture as ct, VideoTexture as Bt, BufferGeometry as J, Float32BufferAttribute as G, PointsMaterial as Tt, Points as H, InstancedMesh as wt, Vector3 as D, Quaternion as zt, Group as Lt, Mesh as St, Sprite as lt, Box3 as jt, Vector4 as O, Matrix4 as _t, Line3 as Et, Sphere as Ot, InstancedInterleavedBuffer as Vt, InterleavedBufferAttribute as ut, MathUtils as kt, REVISION as Wt, ShaderChunk as W, ShaderMaterial as Ut, Vector2 as K, Color as ft } from "three";
|
|
39
|
+
import { CSS2DObject as Nt } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
40
|
+
import { CSS3DObject as Rt, CSS3DSprite as Gt } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
41
|
+
import { geoBounds as At, geoContains as $t, geoDistance as Ft, geoInterpolate as qt } from "d3-geo";
|
|
33
42
|
import "d3-geo-projection";
|
|
34
|
-
import { p as
|
|
43
|
+
import { p as dt, a as Kt } from "./parseVector.module.js";
|
|
35
44
|
import { LineSegmentsGeometry as Qt } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
36
|
-
import { merge as
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
45
|
+
import { merge as tt, mean as Xt, extent as ht } from "d3-array";
|
|
46
|
+
import Yt, { flatten as Ct } from "earcut";
|
|
47
|
+
import Zt from "@turf/boolean-clockwise";
|
|
48
|
+
import Jt from "delaunator";
|
|
49
|
+
import Ht from "@turf/boolean-point-in-polygon";
|
|
41
50
|
import { geoVoronoi as te } from "d3-geo-voronoi";
|
|
42
|
-
import { scaleLinear as
|
|
43
|
-
|
|
51
|
+
import { scaleLinear as pt } from "d3-scale";
|
|
52
|
+
const ee = 0, Le = 1, ie = 2, _e = !1;
|
|
53
|
+
class se {
|
|
44
54
|
constructor() {
|
|
45
|
-
this.resources = /* @__PURE__ */ new Set(), this.
|
|
55
|
+
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
46
56
|
}
|
|
47
57
|
track(t) {
|
|
48
|
-
if (!t
|
|
58
|
+
if (!t)
|
|
49
59
|
return t;
|
|
50
60
|
if (Array.isArray(t))
|
|
51
61
|
return t.forEach((e) => this.track(e)), t;
|
|
52
|
-
if (!this.
|
|
62
|
+
if (!this.disposeMaterial && t instanceof at)
|
|
53
63
|
return t;
|
|
54
|
-
if (t instanceof
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
if (t instanceof mt ? (t.disposeTrack && t.object3d ? this.track(t.object3d) : this.resources.add(t), Object.values(t.materialList).map((e) => this.track(e))) : (t instanceof R || Reflect.has(t, "dispose")) && this.resources.add(t), t instanceof mt)
|
|
65
|
+
t.children.forEach((e) => {
|
|
66
|
+
e.disposeTrack = !1;
|
|
67
|
+
}), this.track(t.children);
|
|
68
|
+
else if (t instanceof R) {
|
|
57
69
|
const e = t;
|
|
58
70
|
this.track(e.geometry), this.track(e.material), this.track(e.children);
|
|
59
|
-
} else if (t instanceof
|
|
71
|
+
} else if (t instanceof at) {
|
|
60
72
|
for (const i of Object.values(t))
|
|
61
|
-
i instanceof
|
|
73
|
+
i instanceof ct && this.track(i);
|
|
62
74
|
const e = t;
|
|
63
75
|
if (e.uniforms) {
|
|
64
76
|
for (const i of Object.values(e.uniforms))
|
|
65
77
|
if (i) {
|
|
66
78
|
const s = i.value;
|
|
67
|
-
(s instanceof
|
|
79
|
+
(s instanceof ct || Array.isArray(s)) && this.track(s);
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
|
-
} else this.disposeVideo && t instanceof
|
|
82
|
+
} else this.disposeVideo && t instanceof Bt && t.source.data && this.resources.add(t.source.data);
|
|
71
83
|
return t;
|
|
72
84
|
}
|
|
73
85
|
dispose() {
|
|
74
86
|
const t = [];
|
|
75
87
|
for (const e of this.resources)
|
|
76
|
-
e instanceof
|
|
88
|
+
e instanceof R ? t.push(e) : e instanceof HTMLVideoElement && e.pause(), Reflect.has(e, "dispose") && e.dispose();
|
|
77
89
|
t.forEach((e) => {
|
|
78
90
|
e.removeFromParent();
|
|
79
91
|
}), t.length = 0, this.resources.clear();
|
|
80
92
|
}
|
|
81
93
|
}
|
|
82
|
-
const
|
|
83
|
-
const e = new
|
|
94
|
+
const ne = (n, t = 1) => {
|
|
95
|
+
const e = new J();
|
|
84
96
|
e.setAttribute(
|
|
85
97
|
"position",
|
|
86
|
-
new
|
|
98
|
+
new G(new Array(t * 3).fill(0), 3)
|
|
87
99
|
), e.setAttribute(
|
|
88
100
|
"scaleAtt",
|
|
89
|
-
new
|
|
101
|
+
new G(new Array(t).fill(1), 1)
|
|
90
102
|
);
|
|
91
|
-
const i =
|
|
103
|
+
const i = n.material, s = new Tt({
|
|
92
104
|
size: 10,
|
|
93
105
|
map: i.map,
|
|
94
106
|
alphaMap: i.alphaMap,
|
|
@@ -101,19 +113,119 @@ const ee = (a, t = 1) => {
|
|
|
101
113
|
alphaTest: i.alphaTest,
|
|
102
114
|
sizeAttenuation: !1
|
|
103
115
|
});
|
|
104
|
-
return s.onBeforeCompile = (
|
|
105
|
-
|
|
116
|
+
return s.onBeforeCompile = (a) => {
|
|
117
|
+
a.vertexShader = `
|
|
106
118
|
attribute float scaleAtt;
|
|
107
|
-
${
|
|
119
|
+
${a.vertexShader.replace(
|
|
108
120
|
"gl_PointSize = size;",
|
|
109
121
|
"gl_PointSize = size * scaleAtt;"
|
|
110
122
|
)}
|
|
111
123
|
`;
|
|
112
|
-
}, new
|
|
124
|
+
}, new H(e, s);
|
|
125
|
+
}, oe = (n, t) => {
|
|
126
|
+
const e = new R();
|
|
127
|
+
t.forEach((i, s) => {
|
|
128
|
+
const a = dt(i.position), l = dt(i.scale || [1, 1, 1]);
|
|
129
|
+
e.position.copy(a), e.scale.copy(l), e.updateMatrix();
|
|
130
|
+
const o = e.matrix.clone();
|
|
131
|
+
if (n instanceof wt || n.isInstantiate)
|
|
132
|
+
n.setMatrixAt(s, o);
|
|
133
|
+
else if (n instanceof H || n.type === "Points") {
|
|
134
|
+
const r = n.geometry, h = r.attributes.position.array, f = r.attributes.scaleAtt.array, p = new D(), u = new D(), m = new zt(), d = s * 3, v = s * 1;
|
|
135
|
+
o.decompose(p, m, u), h[d] = p.x, h[d + 1] = p.y, h[d + 2] = p.z, f[v] = Math.max(u.x, u.y, u.z), r.attributes.position.needsUpdate = !0, r.attributes.scaleAtt.needsUpdate = !0;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
113
138
|
};
|
|
114
|
-
class
|
|
139
|
+
class re {
|
|
140
|
+
constructor() {
|
|
141
|
+
this.onPointerIndex = [];
|
|
142
|
+
}
|
|
143
|
+
onPointerEvent(t, e) {
|
|
144
|
+
const i = this.lead.handlePick([this], t, e);
|
|
145
|
+
this.onPointerIndex.push(i);
|
|
146
|
+
}
|
|
147
|
+
onClick(t) {
|
|
148
|
+
this.onPointerEvent("click", t);
|
|
149
|
+
}
|
|
150
|
+
onPointerEnter(t) {
|
|
151
|
+
this.onPointerEvent("enter", t);
|
|
152
|
+
}
|
|
153
|
+
onPointerLeave(t) {
|
|
154
|
+
this.onPointerEvent("leave", t);
|
|
155
|
+
}
|
|
156
|
+
onPointerMove(t) {
|
|
157
|
+
this.onPointerEvent("move", t);
|
|
158
|
+
}
|
|
159
|
+
onPointerDown(t) {
|
|
160
|
+
this.onPointerEvent("down", t);
|
|
161
|
+
}
|
|
162
|
+
dispose() {
|
|
163
|
+
this.onPointerIndex.forEach((t) => {
|
|
164
|
+
this.lead.removePick(t);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
class ae extends re {
|
|
169
|
+
constructor() {
|
|
170
|
+
super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
|
|
171
|
+
}
|
|
172
|
+
cloneMaterial() {
|
|
173
|
+
const t = this.object3d;
|
|
174
|
+
if (!t || !t.material)
|
|
175
|
+
return;
|
|
176
|
+
const e = t.material;
|
|
177
|
+
if (Array.isArray(e))
|
|
178
|
+
return e.map((i) => {
|
|
179
|
+
const s = i.userData;
|
|
180
|
+
i.userData = {};
|
|
181
|
+
const a = i.clone();
|
|
182
|
+
return i.userData = s, a;
|
|
183
|
+
});
|
|
184
|
+
{
|
|
185
|
+
const i = e.userData;
|
|
186
|
+
e.userData = {};
|
|
187
|
+
const s = e.clone();
|
|
188
|
+
return e.userData = i, s;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
setMaterialList(t, e) {
|
|
192
|
+
const i = this.object3d;
|
|
193
|
+
if (!i || !i.material)
|
|
194
|
+
return;
|
|
195
|
+
this.materialList.origin || (this.materialList.origin = i.material);
|
|
196
|
+
const s = e === "clone" ? this.cloneMaterial() : Array.isArray(e) ? e.slice() : e;
|
|
197
|
+
return this.materialList[t] = s, s;
|
|
198
|
+
}
|
|
199
|
+
useMaterial(t) {
|
|
200
|
+
const e = this.object3d;
|
|
201
|
+
!e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
|
|
202
|
+
}
|
|
203
|
+
useMListById(t, e) {
|
|
204
|
+
if (!this.mList)
|
|
205
|
+
return;
|
|
206
|
+
const i = this.mList.get(t);
|
|
207
|
+
if (!i)
|
|
208
|
+
return;
|
|
209
|
+
const s = this.object3d;
|
|
210
|
+
Array.isArray(s.material) && e !== void 0 ? s.material[e] = i : s.material = i;
|
|
211
|
+
}
|
|
212
|
+
useMListByName(t, e) {
|
|
213
|
+
if (!this.mList)
|
|
214
|
+
return;
|
|
215
|
+
const i = this.mList.getKeyByName(t);
|
|
216
|
+
i && this.useMListById(i, e);
|
|
217
|
+
}
|
|
218
|
+
dispose() {
|
|
219
|
+
super.dispose(), this.mList.rmBaseObjectMap(
|
|
220
|
+
this,
|
|
221
|
+
void 0,
|
|
222
|
+
this.disposeMaterialIfNotUsed
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
class mt extends ae {
|
|
115
227
|
constructor() {
|
|
116
|
-
super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.
|
|
228
|
+
super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.prefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.disposeTrack = !0;
|
|
117
229
|
}
|
|
118
230
|
get parent() {
|
|
119
231
|
const t = this.object3d.parent;
|
|
@@ -131,11 +243,21 @@ class ie extends O {
|
|
|
131
243
|
get scale() {
|
|
132
244
|
return this.object3d.scale;
|
|
133
245
|
}
|
|
134
|
-
get
|
|
135
|
-
return this.object3d.
|
|
246
|
+
get lookAt() {
|
|
247
|
+
return this.object3d.lookAt;
|
|
136
248
|
}
|
|
137
|
-
|
|
138
|
-
|
|
249
|
+
add(...t) {
|
|
250
|
+
[...t].forEach((e) => {
|
|
251
|
+
this.lead.objMap.get(e) ? this.object3d.add(e) : this.lead.createBaseObject(e, {
|
|
252
|
+
target: this
|
|
253
|
+
});
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
remove(...t) {
|
|
257
|
+
[...t].forEach((e) => {
|
|
258
|
+
var i;
|
|
259
|
+
this.lead.objMap.get(e) ? (i = this.lead.objMap.get(e)) == null || i.erase() : this.object3d.remove(e);
|
|
260
|
+
});
|
|
139
261
|
}
|
|
140
262
|
get visible() {
|
|
141
263
|
return this.object3d.visible;
|
|
@@ -162,31 +284,31 @@ class ie extends O {
|
|
|
162
284
|
resize(t, e) {
|
|
163
285
|
}
|
|
164
286
|
show() {
|
|
165
|
-
return this.object3d.visible = !0, this;
|
|
287
|
+
return this.object3d.visible = !0, this.object3d.layers.set(ee), this;
|
|
166
288
|
}
|
|
167
289
|
hide() {
|
|
168
|
-
return this.object3d.visible = !1, this;
|
|
169
|
-
}
|
|
170
|
-
createMesh(...t) {
|
|
171
|
-
return this.object3d = new xt(...t), this;
|
|
290
|
+
return this.object3d.visible = !1, this.object3d.layers.set(ie), this;
|
|
172
291
|
}
|
|
173
292
|
createGroup() {
|
|
174
|
-
return this.object3d = new
|
|
293
|
+
return this.object3d = new Lt(), this;
|
|
294
|
+
}
|
|
295
|
+
createMesh(...t) {
|
|
296
|
+
return this.object3d = new St(...t), this;
|
|
175
297
|
}
|
|
176
298
|
createPoints(...t) {
|
|
177
|
-
return this.object3d = new
|
|
299
|
+
return this.object3d = new H(...t), this;
|
|
178
300
|
}
|
|
179
301
|
createCSS2DObject(t) {
|
|
180
|
-
return this.object3d = new
|
|
302
|
+
return this.object3d = new Nt(t), this;
|
|
181
303
|
}
|
|
182
304
|
createCSS3DObject(t) {
|
|
183
|
-
return this.object3d = new
|
|
305
|
+
return this.object3d = new Rt(t), this;
|
|
184
306
|
}
|
|
185
307
|
createCSS3DSprite(t) {
|
|
186
|
-
return this.object3d = new
|
|
308
|
+
return this.object3d = new Gt(t), this;
|
|
187
309
|
}
|
|
188
310
|
createSprite(t) {
|
|
189
|
-
return this.object3d = new
|
|
311
|
+
return this.object3d = new lt(t), this;
|
|
190
312
|
}
|
|
191
313
|
attach(...t) {
|
|
192
314
|
return [...t].forEach((e) => {
|
|
@@ -194,120 +316,62 @@ class ie extends O {
|
|
|
194
316
|
}), this;
|
|
195
317
|
}
|
|
196
318
|
getSize() {
|
|
197
|
-
const t = new
|
|
319
|
+
const t = new jt().setFromObject(this.object3d);
|
|
198
320
|
return {
|
|
199
321
|
min: t.min,
|
|
200
322
|
max: t.max,
|
|
201
|
-
size: t.getSize(new
|
|
202
|
-
center: t.getCenter(new
|
|
323
|
+
size: t.getSize(new D()),
|
|
324
|
+
center: t.getCenter(new D())
|
|
203
325
|
};
|
|
204
326
|
}
|
|
327
|
+
setTop(t) {
|
|
328
|
+
this.object3d && (this.object3d.renderOrder = t);
|
|
329
|
+
}
|
|
205
330
|
traverse(t) {
|
|
206
331
|
t(this), this.children.forEach((e) => {
|
|
207
332
|
e.traverse(t);
|
|
208
333
|
});
|
|
209
334
|
}
|
|
210
|
-
|
|
211
|
-
return this
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
let l = e == null ? void 0 : e.create;
|
|
218
|
-
l === void 0 && (l = (u) => {
|
|
335
|
+
instantiate(t) {
|
|
336
|
+
return rt(this, null, function* () {
|
|
337
|
+
var c;
|
|
338
|
+
const e = (c = t == null ? void 0 : t.recursive) != null ? c : !0, { objectType: i, objectOptions: s } = this, [, a] = i.split("#");
|
|
339
|
+
let l = t == null ? void 0 : t.create;
|
|
340
|
+
l === void 0 && (l = (r) => {
|
|
341
|
+
var h;
|
|
219
342
|
if (this.object3d) {
|
|
220
|
-
if (
|
|
221
|
-
const
|
|
222
|
-
if (this.object3d instanceof
|
|
223
|
-
|
|
343
|
+
if ((h = t == null ? void 0 : t.instancedAttr) != null && h.length) {
|
|
344
|
+
const f = t.instancedAttr.length;
|
|
345
|
+
if (this.object3d instanceof lt)
|
|
346
|
+
r.object3d = ne(this.object3d, f);
|
|
224
347
|
else {
|
|
225
|
-
const
|
|
226
|
-
|
|
227
|
-
f.geometry,
|
|
228
|
-
f.material,
|
|
229
|
-
m
|
|
230
|
-
), u.setMaterialList("instantiate", "clone"), u.useMaterial("instantiate");
|
|
348
|
+
const p = this.object3d, u = this.cloneMaterial();
|
|
349
|
+
r.object3d = new wt(p.geometry, u, f);
|
|
231
350
|
}
|
|
232
|
-
|
|
233
|
-
t.forEach((f, p) => {
|
|
234
|
-
const g = ut(f.position), w = ut(f.scale || [1, 1, 1]);
|
|
235
|
-
h.position.copy(g), h.scale.copy(w), h.updateMatrix(), u.setInstancedMatrix(p, h.matrix.clone());
|
|
236
|
-
});
|
|
351
|
+
oe(r.object3d, t == null ? void 0 : t.instancedAttr);
|
|
237
352
|
} else
|
|
238
|
-
|
|
239
|
-
|
|
353
|
+
r.object3d = this.object3d.clone(!1), r.object3d.material && (r.object3d.material = this.cloneMaterial());
|
|
354
|
+
r.object3d.userData.prefab && delete r.object3d.userData.prefab;
|
|
240
355
|
}
|
|
241
356
|
});
|
|
242
|
-
const
|
|
357
|
+
const o = yield this.lead.draw(a, q(E({}, s || {}), {
|
|
243
358
|
create: l,
|
|
244
359
|
prefab: !1,
|
|
245
|
-
key: (
|
|
246
|
-
target: (
|
|
360
|
+
key: (t == null ? void 0 : t.key) || (s == null ? void 0 : s.key),
|
|
361
|
+
target: (t == null ? void 0 : t.target) || (s == null ? void 0 : s.target)
|
|
247
362
|
}));
|
|
248
|
-
return this.isBloom &&
|
|
363
|
+
return this.isBloom && o.enableBloom(), e && (yield Promise.all(
|
|
249
364
|
this.children.map(
|
|
250
|
-
(
|
|
251
|
-
target:
|
|
365
|
+
(r) => r.instantiate({
|
|
366
|
+
target: o
|
|
252
367
|
})
|
|
253
368
|
)
|
|
254
|
-
)),
|
|
369
|
+
)), o.isInstantiate = !0, o;
|
|
255
370
|
});
|
|
256
371
|
}
|
|
257
|
-
setInstancedMatrix(t, e) {
|
|
258
|
-
if (this.object3d instanceof ot || this.object3d.isInstantiate)
|
|
259
|
-
this.object3d.setMatrixAt(t, e);
|
|
260
|
-
else if (this.object3d instanceof X || this.object3d.type === "Points") {
|
|
261
|
-
const s = this.object3d.geometry, r = s.attributes.position.array, o = s.attributes.scaleAtt.array, n = new C(), l = new C(), c = new Tt(), d = t * 3, u = t * 1;
|
|
262
|
-
e.decompose(n, c, l), r[d] = n.x, r[d + 1] = n.y, r[d + 2] = n.z, o[u] = Math.max(l.x, l.y, l.z), s.attributes.position.needsUpdate = !0, s.attributes.scaleAtt.needsUpdate = !0;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
372
|
erase() {
|
|
266
373
|
this.lead.erase(this);
|
|
267
374
|
}
|
|
268
|
-
cloneMaterial() {
|
|
269
|
-
const t = this.object3d;
|
|
270
|
-
if (!t || !t.material)
|
|
271
|
-
return;
|
|
272
|
-
const e = t.material;
|
|
273
|
-
if (Array.isArray(e))
|
|
274
|
-
return e.map((i) => {
|
|
275
|
-
const s = i.userData;
|
|
276
|
-
i.userData = {};
|
|
277
|
-
const r = i.clone();
|
|
278
|
-
return i.userData = s, r;
|
|
279
|
-
});
|
|
280
|
-
{
|
|
281
|
-
const i = e.userData;
|
|
282
|
-
e.userData = {};
|
|
283
|
-
const s = e.clone();
|
|
284
|
-
return e.userData = i, s;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
setMaterialList(t, e, i = !0) {
|
|
288
|
-
const s = this.object3d;
|
|
289
|
-
if (!s || !s.material)
|
|
290
|
-
return;
|
|
291
|
-
if (this.materialList.origin || (this.materialList.origin = s.material), this.materialList[t])
|
|
292
|
-
if (i) {
|
|
293
|
-
const o = this.materialList[t], n = new O();
|
|
294
|
-
n.track(o), n.dispose();
|
|
295
|
-
} else
|
|
296
|
-
return this.materialList[t];
|
|
297
|
-
const r = e === "clone" ? this.cloneMaterial() : e;
|
|
298
|
-
return this.materialList[t] = r, r;
|
|
299
|
-
}
|
|
300
|
-
useMaterial(t) {
|
|
301
|
-
const e = this.object3d;
|
|
302
|
-
!e || !e.material || this.useMaterialType === t || !this.materialList[t] || (this.useMaterialType = t, e.material = this.materialList[t]);
|
|
303
|
-
}
|
|
304
|
-
setTop(t) {
|
|
305
|
-
this.object3d && (this.object3d.renderOrder = t);
|
|
306
|
-
}
|
|
307
|
-
onPointerEvent(t, e) {
|
|
308
|
-
const i = this.lead.handlePick([this], t, e);
|
|
309
|
-
this.onPointerIndex.push(i);
|
|
310
|
-
}
|
|
311
375
|
enableBloom() {
|
|
312
376
|
var t;
|
|
313
377
|
(t = this.pencil.composerController) == null || t.setBloomSelection(this, !0), this.isBloom = !0;
|
|
@@ -318,91 +382,87 @@ class ie extends O {
|
|
|
318
382
|
}
|
|
319
383
|
dispose() {
|
|
320
384
|
var t;
|
|
321
|
-
this.
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
326
|
-
class ze extends ie {
|
|
327
|
-
create() {
|
|
328
|
-
this.createGroup();
|
|
385
|
+
if (super.dispose(), (t = this.pencil.composerController) == null || t.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) {
|
|
386
|
+
const e = new se();
|
|
387
|
+
e.disposeMaterial = !1, e.track(this), e.dispose();
|
|
388
|
+
}
|
|
329
389
|
}
|
|
330
390
|
}
|
|
331
|
-
const
|
|
332
|
-
let
|
|
333
|
-
function
|
|
334
|
-
return
|
|
391
|
+
const Q = new O(), vt = new D(), yt = new D(), b = new O(), g = new O(), B = new O(), X = new D(), Y = new _t(), M = new Et(), bt = new D(), U = new jt(), N = new Ot(), T = new O();
|
|
392
|
+
let z, _;
|
|
393
|
+
function gt(n, t, e) {
|
|
394
|
+
return T.set(0, 0, -t, 1).applyMatrix4(n.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / e.width, T.y = _ / e.height, T.applyMatrix4(n.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
|
|
335
395
|
}
|
|
336
|
-
function
|
|
337
|
-
const e =
|
|
338
|
-
for (let
|
|
339
|
-
|
|
340
|
-
const
|
|
341
|
-
|
|
342
|
-
point:
|
|
343
|
-
pointOnLine:
|
|
344
|
-
distance:
|
|
345
|
-
object:
|
|
396
|
+
function ce(n, t) {
|
|
397
|
+
const e = n.matrixWorld, i = n.geometry, s = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, s.count);
|
|
398
|
+
for (let o = 0, c = l; o < c; o++) {
|
|
399
|
+
M.start.fromBufferAttribute(s, o), M.end.fromBufferAttribute(a, o), M.applyMatrix4(e);
|
|
400
|
+
const r = new D(), h = new D();
|
|
401
|
+
z.distanceSqToSegment(M.start, M.end, h, r), h.distanceTo(r) < _ * 0.5 && t.push({
|
|
402
|
+
point: h,
|
|
403
|
+
pointOnLine: r,
|
|
404
|
+
distance: z.origin.distanceTo(h),
|
|
405
|
+
object: n,
|
|
346
406
|
face: null,
|
|
347
|
-
faceIndex:
|
|
407
|
+
faceIndex: o,
|
|
348
408
|
uv: null,
|
|
349
409
|
uv1: null
|
|
350
410
|
});
|
|
351
411
|
}
|
|
352
412
|
}
|
|
353
|
-
function
|
|
354
|
-
const i = t.projectionMatrix,
|
|
355
|
-
|
|
356
|
-
for (let
|
|
357
|
-
if (b.fromBufferAttribute(
|
|
413
|
+
function le(n, t, e) {
|
|
414
|
+
const i = t.projectionMatrix, a = n.material.resolution, l = n.matrixWorld, o = n.geometry, c = o.attributes.instanceStart, r = o.attributes.instanceEnd, h = Math.min(o.instanceCount, c.count), f = -t.near;
|
|
415
|
+
z.at(1, B), B.w = 1, B.applyMatrix4(t.matrixWorldInverse), B.applyMatrix4(i), B.multiplyScalar(1 / B.w), B.x *= a.x / 2, B.y *= a.y / 2, B.z = 0, X.copy(B), Y.multiplyMatrices(t.matrixWorldInverse, l);
|
|
416
|
+
for (let p = 0, u = h; p < u; p++) {
|
|
417
|
+
if (b.fromBufferAttribute(c, p), g.fromBufferAttribute(r, p), b.w = 1, g.w = 1, b.applyMatrix4(Y), g.applyMatrix4(Y), b.z > f && g.z > f)
|
|
358
418
|
continue;
|
|
359
|
-
if (b.z >
|
|
360
|
-
const
|
|
361
|
-
b.lerp(
|
|
362
|
-
} else if (
|
|
363
|
-
const
|
|
364
|
-
|
|
419
|
+
if (b.z > f) {
|
|
420
|
+
const j = b.z - g.z, A = (b.z - f) / j;
|
|
421
|
+
b.lerp(g, A);
|
|
422
|
+
} else if (g.z > f) {
|
|
423
|
+
const j = g.z - b.z, A = (g.z - f) / j;
|
|
424
|
+
g.lerp(b, A);
|
|
365
425
|
}
|
|
366
|
-
b.applyMatrix4(i),
|
|
367
|
-
const
|
|
368
|
-
|
|
369
|
-
const
|
|
370
|
-
if (w &&
|
|
371
|
-
|
|
372
|
-
const
|
|
373
|
-
|
|
374
|
-
point:
|
|
375
|
-
pointOnLine:
|
|
376
|
-
distance:
|
|
377
|
-
object:
|
|
426
|
+
b.applyMatrix4(i), g.applyMatrix4(i), b.multiplyScalar(1 / b.w), g.multiplyScalar(1 / g.w), b.x *= a.x / 2, b.y *= a.y / 2, g.x *= a.x / 2, g.y *= a.y / 2, M.start.copy(b), M.start.z = 0, M.end.copy(g), M.end.z = 0;
|
|
427
|
+
const d = M.closestPointToPointParameter(X, !0);
|
|
428
|
+
M.at(d, bt);
|
|
429
|
+
const v = kt.lerp(b.z, g.z, d), w = v >= -1 && v <= 1, S = X.distanceTo(bt) < _ * 0.5;
|
|
430
|
+
if (w && S) {
|
|
431
|
+
M.start.fromBufferAttribute(c, p), M.end.fromBufferAttribute(r, p), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
432
|
+
const j = new D(), A = new D();
|
|
433
|
+
z.distanceSqToSegment(M.start, M.end, A, j), e.push({
|
|
434
|
+
point: A,
|
|
435
|
+
pointOnLine: j,
|
|
436
|
+
distance: z.origin.distanceTo(A),
|
|
437
|
+
object: n,
|
|
378
438
|
face: null,
|
|
379
|
-
faceIndex:
|
|
439
|
+
faceIndex: p,
|
|
380
440
|
uv: null,
|
|
381
441
|
uv1: null
|
|
382
442
|
});
|
|
383
443
|
}
|
|
384
444
|
}
|
|
385
445
|
}
|
|
386
|
-
class
|
|
446
|
+
class Ee extends St {
|
|
387
447
|
constructor(t = new Qt(), e) {
|
|
388
448
|
super(t, e), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
389
449
|
}
|
|
390
450
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
391
451
|
computeLineDistances() {
|
|
392
452
|
const t = this.geometry, e = t.attributes.instanceStart, i = t.attributes.instanceEnd, s = new Float32Array(2 * e.count);
|
|
393
|
-
for (let
|
|
394
|
-
|
|
395
|
-
const
|
|
453
|
+
for (let l = 0, o = 0, c = e.count; l < c; l++, o += 2)
|
|
454
|
+
vt.fromBufferAttribute(e, l), yt.fromBufferAttribute(i, l), s[o] = o === 0 ? 0 : s[o - 1], s[o + 1] = s[o] + vt.distanceTo(yt);
|
|
455
|
+
const a = new Vt(
|
|
396
456
|
s,
|
|
397
457
|
2,
|
|
398
458
|
1
|
|
399
459
|
);
|
|
400
460
|
return t.setAttribute(
|
|
401
461
|
"instanceDistanceStart",
|
|
402
|
-
new
|
|
462
|
+
new ut(a, 1, 0)
|
|
403
463
|
), t.setAttribute(
|
|
404
464
|
"instanceDistanceEnd",
|
|
405
|
-
new
|
|
465
|
+
new ut(a, 1, 1)
|
|
406
466
|
), this;
|
|
407
467
|
}
|
|
408
468
|
raycast(t, e) {
|
|
@@ -410,670 +470,463 @@ class De extends xt {
|
|
|
410
470
|
s === null && !i && console.error(
|
|
411
471
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
412
472
|
);
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
let
|
|
473
|
+
const a = t.params.Line2 !== void 0 && t.params.Line2.threshold || 0;
|
|
474
|
+
z = t.ray;
|
|
475
|
+
const l = this.matrixWorld, o = this.geometry, c = this.material;
|
|
476
|
+
_ = c.linewidth + a, o.boundingSphere === null && o.computeBoundingSphere(), N.copy(o.boundingSphere).applyMatrix4(l);
|
|
477
|
+
let r;
|
|
418
478
|
if (i)
|
|
419
|
-
|
|
479
|
+
r = _ * 0.5;
|
|
420
480
|
else {
|
|
421
|
-
const
|
|
481
|
+
const f = Math.max(
|
|
422
482
|
s.near,
|
|
423
|
-
|
|
483
|
+
N.distanceToPoint(z.origin)
|
|
424
484
|
);
|
|
425
|
-
|
|
485
|
+
r = gt(
|
|
426
486
|
s,
|
|
427
|
-
|
|
428
|
-
|
|
487
|
+
f,
|
|
488
|
+
c.resolution
|
|
429
489
|
);
|
|
430
490
|
}
|
|
431
|
-
if (
|
|
491
|
+
if (N.radius += r, z.intersectsSphere(N) === !1)
|
|
432
492
|
return;
|
|
433
|
-
|
|
434
|
-
let
|
|
493
|
+
o.boundingBox === null && o.computeBoundingBox(), U.copy(o.boundingBox).applyMatrix4(l);
|
|
494
|
+
let h;
|
|
435
495
|
if (i)
|
|
436
|
-
|
|
496
|
+
h = _ * 0.5;
|
|
437
497
|
else {
|
|
438
|
-
const
|
|
498
|
+
const f = Math.max(
|
|
439
499
|
s.near,
|
|
440
|
-
U.distanceToPoint(
|
|
500
|
+
U.distanceToPoint(z.origin)
|
|
441
501
|
);
|
|
442
|
-
|
|
502
|
+
h = gt(
|
|
443
503
|
s,
|
|
444
|
-
|
|
445
|
-
|
|
504
|
+
f,
|
|
505
|
+
c.resolution
|
|
446
506
|
);
|
|
447
507
|
}
|
|
448
|
-
U.expandByScalar(
|
|
508
|
+
U.expandByScalar(h), z.intersectsBox(U) !== !1 && (i ? ce(this, e) : le(this, s, e));
|
|
449
509
|
}
|
|
450
510
|
onBeforeRender(t) {
|
|
451
511
|
const e = this.material.uniforms;
|
|
452
|
-
e && e.resolution && (t.getViewport(
|
|
512
|
+
e && e.resolution && (t.getViewport(Q), this.material.uniforms.resolution.value.set(Q.z, Q.w));
|
|
453
513
|
}
|
|
454
514
|
}
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
#include <common>
|
|
459
|
-
#include <logdepthbuf_pars_vertex>
|
|
460
|
-
#include <fog_pars_vertex>
|
|
515
|
+
const ue = `
|
|
516
|
+
#include <fog_pars_fragment>
|
|
517
|
+
#include <logdepthbuf_pars_fragment>
|
|
461
518
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
uniform vec2 resolution;
|
|
469
|
-
uniform float lineWidth;
|
|
470
|
-
uniform vec3 color;
|
|
471
|
-
uniform float opacity;
|
|
472
|
-
uniform float sizeAttenuation;
|
|
473
|
-
uniform vec2 offset;
|
|
519
|
+
uniform float useDash;
|
|
520
|
+
uniform float dashArray;
|
|
521
|
+
uniform float dashOffset;
|
|
522
|
+
uniform float dashRatio;
|
|
523
|
+
uniform sampler2D alphaMap;
|
|
524
|
+
uniform float useAlphaMap;
|
|
474
525
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
uniform float size;
|
|
479
|
-
uniform float speed;
|
|
480
|
-
uniform float lightWidth;
|
|
481
|
-
uniform float lineLightAnimation;
|
|
482
|
-
|
|
483
|
-
varying vec2 vUV;
|
|
484
|
-
varying vec4 vColor;
|
|
485
|
-
varying float vCounters;
|
|
486
|
-
varying vec2 vHighPrecisionZW;
|
|
487
|
-
|
|
488
|
-
vec2 fix(vec4 i, float aspect) {
|
|
489
|
-
vec2 res = i.xy / i.w;
|
|
490
|
-
res.x *= aspect;
|
|
491
|
-
vCounters = counters;
|
|
492
|
-
return res;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
void main() {
|
|
496
|
-
float aspect = resolution.x / resolution.y;
|
|
497
|
-
if (lineLightAnimation == 1.0) {
|
|
498
|
-
vec2 vWorld=position.xy;
|
|
499
|
-
float r_time=mod(time/(speed*size),2.);
|
|
500
|
-
float l=distance(vWorld, uCenter)/size;
|
|
501
|
-
float r_opacity=smoothstep(r_time-lightWidth*2.,r_time-lightWidth,l)-smoothstep(r_time-lightWidth,r_time,l);
|
|
502
|
-
vColor=vec4(mix(color,lightColor,r_opacity),opacity);
|
|
503
|
-
} else {
|
|
504
|
-
vColor=vec4(color,opacity);
|
|
505
|
-
}
|
|
526
|
+
varying vec2 vUV;
|
|
527
|
+
varying vec4 vColor;
|
|
528
|
+
varying float vCounters;
|
|
506
529
|
|
|
507
|
-
|
|
530
|
+
uniform sampler2D map;
|
|
531
|
+
uniform float useMap;
|
|
532
|
+
uniform vec2 repeat;
|
|
533
|
+
uniform float offsetLoop;
|
|
534
|
+
uniform float alphaTest;
|
|
508
535
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
vec2 dir;
|
|
521
|
-
if (nextP == currentP) dir = normalize(currentP - prevP);
|
|
522
|
-
else if (prevP == currentP) dir = normalize(nextP - currentP);
|
|
523
|
-
else {
|
|
524
|
-
vec2 dir1 = normalize(currentP - prevP);
|
|
525
|
-
vec2 dir2 = normalize(nextP - currentP);
|
|
526
|
-
dir = normalize(dir1 + dir2);
|
|
527
|
-
|
|
528
|
-
vec2 perp = vec2(-dir1.y, dir1.x);
|
|
529
|
-
vec2 miter = vec2(-dir.y, dir.x);
|
|
530
|
-
//w = clamp(w / dot(miter, perp), 0., 4. * lineWidth * width);
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
//vec2 normal = (cross(vec3(dir, 0.), vec3(0., 0., 1.))).xy;
|
|
534
|
-
vec4 normal = vec4(-dir.y, dir.x, 0., 1.);
|
|
535
|
-
normal.xy *= .5 * w;
|
|
536
|
-
//normal *= projectionMatrix;
|
|
537
|
-
if (sizeAttenuation == 0.) {
|
|
538
|
-
normal.xy *= finalPosition.w;
|
|
539
|
-
normal.xy /= (vec4(resolution, 0., 1.) * projectionMatrix).xy;
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
finalPosition.xy += normal.xy * side;
|
|
543
|
-
gl_Position = finalPosition;
|
|
544
|
-
#include <logdepthbuf_vertex>
|
|
545
|
-
#include <fog_vertex>
|
|
546
|
-
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
|
|
547
|
-
vHighPrecisionZW = finalPosition.zw;
|
|
548
|
-
#include <fog_vertex>
|
|
549
|
-
}
|
|
550
|
-
`
|
|
551
|
-
), ae = (
|
|
552
|
-
/* glsl */
|
|
553
|
-
`
|
|
554
|
-
#include <packing>
|
|
555
|
-
#include <fog_pars_fragment>
|
|
556
|
-
#include <logdepthbuf_pars_fragment>
|
|
557
|
-
|
|
558
|
-
uniform sampler2D map;
|
|
559
|
-
uniform sampler2D alphaMap;
|
|
560
|
-
uniform float useMap;
|
|
561
|
-
uniform float useAlphaMap;
|
|
562
|
-
uniform float useDash;
|
|
563
|
-
uniform float dashArray;
|
|
564
|
-
uniform float dashOffset;
|
|
565
|
-
uniform float dashRatio;
|
|
566
|
-
uniform float visibility;
|
|
567
|
-
uniform float alphaTest;
|
|
568
|
-
uniform vec2 repeat;
|
|
569
|
-
uniform float useDepth;
|
|
570
|
-
uniform float offsetLoop;
|
|
571
|
-
|
|
572
|
-
varying vec2 vUV;
|
|
573
|
-
varying vec4 vColor;
|
|
574
|
-
varying float vCounters;
|
|
575
|
-
varying vec2 vHighPrecisionZW;
|
|
576
|
-
|
|
577
|
-
void main() {
|
|
578
|
-
#include <logdepthbuf_fragment>
|
|
579
|
-
vec4 c = vColor;
|
|
580
|
-
if (useMap == 1.) c *= texture2D(map, vUV * repeat);
|
|
581
|
-
if (useAlphaMap == 1.) c.a *= texture2D(alphaMap, vUV * repeat).a;
|
|
582
|
-
if(offsetLoop!=1.0){
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
void main() {
|
|
539
|
+
#include <logdepthbuf_fragment>
|
|
540
|
+
|
|
541
|
+
vec4 c = vColor;
|
|
542
|
+
|
|
543
|
+
if( useMap == 1. ) c *= texture2D( map, vUV * repeat );
|
|
544
|
+
if( useAlphaMap == 1. ) c.a *= texture2D( alphaMap, vUV * repeat ).r;
|
|
545
|
+
if(offsetLoop!=1.0){
|
|
583
546
|
if(vUV.x>1.0 || vUV.x<0.0){
|
|
584
547
|
c.a = 0.0;
|
|
585
548
|
}
|
|
586
549
|
}
|
|
550
|
+
if (c.a < alphaTest) discard;
|
|
551
|
+
if( useDash == 1. ){
|
|
552
|
+
c.a *= ceil(mod(vCounters + dashOffset, dashArray) - (dashArray * dashRatio));
|
|
553
|
+
}
|
|
554
|
+
gl_FragColor = c;
|
|
555
|
+
#include <fog_fragment>
|
|
556
|
+
#include <${parseInt(Wt) < 154 ? "encodings_fragment" : "colorspace_fragment"}>
|
|
557
|
+
}
|
|
558
|
+
`, fe = `
|
|
559
|
+
#include <common>
|
|
560
|
+
${W.logdepthbuf_pars_vertex}
|
|
561
|
+
${W.fog_pars_vertex}
|
|
587
562
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
563
|
+
attribute vec3 previous;
|
|
564
|
+
attribute vec3 next;
|
|
565
|
+
attribute float side;
|
|
566
|
+
attribute float width;
|
|
567
|
+
attribute float counters;
|
|
568
|
+
|
|
569
|
+
uniform vec2 resolution;
|
|
570
|
+
uniform float lineWidth;
|
|
571
|
+
uniform vec3 color;
|
|
572
|
+
uniform float opacity;
|
|
573
|
+
uniform float sizeAttenuation;
|
|
574
|
+
uniform float scaleDown;
|
|
575
|
+
uniform vec2 offset;
|
|
576
|
+
|
|
577
|
+
varying vec2 vUV;
|
|
578
|
+
varying vec4 vColor;
|
|
579
|
+
varying float vCounters;
|
|
580
|
+
|
|
581
|
+
vec2 intoScreen(vec4 i) {
|
|
582
|
+
return resolution * (0.5 * i.xy / i.w + 0.5);
|
|
598
583
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
);
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
lightColor: { value: new ct(16777215) }
|
|
637
|
-
}),
|
|
638
|
-
vertexShader: re,
|
|
639
|
-
fragmentShader: ae
|
|
640
|
-
}), this.type = "MeshLineMaterial", Object.defineProperties(this, {
|
|
641
|
-
lineWidth: {
|
|
642
|
-
enumerable: !0,
|
|
643
|
-
get() {
|
|
644
|
-
return this.uniforms.lineWidth.value;
|
|
645
|
-
},
|
|
646
|
-
set(e) {
|
|
647
|
-
this.uniforms.lineWidth.value = e;
|
|
648
|
-
}
|
|
649
|
-
},
|
|
650
|
-
map: {
|
|
651
|
-
enumerable: !0,
|
|
652
|
-
get() {
|
|
653
|
-
return this.uniforms.map.value;
|
|
654
|
-
},
|
|
655
|
-
set(e) {
|
|
656
|
-
this.uniforms.map.value = e;
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
useMap: {
|
|
660
|
-
enumerable: !0,
|
|
661
|
-
get() {
|
|
662
|
-
return this.uniforms.useMap.value;
|
|
663
|
-
},
|
|
664
|
-
set(e) {
|
|
665
|
-
this.uniforms.useMap.value = e;
|
|
666
|
-
}
|
|
667
|
-
},
|
|
668
|
-
alphaMap: {
|
|
669
|
-
enumerable: !0,
|
|
670
|
-
get() {
|
|
671
|
-
return this.uniforms.alphaMap.value;
|
|
672
|
-
},
|
|
673
|
-
set(e) {
|
|
674
|
-
this.uniforms.alphaMap.value = e;
|
|
675
|
-
}
|
|
676
|
-
},
|
|
677
|
-
useAlphaMap: {
|
|
678
|
-
enumerable: !0,
|
|
679
|
-
get() {
|
|
680
|
-
return this.uniforms.useAlphaMap.value;
|
|
681
|
-
},
|
|
682
|
-
set(e) {
|
|
683
|
-
this.uniforms.useAlphaMap.value = e;
|
|
684
|
-
}
|
|
685
|
-
},
|
|
686
|
-
color: {
|
|
687
|
-
enumerable: !0,
|
|
688
|
-
get() {
|
|
689
|
-
return this.uniforms.color.value;
|
|
690
|
-
},
|
|
691
|
-
set(e) {
|
|
692
|
-
this.uniforms.color.value = e;
|
|
693
|
-
}
|
|
694
|
-
},
|
|
695
|
-
opacity: {
|
|
696
|
-
enumerable: !0,
|
|
697
|
-
get() {
|
|
698
|
-
return this.uniforms.opacity.value;
|
|
699
|
-
},
|
|
700
|
-
set(e) {
|
|
701
|
-
this.uniforms.opacity.value = e;
|
|
702
|
-
}
|
|
703
|
-
},
|
|
704
|
-
resolution: {
|
|
705
|
-
enumerable: !0,
|
|
706
|
-
get() {
|
|
707
|
-
return this.uniforms.resolution.value;
|
|
708
|
-
},
|
|
709
|
-
set(e) {
|
|
710
|
-
this.uniforms.resolution.value.copy(e);
|
|
711
|
-
}
|
|
712
|
-
},
|
|
713
|
-
sizeAttenuation: {
|
|
714
|
-
enumerable: !0,
|
|
715
|
-
get() {
|
|
716
|
-
return this.uniforms.sizeAttenuation.value;
|
|
717
|
-
},
|
|
718
|
-
set(e) {
|
|
719
|
-
this.uniforms.sizeAttenuation.value = e;
|
|
720
|
-
}
|
|
721
|
-
},
|
|
722
|
-
dashArray: {
|
|
723
|
-
enumerable: !0,
|
|
724
|
-
get() {
|
|
725
|
-
return this.uniforms.dashArray.value;
|
|
726
|
-
},
|
|
727
|
-
set(e) {
|
|
728
|
-
this.uniforms.dashArray.value = e, this.useDash = e !== 0 ? 1 : 0;
|
|
729
|
-
}
|
|
730
|
-
},
|
|
731
|
-
dashOffset: {
|
|
732
|
-
enumerable: !0,
|
|
733
|
-
get() {
|
|
734
|
-
return this.uniforms.dashOffset.value;
|
|
735
|
-
},
|
|
736
|
-
set(e) {
|
|
737
|
-
this.uniforms.dashOffset.value = e;
|
|
738
|
-
}
|
|
739
|
-
},
|
|
740
|
-
dashRatio: {
|
|
741
|
-
enumerable: !0,
|
|
742
|
-
get() {
|
|
743
|
-
return this.uniforms.dashRatio.value;
|
|
744
|
-
},
|
|
745
|
-
set(e) {
|
|
746
|
-
this.uniforms.dashRatio.value = e;
|
|
747
|
-
}
|
|
748
|
-
},
|
|
749
|
-
useDash: {
|
|
750
|
-
enumerable: !0,
|
|
751
|
-
get() {
|
|
752
|
-
return this.uniforms.useDash.value;
|
|
753
|
-
},
|
|
754
|
-
set(e) {
|
|
755
|
-
this.uniforms.useDash.value = e;
|
|
756
|
-
}
|
|
757
|
-
},
|
|
758
|
-
useDepth: {
|
|
759
|
-
enumerable: !0,
|
|
760
|
-
get() {
|
|
761
|
-
return this.uniforms.useDepth.value;
|
|
762
|
-
},
|
|
763
|
-
set(e) {
|
|
764
|
-
this.uniforms.useDepth.value = e;
|
|
765
|
-
}
|
|
766
|
-
},
|
|
767
|
-
visibility: {
|
|
768
|
-
enumerable: !0,
|
|
769
|
-
get() {
|
|
770
|
-
return this.uniforms.visibility.value;
|
|
771
|
-
},
|
|
772
|
-
set(e) {
|
|
773
|
-
this.uniforms.visibility.value = e;
|
|
774
|
-
}
|
|
775
|
-
},
|
|
776
|
-
alphaTest: {
|
|
777
|
-
enumerable: !0,
|
|
778
|
-
get() {
|
|
779
|
-
return this.uniforms.alphaTest.value;
|
|
780
|
-
},
|
|
781
|
-
set(e) {
|
|
782
|
-
this.uniforms.alphaTest.value = e;
|
|
783
|
-
}
|
|
784
|
-
},
|
|
785
|
-
repeat: {
|
|
786
|
-
enumerable: !0,
|
|
787
|
-
get() {
|
|
788
|
-
return this.uniforms.repeat.value;
|
|
789
|
-
},
|
|
790
|
-
set(e) {
|
|
791
|
-
this.uniforms.repeat.value.copy(e);
|
|
792
|
-
}
|
|
793
|
-
},
|
|
794
|
-
lineLightAnimation: {
|
|
795
|
-
enumerable: !0,
|
|
796
|
-
get: function() {
|
|
797
|
-
return this.uniforms.lineLightAnimation.value;
|
|
798
|
-
},
|
|
799
|
-
set: function(e) {
|
|
800
|
-
this.uniforms.lineLightAnimation.value = e;
|
|
801
|
-
}
|
|
802
|
-
},
|
|
803
|
-
time: {
|
|
804
|
-
enumerable: !0,
|
|
805
|
-
get: function() {
|
|
806
|
-
return this.uniforms.time.value;
|
|
807
|
-
},
|
|
808
|
-
set: function(e) {
|
|
809
|
-
this.uniforms.time.value = e;
|
|
810
|
-
}
|
|
811
|
-
},
|
|
812
|
-
size: {
|
|
813
|
-
enumerable: !0,
|
|
814
|
-
get: function() {
|
|
815
|
-
return this.uniforms.size.value;
|
|
816
|
-
},
|
|
817
|
-
set: function(e) {
|
|
818
|
-
this.uniforms.size.value = e;
|
|
819
|
-
}
|
|
820
|
-
},
|
|
821
|
-
speed: {
|
|
822
|
-
enumerable: !0,
|
|
823
|
-
get: function() {
|
|
824
|
-
return this.uniforms.speed.value;
|
|
825
|
-
},
|
|
826
|
-
set: function(e) {
|
|
827
|
-
this.uniforms.speed.value = e;
|
|
584
|
+
|
|
585
|
+
void main() {
|
|
586
|
+
float aspect = resolution.y / resolution.x;
|
|
587
|
+
|
|
588
|
+
mat4 m = projectionMatrix * modelViewMatrix;
|
|
589
|
+
|
|
590
|
+
vec4 currentClip = m * vec4( position, 1.0 );
|
|
591
|
+
vec4 prevClip = m * vec4( previous, 1.0 );
|
|
592
|
+
vec4 nextClip = m * vec4( next, 1.0 );
|
|
593
|
+
|
|
594
|
+
vec4 currentNormed = currentClip / currentClip.w;
|
|
595
|
+
vec4 prevNormed = prevClip / prevClip.w;
|
|
596
|
+
vec4 nextNormed = nextClip / nextClip.w;
|
|
597
|
+
|
|
598
|
+
vec2 currentScreen = intoScreen(currentNormed);
|
|
599
|
+
vec2 prevScreen = intoScreen(prevNormed);
|
|
600
|
+
vec2 nextScreen = intoScreen(nextNormed);
|
|
601
|
+
|
|
602
|
+
float actualWidth = lineWidth * width;
|
|
603
|
+
|
|
604
|
+
vec2 dir;
|
|
605
|
+
if(nextScreen == currentScreen) {
|
|
606
|
+
dir = normalize( currentScreen - prevScreen );
|
|
607
|
+
} else if(prevScreen == currentScreen) {
|
|
608
|
+
dir = normalize( nextScreen - currentScreen );
|
|
609
|
+
} else {
|
|
610
|
+
vec2 inDir = currentScreen - prevScreen;
|
|
611
|
+
vec2 outDir = nextScreen - currentScreen;
|
|
612
|
+
vec2 fullDir = nextScreen - prevScreen;
|
|
613
|
+
|
|
614
|
+
if(length(fullDir) > 0.0) {
|
|
615
|
+
dir = normalize(fullDir);
|
|
616
|
+
} else if(length(inDir) > 0.0){
|
|
617
|
+
dir = normalize(inDir);
|
|
618
|
+
} else {
|
|
619
|
+
dir = normalize(outDir);
|
|
620
|
+
}
|
|
828
621
|
}
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
set: function(e) {
|
|
836
|
-
this.uniforms.lightWidth.value = e;
|
|
622
|
+
|
|
623
|
+
vec2 normal = vec2(-dir.y, dir.x);
|
|
624
|
+
|
|
625
|
+
if(sizeAttenuation != 0.0) {
|
|
626
|
+
normal /= currentClip.w;
|
|
627
|
+
normal *= min(resolution.x, resolution.y);
|
|
837
628
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
return this.uniforms.uCenter.value;
|
|
843
|
-
},
|
|
844
|
-
set: function(e) {
|
|
845
|
-
this.uniforms.uCenter.value = e;
|
|
629
|
+
|
|
630
|
+
if (scaleDown > 0.0) {
|
|
631
|
+
float dist = length(nextNormed - prevNormed);
|
|
632
|
+
normal *= smoothstep(0.0, scaleDown, dist);
|
|
846
633
|
}
|
|
634
|
+
|
|
635
|
+
vec2 offsetInScreen = actualWidth * normal * side * 0.5;
|
|
636
|
+
|
|
637
|
+
vec2 withOffsetScreen = currentScreen + offsetInScreen;
|
|
638
|
+
vec3 withOffsetNormed = vec3((2.0 * withOffsetScreen/resolution - 1.0), currentNormed.z);
|
|
639
|
+
|
|
640
|
+
vCounters = counters;
|
|
641
|
+
vColor = vec4( color, opacity );
|
|
642
|
+
vUV = uv;
|
|
643
|
+
vUV=uv+offset;
|
|
644
|
+
|
|
645
|
+
gl_Position = currentClip.w * vec4(withOffsetNormed, 1.0);
|
|
646
|
+
|
|
647
|
+
${W.logdepthbuf_vertex}
|
|
648
|
+
${W.fog_vertex}
|
|
649
|
+
}
|
|
650
|
+
`;
|
|
651
|
+
class Oe extends Ut {
|
|
652
|
+
constructor(t = {}) {
|
|
653
|
+
var j;
|
|
654
|
+
const S = t, {
|
|
655
|
+
lineWidth: e = 1,
|
|
656
|
+
color: i = "#ffffff",
|
|
657
|
+
map: s = null,
|
|
658
|
+
useMap: a = 0,
|
|
659
|
+
dashOffset: l = 0,
|
|
660
|
+
dashArray: o = 0,
|
|
661
|
+
dashRatio: c = 0,
|
|
662
|
+
sizeAttenuation: r = !0,
|
|
663
|
+
offsetLoop: h = !0,
|
|
664
|
+
offset: f = new K(0, 0),
|
|
665
|
+
scaleDown: p = 0,
|
|
666
|
+
alphaMap: u = void 0,
|
|
667
|
+
alphaTest: m = 0,
|
|
668
|
+
repeat: d = new K(1, 1),
|
|
669
|
+
resolution: v = new K(1, 1)
|
|
670
|
+
} = S, w = ot(S, [
|
|
671
|
+
"lineWidth",
|
|
672
|
+
"color",
|
|
673
|
+
"map",
|
|
674
|
+
"useMap",
|
|
675
|
+
"dashOffset",
|
|
676
|
+
"dashArray",
|
|
677
|
+
"dashRatio",
|
|
678
|
+
"sizeAttenuation",
|
|
679
|
+
"offsetLoop",
|
|
680
|
+
"offset",
|
|
681
|
+
"scaleDown",
|
|
682
|
+
"alphaMap",
|
|
683
|
+
"alphaTest",
|
|
684
|
+
"repeat",
|
|
685
|
+
"resolution"
|
|
686
|
+
]);
|
|
687
|
+
super(q(E({}, w), {
|
|
688
|
+
uniforms: {
|
|
689
|
+
lineWidth: { value: e },
|
|
690
|
+
color: { value: new ft(i) },
|
|
691
|
+
opacity: { value: (j = t.opacity) != null ? j : 1 },
|
|
692
|
+
map: { value: s },
|
|
693
|
+
useMap: { value: s ? 1 : a },
|
|
694
|
+
resolution: { value: v },
|
|
695
|
+
sizeAttenuation: { value: r ? 1 : 0 },
|
|
696
|
+
offset: { value: f },
|
|
697
|
+
offsetLoop: { value: h ? 1 : 0 },
|
|
698
|
+
dashArray: { value: o },
|
|
699
|
+
dashOffset: { value: l },
|
|
700
|
+
dashRatio: { value: c },
|
|
701
|
+
useDash: { value: o > 0 ? 1 : 0 },
|
|
702
|
+
scaleDown: { value: p / 10 },
|
|
703
|
+
alphaTest: { value: m },
|
|
704
|
+
alphaMap: { value: u },
|
|
705
|
+
useAlphaMap: { value: u ? 1 : 0 },
|
|
706
|
+
repeat: { value: d }
|
|
847
707
|
},
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
return this.uniforms.lightColor.value;
|
|
852
|
-
},
|
|
853
|
-
set: function(e) {
|
|
854
|
-
e && (this.uniforms.lightColor.value = e);
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
}), this.setValues(t);
|
|
708
|
+
vertexShader: fe,
|
|
709
|
+
fragmentShader: ue
|
|
710
|
+
})), this.type = "MeshLineMaterial";
|
|
858
711
|
}
|
|
859
|
-
|
|
860
|
-
|
|
712
|
+
updateUniforms(t) {
|
|
713
|
+
t.opacity !== void 0 && (this.uniforms.opacity.value = t.opacity), t.color !== void 0 && (this.uniforms.color.value = new ft(t.color)), t.map !== void 0 && (this.uniforms.map.value = t.map, this.uniforms.useMap.value = t.map ? 1 : 0), t.useMap !== void 0 && (this.uniforms.useMap.value = t.useMap), t.dashOffset !== void 0 && (this.uniforms.dashOffset.value = t.dashOffset), t.dashArray !== void 0 && (this.uniforms.dashArray.value = t.dashArray, this.uniforms.useDash.value = t.dashArray > 0 ? 1 : 0), t.dashRatio !== void 0 && (this.uniforms.dashRatio.value = t.dashRatio), t.sizeAttenuation !== void 0 && (this.uniforms.sizeAttenuation.value = t.sizeAttenuation ? 1 : 0), t.offset !== void 0 && (this.uniforms.offset.value = t.offset), t.offsetLoop !== void 0 && (this.uniforms.offsetLoop.value = t.offsetLoop ? 1 : 0), t.lineWidth !== void 0 && (this.uniforms.lineWidth.value = t.lineWidth), t.scaleDown !== void 0 && (this.uniforms.scaleDown.value = t.scaleDown / 10), t.alphaMap !== void 0 && (this.uniforms.alphaMap.value = t.alphaMap, this.uniforms.useAlphaMap.value = t.alphaMap ? 1 : 0), t.resolution !== void 0 && (this.uniforms.resolution.value = t.resolution), t.repeat !== void 0 && (this.uniforms.repeat.value = t.repeat), t.alphaTest !== void 0 && (this.uniforms.alphaTest.value = t.alphaTest);
|
|
861
714
|
}
|
|
862
715
|
}
|
|
863
|
-
function
|
|
864
|
-
return
|
|
716
|
+
function de(n, t) {
|
|
717
|
+
return n.map((e) => {
|
|
865
718
|
const i = [];
|
|
866
719
|
let s;
|
|
867
|
-
return e.forEach((
|
|
720
|
+
return e.forEach((a) => {
|
|
868
721
|
if (s) {
|
|
869
|
-
const
|
|
870
|
-
if (
|
|
871
|
-
const
|
|
872
|
-
let
|
|
873
|
-
for (;
|
|
874
|
-
i.push(
|
|
722
|
+
const l = Ft(a, s) * 180 / Math.PI;
|
|
723
|
+
if (l > t) {
|
|
724
|
+
const o = qt(s, a), c = 1 / Math.ceil(l / t);
|
|
725
|
+
let r = c;
|
|
726
|
+
for (; r < 1; )
|
|
727
|
+
i.push(o(r)), r += c;
|
|
875
728
|
}
|
|
876
729
|
}
|
|
877
|
-
i.push(s =
|
|
730
|
+
i.push(s = a);
|
|
878
731
|
}), i;
|
|
879
732
|
});
|
|
880
733
|
}
|
|
881
|
-
function
|
|
882
|
-
const
|
|
883
|
-
s !== void 0 ? Math.ceil(
|
|
884
|
-
i !== void 0 ? Math.floor(
|
|
885
|
-
],
|
|
886
|
-
for (let
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
}
|
|
890
|
-
return
|
|
734
|
+
function he(n, { minLng: t, maxLng: e, minLat: i, maxLat: s } = {}) {
|
|
735
|
+
const a = Math.round(nt(360 / n, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, o = (u) => u / l * 360 % 360 - 180, c = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, r = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, h = [
|
|
736
|
+
s !== void 0 ? Math.ceil(r(s)) : 0,
|
|
737
|
+
i !== void 0 ? Math.floor(r(i)) : a - 1
|
|
738
|
+
], f = t === void 0 && e === void 0 ? () => !0 : t === void 0 ? (u) => u <= e : e === void 0 ? (u) => u >= t : e >= t ? (u) => u >= t && u <= e : (u) => u >= t || u <= e, p = [];
|
|
739
|
+
for (let u = h[0]; u <= h[1]; u++) {
|
|
740
|
+
const m = o(u);
|
|
741
|
+
f(m) && p.push([m, c(u)]);
|
|
742
|
+
}
|
|
743
|
+
return p;
|
|
891
744
|
}
|
|
892
|
-
function
|
|
893
|
-
return e ?
|
|
745
|
+
function Z(n, t, e = !1) {
|
|
746
|
+
return e ? $t(t, n) : Ht(n, t);
|
|
894
747
|
}
|
|
895
|
-
function
|
|
896
|
-
const e = { type: "Polygon", coordinates:
|
|
897
|
-
if (Math.min(Math.abs(
|
|
748
|
+
function pe(n, t) {
|
|
749
|
+
const e = { type: "Polygon", coordinates: n }, [[i, s], [a, l]] = At(e);
|
|
750
|
+
if (Math.min(Math.abs(a - i), Math.abs(l - s)) < t)
|
|
898
751
|
return [];
|
|
899
|
-
const
|
|
900
|
-
return
|
|
752
|
+
const o = i > a || l >= 89 || s <= -89;
|
|
753
|
+
return he(t, {
|
|
901
754
|
minLng: i,
|
|
902
|
-
maxLng:
|
|
755
|
+
maxLng: a,
|
|
903
756
|
minLat: s,
|
|
904
|
-
maxLat:
|
|
757
|
+
maxLat: l
|
|
905
758
|
}).filter(
|
|
906
|
-
(
|
|
759
|
+
(c) => Z(c, e, o)
|
|
907
760
|
);
|
|
908
761
|
}
|
|
909
|
-
function
|
|
910
|
-
const s =
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
let
|
|
914
|
-
if (
|
|
915
|
-
const
|
|
916
|
-
|
|
762
|
+
function me(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
763
|
+
const s = de(n, t), a = tt(s), l = pe(n, t), o = [...a, ...l], c = { type: "Polygon", coordinates: n }, [[r, h], [f, p]] = At(c), u = r > f || // crosses antimeridian
|
|
764
|
+
p >= 89 || // crosses north pole
|
|
765
|
+
h <= -89;
|
|
766
|
+
let m = [];
|
|
767
|
+
if (u) {
|
|
768
|
+
const y = te(o).triangles(), x = new Map(
|
|
769
|
+
o.map(([C, P], L) => [`${C}-${P}`, L])
|
|
917
770
|
);
|
|
918
|
-
|
|
919
|
-
const
|
|
920
|
-
if (
|
|
921
|
-
const
|
|
922
|
-
|
|
771
|
+
y.features.forEach((C) => {
|
|
772
|
+
const P = C.geometry.coordinates[0].slice(0, 3).reverse(), L = [];
|
|
773
|
+
if (P.forEach(([I, F]) => {
|
|
774
|
+
const V = `${I}-${F}`;
|
|
775
|
+
x.has(V) && L.push(x.get(V));
|
|
923
776
|
}), L.length === 3) {
|
|
924
|
-
if (L.some((
|
|
925
|
-
const
|
|
926
|
-
if (!
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
777
|
+
if (L.some((I) => I < a.length)) {
|
|
778
|
+
const I = C.properties.circumcenter;
|
|
779
|
+
if (!Z(
|
|
780
|
+
I,
|
|
781
|
+
c,
|
|
782
|
+
u
|
|
930
783
|
))
|
|
931
784
|
return;
|
|
932
785
|
}
|
|
933
|
-
|
|
786
|
+
m.push(...L);
|
|
934
787
|
}
|
|
935
788
|
});
|
|
936
|
-
} else if (
|
|
937
|
-
const
|
|
938
|
-
for (let
|
|
939
|
-
const
|
|
940
|
-
if (
|
|
941
|
-
const
|
|
942
|
-
(
|
|
789
|
+
} else if (l.length) {
|
|
790
|
+
const y = Jt.from(o);
|
|
791
|
+
for (let x = 0, C = y.triangles.length; x < C; x += 3) {
|
|
792
|
+
const P = [2, 1, 0].map((I) => y.triangles[x + I]), L = P.map((I) => o[I]);
|
|
793
|
+
if (P.some((I) => I < a.length)) {
|
|
794
|
+
const I = [0, 1].map(
|
|
795
|
+
(F) => Xt(L, (V) => V[F])
|
|
943
796
|
);
|
|
944
|
-
if (!
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
797
|
+
if (!Z(
|
|
798
|
+
I,
|
|
799
|
+
c,
|
|
800
|
+
u
|
|
948
801
|
))
|
|
949
802
|
continue;
|
|
950
803
|
}
|
|
951
|
-
|
|
804
|
+
m.push(...P);
|
|
952
805
|
}
|
|
953
806
|
} else {
|
|
954
|
-
const { vertices:
|
|
955
|
-
|
|
807
|
+
const { vertices: y, holes: x = [] } = Ct(s);
|
|
808
|
+
m = Yt(y, x, 2);
|
|
956
809
|
}
|
|
957
|
-
let
|
|
810
|
+
let d = e ? [e[0], e[2]] : ht(o, (y) => y[0]), v = e ? [e[1], e[3]] : ht(o, (y) => y[1]);
|
|
958
811
|
if (i) {
|
|
959
|
-
const [
|
|
960
|
-
|
|
812
|
+
const [y, x] = i([d[0], v[0]]), [C, P] = i([d[1], v[1]]);
|
|
813
|
+
d = [y, C], v = [-x, -P];
|
|
961
814
|
}
|
|
962
|
-
const w =
|
|
815
|
+
const w = pt(d, [0, 1]), S = pt(v, [0, 1]), j = o.map(([y, x]) => {
|
|
963
816
|
if (i) {
|
|
964
|
-
const [
|
|
965
|
-
return [w(
|
|
817
|
+
const [C, P] = i([y, x]);
|
|
818
|
+
return [w(C), S(-P)];
|
|
966
819
|
} else
|
|
967
|
-
return [w(
|
|
820
|
+
return [w(y), S(x)];
|
|
968
821
|
});
|
|
969
|
-
return { contour: s, triangles: { points:
|
|
822
|
+
return { contour: s, triangles: { points: o, indices: m, uvs: j } };
|
|
970
823
|
}
|
|
971
|
-
const
|
|
972
|
-
function
|
|
973
|
-
const s =
|
|
974
|
-
(
|
|
824
|
+
const Mt = new J().setAttribute ? "setAttribute" : "addAttribute";
|
|
825
|
+
function $(n, t, e, i) {
|
|
826
|
+
const s = n.map(
|
|
827
|
+
(a) => a.map(([l, o]) => {
|
|
975
828
|
if (i) {
|
|
976
|
-
const [
|
|
977
|
-
return [
|
|
829
|
+
const [c, r] = i([l, o]);
|
|
830
|
+
return [c, -r, t];
|
|
978
831
|
}
|
|
979
|
-
return e ?
|
|
832
|
+
return e ? Kt(l, o, t) : [l, o, t];
|
|
980
833
|
})
|
|
981
834
|
);
|
|
982
|
-
return
|
|
835
|
+
return Ct(s);
|
|
983
836
|
}
|
|
984
|
-
function
|
|
985
|
-
const { vertices:
|
|
986
|
-
|
|
837
|
+
function ve(n, t, e, i, s) {
|
|
838
|
+
const { vertices: a, holes: l } = $(
|
|
839
|
+
n,
|
|
987
840
|
t,
|
|
988
841
|
i,
|
|
989
842
|
s
|
|
990
|
-
), { vertices:
|
|
991
|
-
|
|
843
|
+
), { vertices: o } = $(
|
|
844
|
+
n,
|
|
992
845
|
e,
|
|
993
846
|
i,
|
|
994
847
|
s
|
|
995
|
-
),
|
|
996
|
-
let
|
|
997
|
-
const
|
|
998
|
-
for (let
|
|
999
|
-
let
|
|
1000
|
-
if (
|
|
1001
|
-
|
|
1002
|
-
else if (
|
|
1003
|
-
const
|
|
1004
|
-
|
|
848
|
+
), c = tt([o, a]), r = Math.round(o.length / 3), h = new Set(l);
|
|
849
|
+
let f = 0;
|
|
850
|
+
const p = [];
|
|
851
|
+
for (let m = 0; m < r; m++) {
|
|
852
|
+
let d = m + 1;
|
|
853
|
+
if (d === r)
|
|
854
|
+
d = f;
|
|
855
|
+
else if (h.has(d)) {
|
|
856
|
+
const v = d;
|
|
857
|
+
d = f, f = v;
|
|
1005
858
|
}
|
|
1006
|
-
|
|
859
|
+
p.push(m, m + r, d + r), p.push(d + r, d, m);
|
|
1007
860
|
}
|
|
1008
|
-
const
|
|
1009
|
-
for (let
|
|
1010
|
-
for (let
|
|
1011
|
-
return { indices:
|
|
861
|
+
const u = [];
|
|
862
|
+
for (let m = 1; m >= 0; m--)
|
|
863
|
+
for (let d = 0; d < r; d += 1) u.push(d / (r - 1), m);
|
|
864
|
+
return { indices: p, vertices: c, uvs: u, topVerts: o };
|
|
1012
865
|
}
|
|
1013
|
-
function
|
|
866
|
+
function xt(n, t, e, i, s, a) {
|
|
1014
867
|
return {
|
|
1015
|
-
indices: i ?
|
|
1016
|
-
vertices:
|
|
1017
|
-
[
|
|
868
|
+
indices: i ? n.indices : n.indices.slice().reverse(),
|
|
869
|
+
vertices: $(
|
|
870
|
+
[n.points],
|
|
1018
871
|
t,
|
|
1019
872
|
s,
|
|
1020
|
-
|
|
873
|
+
a
|
|
1021
874
|
).vertices,
|
|
1022
875
|
uvs: e
|
|
1023
876
|
};
|
|
1024
877
|
}
|
|
1025
|
-
const
|
|
1026
|
-
polygonGeoJson:
|
|
878
|
+
const ye = ({
|
|
879
|
+
polygonGeoJson: n,
|
|
1027
880
|
startHeight: t,
|
|
1028
881
|
endHeight: e,
|
|
1029
882
|
curvatureResolution: i = 1,
|
|
1030
883
|
cartesian: s = !0,
|
|
1031
|
-
hasSide:
|
|
1032
|
-
hasBottom:
|
|
1033
|
-
hasTop:
|
|
1034
|
-
projection:
|
|
1035
|
-
bbox:
|
|
884
|
+
hasSide: a = !0,
|
|
885
|
+
hasBottom: l = !1,
|
|
886
|
+
hasTop: o = !1,
|
|
887
|
+
projection: c,
|
|
888
|
+
bbox: r
|
|
1036
889
|
}) => {
|
|
1037
|
-
|
|
1038
|
-
|
|
890
|
+
n.forEach((w) => {
|
|
891
|
+
Zt(w) || w.reverse();
|
|
1039
892
|
});
|
|
1040
|
-
const { contour:
|
|
893
|
+
const { contour: h, triangles: f } = me(n, {
|
|
1041
894
|
resolution: i,
|
|
1042
|
-
bbox:
|
|
1043
|
-
projection:
|
|
895
|
+
bbox: r,
|
|
896
|
+
projection: c
|
|
1044
897
|
});
|
|
1045
|
-
let
|
|
1046
|
-
|
|
1047
|
-
|
|
898
|
+
let p = {}, u;
|
|
899
|
+
a && (p = ve(
|
|
900
|
+
h,
|
|
1048
901
|
t != null ? t : e,
|
|
1049
902
|
e != null ? e : t,
|
|
1050
903
|
s,
|
|
1051
|
-
|
|
1052
|
-
),
|
|
1053
|
-
let
|
|
1054
|
-
(
|
|
1055
|
-
let
|
|
1056
|
-
|
|
1057
|
-
u,
|
|
1058
|
-
t,
|
|
904
|
+
c
|
|
905
|
+
), u = p.topVerts);
|
|
906
|
+
let m = [];
|
|
907
|
+
(l || o) && (m = tt(f.uvs));
|
|
908
|
+
let d = {};
|
|
909
|
+
l && (d = xt(
|
|
1059
910
|
f,
|
|
911
|
+
t,
|
|
912
|
+
m,
|
|
1060
913
|
!1,
|
|
1061
914
|
s,
|
|
1062
|
-
|
|
915
|
+
c
|
|
1063
916
|
));
|
|
1064
|
-
let
|
|
1065
|
-
return
|
|
1066
|
-
u,
|
|
1067
|
-
e,
|
|
917
|
+
let v = {};
|
|
918
|
+
return o && (v = xt(
|
|
1068
919
|
f,
|
|
920
|
+
e,
|
|
921
|
+
m,
|
|
1069
922
|
!0,
|
|
1070
923
|
s,
|
|
1071
|
-
|
|
1072
|
-
)), { contour:
|
|
924
|
+
c
|
|
925
|
+
)), { contour: h, triangles: f, sideTorso: p, bottomCap: d, topCap: v, topVerts: u };
|
|
1073
926
|
};
|
|
1074
|
-
class
|
|
927
|
+
class Ve extends J {
|
|
1075
928
|
constructor(t, e = {}) {
|
|
1076
|
-
super(), this.type = "PolygonBufferGeometry", this.parameters =
|
|
929
|
+
super(), this.type = "PolygonBufferGeometry", this.parameters = E({
|
|
1077
930
|
polygonGeoJson: t,
|
|
1078
931
|
startHeight: 0,
|
|
1079
932
|
endHeight: 1,
|
|
@@ -1088,34 +941,35 @@ class Be extends H {
|
|
|
1088
941
|
const {
|
|
1089
942
|
endHeight: i,
|
|
1090
943
|
hasTop: s,
|
|
1091
|
-
topFirst:
|
|
1092
|
-
hasBottom:
|
|
1093
|
-
hasSide:
|
|
1094
|
-
cartesian:
|
|
1095
|
-
userDataRsoOffset:
|
|
1096
|
-
projection:
|
|
1097
|
-
} = this.parameters, { contour:
|
|
1098
|
-
let
|
|
1099
|
-
const
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
), this.addGroup(
|
|
944
|
+
topFirst: a,
|
|
945
|
+
hasBottom: l,
|
|
946
|
+
hasSide: o,
|
|
947
|
+
cartesian: c,
|
|
948
|
+
userDataRsoOffset: r,
|
|
949
|
+
projection: h
|
|
950
|
+
} = this.parameters, { contour: f, sideTorso: p, topVerts: u, bottomCap: m, topCap: d } = ye(E({}, this.parameters));
|
|
951
|
+
let v = [], w = [], S = [], j = 0;
|
|
952
|
+
const A = (y) => {
|
|
953
|
+
const x = Math.round(v.length / 3), C = S.length;
|
|
954
|
+
v = v.concat(y.vertices), w = w.concat(y.uvs), S = S.concat(
|
|
955
|
+
x ? y.indices.map((P) => P + x) : y.indices
|
|
956
|
+
), this.addGroup(C, S.length - C, j++);
|
|
1104
957
|
};
|
|
1105
|
-
s &&
|
|
1106
|
-
|
|
1107
|
-
i +
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
).vertices :
|
|
958
|
+
s && a && A(d), o && (A(p), this.userData.topVerts = r ? $(
|
|
959
|
+
f,
|
|
960
|
+
i + r,
|
|
961
|
+
c,
|
|
962
|
+
h
|
|
963
|
+
).vertices : u), l && A(m), s && !a && A(d), this.setIndex(S), this[Mt]("position", new G(v, 3)), this[Mt]("uv", new G(w, 2)), this.computeVertexNormals();
|
|
1111
964
|
}
|
|
1112
965
|
}
|
|
1113
966
|
export {
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
967
|
+
Le as B,
|
|
968
|
+
_e as I,
|
|
969
|
+
Ee as L,
|
|
970
|
+
Oe as M,
|
|
971
|
+
Ve as P,
|
|
972
|
+
se as R,
|
|
973
|
+
mt as a,
|
|
974
|
+
ye as g
|
|
1121
975
|
};
|