gl-draw 0.17.0-beta.4 → 0.17.0-beta.40
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/cartographicToCartesian.js +1 -0
- package/dist/cartographicToCartesian.module.js +49 -0
- package/dist/constants.d.ts +0 -1
- package/dist/core/BaseObject/PointerEvent.d.ts +1 -0
- package/dist/core/BaseObject/index.d.ts +16 -4
- package/dist/core/Composer.d.ts +5 -5
- package/dist/core/Helper.d.ts +4 -4
- package/dist/core/Lead/Pick.d.ts +35 -3
- package/dist/core/Lead/index.d.ts +5 -6
- package/dist/core/Pages/Pages.d.ts +1 -0
- package/dist/core/Pencil.d.ts +3 -3
- package/dist/core/pass/OutputPass.d.ts +1 -2
- package/dist/index.js +2 -2
- package/dist/index.module.js +505 -411
- package/dist/index.module2.js +1180 -0
- package/dist/index2.js +140 -0
- package/dist/objects/conicPolygon/geometry/index.d.ts +1 -2
- package/dist/objects/ellipsoid/createGeometry.d.ts +30 -0
- package/dist/objects/ellipsoid/index.d.ts +38 -0
- package/dist/objects/extrudePolygon/createGeometry.d.ts +2 -1
- package/dist/objects/group/index.d.ts +1 -0
- package/dist/objects/index.d.ts +2 -0
- package/dist/objects/index.js +1 -1
- package/dist/objects/index.module.js +907 -763
- package/dist/objects/node/CollisionManager.d.ts +94 -0
- package/dist/objects/node/index.d.ts +7 -2
- package/dist/objects/pie/index.d.ts +2 -1
- package/dist/plugins/Worker/getAttributes/conicLine.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/conicPolygon.d.ts +2 -3
- package/dist/plugins/Worker/getAttributes/extrudePolygon.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/getCoordinatesArr.d.ts +5 -1
- package/dist/plugins/Worker/getAttributes/line.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/line2.d.ts +1 -1
- package/dist/plugins/Worker/getAttributes/splitPolygonsByLongitudeDifference.d.ts +5 -2
- package/dist/plugins/Worker/index.d.ts +2 -3
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/index.module.js +77 -70
- package/dist/utils/Sprite2Points.d.ts +1 -1
- package/dist/utils/cartographicToCartesian.d.ts +30 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/index.module.js +15 -13
- package/dist/utils/proposedRaycast.d.ts +1 -0
- package/package.json +1 -1
- package/dist/WebGPULineSegments2.js +0 -140
- package/dist/WebGPULineSegments2.module.js +0 -1031
- package/dist/polar2Cartesian.js +0 -1
- package/dist/polar2Cartesian.module.js +0 -18
- package/dist/utils/polar2Cartesian.d.ts +0 -1
|
@@ -1,450 +1,492 @@
|
|
|
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
|
|
16
|
-
|
|
17
|
-
if (
|
|
18
|
-
for (var
|
|
19
|
-
|
|
20
|
-
return
|
|
1
|
+
var te = Object.defineProperty, ee = Object.defineProperties;
|
|
2
|
+
var se = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var pt = Object.getOwnPropertySymbols;
|
|
4
|
+
var Rt = Object.prototype.hasOwnProperty, Vt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Bt = (f, t, e) => t in f ? te(f, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[t] = e, O = (f, t) => {
|
|
6
|
+
for (var e in t || (t = {}))
|
|
7
|
+
Rt.call(t, e) && Bt(f, e, t[e]);
|
|
8
|
+
if (pt)
|
|
9
|
+
for (var e of pt(t))
|
|
10
|
+
Vt.call(t, e) && Bt(f, e, t[e]);
|
|
11
|
+
return f;
|
|
12
|
+
}, gt = (f, t) => ee(f, se(t));
|
|
13
|
+
var xt = (f, t) => {
|
|
14
|
+
var e = {};
|
|
15
|
+
for (var s in f)
|
|
16
|
+
Rt.call(f, s) && t.indexOf(s) < 0 && (e[s] = f[s]);
|
|
17
|
+
if (f != null && pt)
|
|
18
|
+
for (var s of pt(f))
|
|
19
|
+
t.indexOf(s) < 0 && Vt.call(f, s) && (e[s] = f[s]);
|
|
20
|
+
return e;
|
|
21
21
|
};
|
|
22
|
-
var
|
|
23
|
-
var
|
|
22
|
+
var ct = (f, t, e) => new Promise((s, n) => {
|
|
23
|
+
var r = (o) => {
|
|
24
24
|
try {
|
|
25
|
-
|
|
25
|
+
c(e.next(o));
|
|
26
26
|
} catch (h) {
|
|
27
|
-
|
|
27
|
+
n(h);
|
|
28
28
|
}
|
|
29
|
-
}, a = (
|
|
29
|
+
}, a = (o) => {
|
|
30
30
|
try {
|
|
31
|
-
|
|
31
|
+
c(e.throw(o));
|
|
32
32
|
} catch (h) {
|
|
33
|
-
|
|
33
|
+
n(h);
|
|
34
34
|
}
|
|
35
|
-
},
|
|
36
|
-
|
|
35
|
+
}, c = (o) => o.done ? s(o.value) : Promise.resolve(o.value).then(r, a);
|
|
36
|
+
c((e = e.apply(f, t)).next());
|
|
37
37
|
});
|
|
38
|
-
import { LineMaterial as
|
|
39
|
-
import { LineMaterial as
|
|
40
|
-
import { LineSegmentsGeometry as
|
|
41
|
-
import { LineSegmentsGeometry as
|
|
42
|
-
import { P as
|
|
43
|
-
import { g as
|
|
44
|
-
import { BufferGeometry as
|
|
45
|
-
import { mergeAttributes as
|
|
46
|
-
import {
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
import
|
|
50
|
-
import
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
38
|
+
import { LineMaterial as ne } from "three/examples/jsm/lines/LineMaterial";
|
|
39
|
+
import { LineMaterial as ps } from "three/examples/jsm/lines/LineMaterial";
|
|
40
|
+
import { LineSegmentsGeometry as ie } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
41
|
+
import { LineSegmentsGeometry as ys } from "three/examples/jsm/lines/LineSegmentsGeometry";
|
|
42
|
+
import { P as oe, a as K, M as re, L as ae } from "../index.module2.js";
|
|
43
|
+
import { N as ws, g as xs } from "../index.module2.js";
|
|
44
|
+
import { BufferGeometry as lt, Float32BufferAttribute as rt, MeshStandardMaterial as ce, Mesh as kt, Vector3 as z, ShapeUtils as yt, Shape as St, Vector2 as P, ArcCurve as le, CatmullRomCurve3 as he, CubicBezierCurve as ue, CubicBezierCurve3 as de, EllipseCurve as fe, LineCurve as me, LineCurve3 as pe, QuadraticBezierCurve as ge, QuadraticBezierCurve3 as ye, SplineCurve as be, Box3 as we, PlaneGeometry as xe, CanvasTexture as ve, AmbientLight as Me, DirectionalLight as Se, PointLight as Ae, SpotLight as Le, HemisphereLight as Te, RectAreaLight as Ce, Matrix4 as Ft, BufferAttribute as Q, Ray as Ee, Sphere as Ge, LineSegments as qt, Color as Yt, MeshBasicMaterial as _e } from "three";
|
|
45
|
+
import { mergeAttributes as Ot, mergeGroups as Pe } from "three/examples/jsm/utils/BufferGeometryUtils";
|
|
46
|
+
import { W as vt } from "../cartographicToCartesian.module.js";
|
|
47
|
+
import { g as ze, c as je } from "../uvGenerator.module.js";
|
|
48
|
+
import { Brush as Dt, Evaluator as Ie, INTERSECTION as Ue } from "three-bvh-csg";
|
|
49
|
+
import { RectAreaLightUniformsLib as Be } from "three/examples/jsm/lights/RectAreaLightUniformsLib";
|
|
50
|
+
import * as ot from "@tweenjs/tween.js";
|
|
51
|
+
import { LineSegments2 as Re } from "three/examples/jsm/lines/LineSegments2";
|
|
52
|
+
function F(f, t = 0) {
|
|
53
|
+
const e = f[0].index !== null, s = new Set(Object.keys(f[0].attributes)), n = new Set(
|
|
54
|
+
Object.keys(f[0].morphAttributes)
|
|
55
|
+
), r = {}, a = {}, c = f[0].morphTargetsRelative, o = new lt();
|
|
55
56
|
let h = 0;
|
|
56
|
-
for (let i = 0; i <
|
|
57
|
-
const
|
|
57
|
+
for (let i = 0; i < f.length; ++i) {
|
|
58
|
+
const l = f[i];
|
|
58
59
|
let g = 0;
|
|
59
|
-
if (
|
|
60
|
+
if (e !== (l.index !== null))
|
|
60
61
|
return console.error(
|
|
61
62
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."
|
|
62
63
|
), null;
|
|
63
|
-
for (const
|
|
64
|
-
if (!
|
|
64
|
+
for (const d in l.attributes) {
|
|
65
|
+
if (!s.has(d))
|
|
65
66
|
return console.error(
|
|
66
|
-
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' +
|
|
67
|
+
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + '. All geometries must have compatible attributes; make sure "' + d + '" attribute exists among all geometries, or in none of them.'
|
|
67
68
|
), null;
|
|
68
|
-
|
|
69
|
+
r[d] === void 0 && (r[d] = []), r[d].push(l.attributes[d]), g++;
|
|
69
70
|
}
|
|
70
|
-
if (g !==
|
|
71
|
+
if (g !== s.size)
|
|
71
72
|
return console.error(
|
|
72
73
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". Make sure all geometries have the same number of attributes."
|
|
73
74
|
), null;
|
|
74
|
-
if (
|
|
75
|
+
if (c !== l.morphTargetsRelative)
|
|
75
76
|
return console.error(
|
|
76
77
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphTargetsRelative must be consistent throughout all geometries."
|
|
77
78
|
), null;
|
|
78
|
-
for (const
|
|
79
|
-
if (!
|
|
79
|
+
for (const d in l.morphAttributes) {
|
|
80
|
+
if (!n.has(d))
|
|
80
81
|
return console.error(
|
|
81
82
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". .morphAttributes must be consistent throughout all geometries."
|
|
82
83
|
), null;
|
|
83
|
-
a[
|
|
84
|
+
a[d] === void 0 && (a[d] = []), a[d].push(l.morphAttributes[d]);
|
|
84
85
|
}
|
|
85
|
-
if (
|
|
86
|
-
let
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
else if (
|
|
90
|
-
|
|
86
|
+
if (t) {
|
|
87
|
+
let d;
|
|
88
|
+
if (e)
|
|
89
|
+
d = l.index.count;
|
|
90
|
+
else if (l.attributes.position !== void 0)
|
|
91
|
+
d = l.attributes.position.count;
|
|
91
92
|
else
|
|
92
93
|
return console.error(
|
|
93
94
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + i + ". The geometry must have either an index or a position attribute"
|
|
94
95
|
), null;
|
|
95
|
-
if (
|
|
96
|
-
|
|
97
|
-
else if (
|
|
98
|
-
for (let y of
|
|
99
|
-
let
|
|
100
|
-
|
|
96
|
+
if (t === 1)
|
|
97
|
+
o.addGroup(h, d, i);
|
|
98
|
+
else if (t === 2 && l.groups.length > 0)
|
|
99
|
+
for (let y of l.groups) {
|
|
100
|
+
let A = y.materialIndex;
|
|
101
|
+
o.addGroup(
|
|
101
102
|
h + y.start,
|
|
102
|
-
Math.min(y.count,
|
|
103
|
-
|
|
103
|
+
Math.min(y.count, d),
|
|
104
|
+
A
|
|
104
105
|
);
|
|
105
106
|
}
|
|
106
|
-
h +=
|
|
107
|
+
h += d;
|
|
107
108
|
}
|
|
108
109
|
}
|
|
109
|
-
if (
|
|
110
|
+
if (e) {
|
|
110
111
|
let i = 0;
|
|
111
|
-
const
|
|
112
|
-
for (let g = 0; g <
|
|
113
|
-
const
|
|
114
|
-
for (let y = 0; y <
|
|
115
|
-
|
|
116
|
-
i +=
|
|
112
|
+
const l = [];
|
|
113
|
+
for (let g = 0; g < f.length; ++g) {
|
|
114
|
+
const d = f[g].index;
|
|
115
|
+
for (let y = 0; y < d.count; ++y)
|
|
116
|
+
l.push(d.getX(y) + i);
|
|
117
|
+
i += f[g].attributes.position.count;
|
|
117
118
|
}
|
|
118
|
-
|
|
119
|
+
o.setIndex(l);
|
|
119
120
|
}
|
|
120
|
-
for (const i in
|
|
121
|
-
const
|
|
122
|
-
if (!
|
|
121
|
+
for (const i in r) {
|
|
122
|
+
const l = Ot(r[i]);
|
|
123
|
+
if (!l)
|
|
123
124
|
return console.error(
|
|
124
125
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " attribute."
|
|
125
126
|
), null;
|
|
126
|
-
|
|
127
|
+
o.setAttribute(i, l);
|
|
127
128
|
}
|
|
128
129
|
for (const i in a) {
|
|
129
|
-
const
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
for (let g = 0; g <
|
|
133
|
-
const
|
|
134
|
-
for (let
|
|
135
|
-
|
|
136
|
-
const y =
|
|
130
|
+
const l = a[i][0].length;
|
|
131
|
+
if (l === 0) break;
|
|
132
|
+
o.morphAttributes = o.morphAttributes || {}, o.morphAttributes[i] = [];
|
|
133
|
+
for (let g = 0; g < l; ++g) {
|
|
134
|
+
const d = [];
|
|
135
|
+
for (let A = 0; A < a[i].length; ++A)
|
|
136
|
+
d.push(a[i][A][g]);
|
|
137
|
+
const y = Ot(d);
|
|
137
138
|
if (!y)
|
|
138
139
|
return console.error(
|
|
139
140
|
"THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + i + " morphAttribute."
|
|
140
141
|
), null;
|
|
141
|
-
|
|
142
|
+
o.morphAttributes[i].push(y);
|
|
142
143
|
}
|
|
143
144
|
}
|
|
144
|
-
return
|
|
145
|
+
return t === 2 ? Pe(o) : o;
|
|
145
146
|
}
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
let
|
|
149
|
-
return typeof
|
|
150
|
-
startHeight:
|
|
151
|
-
endHeight:
|
|
147
|
+
const Ht = (f) => {
|
|
148
|
+
const c = f, { coordinate: t, startHeight: e, height: s } = c, n = xt(c, ["coordinate", "startHeight", "height"]);
|
|
149
|
+
let r = e || 0;
|
|
150
|
+
return typeof e != "undefined" && typeof s != "undefined" && (r = e + s), new oe([t], gt(O({}, n), {
|
|
151
|
+
startHeight: e,
|
|
152
|
+
endHeight: r
|
|
152
153
|
}));
|
|
153
154
|
};
|
|
154
|
-
class
|
|
155
|
-
constructor(
|
|
156
|
-
super(), this.options =
|
|
155
|
+
class es extends K {
|
|
156
|
+
constructor(t) {
|
|
157
|
+
super(), this.options = O({}, t);
|
|
157
158
|
}
|
|
158
159
|
create() {
|
|
159
|
-
const
|
|
160
|
-
geometry:
|
|
161
|
-
coordinateArr:
|
|
162
|
-
coordinate:
|
|
163
|
-
material:
|
|
164
|
-
useGroups:
|
|
165
|
-
} =
|
|
160
|
+
const o = this.options, {
|
|
161
|
+
geometry: t,
|
|
162
|
+
coordinateArr: e,
|
|
163
|
+
coordinate: s,
|
|
164
|
+
material: n,
|
|
165
|
+
useGroups: r
|
|
166
|
+
} = o, a = xt(o, [
|
|
166
167
|
"geometry",
|
|
167
168
|
"coordinateArr",
|
|
168
169
|
"coordinate",
|
|
169
170
|
"material",
|
|
170
171
|
"useGroups"
|
|
171
172
|
]);
|
|
172
|
-
let
|
|
173
|
-
if (!
|
|
174
|
-
|
|
175
|
-
coordinate:
|
|
173
|
+
let c = t;
|
|
174
|
+
if (!c && s)
|
|
175
|
+
c = Ht(O({
|
|
176
|
+
coordinate: s
|
|
176
177
|
}, a));
|
|
177
|
-
else if (!
|
|
178
|
-
const h =
|
|
179
|
-
(i) =>
|
|
178
|
+
else if (!c && e) {
|
|
179
|
+
const h = e.map(
|
|
180
|
+
(i) => Ht(O({
|
|
180
181
|
coordinate: i
|
|
181
182
|
}, a))
|
|
182
183
|
);
|
|
183
|
-
|
|
184
|
+
c = F(h, r != null ? r : 0);
|
|
184
185
|
}
|
|
185
|
-
this.createMesh(
|
|
186
|
+
this.createMesh(c, n);
|
|
186
187
|
}
|
|
187
188
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
189
|
+
function Ve(f = {}) {
|
|
190
|
+
const {
|
|
191
|
+
a: t = vt.a,
|
|
192
|
+
b: e = vt.b,
|
|
193
|
+
scaleFactor: s = 1 / vt.a,
|
|
194
|
+
widthSegments: n = 64,
|
|
195
|
+
heightSegments: r = 32
|
|
196
|
+
} = f, a = new lt(), c = [], o = [], h = [], i = [], l = t * t, g = e * e, d = (l - g) / l;
|
|
197
|
+
let y = 0;
|
|
198
|
+
const A = [];
|
|
199
|
+
for (let x = 0; x <= r; x++) {
|
|
200
|
+
const v = [], E = x / r, _ = (0.5 - E) * 180 * Math.PI / 180, R = Math.sin(_), V = Math.cos(_), X = t / Math.sqrt(1 - d * R * R);
|
|
201
|
+
for (let j = 0; j <= n; j++) {
|
|
202
|
+
const $ = j / n, N = ($ - 0.5) * 360 * Math.PI / 180, at = Math.sin(N), I = Math.cos(N), U = X * V * at * s, At = X * (1 - d) * R * s, ht = X * V * I * s;
|
|
203
|
+
o.push(U, At, ht);
|
|
204
|
+
const tt = V * at / t, B = R * (1 - d) / e, k = V * I / t, D = Math.sqrt(tt * tt + B * B + k * k);
|
|
205
|
+
h.push(tt / D, B / D, k / D), i.push($, 1 - E), v.push(y++);
|
|
206
|
+
}
|
|
207
|
+
A.push(v);
|
|
208
|
+
}
|
|
209
|
+
for (let x = 0; x < r; x++)
|
|
210
|
+
for (let v = 0; v < n; v++) {
|
|
211
|
+
const E = A[x][v + 1], M = A[x][v], _ = A[x + 1][v], R = A[x + 1][v + 1];
|
|
212
|
+
c.push(E, M, R), c.push(M, _, R);
|
|
213
|
+
}
|
|
214
|
+
return a.setIndex(c), a.setAttribute("position", new rt(o, 3)), a.setAttribute("normal", new rt(h, 3)), a.setAttribute("uv", new rt(i, 2)), a;
|
|
215
|
+
}
|
|
216
|
+
class ss extends K {
|
|
217
|
+
constructor(t = {}) {
|
|
218
|
+
super(), this.options = t;
|
|
219
|
+
}
|
|
220
|
+
create() {
|
|
221
|
+
const t = Ve(this.options), e = this.options.material || new ce({
|
|
222
|
+
color: 2200782,
|
|
223
|
+
metalness: 0.1,
|
|
224
|
+
roughness: 0.7,
|
|
225
|
+
wireframe: !1
|
|
226
|
+
}), s = new kt(t, e);
|
|
227
|
+
return s.name = "Ellipsoid", this.object3d = s, s;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const Oe = {
|
|
231
|
+
ArcCurve: le,
|
|
232
|
+
CatmullRomCurve3: he,
|
|
233
|
+
CubicBezierCurve: ue,
|
|
234
|
+
CubicBezierCurve3: de,
|
|
235
|
+
EllipseCurve: fe,
|
|
236
|
+
LineCurve: me,
|
|
237
|
+
LineCurve3: pe,
|
|
238
|
+
QuadraticBezierCurve: ge,
|
|
239
|
+
QuadraticBezierCurve3: ye,
|
|
240
|
+
SplineCurve: be
|
|
199
241
|
};
|
|
200
|
-
class
|
|
242
|
+
class nt extends lt {
|
|
201
243
|
/**
|
|
202
244
|
* Constructs a new extrude geometry.
|
|
203
245
|
*
|
|
204
246
|
* @param {Shape|Array<Shape>} [shapes] - A shape or an array of shapes.
|
|
205
247
|
* @param {ExtrudeGeometry~Options} [options] - The extrude settings.
|
|
206
248
|
*/
|
|
207
|
-
constructor(
|
|
249
|
+
constructor(t = new St([
|
|
208
250
|
new P(0.5, 0.5),
|
|
209
251
|
new P(-0.5, 0.5),
|
|
210
252
|
new P(-0.5, -0.5),
|
|
211
253
|
new P(0.5, -0.5)
|
|
212
|
-
]),
|
|
254
|
+
]), e = {}) {
|
|
213
255
|
super(), this.type = "ExtrudeGeometry", this.parameters = {
|
|
214
|
-
shapes:
|
|
215
|
-
options:
|
|
216
|
-
},
|
|
217
|
-
const
|
|
218
|
-
for (let
|
|
219
|
-
const h =
|
|
256
|
+
shapes: t,
|
|
257
|
+
options: e
|
|
258
|
+
}, t = Array.isArray(t) ? t : [t];
|
|
259
|
+
const s = this, n = [], r = [];
|
|
260
|
+
for (let c = 0, o = t.length; c < o; c++) {
|
|
261
|
+
const h = t[c];
|
|
220
262
|
a(h);
|
|
221
263
|
}
|
|
222
|
-
this.setAttribute("position", new
|
|
223
|
-
function a(
|
|
224
|
-
var
|
|
225
|
-
const
|
|
226
|
-
let g =
|
|
227
|
-
const
|
|
228
|
-
let
|
|
229
|
-
|
|
230
|
-
const
|
|
231
|
-
let
|
|
232
|
-
const
|
|
233
|
-
if (!
|
|
234
|
-
|
|
235
|
-
for (let
|
|
236
|
-
const
|
|
237
|
-
|
|
264
|
+
this.setAttribute("position", new rt(n, 3)), this.setAttribute("uv", new rt(r, 2)), this.computeVertexNormals();
|
|
265
|
+
function a(c) {
|
|
266
|
+
var Et, Gt, _t;
|
|
267
|
+
const o = [], h = e.curveSegments !== void 0 ? e.curveSegments : 12, i = e.steps !== void 0 ? e.steps : 1, l = e.depth !== void 0 ? e.depth : 1;
|
|
268
|
+
let g = e.bevelEnabled !== void 0 ? e.bevelEnabled : !0, d = e.bevelThickness !== void 0 ? e.bevelThickness : 0.2, y = e.bevelSize !== void 0 ? e.bevelSize : d - 0.1, A = e.bevelOffset !== void 0 ? e.bevelOffset : 0, x = e.bevelSegments !== void 0 ? e.bevelSegments : 3;
|
|
269
|
+
const v = e.extrudePath, E = e.UVGenerator !== void 0 ? e.UVGenerator : De, M = (Et = e.hasTop) != null ? Et : !0, _ = (Gt = e.hasBottom) != null ? Gt : !0, R = (_t = e.hasSide) != null ? _t : !0;
|
|
270
|
+
let V, X = !1, j, $, it, N;
|
|
271
|
+
v && (V = v.getSpacedPoints(i), X = !0, g = !1, j = v.computeFrenetFrames(i, !1), $ = new z(), it = new z(), N = new z()), g || (x = 0, d = 0, y = 0, A = 0);
|
|
272
|
+
const at = c.extractPoints(h);
|
|
273
|
+
let I = at.shape;
|
|
274
|
+
const U = at.holes;
|
|
275
|
+
if (!yt.isClockWise(I)) {
|
|
276
|
+
I = I.reverse();
|
|
277
|
+
for (let u = 0, m = U.length; u < m; u++) {
|
|
278
|
+
const p = U[u];
|
|
279
|
+
yt.isClockWise(p) && (U[u] = p.reverse());
|
|
238
280
|
}
|
|
239
281
|
}
|
|
240
|
-
function
|
|
241
|
-
const
|
|
242
|
-
let
|
|
243
|
-
for (let b = 1; b <=
|
|
244
|
-
const
|
|
282
|
+
function ht(u) {
|
|
283
|
+
const p = 10000000000000001e-36;
|
|
284
|
+
let w = u[0];
|
|
285
|
+
for (let b = 1; b <= u.length; b++) {
|
|
286
|
+
const L = b % u.length, S = u[L], T = S.x - w.x, C = S.y - w.y, G = T * T + C * C, H = Math.max(
|
|
287
|
+
Math.abs(S.x),
|
|
288
|
+
Math.abs(S.y),
|
|
245
289
|
Math.abs(w.x),
|
|
246
|
-
Math.abs(w.y)
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (G <= Q) {
|
|
251
|
-
l.splice(M, 1), b--;
|
|
290
|
+
Math.abs(w.y)
|
|
291
|
+
), st = p * H * H;
|
|
292
|
+
if (G <= st) {
|
|
293
|
+
u.splice(L, 1), b--;
|
|
252
294
|
continue;
|
|
253
295
|
}
|
|
254
|
-
|
|
296
|
+
w = S;
|
|
255
297
|
}
|
|
256
298
|
}
|
|
257
|
-
|
|
258
|
-
const
|
|
259
|
-
for (let
|
|
260
|
-
const
|
|
261
|
-
|
|
299
|
+
ht(I), U.forEach(ht);
|
|
300
|
+
const tt = U.length, B = I;
|
|
301
|
+
for (let u = 0; u < tt; u++) {
|
|
302
|
+
const m = U[u];
|
|
303
|
+
I = I.concat(m);
|
|
262
304
|
}
|
|
263
|
-
function
|
|
264
|
-
return
|
|
305
|
+
function k(u, m, p) {
|
|
306
|
+
return m || error("ExtrudeGeometry: vec does not exist"), u.clone().addScaledVector(m, p);
|
|
265
307
|
}
|
|
266
|
-
const
|
|
267
|
-
function
|
|
268
|
-
let
|
|
269
|
-
const
|
|
270
|
-
if (Math.abs(
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
),
|
|
274
|
-
|
|
275
|
-
const
|
|
276
|
-
if (
|
|
277
|
-
return new P(
|
|
278
|
-
|
|
308
|
+
const D = I.length;
|
|
309
|
+
function Lt(u, m, p) {
|
|
310
|
+
let w, b, L;
|
|
311
|
+
const S = u.x - m.x, T = u.y - m.y, C = p.x - u.x, G = p.y - u.y, H = S * S + T * T, st = S * G - T * C;
|
|
312
|
+
if (Math.abs(st) > Number.EPSILON) {
|
|
313
|
+
const W = Math.sqrt(H), Pt = Math.sqrt(
|
|
314
|
+
C * C + G * G
|
|
315
|
+
), zt = m.x - T / W, jt = m.y + S / W, Qt = p.x - G / Pt, Kt = p.y + C / Pt, It = ((Qt - zt) * G - (Kt - jt) * C) / (S * G - T * C);
|
|
316
|
+
w = zt + S * It - u.x, b = jt + T * It - u.y;
|
|
317
|
+
const Ut = w * w + b * b;
|
|
318
|
+
if (Ut <= 2)
|
|
319
|
+
return new P(w, b);
|
|
320
|
+
L = Math.sqrt(Ut / 2);
|
|
279
321
|
} else {
|
|
280
|
-
let
|
|
281
|
-
|
|
322
|
+
let W = !1;
|
|
323
|
+
S > Number.EPSILON ? C > Number.EPSILON && (W = !0) : S < -Number.EPSILON ? C < -Number.EPSILON && (W = !0) : Math.sign(T) === Math.sign(G) && (W = !0), W ? (w = -T, b = S, L = Math.sqrt(H)) : (w = S, b = T, L = Math.sqrt(H / 2));
|
|
282
324
|
}
|
|
283
|
-
return new P(
|
|
325
|
+
return new P(w / L, b / L);
|
|
284
326
|
}
|
|
285
|
-
const
|
|
286
|
-
for (let
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
let
|
|
290
|
-
for (let
|
|
291
|
-
const
|
|
292
|
-
|
|
293
|
-
for (let
|
|
294
|
-
|
|
295
|
-
|
|
327
|
+
const ut = [];
|
|
328
|
+
for (let u = 0, m = B.length, p = m - 1, w = u + 1; u < m; u++, p++, w++)
|
|
329
|
+
p === m && (p = 0), w === m && (w = 0), ut[u] = Lt(B[u], B[p], B[w]);
|
|
330
|
+
const wt = [];
|
|
331
|
+
let J, dt = ut.concat();
|
|
332
|
+
for (let u = 0, m = tt; u < m; u++) {
|
|
333
|
+
const p = U[u];
|
|
334
|
+
J = [];
|
|
335
|
+
for (let w = 0, b = p.length, L = b - 1, S = w + 1; w < b; w++, L++, S++)
|
|
336
|
+
L === b && (L = 0), S === b && (S = 0), J[w] = Lt(p[w], p[L], p[S]);
|
|
337
|
+
wt.push(J), dt = dt.concat(J);
|
|
296
338
|
}
|
|
297
|
-
let
|
|
298
|
-
if (
|
|
299
|
-
|
|
339
|
+
let et;
|
|
340
|
+
if (x === 0)
|
|
341
|
+
et = yt.triangulateShape(B, U);
|
|
300
342
|
else {
|
|
301
|
-
const
|
|
302
|
-
for (let
|
|
303
|
-
const
|
|
304
|
-
for (let
|
|
305
|
-
const
|
|
306
|
-
|
|
343
|
+
const u = [], m = [];
|
|
344
|
+
for (let p = 0; p < x; p++) {
|
|
345
|
+
const w = p / x, b = d * Math.cos(w * Math.PI / 2), L = y * Math.sin(w * Math.PI / 2) + A;
|
|
346
|
+
for (let S = 0, T = B.length; S < T; S++) {
|
|
347
|
+
const C = k(B[S], ut[S], L);
|
|
348
|
+
q(C.x, C.y, -b), w === 0 && u.push(C);
|
|
307
349
|
}
|
|
308
|
-
for (let
|
|
309
|
-
const
|
|
310
|
-
|
|
350
|
+
for (let S = 0, T = tt; S < T; S++) {
|
|
351
|
+
const C = U[S];
|
|
352
|
+
J = wt[S];
|
|
311
353
|
const G = [];
|
|
312
|
-
for (let
|
|
313
|
-
const
|
|
314
|
-
W
|
|
354
|
+
for (let H = 0, st = C.length; H < st; H++) {
|
|
355
|
+
const W = k(C[H], J[H], L);
|
|
356
|
+
q(W.x, W.y, -b), w === 0 && G.push(W);
|
|
315
357
|
}
|
|
316
|
-
|
|
358
|
+
w === 0 && m.push(G);
|
|
317
359
|
}
|
|
318
360
|
}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
361
|
+
et = yt.triangulateShape(
|
|
362
|
+
u,
|
|
363
|
+
m
|
|
322
364
|
);
|
|
323
365
|
}
|
|
324
|
-
const
|
|
325
|
-
for (let
|
|
326
|
-
const
|
|
327
|
-
|
|
366
|
+
const ft = et.length, Tt = y + A;
|
|
367
|
+
for (let u = 0; u < D; u++) {
|
|
368
|
+
const m = g ? k(I[u], dt[u], Tt) : I[u];
|
|
369
|
+
X ? (it.copy(j.normals[0]).multiplyScalar(m.x), $.copy(j.binormals[0]).multiplyScalar(m.y), N.copy(V[0]).add(it).add($), q(N.x, N.y, N.z)) : q(m.x, m.y, 0);
|
|
328
370
|
}
|
|
329
|
-
for (let
|
|
330
|
-
for (let
|
|
331
|
-
const
|
|
332
|
-
|
|
371
|
+
for (let u = 1; u <= i; u++)
|
|
372
|
+
for (let m = 0; m < D; m++) {
|
|
373
|
+
const p = g ? k(I[m], dt[m], Tt) : I[m];
|
|
374
|
+
X ? (it.copy(j.normals[u]).multiplyScalar(p.x), $.copy(j.binormals[u]).multiplyScalar(p.y), N.copy(V[u]).add(it).add($), q(N.x, N.y, N.z)) : q(p.x, p.y, l / i * u);
|
|
333
375
|
}
|
|
334
|
-
for (let
|
|
335
|
-
const
|
|
336
|
-
for (let b = 0,
|
|
337
|
-
const
|
|
338
|
-
|
|
376
|
+
for (let u = x - 1; u >= 0; u--) {
|
|
377
|
+
const m = u / x, p = d * Math.cos(m * Math.PI / 2), w = y * Math.sin(m * Math.PI / 2) + A;
|
|
378
|
+
for (let b = 0, L = B.length; b < L; b++) {
|
|
379
|
+
const S = k(B[b], ut[b], w);
|
|
380
|
+
q(S.x, S.y, l + p);
|
|
339
381
|
}
|
|
340
|
-
for (let b = 0,
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
for (let T = 0,
|
|
344
|
-
const G =
|
|
345
|
-
|
|
382
|
+
for (let b = 0, L = U.length; b < L; b++) {
|
|
383
|
+
const S = U[b];
|
|
384
|
+
J = wt[b];
|
|
385
|
+
for (let T = 0, C = S.length; T < C; T++) {
|
|
386
|
+
const G = k(S[T], J[T], w);
|
|
387
|
+
X ? q(
|
|
346
388
|
G.x,
|
|
347
|
-
G.y +
|
|
348
|
-
|
|
349
|
-
) :
|
|
389
|
+
G.y + V[i - 1].y,
|
|
390
|
+
V[i - 1].x + p
|
|
391
|
+
) : q(G.x, G.y, l + p);
|
|
350
392
|
}
|
|
351
393
|
}
|
|
352
394
|
}
|
|
353
|
-
|
|
354
|
-
function
|
|
355
|
-
const
|
|
395
|
+
Zt(), R && $t();
|
|
396
|
+
function Zt() {
|
|
397
|
+
const u = n.length / 3;
|
|
356
398
|
if (g) {
|
|
357
|
-
let
|
|
358
|
-
if (
|
|
359
|
-
for (let
|
|
360
|
-
const b =
|
|
361
|
-
|
|
399
|
+
let m = 0, p = D * m;
|
|
400
|
+
if (_)
|
|
401
|
+
for (let w = 0; w < ft; w++) {
|
|
402
|
+
const b = et[w];
|
|
403
|
+
mt(b[2] + p, b[1] + p, b[0] + p);
|
|
362
404
|
}
|
|
363
|
-
if (
|
|
364
|
-
for (let
|
|
365
|
-
const b =
|
|
366
|
-
|
|
405
|
+
if (m = i + x * 2, p = D * m, M)
|
|
406
|
+
for (let w = 0; w < ft; w++) {
|
|
407
|
+
const b = et[w];
|
|
408
|
+
mt(b[0] + p, b[1] + p, b[2] + p);
|
|
367
409
|
}
|
|
368
410
|
} else {
|
|
369
|
-
if (
|
|
370
|
-
for (let
|
|
371
|
-
const
|
|
372
|
-
|
|
411
|
+
if (_)
|
|
412
|
+
for (let m = 0; m < ft; m++) {
|
|
413
|
+
const p = et[m];
|
|
414
|
+
mt(p[2], p[1], p[0]);
|
|
373
415
|
}
|
|
374
|
-
if (
|
|
375
|
-
for (let
|
|
376
|
-
const
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
416
|
+
if (M)
|
|
417
|
+
for (let m = 0; m < ft; m++) {
|
|
418
|
+
const p = et[m];
|
|
419
|
+
mt(
|
|
420
|
+
p[0] + D * i,
|
|
421
|
+
p[1] + D * i,
|
|
422
|
+
p[2] + D * i
|
|
381
423
|
);
|
|
382
424
|
}
|
|
383
425
|
}
|
|
384
|
-
|
|
426
|
+
s.addGroup(u, n.length / 3 - u, 0);
|
|
385
427
|
}
|
|
386
|
-
function
|
|
387
|
-
const
|
|
388
|
-
let
|
|
389
|
-
|
|
390
|
-
for (let
|
|
391
|
-
const b =
|
|
392
|
-
|
|
428
|
+
function $t() {
|
|
429
|
+
const u = n.length / 3;
|
|
430
|
+
let m = 0;
|
|
431
|
+
Ct(B, m), m += B.length;
|
|
432
|
+
for (let p = 0, w = U.length; p < w; p++) {
|
|
433
|
+
const b = U[p];
|
|
434
|
+
Ct(b, m), m += b.length;
|
|
393
435
|
}
|
|
394
|
-
|
|
436
|
+
s.addGroup(u, n.length / 3 - u, 1);
|
|
395
437
|
}
|
|
396
|
-
function
|
|
397
|
-
let
|
|
398
|
-
for (; --
|
|
399
|
-
const
|
|
400
|
-
let b =
|
|
401
|
-
b < 0 && (b =
|
|
402
|
-
for (let
|
|
403
|
-
const T =
|
|
404
|
-
|
|
438
|
+
function Ct(u, m) {
|
|
439
|
+
let p = u.length;
|
|
440
|
+
for (; --p >= 0; ) {
|
|
441
|
+
const w = p;
|
|
442
|
+
let b = p - 1;
|
|
443
|
+
b < 0 && (b = u.length - 1);
|
|
444
|
+
for (let L = 0, S = i + x * 2; L < S; L++) {
|
|
445
|
+
const T = D * L, C = D * (L + 1), G = m + w + T, H = m + b + T, st = m + b + C, W = m + w + C;
|
|
446
|
+
Jt(G, H, st, W);
|
|
405
447
|
}
|
|
406
448
|
}
|
|
407
449
|
}
|
|
408
|
-
function
|
|
409
|
-
|
|
450
|
+
function q(u, m, p) {
|
|
451
|
+
o.push(u), o.push(m), o.push(p);
|
|
410
452
|
}
|
|
411
|
-
function
|
|
412
|
-
|
|
413
|
-
const
|
|
414
|
-
n,
|
|
453
|
+
function mt(u, m, p) {
|
|
454
|
+
Y(u), Y(m), Y(p);
|
|
455
|
+
const w = n.length / 3, b = E.generateTopUV(
|
|
415
456
|
s,
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
457
|
+
n,
|
|
458
|
+
w - 3,
|
|
459
|
+
w - 2,
|
|
460
|
+
w - 1
|
|
419
461
|
);
|
|
420
|
-
|
|
462
|
+
Z(b[0]), Z(b[1]), Z(b[2]);
|
|
421
463
|
}
|
|
422
|
-
function
|
|
423
|
-
|
|
424
|
-
const b =
|
|
425
|
-
n,
|
|
464
|
+
function Jt(u, m, p, w) {
|
|
465
|
+
Y(u), Y(m), Y(w), Y(m), Y(p), Y(w);
|
|
466
|
+
const b = n.length / 3, L = E.generateSideWallUV(
|
|
426
467
|
s,
|
|
468
|
+
n,
|
|
427
469
|
b - 6,
|
|
428
470
|
b - 3,
|
|
429
471
|
b - 2,
|
|
430
472
|
b - 1
|
|
431
473
|
);
|
|
432
|
-
|
|
474
|
+
Z(L[0]), Z(L[1]), Z(L[3]), Z(L[1]), Z(L[2]), Z(L[3]);
|
|
433
475
|
}
|
|
434
|
-
function
|
|
435
|
-
|
|
476
|
+
function Y(u) {
|
|
477
|
+
n.push(o[u * 3 + 0]), n.push(o[u * 3 + 1]), n.push(o[u * 3 + 2]);
|
|
436
478
|
}
|
|
437
|
-
function
|
|
438
|
-
|
|
479
|
+
function Z(u) {
|
|
480
|
+
r.push(u.x), r.push(u.y);
|
|
439
481
|
}
|
|
440
482
|
}
|
|
441
483
|
}
|
|
442
|
-
copy(
|
|
443
|
-
return super.copy(
|
|
484
|
+
copy(t) {
|
|
485
|
+
return super.copy(t), this.parameters = Object.assign({}, t.parameters), this;
|
|
444
486
|
}
|
|
445
487
|
toJSON() {
|
|
446
|
-
const
|
|
447
|
-
return
|
|
488
|
+
const t = super.toJSON(), e = this.parameters.shapes, s = this.parameters.options;
|
|
489
|
+
return He(e, s, t);
|
|
448
490
|
}
|
|
449
491
|
/**
|
|
450
492
|
* Factory method for creating an instance of this class from the given
|
|
@@ -454,695 +496,797 @@ class K extends me {
|
|
|
454
496
|
* @param {Array<Shape>} shapes - An array of shapes.
|
|
455
497
|
* @return {ExtrudeGeometry} A new instance.
|
|
456
498
|
*/
|
|
457
|
-
static fromJSON(
|
|
458
|
-
const
|
|
459
|
-
for (let
|
|
460
|
-
const
|
|
461
|
-
|
|
499
|
+
static fromJSON(t, e) {
|
|
500
|
+
const s = [];
|
|
501
|
+
for (let r = 0, a = t.shapes.length; r < a; r++) {
|
|
502
|
+
const c = e[t.shapes[r]];
|
|
503
|
+
s.push(c);
|
|
462
504
|
}
|
|
463
|
-
const
|
|
464
|
-
return
|
|
465
|
-
|
|
466
|
-
)), new
|
|
505
|
+
const n = t.options.extrudePath;
|
|
506
|
+
return n !== void 0 && (t.options.extrudePath = new Oe[n.type]().fromJSON(
|
|
507
|
+
n
|
|
508
|
+
)), new nt(s, t.options);
|
|
467
509
|
}
|
|
468
510
|
}
|
|
469
|
-
const
|
|
470
|
-
generateTopUV: function(
|
|
471
|
-
const
|
|
511
|
+
const De = {
|
|
512
|
+
generateTopUV: function(f, t, e, s, n) {
|
|
513
|
+
const r = t[e * 3], a = t[e * 3 + 1], c = t[s * 3], o = t[s * 3 + 1], h = t[n * 3], i = t[n * 3 + 1];
|
|
472
514
|
return [
|
|
473
|
-
new P(
|
|
474
|
-
new P(
|
|
515
|
+
new P(r, a),
|
|
516
|
+
new P(c, o),
|
|
475
517
|
new P(h, i)
|
|
476
518
|
];
|
|
477
519
|
},
|
|
478
|
-
generateSideWallUV: function(
|
|
479
|
-
const a = e
|
|
480
|
-
return Math.abs(
|
|
481
|
-
new P(a, 1 -
|
|
482
|
-
new P(h, 1 -
|
|
520
|
+
generateSideWallUV: function(f, t, e, s, n, r) {
|
|
521
|
+
const a = t[e * 3], c = t[e * 3 + 1], o = t[e * 3 + 2], h = t[s * 3], i = t[s * 3 + 1], l = t[s * 3 + 2], g = t[n * 3], d = t[n * 3 + 1], y = t[n * 3 + 2], A = t[r * 3], x = t[r * 3 + 1], v = t[r * 3 + 2];
|
|
522
|
+
return Math.abs(c - i) < Math.abs(a - h) ? [
|
|
523
|
+
new P(a, 1 - o),
|
|
524
|
+
new P(h, 1 - l),
|
|
483
525
|
new P(g, 1 - y),
|
|
484
|
-
new P(
|
|
526
|
+
new P(A, 1 - v)
|
|
485
527
|
] : [
|
|
486
|
-
new P(
|
|
487
|
-
new P(i, 1 -
|
|
488
|
-
new P(
|
|
489
|
-
new P(
|
|
528
|
+
new P(c, 1 - o),
|
|
529
|
+
new P(i, 1 - l),
|
|
530
|
+
new P(d, 1 - y),
|
|
531
|
+
new P(x, 1 - v)
|
|
490
532
|
];
|
|
491
533
|
}
|
|
492
534
|
};
|
|
493
|
-
function
|
|
494
|
-
if (
|
|
495
|
-
for (let
|
|
496
|
-
const
|
|
497
|
-
|
|
535
|
+
function He(f, t, e) {
|
|
536
|
+
if (e.shapes = [], Array.isArray(f))
|
|
537
|
+
for (let s = 0, n = f.length; s < n; s++) {
|
|
538
|
+
const r = f[s];
|
|
539
|
+
e.shapes.push(r.uuid);
|
|
498
540
|
}
|
|
499
541
|
else
|
|
500
|
-
|
|
501
|
-
return
|
|
542
|
+
e.shapes.push(f.uuid);
|
|
543
|
+
return e.options = Object.assign({}, t), t.extrudePath !== void 0 && (e.options.extrudePath = t.extrudePath.toJSON()), e;
|
|
502
544
|
}
|
|
503
|
-
class
|
|
504
|
-
constructor(
|
|
505
|
-
super(
|
|
506
|
-
const
|
|
507
|
-
new
|
|
545
|
+
class We extends nt {
|
|
546
|
+
constructor(t, e) {
|
|
547
|
+
super(t, e);
|
|
548
|
+
const s = new Dt(
|
|
549
|
+
new nt(t, gt(O({}, e), {
|
|
508
550
|
hasTop: !0,
|
|
509
551
|
hasSide: !0,
|
|
510
552
|
hasBottom: !1
|
|
511
553
|
}))
|
|
512
554
|
);
|
|
513
|
-
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
const a = new
|
|
517
|
-
|
|
518
|
-
|
|
555
|
+
s.updateMatrixWorld();
|
|
556
|
+
const n = new we().setFromObject(s), r = new z();
|
|
557
|
+
n.getSize(r);
|
|
558
|
+
const a = new z(
|
|
559
|
+
n.min.x + r.x / 2,
|
|
560
|
+
n.min.y + r.y / 2,
|
|
519
561
|
0
|
|
520
562
|
);
|
|
521
|
-
let
|
|
522
|
-
if (
|
|
523
|
-
|
|
524
|
-
const
|
|
525
|
-
|
|
526
|
-
const
|
|
527
|
-
|
|
528
|
-
|
|
563
|
+
let c = e.topSegments, o = e.box3;
|
|
564
|
+
if (o) {
|
|
565
|
+
o = o.union(n);
|
|
566
|
+
const v = new z();
|
|
567
|
+
o.getSize(v);
|
|
568
|
+
const E = Math.max(
|
|
569
|
+
r.x / v.x,
|
|
570
|
+
r.y / v.y
|
|
529
571
|
);
|
|
530
|
-
|
|
572
|
+
c = Math.ceil(e.topSegments * E);
|
|
531
573
|
}
|
|
532
|
-
if (
|
|
574
|
+
if (c < 4)
|
|
533
575
|
return this;
|
|
534
|
-
const h = new
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
), i = new
|
|
576
|
+
const h = new xe(
|
|
577
|
+
r.x,
|
|
578
|
+
r.y,
|
|
579
|
+
c,
|
|
580
|
+
c
|
|
581
|
+
), i = new Dt(h);
|
|
540
582
|
i.position.set(a.x, a.y, a.z), i.updateMatrixWorld();
|
|
541
|
-
const g = new
|
|
542
|
-
|
|
583
|
+
const g = new Ie().evaluate(i, s, Ue), d = g.geometry.getAttribute("position"), y = new rt(
|
|
584
|
+
d.count * 2,
|
|
543
585
|
2
|
|
544
586
|
);
|
|
545
|
-
for (let
|
|
546
|
-
const
|
|
547
|
-
|
|
587
|
+
for (let v = 0; v < d.count; v++) {
|
|
588
|
+
const E = d.getZ(v);
|
|
589
|
+
d.setZ(v, e.depth + E);
|
|
548
590
|
}
|
|
549
|
-
if (
|
|
550
|
-
const
|
|
551
|
-
for (let
|
|
552
|
-
const
|
|
553
|
-
y.setXY(
|
|
591
|
+
if (o) {
|
|
592
|
+
const v = o.min, E = o.max, M = new z().subVectors(E, v);
|
|
593
|
+
for (let _ = 0; _ < d.count; _++) {
|
|
594
|
+
const R = d.getX(_), V = d.getY(_), X = (R - v.x) / M.x, j = (V - v.y) / M.y;
|
|
595
|
+
y.setXY(_, X, j);
|
|
554
596
|
}
|
|
555
597
|
g.geometry.setAttribute("uv", y);
|
|
556
598
|
}
|
|
557
|
-
|
|
558
|
-
const
|
|
599
|
+
d.needsUpdate = !0;
|
|
600
|
+
const A = new nt(t, gt(O({}, e), {
|
|
559
601
|
hasTop: !1
|
|
560
|
-
})),
|
|
561
|
-
this.copy(
|
|
602
|
+
})), x = F([g.geometry, A], 2);
|
|
603
|
+
this.copy(x.toNonIndexed());
|
|
562
604
|
}
|
|
563
605
|
}
|
|
564
|
-
const
|
|
606
|
+
const Wt = (f) => {
|
|
565
607
|
const {
|
|
566
|
-
split:
|
|
567
|
-
depth:
|
|
568
|
-
points:
|
|
569
|
-
box3:
|
|
570
|
-
hasTop:
|
|
608
|
+
split: t,
|
|
609
|
+
depth: e,
|
|
610
|
+
points: s,
|
|
611
|
+
box3: n,
|
|
612
|
+
hasTop: r,
|
|
571
613
|
hasBottom: a,
|
|
572
|
-
hasSide:
|
|
573
|
-
sideRepeat:
|
|
614
|
+
hasSide: c,
|
|
615
|
+
sideRepeat: o,
|
|
574
616
|
topSegments: h
|
|
575
|
-
} =
|
|
576
|
-
depth:
|
|
617
|
+
} = f, i = h ? We : nt, l = new i(new St(s), {
|
|
618
|
+
depth: e,
|
|
577
619
|
bevelEnabled: !1,
|
|
578
|
-
box3:
|
|
579
|
-
UVGenerator:
|
|
580
|
-
split:
|
|
581
|
-
box3:
|
|
582
|
-
sideRepeat:
|
|
620
|
+
box3: n,
|
|
621
|
+
UVGenerator: ze({
|
|
622
|
+
split: t,
|
|
623
|
+
box3: n,
|
|
624
|
+
sideRepeat: o
|
|
583
625
|
}),
|
|
584
|
-
hasTop:
|
|
626
|
+
hasTop: r,
|
|
585
627
|
hasBottom: a,
|
|
586
|
-
hasSide:
|
|
628
|
+
hasSide: c,
|
|
587
629
|
topSegments: h
|
|
588
630
|
});
|
|
589
|
-
return
|
|
631
|
+
return je(), l;
|
|
590
632
|
};
|
|
591
|
-
class
|
|
592
|
-
constructor(
|
|
593
|
-
super(), this.options =
|
|
633
|
+
class ns extends K {
|
|
634
|
+
constructor(t) {
|
|
635
|
+
super(), this.options = O({
|
|
594
636
|
depth: 1
|
|
595
|
-
},
|
|
637
|
+
}, t);
|
|
596
638
|
}
|
|
597
639
|
create() {
|
|
598
|
-
return
|
|
640
|
+
return ct(this, null, function* () {
|
|
599
641
|
const {
|
|
600
|
-
points:
|
|
601
|
-
pointsArr:
|
|
602
|
-
useGroups:
|
|
603
|
-
depth:
|
|
604
|
-
geometry:
|
|
642
|
+
points: t,
|
|
643
|
+
pointsArr: e,
|
|
644
|
+
useGroups: s,
|
|
645
|
+
depth: n,
|
|
646
|
+
geometry: r,
|
|
605
647
|
geometryArr: a,
|
|
606
|
-
material:
|
|
607
|
-
box3:
|
|
648
|
+
material: c,
|
|
649
|
+
box3: o,
|
|
608
650
|
split: h,
|
|
609
651
|
hasTop: i,
|
|
610
|
-
hasBottom:
|
|
652
|
+
hasBottom: l,
|
|
611
653
|
hasSide: g
|
|
612
|
-
} = this.options,
|
|
613
|
-
let
|
|
614
|
-
|
|
615
|
-
points:
|
|
616
|
-
depth:
|
|
654
|
+
} = this.options, d = Array.isArray(n) ? n : [n], y = Array.isArray(o) ? o : [o], A = c;
|
|
655
|
+
let x = r;
|
|
656
|
+
A || console.log("material is null"), !x && t ? x = Wt({
|
|
657
|
+
points: t,
|
|
658
|
+
depth: d[0],
|
|
617
659
|
box3: y[0],
|
|
618
660
|
split: h,
|
|
619
661
|
hasTop: i,
|
|
620
|
-
hasBottom:
|
|
662
|
+
hasBottom: l,
|
|
621
663
|
hasSide: g
|
|
622
|
-
}) : !
|
|
623
|
-
|
|
624
|
-
(
|
|
625
|
-
var
|
|
626
|
-
return
|
|
627
|
-
points:
|
|
628
|
-
depth: (
|
|
629
|
-
box3: (
|
|
664
|
+
}) : !x && e ? x = F(
|
|
665
|
+
e.map(
|
|
666
|
+
(v, E) => {
|
|
667
|
+
var M, _;
|
|
668
|
+
return Wt({
|
|
669
|
+
points: v,
|
|
670
|
+
depth: (M = d[E]) != null ? M : d[0],
|
|
671
|
+
box3: (_ = y[E]) != null ? _ : y[0],
|
|
630
672
|
split: h,
|
|
631
673
|
hasTop: i,
|
|
632
|
-
hasBottom:
|
|
674
|
+
hasBottom: l,
|
|
633
675
|
hasSide: g
|
|
634
676
|
});
|
|
635
677
|
}
|
|
636
678
|
),
|
|
637
|
-
|
|
638
|
-
) : !
|
|
679
|
+
s != null ? s : 0
|
|
680
|
+
) : !x && a && a.length > 1 ? x = F(a, s != null ? s : 0) : !x && a && a.length === 1 && ([x] = a), this.createMesh(x, A);
|
|
639
681
|
});
|
|
640
682
|
}
|
|
641
|
-
addGeometries(
|
|
642
|
-
const
|
|
643
|
-
|
|
683
|
+
addGeometries(t) {
|
|
684
|
+
const e = this.object3d, s = F([e.geometry, ...t]);
|
|
685
|
+
e.geometry = s;
|
|
644
686
|
}
|
|
645
|
-
setTextureAnisotropic(
|
|
646
|
-
|
|
687
|
+
setTextureAnisotropic(t, e) {
|
|
688
|
+
t.anisotropy = e || this.pencil.renderer.capabilities.getMaxAnisotropy();
|
|
647
689
|
}
|
|
648
690
|
}
|
|
649
|
-
const
|
|
691
|
+
const is = (f) => {
|
|
650
692
|
const {
|
|
651
|
-
topColor:
|
|
652
|
-
sideColor:
|
|
653
|
-
sideMap:
|
|
654
|
-
createCanvasObjectURL:
|
|
655
|
-
split:
|
|
693
|
+
topColor: t,
|
|
694
|
+
sideColor: e,
|
|
695
|
+
sideMap: s,
|
|
696
|
+
createCanvasObjectURL: n,
|
|
697
|
+
split: r,
|
|
656
698
|
maxAnisotropy: a
|
|
657
|
-
} =
|
|
658
|
-
return new Promise((
|
|
659
|
-
const
|
|
699
|
+
} = f;
|
|
700
|
+
return new Promise((c) => {
|
|
701
|
+
const o = s ? document.createElement("img") : {
|
|
660
702
|
src: "",
|
|
661
703
|
onload: () => {
|
|
662
704
|
},
|
|
663
705
|
width: 128,
|
|
664
706
|
height: 128
|
|
665
707
|
};
|
|
666
|
-
|
|
667
|
-
const h =
|
|
668
|
-
i.height =
|
|
669
|
-
console.log(URL.createObjectURL(
|
|
708
|
+
o.onload = () => {
|
|
709
|
+
const h = r, i = document.createElement("canvas"), l = i.getContext("2d");
|
|
710
|
+
i.height = o.height / (1 - h), i.width = o.width, h && t && (l.fillStyle = t, l.fillRect(0, 0, o.width, i.height * h)), s && o instanceof HTMLImageElement ? l.drawImage(o, 0, i.height * h, o.width, o.height) : e && (l.fillStyle = e, l.fillRect(0, i.height * h, o.width, o.height)), n && i.toBlob((d) => {
|
|
711
|
+
console.log(URL.createObjectURL(d));
|
|
670
712
|
});
|
|
671
|
-
const g = new
|
|
672
|
-
|
|
673
|
-
},
|
|
713
|
+
const g = new ve(i);
|
|
714
|
+
c(g);
|
|
715
|
+
}, s ? o.src = s : o instanceof HTMLImageElement || o.onload();
|
|
674
716
|
});
|
|
675
717
|
};
|
|
676
|
-
class
|
|
718
|
+
class os extends K {
|
|
677
719
|
create() {
|
|
678
720
|
this.createGroup();
|
|
679
721
|
}
|
|
722
|
+
render() {
|
|
723
|
+
this.object3d.raycast = (t, e) => t.intersectObjects(
|
|
724
|
+
this.object3d.children,
|
|
725
|
+
!0,
|
|
726
|
+
e
|
|
727
|
+
);
|
|
728
|
+
}
|
|
680
729
|
}
|
|
681
|
-
class
|
|
682
|
-
constructor(
|
|
683
|
-
super(), this.rectAreaLightUniformsLibInit = !1, this.options =
|
|
730
|
+
class rs extends K {
|
|
731
|
+
constructor(t) {
|
|
732
|
+
super(), this.rectAreaLightUniformsLibInit = !1, this.options = t;
|
|
684
733
|
}
|
|
685
734
|
create() {
|
|
686
|
-
var
|
|
687
|
-
const
|
|
688
|
-
if (
|
|
689
|
-
const
|
|
690
|
-
|
|
691
|
-
} else if (
|
|
692
|
-
const
|
|
693
|
-
|
|
694
|
-
} else if (
|
|
695
|
-
const
|
|
696
|
-
(
|
|
697
|
-
(
|
|
698
|
-
(
|
|
699
|
-
(
|
|
735
|
+
var e, s, n, r, a, c, o, h, i, l, g, d, y, A, x, v, E;
|
|
736
|
+
const t = this.options;
|
|
737
|
+
if (t.type === "AmbientLight") {
|
|
738
|
+
const M = new Me(t.color);
|
|
739
|
+
M.name = "环境光", this.object3d = M;
|
|
740
|
+
} else if (t.type === "DirectionalLight") {
|
|
741
|
+
const M = new Se(t.color, t.intensity);
|
|
742
|
+
M.name = "平行光", M.target.position.set(0, 0, 0), this.object3d = M, M.target.name = "平行光目标", M.shadow.camera.name = "平行光阴影相机", M.shadow.camera.userData.directionalLightShadow = !0, this.directionalLight = M;
|
|
743
|
+
} else if (t.type === "PointLight") {
|
|
744
|
+
const M = new Ae(
|
|
745
|
+
(e = t.color) != null ? e : 16777215,
|
|
746
|
+
(s = t.intensity) != null ? s : 1,
|
|
747
|
+
(n = t.distance) != null ? n : 0,
|
|
748
|
+
(r = t.decay) != null ? r : 2
|
|
700
749
|
);
|
|
701
|
-
|
|
702
|
-
} else if (
|
|
703
|
-
const
|
|
704
|
-
(a =
|
|
705
|
-
(
|
|
706
|
-
(
|
|
707
|
-
(h =
|
|
708
|
-
(i =
|
|
709
|
-
(
|
|
750
|
+
M.name = "点光源", this.object3d = M, this.pointLight = M;
|
|
751
|
+
} else if (t.type === "SpotLight") {
|
|
752
|
+
const M = new Le(
|
|
753
|
+
(a = t.color) != null ? a : 16777215,
|
|
754
|
+
(c = t.intensity) != null ? c : 1,
|
|
755
|
+
(o = t.distance) != null ? o : 0,
|
|
756
|
+
(h = t.angle) != null ? h : Math.PI / 3,
|
|
757
|
+
(i = t.penumbra) != null ? i : 1,
|
|
758
|
+
(l = t.decay) != null ? l : 2
|
|
710
759
|
);
|
|
711
|
-
|
|
712
|
-
} else if (
|
|
713
|
-
const
|
|
714
|
-
(g =
|
|
715
|
-
(
|
|
716
|
-
(y =
|
|
760
|
+
M.name = "聚光灯", this.object3d = M, this.spotLight = M, M.target.name = "聚光灯目标";
|
|
761
|
+
} else if (t.type === "HemisphereLight") {
|
|
762
|
+
const M = new Te(
|
|
763
|
+
(g = t.color) != null ? g : 16777215,
|
|
764
|
+
(d = t.groundColor) != null ? d : 16777215,
|
|
765
|
+
(y = t.intensity) != null ? y : 1
|
|
717
766
|
);
|
|
718
|
-
|
|
719
|
-
} else if (
|
|
720
|
-
this.rectAreaLightUniformsLibInit || (
|
|
721
|
-
const
|
|
722
|
-
(
|
|
723
|
-
(
|
|
724
|
-
(
|
|
725
|
-
(
|
|
767
|
+
M.name = "半球光", this.object3d = M, this.hemisphereLight = M;
|
|
768
|
+
} else if (t.type === "RectAreaLight") {
|
|
769
|
+
this.rectAreaLightUniformsLibInit || (Be.init(), this.rectAreaLightUniformsLibInit = !0);
|
|
770
|
+
const M = new Ce(
|
|
771
|
+
(A = t.color) != null ? A : 16777215,
|
|
772
|
+
(x = t.intensity) != null ? x : 1,
|
|
773
|
+
(v = t.width) != null ? v : 10,
|
|
774
|
+
(E = t.height) != null ? E : 10
|
|
726
775
|
);
|
|
727
|
-
|
|
776
|
+
M.name = "矩形区域光", this.object3d = M, this.rectAreaLight = M;
|
|
728
777
|
}
|
|
729
778
|
}
|
|
730
779
|
render() {
|
|
731
|
-
const
|
|
732
|
-
|
|
733
|
-
const
|
|
780
|
+
const t = this.object3d;
|
|
781
|
+
t.target && this.pencil.scene.add(t.target);
|
|
782
|
+
const e = this.pencil.cameraTarget;
|
|
734
783
|
if (this.spotLight || this.directionalLight) {
|
|
735
|
-
const
|
|
736
|
-
|
|
737
|
-
} else this.pointLight && this.pointLight.position.copy(
|
|
784
|
+
const s = this.spotLight || this.directionalLight;
|
|
785
|
+
s.position.copy(e), s.target.position.copy(e);
|
|
786
|
+
} else this.pointLight && this.pointLight.position.copy(e);
|
|
738
787
|
}
|
|
739
788
|
dispose() {
|
|
740
|
-
const
|
|
741
|
-
|
|
789
|
+
const t = this.object3d;
|
|
790
|
+
t.target && this.pencil.scene.remove(t.target), super.dispose();
|
|
742
791
|
}
|
|
743
792
|
}
|
|
744
|
-
class
|
|
745
|
-
constructor(
|
|
746
|
-
super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (
|
|
747
|
-
}
|
|
748
|
-
convertToVector3Array(
|
|
749
|
-
if (typeof
|
|
750
|
-
const
|
|
751
|
-
for (let
|
|
752
|
-
|
|
753
|
-
return
|
|
793
|
+
class Ne extends lt {
|
|
794
|
+
constructor(t = [], e = "none", s) {
|
|
795
|
+
super(), this.type = "MeshLineGeometry", this.pointCount = 0, this._points = [], this.shape = "none", this.shapeFunction = (n) => 1, this.matrixWorld = new Ft(), this.shape = e, s && (this.shapeFunction = s), t.length > 0 && this.setPoints(t);
|
|
796
|
+
}
|
|
797
|
+
convertToVector3Array(t) {
|
|
798
|
+
if (typeof t[0] == "number") {
|
|
799
|
+
const e = [], s = t;
|
|
800
|
+
for (let n = 0; n < s.length; n += 3)
|
|
801
|
+
e.push(new z(s[n], s[n + 1], s[n + 2]));
|
|
802
|
+
return e;
|
|
754
803
|
} else
|
|
755
|
-
return
|
|
756
|
-
if (
|
|
757
|
-
return new
|
|
758
|
-
if (
|
|
759
|
-
return
|
|
760
|
-
if (Array.isArray(
|
|
761
|
-
return new
|
|
762
|
-
if (Array.isArray(
|
|
763
|
-
return new
|
|
804
|
+
return t.map((e) => {
|
|
805
|
+
if (e instanceof P)
|
|
806
|
+
return new z(e.x, e.y, 0);
|
|
807
|
+
if (e instanceof z)
|
|
808
|
+
return e;
|
|
809
|
+
if (Array.isArray(e) && e.length === 2)
|
|
810
|
+
return new z(e[0], e[1], 0);
|
|
811
|
+
if (Array.isArray(e) && e.length === 3)
|
|
812
|
+
return new z(e[0], e[1], e[2]);
|
|
764
813
|
}).filter(Boolean);
|
|
765
814
|
}
|
|
766
|
-
setMatrixWorld(
|
|
767
|
-
this.matrixWorld =
|
|
815
|
+
setMatrixWorld(t) {
|
|
816
|
+
this.matrixWorld = t;
|
|
768
817
|
}
|
|
769
|
-
setPoints(
|
|
770
|
-
!
|
|
818
|
+
setPoints(t, e) {
|
|
819
|
+
!t || t.length === 0 || (this._points = this.convertToVector3Array(t), this.pointCount = this._points.length, e && (this.shapeFunction = e, this.shape = "custom"), this.initializeGeometry(), this.updateGeometry());
|
|
771
820
|
}
|
|
772
821
|
initializeGeometry() {
|
|
773
|
-
const
|
|
822
|
+
const t = new Q(
|
|
774
823
|
new Float32Array(this.pointCount * 6),
|
|
775
824
|
3
|
|
776
|
-
),
|
|
825
|
+
), e = new Q(
|
|
777
826
|
new Float32Array(this.pointCount * 6),
|
|
778
827
|
3
|
|
779
|
-
),
|
|
828
|
+
), s = new Q(new Float32Array(this.pointCount * 6), 3), n = new Q(
|
|
780
829
|
new Float32Array(this.pointCount * 2),
|
|
781
830
|
1
|
|
782
|
-
),
|
|
831
|
+
), r = new Q(new Float32Array(this.pointCount * 2), 1), a = new Q(new Float32Array(this.pointCount * 2), 1), c = new Q(new Float32Array(this.pointCount * 4), 2), o = new Q(
|
|
783
832
|
new Uint16Array((this.pointCount - 1) * 6),
|
|
784
833
|
1
|
|
785
834
|
);
|
|
786
835
|
this.shape === "taper" && (this.shapeFunction = (h) => 1 * Math.pow(4 * h * (1 - h), 1));
|
|
787
|
-
for (let h = 0, i = 0,
|
|
788
|
-
|
|
836
|
+
for (let h = 0, i = 0, l = 0; h < this.pointCount; h += 1, i += 2, l += 6) {
|
|
837
|
+
n.setX(i, h / this.pointCount), n.setX(i + 1, h / this.pointCount), r.setX(i, 1), r.setX(i + 1, -1);
|
|
789
838
|
const g = this.shape === "none" ? 1 : this.shapeFunction(h / (this.pointCount - 1));
|
|
790
839
|
a.setX(i, g), a.setX(i + 1, g);
|
|
791
|
-
const
|
|
792
|
-
if (
|
|
840
|
+
const d = h / (this.pointCount - 1);
|
|
841
|
+
if (c.setXY(i, d, 0), c.setXY(i + 1, d, 1), h < this.pointCount - 1) {
|
|
793
842
|
const y = h * 2;
|
|
794
|
-
|
|
843
|
+
o.setX(l + 0, y + 0), o.setX(l + 1, y + 1), o.setX(l + 2, y + 2), o.setX(l + 3, y + 2), o.setX(l + 4, y + 1), o.setX(l + 5, y + 3);
|
|
795
844
|
}
|
|
796
845
|
}
|
|
797
|
-
this.setAttribute("position",
|
|
846
|
+
this.setAttribute("position", t), this.setAttribute("previous", e), this.setAttribute("next", s), this.setAttribute("counters", n), this.setAttribute("side", r), this.setAttribute("width", a), this.setAttribute("uv", c), this.setIndex(o);
|
|
798
847
|
}
|
|
799
848
|
updateGeometry() {
|
|
800
849
|
if (!this._points[0]) return;
|
|
801
|
-
const
|
|
802
|
-
let
|
|
803
|
-
const
|
|
804
|
-
|
|
850
|
+
const t = this.getAttribute("position"), e = this.getAttribute("previous"), s = this.getAttribute("next");
|
|
851
|
+
let n = 0, r = 0, a = 0;
|
|
852
|
+
const c = this._points[0];
|
|
853
|
+
e.setXYZ(r, c.x, c.y, c.z), r += 1, e.setXYZ(r, c.x, c.y, c.z), r += 1;
|
|
805
854
|
for (let h = 0; h < this.pointCount; h++) {
|
|
806
855
|
const i = this._points[h];
|
|
807
|
-
|
|
856
|
+
t.setXYZ(n, i.x, i.y, i.z), n += 1, t.setXYZ(n, i.x, i.y, i.z), n += 1, h < this.pointCount - 1 && (e.setXYZ(r, i.x, i.y, i.z), r += 1, e.setXYZ(r, i.x, i.y, i.z), r += 1), h > 0 && h + 1 <= this.pointCount && (s.setXYZ(a, i.x, i.y, i.z), a += 1, s.setXYZ(a, i.x, i.y, i.z), a += 1);
|
|
808
857
|
}
|
|
809
|
-
const
|
|
810
|
-
|
|
858
|
+
const o = this._points[this.pointCount - 1];
|
|
859
|
+
s.setXYZ(a, o.x, o.y, o.z), a += 1, s.setXYZ(a, o.x, o.y, o.z), a += 1, t.needsUpdate = !0, e.needsUpdate = !0, s.needsUpdate = !0, this.computeBoundingSphere(), this.computeBoundingBox();
|
|
811
860
|
}
|
|
812
861
|
get points() {
|
|
813
862
|
return this._points;
|
|
814
863
|
}
|
|
815
|
-
set points(
|
|
816
|
-
this.setPoints(
|
|
864
|
+
set points(t) {
|
|
865
|
+
this.setPoints(t);
|
|
817
866
|
}
|
|
818
|
-
updatePoints(
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
867
|
+
updatePoints(t, e) {
|
|
868
|
+
const s = this.convertToVector3Array(t);
|
|
869
|
+
if (s.length !== this.pointCount) {
|
|
821
870
|
console.warn(
|
|
822
871
|
"MeshLineGeometry: Cannot update points with different length. Use setPoints() instead."
|
|
823
872
|
);
|
|
824
873
|
return;
|
|
825
874
|
}
|
|
826
|
-
this._points =
|
|
875
|
+
this._points = s, e && (this.shapeFunction = e, this.shape = "custom", this.initializeGeometry()), this.updateGeometry();
|
|
827
876
|
}
|
|
828
|
-
setShape(
|
|
829
|
-
this.shape =
|
|
877
|
+
setShape(t, e) {
|
|
878
|
+
this.shape = t, e && (this.shapeFunction = e), this._points.length > 0 && (this.initializeGeometry(), this.updateGeometry());
|
|
830
879
|
}
|
|
831
880
|
}
|
|
832
|
-
function
|
|
833
|
-
const
|
|
834
|
-
if (
|
|
835
|
-
|
|
836
|
-
const
|
|
837
|
-
if (
|
|
838
|
-
const
|
|
839
|
-
for (let
|
|
840
|
-
const
|
|
841
|
-
|
|
842
|
-
const
|
|
843
|
-
if (
|
|
844
|
-
|
|
845
|
-
r,
|
|
881
|
+
function as(f, t) {
|
|
882
|
+
const e = new Ft(), s = new Ee(), n = new Ge(), r = new z(), a = this.geometry;
|
|
883
|
+
if (n.copy(a.boundingSphere), n.applyMatrix4(this.matrixWorld), !f.ray.intersectSphere(n, r)) return;
|
|
884
|
+
e.copy(this.matrixWorld).invert(), s.copy(f.ray).applyMatrix4(e);
|
|
885
|
+
const c = new z(), o = new z(), h = new z(), i = this instanceof qt ? 2 : 1, l = a.index, g = a.attributes;
|
|
886
|
+
if (l !== null) {
|
|
887
|
+
const d = l.array, y = g.position.array, A = g.width.array;
|
|
888
|
+
for (let x = 0, v = d.length - 1; x < v; x += i) {
|
|
889
|
+
const E = d[x], M = d[x + 1];
|
|
890
|
+
c.fromArray(y, E * 3), o.fromArray(y, M * 3);
|
|
891
|
+
const _ = A[Math.floor(x / 3)] !== void 0 ? A[Math.floor(x / 3)] : 1, R = f.params.Line.threshold + this.material.lineWidth * _ / 2, V = R * R;
|
|
892
|
+
if (s.distanceSqToSegment(
|
|
893
|
+
c,
|
|
846
894
|
o,
|
|
895
|
+
r,
|
|
847
896
|
h
|
|
848
|
-
) >
|
|
849
|
-
|
|
850
|
-
const
|
|
851
|
-
|
|
852
|
-
distance:
|
|
897
|
+
) > V) continue;
|
|
898
|
+
r.applyMatrix4(this.matrixWorld);
|
|
899
|
+
const j = f.ray.origin.distanceTo(r);
|
|
900
|
+
j < f.near || j > f.far || (t.push({
|
|
901
|
+
distance: j,
|
|
853
902
|
// What do we want? intersection point on the ray or on the segment??
|
|
854
903
|
// point: raycaster.ray.at( distance ),
|
|
855
904
|
point: h.clone().applyMatrix4(this.matrixWorld),
|
|
856
|
-
index:
|
|
905
|
+
index: x,
|
|
857
906
|
face: null,
|
|
858
907
|
faceIndex: void 0,
|
|
859
908
|
object: this
|
|
860
|
-
}),
|
|
909
|
+
}), x = v);
|
|
861
910
|
}
|
|
862
911
|
}
|
|
863
912
|
}
|
|
864
|
-
const
|
|
865
|
-
const { setPointWidth:
|
|
866
|
-
return
|
|
867
|
-
},
|
|
868
|
-
let
|
|
869
|
-
constructor(
|
|
870
|
-
super(), this.options =
|
|
913
|
+
const Mt = (f) => {
|
|
914
|
+
const { setPointWidth: t, nodes: e } = f, s = new Ne();
|
|
915
|
+
return s.setPoints(e, t), s;
|
|
916
|
+
}, Nt = /* @__PURE__ */ new WeakMap(), bt = /* @__PURE__ */ new Map();
|
|
917
|
+
let cs = class extends K {
|
|
918
|
+
constructor(t = {}) {
|
|
919
|
+
super(), this.options = O({}, t);
|
|
871
920
|
}
|
|
872
921
|
get material() {
|
|
873
|
-
var
|
|
874
|
-
return (
|
|
922
|
+
var t;
|
|
923
|
+
return (t = this.object3d) == null ? void 0 : t.material;
|
|
875
924
|
}
|
|
876
925
|
create() {
|
|
877
|
-
return
|
|
926
|
+
return ct(this, null, function* () {
|
|
878
927
|
const {
|
|
879
|
-
nodes:
|
|
880
|
-
nodesArr:
|
|
881
|
-
geometry:
|
|
882
|
-
geometryArr:
|
|
883
|
-
material:
|
|
928
|
+
nodes: t,
|
|
929
|
+
nodesArr: e,
|
|
930
|
+
geometry: s,
|
|
931
|
+
geometryArr: n,
|
|
932
|
+
material: r,
|
|
884
933
|
useGroups: a,
|
|
885
|
-
setPointWidth:
|
|
886
|
-
lineWidthArr:
|
|
934
|
+
setPointWidth: c,
|
|
935
|
+
lineWidthArr: o,
|
|
887
936
|
materialParameters: h
|
|
888
937
|
} = this.options;
|
|
889
|
-
let i =
|
|
890
|
-
!i && h && (i = this.getMaterial(h)), !
|
|
891
|
-
nodes:
|
|
892
|
-
setPointWidth:
|
|
893
|
-
}) : !
|
|
894
|
-
|
|
895
|
-
let y =
|
|
896
|
-
return !y &&
|
|
897
|
-
var
|
|
898
|
-
return (
|
|
899
|
-
}),
|
|
938
|
+
let i = r, l = s;
|
|
939
|
+
!i && h && (i = this.getMaterial(h)), !l && t ? l = Mt({
|
|
940
|
+
nodes: t,
|
|
941
|
+
setPointWidth: c
|
|
942
|
+
}) : !l && e ? l = F(
|
|
943
|
+
e.map((g, d) => {
|
|
944
|
+
let y = c;
|
|
945
|
+
return !y && o && (y = () => {
|
|
946
|
+
var A;
|
|
947
|
+
return (A = o[d]) != null ? A : o[0];
|
|
948
|
+
}), Mt({
|
|
900
949
|
nodes: g,
|
|
901
950
|
setPointWidth: y
|
|
902
951
|
});
|
|
903
952
|
}),
|
|
904
953
|
a != null ? a : 0
|
|
905
|
-
) : !
|
|
954
|
+
) : !l && n && n.length > 1 ? l = F(n, a != null ? a : 0) : !l && n && n.length === 1 && ([l] = n), this.createMesh(l, i);
|
|
906
955
|
});
|
|
907
956
|
}
|
|
908
|
-
setGeometry(
|
|
909
|
-
const
|
|
910
|
-
nodes:
|
|
911
|
-
setPointWidth:
|
|
912
|
-
}),
|
|
913
|
-
|
|
914
|
-
}
|
|
915
|
-
getMaterial(
|
|
916
|
-
const { width:
|
|
917
|
-
color: new
|
|
918
|
-
},
|
|
919
|
-
return
|
|
920
|
-
}
|
|
921
|
-
addGeometries(
|
|
922
|
-
const
|
|
923
|
-
|
|
924
|
-
}
|
|
925
|
-
resize(
|
|
926
|
-
var
|
|
927
|
-
(
|
|
928
|
-
}
|
|
929
|
-
handleMaterialChange(
|
|
930
|
-
if (
|
|
931
|
-
const { width:
|
|
932
|
-
this.resize(
|
|
957
|
+
setGeometry(t, e) {
|
|
958
|
+
const s = Mt({
|
|
959
|
+
nodes: t,
|
|
960
|
+
setPointWidth: e
|
|
961
|
+
}), n = this.object3d, r = n.geometry;
|
|
962
|
+
n.geometry = s, r.dispose();
|
|
963
|
+
}
|
|
964
|
+
getMaterial(t) {
|
|
965
|
+
const { width: e, height: s } = this.pencil.getSize(), n = new re(O({
|
|
966
|
+
color: new Yt("#ffffff")
|
|
967
|
+
}, t));
|
|
968
|
+
return n.uniforms.resolution.value.set(e, s), n;
|
|
969
|
+
}
|
|
970
|
+
addGeometries(t) {
|
|
971
|
+
const e = this.object3d, s = F([e.geometry, ...t]);
|
|
972
|
+
e.geometry = s;
|
|
973
|
+
}
|
|
974
|
+
resize(t, e) {
|
|
975
|
+
var s, n;
|
|
976
|
+
(n = (s = this.material) == null ? void 0 : s.uniforms) == null || n.resolution.value.set(t, e);
|
|
977
|
+
}
|
|
978
|
+
handleMaterialChange(t) {
|
|
979
|
+
if (t) {
|
|
980
|
+
const { width: e, height: s } = this.pencil.getSize();
|
|
981
|
+
this.resize(e, s);
|
|
933
982
|
}
|
|
934
983
|
}
|
|
935
984
|
animate({
|
|
936
|
-
duration:
|
|
937
|
-
delay:
|
|
938
|
-
repeat:
|
|
939
|
-
lineLoop:
|
|
940
|
-
onRepeat:
|
|
985
|
+
duration: t = 1e3,
|
|
986
|
+
delay: e = 0,
|
|
987
|
+
repeat: s = 0,
|
|
988
|
+
lineLoop: n,
|
|
989
|
+
onRepeat: r,
|
|
941
990
|
onUpdate: a,
|
|
942
|
-
onComplete:
|
|
943
|
-
startShow:
|
|
991
|
+
onComplete: c,
|
|
992
|
+
startShow: o
|
|
944
993
|
} = {}) {
|
|
945
|
-
const { offset: h, offsetLoop: i } = this.material.uniforms,
|
|
946
|
-
if (
|
|
947
|
-
const g =
|
|
948
|
-
h.value.x = 1, i.value = g &&
|
|
949
|
-
let
|
|
950
|
-
const y = new
|
|
951
|
-
g &&
|
|
994
|
+
const { offset: h, offsetLoop: i } = this.material.uniforms, l = this.pencil.userData.debugLine ? bt : Nt;
|
|
995
|
+
if (l.get(this.material) && this.stopAnimation(), t === 0) return;
|
|
996
|
+
const g = n != null ? n : !0;
|
|
997
|
+
h.value.x = 1, i.value = g && o ? 1 : 0;
|
|
998
|
+
let d = 0;
|
|
999
|
+
const y = new ot.Tween(h.value).to({ x: -1 }, t).delay(e).repeat(s).onUpdate(({ x: A }) => {
|
|
1000
|
+
g && A <= 0 && i.value === 0 && (i.value = 1), a == null || a(A);
|
|
952
1001
|
}).onRepeat(() => {
|
|
953
|
-
|
|
1002
|
+
d += 1, r == null || r(d);
|
|
954
1003
|
}).onComplete(() => {
|
|
955
|
-
|
|
1004
|
+
c == null || c();
|
|
956
1005
|
}).start();
|
|
957
|
-
|
|
1006
|
+
l.set(this.material, y), this.material.addEventListener("dispose", () => {
|
|
958
1007
|
this.stopAnimation();
|
|
959
|
-
}), this.pencil.userData.debugLine && console.log("animate",
|
|
1008
|
+
}), this.pencil.userData.debugLine && console.log("animate", bt.size);
|
|
960
1009
|
}
|
|
961
1010
|
stopAnimation() {
|
|
962
|
-
const
|
|
963
|
-
|
|
1011
|
+
const t = this.pencil.userData.debugLine ? bt : Nt, e = t.get(this.material);
|
|
1012
|
+
e && (e.stop(), ot.remove(e), t.delete(this.material), this.material.uniforms.offset.value.x = 0, this.material.uniforms.offsetLoop.value = 1), this.pencil.userData.debugLine && console.log("stopAnimation", bt.size);
|
|
964
1013
|
}
|
|
965
1014
|
render() {
|
|
966
|
-
const { width:
|
|
967
|
-
this.resize(
|
|
1015
|
+
const { width: t, height: e } = this.pencil.getSize();
|
|
1016
|
+
this.resize(t, e);
|
|
968
1017
|
}
|
|
969
1018
|
};
|
|
970
|
-
const
|
|
971
|
-
const { points:
|
|
972
|
-
return new
|
|
1019
|
+
const Xt = (f) => {
|
|
1020
|
+
const { points: t } = f, e = t.reduce((n, r, a) => (a < t.length - 1 && n.push(r, t[a + 1]), n), []);
|
|
1021
|
+
return new lt().setFromPoints(e);
|
|
973
1022
|
};
|
|
974
|
-
class
|
|
975
|
-
constructor(
|
|
976
|
-
super(), this.options =
|
|
1023
|
+
class hs extends K {
|
|
1024
|
+
constructor(t = {}) {
|
|
1025
|
+
super(), this.options = O({}, t);
|
|
977
1026
|
}
|
|
978
1027
|
get material() {
|
|
979
|
-
var
|
|
980
|
-
return (
|
|
1028
|
+
var t;
|
|
1029
|
+
return (t = this.object3d) == null ? void 0 : t.material;
|
|
981
1030
|
}
|
|
982
1031
|
create() {
|
|
983
|
-
return
|
|
1032
|
+
return ct(this, null, function* () {
|
|
984
1033
|
const {
|
|
985
|
-
points:
|
|
986
|
-
pointsArr:
|
|
987
|
-
geometry:
|
|
988
|
-
geometryArr:
|
|
989
|
-
material:
|
|
1034
|
+
points: t,
|
|
1035
|
+
pointsArr: e,
|
|
1036
|
+
geometry: s,
|
|
1037
|
+
geometryArr: n,
|
|
1038
|
+
material: r,
|
|
990
1039
|
useGroups: a,
|
|
991
|
-
setPointWidth:
|
|
992
|
-
lineWidthArr:
|
|
1040
|
+
setPointWidth: c,
|
|
1041
|
+
lineWidthArr: o,
|
|
993
1042
|
materialParameters: h,
|
|
994
1043
|
instanceCount: i
|
|
995
1044
|
} = this.options;
|
|
996
|
-
let
|
|
997
|
-
!
|
|
998
|
-
points:
|
|
999
|
-
}) : !g &&
|
|
1000
|
-
|
|
1045
|
+
let l = r, g = s;
|
|
1046
|
+
!l && h && (l = this.getMaterial(h)), !g && t ? g = Xt({
|
|
1047
|
+
points: t
|
|
1048
|
+
}) : !g && e ? g = F(
|
|
1049
|
+
e.map((y) => Xt({
|
|
1001
1050
|
points: y
|
|
1002
1051
|
})),
|
|
1003
1052
|
a != null ? a : 0
|
|
1004
|
-
) : !g &&
|
|
1005
|
-
const
|
|
1006
|
-
new
|
|
1053
|
+
) : !g && n && n.length > 1 ? g = F(n, a != null ? a : 0) : !g && n && n.length === 1 && ([g] = n);
|
|
1054
|
+
const d = new ie().fromLineSegments(
|
|
1055
|
+
new qt(g)
|
|
1007
1056
|
);
|
|
1008
1057
|
if (this.pencil.options.WebGPUTHREE) {
|
|
1009
|
-
i && (
|
|
1010
|
-
const y = new
|
|
1058
|
+
i && (d.instanceCount = i);
|
|
1059
|
+
const y = new ae(d, l);
|
|
1011
1060
|
y.computeLineDistances(), this.object3d = y;
|
|
1012
1061
|
} else {
|
|
1013
|
-
const y = new
|
|
1062
|
+
const y = new Re(d, l);
|
|
1014
1063
|
y.computeLineDistances(), this.object3d = y;
|
|
1015
1064
|
}
|
|
1016
1065
|
});
|
|
1017
1066
|
}
|
|
1018
|
-
getMaterial(
|
|
1019
|
-
return new
|
|
1020
|
-
color: new
|
|
1021
|
-
},
|
|
1067
|
+
getMaterial(t) {
|
|
1068
|
+
return new ne(O({
|
|
1069
|
+
color: new Yt("#ffffff")
|
|
1070
|
+
}, t));
|
|
1022
1071
|
}
|
|
1023
1072
|
}
|
|
1024
|
-
class
|
|
1025
|
-
constructor(
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1073
|
+
class us {
|
|
1074
|
+
constructor(t = {}) {
|
|
1075
|
+
this.labels = /* @__PURE__ */ new Map(), this.lastUpdateTime = 0, this.isUpdating = !1, this.options = O({
|
|
1076
|
+
padding: 4,
|
|
1077
|
+
enabled: !0,
|
|
1078
|
+
throttleTime: 16,
|
|
1079
|
+
// ~60fps
|
|
1080
|
+
viewportMargin: 50
|
|
1081
|
+
}, t);
|
|
1029
1082
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
})
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1083
|
+
/**
|
|
1084
|
+
* 添加标签到碰撞检测系统
|
|
1085
|
+
* @param node Node 实例
|
|
1086
|
+
* @param options 配置项,priority 越大越优先显示,不传则使用 node.options.priority
|
|
1087
|
+
*/
|
|
1088
|
+
add(t, e = {}) {
|
|
1089
|
+
var s, n;
|
|
1090
|
+
this.labels.set(t, {
|
|
1091
|
+
node: t,
|
|
1092
|
+
priority: (n = (s = e.priority) != null ? s : t.options.priority) != null ? n : 0,
|
|
1093
|
+
visible: !0
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* 移除标签
|
|
1098
|
+
*/
|
|
1099
|
+
remove(t) {
|
|
1100
|
+
this.labels.delete(t);
|
|
1101
|
+
}
|
|
1102
|
+
/**
|
|
1103
|
+
* 更新标签优先级
|
|
1104
|
+
*/
|
|
1105
|
+
setPriority(t, e) {
|
|
1106
|
+
const s = this.labels.get(t);
|
|
1107
|
+
s && (s.priority = e);
|
|
1108
|
+
}
|
|
1109
|
+
/**
|
|
1110
|
+
* 批量添加标签
|
|
1111
|
+
*/
|
|
1112
|
+
addBatch(t, e) {
|
|
1113
|
+
t.forEach((s, n) => {
|
|
1114
|
+
this.add(s, {
|
|
1115
|
+
priority: e ? e(s, n) : 0
|
|
1057
1116
|
});
|
|
1058
1117
|
});
|
|
1059
|
-
t.observe(e);
|
|
1060
1118
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1119
|
+
/**
|
|
1120
|
+
* 启用/禁用碰撞检测
|
|
1121
|
+
*/
|
|
1122
|
+
setEnabled(t) {
|
|
1123
|
+
this.options.enabled = t, t || this.labels.forEach((e) => {
|
|
1124
|
+
this.setNodeVisibility(e.node, !0), e.visible = !0;
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
/**
|
|
1128
|
+
* 更新碰撞检测(在渲染循环中调用)
|
|
1129
|
+
*/
|
|
1130
|
+
update(t) {
|
|
1131
|
+
if (!this.options.enabled) return;
|
|
1132
|
+
const e = performance.now();
|
|
1133
|
+
e - this.lastUpdateTime < this.options.throttleTime || (this.lastUpdateTime = e, this.camera = t, !this.isUpdating && (this.isUpdating = !0, this.animationFrameId = requestAnimationFrame(() => {
|
|
1134
|
+
this.performCollisionDetection(), this.isUpdating = !1;
|
|
1135
|
+
})));
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* 强制立即更新
|
|
1139
|
+
*/
|
|
1140
|
+
forceUpdate() {
|
|
1141
|
+
this.camera && this.performCollisionDetection();
|
|
1142
|
+
}
|
|
1143
|
+
performCollisionDetection() {
|
|
1144
|
+
const { padding: t, viewportMargin: e } = this.options, s = window.innerWidth, n = window.innerHeight, r = [];
|
|
1145
|
+
this.labels.forEach((c) => {
|
|
1146
|
+
const o = c.node.element;
|
|
1147
|
+
if (!o) return;
|
|
1148
|
+
const h = o.style.display === "none";
|
|
1149
|
+
h && (o.style.visibility = "hidden", o.style.display = "");
|
|
1150
|
+
const i = o.getBoundingClientRect();
|
|
1151
|
+
h && (o.style.display = "none", o.style.visibility = ""), i.right >= -e && i.left <= s + e && i.bottom >= -e && i.top <= n + e ? (c.bounds = i, r.push(c)) : (this.setNodeVisibility(c.node, !1), c.visible = !1);
|
|
1152
|
+
}), r.sort((c, o) => o.priority - c.priority);
|
|
1153
|
+
const a = [];
|
|
1154
|
+
for (const c of r) {
|
|
1155
|
+
if (!c.bounds) continue;
|
|
1156
|
+
this.checkCollision(
|
|
1157
|
+
c.bounds,
|
|
1158
|
+
a,
|
|
1159
|
+
t
|
|
1160
|
+
) ? (this.setNodeVisibility(c.node, !1), c.visible = !1) : (this.setNodeVisibility(c.node, !0), c.visible = !0, a.push(c.bounds));
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* 检测矩形是否与已占用区域碰撞
|
|
1165
|
+
*/
|
|
1166
|
+
checkCollision(t, e, s) {
|
|
1167
|
+
for (const n of e)
|
|
1168
|
+
if (this.rectsIntersect(t, n, s))
|
|
1169
|
+
return !0;
|
|
1170
|
+
return !1;
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* 检测两个矩形是否相交(包含 padding)
|
|
1174
|
+
*/
|
|
1175
|
+
rectsIntersect(t, e, s) {
|
|
1176
|
+
return !(t.right + s < e.left || t.left - s > e.right || t.bottom + s < e.top || t.top - s > e.bottom);
|
|
1177
|
+
}
|
|
1178
|
+
/**
|
|
1179
|
+
* 设置节点可见性
|
|
1180
|
+
*/
|
|
1181
|
+
setNodeVisibility(t, e) {
|
|
1182
|
+
const s = t.element;
|
|
1183
|
+
s && (e ? (s.style.display = "", s.style.opacity = "1") : s.style.display = "none");
|
|
1064
1184
|
}
|
|
1185
|
+
/**
|
|
1186
|
+
* 获取当前可见的标签数量
|
|
1187
|
+
*/
|
|
1188
|
+
getVisibleCount() {
|
|
1189
|
+
let t = 0;
|
|
1190
|
+
return this.labels.forEach((e) => {
|
|
1191
|
+
e.visible && t++;
|
|
1192
|
+
}), t;
|
|
1193
|
+
}
|
|
1194
|
+
/**
|
|
1195
|
+
* 获取所有标签数量
|
|
1196
|
+
*/
|
|
1197
|
+
getTotalCount() {
|
|
1198
|
+
return this.labels.size;
|
|
1199
|
+
}
|
|
1200
|
+
/**
|
|
1201
|
+
* 清空所有标签
|
|
1202
|
+
*/
|
|
1203
|
+
clear() {
|
|
1204
|
+
this.labels.clear();
|
|
1205
|
+
}
|
|
1206
|
+
/**
|
|
1207
|
+
* 销毁管理器
|
|
1208
|
+
*/
|
|
1065
1209
|
dispose() {
|
|
1066
|
-
this.
|
|
1067
|
-
this.lead.removePickNode(e);
|
|
1068
|
-
}), super.dispose();
|
|
1210
|
+
this.animationFrameId && cancelAnimationFrame(this.animationFrameId), this.labels.clear();
|
|
1069
1211
|
}
|
|
1070
1212
|
}
|
|
1071
|
-
class
|
|
1072
|
-
constructor(
|
|
1073
|
-
super(), this.options =
|
|
1213
|
+
class ds extends K {
|
|
1214
|
+
constructor(t) {
|
|
1215
|
+
super(), this.options = O({
|
|
1074
1216
|
maxDepth: 10,
|
|
1075
1217
|
percentDepth: !1,
|
|
1076
1218
|
innerRadius: 25,
|
|
1077
1219
|
outRadius: 42,
|
|
1078
1220
|
activeIndex: -1
|
|
1079
|
-
},
|
|
1221
|
+
}, t);
|
|
1080
1222
|
}
|
|
1081
1223
|
create() {
|
|
1082
|
-
return
|
|
1224
|
+
return ct(this, null, function* () {
|
|
1083
1225
|
this.createGroup();
|
|
1084
|
-
const { data:
|
|
1226
|
+
const { data: t, maxDepth: e, colors: s, material: n, percentDepth: r, activeIndex: a } = this.options, c = Math.max(...t), o = t.reduce((i, l) => i + l, 0);
|
|
1085
1227
|
let h = Math.PI / 2;
|
|
1086
|
-
|
|
1228
|
+
t.forEach((i, l) => {
|
|
1087
1229
|
if (i === 0) return;
|
|
1088
|
-
const g = Math.PI * 2 * (i /
|
|
1089
|
-
color:
|
|
1230
|
+
const g = Math.PI * 2 * (i / o), d = s[l], y = r ? e * (i / c) : e, A = this.createGeometry(y, g), x = n ? n.clone() : new _e({
|
|
1231
|
+
color: d
|
|
1090
1232
|
});
|
|
1091
|
-
|
|
1092
|
-
const
|
|
1093
|
-
|
|
1233
|
+
n && x.color.set(d);
|
|
1234
|
+
const v = new kt(A, x);
|
|
1235
|
+
v.userData.depth = y, v.userData.index = l, v.rotateZ(h), h += g, this.add(v);
|
|
1094
1236
|
}), a !== -1 && this.setActive(a);
|
|
1095
1237
|
});
|
|
1096
1238
|
}
|
|
1097
|
-
createGeometry(
|
|
1098
|
-
const { outRadius:
|
|
1099
|
-
return
|
|
1239
|
+
createGeometry(t, e) {
|
|
1240
|
+
const { outRadius: s, innerRadius: n } = this.options, r = new St();
|
|
1241
|
+
return r.moveTo(s, 0), r.lineTo(n, 0), r.absarc(0, 0, n, 0, e, !1), r.absarc(0, 0, s, e, 0, !0), new nt(r, {
|
|
1100
1242
|
curveSegments: 48,
|
|
1101
|
-
depth:
|
|
1243
|
+
depth: t,
|
|
1102
1244
|
bevelEnabled: !1
|
|
1103
1245
|
});
|
|
1104
1246
|
}
|
|
1105
|
-
handlePick(
|
|
1106
|
-
const { object:
|
|
1107
|
-
return this.setActive(
|
|
1108
|
-
}
|
|
1109
|
-
setActive(
|
|
1110
|
-
const
|
|
1111
|
-
if (this.object3d.children.forEach((
|
|
1112
|
-
if (!(
|
|
1113
|
-
if (
|
|
1114
|
-
|
|
1115
|
-
const
|
|
1116
|
-
|
|
1247
|
+
handlePick(t, e = 1.3) {
|
|
1248
|
+
const { object: s } = this.pencil.pick(t, this.object3d.children) || {}, n = s ? this.object3d.children.findIndex((r) => r === s) : this.options.activeIndex;
|
|
1249
|
+
return this.setActive(n, e);
|
|
1250
|
+
}
|
|
1251
|
+
setActive(t, e = 1.3) {
|
|
1252
|
+
const s = this.object3d.children[t];
|
|
1253
|
+
if (this.object3d.children.forEach((n) => {
|
|
1254
|
+
if (!(s && s === n) && n.scale.z !== 1) {
|
|
1255
|
+
if (n.userData.levTween) return;
|
|
1256
|
+
n.userData.enTween && (n.userData.enTween.stop(), n.userData.enTween = null);
|
|
1257
|
+
const r = new ot.Tween(n.scale).to({ z: 1 }, 100);
|
|
1258
|
+
n.userData.levTween = r, r.start();
|
|
1117
1259
|
}
|
|
1118
|
-
}),
|
|
1119
|
-
if (
|
|
1260
|
+
}), s) {
|
|
1261
|
+
if (s.userData.enTween)
|
|
1120
1262
|
return;
|
|
1121
|
-
|
|
1122
|
-
const
|
|
1123
|
-
return
|
|
1263
|
+
s.userData.levTween && (s.userData.levTween.stop(), s.userData.levTween = null);
|
|
1264
|
+
const n = new ot.Tween(s.scale).to({ z: e }, 100);
|
|
1265
|
+
return s.userData.enTween = n, n.start(), s.userData.index;
|
|
1124
1266
|
}
|
|
1125
1267
|
return -1;
|
|
1126
1268
|
}
|
|
1127
1269
|
render() {
|
|
1128
|
-
this.object3d.scale.z = 0, new
|
|
1270
|
+
this.object3d.scale.z = 0, new ot.Tween(this.object3d.scale).to({ z: 1 }, 1e3).easing(ot.Easing.Sinusoidal.InOut).start();
|
|
1129
1271
|
}
|
|
1130
1272
|
}
|
|
1131
1273
|
export {
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1274
|
+
us as CollisionManage,
|
|
1275
|
+
es as ConicPolygon,
|
|
1276
|
+
ss as Ellipsoid,
|
|
1277
|
+
ns as ExtrudePolygon,
|
|
1278
|
+
os as Group,
|
|
1279
|
+
rs as Light,
|
|
1280
|
+
cs as Line,
|
|
1281
|
+
hs as Line2,
|
|
1282
|
+
ps as Line2Material,
|
|
1283
|
+
ys as LineSegmentsGeometry,
|
|
1284
|
+
Ne as MeshLineGeometry,
|
|
1285
|
+
re as MeshLineMaterial,
|
|
1286
|
+
as as MeshLineRaycast,
|
|
1287
|
+
ws as Node,
|
|
1288
|
+
ds as Pie,
|
|
1289
|
+
oe as getConicPolygonGeometry,
|
|
1290
|
+
xs as getConicPolygonGeometryMetas,
|
|
1291
|
+
is as getSplitTexture
|
|
1148
1292
|
};
|