vis-core 0.28.25 → 0.28.27
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/editor/index.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +32 -32
- package/dist/index.module.js +1737 -1708
- package/dist/version.d.ts +1 -1
- package/dist/vis/all/objects/Arc/index.d.ts +1 -1
- package/dist/vis/map/index.d.ts +19 -9
- package/package.json +1 -1
package/dist/index.module.js
CHANGED
|
@@ -54,7 +54,7 @@ import { KEYUTIL, KJUR, b64tohex } from "jsrsasign";
|
|
|
54
54
|
import CryptoJS from "crypto-js";
|
|
55
55
|
import { makePromiseCreator, generateUUID as generateUUID$1, WorkerPool } from "esus-lite";
|
|
56
56
|
import { EventEmitter } from "events";
|
|
57
|
-
import {
|
|
57
|
+
import { centroid, booleanPointInPolygon as booleanPointInPolygon$1, point, polygon, flatten as flatten$3, explode, inside, intersect as intersect$1, booleanContains, lineString, booleanCrosses, center } from "@turf/turf";
|
|
58
58
|
import world$1 from "geojson-cn/json/0.json";
|
|
59
59
|
import json100000Lite from "geojson-cn/json-lite/100000.json";
|
|
60
60
|
import json100000 from "geojson-cn/json/100000.json";
|
|
@@ -88,7 +88,7 @@ const publicKeyPEM = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQklqQU5CZ2txaGtpRz
|
|
|
88
88
|
).toString(CryptoJS.enc.Utf8), Fe = JSON.parse(Ne), Ae = Date.now();
|
|
89
89
|
return !Fe.s || Fe.s > Ae ? (this.token = void 0, "") : Fe.e && Fe.e < Ae ? (this.token = void 0, "") : (Fe.isValid = O, Fe);
|
|
90
90
|
}
|
|
91
|
-
}, version = "0.28.
|
|
91
|
+
}, version = "0.28.27";
|
|
92
92
|
/**
|
|
93
93
|
* @license
|
|
94
94
|
* Copyright 2010-2025 Three.js Authors
|
|
@@ -57768,7 +57768,7 @@ class Arc extends ht {
|
|
|
57768
57768
|
{ key: "Arc_终点", position: I.v3 }
|
|
57769
57769
|
].map((at) => B0(this, [at], function* ({ key: je, position: ke }) {
|
|
57770
57770
|
const ct = yield Pe.draw("Group", {}, this);
|
|
57771
|
-
return ct.position.copy(ke), ct.userData.disabledC = !0, ct.userData.disabledR = !0, Pe.updateBaseObjectKey(ct, `${je}_${this.options.key}`), ct;
|
|
57771
|
+
return ct.position.copy(ke), ct.userData.disabledC = !0, ct.userData.disabledR = !0, ct.userData.disabledProcessedChildren = !0, Pe.updateBaseObjectKey(ct, `${je}_${this.options.key}`), ct;
|
|
57772
57772
|
}))
|
|
57773
57773
|
);
|
|
57774
57774
|
this.helperMesh = [Fe, Ae, De, xt], this.helperMeshPosition = [
|
|
@@ -59106,7 +59106,11 @@ function applyFixes(g, t) {
|
|
|
59106
59106
|
}
|
|
59107
59107
|
},
|
|
59108
59108
|
{
|
|
59109
|
-
version: "0.
|
|
59109
|
+
version: "1.0.0",
|
|
59110
|
+
fix: () => !1
|
|
59111
|
+
},
|
|
59112
|
+
{
|
|
59113
|
+
version: "1.0.1",
|
|
59110
59114
|
fix: () => !1
|
|
59111
59115
|
}
|
|
59112
59116
|
];
|
|
@@ -59133,7 +59137,48 @@ const fixJSON = (g) => {
|
|
|
59133
59137
|
version: g.v
|
|
59134
59138
|
}
|
|
59135
59139
|
}), (t = g.c) != null && t.key && delete g.c.key, applyFixes(g.c.version, g), g;
|
|
59136
|
-
};
|
|
59140
|
+
}, encodings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
59141
|
+
function encodeArrayBufferToUrlSafeBase64(g) {
|
|
59142
|
+
let t = "";
|
|
59143
|
+
const r = new Uint8Array(g), m = r.byteLength, v = m % 3, C = m - v;
|
|
59144
|
+
let _, w, I, O, Pe;
|
|
59145
|
+
for (let Ne = 0; Ne < C; Ne = Ne + 3)
|
|
59146
|
+
Pe = r[Ne] << 16 | r[Ne + 1] << 8 | r[Ne + 2], _ = (Pe & 16515072) >> 18, w = (Pe & 258048) >> 12, I = (Pe & 4032) >> 6, O = Pe & 63, t += encodings[_] + encodings[w] + encodings[I] + encodings[O];
|
|
59147
|
+
return v === 1 ? (Pe = r[C], _ = (Pe & 252) >> 2, w = (Pe & 3) << 4, t += encodings[_] + encodings[w]) : v === 2 && (Pe = r[C] << 8 | r[C + 1], _ = (Pe & 64512) >> 10, w = (Pe & 1008) >> 4, I = (Pe & 15) << 2, t += encodings[_] + encodings[w] + encodings[I]), t;
|
|
59148
|
+
}
|
|
59149
|
+
function charCodeToNumber(g) {
|
|
59150
|
+
if (g >= 65 && g <= 90)
|
|
59151
|
+
return g - 65;
|
|
59152
|
+
if (g >= 97 && g <= 122)
|
|
59153
|
+
return g - 71;
|
|
59154
|
+
if (g >= 48 && g <= 57)
|
|
59155
|
+
return g + 4;
|
|
59156
|
+
if (g === 45)
|
|
59157
|
+
return 62;
|
|
59158
|
+
if (g === 95)
|
|
59159
|
+
return 63;
|
|
59160
|
+
throw new Error("Invalid char code in url safe base64: " + g);
|
|
59161
|
+
}
|
|
59162
|
+
function decodeUrlSafeBase64ToArrayBuffer(g) {
|
|
59163
|
+
const t = g.length % 4;
|
|
59164
|
+
let r = 0, m = 0, v = 0;
|
|
59165
|
+
if (t === 0)
|
|
59166
|
+
r = g.length / 4 * 3, m = g.length;
|
|
59167
|
+
else {
|
|
59168
|
+
if (t === 1)
|
|
59169
|
+
throw new Error("invalid url safe base64 encoded string: " + g);
|
|
59170
|
+
t === 2 ? (r = (g.length - 2) / 4 * 3, m = g.length - 2, v = 1) : (r = (g.length - 3) / 4 * 3, m = g.length - 3, v = 2);
|
|
59171
|
+
}
|
|
59172
|
+
let C;
|
|
59173
|
+
const _ = new Uint8Array(r + v);
|
|
59174
|
+
let w, I, O, Pe;
|
|
59175
|
+
for (let Ne = 0, Fe = 0; Ne < m; Ne += 4, Fe += 3)
|
|
59176
|
+
w = charCodeToNumber(g.charCodeAt(Ne)), I = charCodeToNumber(g.charCodeAt(Ne + 1)), O = charCodeToNumber(g.charCodeAt(Ne + 2)), Pe = charCodeToNumber(g.charCodeAt(Ne + 3)), C = (w << 18) + (I << 12) + (O << 6) + Pe, _.set(
|
|
59177
|
+
[(C & 16711680) >> 16, (C & 65280) >> 8, C & 255],
|
|
59178
|
+
Fe
|
|
59179
|
+
);
|
|
59180
|
+
return t === 2 ? (w = charCodeToNumber(g.charCodeAt(m)), I = charCodeToNumber(g.charCodeAt(m + 1)), C = (w << 2) + (I >> 4), _.set([C & 255], r)) : t === 3 && (w = charCodeToNumber(g.charCodeAt(m)), I = charCodeToNumber(g.charCodeAt(m + 1)), O = charCodeToNumber(g.charCodeAt(m + 2)), C = (w << 10) + (I << 4) + (O >> 2), _.set([(C & 65280) >> 8, C & 255], r)), _.buffer;
|
|
59181
|
+
}
|
|
59137
59182
|
class Command {
|
|
59138
59183
|
constructor(t) {
|
|
59139
59184
|
C0(this, "id");
|
|
@@ -60043,48 +60088,7 @@ const Commands = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
|
|
|
60043
60088
|
SetTarget,
|
|
60044
60089
|
SetValue,
|
|
60045
60090
|
SetVector
|
|
60046
|
-
}, Symbol.toStringTag, { value: "Module" }))
|
|
60047
|
-
function encodeArrayBufferToUrlSafeBase64(g) {
|
|
60048
|
-
let t = "";
|
|
60049
|
-
const r = new Uint8Array(g), m = r.byteLength, v = m % 3, C = m - v;
|
|
60050
|
-
let _, w, I, O, Pe;
|
|
60051
|
-
for (let Ne = 0; Ne < C; Ne = Ne + 3)
|
|
60052
|
-
Pe = r[Ne] << 16 | r[Ne + 1] << 8 | r[Ne + 2], _ = (Pe & 16515072) >> 18, w = (Pe & 258048) >> 12, I = (Pe & 4032) >> 6, O = Pe & 63, t += encodings[_] + encodings[w] + encodings[I] + encodings[O];
|
|
60053
|
-
return v === 1 ? (Pe = r[C], _ = (Pe & 252) >> 2, w = (Pe & 3) << 4, t += encodings[_] + encodings[w]) : v === 2 && (Pe = r[C] << 8 | r[C + 1], _ = (Pe & 64512) >> 10, w = (Pe & 1008) >> 4, I = (Pe & 15) << 2, t += encodings[_] + encodings[w] + encodings[I]), t;
|
|
60054
|
-
}
|
|
60055
|
-
function charCodeToNumber(g) {
|
|
60056
|
-
if (g >= 65 && g <= 90)
|
|
60057
|
-
return g - 65;
|
|
60058
|
-
if (g >= 97 && g <= 122)
|
|
60059
|
-
return g - 71;
|
|
60060
|
-
if (g >= 48 && g <= 57)
|
|
60061
|
-
return g + 4;
|
|
60062
|
-
if (g === 45)
|
|
60063
|
-
return 62;
|
|
60064
|
-
if (g === 95)
|
|
60065
|
-
return 63;
|
|
60066
|
-
throw new Error("Invalid char code in url safe base64: " + g);
|
|
60067
|
-
}
|
|
60068
|
-
function decodeUrlSafeBase64ToArrayBuffer(g) {
|
|
60069
|
-
const t = g.length % 4;
|
|
60070
|
-
let r = 0, m = 0, v = 0;
|
|
60071
|
-
if (t === 0)
|
|
60072
|
-
r = g.length / 4 * 3, m = g.length;
|
|
60073
|
-
else {
|
|
60074
|
-
if (t === 1)
|
|
60075
|
-
throw new Error("invalid url safe base64 encoded string: " + g);
|
|
60076
|
-
t === 2 ? (r = (g.length - 2) / 4 * 3, m = g.length - 2, v = 1) : (r = (g.length - 3) / 4 * 3, m = g.length - 3, v = 2);
|
|
60077
|
-
}
|
|
60078
|
-
let C;
|
|
60079
|
-
const _ = new Uint8Array(r + v);
|
|
60080
|
-
let w, I, O, Pe;
|
|
60081
|
-
for (let Ne = 0, Fe = 0; Ne < m; Ne += 4, Fe += 3)
|
|
60082
|
-
w = charCodeToNumber(g.charCodeAt(Ne)), I = charCodeToNumber(g.charCodeAt(Ne + 1)), O = charCodeToNumber(g.charCodeAt(Ne + 2)), Pe = charCodeToNumber(g.charCodeAt(Ne + 3)), C = (w << 18) + (I << 12) + (O << 6) + Pe, _.set(
|
|
60083
|
-
[(C & 16711680) >> 16, (C & 65280) >> 8, C & 255],
|
|
60084
|
-
Fe
|
|
60085
|
-
);
|
|
60086
|
-
return t === 2 ? (w = charCodeToNumber(g.charCodeAt(m)), I = charCodeToNumber(g.charCodeAt(m + 1)), C = (w << 2) + (I >> 4), _.set([C & 255], r)) : t === 3 && (w = charCodeToNumber(g.charCodeAt(m)), I = charCodeToNumber(g.charCodeAt(m + 1)), O = charCodeToNumber(g.charCodeAt(m + 2)), C = (w << 10) + (I << 4) + (O >> 2), _.set([(C & 65280) >> 8, C & 255], r)), _.buffer;
|
|
60087
|
-
}
|
|
60091
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
60088
60092
|
class History {
|
|
60089
60093
|
constructor(t) {
|
|
60090
60094
|
C0(this, "editor");
|
|
@@ -60600,7 +60604,7 @@ class Editor {
|
|
|
60600
60604
|
});
|
|
60601
60605
|
}
|
|
60602
60606
|
const w = C.length > 0 ? r(C) : [], I = v.object3d.isGroup, O = I || ["@Scene", "@Camera"].includes(v.key) || v.userData.disabledC || v.key.includes("__c__"), Pe = ["@Scene", "@Camera"].includes(v.key) || v.userData.disabledR || v.key.includes("__c__");
|
|
60603
|
-
if (w.length === 0 && I)
|
|
60607
|
+
if (w.length === 0 && I && !v.userData.disabledProcessedChildren)
|
|
60604
60608
|
return null;
|
|
60605
60609
|
const Ne = v.key.replace(
|
|
60606
60610
|
v.key[0],
|
|
@@ -60689,6 +60693,24 @@ class Editor {
|
|
|
60689
60693
|
}
|
|
60690
60694
|
});
|
|
60691
60695
|
}
|
|
60696
|
+
appendJSON(t) {
|
|
60697
|
+
return B0(this, null, function* () {
|
|
60698
|
+
let r;
|
|
60699
|
+
if (typeof t == "string") {
|
|
60700
|
+
const m = this.options.assetsPrefix + t;
|
|
60701
|
+
console.time("vis-core:time.append-json-fetch");
|
|
60702
|
+
const { res: v, err: C } = yield jsonFetch(m);
|
|
60703
|
+
if (console.timeEnd("vis-core:time.append-json-fetch"), C)
|
|
60704
|
+
throw new Error("appendJSON error:" + C);
|
|
60705
|
+
r = v;
|
|
60706
|
+
} else
|
|
60707
|
+
r = t;
|
|
60708
|
+
this.history.undos.length = 0, this.history.fromJSON({
|
|
60709
|
+
i: r.h.i,
|
|
60710
|
+
u: r.h.u.filter((m) => m.type !== "AddVis")
|
|
60711
|
+
}), yield this.history.processUndos(this.options.processUndosMaxFrameTime);
|
|
60712
|
+
});
|
|
60713
|
+
}
|
|
60692
60714
|
toJSON() {
|
|
60693
60715
|
return {};
|
|
60694
60716
|
}
|
|
@@ -61278,1137 +61300,7 @@ class Base extends Camera {
|
|
|
61278
61300
|
}
|
|
61279
61301
|
}
|
|
61280
61302
|
C0(Base, "VisName", "base");
|
|
61281
|
-
|
|
61282
|
-
const r = flatten$3(g).features, m = flatten$3(t).features, v = {
|
|
61283
|
-
type: "FeatureCollection",
|
|
61284
|
-
features: []
|
|
61285
|
-
};
|
|
61286
|
-
for (let C = r.length - 1; C >= 0; C--) {
|
|
61287
|
-
const _ = r[C];
|
|
61288
|
-
for (let w = m.length - 1; w >= 0; w--) {
|
|
61289
|
-
const I = m[w];
|
|
61290
|
-
if (contains(_, I))
|
|
61291
|
-
v.features.push(I);
|
|
61292
|
-
else if (contains(I, _))
|
|
61293
|
-
_.properties = I.properties, v.features.push(_);
|
|
61294
|
-
else {
|
|
61295
|
-
const O = intersect$1(_, I);
|
|
61296
|
-
O && (O.properties = I.properties, v.features.push(O));
|
|
61297
|
-
}
|
|
61298
|
-
}
|
|
61299
|
-
}
|
|
61300
|
-
return v;
|
|
61301
|
-
}
|
|
61302
|
-
function contains(g, t) {
|
|
61303
|
-
let r = !0;
|
|
61304
|
-
const m = explode(t).features;
|
|
61305
|
-
for (let v = m.length - 1; v >= 0; v--)
|
|
61306
|
-
if (!inside(m[v], g)) {
|
|
61307
|
-
r = !1;
|
|
61308
|
-
break;
|
|
61309
|
-
}
|
|
61310
|
-
return r;
|
|
61311
|
-
}
|
|
61312
|
-
const getBoxMultiPoly = (g) => {
|
|
61313
|
-
const t = g.features.map((r) => r.geometry.type === "Polygon" ? [r.geometry.coordinates] : r.geometry.coordinates).flat();
|
|
61314
|
-
return Array.from({ length: t.length }, (r, m) => polygon(t[m]));
|
|
61315
|
-
};
|
|
61316
|
-
class Building extends ht {
|
|
61317
|
-
constructor(r) {
|
|
61318
|
-
super();
|
|
61319
|
-
C0(this, "options");
|
|
61320
|
-
C0(this, "building", {});
|
|
61321
|
-
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
61322
|
-
C0(this, "worldPositionZ", {
|
|
61323
|
-
value: 0
|
|
61324
|
-
});
|
|
61325
|
-
this.options = q0({}, r);
|
|
61326
|
-
}
|
|
61327
|
-
create() {
|
|
61328
|
-
return B0(this, null, function* () {
|
|
61329
|
-
const { json: r, projection: m, cacheKey: v, meters: C, grey: _, clip: w } = this.options, I = this.pencil.mList, O = this.pencil.getPlugin("worker"), Pe = this.pencil.lead, Ne = _ ? "-grey" : "";
|
|
61330
|
-
this.createGroup();
|
|
61331
|
-
const Fe = I.getMultiple("building" + Ne);
|
|
61332
|
-
let Ae = v ? yield O.getCachedGeometry({
|
|
61333
|
-
cacheKey: v
|
|
61334
|
-
}) : [];
|
|
61335
|
-
if (Ae.length)
|
|
61336
|
-
w && this.outJson.set(1, !0);
|
|
61337
|
-
else {
|
|
61338
|
-
let De;
|
|
61339
|
-
w && (De = getBoxMultiPoly(w));
|
|
61340
|
-
const xt = {};
|
|
61341
|
-
(r.features || r).forEach((ke) => {
|
|
61342
|
-
const at = typeof ke.properties.h == "string" ? ke.properties.h.split(".")[1] : 0, ct = Number(ke.properties.h) | 0;
|
|
61343
|
-
xt[at] || (xt[at] = {}), xt[at][ct] || (xt[at][ct] = []), De ? De.some((Lt) => {
|
|
61344
|
-
ke.geometry.coordinates[1] && console.log(ke.geometry.coordinates[1]);
|
|
61345
|
-
const Wt = polygon(ke.geometry.coordinates[0]);
|
|
61346
|
-
return booleanContains(Lt, Wt) ? (xt[at][ct].push(ke), !0) : !1;
|
|
61347
|
-
}) || this.outJson.set(ke, !1) : xt[at][ct].push(ke);
|
|
61348
|
-
});
|
|
61349
|
-
const je = Object.keys(xt).map((ke) => {
|
|
61350
|
-
const at = xt[ke];
|
|
61351
|
-
return Object.keys(at).map((ct) => {
|
|
61352
|
-
const Gt = at[ct];
|
|
61353
|
-
return {
|
|
61354
|
-
z: +ke,
|
|
61355
|
-
h: +ct,
|
|
61356
|
-
coordinatesArr: Gt.map(
|
|
61357
|
-
(Lt) => Lt.geometry.type === "Polygon" ? Lt.geometry.coordinates[0] : Lt.geometry.coordinates[0][0]
|
|
61358
|
-
)
|
|
61359
|
-
};
|
|
61360
|
-
});
|
|
61361
|
-
}).flat().filter((ke) => ke.coordinatesArr.length);
|
|
61362
|
-
Ae = yield Promise.all(
|
|
61363
|
-
je.map((ke) => {
|
|
61364
|
-
const { h: at, z: ct, coordinatesArr: Gt } = ke, Lt = +at <= 20 ? +at / 18 : +at <= 60 ? +at / 27 : +at / 12;
|
|
61365
|
-
return O.geoGeometry("extrudePolygon", {
|
|
61366
|
-
cacheKey: v,
|
|
61367
|
-
userData: {
|
|
61368
|
-
z: ct,
|
|
61369
|
-
h: at
|
|
61370
|
-
},
|
|
61371
|
-
mesaage: {
|
|
61372
|
-
coordinatesArr: Gt,
|
|
61373
|
-
projection: m,
|
|
61374
|
-
useGroups: 2,
|
|
61375
|
-
depth: [Number(at) * (C || 1)],
|
|
61376
|
-
hasBottom: !1,
|
|
61377
|
-
sideRepeat: Lt
|
|
61378
|
-
}
|
|
61379
|
-
});
|
|
61380
|
-
})
|
|
61381
|
-
);
|
|
61382
|
-
}
|
|
61383
|
-
yield Promise.all(
|
|
61384
|
-
Ae.map((De) => B0(this, null, function* () {
|
|
61385
|
-
const { h: xt, z: je } = De.userData, ke = xt + je, at = ke <= 20 ? "20" : ke <= 60 ? "60" : "max";
|
|
61386
|
-
let ct = this.options.material;
|
|
61387
|
-
ct || (ct = [Fe[at + "Top"], Fe[at + "Side"]]);
|
|
61388
|
-
const Gt = yield Pe.draw(
|
|
61389
|
-
"ExtrudePolygon",
|
|
61390
|
-
{
|
|
61391
|
-
key: `$p:-${xt}-${je}`,
|
|
61392
|
-
geometry: De,
|
|
61393
|
-
material: ct
|
|
61394
|
-
},
|
|
61395
|
-
this
|
|
61396
|
-
);
|
|
61397
|
-
this.options.grey || (Gt.object3d.castShadow = !0), this.building[xt] || (this.building[xt] = []), this.building[xt].push(Gt), Gt.position.z = Number(je) * (C || 1);
|
|
61398
|
-
}))
|
|
61399
|
-
), this.options.sideGradient && this.sideGradient(), this.object3d.name = "建筑", _ || this.lead.updateBaseObjectKey(
|
|
61400
|
-
this,
|
|
61401
|
-
`building${Ne ? "-grey" : ""}#group`
|
|
61402
|
-
);
|
|
61403
|
-
});
|
|
61404
|
-
}
|
|
61405
|
-
sideGradient(r = "#052438", m = 0.05 / 100) {
|
|
61406
|
-
this.traverse((v) => {
|
|
61407
|
-
if (v instanceof is) {
|
|
61408
|
-
const C = v.object3d.material;
|
|
61409
|
-
C[1].onBeforeCompile = (_) => {
|
|
61410
|
-
_.uniforms.gradientColor = { value: new Color$1(r) }, _.uniforms.maxGradientHeight = {
|
|
61411
|
-
value: m
|
|
61412
|
-
}, _.uniforms.worldPositionZ = this.worldPositionZ, _.vertexShader = `
|
|
61413
|
-
varying vec3 vPosition;
|
|
61414
|
-
varying vec3 vWorldPosition;
|
|
61415
|
-
${_.vertexShader}
|
|
61416
|
-
`.replace(
|
|
61417
|
-
"#include <begin_vertex>",
|
|
61418
|
-
`#include <begin_vertex>
|
|
61419
|
-
vPosition = position;
|
|
61420
|
-
vec4 worldPosition1 = modelMatrix * vec4(position, 1.0);
|
|
61421
|
-
vWorldPosition = worldPosition1.xyz;
|
|
61422
|
-
`
|
|
61423
|
-
), _.vertexShader = `
|
|
61424
|
-
varying vec2 vUv;
|
|
61425
|
-
${_.vertexShader}
|
|
61426
|
-
`.replace(
|
|
61427
|
-
"#include <uv_vertex>",
|
|
61428
|
-
`#include <uv_vertex>
|
|
61429
|
-
vUv = uv;
|
|
61430
|
-
`
|
|
61431
|
-
), _.fragmentShader = `
|
|
61432
|
-
uniform vec3 gradientColor;
|
|
61433
|
-
uniform float maxGradientHeight;
|
|
61434
|
-
uniform float worldPositionZ;
|
|
61435
|
-
varying vec3 vWorldPosition;
|
|
61436
|
-
varying vec2 vUv;
|
|
61437
|
-
|
|
61438
|
-
${_.fragmentShader}
|
|
61439
|
-
`.replace(
|
|
61440
|
-
"#include <dithering_fragment>",
|
|
61441
|
-
`
|
|
61442
|
-
#include <dithering_fragment>
|
|
61443
|
-
if ((vWorldPosition.z-worldPositionZ) <= maxGradientHeight) {
|
|
61444
|
-
float gradient = (vWorldPosition.z-worldPositionZ) / maxGradientHeight;
|
|
61445
|
-
gl_FragColor.rgb = mix(gl_FragColor.rgb, gradientColor,1.0-gradient);
|
|
61446
|
-
}
|
|
61447
|
-
`
|
|
61448
|
-
);
|
|
61449
|
-
}, C[1].needsUpdate = !0;
|
|
61450
|
-
}
|
|
61451
|
-
});
|
|
61452
|
-
}
|
|
61453
|
-
update() {
|
|
61454
|
-
const r = new Vector3();
|
|
61455
|
-
this.object3d.getWorldPosition(r), this.worldPositionZ.value !== r.z && (this.worldPositionZ.value = r.z);
|
|
61456
|
-
}
|
|
61457
|
-
dispose() {
|
|
61458
|
-
super.dispose(), this.outJson.clear();
|
|
61459
|
-
}
|
|
61460
|
-
}
|
|
61461
|
-
class Road extends ht {
|
|
61462
|
-
constructor(r) {
|
|
61463
|
-
super();
|
|
61464
|
-
C0(this, "options");
|
|
61465
|
-
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
61466
|
-
C0(this, "linePrimary", []);
|
|
61467
|
-
C0(this, "lineSecondary", []);
|
|
61468
|
-
this.options = q0({}, r);
|
|
61469
|
-
}
|
|
61470
|
-
create() {
|
|
61471
|
-
return B0(this, null, function* () {
|
|
61472
|
-
const { clip: r, grey: m } = this.options;
|
|
61473
|
-
this.createGroup();
|
|
61474
|
-
const v = this.pencil.getPlugin("worker"), C = this.pencil.lead, _ = this.pencil.mList, w = m ? "-grey" : "", { json: I, projection: O, cacheKey: Pe, meters: Ne } = this.options;
|
|
61475
|
-
let Fe = Pe ? yield v.getCachedGeometry({
|
|
61476
|
-
cacheKey: Pe
|
|
61477
|
-
}) : [];
|
|
61478
|
-
if (Fe.length)
|
|
61479
|
-
r && this.outJson.set(1, !0);
|
|
61480
|
-
else {
|
|
61481
|
-
const Ae = {};
|
|
61482
|
-
let De;
|
|
61483
|
-
r && (De = getBoxMultiPoly(r)), (I.features || I).forEach((je) => {
|
|
61484
|
-
const ke = je.properties.w;
|
|
61485
|
-
Ae[ke] || (Ae[ke] = []), De ? De.some((ct) => {
|
|
61486
|
-
je.geometry.coordinates[1] && console.log(je.geometry.coordinates[1]);
|
|
61487
|
-
const Gt = lineString(je.geometry.coordinates[0]);
|
|
61488
|
-
if (booleanContains(ct, Gt)) {
|
|
61489
|
-
const Wt = [
|
|
61490
|
-
je.geometry.coordinates[0].filter((Pt) => booleanPointInPolygon$1(Pt, ct))
|
|
61491
|
-
];
|
|
61492
|
-
return Wt[0].length && Ae[ke].push(Ji(q0({}, je), {
|
|
61493
|
-
geometry: Ji(q0({}, je.geometry), {
|
|
61494
|
-
coordinates: Wt
|
|
61495
|
-
})
|
|
61496
|
-
})), !0;
|
|
61497
|
-
}
|
|
61498
|
-
return !1;
|
|
61499
|
-
}) || this.outJson.set(je, !1) : Ae[ke].push(je);
|
|
61500
|
-
});
|
|
61501
|
-
const xt = Object.keys(Ae).map((je) => {
|
|
61502
|
-
const ke = Ae[je];
|
|
61503
|
-
return {
|
|
61504
|
-
w: +je,
|
|
61505
|
-
coordinatesArr: ke.map((at) => at.geometry.coordinates[0])
|
|
61506
|
-
};
|
|
61507
|
-
}).filter((je) => je.coordinatesArr.length);
|
|
61508
|
-
Fe = yield Promise.all(
|
|
61509
|
-
xt.map((je) => {
|
|
61510
|
-
const { w: ke, coordinatesArr: at } = je;
|
|
61511
|
-
return v.geoGeometry("line", {
|
|
61512
|
-
cacheKey: Pe,
|
|
61513
|
-
mesaage: {
|
|
61514
|
-
coordinatesArr: at,
|
|
61515
|
-
lineWidth: [ke * (Ne || 1)],
|
|
61516
|
-
projection: O
|
|
61517
|
-
}
|
|
61518
|
-
});
|
|
61519
|
-
})
|
|
61520
|
-
);
|
|
61521
|
-
}
|
|
61522
|
-
yield Promise.all(
|
|
61523
|
-
Fe.map((Ae, De) => B0(this, null, function* () {
|
|
61524
|
-
const xt = yield C.draw(
|
|
61525
|
-
"Line",
|
|
61526
|
-
{
|
|
61527
|
-
key: `$p:-${De}`,
|
|
61528
|
-
geometry: Ae,
|
|
61529
|
-
material: _.getMultiple("road" + w).primary
|
|
61530
|
-
},
|
|
61531
|
-
this
|
|
61532
|
-
);
|
|
61533
|
-
this.linePrimary.push(xt);
|
|
61534
|
-
}))
|
|
61535
|
-
), this.object3d.name = "道路", m || this.lead.updateBaseObjectKey(this, `road${w ? "-grey" : ""}#group`);
|
|
61536
|
-
});
|
|
61537
|
-
}
|
|
61538
|
-
dispose() {
|
|
61539
|
-
super.dispose(), this.linePrimary = [], this.lineSecondary = [], this.outJson.clear();
|
|
61540
|
-
}
|
|
61541
|
-
}
|
|
61542
|
-
class Area extends ht {
|
|
61543
|
-
constructor(r) {
|
|
61544
|
-
super();
|
|
61545
|
-
C0(this, "options");
|
|
61546
|
-
C0(this, "area", []);
|
|
61547
|
-
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
61548
|
-
this.options = q0({}, r);
|
|
61549
|
-
}
|
|
61550
|
-
create() {
|
|
61551
|
-
return B0(this, null, function* () {
|
|
61552
|
-
this.createGroup();
|
|
61553
|
-
const { json: r, projection: m, type: v, cacheKey: C, material: _, oArr: w, clip: I } = this.options, O = this.pencil.getPlugin("worker"), Pe = this.pencil.lead;
|
|
61554
|
-
let Ne = C ? yield O.getCachedGeometry({
|
|
61555
|
-
cacheKey: C
|
|
61556
|
-
}) : [];
|
|
61557
|
-
if (Ne.length)
|
|
61558
|
-
I && this.outJson.set(1, !0);
|
|
61559
|
-
else {
|
|
61560
|
-
const Fe = {};
|
|
61561
|
-
let Ae;
|
|
61562
|
-
I && (Ae = getBoxMultiPoly(I)), (r.features || r).forEach((xt) => {
|
|
61563
|
-
const je = xt.properties.o;
|
|
61564
|
-
Fe[je] || (Fe[je] = []), Ae ? Ae.some((at) => {
|
|
61565
|
-
const ct = polygon(xt.geometry.coordinates);
|
|
61566
|
-
if (booleanContains(at, ct))
|
|
61567
|
-
return Fe[je].push(xt), !0;
|
|
61568
|
-
{
|
|
61569
|
-
const Lt = lineString(xt.geometry.coordinates[0]);
|
|
61570
|
-
if (booleanCrosses(at, Lt)) {
|
|
61571
|
-
const Pt = clipGeojson(at, xt);
|
|
61572
|
-
Pt.features[0] && Fe[je].push(Ji(q0({}, xt), {
|
|
61573
|
-
geometry: Ji(q0({}, xt.geometry), {
|
|
61574
|
-
coordinates: Pt.features[0].geometry.coordinates
|
|
61575
|
-
})
|
|
61576
|
-
}));
|
|
61577
|
-
}
|
|
61578
|
-
}
|
|
61579
|
-
return !1;
|
|
61580
|
-
}) || this.outJson.set(xt, !1) : Fe[je].push(xt);
|
|
61581
|
-
});
|
|
61582
|
-
const De = Object.keys(Fe).map((xt) => {
|
|
61583
|
-
const je = Fe[xt];
|
|
61584
|
-
return {
|
|
61585
|
-
z: +xt,
|
|
61586
|
-
coordinatesArr: je.map(
|
|
61587
|
-
(ke) => ke.geometry.type === "Polygon" ? ke.geometry.coordinates[0] : ke.geometry.coordinates[0][0]
|
|
61588
|
-
)
|
|
61589
|
-
};
|
|
61590
|
-
}).filter((xt) => xt.coordinatesArr.length);
|
|
61591
|
-
Ne = yield Promise.all(
|
|
61592
|
-
De.map((xt) => {
|
|
61593
|
-
const { z: je, coordinatesArr: ke } = xt;
|
|
61594
|
-
return O.geoGeometry("extrudePolygon", {
|
|
61595
|
-
cacheKey: C,
|
|
61596
|
-
userData: {
|
|
61597
|
-
z: je
|
|
61598
|
-
},
|
|
61599
|
-
mesaage: {
|
|
61600
|
-
coordinatesArr: ke,
|
|
61601
|
-
projection: m,
|
|
61602
|
-
depth: [0],
|
|
61603
|
-
hasBottom: !1,
|
|
61604
|
-
hasSide: !1
|
|
61605
|
-
}
|
|
61606
|
-
});
|
|
61607
|
-
})
|
|
61608
|
-
);
|
|
61609
|
-
}
|
|
61610
|
-
yield Promise.all(
|
|
61611
|
-
Ne.map((Fe, Ae) => B0(this, null, function* () {
|
|
61612
|
-
const { z: De } = Fe.userData, xt = yield Pe.draw(
|
|
61613
|
-
"ExtrudePolygon",
|
|
61614
|
-
{
|
|
61615
|
-
key: `$p:-${Ae}`,
|
|
61616
|
-
geometry: Fe,
|
|
61617
|
-
material: _
|
|
61618
|
-
},
|
|
61619
|
-
this
|
|
61620
|
-
);
|
|
61621
|
-
w != null && w.length && (xt.position.z = w.findIndex((je) => je === +De) * 1e-3), this.area.push(xt);
|
|
61622
|
-
}))
|
|
61623
|
-
);
|
|
61624
|
-
});
|
|
61625
|
-
}
|
|
61626
|
-
dispose() {
|
|
61627
|
-
super.dispose(), this.outJson.clear();
|
|
61628
|
-
}
|
|
61629
|
-
}
|
|
61630
|
-
class Reflector extends Mesh {
|
|
61631
|
-
/**
|
|
61632
|
-
* Constructs a new reflector.
|
|
61633
|
-
*
|
|
61634
|
-
* @param {BufferGeometry} geometry - The reflector's geometry.
|
|
61635
|
-
* @param {Reflector~Options} [options] - The configuration options.
|
|
61636
|
-
*/
|
|
61637
|
-
constructor(t, r = {}) {
|
|
61638
|
-
super(t), this.isReflector = !0, this.type = "Reflector", this.forceUpdate = !1, this.camera = new PerspectiveCamera();
|
|
61639
|
-
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(8355711), C = r.textureWidth || 512, _ = r.textureHeight || 512, w = r.clipBias || 0, I = r.shader || Reflector.ReflectorShader, O = r.multisample !== void 0 ? r.multisample : 4, Pe = new Plane$1(), Ne = new Vector3(), Fe = new Vector3(), Ae = new Vector3(), De = new Matrix4(), xt = new Vector3(0, 0, -1), je = new Vector4(), ke = new Vector3(), at = new Vector3(), ct = new Vector4(), Gt = new Matrix4(), Lt = this.camera, Wt = new WebGLRenderTarget(C, _, { samples: O, type: HalfFloatType }), Pt = new ShaderMaterial({
|
|
61640
|
-
name: I.name !== void 0 ? I.name : "unspecified",
|
|
61641
|
-
uniforms: UniformsUtils.clone(I.uniforms),
|
|
61642
|
-
fragmentShader: I.fragmentShader,
|
|
61643
|
-
vertexShader: I.vertexShader
|
|
61644
|
-
});
|
|
61645
|
-
Pt.uniforms.tDiffuse.value = Wt.texture, Pt.uniforms.color.value = v, Pt.uniforms.textureMatrix.value = Gt, this.material = Pt, this.onBeforeRender = function(zt, Nt, Kt) {
|
|
61646
|
-
if (Fe.setFromMatrixPosition(m.matrixWorld), Ae.setFromMatrixPosition(Kt.matrixWorld), De.extractRotation(m.matrixWorld), Ne.set(0, 0, 1), Ne.applyMatrix4(De), ke.subVectors(Fe, Ae), ke.dot(Ne) > 0 === !0 && this.forceUpdate === !1) return;
|
|
61647
|
-
ke.reflect(Ne).negate(), ke.add(Fe), De.extractRotation(Kt.matrixWorld), xt.set(0, 0, -1), xt.applyMatrix4(De), xt.add(Ae), at.subVectors(Fe, xt), at.reflect(Ne).negate(), at.add(Fe), Lt.position.copy(ke), Lt.up.set(0, 1, 0), Lt.up.applyMatrix4(De), Lt.up.reflect(Ne), Lt.lookAt(at), Lt.far = Kt.far, Lt.updateMatrixWorld(), Lt.projectionMatrix.copy(Kt.projectionMatrix), Gt.set(
|
|
61648
|
-
0.5,
|
|
61649
|
-
0,
|
|
61650
|
-
0,
|
|
61651
|
-
0.5,
|
|
61652
|
-
0,
|
|
61653
|
-
0.5,
|
|
61654
|
-
0,
|
|
61655
|
-
0.5,
|
|
61656
|
-
0,
|
|
61657
|
-
0,
|
|
61658
|
-
0.5,
|
|
61659
|
-
0.5,
|
|
61660
|
-
0,
|
|
61661
|
-
0,
|
|
61662
|
-
0,
|
|
61663
|
-
1
|
|
61664
|
-
), Gt.multiply(Lt.projectionMatrix), Gt.multiply(Lt.matrixWorldInverse), Gt.multiply(m.matrixWorld), Pe.setFromNormalAndCoplanarPoint(Ne, Fe), Pe.applyMatrix4(Lt.matrixWorldInverse), je.set(Pe.normal.x, Pe.normal.y, Pe.normal.z, Pe.constant);
|
|
61665
|
-
const n0 = Lt.projectionMatrix;
|
|
61666
|
-
ct.x = (Math.sign(je.x) + n0.elements[8]) / n0.elements[0], ct.y = (Math.sign(je.y) + n0.elements[9]) / n0.elements[5], ct.z = -1, ct.w = (1 + n0.elements[10]) / n0.elements[14], je.multiplyScalar(2 / je.dot(ct)), n0.elements[2] = je.x, n0.elements[6] = je.y, n0.elements[10] = je.z + 1 - w, n0.elements[14] = je.w, m.visible = !1;
|
|
61667
|
-
const r0 = zt.getRenderTarget(), l0 = zt.xr.enabled, s0 = zt.shadowMap.autoUpdate;
|
|
61668
|
-
zt.xr.enabled = !1, zt.shadowMap.autoUpdate = !1, zt.setRenderTarget(Wt), zt.state.buffers.depth.setMask(!0), zt.autoClear === !1 && zt.clear(), zt.render(Nt, Lt), zt.xr.enabled = l0, zt.shadowMap.autoUpdate = s0, zt.setRenderTarget(r0);
|
|
61669
|
-
const qt = Kt.viewport;
|
|
61670
|
-
qt !== void 0 && zt.state.viewport(qt), m.visible = !0, this.forceUpdate = !1;
|
|
61671
|
-
}, this.getRenderTarget = function() {
|
|
61672
|
-
return Wt;
|
|
61673
|
-
}, this.dispose = function() {
|
|
61674
|
-
Wt.dispose(), m.material.dispose();
|
|
61675
|
-
};
|
|
61676
|
-
}
|
|
61677
|
-
}
|
|
61678
|
-
Reflector.ReflectorShader = {
|
|
61679
|
-
name: "ReflectorShader",
|
|
61680
|
-
uniforms: {
|
|
61681
|
-
color: {
|
|
61682
|
-
value: null
|
|
61683
|
-
},
|
|
61684
|
-
tDiffuse: {
|
|
61685
|
-
value: null
|
|
61686
|
-
},
|
|
61687
|
-
textureMatrix: {
|
|
61688
|
-
value: null
|
|
61689
|
-
}
|
|
61690
|
-
},
|
|
61691
|
-
vertexShader: (
|
|
61692
|
-
/* glsl */
|
|
61693
|
-
`
|
|
61694
|
-
uniform mat4 textureMatrix;
|
|
61695
|
-
varying vec4 vUv;
|
|
61696
|
-
|
|
61697
|
-
#include <common>
|
|
61698
|
-
#include <logdepthbuf_pars_vertex>
|
|
61699
|
-
|
|
61700
|
-
void main() {
|
|
61701
|
-
|
|
61702
|
-
vUv = textureMatrix * vec4( position, 1.0 );
|
|
61703
|
-
|
|
61704
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
61705
|
-
|
|
61706
|
-
#include <logdepthbuf_vertex>
|
|
61707
|
-
|
|
61708
|
-
}`
|
|
61709
|
-
),
|
|
61710
|
-
fragmentShader: (
|
|
61711
|
-
/* glsl */
|
|
61712
|
-
`
|
|
61713
|
-
uniform vec3 color;
|
|
61714
|
-
uniform sampler2D tDiffuse;
|
|
61715
|
-
varying vec4 vUv;
|
|
61716
|
-
|
|
61717
|
-
#include <logdepthbuf_pars_fragment>
|
|
61718
|
-
|
|
61719
|
-
float blendOverlay( float base, float blend ) {
|
|
61720
|
-
|
|
61721
|
-
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
61722
|
-
|
|
61723
|
-
}
|
|
61724
|
-
|
|
61725
|
-
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
61726
|
-
|
|
61727
|
-
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
61728
|
-
|
|
61729
|
-
}
|
|
61730
|
-
|
|
61731
|
-
void main() {
|
|
61732
|
-
|
|
61733
|
-
#include <logdepthbuf_fragment>
|
|
61734
|
-
|
|
61735
|
-
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
61736
|
-
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
61737
|
-
|
|
61738
|
-
#include <tonemapping_fragment>
|
|
61739
|
-
#include <colorspace_fragment>
|
|
61740
|
-
|
|
61741
|
-
}`
|
|
61742
|
-
)
|
|
61743
|
-
};
|
|
61744
|
-
class Refractor extends Mesh {
|
|
61745
|
-
/**
|
|
61746
|
-
* Constructs a new refractor.
|
|
61747
|
-
*
|
|
61748
|
-
* @param {BufferGeometry} geometry - The refractor's geometry.
|
|
61749
|
-
* @param {Refractor~Options} [options] - The configuration options.
|
|
61750
|
-
*/
|
|
61751
|
-
constructor(t, r = {}) {
|
|
61752
|
-
super(t), this.isRefractor = !0, this.type = "Refractor", this.camera = new PerspectiveCamera();
|
|
61753
|
-
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(8355711), C = r.textureWidth || 512, _ = r.textureHeight || 512, w = r.clipBias || 0, I = r.shader || Refractor.RefractorShader, O = r.multisample !== void 0 ? r.multisample : 4, Pe = this.camera;
|
|
61754
|
-
Pe.matrixAutoUpdate = !1, Pe.userData.refractor = !0;
|
|
61755
|
-
const Ne = new Plane$1(), Fe = new Matrix4(), Ae = new WebGLRenderTarget(C, _, { samples: O, type: HalfFloatType });
|
|
61756
|
-
this.material = new ShaderMaterial({
|
|
61757
|
-
name: I.name !== void 0 ? I.name : "unspecified",
|
|
61758
|
-
uniforms: UniformsUtils.clone(I.uniforms),
|
|
61759
|
-
vertexShader: I.vertexShader,
|
|
61760
|
-
fragmentShader: I.fragmentShader,
|
|
61761
|
-
transparent: !0
|
|
61762
|
-
// ensures, refractors are drawn from farthest to closest
|
|
61763
|
-
}), this.material.uniforms.color.value = v, this.material.uniforms.tDiffuse.value = Ae.texture, this.material.uniforms.textureMatrix.value = Fe;
|
|
61764
|
-
const De = function() {
|
|
61765
|
-
const ct = new Vector3(), Gt = new Vector3(), Lt = new Matrix4(), Wt = new Vector3(), Pt = new Vector3();
|
|
61766
|
-
return function(Nt) {
|
|
61767
|
-
return ct.setFromMatrixPosition(m.matrixWorld), Gt.setFromMatrixPosition(Nt.matrixWorld), Wt.subVectors(ct, Gt), Lt.extractRotation(m.matrixWorld), Pt.set(0, 0, 1), Pt.applyMatrix4(Lt), Wt.dot(Pt) < 0;
|
|
61768
|
-
};
|
|
61769
|
-
}(), xt = function() {
|
|
61770
|
-
const ct = new Vector3(), Gt = new Vector3(), Lt = new Quaternion(), Wt = new Vector3();
|
|
61771
|
-
return function() {
|
|
61772
|
-
m.matrixWorld.decompose(Gt, Lt, Wt), ct.set(0, 0, 1).applyQuaternion(Lt).normalize(), ct.negate(), Ne.setFromNormalAndCoplanarPoint(ct, Gt);
|
|
61773
|
-
};
|
|
61774
|
-
}(), je = function() {
|
|
61775
|
-
const ct = new Plane$1(), Gt = new Vector4(), Lt = new Vector4();
|
|
61776
|
-
return function(Pt) {
|
|
61777
|
-
Pe.matrixWorld.copy(Pt.matrixWorld), Pe.matrixWorldInverse.copy(Pe.matrixWorld).invert(), Pe.projectionMatrix.copy(Pt.projectionMatrix), Pe.far = Pt.far, ct.copy(Ne), ct.applyMatrix4(Pe.matrixWorldInverse), Gt.set(ct.normal.x, ct.normal.y, ct.normal.z, ct.constant);
|
|
61778
|
-
const zt = Pe.projectionMatrix;
|
|
61779
|
-
Lt.x = (Math.sign(Gt.x) + zt.elements[8]) / zt.elements[0], Lt.y = (Math.sign(Gt.y) + zt.elements[9]) / zt.elements[5], Lt.z = -1, Lt.w = (1 + zt.elements[10]) / zt.elements[14], Gt.multiplyScalar(2 / Gt.dot(Lt)), zt.elements[2] = Gt.x, zt.elements[6] = Gt.y, zt.elements[10] = Gt.z + 1 - w, zt.elements[14] = Gt.w;
|
|
61780
|
-
};
|
|
61781
|
-
}();
|
|
61782
|
-
function ke(ct) {
|
|
61783
|
-
Fe.set(
|
|
61784
|
-
0.5,
|
|
61785
|
-
0,
|
|
61786
|
-
0,
|
|
61787
|
-
0.5,
|
|
61788
|
-
0,
|
|
61789
|
-
0.5,
|
|
61790
|
-
0,
|
|
61791
|
-
0.5,
|
|
61792
|
-
0,
|
|
61793
|
-
0,
|
|
61794
|
-
0.5,
|
|
61795
|
-
0.5,
|
|
61796
|
-
0,
|
|
61797
|
-
0,
|
|
61798
|
-
0,
|
|
61799
|
-
1
|
|
61800
|
-
), Fe.multiply(ct.projectionMatrix), Fe.multiply(ct.matrixWorldInverse), Fe.multiply(m.matrixWorld);
|
|
61801
|
-
}
|
|
61802
|
-
function at(ct, Gt, Lt) {
|
|
61803
|
-
m.visible = !1;
|
|
61804
|
-
const Wt = ct.getRenderTarget(), Pt = ct.xr.enabled, zt = ct.shadowMap.autoUpdate;
|
|
61805
|
-
ct.xr.enabled = !1, ct.shadowMap.autoUpdate = !1, ct.setRenderTarget(Ae), ct.autoClear === !1 && ct.clear(), ct.render(Gt, Pe), ct.xr.enabled = Pt, ct.shadowMap.autoUpdate = zt, ct.setRenderTarget(Wt);
|
|
61806
|
-
const Nt = Lt.viewport;
|
|
61807
|
-
Nt !== void 0 && ct.state.viewport(Nt), m.visible = !0;
|
|
61808
|
-
}
|
|
61809
|
-
this.onBeforeRender = function(ct, Gt, Lt) {
|
|
61810
|
-
Lt.userData.refractor !== !0 && De(Lt) && (xt(), ke(Lt), je(Lt), at(ct, Gt, Lt));
|
|
61811
|
-
}, this.getRenderTarget = function() {
|
|
61812
|
-
return Ae;
|
|
61813
|
-
}, this.dispose = function() {
|
|
61814
|
-
Ae.dispose(), m.material.dispose();
|
|
61815
|
-
};
|
|
61816
|
-
}
|
|
61817
|
-
}
|
|
61818
|
-
Refractor.RefractorShader = {
|
|
61819
|
-
name: "RefractorShader",
|
|
61820
|
-
uniforms: {
|
|
61821
|
-
color: {
|
|
61822
|
-
value: null
|
|
61823
|
-
},
|
|
61824
|
-
tDiffuse: {
|
|
61825
|
-
value: null
|
|
61826
|
-
},
|
|
61827
|
-
textureMatrix: {
|
|
61828
|
-
value: null
|
|
61829
|
-
}
|
|
61830
|
-
},
|
|
61831
|
-
vertexShader: (
|
|
61832
|
-
/* glsl */
|
|
61833
|
-
`
|
|
61834
|
-
|
|
61835
|
-
uniform mat4 textureMatrix;
|
|
61836
|
-
|
|
61837
|
-
varying vec4 vUv;
|
|
61838
|
-
|
|
61839
|
-
void main() {
|
|
61840
|
-
|
|
61841
|
-
vUv = textureMatrix * vec4( position, 1.0 );
|
|
61842
|
-
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
61843
|
-
|
|
61844
|
-
}`
|
|
61845
|
-
),
|
|
61846
|
-
fragmentShader: (
|
|
61847
|
-
/* glsl */
|
|
61848
|
-
`
|
|
61849
|
-
|
|
61850
|
-
uniform vec3 color;
|
|
61851
|
-
uniform sampler2D tDiffuse;
|
|
61852
|
-
|
|
61853
|
-
varying vec4 vUv;
|
|
61854
|
-
|
|
61855
|
-
float blendOverlay( float base, float blend ) {
|
|
61856
|
-
|
|
61857
|
-
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
61858
|
-
|
|
61859
|
-
}
|
|
61860
|
-
|
|
61861
|
-
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
61862
|
-
|
|
61863
|
-
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
61864
|
-
|
|
61865
|
-
}
|
|
61866
|
-
|
|
61867
|
-
void main() {
|
|
61868
|
-
|
|
61869
|
-
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
61870
|
-
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
61871
|
-
|
|
61872
|
-
#include <tonemapping_fragment>
|
|
61873
|
-
#include <colorspace_fragment>
|
|
61874
|
-
|
|
61875
|
-
}`
|
|
61876
|
-
)
|
|
61877
|
-
};
|
|
61878
|
-
class Water extends Mesh {
|
|
61879
|
-
constructor(t, r = {}) {
|
|
61880
|
-
super(t), this.isWater = !0, this.type = "Water";
|
|
61881
|
-
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(16777215), C = r.textureWidth !== void 0 ? r.textureWidth : 512, _ = r.textureHeight !== void 0 ? r.textureHeight : 512, w = r.clipBias !== void 0 ? r.clipBias : 0, I = r.flowDirection !== void 0 ? r.flowDirection : new Vector2(1, 0), O = r.flowSpeed !== void 0 ? r.flowSpeed : 0.03, Pe = r.reflectivity !== void 0 ? r.reflectivity : 0.02, Ne = r.scale !== void 0 ? r.scale : 1, Fe = r.shader !== void 0 ? r.shader : Water.WaterShader, Ae = r.flowMap || void 0, De = r.normalMap0, xt = r.normalMap1;
|
|
61882
|
-
De.colorSpace = NoColorSpace, xt.colorSpace = NoColorSpace;
|
|
61883
|
-
const je = 0.15, ke = je * 0.5, at = new Matrix4(), ct = new Clock();
|
|
61884
|
-
if (Reflector === void 0) {
|
|
61885
|
-
console.error("THREE.Water: Required component Reflector not found.");
|
|
61886
|
-
return;
|
|
61887
|
-
}
|
|
61888
|
-
if (Refractor === void 0) {
|
|
61889
|
-
console.error("THREE.Water: Required component Refractor not found.");
|
|
61890
|
-
return;
|
|
61891
|
-
}
|
|
61892
|
-
const Gt = new Reflector(t, {
|
|
61893
|
-
textureWidth: C,
|
|
61894
|
-
textureHeight: _,
|
|
61895
|
-
clipBias: w
|
|
61896
|
-
}), Lt = new Refractor(t, {
|
|
61897
|
-
textureWidth: C,
|
|
61898
|
-
textureHeight: _,
|
|
61899
|
-
clipBias: w
|
|
61900
|
-
});
|
|
61901
|
-
Gt.matrixAutoUpdate = !1, Lt.matrixAutoUpdate = !1, this.material = new ShaderMaterial({
|
|
61902
|
-
name: Fe.name,
|
|
61903
|
-
uniforms: UniformsUtils.merge([UniformsLib.fog, Fe.uniforms]),
|
|
61904
|
-
vertexShader: Fe.vertexShader,
|
|
61905
|
-
fragmentShader: Fe.fragmentShader,
|
|
61906
|
-
transparent: !0,
|
|
61907
|
-
fog: !0
|
|
61908
|
-
}), Ae !== void 0 ? (this.material.defines.USE_FLOWMAP = "", this.material.uniforms.tFlowMap = {
|
|
61909
|
-
type: "t",
|
|
61910
|
-
value: Ae
|
|
61911
|
-
}) : this.material.uniforms.flowDirection = {
|
|
61912
|
-
type: "v2",
|
|
61913
|
-
value: I
|
|
61914
|
-
}, De.wrapS = De.wrapT = RepeatWrapping, xt.wrapS = xt.wrapT = RepeatWrapping, this.material.uniforms.tReflectionMap.value = Gt.getRenderTarget().texture, this.material.uniforms.tRefractionMap.value = Lt.getRenderTarget().texture, this.material.uniforms.tNormalMap0.value = De, this.material.uniforms.tNormalMap1.value = xt, this.material.uniforms.color.value = v, this.material.uniforms.reflectivity.value = Pe, this.material.uniforms.textureMatrix.value = at, this.material.uniforms.config.value.x = 0, this.material.uniforms.config.value.y = ke, this.material.uniforms.config.value.z = ke, this.material.uniforms.config.value.w = Ne;
|
|
61915
|
-
function Wt(zt) {
|
|
61916
|
-
at.set(
|
|
61917
|
-
0.5,
|
|
61918
|
-
0,
|
|
61919
|
-
0,
|
|
61920
|
-
0.5,
|
|
61921
|
-
0,
|
|
61922
|
-
0.5,
|
|
61923
|
-
0,
|
|
61924
|
-
0.5,
|
|
61925
|
-
0,
|
|
61926
|
-
0,
|
|
61927
|
-
0.5,
|
|
61928
|
-
0.5,
|
|
61929
|
-
0,
|
|
61930
|
-
0,
|
|
61931
|
-
0,
|
|
61932
|
-
1
|
|
61933
|
-
), at.multiply(zt.projectionMatrix), at.multiply(zt.matrixWorldInverse), at.multiply(m.matrixWorld);
|
|
61934
|
-
}
|
|
61935
|
-
function Pt() {
|
|
61936
|
-
const zt = ct.getDelta(), Nt = m.material.uniforms.config;
|
|
61937
|
-
Nt.value.x += O * zt, Nt.value.y = Nt.value.x + ke, Nt.value.x >= je ? (Nt.value.x = 0, Nt.value.y = ke) : Nt.value.y >= je && (Nt.value.y = Nt.value.y - je);
|
|
61938
|
-
}
|
|
61939
|
-
this.onBeforeRender = function(zt, Nt, Kt) {
|
|
61940
|
-
Wt(Kt), Pt(), m.visible = !1, Gt.matrixWorld.copy(m.matrixWorld), Lt.matrixWorld.copy(m.matrixWorld), Gt.onBeforeRender(zt, Nt, Kt), Lt.onBeforeRender(zt, Nt, Kt), m.visible = !0;
|
|
61941
|
-
};
|
|
61942
|
-
}
|
|
61943
|
-
}
|
|
61944
|
-
Water.WaterShader = {
|
|
61945
|
-
name: "WaterShader",
|
|
61946
|
-
uniforms: {
|
|
61947
|
-
color: {
|
|
61948
|
-
type: "c",
|
|
61949
|
-
value: null
|
|
61950
|
-
},
|
|
61951
|
-
reflectivity: {
|
|
61952
|
-
type: "f",
|
|
61953
|
-
value: 0
|
|
61954
|
-
},
|
|
61955
|
-
tReflectionMap: {
|
|
61956
|
-
type: "t",
|
|
61957
|
-
value: null
|
|
61958
|
-
},
|
|
61959
|
-
tRefractionMap: {
|
|
61960
|
-
type: "t",
|
|
61961
|
-
value: null
|
|
61962
|
-
},
|
|
61963
|
-
tNormalMap0: {
|
|
61964
|
-
type: "t",
|
|
61965
|
-
value: null
|
|
61966
|
-
},
|
|
61967
|
-
tNormalMap1: {
|
|
61968
|
-
type: "t",
|
|
61969
|
-
value: null
|
|
61970
|
-
},
|
|
61971
|
-
textureMatrix: {
|
|
61972
|
-
type: "m4",
|
|
61973
|
-
value: null
|
|
61974
|
-
},
|
|
61975
|
-
config: {
|
|
61976
|
-
type: "v4",
|
|
61977
|
-
value: new Vector4()
|
|
61978
|
-
}
|
|
61979
|
-
},
|
|
61980
|
-
vertexShader: (
|
|
61981
|
-
/* glsl */
|
|
61982
|
-
`
|
|
61983
|
-
|
|
61984
|
-
#include <common>
|
|
61985
|
-
#include <fog_pars_vertex>
|
|
61986
|
-
#include <logdepthbuf_pars_vertex>
|
|
61987
|
-
|
|
61988
|
-
uniform mat4 textureMatrix;
|
|
61989
|
-
|
|
61990
|
-
varying vec4 vCoord;
|
|
61991
|
-
varying vec2 vUv;
|
|
61992
|
-
varying vec3 vToEye;
|
|
61993
|
-
|
|
61994
|
-
void main() {
|
|
61995
|
-
|
|
61996
|
-
vUv = uv;
|
|
61997
|
-
vCoord = textureMatrix * vec4( position, 1.0 );
|
|
61998
|
-
|
|
61999
|
-
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
62000
|
-
vToEye = cameraPosition - worldPosition.xyz;
|
|
62001
|
-
|
|
62002
|
-
vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex
|
|
62003
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
62004
|
-
|
|
62005
|
-
#include <logdepthbuf_vertex>
|
|
62006
|
-
#include <fog_vertex>
|
|
62007
|
-
|
|
62008
|
-
}`
|
|
62009
|
-
),
|
|
62010
|
-
fragmentShader: (
|
|
62011
|
-
/* glsl */
|
|
62012
|
-
`
|
|
62013
|
-
|
|
62014
|
-
#include <common>
|
|
62015
|
-
#include <fog_pars_fragment>
|
|
62016
|
-
#include <logdepthbuf_pars_fragment>
|
|
62017
|
-
|
|
62018
|
-
uniform sampler2D tReflectionMap;
|
|
62019
|
-
uniform sampler2D tRefractionMap;
|
|
62020
|
-
uniform sampler2D tNormalMap0;
|
|
62021
|
-
uniform sampler2D tNormalMap1;
|
|
62022
|
-
|
|
62023
|
-
#ifdef USE_FLOWMAP
|
|
62024
|
-
uniform sampler2D tFlowMap;
|
|
62025
|
-
#else
|
|
62026
|
-
uniform vec2 flowDirection;
|
|
62027
|
-
#endif
|
|
62028
|
-
|
|
62029
|
-
uniform vec3 color;
|
|
62030
|
-
uniform float reflectivity;
|
|
62031
|
-
uniform vec4 config;
|
|
62032
|
-
|
|
62033
|
-
varying vec4 vCoord;
|
|
62034
|
-
varying vec2 vUv;
|
|
62035
|
-
varying vec3 vToEye;
|
|
62036
|
-
|
|
62037
|
-
void main() {
|
|
62038
|
-
|
|
62039
|
-
#include <logdepthbuf_fragment>
|
|
62040
|
-
|
|
62041
|
-
float flowMapOffset0 = config.x;
|
|
62042
|
-
float flowMapOffset1 = config.y;
|
|
62043
|
-
float halfCycle = config.z;
|
|
62044
|
-
float scale = config.w;
|
|
62045
|
-
|
|
62046
|
-
vec3 toEye = normalize( vToEye );
|
|
62047
|
-
|
|
62048
|
-
// determine flow direction
|
|
62049
|
-
vec2 flow;
|
|
62050
|
-
#ifdef USE_FLOWMAP
|
|
62051
|
-
flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
|
|
62052
|
-
#else
|
|
62053
|
-
flow = flowDirection;
|
|
62054
|
-
#endif
|
|
62055
|
-
flow.x *= - 1.0;
|
|
62056
|
-
|
|
62057
|
-
// sample normal maps (distort uvs with flowdata)
|
|
62058
|
-
vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
|
|
62059
|
-
vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
|
|
62060
|
-
|
|
62061
|
-
// linear interpolate to get the final normal color
|
|
62062
|
-
float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
|
|
62063
|
-
vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
|
|
62064
|
-
|
|
62065
|
-
// calculate normal vector
|
|
62066
|
-
vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
|
|
62067
|
-
|
|
62068
|
-
// calculate the fresnel term to blend reflection and refraction maps
|
|
62069
|
-
// float theta = max( dot( toEye, normal ), 0.0 );
|
|
62070
|
-
vec3 adjustedEye = vec3(toEye.x, toEye.z, toEye.y);
|
|
62071
|
-
float theta = max( dot( adjustedEye, normal ), 0.0 );
|
|
62072
|
-
float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
|
|
62073
|
-
|
|
62074
|
-
// calculate final uv coords
|
|
62075
|
-
vec3 coord = vCoord.xyz / vCoord.w;
|
|
62076
|
-
vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
|
|
62077
|
-
|
|
62078
|
-
vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
|
|
62079
|
-
vec4 refractColor = texture2D( tRefractionMap, uv );
|
|
62080
|
-
|
|
62081
|
-
// multiply water color with the mix of both textures
|
|
62082
|
-
gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
|
|
62083
|
-
|
|
62084
|
-
#include <tonemapping_fragment>
|
|
62085
|
-
#include <colorspace_fragment>
|
|
62086
|
-
#include <fog_fragment>
|
|
62087
|
-
|
|
62088
|
-
}`
|
|
62089
|
-
)
|
|
62090
|
-
};
|
|
62091
|
-
class CityPlane extends ht {
|
|
62092
|
-
constructor(r) {
|
|
62093
|
-
super();
|
|
62094
|
-
C0(this, "options");
|
|
62095
|
-
C0(this, "plane");
|
|
62096
|
-
C0(this, "water");
|
|
62097
|
-
this.options = q0({
|
|
62098
|
-
color: "#0C4557",
|
|
62099
|
-
map: null
|
|
62100
|
-
}, r);
|
|
62101
|
-
}
|
|
62102
|
-
create() {
|
|
62103
|
-
return B0(this, null, function* () {
|
|
62104
|
-
const { width: r, height: m, color: v, map: C, material: _ } = this.options, w = new PlaneGeometry(r, m, 2, 2);
|
|
62105
|
-
this.plane = w;
|
|
62106
|
-
const I = _ || new MeshBasicMaterial({
|
|
62107
|
-
color: v,
|
|
62108
|
-
map: C
|
|
62109
|
-
});
|
|
62110
|
-
this.createMesh(w, I);
|
|
62111
|
-
});
|
|
62112
|
-
}
|
|
62113
|
-
addWater() {
|
|
62114
|
-
const r = this.pencil.loader, m = new Water(this.plane.clone(), {
|
|
62115
|
-
color: "#ffffff",
|
|
62116
|
-
scale: 1,
|
|
62117
|
-
flowDirection: new Vector2(0, 0),
|
|
62118
|
-
flowSpeed: 1e-9,
|
|
62119
|
-
textureWidth: 1024,
|
|
62120
|
-
textureHeight: 1024,
|
|
62121
|
-
normalMap0: r.getAsset("/image/water/normalMap0.jpg"),
|
|
62122
|
-
normalMap1: r.getAsset("/image/water/normalMap1.jpg"),
|
|
62123
|
-
reflectivity: 0.04
|
|
62124
|
-
});
|
|
62125
|
-
this.water = m, m.position.z = 1e-3, this.add(m);
|
|
62126
|
-
}
|
|
62127
|
-
}
|
|
62128
|
-
const fragmentShader = "varying vec2 vUv;uniform vec3 uColor;uniform float uOpacity;uniform float uSpeed;uniform float uLineCount;uniform float time;float PI=3.14159265;float drawCircle(float index,float range){float opacity=1.0;if(index>=1.0-range){opacity=1.0-(index-(1.0-range))/range;}else if(index<=range){opacity=index/range;}return opacity;}float distanceTo(vec2 src,vec2 dst){float dx=src.x-dst.x;float dy=src.y-dst.y;return sqrt(dx*dx+dy*dy);}void main(){float iTime=-time*uSpeed;float opacity=0.0;float len=distanceTo(vec2(0.5,0.5),vec2(vUv.x,vUv.y));float size=1.0/uLineCount;vec2 range=vec2(0.5,0.8);float index=mod(iTime+len,size);if(index<size&&len<=0.5){float i=sin(index/size*PI);if(i>=range.x&&i<=range.y){float t=(i-range.x)/(range.y-range.x);float r=0.3;opacity=drawCircle(t,r);}opacity*=1.0-len/0.5;}gl_FragColor=vec4(uColor,opacity*uOpacity);}", vertexShader = "varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}", fs = "uniform sampler2D uTexture;uniform vec2 uOffset;uniform float uRepeat;uniform float uOpacity;varying vec2 vUv;void main(){vec4 color=texture2D(uTexture,vUv+uOffset);float alpha=smoothstep(uRepeat,0.0,vUv.y);if(color.a<0.1){discard;}gl_FragColor=vec4(color.rgb,alpha*uOpacity);}", vs = "uniform float uRepeat;varying vec2 vUv;void main(){vUv=uv*uRepeat;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}", width = 10, height = 20, radialSegments = 32;
|
|
62129
|
-
function getCanvasTexture(g) {
|
|
62130
|
-
const t = document.createElement("canvas");
|
|
62131
|
-
t.width = 256, t.height = 256;
|
|
62132
|
-
const r = t.getContext("2d"), m = r.createLinearGradient(0, 0, 0, 256);
|
|
62133
|
-
m.addColorStop(0, `rgba(${g}, 1)`), m.addColorStop(0.1, `rgba(${g}, 1)`), m.addColorStop(0.1, "rgba(255, 255, 255, 0.00)"), m.addColorStop(1, "rgba(255, 255, 255, 0.00)"), r.fillStyle = m, r.fillRect(0, 0, 256, 256);
|
|
62134
|
-
const v = new CanvasTexture(t);
|
|
62135
|
-
return v.colorSpace = SRGBColorSpace, v.wrapT = RepeatWrapping, v.magFilter = NearestFilter, v.minFilter = NearestFilter, t.remove(), v;
|
|
62136
|
-
}
|
|
62137
|
-
class Target extends ht {
|
|
62138
|
-
constructor(r) {
|
|
62139
|
-
super();
|
|
62140
|
-
C0(this, "options");
|
|
62141
|
-
C0(this, "time", { value: 0 });
|
|
62142
|
-
C0(this, "offset", new Vector2(0, 0));
|
|
62143
|
-
C0(this, "timer", null);
|
|
62144
|
-
C0(this, "inTween", null);
|
|
62145
|
-
C0(this, "outTween", null);
|
|
62146
|
-
this.options = r;
|
|
62147
|
-
}
|
|
62148
|
-
createWave(r) {
|
|
62149
|
-
const m = width * 3, v = new PlaneGeometry(m, m, 1, 1), C = new ShaderMaterial({
|
|
62150
|
-
uniforms: {
|
|
62151
|
-
uColor: {
|
|
62152
|
-
value: new Color$1(`rgb(${r})`)
|
|
62153
|
-
},
|
|
62154
|
-
uOpacity: {
|
|
62155
|
-
value: 0
|
|
62156
|
-
},
|
|
62157
|
-
uSpeed: { value: 0.1 },
|
|
62158
|
-
uLineCount: { value: 3 },
|
|
62159
|
-
uRadius: { value: m / 2 },
|
|
62160
|
-
time: this.time
|
|
62161
|
-
},
|
|
62162
|
-
blending: AdditiveBlending,
|
|
62163
|
-
depthWrite: !1,
|
|
62164
|
-
transparent: !0,
|
|
62165
|
-
vertexShader,
|
|
62166
|
-
fragmentShader
|
|
62167
|
-
});
|
|
62168
|
-
return new Mesh(v, C);
|
|
62169
|
-
}
|
|
62170
|
-
createRipple(r) {
|
|
62171
|
-
const m = new ShaderMaterial({
|
|
62172
|
-
uniforms: {
|
|
62173
|
-
uTexture: {
|
|
62174
|
-
value: r
|
|
62175
|
-
},
|
|
62176
|
-
uOffset: {
|
|
62177
|
-
value: this.offset
|
|
62178
|
-
},
|
|
62179
|
-
uRepeat: {
|
|
62180
|
-
value: 6
|
|
62181
|
-
},
|
|
62182
|
-
uOpacity: {
|
|
62183
|
-
value: 1
|
|
62184
|
-
}
|
|
62185
|
-
},
|
|
62186
|
-
fragmentShader: fs,
|
|
62187
|
-
vertexShader: vs,
|
|
62188
|
-
transparent: !0,
|
|
62189
|
-
depthWrite: !1,
|
|
62190
|
-
blending: AdditiveBlending,
|
|
62191
|
-
side: DoubleSide
|
|
62192
|
-
}), v = width, C = height * 1.5, _ = new CylinderGeometry(
|
|
62193
|
-
v,
|
|
62194
|
-
v,
|
|
62195
|
-
C,
|
|
62196
|
-
radialSegments,
|
|
62197
|
-
1,
|
|
62198
|
-
!0
|
|
62199
|
-
), w = new Mesh(_, m);
|
|
62200
|
-
return w.translateZ(C / 2), w.rotateX(Math.PI / 2), w;
|
|
62201
|
-
}
|
|
62202
|
-
createCylinder(r) {
|
|
62203
|
-
const m = width - 0.1, v = new CylinderGeometry(
|
|
62204
|
-
m,
|
|
62205
|
-
// top
|
|
62206
|
-
m,
|
|
62207
|
-
// bottom
|
|
62208
|
-
height,
|
|
62209
|
-
radialSegments,
|
|
62210
|
-
1,
|
|
62211
|
-
!0
|
|
62212
|
-
), C = new MeshBasicMaterial({
|
|
62213
|
-
map: r,
|
|
62214
|
-
transparent: !0,
|
|
62215
|
-
side: DoubleSide,
|
|
62216
|
-
opacity: 0.3
|
|
62217
|
-
// depthWrite: false,
|
|
62218
|
-
// blending: THREE.AdditiveBlending,
|
|
62219
|
-
}), _ = new Object3D(), w = new Mesh(v, C);
|
|
62220
|
-
return w.translateZ(height / 2), w.rotateX(Math.PI / 2), _.add(w), _.scale.setZ(1), _;
|
|
62221
|
-
}
|
|
62222
|
-
createTorus(r) {
|
|
62223
|
-
const m = new TorusGeometry(width / 3, 0.4, 6, 36), v = new MeshBasicMaterial({
|
|
62224
|
-
color: `rgb(${r})`,
|
|
62225
|
-
transparent: !0,
|
|
62226
|
-
opacity: 0
|
|
62227
|
-
}), C = new Mesh(m, v);
|
|
62228
|
-
return C.translateZ(1), C;
|
|
62229
|
-
}
|
|
62230
|
-
create() {
|
|
62231
|
-
return B0(this, null, function* () {
|
|
62232
|
-
const { scale: r = 0.03 } = this.options;
|
|
62233
|
-
this.createGroup();
|
|
62234
|
-
const m = this.pencil.loader, v = "241, 241, 86", C = m.getAsset("/image/city/cylinder.webp"), _ = getCanvasTexture(v), w = this.createRipple(_);
|
|
62235
|
-
this.object3d.add(w);
|
|
62236
|
-
const I = this.createCylinder(C);
|
|
62237
|
-
this.object3d.add(I), this.object3d.scale.multiplyScalar(r);
|
|
62238
|
-
});
|
|
62239
|
-
}
|
|
62240
|
-
erase() {
|
|
62241
|
-
this.inTween && (this.inTween.stop(), this.inTween = null), this.timer && (clearTimeout(this.timer), this.timer = null), this.outTween && (this.outTween.stop(), this.outTween = null), super.erase();
|
|
62242
|
-
}
|
|
62243
|
-
update(r, m) {
|
|
62244
|
-
this.time.value += 0.01, this.offset.y -= 0.02;
|
|
62245
|
-
}
|
|
62246
|
-
}
|
|
62247
|
-
const objs$2 = Ji(q0({}, objs$3), {
|
|
62248
|
-
Building,
|
|
62249
|
-
Road,
|
|
62250
|
-
Area,
|
|
62251
|
-
CityPlane,
|
|
62252
|
-
Target
|
|
62253
|
-
}), setWaterMaterial = (g, t = {}) => {
|
|
62254
|
-
const r = t.textureWidth !== void 0 ? t.textureWidth : 512, m = t.textureHeight !== void 0 ? t.textureHeight : 512, v = t.alpha !== void 0 ? t.alpha : 1, C = t.waterNormals !== void 0 ? t.waterNormals : null, _ = new Color$1(
|
|
62255
|
-
t.waterColor !== void 0 ? t.waterColor : g.material.color
|
|
62256
|
-
), w = t.eye !== void 0 ? t.eye : new Vector3(0, 0, 0), I = t.distortionScale !== void 0 ? t.distortionScale : 0, O = t.side !== void 0 ? t.side : FrontSide, Pe = t.fog !== void 0 ? t.fog : !1, Ne = new Plane$1(), Fe = new Vector3(), Ae = new Vector3(), De = new Vector3(), xt = new Matrix4(), je = new Vector3(0, 0, -1), ke = new Vector4(), at = new Vector3(), ct = new Vector3(), Gt = new Vector4(), Lt = new Matrix4(), Wt = new PerspectiveCamera(), Pt = new WebGLRenderTarget(r, m), zt = {
|
|
62257
|
-
name: "MirrorShader",
|
|
62258
|
-
uniforms: UniformsUtils.merge([
|
|
62259
|
-
UniformsLib.fog,
|
|
62260
|
-
UniformsLib.lights,
|
|
62261
|
-
{
|
|
62262
|
-
normalSampler: { value: null },
|
|
62263
|
-
mirrorSampler: { value: null },
|
|
62264
|
-
alpha: { value: 1 },
|
|
62265
|
-
time: { value: 0 },
|
|
62266
|
-
size: { value: 1 },
|
|
62267
|
-
distortionScale: { value: 20 },
|
|
62268
|
-
textureMatrix: { value: new Matrix4() },
|
|
62269
|
-
eye: { value: new Vector3() },
|
|
62270
|
-
waterColor: { value: new Color$1(5592405) }
|
|
62271
|
-
}
|
|
62272
|
-
]),
|
|
62273
|
-
vertexShader: (
|
|
62274
|
-
/* glsl */
|
|
62275
|
-
`
|
|
62276
|
-
uniform mat4 textureMatrix;
|
|
62277
|
-
uniform float time;
|
|
62278
|
-
|
|
62279
|
-
varying vec4 mirrorCoord;
|
|
62280
|
-
varying vec4 worldPosition;
|
|
62281
|
-
|
|
62282
|
-
#include <common>
|
|
62283
|
-
#include <fog_pars_vertex>
|
|
62284
|
-
#include <shadowmap_pars_vertex>
|
|
62285
|
-
#include <logdepthbuf_pars_vertex>
|
|
62286
|
-
|
|
62287
|
-
void main() {
|
|
62288
|
-
mirrorCoord = modelMatrix * vec4( position, 1.0 );
|
|
62289
|
-
worldPosition = mirrorCoord.xyzw;
|
|
62290
|
-
mirrorCoord = textureMatrix * mirrorCoord;
|
|
62291
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
62292
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
62293
|
-
|
|
62294
|
-
#include <beginnormal_vertex>
|
|
62295
|
-
#include <defaultnormal_vertex>
|
|
62296
|
-
#include <logdepthbuf_vertex>
|
|
62297
|
-
#include <fog_vertex>
|
|
62298
|
-
#include <shadowmap_vertex>
|
|
62299
|
-
}`
|
|
62300
|
-
),
|
|
62301
|
-
fragmentShader: (
|
|
62302
|
-
/* glsl */
|
|
62303
|
-
`
|
|
62304
|
-
uniform sampler2D mirrorSampler;
|
|
62305
|
-
uniform float alpha;
|
|
62306
|
-
uniform float time;
|
|
62307
|
-
uniform float size;
|
|
62308
|
-
uniform float distortionScale;
|
|
62309
|
-
uniform sampler2D normalSampler;
|
|
62310
|
-
|
|
62311
|
-
|
|
62312
|
-
uniform vec3 eye;
|
|
62313
|
-
uniform vec3 waterColor;
|
|
62314
|
-
|
|
62315
|
-
varying vec4 mirrorCoord;
|
|
62316
|
-
varying vec4 worldPosition;
|
|
62317
|
-
|
|
62318
|
-
vec4 getNoise( vec2 uv ) {
|
|
62319
|
-
vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);
|
|
62320
|
-
vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );
|
|
62321
|
-
vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );
|
|
62322
|
-
vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );
|
|
62323
|
-
vec4 noise = texture2D( normalSampler, uv0 ) +
|
|
62324
|
-
texture2D( normalSampler, uv1 ) +
|
|
62325
|
-
texture2D( normalSampler, uv2 ) +
|
|
62326
|
-
texture2D( normalSampler, uv3 );
|
|
62327
|
-
return noise * 0.5 - 1.0;
|
|
62328
|
-
}
|
|
62329
|
-
|
|
62330
|
-
|
|
62331
|
-
#include <common>
|
|
62332
|
-
#include <packing>
|
|
62333
|
-
#include <bsdfs>
|
|
62334
|
-
#include <fog_pars_fragment>
|
|
62335
|
-
#include <logdepthbuf_pars_fragment>
|
|
62336
|
-
#include <lights_pars_begin>
|
|
62337
|
-
#include <shadowmap_pars_fragment>
|
|
62338
|
-
#include <shadowmask_pars_fragment>
|
|
62339
|
-
|
|
62340
|
-
void main() {
|
|
62341
|
-
|
|
62342
|
-
#include <logdepthbuf_fragment>
|
|
62343
|
-
vec4 noise = getNoise( worldPosition.xz * size );
|
|
62344
|
-
vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );
|
|
62345
|
-
|
|
62346
|
-
|
|
62347
|
-
vec3 worldToEye = eye-worldPosition.xyz;
|
|
62348
|
-
|
|
62349
|
-
|
|
62350
|
-
float distance = length(worldToEye);
|
|
62351
|
-
|
|
62352
|
-
vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;
|
|
62353
|
-
vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );
|
|
62354
|
-
vec3 m =mix(reflectionSample, waterColor, 0.5);
|
|
62355
|
-
gl_FragColor = vec4(m, alpha );
|
|
62356
|
-
|
|
62357
|
-
#include <tonemapping_fragment>
|
|
62358
|
-
#include <colorspace_fragment>
|
|
62359
|
-
#include <fog_fragment>
|
|
62360
|
-
}`
|
|
62361
|
-
)
|
|
62362
|
-
}, Nt = new ShaderMaterial({
|
|
62363
|
-
name: zt.name,
|
|
62364
|
-
uniforms: UniformsUtils.clone(zt.uniforms),
|
|
62365
|
-
vertexShader: zt.vertexShader,
|
|
62366
|
-
fragmentShader: zt.fragmentShader,
|
|
62367
|
-
lights: !0,
|
|
62368
|
-
side: O,
|
|
62369
|
-
fog: Pe
|
|
62370
|
-
});
|
|
62371
|
-
Nt.uniforms.mirrorSampler.value = Pt.texture, Nt.uniforms.textureMatrix.value = Lt, Nt.uniforms.alpha.value = v, Nt.uniforms.normalSampler.value = C, Nt.uniforms.waterColor.value = _, Nt.uniforms.distortionScale.value = I, Nt.uniforms.eye.value = w;
|
|
62372
|
-
const Kt = g.material;
|
|
62373
|
-
g.material = Nt, g.onBeforeRender = function(kt, n0, r0) {
|
|
62374
|
-
Kt.color !== Nt.uniforms.waterColor.value && (Nt.uniforms.waterColor.value = Kt.color), Ae.setFromMatrixPosition(g.matrixWorld), De.setFromMatrixPosition(r0.matrixWorld), xt.extractRotation(g.matrixWorld), Fe.set(0, 0, 1), Fe.applyMatrix4(xt), at.subVectors(Ae, De), r0.updateMatrix(), r0.updateMatrixWorld(), g.updateMatrix(), g.updateMatrixWorld();
|
|
62375
|
-
const l0 = new Frustum(), s0 = new Matrix4();
|
|
62376
|
-
if (s0.multiplyMatrices(
|
|
62377
|
-
r0.projectionMatrix,
|
|
62378
|
-
r0.matrixWorldInverse
|
|
62379
|
-
), l0.setFromProjectionMatrix(s0), !l0.intersectsObject(g) || at.dot(Fe) > 0)
|
|
62380
|
-
return;
|
|
62381
|
-
at.reflect(Fe).negate(), at.add(Ae), xt.extractRotation(r0.matrixWorld), je.set(0, 0, -1), je.applyMatrix4(xt), je.add(De), ct.subVectors(Ae, je), ct.reflect(Fe).negate(), ct.add(Ae), Wt.position.copy(at), Wt.up.set(0, 1, 0), Wt.up.applyMatrix4(xt), Wt.up.reflect(Fe), Wt.lookAt(ct), Wt.far = r0.far, Wt.updateMatrixWorld(), Wt.projectionMatrix.copy(r0.projectionMatrix), Lt.set(
|
|
62382
|
-
0.5,
|
|
62383
|
-
0,
|
|
62384
|
-
0,
|
|
62385
|
-
0.5,
|
|
62386
|
-
0,
|
|
62387
|
-
0.5,
|
|
62388
|
-
0,
|
|
62389
|
-
0.5,
|
|
62390
|
-
0,
|
|
62391
|
-
0,
|
|
62392
|
-
0.5,
|
|
62393
|
-
0.5,
|
|
62394
|
-
0,
|
|
62395
|
-
0,
|
|
62396
|
-
0,
|
|
62397
|
-
1
|
|
62398
|
-
), Lt.multiply(Wt.projectionMatrix), Lt.multiply(Wt.matrixWorldInverse), Ne.setFromNormalAndCoplanarPoint(Fe, Ae), Ne.applyMatrix4(Wt.matrixWorldInverse), ke.set(
|
|
62399
|
-
Ne.normal.x,
|
|
62400
|
-
Ne.normal.y,
|
|
62401
|
-
Ne.normal.z,
|
|
62402
|
-
Ne.constant
|
|
62403
|
-
);
|
|
62404
|
-
const qt = Wt.projectionMatrix;
|
|
62405
|
-
Gt.x = (Math.sign(ke.x) + qt.elements[8]) / qt.elements[0], Gt.y = (Math.sign(ke.y) + qt.elements[9]) / qt.elements[5], Gt.z = -1, Gt.w = (1 + qt.elements[10]) / qt.elements[14], ke.multiplyScalar(2 / ke.dot(Gt)), qt.elements[2] = ke.x, qt.elements[6] = ke.y, qt.elements[10] = ke.z + 1, qt.elements[14] = ke.w, w.setFromMatrixPosition(r0.matrixWorld);
|
|
62406
|
-
const t0 = kt.getRenderTarget(), Yt = kt.xr.enabled, a0 = kt.shadowMap.autoUpdate;
|
|
62407
|
-
g.visible = !1, kt.xr.enabled = !1, kt.shadowMap.autoUpdate = !1, kt.setRenderTarget(Pt), kt.state.buffers.depth.setMask(!0), kt.autoClear === !1 && kt.clear(), kt.render(n0, Wt), g.visible = !0, kt.xr.enabled = Yt, kt.shadowMap.autoUpdate = a0, kt.setRenderTarget(t0);
|
|
62408
|
-
const g0 = r0.viewport;
|
|
62409
|
-
g0 !== void 0 && kt.state.viewport(g0);
|
|
62410
|
-
};
|
|
62411
|
-
}, type = "FeatureCollection", features = [
|
|
61303
|
+
const type = "FeatureCollection", features = [
|
|
62412
61304
|
{
|
|
62413
61305
|
type: "Feature",
|
|
62414
61306
|
properties: {},
|
|
@@ -140485,11 +139377,1649 @@ const continentsBbox = continentsBboxObj, continentsM49 = {
|
|
|
140485
139377
|
parent: 0,
|
|
140486
139378
|
c: [],
|
|
140487
139379
|
b: [...worldExclATABbox]
|
|
140488
|
-
} : /^\d{6}$/.test(`${g}`) ? adcodeAll[g] : continentsType.find((t) => t.adcode === g)
|
|
139380
|
+
} : /^\d{6}$/.test(`${g}`) ? adcodeAll[g] : continentsType.find((t) => t.adcode === g), hideMaterial = new MeshBasicMaterial({
|
|
139381
|
+
colorWrite: !1,
|
|
139382
|
+
transparent: !0
|
|
139383
|
+
});
|
|
139384
|
+
let PlaneMap$1 = class extends ht {
|
|
139385
|
+
constructor(r) {
|
|
139386
|
+
var m;
|
|
139387
|
+
super();
|
|
139388
|
+
C0(this, "options");
|
|
139389
|
+
C0(this, "isActive", !0);
|
|
139390
|
+
C0(this, "groupArr", []);
|
|
139391
|
+
C0(this, "areaArr", []);
|
|
139392
|
+
C0(this, "lineArr");
|
|
139393
|
+
C0(this, "mergeSideArea", null);
|
|
139394
|
+
C0(this, "extrudelineArr");
|
|
139395
|
+
C0(this, "splitPolygons", 0);
|
|
139396
|
+
this.options = q0({
|
|
139397
|
+
areaGroup: !0,
|
|
139398
|
+
hasSide: !0,
|
|
139399
|
+
lineOffset: 0,
|
|
139400
|
+
topSegments: 0,
|
|
139401
|
+
depth: 2,
|
|
139402
|
+
bloom: !1,
|
|
139403
|
+
mergeSide: !1,
|
|
139404
|
+
onTop: 0
|
|
139405
|
+
}, r), ((m = this.options.projection.rotate) == null ? void 0 : m[0]) === -160 && (this.options.projection.projectionType === "winkel3" ? this.splitPolygons = 100 : this.splitPolygons = 300);
|
|
139406
|
+
}
|
|
139407
|
+
create() {
|
|
139408
|
+
return B0(this, null, function* () {
|
|
139409
|
+
const {
|
|
139410
|
+
geojson: r,
|
|
139411
|
+
extrudeLineGeojson: m,
|
|
139412
|
+
bbox: v,
|
|
139413
|
+
areaGroup: C,
|
|
139414
|
+
materialOptions: _,
|
|
139415
|
+
hasSide: w,
|
|
139416
|
+
mergeSide: I
|
|
139417
|
+
} = this.options;
|
|
139418
|
+
this.createGroup();
|
|
139419
|
+
const O = this.pencil.lead;
|
|
139420
|
+
if (C) {
|
|
139421
|
+
const Wt = yield Promise.all(
|
|
139422
|
+
r.features.map((Pt) => B0(this, null, function* () {
|
|
139423
|
+
const { properties: zt } = Pt, Nt = `${this.getPropertiesKey(zt)}`, Kt = yield O.draw("Group", {
|
|
139424
|
+
target: this,
|
|
139425
|
+
key: Nt
|
|
139426
|
+
});
|
|
139427
|
+
return Kt.object3d.name = (zt == null ? void 0 : zt.adcode) === "100000_JD" ? "十段线" : zt == null ? void 0 : zt.name, Kt.userData = q0({}, zt), Kt;
|
|
139428
|
+
}))
|
|
139429
|
+
);
|
|
139430
|
+
this.groupArr = Wt;
|
|
139431
|
+
}
|
|
139432
|
+
const {
|
|
139433
|
+
lineMat: Pe,
|
|
139434
|
+
extrudeLineMat: Ne,
|
|
139435
|
+
topMat: Fe,
|
|
139436
|
+
sideMat: Ae,
|
|
139437
|
+
bgTopMat: De,
|
|
139438
|
+
bgSideMat: xt,
|
|
139439
|
+
bgLineMat: je,
|
|
139440
|
+
bgExtrudeLineMat: ke
|
|
139441
|
+
} = _, [at, ct, Gt, Lt] = yield Promise.all([
|
|
139442
|
+
this.addArea(r, {
|
|
139443
|
+
material: w ? [Fe, I ? hideMaterial : Ae] : Fe,
|
|
139444
|
+
bbox: v,
|
|
139445
|
+
areaGroup: C,
|
|
139446
|
+
hasSide: w,
|
|
139447
|
+
hasTop: !0,
|
|
139448
|
+
castShadow: !I,
|
|
139449
|
+
onTop: this.options.onTop
|
|
139450
|
+
}),
|
|
139451
|
+
this.addLine(r, {
|
|
139452
|
+
material: Pe,
|
|
139453
|
+
onTop: this.options.onTop + 2,
|
|
139454
|
+
areaGroup: C
|
|
139455
|
+
}),
|
|
139456
|
+
m && this.addLine(m, {
|
|
139457
|
+
material: Ne,
|
|
139458
|
+
onTop: this.options.onTop + 3
|
|
139459
|
+
}),
|
|
139460
|
+
I && m && this.addArea(m, {
|
|
139461
|
+
material: Ae,
|
|
139462
|
+
bbox: v,
|
|
139463
|
+
castShadow: !0,
|
|
139464
|
+
areaGroup: !1,
|
|
139465
|
+
hasSide: !0,
|
|
139466
|
+
hasTop: !1,
|
|
139467
|
+
onTop: this.options.onTop
|
|
139468
|
+
})
|
|
139469
|
+
]);
|
|
139470
|
+
Lt && (this.mergeSideArea = Lt[0], this.mergeSideArea.object3d.name = "板块合并侧面"), this.areaArr = at, ct.forEach((Wt) => {
|
|
139471
|
+
Wt.position.z = this.options.depth + this.options.lineOffset;
|
|
139472
|
+
}), this.lineArr = ct, Gt && (Gt.forEach((Wt) => {
|
|
139473
|
+
Wt.position.z = this.options.depth + this.options.lineOffset, this.lead.updateBaseObjectKey(
|
|
139474
|
+
Wt,
|
|
139475
|
+
"$t:#" + this.getPropertiesKey({
|
|
139476
|
+
name: "extrudeLine"
|
|
139477
|
+
})
|
|
139478
|
+
);
|
|
139479
|
+
}), this.extrudelineArr = Gt), De && xt && this.setAreaMaterial("bg", [De, xt]), je && this.setLineMaterial("bg", je), ke && this.setExtrudeLineMaterial("bg", ke);
|
|
139480
|
+
});
|
|
139481
|
+
}
|
|
139482
|
+
addArea(r, m) {
|
|
139483
|
+
return B0(this, null, function* () {
|
|
139484
|
+
const { bbox: v, material: C, onTop: _ } = m, w = this.geojson2Meta(r), I = this.pencil.getPlugin("worker"), O = this.pencil.lead;
|
|
139485
|
+
if (this.pencil.mList, m.areaGroup)
|
|
139486
|
+
return yield Promise.all(
|
|
139487
|
+
w.map((Pe) => B0(this, null, function* () {
|
|
139488
|
+
const { coords: Ne, properties: Fe } = Pe, Ae = this.findGroup(this.getPropertiesKey(Fe)), De = yield I.geoGeometry(
|
|
139489
|
+
"extrudePolygon",
|
|
139490
|
+
{
|
|
139491
|
+
mesaage: {
|
|
139492
|
+
coordinatesArr: Ne,
|
|
139493
|
+
projection: this.options.projection,
|
|
139494
|
+
topSegments: this.options.topSegments,
|
|
139495
|
+
bbox: v,
|
|
139496
|
+
depth: [this.options.depth],
|
|
139497
|
+
hasBottom: !1,
|
|
139498
|
+
hasSide: m.hasSide,
|
|
139499
|
+
hasTop: m.hasTop,
|
|
139500
|
+
useGroups: m.hasSide && m.hasTop ? 2 : 0,
|
|
139501
|
+
splitPolygons: this.splitPolygons
|
|
139502
|
+
}
|
|
139503
|
+
}
|
|
139504
|
+
), xt = `${this.getPropertiesKey(Fe)}`, je = yield O.draw(
|
|
139505
|
+
"ExtrudePolygon",
|
|
139506
|
+
{
|
|
139507
|
+
key: xt,
|
|
139508
|
+
geometry: De,
|
|
139509
|
+
material: C,
|
|
139510
|
+
onTop: _
|
|
139511
|
+
},
|
|
139512
|
+
Ae
|
|
139513
|
+
);
|
|
139514
|
+
return je.object3d.name = "板块", m != null && m.castShadow && (je.object3d.castShadow = !0), je.userData = q0({}, Fe), je;
|
|
139515
|
+
}))
|
|
139516
|
+
);
|
|
139517
|
+
{
|
|
139518
|
+
const Pe = yield I.geoGeometry("extrudePolygon", {
|
|
139519
|
+
mesaage: {
|
|
139520
|
+
coordinatesArr: w.map(({ coords: Fe }) => Fe).flat(),
|
|
139521
|
+
projection: q0({}, this.options.projection),
|
|
139522
|
+
topSegments: this.options.topSegments,
|
|
139523
|
+
bbox: v,
|
|
139524
|
+
depth: [this.options.depth],
|
|
139525
|
+
hasSide: m.hasSide,
|
|
139526
|
+
hasTop: m.hasTop,
|
|
139527
|
+
hasBottom: !1,
|
|
139528
|
+
useGroups: 2,
|
|
139529
|
+
splitPolygons: this.splitPolygons
|
|
139530
|
+
}
|
|
139531
|
+
}), Ne = yield O.draw(
|
|
139532
|
+
"ExtrudePolygon",
|
|
139533
|
+
{
|
|
139534
|
+
key: this.getPropertiesKey({
|
|
139535
|
+
name: "all"
|
|
139536
|
+
}),
|
|
139537
|
+
geometry: Pe,
|
|
139538
|
+
material: C
|
|
139539
|
+
},
|
|
139540
|
+
this
|
|
139541
|
+
);
|
|
139542
|
+
return m != null && m.castShadow && (Ne.object3d.castShadow = !0), Ne.object3d.name = "板块", Ne.userData = {}, [Ne];
|
|
139543
|
+
}
|
|
139544
|
+
});
|
|
139545
|
+
}
|
|
139546
|
+
addLine(r, m) {
|
|
139547
|
+
return B0(this, null, function* () {
|
|
139548
|
+
const { material: v, onTop: C } = m, _ = this.geojson2Meta(r), w = this.pencil.getPlugin("worker"), I = this.pencil.lead;
|
|
139549
|
+
if (m.areaGroup)
|
|
139550
|
+
return yield Promise.all(
|
|
139551
|
+
_.map((O) => B0(this, null, function* () {
|
|
139552
|
+
const { coords: Pe, properties: Ne } = O, Fe = this.findGroup(this.getPropertiesKey(Ne)), Ae = yield w.geoGeometry("line", {
|
|
139553
|
+
mesaage: {
|
|
139554
|
+
coordinatesArr: Pe,
|
|
139555
|
+
lineWidth: [1],
|
|
139556
|
+
projection: this.options.projection,
|
|
139557
|
+
splitPolygons: this.splitPolygons
|
|
139558
|
+
}
|
|
139559
|
+
}), De = `${this.getPropertiesKey(Ne)}`, xt = yield I.draw(
|
|
139560
|
+
"Line",
|
|
139561
|
+
{
|
|
139562
|
+
key: De,
|
|
139563
|
+
geometry: Ae,
|
|
139564
|
+
material: v,
|
|
139565
|
+
onTop: C
|
|
139566
|
+
},
|
|
139567
|
+
Fe
|
|
139568
|
+
);
|
|
139569
|
+
return xt.userData = q0({}, Ne), xt.object3d.name = "线", xt;
|
|
139570
|
+
}))
|
|
139571
|
+
);
|
|
139572
|
+
{
|
|
139573
|
+
const O = yield w.geoGeometry("line", {
|
|
139574
|
+
mesaage: {
|
|
139575
|
+
coordinatesArr: _.map(({ coords: Ne }) => Ne).flat(),
|
|
139576
|
+
lineWidth: [1],
|
|
139577
|
+
projection: this.options.projection,
|
|
139578
|
+
splitPolygons: this.splitPolygons
|
|
139579
|
+
}
|
|
139580
|
+
}), Pe = yield I.draw(
|
|
139581
|
+
"Line",
|
|
139582
|
+
{
|
|
139583
|
+
key: this.getPropertiesKey({
|
|
139584
|
+
name: "all"
|
|
139585
|
+
}),
|
|
139586
|
+
geometry: O,
|
|
139587
|
+
material: v,
|
|
139588
|
+
onTop: C
|
|
139589
|
+
},
|
|
139590
|
+
this
|
|
139591
|
+
);
|
|
139592
|
+
return Pe.object3d.name = "线", [Pe];
|
|
139593
|
+
}
|
|
139594
|
+
});
|
|
139595
|
+
}
|
|
139596
|
+
getPropertiesKey(r) {
|
|
139597
|
+
return `${this.key.split("#")[1]}-${r.adcode || r.iso_a2 || r.name}`;
|
|
139598
|
+
}
|
|
139599
|
+
geojson2Meta(r) {
|
|
139600
|
+
return r.features.filter((m) => m.geometry).map((m) => {
|
|
139601
|
+
const { type: v, coordinates: C } = m.geometry;
|
|
139602
|
+
let _ = [];
|
|
139603
|
+
return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
|
|
139604
|
+
coords: _,
|
|
139605
|
+
properties: m.properties
|
|
139606
|
+
};
|
|
139607
|
+
});
|
|
139608
|
+
}
|
|
139609
|
+
update(r, m) {
|
|
139610
|
+
const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions;
|
|
139611
|
+
this.isActive && [v, C].forEach((_) => {
|
|
139612
|
+
!_ || !_.uniforms.lineLightAnimation.value || (_.uniforms.time.value = m);
|
|
139613
|
+
});
|
|
139614
|
+
}
|
|
139615
|
+
findGroup(r, m = !1) {
|
|
139616
|
+
return this.pencil.lead.getObject("Group", {
|
|
139617
|
+
key: `${m ? this.getPropertiesKey({
|
|
139618
|
+
adcode: r
|
|
139619
|
+
}) : r}`
|
|
139620
|
+
});
|
|
139621
|
+
}
|
|
139622
|
+
setAreaMaterial(r, m) {
|
|
139623
|
+
this.areaArr.forEach((v) => {
|
|
139624
|
+
v.setMaterialList(
|
|
139625
|
+
r,
|
|
139626
|
+
this.mergeSideArea && Array.isArray(m) ? [m[0], hideMaterial] : m
|
|
139627
|
+
);
|
|
139628
|
+
}), this.mergeSideArea && Array.isArray(m) && this.mergeSideArea.setMaterialList(r, m[1]);
|
|
139629
|
+
}
|
|
139630
|
+
useAreaMaterial(r) {
|
|
139631
|
+
this.areaArr.forEach((m) => {
|
|
139632
|
+
m.useMaterial(r);
|
|
139633
|
+
}), this.mergeSideArea && this.mergeSideArea.useMaterial(r);
|
|
139634
|
+
}
|
|
139635
|
+
setLineMaterial(r, m) {
|
|
139636
|
+
this.lineArr.forEach((v) => {
|
|
139637
|
+
v.setMaterialList(r, m);
|
|
139638
|
+
});
|
|
139639
|
+
}
|
|
139640
|
+
useLineMaterial(r) {
|
|
139641
|
+
this.lineArr.forEach((m) => {
|
|
139642
|
+
m.useMaterial(r);
|
|
139643
|
+
});
|
|
139644
|
+
}
|
|
139645
|
+
setExtrudeLineMaterial(r, m) {
|
|
139646
|
+
var v;
|
|
139647
|
+
(v = this.extrudelineArr) == null || v.forEach((C) => {
|
|
139648
|
+
C.setMaterialList(r, m);
|
|
139649
|
+
});
|
|
139650
|
+
}
|
|
139651
|
+
useExtrudeLineMaterial(r) {
|
|
139652
|
+
var m;
|
|
139653
|
+
(m = this.extrudelineArr) == null || m.forEach((v) => {
|
|
139654
|
+
v.useMaterial(r);
|
|
139655
|
+
});
|
|
139656
|
+
}
|
|
139657
|
+
changeLineAnimateParams({
|
|
139658
|
+
speed: r = 0.5,
|
|
139659
|
+
extrude: m = !1
|
|
139660
|
+
}) {
|
|
139661
|
+
const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions, _ = m ? C : v;
|
|
139662
|
+
if (!_) return;
|
|
139663
|
+
_.uniforms.time.value = 0, _.uniforms.speed.value = r, _.uniforms.lineLightAnimation.value = 1;
|
|
139664
|
+
const { size: w, min: I, max: O } = this.getSize();
|
|
139665
|
+
_.uniforms.size.value = Math.max(w.x, w.y) / 2, _.uniforms.uCenter.value = new Vector2(
|
|
139666
|
+
(I.x + O.x) / 2,
|
|
139667
|
+
(I.y + O.y) / 2
|
|
139668
|
+
);
|
|
139669
|
+
}
|
|
139670
|
+
deactive() {
|
|
139671
|
+
this.isActive && (this.options, this.isActive = !1, this.options.bloom && this.toggleExtrudelineBloom(!1), this.useAreaMaterial("bg"), this.useLineMaterial("bg"), this.useExtrudeLineMaterial("bg"));
|
|
139672
|
+
}
|
|
139673
|
+
render() {
|
|
139674
|
+
this.options.bloom && this.toggleExtrudelineBloom(!0);
|
|
139675
|
+
}
|
|
139676
|
+
toggleExtrudelineBloom(r) {
|
|
139677
|
+
var m;
|
|
139678
|
+
(m = this.extrudelineArr) == null || m.forEach((v) => {
|
|
139679
|
+
r ? v.enableBloom() : v.disableBloom();
|
|
139680
|
+
});
|
|
139681
|
+
}
|
|
139682
|
+
active() {
|
|
139683
|
+
this.isActive || (this.isActive = !0, this.useAreaMaterial("origin"), this.useLineMaterial("origin"), this.useExtrudeLineMaterial("origin"), this.options.bloom && this.toggleExtrudelineBloom(!0));
|
|
139684
|
+
}
|
|
139685
|
+
dispose() {
|
|
139686
|
+
super.dispose(), this.areaArr.length = 0, this.lineArr && (this.lineArr.length = 0), this.extrudelineArr && (this.extrudelineArr.length = 0);
|
|
139687
|
+
}
|
|
139688
|
+
// test(material: THREE.Material) {
|
|
139689
|
+
// material.onBeforeCompile = (shader) => {
|
|
139690
|
+
// shader.vertexShader = `
|
|
139691
|
+
// varying float vHeightPercent;
|
|
139692
|
+
// ${shader.vertexShader}
|
|
139693
|
+
// `.replace(
|
|
139694
|
+
// `#include <fog_vertex>`,
|
|
139695
|
+
// `
|
|
139696
|
+
// #include <fog_vertex>
|
|
139697
|
+
// vec4 zzz =vec4( transformed, 1.0 );
|
|
139698
|
+
// //min
|
|
139699
|
+
// float min = 1.0;
|
|
139700
|
+
// float max = 2.0;
|
|
139701
|
+
// float heightPercent = (zzz.z - min) / (max - min);
|
|
139702
|
+
// vHeightPercent = heightPercent;
|
|
139703
|
+
// `
|
|
139704
|
+
// );
|
|
139705
|
+
// shader.fragmentShader = `
|
|
139706
|
+
// varying float vHeightPercent;
|
|
139707
|
+
// ${shader.fragmentShader}
|
|
139708
|
+
// `.replace(
|
|
139709
|
+
// `#include <dithering_fragment>`,
|
|
139710
|
+
// `
|
|
139711
|
+
// #include <dithering_fragment>
|
|
139712
|
+
// vec3 valleyColor = vec3(0.0, 0.0, 1.0);
|
|
139713
|
+
// vec3 peakColor = vec3(1.0, 0.0, 0.0);
|
|
139714
|
+
// vec3 interpolatedColor = mix(valleyColor, peakColor, vHeightPercent);
|
|
139715
|
+
// gl_FragColor.rgb = interpolatedColor;
|
|
139716
|
+
// `
|
|
139717
|
+
// );
|
|
139718
|
+
// };
|
|
139719
|
+
// }
|
|
139720
|
+
};
|
|
139721
|
+
class Reflector extends Mesh {
|
|
139722
|
+
/**
|
|
139723
|
+
* Constructs a new reflector.
|
|
139724
|
+
*
|
|
139725
|
+
* @param {BufferGeometry} geometry - The reflector's geometry.
|
|
139726
|
+
* @param {Reflector~Options} [options] - The configuration options.
|
|
139727
|
+
*/
|
|
139728
|
+
constructor(t, r = {}) {
|
|
139729
|
+
super(t), this.isReflector = !0, this.type = "Reflector", this.forceUpdate = !1, this.camera = new PerspectiveCamera();
|
|
139730
|
+
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(8355711), C = r.textureWidth || 512, _ = r.textureHeight || 512, w = r.clipBias || 0, I = r.shader || Reflector.ReflectorShader, O = r.multisample !== void 0 ? r.multisample : 4, Pe = new Plane$1(), Ne = new Vector3(), Fe = new Vector3(), Ae = new Vector3(), De = new Matrix4(), xt = new Vector3(0, 0, -1), je = new Vector4(), ke = new Vector3(), at = new Vector3(), ct = new Vector4(), Gt = new Matrix4(), Lt = this.camera, Wt = new WebGLRenderTarget(C, _, { samples: O, type: HalfFloatType }), Pt = new ShaderMaterial({
|
|
139731
|
+
name: I.name !== void 0 ? I.name : "unspecified",
|
|
139732
|
+
uniforms: UniformsUtils.clone(I.uniforms),
|
|
139733
|
+
fragmentShader: I.fragmentShader,
|
|
139734
|
+
vertexShader: I.vertexShader
|
|
139735
|
+
});
|
|
139736
|
+
Pt.uniforms.tDiffuse.value = Wt.texture, Pt.uniforms.color.value = v, Pt.uniforms.textureMatrix.value = Gt, this.material = Pt, this.onBeforeRender = function(zt, Nt, Kt) {
|
|
139737
|
+
if (Fe.setFromMatrixPosition(m.matrixWorld), Ae.setFromMatrixPosition(Kt.matrixWorld), De.extractRotation(m.matrixWorld), Ne.set(0, 0, 1), Ne.applyMatrix4(De), ke.subVectors(Fe, Ae), ke.dot(Ne) > 0 === !0 && this.forceUpdate === !1) return;
|
|
139738
|
+
ke.reflect(Ne).negate(), ke.add(Fe), De.extractRotation(Kt.matrixWorld), xt.set(0, 0, -1), xt.applyMatrix4(De), xt.add(Ae), at.subVectors(Fe, xt), at.reflect(Ne).negate(), at.add(Fe), Lt.position.copy(ke), Lt.up.set(0, 1, 0), Lt.up.applyMatrix4(De), Lt.up.reflect(Ne), Lt.lookAt(at), Lt.far = Kt.far, Lt.updateMatrixWorld(), Lt.projectionMatrix.copy(Kt.projectionMatrix), Gt.set(
|
|
139739
|
+
0.5,
|
|
139740
|
+
0,
|
|
139741
|
+
0,
|
|
139742
|
+
0.5,
|
|
139743
|
+
0,
|
|
139744
|
+
0.5,
|
|
139745
|
+
0,
|
|
139746
|
+
0.5,
|
|
139747
|
+
0,
|
|
139748
|
+
0,
|
|
139749
|
+
0.5,
|
|
139750
|
+
0.5,
|
|
139751
|
+
0,
|
|
139752
|
+
0,
|
|
139753
|
+
0,
|
|
139754
|
+
1
|
|
139755
|
+
), Gt.multiply(Lt.projectionMatrix), Gt.multiply(Lt.matrixWorldInverse), Gt.multiply(m.matrixWorld), Pe.setFromNormalAndCoplanarPoint(Ne, Fe), Pe.applyMatrix4(Lt.matrixWorldInverse), je.set(Pe.normal.x, Pe.normal.y, Pe.normal.z, Pe.constant);
|
|
139756
|
+
const n0 = Lt.projectionMatrix;
|
|
139757
|
+
ct.x = (Math.sign(je.x) + n0.elements[8]) / n0.elements[0], ct.y = (Math.sign(je.y) + n0.elements[9]) / n0.elements[5], ct.z = -1, ct.w = (1 + n0.elements[10]) / n0.elements[14], je.multiplyScalar(2 / je.dot(ct)), n0.elements[2] = je.x, n0.elements[6] = je.y, n0.elements[10] = je.z + 1 - w, n0.elements[14] = je.w, m.visible = !1;
|
|
139758
|
+
const r0 = zt.getRenderTarget(), l0 = zt.xr.enabled, s0 = zt.shadowMap.autoUpdate;
|
|
139759
|
+
zt.xr.enabled = !1, zt.shadowMap.autoUpdate = !1, zt.setRenderTarget(Wt), zt.state.buffers.depth.setMask(!0), zt.autoClear === !1 && zt.clear(), zt.render(Nt, Lt), zt.xr.enabled = l0, zt.shadowMap.autoUpdate = s0, zt.setRenderTarget(r0);
|
|
139760
|
+
const qt = Kt.viewport;
|
|
139761
|
+
qt !== void 0 && zt.state.viewport(qt), m.visible = !0, this.forceUpdate = !1;
|
|
139762
|
+
}, this.getRenderTarget = function() {
|
|
139763
|
+
return Wt;
|
|
139764
|
+
}, this.dispose = function() {
|
|
139765
|
+
Wt.dispose(), m.material.dispose();
|
|
139766
|
+
};
|
|
139767
|
+
}
|
|
139768
|
+
}
|
|
139769
|
+
Reflector.ReflectorShader = {
|
|
139770
|
+
name: "ReflectorShader",
|
|
139771
|
+
uniforms: {
|
|
139772
|
+
color: {
|
|
139773
|
+
value: null
|
|
139774
|
+
},
|
|
139775
|
+
tDiffuse: {
|
|
139776
|
+
value: null
|
|
139777
|
+
},
|
|
139778
|
+
textureMatrix: {
|
|
139779
|
+
value: null
|
|
139780
|
+
}
|
|
139781
|
+
},
|
|
139782
|
+
vertexShader: (
|
|
139783
|
+
/* glsl */
|
|
139784
|
+
`
|
|
139785
|
+
uniform mat4 textureMatrix;
|
|
139786
|
+
varying vec4 vUv;
|
|
139787
|
+
|
|
139788
|
+
#include <common>
|
|
139789
|
+
#include <logdepthbuf_pars_vertex>
|
|
139790
|
+
|
|
139791
|
+
void main() {
|
|
139792
|
+
|
|
139793
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
139794
|
+
|
|
139795
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
139796
|
+
|
|
139797
|
+
#include <logdepthbuf_vertex>
|
|
139798
|
+
|
|
139799
|
+
}`
|
|
139800
|
+
),
|
|
139801
|
+
fragmentShader: (
|
|
139802
|
+
/* glsl */
|
|
139803
|
+
`
|
|
139804
|
+
uniform vec3 color;
|
|
139805
|
+
uniform sampler2D tDiffuse;
|
|
139806
|
+
varying vec4 vUv;
|
|
139807
|
+
|
|
139808
|
+
#include <logdepthbuf_pars_fragment>
|
|
139809
|
+
|
|
139810
|
+
float blendOverlay( float base, float blend ) {
|
|
139811
|
+
|
|
139812
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
139813
|
+
|
|
139814
|
+
}
|
|
139815
|
+
|
|
139816
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
139817
|
+
|
|
139818
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
139819
|
+
|
|
139820
|
+
}
|
|
139821
|
+
|
|
139822
|
+
void main() {
|
|
139823
|
+
|
|
139824
|
+
#include <logdepthbuf_fragment>
|
|
139825
|
+
|
|
139826
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
139827
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
139828
|
+
|
|
139829
|
+
#include <tonemapping_fragment>
|
|
139830
|
+
#include <colorspace_fragment>
|
|
139831
|
+
|
|
139832
|
+
}`
|
|
139833
|
+
)
|
|
139834
|
+
};
|
|
139835
|
+
class Refractor extends Mesh {
|
|
139836
|
+
/**
|
|
139837
|
+
* Constructs a new refractor.
|
|
139838
|
+
*
|
|
139839
|
+
* @param {BufferGeometry} geometry - The refractor's geometry.
|
|
139840
|
+
* @param {Refractor~Options} [options] - The configuration options.
|
|
139841
|
+
*/
|
|
139842
|
+
constructor(t, r = {}) {
|
|
139843
|
+
super(t), this.isRefractor = !0, this.type = "Refractor", this.camera = new PerspectiveCamera();
|
|
139844
|
+
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(8355711), C = r.textureWidth || 512, _ = r.textureHeight || 512, w = r.clipBias || 0, I = r.shader || Refractor.RefractorShader, O = r.multisample !== void 0 ? r.multisample : 4, Pe = this.camera;
|
|
139845
|
+
Pe.matrixAutoUpdate = !1, Pe.userData.refractor = !0;
|
|
139846
|
+
const Ne = new Plane$1(), Fe = new Matrix4(), Ae = new WebGLRenderTarget(C, _, { samples: O, type: HalfFloatType });
|
|
139847
|
+
this.material = new ShaderMaterial({
|
|
139848
|
+
name: I.name !== void 0 ? I.name : "unspecified",
|
|
139849
|
+
uniforms: UniformsUtils.clone(I.uniforms),
|
|
139850
|
+
vertexShader: I.vertexShader,
|
|
139851
|
+
fragmentShader: I.fragmentShader,
|
|
139852
|
+
transparent: !0
|
|
139853
|
+
// ensures, refractors are drawn from farthest to closest
|
|
139854
|
+
}), this.material.uniforms.color.value = v, this.material.uniforms.tDiffuse.value = Ae.texture, this.material.uniforms.textureMatrix.value = Fe;
|
|
139855
|
+
const De = function() {
|
|
139856
|
+
const ct = new Vector3(), Gt = new Vector3(), Lt = new Matrix4(), Wt = new Vector3(), Pt = new Vector3();
|
|
139857
|
+
return function(Nt) {
|
|
139858
|
+
return ct.setFromMatrixPosition(m.matrixWorld), Gt.setFromMatrixPosition(Nt.matrixWorld), Wt.subVectors(ct, Gt), Lt.extractRotation(m.matrixWorld), Pt.set(0, 0, 1), Pt.applyMatrix4(Lt), Wt.dot(Pt) < 0;
|
|
139859
|
+
};
|
|
139860
|
+
}(), xt = function() {
|
|
139861
|
+
const ct = new Vector3(), Gt = new Vector3(), Lt = new Quaternion(), Wt = new Vector3();
|
|
139862
|
+
return function() {
|
|
139863
|
+
m.matrixWorld.decompose(Gt, Lt, Wt), ct.set(0, 0, 1).applyQuaternion(Lt).normalize(), ct.negate(), Ne.setFromNormalAndCoplanarPoint(ct, Gt);
|
|
139864
|
+
};
|
|
139865
|
+
}(), je = function() {
|
|
139866
|
+
const ct = new Plane$1(), Gt = new Vector4(), Lt = new Vector4();
|
|
139867
|
+
return function(Pt) {
|
|
139868
|
+
Pe.matrixWorld.copy(Pt.matrixWorld), Pe.matrixWorldInverse.copy(Pe.matrixWorld).invert(), Pe.projectionMatrix.copy(Pt.projectionMatrix), Pe.far = Pt.far, ct.copy(Ne), ct.applyMatrix4(Pe.matrixWorldInverse), Gt.set(ct.normal.x, ct.normal.y, ct.normal.z, ct.constant);
|
|
139869
|
+
const zt = Pe.projectionMatrix;
|
|
139870
|
+
Lt.x = (Math.sign(Gt.x) + zt.elements[8]) / zt.elements[0], Lt.y = (Math.sign(Gt.y) + zt.elements[9]) / zt.elements[5], Lt.z = -1, Lt.w = (1 + zt.elements[10]) / zt.elements[14], Gt.multiplyScalar(2 / Gt.dot(Lt)), zt.elements[2] = Gt.x, zt.elements[6] = Gt.y, zt.elements[10] = Gt.z + 1 - w, zt.elements[14] = Gt.w;
|
|
139871
|
+
};
|
|
139872
|
+
}();
|
|
139873
|
+
function ke(ct) {
|
|
139874
|
+
Fe.set(
|
|
139875
|
+
0.5,
|
|
139876
|
+
0,
|
|
139877
|
+
0,
|
|
139878
|
+
0.5,
|
|
139879
|
+
0,
|
|
139880
|
+
0.5,
|
|
139881
|
+
0,
|
|
139882
|
+
0.5,
|
|
139883
|
+
0,
|
|
139884
|
+
0,
|
|
139885
|
+
0.5,
|
|
139886
|
+
0.5,
|
|
139887
|
+
0,
|
|
139888
|
+
0,
|
|
139889
|
+
0,
|
|
139890
|
+
1
|
|
139891
|
+
), Fe.multiply(ct.projectionMatrix), Fe.multiply(ct.matrixWorldInverse), Fe.multiply(m.matrixWorld);
|
|
139892
|
+
}
|
|
139893
|
+
function at(ct, Gt, Lt) {
|
|
139894
|
+
m.visible = !1;
|
|
139895
|
+
const Wt = ct.getRenderTarget(), Pt = ct.xr.enabled, zt = ct.shadowMap.autoUpdate;
|
|
139896
|
+
ct.xr.enabled = !1, ct.shadowMap.autoUpdate = !1, ct.setRenderTarget(Ae), ct.autoClear === !1 && ct.clear(), ct.render(Gt, Pe), ct.xr.enabled = Pt, ct.shadowMap.autoUpdate = zt, ct.setRenderTarget(Wt);
|
|
139897
|
+
const Nt = Lt.viewport;
|
|
139898
|
+
Nt !== void 0 && ct.state.viewport(Nt), m.visible = !0;
|
|
139899
|
+
}
|
|
139900
|
+
this.onBeforeRender = function(ct, Gt, Lt) {
|
|
139901
|
+
Lt.userData.refractor !== !0 && De(Lt) && (xt(), ke(Lt), je(Lt), at(ct, Gt, Lt));
|
|
139902
|
+
}, this.getRenderTarget = function() {
|
|
139903
|
+
return Ae;
|
|
139904
|
+
}, this.dispose = function() {
|
|
139905
|
+
Ae.dispose(), m.material.dispose();
|
|
139906
|
+
};
|
|
139907
|
+
}
|
|
139908
|
+
}
|
|
139909
|
+
Refractor.RefractorShader = {
|
|
139910
|
+
name: "RefractorShader",
|
|
139911
|
+
uniforms: {
|
|
139912
|
+
color: {
|
|
139913
|
+
value: null
|
|
139914
|
+
},
|
|
139915
|
+
tDiffuse: {
|
|
139916
|
+
value: null
|
|
139917
|
+
},
|
|
139918
|
+
textureMatrix: {
|
|
139919
|
+
value: null
|
|
139920
|
+
}
|
|
139921
|
+
},
|
|
139922
|
+
vertexShader: (
|
|
139923
|
+
/* glsl */
|
|
139924
|
+
`
|
|
139925
|
+
|
|
139926
|
+
uniform mat4 textureMatrix;
|
|
139927
|
+
|
|
139928
|
+
varying vec4 vUv;
|
|
139929
|
+
|
|
139930
|
+
void main() {
|
|
139931
|
+
|
|
139932
|
+
vUv = textureMatrix * vec4( position, 1.0 );
|
|
139933
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
139934
|
+
|
|
139935
|
+
}`
|
|
139936
|
+
),
|
|
139937
|
+
fragmentShader: (
|
|
139938
|
+
/* glsl */
|
|
139939
|
+
`
|
|
139940
|
+
|
|
139941
|
+
uniform vec3 color;
|
|
139942
|
+
uniform sampler2D tDiffuse;
|
|
139943
|
+
|
|
139944
|
+
varying vec4 vUv;
|
|
139945
|
+
|
|
139946
|
+
float blendOverlay( float base, float blend ) {
|
|
139947
|
+
|
|
139948
|
+
return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
|
|
139949
|
+
|
|
139950
|
+
}
|
|
139951
|
+
|
|
139952
|
+
vec3 blendOverlay( vec3 base, vec3 blend ) {
|
|
139953
|
+
|
|
139954
|
+
return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
|
|
139955
|
+
|
|
139956
|
+
}
|
|
139957
|
+
|
|
139958
|
+
void main() {
|
|
139959
|
+
|
|
139960
|
+
vec4 base = texture2DProj( tDiffuse, vUv );
|
|
139961
|
+
gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
|
|
139962
|
+
|
|
139963
|
+
#include <tonemapping_fragment>
|
|
139964
|
+
#include <colorspace_fragment>
|
|
139965
|
+
|
|
139966
|
+
}`
|
|
139967
|
+
)
|
|
139968
|
+
};
|
|
139969
|
+
class Water extends Mesh {
|
|
139970
|
+
constructor(t, r = {}) {
|
|
139971
|
+
super(t), this.isWater = !0, this.type = "Water";
|
|
139972
|
+
const m = this, v = r.color !== void 0 ? new Color$1(r.color) : new Color$1(16777215), C = r.textureWidth !== void 0 ? r.textureWidth : 512, _ = r.textureHeight !== void 0 ? r.textureHeight : 512, w = r.clipBias !== void 0 ? r.clipBias : 0, I = r.flowDirection !== void 0 ? r.flowDirection : new Vector2(1, 0), O = r.flowSpeed !== void 0 ? r.flowSpeed : 0.03, Pe = r.reflectivity !== void 0 ? r.reflectivity : 0.02, Ne = r.scale !== void 0 ? r.scale : 1, Fe = r.shader !== void 0 ? r.shader : Water.WaterShader, Ae = r.flowMap || void 0, De = r.normalMap0, xt = r.normalMap1;
|
|
139973
|
+
De.colorSpace = NoColorSpace, xt.colorSpace = NoColorSpace;
|
|
139974
|
+
const je = 0.15, ke = je * 0.5, at = new Matrix4(), ct = new Clock();
|
|
139975
|
+
if (Reflector === void 0) {
|
|
139976
|
+
console.error("THREE.Water: Required component Reflector not found.");
|
|
139977
|
+
return;
|
|
139978
|
+
}
|
|
139979
|
+
if (Refractor === void 0) {
|
|
139980
|
+
console.error("THREE.Water: Required component Refractor not found.");
|
|
139981
|
+
return;
|
|
139982
|
+
}
|
|
139983
|
+
const Gt = new Reflector(t, {
|
|
139984
|
+
textureWidth: C,
|
|
139985
|
+
textureHeight: _,
|
|
139986
|
+
clipBias: w
|
|
139987
|
+
}), Lt = new Refractor(t, {
|
|
139988
|
+
textureWidth: C,
|
|
139989
|
+
textureHeight: _,
|
|
139990
|
+
clipBias: w
|
|
139991
|
+
});
|
|
139992
|
+
Gt.matrixAutoUpdate = !1, Lt.matrixAutoUpdate = !1, this.material = new ShaderMaterial({
|
|
139993
|
+
name: Fe.name,
|
|
139994
|
+
uniforms: UniformsUtils.merge([UniformsLib.fog, Fe.uniforms]),
|
|
139995
|
+
vertexShader: Fe.vertexShader,
|
|
139996
|
+
fragmentShader: Fe.fragmentShader,
|
|
139997
|
+
transparent: !0,
|
|
139998
|
+
fog: !0
|
|
139999
|
+
}), Ae !== void 0 ? (this.material.defines.USE_FLOWMAP = "", this.material.uniforms.tFlowMap = {
|
|
140000
|
+
type: "t",
|
|
140001
|
+
value: Ae
|
|
140002
|
+
}) : this.material.uniforms.flowDirection = {
|
|
140003
|
+
type: "v2",
|
|
140004
|
+
value: I
|
|
140005
|
+
}, De.wrapS = De.wrapT = RepeatWrapping, xt.wrapS = xt.wrapT = RepeatWrapping, this.material.uniforms.tReflectionMap.value = Gt.getRenderTarget().texture, this.material.uniforms.tRefractionMap.value = Lt.getRenderTarget().texture, this.material.uniforms.tNormalMap0.value = De, this.material.uniforms.tNormalMap1.value = xt, this.material.uniforms.color.value = v, this.material.uniforms.reflectivity.value = Pe, this.material.uniforms.textureMatrix.value = at, this.material.uniforms.config.value.x = 0, this.material.uniforms.config.value.y = ke, this.material.uniforms.config.value.z = ke, this.material.uniforms.config.value.w = Ne;
|
|
140006
|
+
function Wt(zt) {
|
|
140007
|
+
at.set(
|
|
140008
|
+
0.5,
|
|
140009
|
+
0,
|
|
140010
|
+
0,
|
|
140011
|
+
0.5,
|
|
140012
|
+
0,
|
|
140013
|
+
0.5,
|
|
140014
|
+
0,
|
|
140015
|
+
0.5,
|
|
140016
|
+
0,
|
|
140017
|
+
0,
|
|
140018
|
+
0.5,
|
|
140019
|
+
0.5,
|
|
140020
|
+
0,
|
|
140021
|
+
0,
|
|
140022
|
+
0,
|
|
140023
|
+
1
|
|
140024
|
+
), at.multiply(zt.projectionMatrix), at.multiply(zt.matrixWorldInverse), at.multiply(m.matrixWorld);
|
|
140025
|
+
}
|
|
140026
|
+
function Pt() {
|
|
140027
|
+
const zt = ct.getDelta(), Nt = m.material.uniforms.config;
|
|
140028
|
+
Nt.value.x += O * zt, Nt.value.y = Nt.value.x + ke, Nt.value.x >= je ? (Nt.value.x = 0, Nt.value.y = ke) : Nt.value.y >= je && (Nt.value.y = Nt.value.y - je);
|
|
140029
|
+
}
|
|
140030
|
+
this.onBeforeRender = function(zt, Nt, Kt) {
|
|
140031
|
+
Wt(Kt), Pt(), m.visible = !1, Gt.matrixWorld.copy(m.matrixWorld), Lt.matrixWorld.copy(m.matrixWorld), Gt.onBeforeRender(zt, Nt, Kt), Lt.onBeforeRender(zt, Nt, Kt), m.visible = !0;
|
|
140032
|
+
};
|
|
140033
|
+
}
|
|
140034
|
+
}
|
|
140035
|
+
Water.WaterShader = {
|
|
140036
|
+
name: "WaterShader",
|
|
140037
|
+
uniforms: {
|
|
140038
|
+
color: {
|
|
140039
|
+
type: "c",
|
|
140040
|
+
value: null
|
|
140041
|
+
},
|
|
140042
|
+
reflectivity: {
|
|
140043
|
+
type: "f",
|
|
140044
|
+
value: 0
|
|
140045
|
+
},
|
|
140046
|
+
tReflectionMap: {
|
|
140047
|
+
type: "t",
|
|
140048
|
+
value: null
|
|
140049
|
+
},
|
|
140050
|
+
tRefractionMap: {
|
|
140051
|
+
type: "t",
|
|
140052
|
+
value: null
|
|
140053
|
+
},
|
|
140054
|
+
tNormalMap0: {
|
|
140055
|
+
type: "t",
|
|
140056
|
+
value: null
|
|
140057
|
+
},
|
|
140058
|
+
tNormalMap1: {
|
|
140059
|
+
type: "t",
|
|
140060
|
+
value: null
|
|
140061
|
+
},
|
|
140062
|
+
textureMatrix: {
|
|
140063
|
+
type: "m4",
|
|
140064
|
+
value: null
|
|
140065
|
+
},
|
|
140066
|
+
config: {
|
|
140067
|
+
type: "v4",
|
|
140068
|
+
value: new Vector4()
|
|
140069
|
+
}
|
|
140070
|
+
},
|
|
140071
|
+
vertexShader: (
|
|
140072
|
+
/* glsl */
|
|
140073
|
+
`
|
|
140074
|
+
|
|
140075
|
+
#include <common>
|
|
140076
|
+
#include <fog_pars_vertex>
|
|
140077
|
+
#include <logdepthbuf_pars_vertex>
|
|
140078
|
+
|
|
140079
|
+
uniform mat4 textureMatrix;
|
|
140080
|
+
|
|
140081
|
+
varying vec4 vCoord;
|
|
140082
|
+
varying vec2 vUv;
|
|
140083
|
+
varying vec3 vToEye;
|
|
140084
|
+
|
|
140085
|
+
void main() {
|
|
140086
|
+
|
|
140087
|
+
vUv = uv;
|
|
140088
|
+
vCoord = textureMatrix * vec4( position, 1.0 );
|
|
140089
|
+
|
|
140090
|
+
vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
|
|
140091
|
+
vToEye = cameraPosition - worldPosition.xyz;
|
|
140092
|
+
|
|
140093
|
+
vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex
|
|
140094
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
140095
|
+
|
|
140096
|
+
#include <logdepthbuf_vertex>
|
|
140097
|
+
#include <fog_vertex>
|
|
140098
|
+
|
|
140099
|
+
}`
|
|
140100
|
+
),
|
|
140101
|
+
fragmentShader: (
|
|
140102
|
+
/* glsl */
|
|
140103
|
+
`
|
|
140104
|
+
|
|
140105
|
+
#include <common>
|
|
140106
|
+
#include <fog_pars_fragment>
|
|
140107
|
+
#include <logdepthbuf_pars_fragment>
|
|
140108
|
+
|
|
140109
|
+
uniform sampler2D tReflectionMap;
|
|
140110
|
+
uniform sampler2D tRefractionMap;
|
|
140111
|
+
uniform sampler2D tNormalMap0;
|
|
140112
|
+
uniform sampler2D tNormalMap1;
|
|
140113
|
+
|
|
140114
|
+
#ifdef USE_FLOWMAP
|
|
140115
|
+
uniform sampler2D tFlowMap;
|
|
140116
|
+
#else
|
|
140117
|
+
uniform vec2 flowDirection;
|
|
140118
|
+
#endif
|
|
140119
|
+
|
|
140120
|
+
uniform vec3 color;
|
|
140121
|
+
uniform float reflectivity;
|
|
140122
|
+
uniform vec4 config;
|
|
140123
|
+
|
|
140124
|
+
varying vec4 vCoord;
|
|
140125
|
+
varying vec2 vUv;
|
|
140126
|
+
varying vec3 vToEye;
|
|
140127
|
+
|
|
140128
|
+
void main() {
|
|
140129
|
+
|
|
140130
|
+
#include <logdepthbuf_fragment>
|
|
140131
|
+
|
|
140132
|
+
float flowMapOffset0 = config.x;
|
|
140133
|
+
float flowMapOffset1 = config.y;
|
|
140134
|
+
float halfCycle = config.z;
|
|
140135
|
+
float scale = config.w;
|
|
140136
|
+
|
|
140137
|
+
vec3 toEye = normalize( vToEye );
|
|
140138
|
+
|
|
140139
|
+
// determine flow direction
|
|
140140
|
+
vec2 flow;
|
|
140141
|
+
#ifdef USE_FLOWMAP
|
|
140142
|
+
flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
|
|
140143
|
+
#else
|
|
140144
|
+
flow = flowDirection;
|
|
140145
|
+
#endif
|
|
140146
|
+
flow.x *= - 1.0;
|
|
140147
|
+
|
|
140148
|
+
// sample normal maps (distort uvs with flowdata)
|
|
140149
|
+
vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
|
|
140150
|
+
vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
|
|
140151
|
+
|
|
140152
|
+
// linear interpolate to get the final normal color
|
|
140153
|
+
float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
|
|
140154
|
+
vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
|
|
140155
|
+
|
|
140156
|
+
// calculate normal vector
|
|
140157
|
+
vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
|
|
140158
|
+
|
|
140159
|
+
// calculate the fresnel term to blend reflection and refraction maps
|
|
140160
|
+
// float theta = max( dot( toEye, normal ), 0.0 );
|
|
140161
|
+
vec3 adjustedEye = vec3(toEye.x, toEye.z, toEye.y);
|
|
140162
|
+
float theta = max( dot( adjustedEye, normal ), 0.0 );
|
|
140163
|
+
float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
|
|
140164
|
+
|
|
140165
|
+
// calculate final uv coords
|
|
140166
|
+
vec3 coord = vCoord.xyz / vCoord.w;
|
|
140167
|
+
vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
|
|
140168
|
+
|
|
140169
|
+
vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
|
|
140170
|
+
vec4 refractColor = texture2D( tRefractionMap, uv );
|
|
140171
|
+
|
|
140172
|
+
// multiply water color with the mix of both textures
|
|
140173
|
+
gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
|
|
140174
|
+
|
|
140175
|
+
#include <tonemapping_fragment>
|
|
140176
|
+
#include <colorspace_fragment>
|
|
140177
|
+
#include <fog_fragment>
|
|
140178
|
+
|
|
140179
|
+
}`
|
|
140180
|
+
)
|
|
140181
|
+
};
|
|
140182
|
+
class CityPlane extends ht {
|
|
140183
|
+
constructor(r) {
|
|
140184
|
+
super();
|
|
140185
|
+
C0(this, "options");
|
|
140186
|
+
C0(this, "plane");
|
|
140187
|
+
C0(this, "water");
|
|
140188
|
+
this.options = q0({
|
|
140189
|
+
color: "#0C4557",
|
|
140190
|
+
map: null
|
|
140191
|
+
}, r);
|
|
140192
|
+
}
|
|
140193
|
+
create() {
|
|
140194
|
+
return B0(this, null, function* () {
|
|
140195
|
+
const { width: r, height: m, color: v, map: C, material: _ } = this.options, w = new PlaneGeometry(r, m, 2, 2);
|
|
140196
|
+
this.plane = w;
|
|
140197
|
+
const I = _ || new MeshBasicMaterial({
|
|
140198
|
+
color: v,
|
|
140199
|
+
map: C
|
|
140200
|
+
});
|
|
140201
|
+
this.createMesh(w, I);
|
|
140202
|
+
});
|
|
140203
|
+
}
|
|
140204
|
+
addWater() {
|
|
140205
|
+
const r = this.pencil.loader, m = new Water(this.plane.clone(), {
|
|
140206
|
+
color: "#ffffff",
|
|
140207
|
+
scale: 1,
|
|
140208
|
+
flowDirection: new Vector2(0, 0),
|
|
140209
|
+
flowSpeed: 1e-9,
|
|
140210
|
+
textureWidth: 1024,
|
|
140211
|
+
textureHeight: 1024,
|
|
140212
|
+
normalMap0: r.getAsset("/image/water/normalMap0.jpg"),
|
|
140213
|
+
normalMap1: r.getAsset("/image/water/normalMap1.jpg"),
|
|
140214
|
+
reflectivity: 0.04
|
|
140215
|
+
});
|
|
140216
|
+
this.water = m, m.position.z = 1e-3, this.add(m);
|
|
140217
|
+
}
|
|
140218
|
+
}
|
|
140219
|
+
class ContinentsBg extends ht {
|
|
140220
|
+
constructor(r) {
|
|
140221
|
+
super();
|
|
140222
|
+
C0(this, "options");
|
|
140223
|
+
C0(this, "mapArr", []);
|
|
140224
|
+
this.options = r;
|
|
140225
|
+
}
|
|
140226
|
+
create() {
|
|
140227
|
+
return B0(this, null, function* () {
|
|
140228
|
+
const { depth: r } = this.options, m = this.pencil.mList, v = this.pencil.lead, C = m.getMultiple("continents");
|
|
140229
|
+
this.createGroup(), this.object3d.name = "大洲", yield Promise.all(
|
|
140230
|
+
Object.values(continentsLiteJson).map((_) => B0(this, null, function* () {
|
|
140231
|
+
const w = _.features[0], I = w.properties.adcode;
|
|
140232
|
+
if (I === 10) return;
|
|
140233
|
+
const O = centroid(w).geometry.coordinates;
|
|
140234
|
+
let Pe = 0, Ne = 0, Fe = this.options.scale;
|
|
140235
|
+
const Ae = 30, De = 25;
|
|
140236
|
+
I === 5 ? (Pe = -Ae, Ne = De, Fe = Fe * 0.2) : I === 21 ? (Pe = 0, Ne = De, Fe = Fe * 0.18) : I === 9 ? (Pe = Ae, Ne = De, Fe = Fe * 0.3) : I === 142 ? (Pe = -Ae, Ne = -De, Fe = Fe * 0.15) : I === 150 ? (Pe = 0, Ne = -De, Fe = Fe * 0.3) : I === 2 && (Pe = Ae, Ne = -De, Fe = Fe * 0.2);
|
|
140237
|
+
const xt = yield v.draw(
|
|
140238
|
+
"PlaneMap",
|
|
140239
|
+
{
|
|
140240
|
+
key: `${this.key}-${I}`,
|
|
140241
|
+
geojson: _,
|
|
140242
|
+
projection: {
|
|
140243
|
+
center: O,
|
|
140244
|
+
scale: Fe,
|
|
140245
|
+
rotate: [0, 0],
|
|
140246
|
+
projectionType: "equirectangular"
|
|
140247
|
+
},
|
|
140248
|
+
areaGroup: !1,
|
|
140249
|
+
// bbox: bboxworld,
|
|
140250
|
+
depth: r,
|
|
140251
|
+
materialOptions: q0({}, C)
|
|
140252
|
+
},
|
|
140253
|
+
this
|
|
140254
|
+
);
|
|
140255
|
+
xt.userData.projection = f({
|
|
140256
|
+
center: O,
|
|
140257
|
+
scale: Fe,
|
|
140258
|
+
rotate: [0, 0],
|
|
140259
|
+
projectionType: "equirectangular"
|
|
140260
|
+
}), xt.object3d.name = w.properties.name, xt.userData.name = w.properties.name, xt.position.set(Pe, Ne, 0), this.mapArr.push(xt);
|
|
140261
|
+
}))
|
|
140262
|
+
);
|
|
140263
|
+
});
|
|
140264
|
+
}
|
|
140265
|
+
getPointInContinentInfo(r) {
|
|
140266
|
+
var m;
|
|
140267
|
+
return (m = Object.values(continentsLiteJson).map((v) => v.features).find((v) => v[0].geometry.coordinates.some((C) => C.length ? booleanPointInPolygon$1(point(r), polygon(C)) : !1))) == null ? void 0 : m[0];
|
|
140268
|
+
}
|
|
140269
|
+
getPointInContinent(r) {
|
|
140270
|
+
return !!this.getPointInContinentInfo(r);
|
|
140271
|
+
}
|
|
140272
|
+
getLocationPosition(r, m) {
|
|
140273
|
+
var C;
|
|
140274
|
+
const v = m || ((C = this.getPointInContinentInfo(r)) == null ? void 0 : C.properties.name);
|
|
140275
|
+
if (v) {
|
|
140276
|
+
const _ = this.mapArr.find((w) => w.userData.name === v);
|
|
140277
|
+
if (_) {
|
|
140278
|
+
const { projection: w } = _.userData, [I, O] = r, [Pe, Ne] = w([I, O]), Fe = new Vector3(Pe, -Ne, this.options.depth);
|
|
140279
|
+
return Fe.applyMatrix4(_.object3d.matrixWorld), [Fe.x, Fe.y, Fe.z];
|
|
140280
|
+
}
|
|
140281
|
+
}
|
|
140282
|
+
}
|
|
140283
|
+
render() {
|
|
140284
|
+
this.lead.updateBaseObjectKey(this, "continents-group"), this.mapArr.forEach((r) => {
|
|
140285
|
+
this.lead.updateBaseObjectKey(r, "continents-" + r.userData.name);
|
|
140286
|
+
});
|
|
140287
|
+
}
|
|
140288
|
+
dispose() {
|
|
140289
|
+
this.mapArr.forEach((r) => {
|
|
140290
|
+
r.dispose();
|
|
140291
|
+
}), this.mapArr.length = 0;
|
|
140292
|
+
}
|
|
140293
|
+
}
|
|
140294
|
+
class PlaneMap extends ht {
|
|
140295
|
+
constructor(r) {
|
|
140296
|
+
super();
|
|
140297
|
+
C0(this, "options");
|
|
140298
|
+
C0(this, "extrudePolygon");
|
|
140299
|
+
this.options = q0({
|
|
140300
|
+
depth: 2
|
|
140301
|
+
}, r);
|
|
140302
|
+
}
|
|
140303
|
+
geojson2Meta(r) {
|
|
140304
|
+
return r.features.filter((m) => m.geometry).map((m) => {
|
|
140305
|
+
const { type: v, coordinates: C } = m.geometry;
|
|
140306
|
+
let _ = [];
|
|
140307
|
+
return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
|
|
140308
|
+
coords: _,
|
|
140309
|
+
properties: m.properties
|
|
140310
|
+
};
|
|
140311
|
+
});
|
|
140312
|
+
}
|
|
140313
|
+
create() {
|
|
140314
|
+
return B0(this, null, function* () {
|
|
140315
|
+
const { geojson: r, bbox: m } = this.options, v = this.geojson2Meta(r), C = this.pencil.getPlugin("worker"), _ = this.pencil.lead, I = yield this.pencil.loader.load("/1.png"), O = yield C.geoGeometry("extrudePolygon", {
|
|
140316
|
+
mesaage: {
|
|
140317
|
+
coordinatesArr: v.map(({ coords: at }) => at).flat(),
|
|
140318
|
+
projection: q0({}, this.options.projection),
|
|
140319
|
+
topSegments: 100,
|
|
140320
|
+
bbox: m,
|
|
140321
|
+
depth: [this.options.depth],
|
|
140322
|
+
hasBottom: !1,
|
|
140323
|
+
hasSide: !1
|
|
140324
|
+
}
|
|
140325
|
+
}), Pe = O.attributes.position.count;
|
|
140326
|
+
O.setAttribute(
|
|
140327
|
+
"color",
|
|
140328
|
+
new BufferAttribute(new Float32Array(Pe * 3), 3)
|
|
140329
|
+
);
|
|
140330
|
+
const Ne = this.options.depth;
|
|
140331
|
+
this.setNoise(O, I.image, Ne);
|
|
140332
|
+
const Fe = new Color$1(), Ae = O.attributes.color, De = O.attributes.position, xt = new Color$1("red"), je = new Color$1("green");
|
|
140333
|
+
for (let at = 0; at < Pe; at++) {
|
|
140334
|
+
const ct = De.getZ(at) / Ne;
|
|
140335
|
+
Fe.lerpColors(xt, je, ct), Ae.setXYZ(at, Fe.r, Fe.g, Fe.b);
|
|
140336
|
+
}
|
|
140337
|
+
const ke = yield _.draw(
|
|
140338
|
+
"ExtrudePolygon",
|
|
140339
|
+
{
|
|
140340
|
+
geometry: O,
|
|
140341
|
+
material: new MeshStandardMaterial({
|
|
140342
|
+
flatShading: !0,
|
|
140343
|
+
vertexColors: !0
|
|
140344
|
+
})
|
|
140345
|
+
},
|
|
140346
|
+
null
|
|
140347
|
+
);
|
|
140348
|
+
ke.position.z += 1e-3, this.extrudePolygon = ke, this.object3d = ke.object3d;
|
|
140349
|
+
});
|
|
140350
|
+
}
|
|
140351
|
+
setNoise(r, m, v = 1) {
|
|
140352
|
+
const C = document.createElement("canvas"), _ = [];
|
|
140353
|
+
C.width = m.width, C.height = m.height;
|
|
140354
|
+
const w = C.getContext("2d");
|
|
140355
|
+
w.drawImage(m, 0, 0);
|
|
140356
|
+
const O = w.getImageData(0, 0, m.width, m.height).data;
|
|
140357
|
+
for (let Ae = 0; Ae < m.height; Ae++) {
|
|
140358
|
+
_[Ae] = [];
|
|
140359
|
+
for (let De = 0; De < m.width; De++) {
|
|
140360
|
+
const xt = (Ae * m.width + De) * 4, je = O[xt];
|
|
140361
|
+
_[Ae][De] = je / 255;
|
|
140362
|
+
}
|
|
140363
|
+
}
|
|
140364
|
+
const Pe = r.attributes.position, Ne = r.attributes.uv, Fe = new Vector2();
|
|
140365
|
+
for (let Ae = 0; Ae < Pe.count; Ae++) {
|
|
140366
|
+
Fe.fromBufferAttribute(Ne, Ae);
|
|
140367
|
+
let De = Math.round(Fe.x * m.width) - 1, xt = Math.round(Fe.y * m.height) - 1;
|
|
140368
|
+
De < 0 && (De = 0), xt < 0 && (xt = 0);
|
|
140369
|
+
const je = _[xt][De];
|
|
140370
|
+
Pe.setZ(Ae, je * v);
|
|
140371
|
+
}
|
|
140372
|
+
}
|
|
140373
|
+
render() {
|
|
140374
|
+
this.mList.rmBaseObjectMap(this.extrudePolygon);
|
|
140375
|
+
}
|
|
140376
|
+
dispose() {
|
|
140377
|
+
this.extrudePolygon.dispose(), super.dispose();
|
|
140378
|
+
}
|
|
140379
|
+
}
|
|
140380
|
+
const objs$2 = Ji(q0({}, objs$3), {
|
|
140381
|
+
PlaneMap: PlaneMap$1,
|
|
140382
|
+
CityPlane,
|
|
140383
|
+
ContinentsBg,
|
|
140384
|
+
Mountain: PlaneMap
|
|
140385
|
+
});
|
|
140386
|
+
function clipGeojson(g, t) {
|
|
140387
|
+
const r = flatten$3(g).features, m = flatten$3(t).features, v = {
|
|
140388
|
+
type: "FeatureCollection",
|
|
140389
|
+
features: []
|
|
140390
|
+
};
|
|
140391
|
+
for (let C = r.length - 1; C >= 0; C--) {
|
|
140392
|
+
const _ = r[C];
|
|
140393
|
+
for (let w = m.length - 1; w >= 0; w--) {
|
|
140394
|
+
const I = m[w];
|
|
140395
|
+
if (contains(_, I))
|
|
140396
|
+
v.features.push(I);
|
|
140397
|
+
else if (contains(I, _))
|
|
140398
|
+
_.properties = I.properties, v.features.push(_);
|
|
140399
|
+
else {
|
|
140400
|
+
const O = intersect$1(_, I);
|
|
140401
|
+
O && (O.properties = I.properties, v.features.push(O));
|
|
140402
|
+
}
|
|
140403
|
+
}
|
|
140404
|
+
}
|
|
140405
|
+
return v;
|
|
140406
|
+
}
|
|
140407
|
+
function contains(g, t) {
|
|
140408
|
+
let r = !0;
|
|
140409
|
+
const m = explode(t).features;
|
|
140410
|
+
for (let v = m.length - 1; v >= 0; v--)
|
|
140411
|
+
if (!inside(m[v], g)) {
|
|
140412
|
+
r = !1;
|
|
140413
|
+
break;
|
|
140414
|
+
}
|
|
140415
|
+
return r;
|
|
140416
|
+
}
|
|
140417
|
+
const getBoxMultiPoly = (g) => {
|
|
140418
|
+
const t = g.features.map((r) => r.geometry.type === "Polygon" ? [r.geometry.coordinates] : r.geometry.coordinates).flat();
|
|
140419
|
+
return Array.from({ length: t.length }, (r, m) => polygon(t[m]));
|
|
140420
|
+
};
|
|
140421
|
+
class Building extends ht {
|
|
140422
|
+
constructor(r) {
|
|
140423
|
+
super();
|
|
140424
|
+
C0(this, "options");
|
|
140425
|
+
C0(this, "building", {});
|
|
140426
|
+
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
140427
|
+
C0(this, "worldPositionZ", {
|
|
140428
|
+
value: 0
|
|
140429
|
+
});
|
|
140430
|
+
this.options = q0({}, r);
|
|
140431
|
+
}
|
|
140432
|
+
create() {
|
|
140433
|
+
return B0(this, null, function* () {
|
|
140434
|
+
const { json: r, projection: m, cacheKey: v, meters: C, grey: _, clip: w } = this.options, I = this.pencil.mList, O = this.pencil.getPlugin("worker"), Pe = this.pencil.lead, Ne = _ ? "-grey" : "";
|
|
140435
|
+
this.createGroup();
|
|
140436
|
+
const Fe = I.getMultiple("building" + Ne);
|
|
140437
|
+
let Ae = v ? yield O.getCachedGeometry({
|
|
140438
|
+
cacheKey: v
|
|
140439
|
+
}) : [];
|
|
140440
|
+
if (Ae.length)
|
|
140441
|
+
w && this.outJson.set(1, !0);
|
|
140442
|
+
else {
|
|
140443
|
+
let De;
|
|
140444
|
+
w && (De = getBoxMultiPoly(w));
|
|
140445
|
+
const xt = {};
|
|
140446
|
+
(r.features || r).forEach((ke) => {
|
|
140447
|
+
const at = typeof ke.properties.h == "string" ? ke.properties.h.split(".")[1] : 0, ct = Number(ke.properties.h) | 0;
|
|
140448
|
+
xt[at] || (xt[at] = {}), xt[at][ct] || (xt[at][ct] = []), De ? De.some((Lt) => {
|
|
140449
|
+
ke.geometry.coordinates[1] && console.log(ke.geometry.coordinates[1]);
|
|
140450
|
+
const Wt = polygon(ke.geometry.coordinates[0]);
|
|
140451
|
+
return booleanContains(Lt, Wt) ? (xt[at][ct].push(ke), !0) : !1;
|
|
140452
|
+
}) || this.outJson.set(ke, !1) : xt[at][ct].push(ke);
|
|
140453
|
+
});
|
|
140454
|
+
const je = Object.keys(xt).map((ke) => {
|
|
140455
|
+
const at = xt[ke];
|
|
140456
|
+
return Object.keys(at).map((ct) => {
|
|
140457
|
+
const Gt = at[ct];
|
|
140458
|
+
return {
|
|
140459
|
+
z: +ke,
|
|
140460
|
+
h: +ct,
|
|
140461
|
+
coordinatesArr: Gt.map(
|
|
140462
|
+
(Lt) => Lt.geometry.type === "Polygon" ? Lt.geometry.coordinates[0] : Lt.geometry.coordinates[0][0]
|
|
140463
|
+
)
|
|
140464
|
+
};
|
|
140465
|
+
});
|
|
140466
|
+
}).flat().filter((ke) => ke.coordinatesArr.length);
|
|
140467
|
+
Ae = yield Promise.all(
|
|
140468
|
+
je.map((ke) => {
|
|
140469
|
+
const { h: at, z: ct, coordinatesArr: Gt } = ke, Lt = +at <= 20 ? +at / 18 : +at <= 60 ? +at / 27 : +at / 12;
|
|
140470
|
+
return O.geoGeometry("extrudePolygon", {
|
|
140471
|
+
cacheKey: v,
|
|
140472
|
+
userData: {
|
|
140473
|
+
z: ct,
|
|
140474
|
+
h: at
|
|
140475
|
+
},
|
|
140476
|
+
mesaage: {
|
|
140477
|
+
coordinatesArr: Gt,
|
|
140478
|
+
projection: m,
|
|
140479
|
+
useGroups: 2,
|
|
140480
|
+
depth: [Number(at) * (C || 1)],
|
|
140481
|
+
hasBottom: !1,
|
|
140482
|
+
sideRepeat: Lt
|
|
140483
|
+
}
|
|
140484
|
+
});
|
|
140485
|
+
})
|
|
140486
|
+
);
|
|
140487
|
+
}
|
|
140488
|
+
yield Promise.all(
|
|
140489
|
+
Ae.map((De) => B0(this, null, function* () {
|
|
140490
|
+
const { h: xt, z: je } = De.userData, ke = xt + je, at = ke <= 20 ? "20" : ke <= 60 ? "60" : "max";
|
|
140491
|
+
let ct = this.options.material;
|
|
140492
|
+
ct || (ct = [Fe[at + "Top"], Fe[at + "Side"]]);
|
|
140493
|
+
const Gt = yield Pe.draw(
|
|
140494
|
+
"ExtrudePolygon",
|
|
140495
|
+
{
|
|
140496
|
+
key: `$p:-${xt}-${je}`,
|
|
140497
|
+
geometry: De,
|
|
140498
|
+
material: ct
|
|
140499
|
+
},
|
|
140500
|
+
this
|
|
140501
|
+
);
|
|
140502
|
+
this.options.grey || (Gt.object3d.castShadow = !0), this.building[xt] || (this.building[xt] = []), this.building[xt].push(Gt), Gt.position.z = Number(je) * (C || 1);
|
|
140503
|
+
}))
|
|
140504
|
+
), this.options.sideGradient && this.sideGradient(), this.object3d.name = "建筑", _ || this.lead.updateBaseObjectKey(
|
|
140505
|
+
this,
|
|
140506
|
+
`building${Ne ? "-grey" : ""}#group`
|
|
140507
|
+
);
|
|
140508
|
+
});
|
|
140509
|
+
}
|
|
140510
|
+
sideGradient(r = "#052438", m = 0.05 / 100) {
|
|
140511
|
+
this.traverse((v) => {
|
|
140512
|
+
if (v instanceof is) {
|
|
140513
|
+
const C = v.object3d.material;
|
|
140514
|
+
C[1].onBeforeCompile = (_) => {
|
|
140515
|
+
_.uniforms.gradientColor = { value: new Color$1(r) }, _.uniforms.maxGradientHeight = {
|
|
140516
|
+
value: m
|
|
140517
|
+
}, _.uniforms.worldPositionZ = this.worldPositionZ, _.vertexShader = `
|
|
140518
|
+
varying vec3 vPosition;
|
|
140519
|
+
varying vec3 vWorldPosition;
|
|
140520
|
+
${_.vertexShader}
|
|
140521
|
+
`.replace(
|
|
140522
|
+
"#include <begin_vertex>",
|
|
140523
|
+
`#include <begin_vertex>
|
|
140524
|
+
vPosition = position;
|
|
140525
|
+
vec4 worldPosition1 = modelMatrix * vec4(position, 1.0);
|
|
140526
|
+
vWorldPosition = worldPosition1.xyz;
|
|
140527
|
+
`
|
|
140528
|
+
), _.vertexShader = `
|
|
140529
|
+
varying vec2 vUv;
|
|
140530
|
+
${_.vertexShader}
|
|
140531
|
+
`.replace(
|
|
140532
|
+
"#include <uv_vertex>",
|
|
140533
|
+
`#include <uv_vertex>
|
|
140534
|
+
vUv = uv;
|
|
140535
|
+
`
|
|
140536
|
+
), _.fragmentShader = `
|
|
140537
|
+
uniform vec3 gradientColor;
|
|
140538
|
+
uniform float maxGradientHeight;
|
|
140539
|
+
uniform float worldPositionZ;
|
|
140540
|
+
varying vec3 vWorldPosition;
|
|
140541
|
+
varying vec2 vUv;
|
|
140542
|
+
|
|
140543
|
+
${_.fragmentShader}
|
|
140544
|
+
`.replace(
|
|
140545
|
+
"#include <dithering_fragment>",
|
|
140546
|
+
`
|
|
140547
|
+
#include <dithering_fragment>
|
|
140548
|
+
if ((vWorldPosition.z-worldPositionZ) <= maxGradientHeight) {
|
|
140549
|
+
float gradient = (vWorldPosition.z-worldPositionZ) / maxGradientHeight;
|
|
140550
|
+
gl_FragColor.rgb = mix(gl_FragColor.rgb, gradientColor,1.0-gradient);
|
|
140551
|
+
}
|
|
140552
|
+
`
|
|
140553
|
+
);
|
|
140554
|
+
}, C[1].needsUpdate = !0;
|
|
140555
|
+
}
|
|
140556
|
+
});
|
|
140557
|
+
}
|
|
140558
|
+
update() {
|
|
140559
|
+
const r = new Vector3();
|
|
140560
|
+
this.object3d.getWorldPosition(r), this.worldPositionZ.value !== r.z && (this.worldPositionZ.value = r.z);
|
|
140561
|
+
}
|
|
140562
|
+
dispose() {
|
|
140563
|
+
super.dispose(), this.outJson.clear();
|
|
140564
|
+
}
|
|
140565
|
+
}
|
|
140566
|
+
class Road extends ht {
|
|
140567
|
+
constructor(r) {
|
|
140568
|
+
super();
|
|
140569
|
+
C0(this, "options");
|
|
140570
|
+
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
140571
|
+
C0(this, "linePrimary", []);
|
|
140572
|
+
C0(this, "lineSecondary", []);
|
|
140573
|
+
this.options = q0({}, r);
|
|
140574
|
+
}
|
|
140575
|
+
create() {
|
|
140576
|
+
return B0(this, null, function* () {
|
|
140577
|
+
const { clip: r, grey: m } = this.options;
|
|
140578
|
+
this.createGroup();
|
|
140579
|
+
const v = this.pencil.getPlugin("worker"), C = this.pencil.lead, _ = this.pencil.mList, w = m ? "-grey" : "", { json: I, projection: O, cacheKey: Pe, meters: Ne } = this.options;
|
|
140580
|
+
let Fe = Pe ? yield v.getCachedGeometry({
|
|
140581
|
+
cacheKey: Pe
|
|
140582
|
+
}) : [];
|
|
140583
|
+
if (Fe.length)
|
|
140584
|
+
r && this.outJson.set(1, !0);
|
|
140585
|
+
else {
|
|
140586
|
+
const Ae = {};
|
|
140587
|
+
let De;
|
|
140588
|
+
r && (De = getBoxMultiPoly(r)), (I.features || I).forEach((je) => {
|
|
140589
|
+
const ke = je.properties.w;
|
|
140590
|
+
Ae[ke] || (Ae[ke] = []), De ? De.some((ct) => {
|
|
140591
|
+
je.geometry.coordinates[1] && console.log(je.geometry.coordinates[1]);
|
|
140592
|
+
const Gt = lineString(je.geometry.coordinates[0]);
|
|
140593
|
+
if (booleanContains(ct, Gt)) {
|
|
140594
|
+
const Wt = [
|
|
140595
|
+
je.geometry.coordinates[0].filter((Pt) => booleanPointInPolygon$1(Pt, ct))
|
|
140596
|
+
];
|
|
140597
|
+
return Wt[0].length && Ae[ke].push(Ji(q0({}, je), {
|
|
140598
|
+
geometry: Ji(q0({}, je.geometry), {
|
|
140599
|
+
coordinates: Wt
|
|
140600
|
+
})
|
|
140601
|
+
})), !0;
|
|
140602
|
+
}
|
|
140603
|
+
return !1;
|
|
140604
|
+
}) || this.outJson.set(je, !1) : Ae[ke].push(je);
|
|
140605
|
+
});
|
|
140606
|
+
const xt = Object.keys(Ae).map((je) => {
|
|
140607
|
+
const ke = Ae[je];
|
|
140608
|
+
return {
|
|
140609
|
+
w: +je,
|
|
140610
|
+
coordinatesArr: ke.map((at) => at.geometry.coordinates[0])
|
|
140611
|
+
};
|
|
140612
|
+
}).filter((je) => je.coordinatesArr.length);
|
|
140613
|
+
Fe = yield Promise.all(
|
|
140614
|
+
xt.map((je) => {
|
|
140615
|
+
const { w: ke, coordinatesArr: at } = je;
|
|
140616
|
+
return v.geoGeometry("line", {
|
|
140617
|
+
cacheKey: Pe,
|
|
140618
|
+
mesaage: {
|
|
140619
|
+
coordinatesArr: at,
|
|
140620
|
+
lineWidth: [ke * (Ne || 1)],
|
|
140621
|
+
projection: O
|
|
140622
|
+
}
|
|
140623
|
+
});
|
|
140624
|
+
})
|
|
140625
|
+
);
|
|
140626
|
+
}
|
|
140627
|
+
yield Promise.all(
|
|
140628
|
+
Fe.map((Ae, De) => B0(this, null, function* () {
|
|
140629
|
+
const xt = yield C.draw(
|
|
140630
|
+
"Line",
|
|
140631
|
+
{
|
|
140632
|
+
key: `$p:-${De}`,
|
|
140633
|
+
geometry: Ae,
|
|
140634
|
+
material: _.getMultiple("road" + w).primary
|
|
140635
|
+
},
|
|
140636
|
+
this
|
|
140637
|
+
);
|
|
140638
|
+
this.linePrimary.push(xt);
|
|
140639
|
+
}))
|
|
140640
|
+
), this.object3d.name = "道路", m || this.lead.updateBaseObjectKey(this, `road${w ? "-grey" : ""}#group`);
|
|
140641
|
+
});
|
|
140642
|
+
}
|
|
140643
|
+
dispose() {
|
|
140644
|
+
super.dispose(), this.linePrimary = [], this.lineSecondary = [], this.outJson.clear();
|
|
140645
|
+
}
|
|
140646
|
+
}
|
|
140647
|
+
class Area extends ht {
|
|
140648
|
+
constructor(r) {
|
|
140649
|
+
super();
|
|
140650
|
+
C0(this, "options");
|
|
140651
|
+
C0(this, "area", []);
|
|
140652
|
+
C0(this, "outJson", /* @__PURE__ */ new Map());
|
|
140653
|
+
this.options = q0({}, r);
|
|
140654
|
+
}
|
|
140655
|
+
create() {
|
|
140656
|
+
return B0(this, null, function* () {
|
|
140657
|
+
this.createGroup();
|
|
140658
|
+
const { json: r, projection: m, type: v, cacheKey: C, material: _, oArr: w, clip: I } = this.options, O = this.pencil.getPlugin("worker"), Pe = this.pencil.lead;
|
|
140659
|
+
let Ne = C ? yield O.getCachedGeometry({
|
|
140660
|
+
cacheKey: C
|
|
140661
|
+
}) : [];
|
|
140662
|
+
if (Ne.length)
|
|
140663
|
+
I && this.outJson.set(1, !0);
|
|
140664
|
+
else {
|
|
140665
|
+
const Fe = {};
|
|
140666
|
+
let Ae;
|
|
140667
|
+
I && (Ae = getBoxMultiPoly(I)), (r.features || r).forEach((xt) => {
|
|
140668
|
+
const je = xt.properties.o;
|
|
140669
|
+
Fe[je] || (Fe[je] = []), Ae ? Ae.some((at) => {
|
|
140670
|
+
const ct = polygon(xt.geometry.coordinates);
|
|
140671
|
+
if (booleanContains(at, ct))
|
|
140672
|
+
return Fe[je].push(xt), !0;
|
|
140673
|
+
{
|
|
140674
|
+
const Lt = lineString(xt.geometry.coordinates[0]);
|
|
140675
|
+
if (booleanCrosses(at, Lt)) {
|
|
140676
|
+
const Pt = clipGeojson(at, xt);
|
|
140677
|
+
Pt.features[0] && Fe[je].push(Ji(q0({}, xt), {
|
|
140678
|
+
geometry: Ji(q0({}, xt.geometry), {
|
|
140679
|
+
coordinates: Pt.features[0].geometry.coordinates
|
|
140680
|
+
})
|
|
140681
|
+
}));
|
|
140682
|
+
}
|
|
140683
|
+
}
|
|
140684
|
+
return !1;
|
|
140685
|
+
}) || this.outJson.set(xt, !1) : Fe[je].push(xt);
|
|
140686
|
+
});
|
|
140687
|
+
const De = Object.keys(Fe).map((xt) => {
|
|
140688
|
+
const je = Fe[xt];
|
|
140689
|
+
return {
|
|
140690
|
+
z: +xt,
|
|
140691
|
+
coordinatesArr: je.map(
|
|
140692
|
+
(ke) => ke.geometry.type === "Polygon" ? ke.geometry.coordinates[0] : ke.geometry.coordinates[0][0]
|
|
140693
|
+
)
|
|
140694
|
+
};
|
|
140695
|
+
}).filter((xt) => xt.coordinatesArr.length);
|
|
140696
|
+
Ne = yield Promise.all(
|
|
140697
|
+
De.map((xt) => {
|
|
140698
|
+
const { z: je, coordinatesArr: ke } = xt;
|
|
140699
|
+
return O.geoGeometry("extrudePolygon", {
|
|
140700
|
+
cacheKey: C,
|
|
140701
|
+
userData: {
|
|
140702
|
+
z: je
|
|
140703
|
+
},
|
|
140704
|
+
mesaage: {
|
|
140705
|
+
coordinatesArr: ke,
|
|
140706
|
+
projection: m,
|
|
140707
|
+
depth: [0],
|
|
140708
|
+
hasBottom: !1,
|
|
140709
|
+
hasSide: !1
|
|
140710
|
+
}
|
|
140711
|
+
});
|
|
140712
|
+
})
|
|
140713
|
+
);
|
|
140714
|
+
}
|
|
140715
|
+
yield Promise.all(
|
|
140716
|
+
Ne.map((Fe, Ae) => B0(this, null, function* () {
|
|
140717
|
+
const { z: De } = Fe.userData, xt = yield Pe.draw(
|
|
140718
|
+
"ExtrudePolygon",
|
|
140719
|
+
{
|
|
140720
|
+
key: `$p:-${Ae}`,
|
|
140721
|
+
geometry: Fe,
|
|
140722
|
+
material: _
|
|
140723
|
+
},
|
|
140724
|
+
this
|
|
140725
|
+
);
|
|
140726
|
+
w != null && w.length && (xt.position.z = w.findIndex((je) => je === +De) * 1e-3), this.area.push(xt);
|
|
140727
|
+
}))
|
|
140728
|
+
);
|
|
140729
|
+
});
|
|
140730
|
+
}
|
|
140731
|
+
dispose() {
|
|
140732
|
+
super.dispose(), this.outJson.clear();
|
|
140733
|
+
}
|
|
140734
|
+
}
|
|
140735
|
+
const fragmentShader = "varying vec2 vUv;uniform vec3 uColor;uniform float uOpacity;uniform float uSpeed;uniform float uLineCount;uniform float time;float PI=3.14159265;float drawCircle(float index,float range){float opacity=1.0;if(index>=1.0-range){opacity=1.0-(index-(1.0-range))/range;}else if(index<=range){opacity=index/range;}return opacity;}float distanceTo(vec2 src,vec2 dst){float dx=src.x-dst.x;float dy=src.y-dst.y;return sqrt(dx*dx+dy*dy);}void main(){float iTime=-time*uSpeed;float opacity=0.0;float len=distanceTo(vec2(0.5,0.5),vec2(vUv.x,vUv.y));float size=1.0/uLineCount;vec2 range=vec2(0.5,0.8);float index=mod(iTime+len,size);if(index<size&&len<=0.5){float i=sin(index/size*PI);if(i>=range.x&&i<=range.y){float t=(i-range.x)/(range.y-range.x);float r=0.3;opacity=drawCircle(t,r);}opacity*=1.0-len/0.5;}gl_FragColor=vec4(uColor,opacity*uOpacity);}", vertexShader = "varying vec2 vUv;void main(){vUv=uv;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}", fs = "uniform sampler2D uTexture;uniform vec2 uOffset;uniform float uRepeat;uniform float uOpacity;varying vec2 vUv;void main(){vec4 color=texture2D(uTexture,vUv+uOffset);float alpha=smoothstep(uRepeat,0.0,vUv.y);if(color.a<0.1){discard;}gl_FragColor=vec4(color.rgb,alpha*uOpacity);}", vs = "uniform float uRepeat;varying vec2 vUv;void main(){vUv=uv*uRepeat;gl_Position=projectionMatrix*modelViewMatrix*vec4(position,1.0);}", width = 10, height = 20, radialSegments = 32;
|
|
140736
|
+
function getCanvasTexture(g) {
|
|
140737
|
+
const t = document.createElement("canvas");
|
|
140738
|
+
t.width = 256, t.height = 256;
|
|
140739
|
+
const r = t.getContext("2d"), m = r.createLinearGradient(0, 0, 0, 256);
|
|
140740
|
+
m.addColorStop(0, `rgba(${g}, 1)`), m.addColorStop(0.1, `rgba(${g}, 1)`), m.addColorStop(0.1, "rgba(255, 255, 255, 0.00)"), m.addColorStop(1, "rgba(255, 255, 255, 0.00)"), r.fillStyle = m, r.fillRect(0, 0, 256, 256);
|
|
140741
|
+
const v = new CanvasTexture(t);
|
|
140742
|
+
return v.colorSpace = SRGBColorSpace, v.wrapT = RepeatWrapping, v.magFilter = NearestFilter, v.minFilter = NearestFilter, t.remove(), v;
|
|
140743
|
+
}
|
|
140744
|
+
class Target extends ht {
|
|
140745
|
+
constructor(r) {
|
|
140746
|
+
super();
|
|
140747
|
+
C0(this, "options");
|
|
140748
|
+
C0(this, "time", { value: 0 });
|
|
140749
|
+
C0(this, "offset", new Vector2(0, 0));
|
|
140750
|
+
C0(this, "timer", null);
|
|
140751
|
+
C0(this, "inTween", null);
|
|
140752
|
+
C0(this, "outTween", null);
|
|
140753
|
+
this.options = r;
|
|
140754
|
+
}
|
|
140755
|
+
createWave(r) {
|
|
140756
|
+
const m = width * 3, v = new PlaneGeometry(m, m, 1, 1), C = new ShaderMaterial({
|
|
140757
|
+
uniforms: {
|
|
140758
|
+
uColor: {
|
|
140759
|
+
value: new Color$1(`rgb(${r})`)
|
|
140760
|
+
},
|
|
140761
|
+
uOpacity: {
|
|
140762
|
+
value: 0
|
|
140763
|
+
},
|
|
140764
|
+
uSpeed: { value: 0.1 },
|
|
140765
|
+
uLineCount: { value: 3 },
|
|
140766
|
+
uRadius: { value: m / 2 },
|
|
140767
|
+
time: this.time
|
|
140768
|
+
},
|
|
140769
|
+
blending: AdditiveBlending,
|
|
140770
|
+
depthWrite: !1,
|
|
140771
|
+
transparent: !0,
|
|
140772
|
+
vertexShader,
|
|
140773
|
+
fragmentShader
|
|
140774
|
+
});
|
|
140775
|
+
return new Mesh(v, C);
|
|
140776
|
+
}
|
|
140777
|
+
createRipple(r) {
|
|
140778
|
+
const m = new ShaderMaterial({
|
|
140779
|
+
uniforms: {
|
|
140780
|
+
uTexture: {
|
|
140781
|
+
value: r
|
|
140782
|
+
},
|
|
140783
|
+
uOffset: {
|
|
140784
|
+
value: this.offset
|
|
140785
|
+
},
|
|
140786
|
+
uRepeat: {
|
|
140787
|
+
value: 6
|
|
140788
|
+
},
|
|
140789
|
+
uOpacity: {
|
|
140790
|
+
value: 1
|
|
140791
|
+
}
|
|
140792
|
+
},
|
|
140793
|
+
fragmentShader: fs,
|
|
140794
|
+
vertexShader: vs,
|
|
140795
|
+
transparent: !0,
|
|
140796
|
+
depthWrite: !1,
|
|
140797
|
+
blending: AdditiveBlending,
|
|
140798
|
+
side: DoubleSide
|
|
140799
|
+
}), v = width, C = height * 1.5, _ = new CylinderGeometry(
|
|
140800
|
+
v,
|
|
140801
|
+
v,
|
|
140802
|
+
C,
|
|
140803
|
+
radialSegments,
|
|
140804
|
+
1,
|
|
140805
|
+
!0
|
|
140806
|
+
), w = new Mesh(_, m);
|
|
140807
|
+
return w.translateZ(C / 2), w.rotateX(Math.PI / 2), w;
|
|
140808
|
+
}
|
|
140809
|
+
createCylinder(r) {
|
|
140810
|
+
const m = width - 0.1, v = new CylinderGeometry(
|
|
140811
|
+
m,
|
|
140812
|
+
// top
|
|
140813
|
+
m,
|
|
140814
|
+
// bottom
|
|
140815
|
+
height,
|
|
140816
|
+
radialSegments,
|
|
140817
|
+
1,
|
|
140818
|
+
!0
|
|
140819
|
+
), C = new MeshBasicMaterial({
|
|
140820
|
+
map: r,
|
|
140821
|
+
transparent: !0,
|
|
140822
|
+
side: DoubleSide,
|
|
140823
|
+
opacity: 0.3
|
|
140824
|
+
// depthWrite: false,
|
|
140825
|
+
// blending: THREE.AdditiveBlending,
|
|
140826
|
+
}), _ = new Object3D(), w = new Mesh(v, C);
|
|
140827
|
+
return w.translateZ(height / 2), w.rotateX(Math.PI / 2), _.add(w), _.scale.setZ(1), _;
|
|
140828
|
+
}
|
|
140829
|
+
createTorus(r) {
|
|
140830
|
+
const m = new TorusGeometry(width / 3, 0.4, 6, 36), v = new MeshBasicMaterial({
|
|
140831
|
+
color: `rgb(${r})`,
|
|
140832
|
+
transparent: !0,
|
|
140833
|
+
opacity: 0
|
|
140834
|
+
}), C = new Mesh(m, v);
|
|
140835
|
+
return C.translateZ(1), C;
|
|
140836
|
+
}
|
|
140837
|
+
create() {
|
|
140838
|
+
return B0(this, null, function* () {
|
|
140839
|
+
const { scale: r = 0.03 } = this.options;
|
|
140840
|
+
this.createGroup();
|
|
140841
|
+
const m = this.pencil.loader, v = "241, 241, 86", C = m.getAsset("/image/city/cylinder.webp"), _ = getCanvasTexture(v), w = this.createRipple(_);
|
|
140842
|
+
this.object3d.add(w);
|
|
140843
|
+
const I = this.createCylinder(C);
|
|
140844
|
+
this.object3d.add(I), this.object3d.scale.multiplyScalar(r);
|
|
140845
|
+
});
|
|
140846
|
+
}
|
|
140847
|
+
erase() {
|
|
140848
|
+
this.inTween && (this.inTween.stop(), this.inTween = null), this.timer && (clearTimeout(this.timer), this.timer = null), this.outTween && (this.outTween.stop(), this.outTween = null), super.erase();
|
|
140849
|
+
}
|
|
140850
|
+
update(r, m) {
|
|
140851
|
+
this.time.value += 0.01, this.offset.y -= 0.02;
|
|
140852
|
+
}
|
|
140853
|
+
}
|
|
140854
|
+
const objs$1 = Ji(q0({}, objs$3), {
|
|
140855
|
+
Building,
|
|
140856
|
+
Road,
|
|
140857
|
+
Area,
|
|
140858
|
+
CityPlane,
|
|
140859
|
+
Target
|
|
140860
|
+
}), setWaterMaterial = (g, t = {}) => {
|
|
140861
|
+
const r = t.textureWidth !== void 0 ? t.textureWidth : 512, m = t.textureHeight !== void 0 ? t.textureHeight : 512, v = t.alpha !== void 0 ? t.alpha : 1, C = t.waterNormals !== void 0 ? t.waterNormals : null, _ = new Color$1(
|
|
140862
|
+
t.waterColor !== void 0 ? t.waterColor : g.material.color
|
|
140863
|
+
), w = t.eye !== void 0 ? t.eye : new Vector3(0, 0, 0), I = t.distortionScale !== void 0 ? t.distortionScale : 0, O = t.side !== void 0 ? t.side : FrontSide, Pe = t.fog !== void 0 ? t.fog : !1, Ne = new Plane$1(), Fe = new Vector3(), Ae = new Vector3(), De = new Vector3(), xt = new Matrix4(), je = new Vector3(0, 0, -1), ke = new Vector4(), at = new Vector3(), ct = new Vector3(), Gt = new Vector4(), Lt = new Matrix4(), Wt = new PerspectiveCamera(), Pt = new WebGLRenderTarget(r, m), zt = {
|
|
140864
|
+
name: "MirrorShader",
|
|
140865
|
+
uniforms: UniformsUtils.merge([
|
|
140866
|
+
UniformsLib.fog,
|
|
140867
|
+
UniformsLib.lights,
|
|
140868
|
+
{
|
|
140869
|
+
normalSampler: { value: null },
|
|
140870
|
+
mirrorSampler: { value: null },
|
|
140871
|
+
alpha: { value: 1 },
|
|
140872
|
+
time: { value: 0 },
|
|
140873
|
+
size: { value: 1 },
|
|
140874
|
+
distortionScale: { value: 20 },
|
|
140875
|
+
textureMatrix: { value: new Matrix4() },
|
|
140876
|
+
eye: { value: new Vector3() },
|
|
140877
|
+
waterColor: { value: new Color$1(5592405) }
|
|
140878
|
+
}
|
|
140879
|
+
]),
|
|
140880
|
+
vertexShader: (
|
|
140881
|
+
/* glsl */
|
|
140882
|
+
`
|
|
140883
|
+
uniform mat4 textureMatrix;
|
|
140884
|
+
uniform float time;
|
|
140885
|
+
|
|
140886
|
+
varying vec4 mirrorCoord;
|
|
140887
|
+
varying vec4 worldPosition;
|
|
140888
|
+
|
|
140889
|
+
#include <common>
|
|
140890
|
+
#include <fog_pars_vertex>
|
|
140891
|
+
#include <shadowmap_pars_vertex>
|
|
140892
|
+
#include <logdepthbuf_pars_vertex>
|
|
140893
|
+
|
|
140894
|
+
void main() {
|
|
140895
|
+
mirrorCoord = modelMatrix * vec4( position, 1.0 );
|
|
140896
|
+
worldPosition = mirrorCoord.xyzw;
|
|
140897
|
+
mirrorCoord = textureMatrix * mirrorCoord;
|
|
140898
|
+
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
140899
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
140900
|
+
|
|
140901
|
+
#include <beginnormal_vertex>
|
|
140902
|
+
#include <defaultnormal_vertex>
|
|
140903
|
+
#include <logdepthbuf_vertex>
|
|
140904
|
+
#include <fog_vertex>
|
|
140905
|
+
#include <shadowmap_vertex>
|
|
140906
|
+
}`
|
|
140907
|
+
),
|
|
140908
|
+
fragmentShader: (
|
|
140909
|
+
/* glsl */
|
|
140910
|
+
`
|
|
140911
|
+
uniform sampler2D mirrorSampler;
|
|
140912
|
+
uniform float alpha;
|
|
140913
|
+
uniform float time;
|
|
140914
|
+
uniform float size;
|
|
140915
|
+
uniform float distortionScale;
|
|
140916
|
+
uniform sampler2D normalSampler;
|
|
140917
|
+
|
|
140918
|
+
|
|
140919
|
+
uniform vec3 eye;
|
|
140920
|
+
uniform vec3 waterColor;
|
|
140921
|
+
|
|
140922
|
+
varying vec4 mirrorCoord;
|
|
140923
|
+
varying vec4 worldPosition;
|
|
140924
|
+
|
|
140925
|
+
vec4 getNoise( vec2 uv ) {
|
|
140926
|
+
vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);
|
|
140927
|
+
vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );
|
|
140928
|
+
vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );
|
|
140929
|
+
vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );
|
|
140930
|
+
vec4 noise = texture2D( normalSampler, uv0 ) +
|
|
140931
|
+
texture2D( normalSampler, uv1 ) +
|
|
140932
|
+
texture2D( normalSampler, uv2 ) +
|
|
140933
|
+
texture2D( normalSampler, uv3 );
|
|
140934
|
+
return noise * 0.5 - 1.0;
|
|
140935
|
+
}
|
|
140936
|
+
|
|
140937
|
+
|
|
140938
|
+
#include <common>
|
|
140939
|
+
#include <packing>
|
|
140940
|
+
#include <bsdfs>
|
|
140941
|
+
#include <fog_pars_fragment>
|
|
140942
|
+
#include <logdepthbuf_pars_fragment>
|
|
140943
|
+
#include <lights_pars_begin>
|
|
140944
|
+
#include <shadowmap_pars_fragment>
|
|
140945
|
+
#include <shadowmask_pars_fragment>
|
|
140946
|
+
|
|
140947
|
+
void main() {
|
|
140948
|
+
|
|
140949
|
+
#include <logdepthbuf_fragment>
|
|
140950
|
+
vec4 noise = getNoise( worldPosition.xz * size );
|
|
140951
|
+
vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );
|
|
140952
|
+
|
|
140953
|
+
|
|
140954
|
+
vec3 worldToEye = eye-worldPosition.xyz;
|
|
140955
|
+
|
|
140956
|
+
|
|
140957
|
+
float distance = length(worldToEye);
|
|
140958
|
+
|
|
140959
|
+
vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;
|
|
140960
|
+
vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );
|
|
140961
|
+
vec3 m =mix(reflectionSample, waterColor, 0.5);
|
|
140962
|
+
gl_FragColor = vec4(m, alpha );
|
|
140963
|
+
|
|
140964
|
+
#include <tonemapping_fragment>
|
|
140965
|
+
#include <colorspace_fragment>
|
|
140966
|
+
#include <fog_fragment>
|
|
140967
|
+
}`
|
|
140968
|
+
)
|
|
140969
|
+
}, Nt = new ShaderMaterial({
|
|
140970
|
+
name: zt.name,
|
|
140971
|
+
uniforms: UniformsUtils.clone(zt.uniforms),
|
|
140972
|
+
vertexShader: zt.vertexShader,
|
|
140973
|
+
fragmentShader: zt.fragmentShader,
|
|
140974
|
+
lights: !0,
|
|
140975
|
+
side: O,
|
|
140976
|
+
fog: Pe
|
|
140977
|
+
});
|
|
140978
|
+
Nt.uniforms.mirrorSampler.value = Pt.texture, Nt.uniforms.textureMatrix.value = Lt, Nt.uniforms.alpha.value = v, Nt.uniforms.normalSampler.value = C, Nt.uniforms.waterColor.value = _, Nt.uniforms.distortionScale.value = I, Nt.uniforms.eye.value = w;
|
|
140979
|
+
const Kt = g.material;
|
|
140980
|
+
g.material = Nt, g.onBeforeRender = function(kt, n0, r0) {
|
|
140981
|
+
Kt.color !== Nt.uniforms.waterColor.value && (Nt.uniforms.waterColor.value = Kt.color), Ae.setFromMatrixPosition(g.matrixWorld), De.setFromMatrixPosition(r0.matrixWorld), xt.extractRotation(g.matrixWorld), Fe.set(0, 0, 1), Fe.applyMatrix4(xt), at.subVectors(Ae, De), r0.updateMatrix(), r0.updateMatrixWorld(), g.updateMatrix(), g.updateMatrixWorld();
|
|
140982
|
+
const l0 = new Frustum(), s0 = new Matrix4();
|
|
140983
|
+
if (s0.multiplyMatrices(
|
|
140984
|
+
r0.projectionMatrix,
|
|
140985
|
+
r0.matrixWorldInverse
|
|
140986
|
+
), l0.setFromProjectionMatrix(s0), !l0.intersectsObject(g) || at.dot(Fe) > 0)
|
|
140987
|
+
return;
|
|
140988
|
+
at.reflect(Fe).negate(), at.add(Ae), xt.extractRotation(r0.matrixWorld), je.set(0, 0, -1), je.applyMatrix4(xt), je.add(De), ct.subVectors(Ae, je), ct.reflect(Fe).negate(), ct.add(Ae), Wt.position.copy(at), Wt.up.set(0, 1, 0), Wt.up.applyMatrix4(xt), Wt.up.reflect(Fe), Wt.lookAt(ct), Wt.far = r0.far, Wt.updateMatrixWorld(), Wt.projectionMatrix.copy(r0.projectionMatrix), Lt.set(
|
|
140989
|
+
0.5,
|
|
140990
|
+
0,
|
|
140991
|
+
0,
|
|
140992
|
+
0.5,
|
|
140993
|
+
0,
|
|
140994
|
+
0.5,
|
|
140995
|
+
0,
|
|
140996
|
+
0.5,
|
|
140997
|
+
0,
|
|
140998
|
+
0,
|
|
140999
|
+
0.5,
|
|
141000
|
+
0.5,
|
|
141001
|
+
0,
|
|
141002
|
+
0,
|
|
141003
|
+
0,
|
|
141004
|
+
1
|
|
141005
|
+
), Lt.multiply(Wt.projectionMatrix), Lt.multiply(Wt.matrixWorldInverse), Ne.setFromNormalAndCoplanarPoint(Fe, Ae), Ne.applyMatrix4(Wt.matrixWorldInverse), ke.set(
|
|
141006
|
+
Ne.normal.x,
|
|
141007
|
+
Ne.normal.y,
|
|
141008
|
+
Ne.normal.z,
|
|
141009
|
+
Ne.constant
|
|
141010
|
+
);
|
|
141011
|
+
const qt = Wt.projectionMatrix;
|
|
141012
|
+
Gt.x = (Math.sign(ke.x) + qt.elements[8]) / qt.elements[0], Gt.y = (Math.sign(ke.y) + qt.elements[9]) / qt.elements[5], Gt.z = -1, Gt.w = (1 + qt.elements[10]) / qt.elements[14], ke.multiplyScalar(2 / ke.dot(Gt)), qt.elements[2] = ke.x, qt.elements[6] = ke.y, qt.elements[10] = ke.z + 1, qt.elements[14] = ke.w, w.setFromMatrixPosition(r0.matrixWorld);
|
|
141013
|
+
const t0 = kt.getRenderTarget(), Yt = kt.xr.enabled, a0 = kt.shadowMap.autoUpdate;
|
|
141014
|
+
g.visible = !1, kt.xr.enabled = !1, kt.shadowMap.autoUpdate = !1, kt.setRenderTarget(Pt), kt.state.buffers.depth.setMask(!0), kt.autoClear === !1 && kt.clear(), kt.render(n0, Wt), g.visible = !0, kt.xr.enabled = Yt, kt.shadowMap.autoUpdate = a0, kt.setRenderTarget(t0);
|
|
141015
|
+
const g0 = r0.viewport;
|
|
141016
|
+
g0 !== void 0 && kt.state.viewport(g0);
|
|
141017
|
+
};
|
|
141018
|
+
};
|
|
140489
141019
|
class City$1 extends Base {
|
|
140490
141020
|
constructor() {
|
|
140491
141021
|
super(...arguments);
|
|
140492
|
-
C0(this, "leadObjs", objs$
|
|
141022
|
+
C0(this, "leadObjs", objs$1);
|
|
140493
141023
|
C0(this, "adcode", 0);
|
|
140494
141024
|
C0(this, "pcenter", [104, 37.5]);
|
|
140495
141025
|
C0(this, "pscale", 5e4);
|
|
@@ -140933,514 +141463,24 @@ class City extends City$1 {
|
|
|
140933
141463
|
this.pencil.camera.near = r * this.multiplyScalar, m && (this.pencil.camera.far = m * this.multiplyScalar), this.pencil.camera.updateProjectionMatrix();
|
|
140934
141464
|
}
|
|
140935
141465
|
}
|
|
140936
|
-
const
|
|
140937
|
-
|
|
140938
|
-
|
|
140939
|
-
|
|
140940
|
-
|
|
140941
|
-
|
|
140942
|
-
|
|
140943
|
-
|
|
140944
|
-
|
|
140945
|
-
|
|
140946
|
-
|
|
140947
|
-
|
|
140948
|
-
|
|
140949
|
-
|
|
140950
|
-
|
|
140951
|
-
|
|
140952
|
-
|
|
140953
|
-
|
|
140954
|
-
hasSide: !0,
|
|
140955
|
-
lineOffset: 0,
|
|
140956
|
-
topSegments: 0,
|
|
140957
|
-
depth: 2,
|
|
140958
|
-
bloom: !1,
|
|
140959
|
-
mergeSide: !1,
|
|
140960
|
-
onTop: 0
|
|
140961
|
-
}, r), ((m = this.options.projection.rotate) == null ? void 0 : m[0]) === -160 && (this.options.projection.projectionType === "winkel3" ? this.splitPolygons = 100 : this.splitPolygons = 300);
|
|
140962
|
-
}
|
|
140963
|
-
create() {
|
|
140964
|
-
return B0(this, null, function* () {
|
|
140965
|
-
const {
|
|
140966
|
-
geojson: r,
|
|
140967
|
-
extrudeLineGeojson: m,
|
|
140968
|
-
bbox: v,
|
|
140969
|
-
areaGroup: C,
|
|
140970
|
-
materialOptions: _,
|
|
140971
|
-
hasSide: w,
|
|
140972
|
-
mergeSide: I
|
|
140973
|
-
} = this.options;
|
|
140974
|
-
this.createGroup();
|
|
140975
|
-
const O = this.pencil.lead;
|
|
140976
|
-
if (C) {
|
|
140977
|
-
const Wt = yield Promise.all(
|
|
140978
|
-
r.features.map((Pt) => B0(this, null, function* () {
|
|
140979
|
-
const { properties: zt } = Pt, Nt = `${this.getPropertiesKey(zt)}`, Kt = yield O.draw("Group", {
|
|
140980
|
-
target: this,
|
|
140981
|
-
key: Nt
|
|
140982
|
-
});
|
|
140983
|
-
return Kt.object3d.name = (zt == null ? void 0 : zt.adcode) === "100000_JD" ? "十段线" : zt == null ? void 0 : zt.name, Kt.userData = q0({}, zt), Kt;
|
|
140984
|
-
}))
|
|
140985
|
-
);
|
|
140986
|
-
this.groupArr = Wt;
|
|
140987
|
-
}
|
|
140988
|
-
const {
|
|
140989
|
-
lineMat: Pe,
|
|
140990
|
-
extrudeLineMat: Ne,
|
|
140991
|
-
topMat: Fe,
|
|
140992
|
-
sideMat: Ae,
|
|
140993
|
-
bgTopMat: De,
|
|
140994
|
-
bgSideMat: xt,
|
|
140995
|
-
bgLineMat: je,
|
|
140996
|
-
bgExtrudeLineMat: ke
|
|
140997
|
-
} = _, [at, ct, Gt, Lt] = yield Promise.all([
|
|
140998
|
-
this.addArea(r, {
|
|
140999
|
-
material: w ? [Fe, I ? hideMaterial : Ae] : Fe,
|
|
141000
|
-
bbox: v,
|
|
141001
|
-
areaGroup: C,
|
|
141002
|
-
hasSide: w,
|
|
141003
|
-
hasTop: !0,
|
|
141004
|
-
castShadow: !I,
|
|
141005
|
-
onTop: this.options.onTop
|
|
141006
|
-
}),
|
|
141007
|
-
this.addLine(r, {
|
|
141008
|
-
material: Pe,
|
|
141009
|
-
onTop: this.options.onTop + 2,
|
|
141010
|
-
areaGroup: C
|
|
141011
|
-
}),
|
|
141012
|
-
m && this.addLine(m, {
|
|
141013
|
-
material: Ne,
|
|
141014
|
-
onTop: this.options.onTop + 3
|
|
141015
|
-
}),
|
|
141016
|
-
I && m && this.addArea(m, {
|
|
141017
|
-
material: Ae,
|
|
141018
|
-
bbox: v,
|
|
141019
|
-
castShadow: !0,
|
|
141020
|
-
areaGroup: !1,
|
|
141021
|
-
hasSide: !0,
|
|
141022
|
-
hasTop: !1,
|
|
141023
|
-
onTop: this.options.onTop
|
|
141024
|
-
})
|
|
141025
|
-
]);
|
|
141026
|
-
Lt && (this.mergeSideArea = Lt[0], this.mergeSideArea.object3d.name = "板块合并侧面"), this.areaArr = at, ct.forEach((Wt) => {
|
|
141027
|
-
Wt.position.z = this.options.depth + this.options.lineOffset;
|
|
141028
|
-
}), this.lineArr = ct, Gt && (Gt.forEach((Wt) => {
|
|
141029
|
-
Wt.position.z = this.options.depth + this.options.lineOffset, this.lead.updateBaseObjectKey(
|
|
141030
|
-
Wt,
|
|
141031
|
-
"$t:#" + this.getPropertiesKey({
|
|
141032
|
-
name: "extrudeLine"
|
|
141033
|
-
})
|
|
141034
|
-
);
|
|
141035
|
-
}), this.extrudelineArr = Gt), De && xt && this.setAreaMaterial("bg", [De, xt]), je && this.setLineMaterial("bg", je), ke && this.setExtrudeLineMaterial("bg", ke);
|
|
141036
|
-
});
|
|
141037
|
-
}
|
|
141038
|
-
addArea(r, m) {
|
|
141039
|
-
return B0(this, null, function* () {
|
|
141040
|
-
const { bbox: v, material: C, onTop: _ } = m, w = this.geojson2Meta(r), I = this.pencil.getPlugin("worker"), O = this.pencil.lead;
|
|
141041
|
-
if (this.pencil.mList, m.areaGroup)
|
|
141042
|
-
return yield Promise.all(
|
|
141043
|
-
w.map((Pe) => B0(this, null, function* () {
|
|
141044
|
-
const { coords: Ne, properties: Fe } = Pe, Ae = this.findGroup(this.getPropertiesKey(Fe)), De = yield I.geoGeometry(
|
|
141045
|
-
"extrudePolygon",
|
|
141046
|
-
{
|
|
141047
|
-
mesaage: {
|
|
141048
|
-
coordinatesArr: Ne,
|
|
141049
|
-
projection: this.options.projection,
|
|
141050
|
-
topSegments: this.options.topSegments,
|
|
141051
|
-
bbox: v,
|
|
141052
|
-
depth: [this.options.depth],
|
|
141053
|
-
hasBottom: !1,
|
|
141054
|
-
hasSide: m.hasSide,
|
|
141055
|
-
hasTop: m.hasTop,
|
|
141056
|
-
useGroups: m.hasSide && m.hasTop ? 2 : 0,
|
|
141057
|
-
splitPolygons: this.splitPolygons
|
|
141058
|
-
}
|
|
141059
|
-
}
|
|
141060
|
-
), xt = `${this.getPropertiesKey(Fe)}`, je = yield O.draw(
|
|
141061
|
-
"ExtrudePolygon",
|
|
141062
|
-
{
|
|
141063
|
-
key: xt,
|
|
141064
|
-
geometry: De,
|
|
141065
|
-
material: C,
|
|
141066
|
-
onTop: _
|
|
141067
|
-
},
|
|
141068
|
-
Ae
|
|
141069
|
-
);
|
|
141070
|
-
return je.object3d.name = "板块", m != null && m.castShadow && (je.object3d.castShadow = !0), je.userData = q0({}, Fe), je;
|
|
141071
|
-
}))
|
|
141072
|
-
);
|
|
141073
|
-
{
|
|
141074
|
-
const Pe = yield I.geoGeometry("extrudePolygon", {
|
|
141075
|
-
mesaage: {
|
|
141076
|
-
coordinatesArr: w.map(({ coords: Fe }) => Fe).flat(),
|
|
141077
|
-
projection: q0({}, this.options.projection),
|
|
141078
|
-
topSegments: this.options.topSegments,
|
|
141079
|
-
bbox: v,
|
|
141080
|
-
depth: [this.options.depth],
|
|
141081
|
-
hasSide: m.hasSide,
|
|
141082
|
-
hasTop: m.hasTop,
|
|
141083
|
-
hasBottom: !1,
|
|
141084
|
-
useGroups: 2,
|
|
141085
|
-
splitPolygons: this.splitPolygons
|
|
141086
|
-
}
|
|
141087
|
-
}), Ne = yield O.draw(
|
|
141088
|
-
"ExtrudePolygon",
|
|
141089
|
-
{
|
|
141090
|
-
key: this.getPropertiesKey({
|
|
141091
|
-
name: "all"
|
|
141092
|
-
}),
|
|
141093
|
-
geometry: Pe,
|
|
141094
|
-
material: C
|
|
141095
|
-
},
|
|
141096
|
-
this
|
|
141097
|
-
);
|
|
141098
|
-
return m != null && m.castShadow && (Ne.object3d.castShadow = !0), Ne.object3d.name = "板块", Ne.userData = {}, [Ne];
|
|
141099
|
-
}
|
|
141100
|
-
});
|
|
141101
|
-
}
|
|
141102
|
-
addLine(r, m) {
|
|
141103
|
-
return B0(this, null, function* () {
|
|
141104
|
-
const { material: v, onTop: C } = m, _ = this.geojson2Meta(r), w = this.pencil.getPlugin("worker"), I = this.pencil.lead;
|
|
141105
|
-
if (m.areaGroup)
|
|
141106
|
-
return yield Promise.all(
|
|
141107
|
-
_.map((O) => B0(this, null, function* () {
|
|
141108
|
-
const { coords: Pe, properties: Ne } = O, Fe = this.findGroup(this.getPropertiesKey(Ne)), Ae = yield w.geoGeometry("line", {
|
|
141109
|
-
mesaage: {
|
|
141110
|
-
coordinatesArr: Pe,
|
|
141111
|
-
lineWidth: [1],
|
|
141112
|
-
projection: this.options.projection,
|
|
141113
|
-
splitPolygons: this.splitPolygons
|
|
141114
|
-
}
|
|
141115
|
-
}), De = `${this.getPropertiesKey(Ne)}`, xt = yield I.draw(
|
|
141116
|
-
"Line",
|
|
141117
|
-
{
|
|
141118
|
-
key: De,
|
|
141119
|
-
geometry: Ae,
|
|
141120
|
-
material: v,
|
|
141121
|
-
onTop: C
|
|
141122
|
-
},
|
|
141123
|
-
Fe
|
|
141124
|
-
);
|
|
141125
|
-
return xt.userData = q0({}, Ne), xt.object3d.name = "线", xt;
|
|
141126
|
-
}))
|
|
141127
|
-
);
|
|
141128
|
-
{
|
|
141129
|
-
const O = yield w.geoGeometry("line", {
|
|
141130
|
-
mesaage: {
|
|
141131
|
-
coordinatesArr: _.map(({ coords: Ne }) => Ne).flat(),
|
|
141132
|
-
lineWidth: [1],
|
|
141133
|
-
projection: this.options.projection,
|
|
141134
|
-
splitPolygons: this.splitPolygons
|
|
141135
|
-
}
|
|
141136
|
-
}), Pe = yield I.draw(
|
|
141137
|
-
"Line",
|
|
141138
|
-
{
|
|
141139
|
-
key: this.getPropertiesKey({
|
|
141140
|
-
name: "all"
|
|
141141
|
-
}),
|
|
141142
|
-
geometry: O,
|
|
141143
|
-
material: v,
|
|
141144
|
-
onTop: C
|
|
141145
|
-
},
|
|
141146
|
-
this
|
|
141147
|
-
);
|
|
141148
|
-
return Pe.object3d.name = "线", [Pe];
|
|
141149
|
-
}
|
|
141150
|
-
});
|
|
141151
|
-
}
|
|
141152
|
-
getPropertiesKey(r) {
|
|
141153
|
-
return `${this.key.split("#")[1]}-${r.adcode || r.iso_a2 || r.name}`;
|
|
141154
|
-
}
|
|
141155
|
-
geojson2Meta(r) {
|
|
141156
|
-
return r.features.filter((m) => m.geometry).map((m) => {
|
|
141157
|
-
const { type: v, coordinates: C } = m.geometry;
|
|
141158
|
-
let _ = [];
|
|
141159
|
-
return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
|
|
141160
|
-
coords: _,
|
|
141161
|
-
properties: m.properties
|
|
141162
|
-
};
|
|
141163
|
-
});
|
|
141164
|
-
}
|
|
141165
|
-
update(r, m) {
|
|
141166
|
-
const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions;
|
|
141167
|
-
this.isActive && [v, C].forEach((_) => {
|
|
141168
|
-
!_ || !_.uniforms.lineLightAnimation.value || (_.uniforms.time.value = m);
|
|
141169
|
-
});
|
|
141170
|
-
}
|
|
141171
|
-
findGroup(r, m = !1) {
|
|
141172
|
-
return this.pencil.lead.getObject("Group", {
|
|
141173
|
-
key: `${m ? this.getPropertiesKey({
|
|
141174
|
-
adcode: r
|
|
141175
|
-
}) : r}`
|
|
141176
|
-
});
|
|
141177
|
-
}
|
|
141178
|
-
setAreaMaterial(r, m) {
|
|
141179
|
-
this.areaArr.forEach((v) => {
|
|
141180
|
-
v.setMaterialList(
|
|
141181
|
-
r,
|
|
141182
|
-
this.mergeSideArea && Array.isArray(m) ? [m[0], hideMaterial] : m
|
|
141183
|
-
);
|
|
141184
|
-
}), this.mergeSideArea && Array.isArray(m) && this.mergeSideArea.setMaterialList(r, m[1]);
|
|
141185
|
-
}
|
|
141186
|
-
useAreaMaterial(r) {
|
|
141187
|
-
this.areaArr.forEach((m) => {
|
|
141188
|
-
m.useMaterial(r);
|
|
141189
|
-
}), this.mergeSideArea && this.mergeSideArea.useMaterial(r);
|
|
141190
|
-
}
|
|
141191
|
-
setLineMaterial(r, m) {
|
|
141192
|
-
this.lineArr.forEach((v) => {
|
|
141193
|
-
v.setMaterialList(r, m);
|
|
141194
|
-
});
|
|
141195
|
-
}
|
|
141196
|
-
useLineMaterial(r) {
|
|
141197
|
-
this.lineArr.forEach((m) => {
|
|
141198
|
-
m.useMaterial(r);
|
|
141199
|
-
});
|
|
141200
|
-
}
|
|
141201
|
-
setExtrudeLineMaterial(r, m) {
|
|
141202
|
-
var v;
|
|
141203
|
-
(v = this.extrudelineArr) == null || v.forEach((C) => {
|
|
141204
|
-
C.setMaterialList(r, m);
|
|
141205
|
-
});
|
|
141206
|
-
}
|
|
141207
|
-
useExtrudeLineMaterial(r) {
|
|
141208
|
-
var m;
|
|
141209
|
-
(m = this.extrudelineArr) == null || m.forEach((v) => {
|
|
141210
|
-
v.useMaterial(r);
|
|
141211
|
-
});
|
|
141212
|
-
}
|
|
141213
|
-
changeLineAnimateParams({
|
|
141214
|
-
speed: r = 0.5,
|
|
141215
|
-
extrude: m = !1
|
|
141216
|
-
}) {
|
|
141217
|
-
const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions, _ = m ? C : v;
|
|
141218
|
-
if (!_) return;
|
|
141219
|
-
_.uniforms.time.value = 0, _.uniforms.speed.value = r, _.uniforms.lineLightAnimation.value = 1;
|
|
141220
|
-
const { size: w, min: I, max: O } = this.getSize();
|
|
141221
|
-
_.uniforms.size.value = Math.max(w.x, w.y) / 2, _.uniforms.uCenter.value = new Vector2(
|
|
141222
|
-
(I.x + O.x) / 2,
|
|
141223
|
-
(I.y + O.y) / 2
|
|
141224
|
-
);
|
|
141225
|
-
}
|
|
141226
|
-
deactive() {
|
|
141227
|
-
this.isActive && (this.options, this.isActive = !1, this.options.bloom && this.toggleExtrudelineBloom(!1), this.useAreaMaterial("bg"), this.useLineMaterial("bg"), this.useExtrudeLineMaterial("bg"));
|
|
141228
|
-
}
|
|
141229
|
-
render() {
|
|
141230
|
-
this.options.bloom && this.toggleExtrudelineBloom(!0);
|
|
141231
|
-
}
|
|
141232
|
-
toggleExtrudelineBloom(r) {
|
|
141233
|
-
var m;
|
|
141234
|
-
(m = this.extrudelineArr) == null || m.forEach((v) => {
|
|
141235
|
-
r ? v.enableBloom() : v.disableBloom();
|
|
141236
|
-
});
|
|
141237
|
-
}
|
|
141238
|
-
active() {
|
|
141239
|
-
this.isActive || (this.isActive = !0, this.useAreaMaterial("origin"), this.useLineMaterial("origin"), this.useExtrudeLineMaterial("origin"), this.options.bloom && this.toggleExtrudelineBloom(!0));
|
|
141240
|
-
}
|
|
141241
|
-
dispose() {
|
|
141242
|
-
super.dispose(), this.areaArr.length = 0, this.lineArr && (this.lineArr.length = 0), this.extrudelineArr && (this.extrudelineArr.length = 0);
|
|
141243
|
-
}
|
|
141244
|
-
// test(material: THREE.Material) {
|
|
141245
|
-
// material.onBeforeCompile = (shader) => {
|
|
141246
|
-
// shader.vertexShader = `
|
|
141247
|
-
// varying float vHeightPercent;
|
|
141248
|
-
// ${shader.vertexShader}
|
|
141249
|
-
// `.replace(
|
|
141250
|
-
// `#include <fog_vertex>`,
|
|
141251
|
-
// `
|
|
141252
|
-
// #include <fog_vertex>
|
|
141253
|
-
// vec4 zzz =vec4( transformed, 1.0 );
|
|
141254
|
-
// //min
|
|
141255
|
-
// float min = 1.0;
|
|
141256
|
-
// float max = 2.0;
|
|
141257
|
-
// float heightPercent = (zzz.z - min) / (max - min);
|
|
141258
|
-
// vHeightPercent = heightPercent;
|
|
141259
|
-
// `
|
|
141260
|
-
// );
|
|
141261
|
-
// shader.fragmentShader = `
|
|
141262
|
-
// varying float vHeightPercent;
|
|
141263
|
-
// ${shader.fragmentShader}
|
|
141264
|
-
// `.replace(
|
|
141265
|
-
// `#include <dithering_fragment>`,
|
|
141266
|
-
// `
|
|
141267
|
-
// #include <dithering_fragment>
|
|
141268
|
-
// vec3 valleyColor = vec3(0.0, 0.0, 1.0);
|
|
141269
|
-
// vec3 peakColor = vec3(1.0, 0.0, 0.0);
|
|
141270
|
-
// vec3 interpolatedColor = mix(valleyColor, peakColor, vHeightPercent);
|
|
141271
|
-
// gl_FragColor.rgb = interpolatedColor;
|
|
141272
|
-
// `
|
|
141273
|
-
// );
|
|
141274
|
-
// };
|
|
141275
|
-
// }
|
|
141276
|
-
};
|
|
141277
|
-
class ContinentsBg extends ht {
|
|
141278
|
-
constructor(r) {
|
|
141279
|
-
super();
|
|
141280
|
-
C0(this, "options");
|
|
141281
|
-
C0(this, "mapArr", []);
|
|
141282
|
-
this.options = r;
|
|
141283
|
-
}
|
|
141284
|
-
create() {
|
|
141285
|
-
return B0(this, null, function* () {
|
|
141286
|
-
const { depth: r } = this.options, m = this.pencil.mList, v = this.pencil.lead, C = m.getMultiple("continents");
|
|
141287
|
-
this.createGroup(), this.object3d.name = "大洲", yield Promise.all(
|
|
141288
|
-
Object.values(continentsLiteJson).map((_) => B0(this, null, function* () {
|
|
141289
|
-
const w = _.features[0], I = w.properties.adcode;
|
|
141290
|
-
if (I === 10) return;
|
|
141291
|
-
const O = centroid(w).geometry.coordinates;
|
|
141292
|
-
let Pe = 0, Ne = 0, Fe = this.options.scale;
|
|
141293
|
-
const Ae = 30, De = 25;
|
|
141294
|
-
I === 5 ? (Pe = -Ae, Ne = De, Fe = Fe * 0.2) : I === 21 ? (Pe = 0, Ne = De, Fe = Fe * 0.18) : I === 9 ? (Pe = Ae, Ne = De, Fe = Fe * 0.3) : I === 142 ? (Pe = -Ae, Ne = -De, Fe = Fe * 0.15) : I === 150 ? (Pe = 0, Ne = -De, Fe = Fe * 0.3) : I === 2 && (Pe = Ae, Ne = -De, Fe = Fe * 0.2);
|
|
141295
|
-
const xt = yield v.draw(
|
|
141296
|
-
"PlaneMap",
|
|
141297
|
-
{
|
|
141298
|
-
key: `${this.key}-${I}`,
|
|
141299
|
-
geojson: _,
|
|
141300
|
-
projection: {
|
|
141301
|
-
center: O,
|
|
141302
|
-
scale: Fe,
|
|
141303
|
-
rotate: [0, 0],
|
|
141304
|
-
projectionType: "equirectangular"
|
|
141305
|
-
},
|
|
141306
|
-
areaGroup: !1,
|
|
141307
|
-
// bbox: bboxworld,
|
|
141308
|
-
depth: r,
|
|
141309
|
-
materialOptions: q0({}, C)
|
|
141310
|
-
},
|
|
141311
|
-
this
|
|
141312
|
-
);
|
|
141313
|
-
xt.userData.projection = f({
|
|
141314
|
-
center: O,
|
|
141315
|
-
scale: Fe,
|
|
141316
|
-
rotate: [0, 0],
|
|
141317
|
-
projectionType: "equirectangular"
|
|
141318
|
-
}), xt.object3d.name = w.properties.name, xt.userData.name = w.properties.name, xt.position.set(Pe, Ne, 0), this.mapArr.push(xt);
|
|
141319
|
-
}))
|
|
141320
|
-
);
|
|
141321
|
-
});
|
|
141322
|
-
}
|
|
141323
|
-
getPointInContinentInfo(r) {
|
|
141324
|
-
var m;
|
|
141325
|
-
return (m = Object.values(continentsLiteJson).map((v) => v.features).find((v) => v[0].geometry.coordinates.some((C) => C.length ? booleanPointInPolygon$1(point(r), polygon(C)) : !1))) == null ? void 0 : m[0];
|
|
141326
|
-
}
|
|
141327
|
-
getPointInContinent(r) {
|
|
141328
|
-
return !!this.getPointInContinentInfo(r);
|
|
141329
|
-
}
|
|
141330
|
-
getLocationPosition(r, m) {
|
|
141331
|
-
var C;
|
|
141332
|
-
const v = m || ((C = this.getPointInContinentInfo(r)) == null ? void 0 : C.properties.name);
|
|
141333
|
-
if (v) {
|
|
141334
|
-
const _ = this.mapArr.find((w) => w.userData.name === v);
|
|
141335
|
-
if (_) {
|
|
141336
|
-
const { projection: w } = _.userData, [I, O] = r, [Pe, Ne] = w([I, O]), Fe = new Vector3(Pe, -Ne, this.options.depth);
|
|
141337
|
-
return Fe.applyMatrix4(_.object3d.matrixWorld), [Fe.x, Fe.y, Fe.z];
|
|
141338
|
-
}
|
|
141339
|
-
}
|
|
141340
|
-
}
|
|
141341
|
-
render() {
|
|
141342
|
-
this.lead.updateBaseObjectKey(this, "continents-group"), this.mapArr.forEach((r) => {
|
|
141343
|
-
this.lead.updateBaseObjectKey(r, "continents-" + r.userData.name);
|
|
141344
|
-
});
|
|
141345
|
-
}
|
|
141346
|
-
dispose() {
|
|
141347
|
-
this.mapArr.forEach((r) => {
|
|
141348
|
-
r.dispose();
|
|
141349
|
-
}), this.mapArr.length = 0;
|
|
141350
|
-
}
|
|
141351
|
-
}
|
|
141352
|
-
class PlaneMap extends ht {
|
|
141353
|
-
constructor(r) {
|
|
141354
|
-
super();
|
|
141355
|
-
C0(this, "options");
|
|
141356
|
-
C0(this, "extrudePolygon");
|
|
141357
|
-
this.options = q0({
|
|
141358
|
-
depth: 2
|
|
141359
|
-
}, r);
|
|
141360
|
-
}
|
|
141361
|
-
geojson2Meta(r) {
|
|
141362
|
-
return r.features.filter((m) => m.geometry).map((m) => {
|
|
141363
|
-
const { type: v, coordinates: C } = m.geometry;
|
|
141364
|
-
let _ = [];
|
|
141365
|
-
return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
|
|
141366
|
-
coords: _,
|
|
141367
|
-
properties: m.properties
|
|
141368
|
-
};
|
|
141369
|
-
});
|
|
141370
|
-
}
|
|
141371
|
-
create() {
|
|
141372
|
-
return B0(this, null, function* () {
|
|
141373
|
-
const { geojson: r, bbox: m } = this.options, v = this.geojson2Meta(r), C = this.pencil.getPlugin("worker"), _ = this.pencil.lead, I = yield this.pencil.loader.load("/1.png"), O = yield C.geoGeometry("extrudePolygon", {
|
|
141374
|
-
mesaage: {
|
|
141375
|
-
coordinatesArr: v.map(({ coords: at }) => at).flat(),
|
|
141376
|
-
projection: q0({}, this.options.projection),
|
|
141377
|
-
topSegments: 100,
|
|
141378
|
-
bbox: m,
|
|
141379
|
-
depth: [this.options.depth],
|
|
141380
|
-
hasBottom: !1,
|
|
141381
|
-
hasSide: !1
|
|
141382
|
-
}
|
|
141383
|
-
}), Pe = O.attributes.position.count;
|
|
141384
|
-
O.setAttribute(
|
|
141385
|
-
"color",
|
|
141386
|
-
new BufferAttribute(new Float32Array(Pe * 3), 3)
|
|
141387
|
-
);
|
|
141388
|
-
const Ne = this.options.depth;
|
|
141389
|
-
this.setNoise(O, I.image, Ne);
|
|
141390
|
-
const Fe = new Color$1(), Ae = O.attributes.color, De = O.attributes.position, xt = new Color$1("red"), je = new Color$1("green");
|
|
141391
|
-
for (let at = 0; at < Pe; at++) {
|
|
141392
|
-
const ct = De.getZ(at) / Ne;
|
|
141393
|
-
Fe.lerpColors(xt, je, ct), Ae.setXYZ(at, Fe.r, Fe.g, Fe.b);
|
|
141394
|
-
}
|
|
141395
|
-
const ke = yield _.draw(
|
|
141396
|
-
"ExtrudePolygon",
|
|
141397
|
-
{
|
|
141398
|
-
geometry: O,
|
|
141399
|
-
material: new MeshStandardMaterial({
|
|
141400
|
-
flatShading: !0,
|
|
141401
|
-
vertexColors: !0
|
|
141402
|
-
})
|
|
141403
|
-
},
|
|
141404
|
-
null
|
|
141405
|
-
);
|
|
141406
|
-
ke.position.z += 1e-3, this.extrudePolygon = ke, this.object3d = ke.object3d;
|
|
141407
|
-
});
|
|
141408
|
-
}
|
|
141409
|
-
setNoise(r, m, v = 1) {
|
|
141410
|
-
const C = document.createElement("canvas"), _ = [];
|
|
141411
|
-
C.width = m.width, C.height = m.height;
|
|
141412
|
-
const w = C.getContext("2d");
|
|
141413
|
-
w.drawImage(m, 0, 0);
|
|
141414
|
-
const O = w.getImageData(0, 0, m.width, m.height).data;
|
|
141415
|
-
for (let Ae = 0; Ae < m.height; Ae++) {
|
|
141416
|
-
_[Ae] = [];
|
|
141417
|
-
for (let De = 0; De < m.width; De++) {
|
|
141418
|
-
const xt = (Ae * m.width + De) * 4, je = O[xt];
|
|
141419
|
-
_[Ae][De] = je / 255;
|
|
141420
|
-
}
|
|
141421
|
-
}
|
|
141422
|
-
const Pe = r.attributes.position, Ne = r.attributes.uv, Fe = new Vector2();
|
|
141423
|
-
for (let Ae = 0; Ae < Pe.count; Ae++) {
|
|
141424
|
-
Fe.fromBufferAttribute(Ne, Ae);
|
|
141425
|
-
let De = Math.round(Fe.x * m.width) - 1, xt = Math.round(Fe.y * m.height) - 1;
|
|
141426
|
-
De < 0 && (De = 0), xt < 0 && (xt = 0);
|
|
141427
|
-
const je = _[xt][De];
|
|
141428
|
-
Pe.setZ(Ae, je * v);
|
|
141429
|
-
}
|
|
141430
|
-
}
|
|
141431
|
-
render() {
|
|
141432
|
-
this.mList.rmBaseObjectMap(this.extrudePolygon);
|
|
141433
|
-
}
|
|
141434
|
-
dispose() {
|
|
141435
|
-
this.extrudePolygon.dispose(), super.dispose();
|
|
141436
|
-
}
|
|
141437
|
-
}
|
|
141438
|
-
const objs$1 = Ji(q0({}, objs$3), {
|
|
141439
|
-
PlaneMap: PlaneMap$1,
|
|
141440
|
-
CityPlane,
|
|
141441
|
-
ContinentsBg,
|
|
141442
|
-
Mountain: PlaneMap
|
|
141443
|
-
}), worldPacificCentre = (g) => {
|
|
141466
|
+
const getLabelElement = (g) => {
|
|
141467
|
+
const t = document.createElement("div");
|
|
141468
|
+
return g.replace(
|
|
141469
|
+
/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,
|
|
141470
|
+
""
|
|
141471
|
+
), t.classList.add(
|
|
141472
|
+
"vis-map-label",
|
|
141473
|
+
"absolute",
|
|
141474
|
+
"top-1/2",
|
|
141475
|
+
"left-1/2",
|
|
141476
|
+
"-translate-x-1/2",
|
|
141477
|
+
"-translate-y-1/2"
|
|
141478
|
+
), t.innerHTML = `
|
|
141479
|
+
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
141480
|
+
${g}
|
|
141481
|
+
</div>
|
|
141482
|
+
`, t;
|
|
141483
|
+
}, worldPacificCentre = (g) => {
|
|
141444
141484
|
g.loaderAdd = function() {
|
|
141445
141485
|
const t = this.loader;
|
|
141446
141486
|
t.add(["/image/map/jianbian.webp"]), t.add(["/image/map/hp2.webp", "/image/map/fx2.webp"]);
|
|
@@ -141790,27 +141830,10 @@ const objs$1 = Ji(q0({}, objs$3), {
|
|
|
141790
141830
|
this.mList.addMultiple("plane", t), this.options.drillDownFirstLevelUseBgMats && this.mList.copyMultiple("plane", "bgPlane"), this.initMaterialBg();
|
|
141791
141831
|
});
|
|
141792
141832
|
};
|
|
141793
|
-
}, getLabelElement = (g) => {
|
|
141794
|
-
const t = document.createElement("div");
|
|
141795
|
-
return g.replace(
|
|
141796
|
-
/省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,
|
|
141797
|
-
""
|
|
141798
|
-
), t.classList.add(
|
|
141799
|
-
"vis-map-label",
|
|
141800
|
-
"absolute",
|
|
141801
|
-
"top-1/2",
|
|
141802
|
-
"left-1/2",
|
|
141803
|
-
"-translate-x-1/2",
|
|
141804
|
-
"-translate-y-1/2"
|
|
141805
|
-
), t.innerHTML = `
|
|
141806
|
-
<div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
|
|
141807
|
-
${g}
|
|
141808
|
-
</div>
|
|
141809
|
-
`, t;
|
|
141810
141833
|
}, xn = class xn extends Base {
|
|
141811
141834
|
constructor() {
|
|
141812
141835
|
super(...arguments);
|
|
141813
|
-
C0(this, "leadObjs", objs$
|
|
141836
|
+
C0(this, "leadObjs", objs$2);
|
|
141814
141837
|
C0(this, "mapHistory", []);
|
|
141815
141838
|
C0(this, "activePlaneMap", null);
|
|
141816
141839
|
C0(this, "isAnimating", !1);
|
|
@@ -142732,7 +142755,10 @@ const objs$1 = Ji(q0({}, objs$3), {
|
|
|
142732
142755
|
return _;
|
|
142733
142756
|
}
|
|
142734
142757
|
setAdcode(v) {
|
|
142735
|
-
return B0(this, arguments, function* ({
|
|
142758
|
+
return B0(this, arguments, function* ({
|
|
142759
|
+
adcodes: r,
|
|
142760
|
+
duration: m
|
|
142761
|
+
}) {
|
|
142736
142762
|
var _, w, I;
|
|
142737
142763
|
const { adcodes: C } = this;
|
|
142738
142764
|
if (!(JSON.stringify(r) === JSON.stringify(C) || this.isAnimating))
|
|
@@ -142803,6 +142829,9 @@ const objs$1 = Ji(q0({}, objs$3), {
|
|
|
142803
142829
|
enableTransition: v
|
|
142804
142830
|
});
|
|
142805
142831
|
}
|
|
142832
|
+
findAdcodeInfo(r) {
|
|
142833
|
+
return findAdcodeInfo(r);
|
|
142834
|
+
}
|
|
142806
142835
|
dispose() {
|
|
142807
142836
|
var r, m, v;
|
|
142808
142837
|
(r = this.cityVis) == null || r.dispose(), (m = this.map) == null || m.dispose(), this.parentBg.forEach((C) => {
|