gl-draw 0.16.0-beta.8 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/WebGPULineSegments2.js +3 -3
- package/dist/WebGPULineSegments2.module.js +407 -399
- package/dist/core/BaseObject/index.d.ts +4 -0
- package/dist/core/Lead/Lead.d.ts +17 -11
- package/dist/index.js +2 -2
- package/dist/index.module.js +557 -540
- package/package.json +1 -1
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, $ = (
|
|
13
|
-
var
|
|
14
|
-
var
|
|
15
|
-
for (var i in
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var i of
|
|
19
|
-
|
|
20
|
-
return
|
|
1
|
+
var Ce = Object.defineProperty, Ie = Object.defineProperties;
|
|
2
|
+
var Pe = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var V = Object.getOwnPropertySymbols;
|
|
4
|
+
var te = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var ne = Math.pow, ee = (s, e, t) => e in s ? Ce(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, k = (s, e) => {
|
|
6
|
+
for (var t in e || (e = {}))
|
|
7
|
+
te.call(e, t) && ee(s, t, e[t]);
|
|
8
|
+
if (V)
|
|
9
|
+
for (var t of V(e))
|
|
10
|
+
ie.call(e, t) && ee(s, t, e[t]);
|
|
11
|
+
return s;
|
|
12
|
+
}, $ = (s, e) => Ie(s, Pe(e));
|
|
13
|
+
var se = (s, e) => {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var i in s)
|
|
16
|
+
te.call(s, i) && e.indexOf(i) < 0 && (t[i] = s[i]);
|
|
17
|
+
if (s != null && V)
|
|
18
|
+
for (var i of V(s))
|
|
19
|
+
e.indexOf(i) < 0 && ie.call(s, i) && (t[i] = s[i]);
|
|
20
|
+
return t;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
22
|
+
var re = (s, e, t) => new Promise((i, n) => {
|
|
23
23
|
var a = (o) => {
|
|
24
24
|
try {
|
|
25
|
-
r(
|
|
25
|
+
r(t.next(o));
|
|
26
26
|
} catch (c) {
|
|
27
|
-
|
|
27
|
+
n(c);
|
|
28
28
|
}
|
|
29
29
|
}, l = (o) => {
|
|
30
30
|
try {
|
|
31
|
-
r(
|
|
31
|
+
r(t.throw(o));
|
|
32
32
|
} catch (c) {
|
|
33
|
-
|
|
33
|
+
n(c);
|
|
34
34
|
}
|
|
35
35
|
}, r = (o) => o.done ? i(o.value) : Promise.resolve(o.value).then(a, l);
|
|
36
|
-
r((
|
|
36
|
+
r((t = t.apply(s, e)).next());
|
|
37
37
|
});
|
|
38
|
-
import { Material as
|
|
39
|
-
import { CSS2DObject as
|
|
40
|
-
import { CSS3DObject as
|
|
41
|
-
import { geoBounds as
|
|
38
|
+
import { Material as ae, Object3D as N, Texture as oe, BufferGeometry as Z, Float32BufferAttribute as R, PointsMaterial as Be, Points as J, InstancedMesh as xe, Vector3 as P, Quaternion as De, Group as Te, Mesh as we, Sprite as ce, Box3 as Se, ShaderMaterial as ze, Vector2 as q, Color as le, Vector4 as E, Matrix4 as Oe, Line3 as _e, Sphere as ke, InstancedInterleavedBuffer as Ee, InterleavedBufferAttribute as ue, MathUtils as Le } from "three";
|
|
39
|
+
import { CSS2DObject as Ve } from "three/examples/jsm/renderers/CSS2DRenderer";
|
|
40
|
+
import { CSS3DObject as Ue, CSS3DSprite as We } from "three/examples/jsm/renderers/CSS3DRenderer";
|
|
41
|
+
import { geoBounds as je, geoContains as Ne, geoDistance as Re, geoInterpolate as Ge } from "d3-geo";
|
|
42
42
|
import "d3-geo-projection";
|
|
43
|
-
import { p as
|
|
44
|
-
import { merge as H, mean as $
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import { geoVoronoi as
|
|
50
|
-
import { scaleLinear as
|
|
51
|
-
import { LineSegmentsGeometry as
|
|
52
|
-
const
|
|
53
|
-
class
|
|
43
|
+
import { p as fe, a as Fe } from "./polar2Cartesian.module.js";
|
|
44
|
+
import { merge as H, mean as $e, extent as de } from "d3-array";
|
|
45
|
+
import qe, { flatten as Ae } from "earcut";
|
|
46
|
+
import Ke from "@turf/boolean-clockwise";
|
|
47
|
+
import Qe from "delaunator";
|
|
48
|
+
import Xe from "@turf/boolean-point-in-polygon";
|
|
49
|
+
import { geoVoronoi as Ye } from "d3-geo-voronoi";
|
|
50
|
+
import { scaleLinear as he } from "d3-scale";
|
|
51
|
+
import { LineSegmentsGeometry as Ze } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
52
|
+
const Je = 0, Dt = 1, He = 2, Tt = !1;
|
|
53
|
+
class et {
|
|
54
54
|
constructor() {
|
|
55
55
|
this.resources = /* @__PURE__ */ new Set(), this.disposeMaterial = !0, this.disposeVideo = !0;
|
|
56
56
|
}
|
|
57
|
-
track(
|
|
58
|
-
if (!
|
|
59
|
-
return
|
|
60
|
-
if (Array.isArray(
|
|
61
|
-
return
|
|
62
|
-
if (!this.disposeMaterial &&
|
|
63
|
-
return
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}), this.track(
|
|
68
|
-
else if (
|
|
69
|
-
const
|
|
70
|
-
this.track(
|
|
71
|
-
} else if (
|
|
72
|
-
for (const i of Object.values(
|
|
73
|
-
i instanceof
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
for (const i of Object.values(
|
|
57
|
+
track(e) {
|
|
58
|
+
if (!e)
|
|
59
|
+
return e;
|
|
60
|
+
if (Array.isArray(e))
|
|
61
|
+
return e.forEach((t) => this.track(t)), e;
|
|
62
|
+
if (!this.disposeMaterial && e instanceof ae)
|
|
63
|
+
return e;
|
|
64
|
+
if (e instanceof pe ? (e.disposeTrack && e.object3d ? this.track(e.object3d) : this.resources.add(e), Object.values(e.materialList).map((t) => this.track(t))) : (e instanceof N || Reflect.has(e, "dispose")) && this.resources.add(e), e instanceof pe)
|
|
65
|
+
e.children.forEach((t) => {
|
|
66
|
+
t.disposeTrack = !1;
|
|
67
|
+
}), this.track(e.children);
|
|
68
|
+
else if (e instanceof N) {
|
|
69
|
+
const t = e;
|
|
70
|
+
this.track(t.geometry), this.track(t.material), this.track(t.children);
|
|
71
|
+
} else if (e instanceof ae) {
|
|
72
|
+
for (const i of Object.values(e))
|
|
73
|
+
i instanceof oe && this.track(i);
|
|
74
|
+
const t = e;
|
|
75
|
+
if (t.uniforms) {
|
|
76
|
+
for (const i of Object.values(t.uniforms))
|
|
77
77
|
if (i) {
|
|
78
|
-
const
|
|
79
|
-
(
|
|
78
|
+
const n = i.value;
|
|
79
|
+
(n instanceof oe || Array.isArray(n)) && this.track(n);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
} else this.disposeVideo &&
|
|
83
|
-
return
|
|
82
|
+
} else this.disposeVideo && e.isVideoTexture && e.source.data && this.resources.add(e.source.data);
|
|
83
|
+
return e;
|
|
84
84
|
}
|
|
85
85
|
dispose() {
|
|
86
|
-
const
|
|
87
|
-
for (const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}),
|
|
86
|
+
const e = [];
|
|
87
|
+
for (const t of this.resources)
|
|
88
|
+
t instanceof N ? e.push(t) : t instanceof HTMLVideoElement && t.pause(), Reflect.has(t, "dispose") && t.dispose();
|
|
89
|
+
e.forEach((t) => {
|
|
90
|
+
t.removeFromParent();
|
|
91
|
+
}), e.length = 0, this.resources.clear();
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
const
|
|
95
|
-
const
|
|
96
|
-
|
|
94
|
+
const tt = (s, e = 1) => {
|
|
95
|
+
const t = new Z();
|
|
96
|
+
t.setAttribute(
|
|
97
97
|
"position",
|
|
98
|
-
new R(new Array(
|
|
99
|
-
),
|
|
98
|
+
new R(new Array(e * 3).fill(0), 3)
|
|
99
|
+
), t.setAttribute(
|
|
100
100
|
"scaleAtt",
|
|
101
|
-
new R(new Array(
|
|
101
|
+
new R(new Array(e).fill(1), 1)
|
|
102
102
|
);
|
|
103
|
-
const i =
|
|
103
|
+
const i = s.material, n = new Be({
|
|
104
104
|
size: 10,
|
|
105
105
|
map: i.map,
|
|
106
106
|
alphaMap: i.alphaMap,
|
|
@@ -113,7 +113,7 @@ const ee = (n, t = 1) => {
|
|
|
113
113
|
alphaTest: i.alphaTest,
|
|
114
114
|
sizeAttenuation: !1
|
|
115
115
|
});
|
|
116
|
-
return
|
|
116
|
+
return n.onBeforeCompile = (a) => {
|
|
117
117
|
a.vertexShader = `
|
|
118
118
|
attribute float scaleAtt;
|
|
119
119
|
${a.vertexShader.replace(
|
|
@@ -121,99 +121,99 @@ const ee = (n, t = 1) => {
|
|
|
121
121
|
"gl_PointSize = size * scaleAtt;"
|
|
122
122
|
)}
|
|
123
123
|
`;
|
|
124
|
-
}, new J(
|
|
125
|
-
},
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
const a =
|
|
129
|
-
|
|
130
|
-
const r =
|
|
131
|
-
if (
|
|
132
|
-
|
|
133
|
-
else if (
|
|
134
|
-
const c =
|
|
124
|
+
}, new J(t, n);
|
|
125
|
+
}, it = (s, e) => {
|
|
126
|
+
const t = new N();
|
|
127
|
+
e.forEach((i, n) => {
|
|
128
|
+
const a = fe(i.position), l = fe(i.scale || [1, 1, 1]);
|
|
129
|
+
t.position.copy(a), t.scale.copy(l), t.updateMatrix();
|
|
130
|
+
const r = t.matrix.clone();
|
|
131
|
+
if (s instanceof xe || s.isInstantiate)
|
|
132
|
+
s.setMatrixAt(n, r);
|
|
133
|
+
else if (s instanceof J || s.type === "Points") {
|
|
134
|
+
const c = s.geometry, f = c.attributes.position.array, d = c.attributes.scaleAtt.array, h = new P(), u = new P(), m = new De(), p = n * 3, v = n * 1;
|
|
135
135
|
r.decompose(h, m, u), f[p] = h.x, f[p + 1] = h.y, f[p + 2] = h.z, d[v] = Math.max(u.x, u.y, u.z), c.attributes.position.needsUpdate = !0, c.attributes.scaleAtt.needsUpdate = !0;
|
|
136
136
|
}
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
-
class
|
|
139
|
+
class nt {
|
|
140
140
|
constructor() {
|
|
141
141
|
this.onPointerIndex = [];
|
|
142
142
|
}
|
|
143
|
-
onPointerEvent(
|
|
144
|
-
const i = this.lead.handlePick([this],
|
|
143
|
+
onPointerEvent(e, t) {
|
|
144
|
+
const i = this.lead.handlePick([this], e, t);
|
|
145
145
|
this.onPointerIndex.push(i);
|
|
146
146
|
}
|
|
147
|
-
onClick(
|
|
148
|
-
this.onPointerEvent("click",
|
|
147
|
+
onClick(e) {
|
|
148
|
+
this.onPointerEvent("click", e);
|
|
149
149
|
}
|
|
150
|
-
onPointerEnter(
|
|
151
|
-
this.onPointerEvent("enter",
|
|
150
|
+
onPointerEnter(e) {
|
|
151
|
+
this.onPointerEvent("enter", e);
|
|
152
152
|
}
|
|
153
|
-
onPointerLeave(
|
|
154
|
-
this.onPointerEvent("leave",
|
|
153
|
+
onPointerLeave(e) {
|
|
154
|
+
this.onPointerEvent("leave", e);
|
|
155
155
|
}
|
|
156
|
-
onPointerMove(
|
|
157
|
-
this.onPointerEvent("move",
|
|
156
|
+
onPointerMove(e) {
|
|
157
|
+
this.onPointerEvent("move", e);
|
|
158
158
|
}
|
|
159
|
-
onPointerDown(
|
|
160
|
-
this.onPointerEvent("down",
|
|
159
|
+
onPointerDown(e) {
|
|
160
|
+
this.onPointerEvent("down", e);
|
|
161
161
|
}
|
|
162
162
|
dispose() {
|
|
163
|
-
this.onPointerIndex.forEach((
|
|
164
|
-
this.lead.removePick(
|
|
163
|
+
this.onPointerIndex.forEach((e) => {
|
|
164
|
+
this.lead.removePick(e);
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
class
|
|
168
|
+
class st extends nt {
|
|
169
169
|
constructor() {
|
|
170
170
|
super(...arguments), this.userData = {}, this.materialList = {}, this.useMaterialType = "origin", this.disposeMaterialIfNotUsed = !0;
|
|
171
171
|
}
|
|
172
172
|
cloneMaterial() {
|
|
173
|
-
const
|
|
174
|
-
if (!
|
|
173
|
+
const e = this.object3d;
|
|
174
|
+
if (!e || !e.material)
|
|
175
175
|
return;
|
|
176
|
-
const
|
|
177
|
-
if (Array.isArray(
|
|
178
|
-
return
|
|
179
|
-
const
|
|
176
|
+
const t = e.material;
|
|
177
|
+
if (Array.isArray(t))
|
|
178
|
+
return t.map((i) => {
|
|
179
|
+
const n = i.userData;
|
|
180
180
|
i.userData = {};
|
|
181
181
|
const a = i.clone();
|
|
182
|
-
return i.userData =
|
|
182
|
+
return i.userData = n, a;
|
|
183
183
|
});
|
|
184
184
|
{
|
|
185
|
-
const i =
|
|
186
|
-
|
|
187
|
-
const
|
|
188
|
-
return
|
|
185
|
+
const i = t.userData;
|
|
186
|
+
t.userData = {};
|
|
187
|
+
const n = t.clone();
|
|
188
|
+
return t.userData = i, n;
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
setMaterialList(
|
|
191
|
+
setMaterialList(e, t) {
|
|
192
192
|
const i = this.object3d;
|
|
193
193
|
if (!i || !i.material)
|
|
194
194
|
return;
|
|
195
195
|
this.materialList.origin || (this.materialList.origin = i.material);
|
|
196
|
-
const
|
|
197
|
-
return this.materialList[
|
|
196
|
+
const n = t === "clone" ? this.cloneMaterial() : Array.isArray(t) ? t.slice() : t;
|
|
197
|
+
return this.materialList[e] = n, n;
|
|
198
198
|
}
|
|
199
|
-
useMaterial(
|
|
200
|
-
const
|
|
201
|
-
!
|
|
199
|
+
useMaterial(e) {
|
|
200
|
+
const t = this.object3d;
|
|
201
|
+
!t || !t.material || this.useMaterialType === e || !this.materialList[e] || (this.useMaterialType = e, t.material = this.materialList[e]);
|
|
202
202
|
}
|
|
203
|
-
useMListById(
|
|
203
|
+
useMListById(e, t) {
|
|
204
204
|
if (!this.mList)
|
|
205
205
|
return;
|
|
206
|
-
const i = this.mList.get(
|
|
206
|
+
const i = this.mList.get(e);
|
|
207
207
|
if (!i)
|
|
208
208
|
return;
|
|
209
|
-
const
|
|
210
|
-
Array.isArray(
|
|
209
|
+
const n = this.object3d;
|
|
210
|
+
Array.isArray(n.material) && t !== void 0 ? n.material[t] = i : n.material = i;
|
|
211
211
|
}
|
|
212
|
-
useMListByName(
|
|
212
|
+
useMListByName(e, t) {
|
|
213
213
|
if (!this.mList)
|
|
214
214
|
return;
|
|
215
|
-
const i = this.mList.getKeyByName(
|
|
216
|
-
i && this.useMListById(i,
|
|
215
|
+
const i = this.mList.getKeyByName(e);
|
|
216
|
+
i && this.useMListById(i, t);
|
|
217
217
|
}
|
|
218
218
|
dispose() {
|
|
219
219
|
super.dispose(), this.mList.rmBaseObjectMap(
|
|
@@ -223,16 +223,16 @@ class ne extends se {
|
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class pe extends st {
|
|
227
227
|
constructor() {
|
|
228
|
-
super(...arguments), this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0;
|
|
228
|
+
super(...arguments), this.key = "", this.objectType = "BaseObject", this.userData = {}, this.isPrefab = !1, this.isInstantiate = !1, this.isBloom = !1, this.isBaseObject = !0, this.disposeTrack = !0;
|
|
229
229
|
}
|
|
230
230
|
get parent() {
|
|
231
|
-
const
|
|
232
|
-
return
|
|
231
|
+
const e = this.object3d.parent;
|
|
232
|
+
return e && this.lead.objMap.get(e) || null;
|
|
233
233
|
}
|
|
234
234
|
get children() {
|
|
235
|
-
return this.object3d.children.map((
|
|
235
|
+
return this.object3d.children.map((e) => this.lead.objMap.get(e)).filter((e) => !!e);
|
|
236
236
|
}
|
|
237
237
|
get position() {
|
|
238
238
|
return this.object3d.position;
|
|
@@ -246,17 +246,17 @@ class pt extends ne {
|
|
|
246
246
|
get lookAt() {
|
|
247
247
|
return this.object3d.lookAt;
|
|
248
248
|
}
|
|
249
|
-
add(...
|
|
250
|
-
[...
|
|
251
|
-
this.lead.objMap.get(
|
|
249
|
+
add(...e) {
|
|
250
|
+
[...e].forEach((t) => {
|
|
251
|
+
this.lead.objMap.get(t) ? this.object3d.add(t) : this.lead.createBaseObject(t, {
|
|
252
252
|
target: this
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
|
-
remove(...
|
|
257
|
-
[...
|
|
256
|
+
remove(...e) {
|
|
257
|
+
[...e].forEach((t) => {
|
|
258
258
|
var i;
|
|
259
|
-
this.lead.objMap.get(
|
|
259
|
+
this.lead.objMap.get(t) ? (i = this.lead.objMap.get(t)) == null || i.erase() : this.object3d.remove(t);
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
get visible() {
|
|
@@ -264,11 +264,11 @@ class pt extends ne {
|
|
|
264
264
|
}
|
|
265
265
|
get visibleWithAncestors() {
|
|
266
266
|
if (this.visible) {
|
|
267
|
-
let
|
|
268
|
-
for (;
|
|
269
|
-
if (!
|
|
267
|
+
let e = this.parent;
|
|
268
|
+
for (; e; ) {
|
|
269
|
+
if (!e.visible)
|
|
270
270
|
return !1;
|
|
271
|
-
|
|
271
|
+
e = e.parent;
|
|
272
272
|
}
|
|
273
273
|
return !0;
|
|
274
274
|
} else
|
|
@@ -279,90 +279,98 @@ class pt extends ne {
|
|
|
279
279
|
}
|
|
280
280
|
render() {
|
|
281
281
|
}
|
|
282
|
-
update(
|
|
282
|
+
update(e, t) {
|
|
283
283
|
}
|
|
284
|
-
resize(
|
|
284
|
+
resize(e, t) {
|
|
285
285
|
}
|
|
286
286
|
show() {
|
|
287
|
-
return this.object3d.visible = !0, this.object3d.layers.set(
|
|
287
|
+
return this.object3d.visible = !0, this.object3d.layers.set(Je), this.isBloom && this.enableBloom(), this;
|
|
288
288
|
}
|
|
289
289
|
hide() {
|
|
290
|
-
return this.object3d.visible = !1, this.object3d.layers.set(
|
|
290
|
+
return this.object3d.visible = !1, this.object3d.layers.set(He), this;
|
|
291
291
|
}
|
|
292
292
|
createGroup() {
|
|
293
|
-
return this.object3d = new
|
|
293
|
+
return this.object3d = new Te(), this;
|
|
294
294
|
}
|
|
295
|
-
createMesh(...
|
|
296
|
-
return this.object3d = new
|
|
295
|
+
createMesh(...e) {
|
|
296
|
+
return this.object3d = new we(...e), this;
|
|
297
297
|
}
|
|
298
|
-
createPoints(...
|
|
299
|
-
return this.object3d = new J(...
|
|
298
|
+
createPoints(...e) {
|
|
299
|
+
return this.object3d = new J(...e), this;
|
|
300
300
|
}
|
|
301
|
-
createCSS2DObject(
|
|
302
|
-
return this.object3d = new
|
|
301
|
+
createCSS2DObject(e) {
|
|
302
|
+
return this.object3d = new Ve(e), this;
|
|
303
303
|
}
|
|
304
|
-
createCSS3DObject(
|
|
305
|
-
return this.object3d = new
|
|
304
|
+
createCSS3DObject(e) {
|
|
305
|
+
return this.object3d = new Ue(e), this;
|
|
306
306
|
}
|
|
307
|
-
createCSS3DSprite(
|
|
308
|
-
return this.object3d = new
|
|
307
|
+
createCSS3DSprite(e) {
|
|
308
|
+
return this.object3d = new We(e), this;
|
|
309
309
|
}
|
|
310
|
-
createSprite(
|
|
311
|
-
return this.object3d = new
|
|
310
|
+
createSprite(e) {
|
|
311
|
+
return this.object3d = new ce(e), this;
|
|
312
312
|
}
|
|
313
|
-
attach(...
|
|
314
|
-
return [...
|
|
315
|
-
this.object3d.attach(
|
|
313
|
+
attach(...e) {
|
|
314
|
+
return [...e].forEach((t) => {
|
|
315
|
+
this.object3d.attach(t.object3d);
|
|
316
316
|
}), this;
|
|
317
317
|
}
|
|
318
318
|
getSize() {
|
|
319
|
-
const
|
|
319
|
+
const e = new Se().setFromObject(this.object3d);
|
|
320
320
|
return {
|
|
321
|
-
min:
|
|
322
|
-
max:
|
|
323
|
-
size:
|
|
324
|
-
center:
|
|
321
|
+
min: e.min,
|
|
322
|
+
max: e.max,
|
|
323
|
+
size: e.getSize(new P()),
|
|
324
|
+
center: e.getCenter(new P())
|
|
325
325
|
};
|
|
326
326
|
}
|
|
327
|
-
setTop(
|
|
328
|
-
this.object3d && (this.object3d.renderOrder =
|
|
327
|
+
setTop(e) {
|
|
328
|
+
this.object3d && (this.object3d.renderOrder = e);
|
|
329
329
|
}
|
|
330
|
-
traverse(
|
|
331
|
-
|
|
332
|
-
|
|
330
|
+
traverse(e) {
|
|
331
|
+
e(this), this.children.forEach((t) => {
|
|
332
|
+
t.traverse(e);
|
|
333
333
|
});
|
|
334
334
|
}
|
|
335
|
-
instantiate(
|
|
336
|
-
return
|
|
335
|
+
instantiate(e) {
|
|
336
|
+
return re(this, null, function* () {
|
|
337
337
|
var o, c;
|
|
338
|
-
const
|
|
339
|
-
let l =
|
|
340
|
-
|
|
338
|
+
const t = (o = e == null ? void 0 : e.recursive) != null ? o : !0, i = (c = e == null ? void 0 : e.cloneMaterial) != null ? c : !1, { objectType: n, objectOptions: a } = this;
|
|
339
|
+
let l = e == null ? void 0 : e.create, r;
|
|
340
|
+
return this.objectType === "BaseObject" ? r = this.lead.createBaseObject(this.object3d.clone(!1), {
|
|
341
|
+
target: (e == null ? void 0 : e.target) || this.parent
|
|
342
|
+
}) : (l === void 0 && (l = (f) => {
|
|
341
343
|
var d;
|
|
342
344
|
if (this.object3d) {
|
|
343
|
-
if ((d =
|
|
344
|
-
const h =
|
|
345
|
-
if (this.object3d instanceof
|
|
346
|
-
f.object3d =
|
|
345
|
+
if ((d = e == null ? void 0 : e.instancedAttr) != null && d.length) {
|
|
346
|
+
const h = e.instancedAttr.length;
|
|
347
|
+
if (this.object3d instanceof ce)
|
|
348
|
+
f.object3d = tt(this.object3d, h);
|
|
347
349
|
else {
|
|
348
350
|
const u = this.object3d, m = i ? this.cloneMaterial() : u.material;
|
|
349
|
-
f.object3d = new
|
|
351
|
+
f.object3d = new xe(
|
|
352
|
+
u.geometry,
|
|
353
|
+
m,
|
|
354
|
+
h
|
|
355
|
+
);
|
|
350
356
|
}
|
|
351
|
-
|
|
357
|
+
it(f.object3d, e == null ? void 0 : e.instancedAttr);
|
|
352
358
|
} else
|
|
353
359
|
f.object3d = this.object3d.clone(!1), i && f.object3d.material && (f.object3d.material = this.cloneMaterial());
|
|
354
360
|
f.object3d.userData.prefab && delete f.object3d.userData.prefab;
|
|
355
361
|
}
|
|
356
|
-
})
|
|
357
|
-
const r = yield this.lead.draw(s, $(L({}, a || {}), {
|
|
362
|
+
}), r = yield this.lead.draw(n, $(k({}, a || {}), {
|
|
358
363
|
create: l,
|
|
359
364
|
prefab: !1,
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
365
|
+
keyType: this.keyType,
|
|
366
|
+
key: (e == null ? void 0 : e.key) || this.keyName,
|
|
367
|
+
uId: (e == null ? void 0 : e.uId) || this.keyUId,
|
|
368
|
+
target: (e == null ? void 0 : e.target) || this.parent
|
|
369
|
+
}))), this.isBloom && r.enableBloom(), t && (yield Promise.all(
|
|
364
370
|
this.children.map(
|
|
365
371
|
(f) => f.instantiate({
|
|
372
|
+
key: f.keyUId ? `${f.keyName}-${f.keyUId}` : f.keyName,
|
|
373
|
+
uId: e == null ? void 0 : e.uId,
|
|
366
374
|
cloneMaterial: i,
|
|
367
375
|
target: r
|
|
368
376
|
})
|
|
@@ -373,107 +381,107 @@ class pt extends ne {
|
|
|
373
381
|
erase() {
|
|
374
382
|
this.lead.erase(this);
|
|
375
383
|
}
|
|
376
|
-
handleMaterialChange(
|
|
384
|
+
handleMaterialChange(e) {
|
|
377
385
|
}
|
|
378
386
|
enableBloom() {
|
|
379
|
-
var
|
|
380
|
-
(
|
|
387
|
+
var e;
|
|
388
|
+
(e = this.pencil.composerController) == null || e.setBloomSelection(this, !0), this.isBloom = !0;
|
|
381
389
|
}
|
|
382
390
|
disableBloom() {
|
|
383
|
-
var
|
|
384
|
-
(
|
|
391
|
+
var e;
|
|
392
|
+
(e = this.pencil.composerController) == null || e.setBloomSelection(this, !1), this.isBloom = !1;
|
|
385
393
|
}
|
|
386
394
|
dispose() {
|
|
387
|
-
var
|
|
388
|
-
if (super.dispose(), (
|
|
389
|
-
const
|
|
390
|
-
|
|
395
|
+
var e;
|
|
396
|
+
if (super.dispose(), (e = this.pencil.composerController) == null || e.bloomSelection.delete(this), this.lead && (this.lead.objects.delete(this.key), this.lead.objectWrapChindIdMap.delete(this), this.object3d && this.lead.objMap.delete(this.object3d)), this.disposeTrack) {
|
|
397
|
+
const t = new et();
|
|
398
|
+
t.disposeMaterial = !1, t.track(this), t.dispose();
|
|
391
399
|
}
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
|
-
function
|
|
395
|
-
return
|
|
402
|
+
function rt(s, e) {
|
|
403
|
+
return s.map((t) => {
|
|
396
404
|
const i = [];
|
|
397
|
-
let
|
|
398
|
-
return
|
|
399
|
-
if (
|
|
400
|
-
const l =
|
|
401
|
-
if (l >
|
|
402
|
-
const r =
|
|
405
|
+
let n;
|
|
406
|
+
return t.forEach((a) => {
|
|
407
|
+
if (n) {
|
|
408
|
+
const l = Re(a, n) * 180 / Math.PI;
|
|
409
|
+
if (l > e) {
|
|
410
|
+
const r = Ge(n, a), o = 1 / Math.ceil(l / e);
|
|
403
411
|
let c = o;
|
|
404
412
|
for (; c < 1; )
|
|
405
413
|
i.push(r(c)), c += o;
|
|
406
414
|
}
|
|
407
415
|
}
|
|
408
|
-
i.push(
|
|
416
|
+
i.push(n = a);
|
|
409
417
|
}), i;
|
|
410
418
|
});
|
|
411
419
|
}
|
|
412
|
-
function
|
|
413
|
-
const a = Math.round(
|
|
414
|
-
|
|
420
|
+
function at(s, { minLng: e, maxLng: t, minLat: i, maxLat: n } = {}) {
|
|
421
|
+
const a = Math.round(ne(360 / s, 2) / Math.PI), l = (1 + Math.sqrt(5)) / 2, r = (u) => u / l * 360 % 360 - 180, o = (u) => Math.acos(2 * u / a - 1) / Math.PI * 180 - 90, c = (u) => a * (Math.cos((u + 90) * Math.PI / 180) + 1) / 2, f = [
|
|
422
|
+
n !== void 0 ? Math.ceil(c(n)) : 0,
|
|
415
423
|
i !== void 0 ? Math.floor(c(i)) : a - 1
|
|
416
|
-
], d =
|
|
424
|
+
], d = e === void 0 && t === void 0 ? () => !0 : e === void 0 ? (u) => u <= t : t === void 0 ? (u) => u >= e : t >= e ? (u) => u >= e && u <= t : (u) => u >= e || u <= t, h = [];
|
|
417
425
|
for (let u = f[0]; u <= f[1]; u++) {
|
|
418
426
|
const m = r(u);
|
|
419
427
|
d(m) && h.push([m, o(u)]);
|
|
420
428
|
}
|
|
421
429
|
return h;
|
|
422
430
|
}
|
|
423
|
-
function Y(
|
|
424
|
-
return
|
|
431
|
+
function Y(s, e, t = !1) {
|
|
432
|
+
return t ? Ne(e, s) : Xe(s, e);
|
|
425
433
|
}
|
|
426
|
-
function
|
|
427
|
-
const
|
|
428
|
-
if (Math.min(Math.abs(a - i), Math.abs(l -
|
|
434
|
+
function ot(s, e) {
|
|
435
|
+
const t = { type: "Polygon", coordinates: s }, [[i, n], [a, l]] = je(t);
|
|
436
|
+
if (Math.min(Math.abs(a - i), Math.abs(l - n)) < e)
|
|
429
437
|
return [];
|
|
430
|
-
const r = i > a || l >= 89 ||
|
|
431
|
-
return
|
|
438
|
+
const r = i > a || l >= 89 || n <= -89;
|
|
439
|
+
return at(e, {
|
|
432
440
|
minLng: i,
|
|
433
441
|
maxLng: a,
|
|
434
|
-
minLat:
|
|
442
|
+
minLat: n,
|
|
435
443
|
maxLat: l
|
|
436
444
|
}).filter(
|
|
437
|
-
(o) => Y(o,
|
|
445
|
+
(o) => Y(o, t, r)
|
|
438
446
|
);
|
|
439
447
|
}
|
|
440
|
-
function
|
|
441
|
-
const
|
|
448
|
+
function ct(s, { resolution: e = 1 / 0, bbox: t, projection: i } = {}) {
|
|
449
|
+
const n = rt(s, e), a = H(n), l = ot(s, e), r = [...a, ...l], o = { type: "Polygon", coordinates: s }, [[c, f], [d, h]] = je(o), u = c > d || // crosses antimeridian
|
|
442
450
|
h >= 89 || // crosses north pole
|
|
443
451
|
f <= -89;
|
|
444
452
|
let m = [];
|
|
445
453
|
if (u) {
|
|
446
|
-
const
|
|
447
|
-
r.map(([A, C],
|
|
454
|
+
const y = Ye(r).triangles(), x = new Map(
|
|
455
|
+
r.map(([A, C], O) => [`${A}-${C}`, O])
|
|
448
456
|
);
|
|
449
|
-
|
|
450
|
-
const C = A.geometry.coordinates[0].slice(0, 3).reverse(),
|
|
451
|
-
if (C.forEach(([
|
|
452
|
-
const
|
|
453
|
-
x.has(
|
|
454
|
-
}),
|
|
455
|
-
if (
|
|
456
|
-
const
|
|
457
|
+
y.features.forEach((A) => {
|
|
458
|
+
const C = A.geometry.coordinates[0].slice(0, 3).reverse(), O = [];
|
|
459
|
+
if (C.forEach(([I, F]) => {
|
|
460
|
+
const L = `${I}-${F}`;
|
|
461
|
+
x.has(L) && O.push(x.get(L));
|
|
462
|
+
}), O.length === 3) {
|
|
463
|
+
if (O.some((I) => I < a.length)) {
|
|
464
|
+
const I = A.properties.circumcenter;
|
|
457
465
|
if (!Y(
|
|
458
|
-
|
|
466
|
+
I,
|
|
459
467
|
o,
|
|
460
468
|
u
|
|
461
469
|
))
|
|
462
470
|
return;
|
|
463
471
|
}
|
|
464
|
-
m.push(...
|
|
472
|
+
m.push(...O);
|
|
465
473
|
}
|
|
466
474
|
});
|
|
467
475
|
} else if (l.length) {
|
|
468
|
-
const
|
|
469
|
-
for (let x = 0, A =
|
|
470
|
-
const C = [2, 1, 0].map((
|
|
471
|
-
if (C.some((
|
|
472
|
-
const
|
|
473
|
-
(F) => $
|
|
476
|
+
const y = Qe.from(r);
|
|
477
|
+
for (let x = 0, A = y.triangles.length; x < A; x += 3) {
|
|
478
|
+
const C = [2, 1, 0].map((I) => y.triangles[x + I]), O = C.map((I) => r[I]);
|
|
479
|
+
if (C.some((I) => I < a.length)) {
|
|
480
|
+
const I = [0, 1].map(
|
|
481
|
+
(F) => $e(O, (L) => L[F])
|
|
474
482
|
);
|
|
475
483
|
if (!Y(
|
|
476
|
-
|
|
484
|
+
I,
|
|
477
485
|
o,
|
|
478
486
|
u
|
|
479
487
|
))
|
|
@@ -482,47 +490,47 @@ function ce(n, { resolution: t = 1 / 0, bbox: e, projection: i } = {}) {
|
|
|
482
490
|
m.push(...C);
|
|
483
491
|
}
|
|
484
492
|
} else {
|
|
485
|
-
const { vertices:
|
|
486
|
-
m =
|
|
493
|
+
const { vertices: y, holes: x = [] } = Ae(n);
|
|
494
|
+
m = qe(y, x, 2);
|
|
487
495
|
}
|
|
488
|
-
let p =
|
|
496
|
+
let p = t ? [t[0], t[2]] : de(r, (y) => y[0]), v = t ? [t[1], t[3]] : de(r, (y) => y[1]);
|
|
489
497
|
if (i) {
|
|
490
|
-
const [
|
|
491
|
-
p = [
|
|
498
|
+
const [y, x] = i([p[0], v[0]]), [A, C] = i([p[1], v[1]]);
|
|
499
|
+
p = [y, A], v = [-x, -C];
|
|
492
500
|
}
|
|
493
|
-
const w =
|
|
501
|
+
const w = he(p, [0, 1]), S = he(v, [0, 1]), B = r.map(([y, x]) => {
|
|
494
502
|
if (i) {
|
|
495
|
-
const [A, C] = i([
|
|
503
|
+
const [A, C] = i([y, x]);
|
|
496
504
|
return [w(A), S(-C)];
|
|
497
505
|
} else
|
|
498
|
-
return [w(
|
|
506
|
+
return [w(y), S(x)];
|
|
499
507
|
});
|
|
500
|
-
return { contour:
|
|
508
|
+
return { contour: n, triangles: { points: r, indices: m, uvs: B } };
|
|
501
509
|
}
|
|
502
|
-
const
|
|
503
|
-
function G(
|
|
504
|
-
const
|
|
510
|
+
const me = new Z().setAttribute ? "setAttribute" : "addAttribute";
|
|
511
|
+
function G(s, e, t, i) {
|
|
512
|
+
const n = s.map(
|
|
505
513
|
(a) => a.map(([l, r]) => {
|
|
506
514
|
if (i) {
|
|
507
515
|
const [o, c] = i([l, r]);
|
|
508
|
-
return [o, -c,
|
|
516
|
+
return [o, -c, e];
|
|
509
517
|
}
|
|
510
|
-
return
|
|
518
|
+
return t ? Fe(l, r, e) : [l, r, e];
|
|
511
519
|
})
|
|
512
520
|
);
|
|
513
|
-
return
|
|
521
|
+
return Ae(n);
|
|
514
522
|
}
|
|
515
|
-
function
|
|
523
|
+
function lt(s, e, t, i, n) {
|
|
516
524
|
const { vertices: a, holes: l } = G(
|
|
517
|
-
|
|
518
|
-
|
|
525
|
+
s,
|
|
526
|
+
e,
|
|
519
527
|
i,
|
|
520
|
-
|
|
528
|
+
n
|
|
521
529
|
), { vertices: r } = G(
|
|
522
|
-
|
|
523
|
-
|
|
530
|
+
s,
|
|
531
|
+
t,
|
|
524
532
|
i,
|
|
525
|
-
|
|
533
|
+
n
|
|
526
534
|
), o = H([r, a]), c = Math.round(r.length / 3), f = new Set(l);
|
|
527
535
|
let d = 0;
|
|
528
536
|
const h = [];
|
|
@@ -541,71 +549,71 @@ function le(n, t, e, i, s) {
|
|
|
541
549
|
for (let p = 0; p < c; p += 1) u.push(p / (c - 1), m);
|
|
542
550
|
return { indices: h, vertices: o, uvs: u, topVerts: r };
|
|
543
551
|
}
|
|
544
|
-
function
|
|
552
|
+
function ve(s, e, t, i, n, a) {
|
|
545
553
|
return {
|
|
546
|
-
indices: i ?
|
|
554
|
+
indices: i ? s.indices : s.indices.slice().reverse(),
|
|
547
555
|
vertices: G(
|
|
548
|
-
[
|
|
549
|
-
|
|
550
|
-
|
|
556
|
+
[s.points],
|
|
557
|
+
e,
|
|
558
|
+
n,
|
|
551
559
|
a
|
|
552
560
|
).vertices,
|
|
553
|
-
uvs:
|
|
561
|
+
uvs: t
|
|
554
562
|
};
|
|
555
563
|
}
|
|
556
|
-
const
|
|
557
|
-
polygonGeoJson:
|
|
558
|
-
startHeight:
|
|
559
|
-
endHeight:
|
|
564
|
+
const ut = ({
|
|
565
|
+
polygonGeoJson: s,
|
|
566
|
+
startHeight: e,
|
|
567
|
+
endHeight: t,
|
|
560
568
|
curvatureResolution: i = 1,
|
|
561
|
-
cartesian:
|
|
569
|
+
cartesian: n = !0,
|
|
562
570
|
hasSide: a = !0,
|
|
563
571
|
hasBottom: l = !1,
|
|
564
572
|
hasTop: r = !1,
|
|
565
573
|
projection: o,
|
|
566
574
|
bbox: c
|
|
567
575
|
}) => {
|
|
568
|
-
|
|
569
|
-
|
|
576
|
+
s.forEach((w) => {
|
|
577
|
+
Ke(w) || w.reverse();
|
|
570
578
|
});
|
|
571
|
-
const { contour: f, triangles: d } =
|
|
579
|
+
const { contour: f, triangles: d } = ct(s, {
|
|
572
580
|
resolution: i,
|
|
573
581
|
bbox: c,
|
|
574
582
|
projection: o
|
|
575
583
|
});
|
|
576
584
|
let h = {}, u;
|
|
577
|
-
a && (h =
|
|
585
|
+
a && (h = lt(
|
|
578
586
|
f,
|
|
579
|
-
t != null ? t : e,
|
|
580
587
|
e != null ? e : t,
|
|
581
|
-
|
|
588
|
+
t != null ? t : e,
|
|
589
|
+
n,
|
|
582
590
|
o
|
|
583
591
|
), u = h.topVerts);
|
|
584
592
|
let m = [];
|
|
585
593
|
(l || r) && (m = H(d.uvs));
|
|
586
594
|
let p = {};
|
|
587
|
-
l && (p =
|
|
595
|
+
l && (p = ve(
|
|
588
596
|
d,
|
|
589
|
-
|
|
597
|
+
e,
|
|
590
598
|
m,
|
|
591
599
|
!1,
|
|
592
|
-
|
|
600
|
+
n,
|
|
593
601
|
o
|
|
594
602
|
));
|
|
595
603
|
let v = {};
|
|
596
|
-
return r && (v =
|
|
604
|
+
return r && (v = ve(
|
|
597
605
|
d,
|
|
598
|
-
|
|
606
|
+
t,
|
|
599
607
|
m,
|
|
600
608
|
!0,
|
|
601
|
-
|
|
609
|
+
n,
|
|
602
610
|
o
|
|
603
611
|
)), { contour: f, triangles: d, sideTorso: h, bottomCap: p, topCap: v, topVerts: u };
|
|
604
612
|
};
|
|
605
|
-
class
|
|
606
|
-
constructor(
|
|
607
|
-
super(), this.type = "PolygonBufferGeometry", this.parameters =
|
|
608
|
-
polygonGeoJson:
|
|
613
|
+
class zt extends Z {
|
|
614
|
+
constructor(e, t = {}) {
|
|
615
|
+
super(), this.type = "PolygonBufferGeometry", this.parameters = k({
|
|
616
|
+
polygonGeoJson: e,
|
|
609
617
|
startHeight: 0,
|
|
610
618
|
endHeight: 1,
|
|
611
619
|
hasTop: !0,
|
|
@@ -615,33 +623,33 @@ class ze extends Z {
|
|
|
615
623
|
curvatureResolution: 1,
|
|
616
624
|
cartesian: !0,
|
|
617
625
|
userDataRsoOffset: 0
|
|
618
|
-
},
|
|
626
|
+
}, t);
|
|
619
627
|
const {
|
|
620
628
|
endHeight: i,
|
|
621
|
-
hasTop:
|
|
629
|
+
hasTop: n,
|
|
622
630
|
topFirst: a,
|
|
623
631
|
hasBottom: l,
|
|
624
632
|
hasSide: r,
|
|
625
633
|
cartesian: o,
|
|
626
634
|
userDataRsoOffset: c,
|
|
627
635
|
projection: f
|
|
628
|
-
} = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } =
|
|
636
|
+
} = this.parameters, { contour: d, sideTorso: h, topVerts: u, bottomCap: m, topCap: p } = ut(k({}, this.parameters));
|
|
629
637
|
let v = [], w = [], S = [], B = 0;
|
|
630
|
-
const j = (
|
|
638
|
+
const j = (y) => {
|
|
631
639
|
const x = Math.round(v.length / 3), A = S.length;
|
|
632
|
-
v = v.concat(
|
|
633
|
-
x ?
|
|
640
|
+
v = v.concat(y.vertices), w = w.concat(y.uvs), S = S.concat(
|
|
641
|
+
x ? y.indices.map((C) => C + x) : y.indices
|
|
634
642
|
), this.addGroup(A, S.length - A, B++);
|
|
635
643
|
};
|
|
636
|
-
|
|
644
|
+
n && a && j(p), r && (j(h), this.userData.topVerts = c ? G(
|
|
637
645
|
d,
|
|
638
646
|
i + c,
|
|
639
647
|
o,
|
|
640
648
|
f
|
|
641
|
-
).vertices : u), l && j(m),
|
|
649
|
+
).vertices : u), l && j(m), n && !a && j(p), this.setIndex(S), this[me]("position", new R(v, 3)), this[me]("uv", new R(w, 2)), this.computeVertexNormals();
|
|
642
650
|
}
|
|
643
651
|
}
|
|
644
|
-
const
|
|
652
|
+
const ft = `
|
|
645
653
|
#include <fog_pars_fragment>
|
|
646
654
|
#include <logdepthbuf_pars_fragment>
|
|
647
655
|
|
|
@@ -685,7 +693,7 @@ void main() {
|
|
|
685
693
|
#include <tonemapping_fragment>
|
|
686
694
|
#include <colorspace_fragment>
|
|
687
695
|
}
|
|
688
|
-
`,
|
|
696
|
+
`, dt = `
|
|
689
697
|
#include <common>
|
|
690
698
|
#include <logdepthbuf_pars_vertex>
|
|
691
699
|
#include <fog_pars_vertex>
|
|
@@ -778,12 +786,12 @@ void main() {
|
|
|
778
786
|
#include <fog_vertex>
|
|
779
787
|
}
|
|
780
788
|
`;
|
|
781
|
-
class
|
|
782
|
-
constructor(
|
|
783
|
-
const S =
|
|
784
|
-
lineWidth:
|
|
789
|
+
class Ot extends ze {
|
|
790
|
+
constructor(e = {}) {
|
|
791
|
+
const S = e, {
|
|
792
|
+
lineWidth: t = 1,
|
|
785
793
|
color: i = "#ffffff",
|
|
786
|
-
opacity:
|
|
794
|
+
opacity: n = 1,
|
|
787
795
|
map: a = null,
|
|
788
796
|
dashOffset: l = 0,
|
|
789
797
|
dashArray: r = 0,
|
|
@@ -796,7 +804,7 @@ class _e extends zt {
|
|
|
796
804
|
alphaTest: m = 0,
|
|
797
805
|
repeat: p = new q(1, 1),
|
|
798
806
|
resolution: v = new q(1, 1)
|
|
799
|
-
} = S, w =
|
|
807
|
+
} = S, w = se(S, [
|
|
800
808
|
"lineWidth",
|
|
801
809
|
"color",
|
|
802
810
|
"opacity",
|
|
@@ -813,11 +821,11 @@ class _e extends zt {
|
|
|
813
821
|
"repeat",
|
|
814
822
|
"resolution"
|
|
815
823
|
]);
|
|
816
|
-
super($(
|
|
824
|
+
super($(k({}, w), {
|
|
817
825
|
uniforms: {
|
|
818
|
-
lineWidth: { value:
|
|
819
|
-
color: { value: new
|
|
820
|
-
opacity: { value:
|
|
826
|
+
lineWidth: { value: t },
|
|
827
|
+
color: { value: new le(i) },
|
|
828
|
+
opacity: { value: n },
|
|
821
829
|
map: { value: a },
|
|
822
830
|
useMap: { value: a ? 1 : 0 },
|
|
823
831
|
resolution: { value: v },
|
|
@@ -834,73 +842,73 @@ class _e extends zt {
|
|
|
834
842
|
useAlphaMap: { value: u ? 1 : 0 },
|
|
835
843
|
repeat: { value: p }
|
|
836
844
|
},
|
|
837
|
-
vertexShader:
|
|
838
|
-
fragmentShader:
|
|
845
|
+
vertexShader: dt,
|
|
846
|
+
fragmentShader: ft
|
|
839
847
|
})), this.type = "MeshLineMaterial";
|
|
840
848
|
}
|
|
841
849
|
// Getter and setter for color
|
|
842
850
|
get color() {
|
|
843
851
|
return this.uniforms.color.value;
|
|
844
852
|
}
|
|
845
|
-
set color(
|
|
846
|
-
this.uniforms.color.value = new
|
|
853
|
+
set color(e) {
|
|
854
|
+
this.uniforms.color.value = new le(e);
|
|
847
855
|
}
|
|
848
856
|
get opacity() {
|
|
849
|
-
var
|
|
850
|
-
return ((
|
|
857
|
+
var e;
|
|
858
|
+
return ((e = this.uniforms) == null ? void 0 : e.opacity.value) || 1;
|
|
851
859
|
}
|
|
852
|
-
set opacity(
|
|
853
|
-
this.uniforms && (this.uniforms.opacity.value =
|
|
860
|
+
set opacity(e) {
|
|
861
|
+
this.uniforms && (this.uniforms.opacity.value = e);
|
|
854
862
|
}
|
|
855
863
|
get alphaTest() {
|
|
856
864
|
return this.uniforms.alphaTest.value;
|
|
857
865
|
}
|
|
858
|
-
set alphaTest(
|
|
859
|
-
this.uniforms && (this.uniforms.alphaTest.value =
|
|
866
|
+
set alphaTest(e) {
|
|
867
|
+
this.uniforms && (this.uniforms.alphaTest.value = e);
|
|
860
868
|
}
|
|
861
869
|
// Getter and setter for map
|
|
862
870
|
get map() {
|
|
863
871
|
return this.uniforms.map.value;
|
|
864
872
|
}
|
|
865
|
-
set map(
|
|
866
|
-
this.uniforms.map.value =
|
|
873
|
+
set map(e) {
|
|
874
|
+
this.uniforms.map.value = e, this.uniforms.useMap.value = e ? 1 : 0;
|
|
867
875
|
}
|
|
868
876
|
get repeat() {
|
|
869
877
|
return this.uniforms.repeat.value;
|
|
870
878
|
}
|
|
871
|
-
set repeat(
|
|
872
|
-
this.uniforms.repeat.value.copy(
|
|
879
|
+
set repeat(e) {
|
|
880
|
+
this.uniforms.repeat.value.copy(e);
|
|
873
881
|
}
|
|
874
882
|
// Getter and setter for lineWidth
|
|
875
883
|
get lineWidth() {
|
|
876
884
|
return this.uniforms.lineWidth.value;
|
|
877
885
|
}
|
|
878
|
-
set lineWidth(
|
|
879
|
-
this.uniforms.lineWidth.value =
|
|
886
|
+
set lineWidth(e) {
|
|
887
|
+
this.uniforms.lineWidth.value = e;
|
|
880
888
|
}
|
|
881
889
|
// Getter and setter for sizeAttenuation
|
|
882
890
|
get sizeAttenuation() {
|
|
883
891
|
return this.uniforms.sizeAttenuation.value === 1;
|
|
884
892
|
}
|
|
885
|
-
set sizeAttenuation(
|
|
886
|
-
this.uniforms.sizeAttenuation.value =
|
|
893
|
+
set sizeAttenuation(e) {
|
|
894
|
+
this.uniforms.sizeAttenuation.value = e ? 1 : 0;
|
|
887
895
|
}
|
|
888
896
|
}
|
|
889
|
-
const K = new
|
|
890
|
-
let z,
|
|
891
|
-
function
|
|
892
|
-
return T.set(0, 0, -
|
|
897
|
+
const K = new E(), ye = new P(), be = new P(), b = new E(), g = new E(), D = new E(), Q = new P(), X = new Oe(), M = new _e(), ge = new P(), U = new Se(), W = new ke(), T = new E();
|
|
898
|
+
let z, _;
|
|
899
|
+
function Me(s, e, t) {
|
|
900
|
+
return T.set(0, 0, -e, 1).applyMatrix4(s.projectionMatrix), T.multiplyScalar(1 / T.w), T.x = _ / t.width, T.y = _ / t.height, T.applyMatrix4(s.projectionMatrixInverse), T.multiplyScalar(1 / T.w), Math.abs(Math.max(T.x, T.y));
|
|
893
901
|
}
|
|
894
|
-
function
|
|
895
|
-
const
|
|
902
|
+
function ht(s, e) {
|
|
903
|
+
const t = s.matrixWorld, i = s.geometry, n = i.attributes.instanceStart, a = i.attributes.instanceEnd, l = Math.min(i.instanceCount, n.count);
|
|
896
904
|
for (let r = 0, o = l; r < o; r++) {
|
|
897
|
-
M.start.fromBufferAttribute(
|
|
898
|
-
const c = new
|
|
899
|
-
z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) <
|
|
905
|
+
M.start.fromBufferAttribute(n, r), M.end.fromBufferAttribute(a, r), M.applyMatrix4(t);
|
|
906
|
+
const c = new P(), f = new P();
|
|
907
|
+
z.distanceSqToSegment(M.start, M.end, f, c), f.distanceTo(c) < _ * 0.5 && e.push({
|
|
900
908
|
point: f,
|
|
901
909
|
pointOnLine: c,
|
|
902
910
|
distance: z.origin.distanceTo(f),
|
|
903
|
-
object:
|
|
911
|
+
object: s,
|
|
904
912
|
face: null,
|
|
905
913
|
faceIndex: r,
|
|
906
914
|
uv: null,
|
|
@@ -908,31 +916,31 @@ function he(n, t) {
|
|
|
908
916
|
});
|
|
909
917
|
}
|
|
910
918
|
}
|
|
911
|
-
function
|
|
912
|
-
const i =
|
|
913
|
-
z.at(1, D), D.w = 1, D.applyMatrix4(
|
|
919
|
+
function pt(s, e, t) {
|
|
920
|
+
const i = e.projectionMatrix, a = s.material.resolution, l = s.matrixWorld, r = s.geometry, o = r.attributes.instanceStart, c = r.attributes.instanceEnd, f = Math.min(r.instanceCount, o.count), d = -e.near;
|
|
921
|
+
z.at(1, D), D.w = 1, D.applyMatrix4(e.matrixWorldInverse), D.applyMatrix4(i), D.multiplyScalar(1 / D.w), D.x *= a.x / 2, D.y *= a.y / 2, D.z = 0, Q.copy(D), X.multiplyMatrices(e.matrixWorldInverse, l);
|
|
914
922
|
for (let h = 0, u = f; h < u; h++) {
|
|
915
|
-
if (
|
|
923
|
+
if (b.fromBufferAttribute(o, h), g.fromBufferAttribute(c, h), b.w = 1, g.w = 1, b.applyMatrix4(X), g.applyMatrix4(X), b.z > d && g.z > d)
|
|
916
924
|
continue;
|
|
917
|
-
if (
|
|
918
|
-
const B =
|
|
919
|
-
|
|
920
|
-
} else if (
|
|
921
|
-
const B =
|
|
922
|
-
|
|
925
|
+
if (b.z > d) {
|
|
926
|
+
const B = b.z - g.z, j = (b.z - d) / B;
|
|
927
|
+
b.lerp(g, j);
|
|
928
|
+
} else if (g.z > d) {
|
|
929
|
+
const B = g.z - b.z, j = (g.z - d) / B;
|
|
930
|
+
g.lerp(b, j);
|
|
923
931
|
}
|
|
924
|
-
|
|
932
|
+
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;
|
|
925
933
|
const p = M.closestPointToPointParameter(Q, !0);
|
|
926
|
-
M.at(p,
|
|
927
|
-
const v =
|
|
934
|
+
M.at(p, ge);
|
|
935
|
+
const v = Le.lerp(b.z, g.z, p), w = v >= -1 && v <= 1, S = Q.distanceTo(ge) < _ * 0.5;
|
|
928
936
|
if (w && S) {
|
|
929
937
|
M.start.fromBufferAttribute(o, h), M.end.fromBufferAttribute(c, h), M.start.applyMatrix4(l), M.end.applyMatrix4(l);
|
|
930
|
-
const B = new
|
|
931
|
-
z.distanceSqToSegment(M.start, M.end, j, B),
|
|
938
|
+
const B = new P(), j = new P();
|
|
939
|
+
z.distanceSqToSegment(M.start, M.end, j, B), t.push({
|
|
932
940
|
point: j,
|
|
933
941
|
pointOnLine: B,
|
|
934
942
|
distance: z.origin.distanceTo(j),
|
|
935
|
-
object:
|
|
943
|
+
object: s,
|
|
936
944
|
face: null,
|
|
937
945
|
faceIndex: h,
|
|
938
946
|
uv: null,
|
|
@@ -941,82 +949,82 @@ function pe(n, t, e) {
|
|
|
941
949
|
}
|
|
942
950
|
}
|
|
943
951
|
}
|
|
944
|
-
class
|
|
945
|
-
constructor(
|
|
946
|
-
super(
|
|
952
|
+
class _t extends we {
|
|
953
|
+
constructor(e = new Ze(), t) {
|
|
954
|
+
super(e, t), this.isLineSegments2 = !0, this.type = "LineSegments2";
|
|
947
955
|
}
|
|
948
956
|
// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
|
|
949
957
|
computeLineDistances() {
|
|
950
|
-
const
|
|
951
|
-
for (let l = 0, r = 0, o =
|
|
952
|
-
|
|
953
|
-
const a = new
|
|
954
|
-
|
|
958
|
+
const e = this.geometry, t = e.attributes.instanceStart, i = e.attributes.instanceEnd, n = new Float32Array(2 * t.count);
|
|
959
|
+
for (let l = 0, r = 0, o = t.count; l < o; l++, r += 2)
|
|
960
|
+
ye.fromBufferAttribute(t, l), be.fromBufferAttribute(i, l), n[r] = r === 0 ? 0 : n[r - 1], n[r + 1] = n[r] + ye.distanceTo(be);
|
|
961
|
+
const a = new Ee(
|
|
962
|
+
n,
|
|
955
963
|
2,
|
|
956
964
|
1
|
|
957
965
|
);
|
|
958
|
-
return
|
|
966
|
+
return e.setAttribute(
|
|
959
967
|
"instanceDistanceStart",
|
|
960
|
-
new
|
|
961
|
-
),
|
|
968
|
+
new ue(a, 1, 0)
|
|
969
|
+
), e.setAttribute(
|
|
962
970
|
"instanceDistanceEnd",
|
|
963
|
-
new
|
|
971
|
+
new ue(a, 1, 1)
|
|
964
972
|
), this;
|
|
965
973
|
}
|
|
966
|
-
raycast(
|
|
967
|
-
const i = this.material.worldUnits,
|
|
968
|
-
|
|
974
|
+
raycast(e, t) {
|
|
975
|
+
const i = this.material.worldUnits, n = e.camera;
|
|
976
|
+
n === null && !i && console.error(
|
|
969
977
|
'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.'
|
|
970
978
|
);
|
|
971
|
-
const a =
|
|
972
|
-
z =
|
|
979
|
+
const a = e.params.Line2 !== void 0 && e.params.Line2.threshold || 0;
|
|
980
|
+
z = e.ray;
|
|
973
981
|
const l = this.matrixWorld, r = this.geometry, o = this.material;
|
|
974
|
-
|
|
982
|
+
_ = o.linewidth + a, r.boundingSphere === null && r.computeBoundingSphere(), W.copy(r.boundingSphere).applyMatrix4(l);
|
|
975
983
|
let c;
|
|
976
984
|
if (i)
|
|
977
|
-
c =
|
|
985
|
+
c = _ * 0.5;
|
|
978
986
|
else {
|
|
979
987
|
const d = Math.max(
|
|
980
|
-
|
|
981
|
-
|
|
988
|
+
n.near,
|
|
989
|
+
W.distanceToPoint(z.origin)
|
|
982
990
|
);
|
|
983
|
-
c =
|
|
984
|
-
|
|
991
|
+
c = Me(
|
|
992
|
+
n,
|
|
985
993
|
d,
|
|
986
994
|
o.resolution
|
|
987
995
|
);
|
|
988
996
|
}
|
|
989
|
-
if (
|
|
997
|
+
if (W.radius += c, z.intersectsSphere(W) === !1)
|
|
990
998
|
return;
|
|
991
|
-
r.boundingBox === null && r.computeBoundingBox(),
|
|
999
|
+
r.boundingBox === null && r.computeBoundingBox(), U.copy(r.boundingBox).applyMatrix4(l);
|
|
992
1000
|
let f;
|
|
993
1001
|
if (i)
|
|
994
|
-
f =
|
|
1002
|
+
f = _ * 0.5;
|
|
995
1003
|
else {
|
|
996
1004
|
const d = Math.max(
|
|
997
|
-
|
|
998
|
-
|
|
1005
|
+
n.near,
|
|
1006
|
+
U.distanceToPoint(z.origin)
|
|
999
1007
|
);
|
|
1000
|
-
f =
|
|
1001
|
-
|
|
1008
|
+
f = Me(
|
|
1009
|
+
n,
|
|
1002
1010
|
d,
|
|
1003
1011
|
o.resolution
|
|
1004
1012
|
);
|
|
1005
1013
|
}
|
|
1006
|
-
|
|
1014
|
+
U.expandByScalar(f), z.intersectsBox(U) !== !1 && (i ? ht(this, t) : pt(this, n, t));
|
|
1007
1015
|
}
|
|
1008
|
-
onBeforeRender(
|
|
1009
|
-
const
|
|
1010
|
-
|
|
1016
|
+
onBeforeRender(e) {
|
|
1017
|
+
const t = this.material.uniforms;
|
|
1018
|
+
t && t.resolution && (e.getViewport(K), this.material.uniforms.resolution.value.set(K.z, K.w));
|
|
1011
1019
|
}
|
|
1012
1020
|
}
|
|
1013
1021
|
export {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
+
Dt as B,
|
|
1023
|
+
Tt as I,
|
|
1024
|
+
_t as L,
|
|
1025
|
+
Ot as M,
|
|
1026
|
+
zt as P,
|
|
1027
|
+
et as R,
|
|
1028
|
+
pe as a,
|
|
1029
|
+
ut as g
|
|
1022
1030
|
};
|