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