vis-core 0.28.26 → 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.
@@ -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 { flatten as flatten$3, explode, inside, polygon, intersect as intersect$1, booleanContains, lineString, booleanPointInPolygon as booleanPointInPolygon$1, booleanCrosses, centroid, point, center } from "@turf/turf";
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.26";
91
+ }, version = "0.28.27";
92
92
  /**
93
93
  * @license
94
94
  * Copyright 2010-2025 Three.js Authors
@@ -61300,1137 +61300,7 @@ class Base extends Camera {
61300
61300
  }
61301
61301
  }
61302
61302
  C0(Base, "VisName", "base");
61303
- function clipGeojson(g, t) {
61304
- const r = flatten$3(g).features, m = flatten$3(t).features, v = {
61305
- type: "FeatureCollection",
61306
- features: []
61307
- };
61308
- for (let C = r.length - 1; C >= 0; C--) {
61309
- const _ = r[C];
61310
- for (let w = m.length - 1; w >= 0; w--) {
61311
- const I = m[w];
61312
- if (contains(_, I))
61313
- v.features.push(I);
61314
- else if (contains(I, _))
61315
- _.properties = I.properties, v.features.push(_);
61316
- else {
61317
- const O = intersect$1(_, I);
61318
- O && (O.properties = I.properties, v.features.push(O));
61319
- }
61320
- }
61321
- }
61322
- return v;
61323
- }
61324
- function contains(g, t) {
61325
- let r = !0;
61326
- const m = explode(t).features;
61327
- for (let v = m.length - 1; v >= 0; v--)
61328
- if (!inside(m[v], g)) {
61329
- r = !1;
61330
- break;
61331
- }
61332
- return r;
61333
- }
61334
- const getBoxMultiPoly = (g) => {
61335
- const t = g.features.map((r) => r.geometry.type === "Polygon" ? [r.geometry.coordinates] : r.geometry.coordinates).flat();
61336
- return Array.from({ length: t.length }, (r, m) => polygon(t[m]));
61337
- };
61338
- class Building extends ht {
61339
- constructor(r) {
61340
- super();
61341
- C0(this, "options");
61342
- C0(this, "building", {});
61343
- C0(this, "outJson", /* @__PURE__ */ new Map());
61344
- C0(this, "worldPositionZ", {
61345
- value: 0
61346
- });
61347
- this.options = q0({}, r);
61348
- }
61349
- create() {
61350
- return B0(this, null, function* () {
61351
- 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" : "";
61352
- this.createGroup();
61353
- const Fe = I.getMultiple("building" + Ne);
61354
- let Ae = v ? yield O.getCachedGeometry({
61355
- cacheKey: v
61356
- }) : [];
61357
- if (Ae.length)
61358
- w && this.outJson.set(1, !0);
61359
- else {
61360
- let De;
61361
- w && (De = getBoxMultiPoly(w));
61362
- const xt = {};
61363
- (r.features || r).forEach((ke) => {
61364
- const at = typeof ke.properties.h == "string" ? ke.properties.h.split(".")[1] : 0, ct = Number(ke.properties.h) | 0;
61365
- xt[at] || (xt[at] = {}), xt[at][ct] || (xt[at][ct] = []), De ? De.some((Lt) => {
61366
- ke.geometry.coordinates[1] && console.log(ke.geometry.coordinates[1]);
61367
- const Wt = polygon(ke.geometry.coordinates[0]);
61368
- return booleanContains(Lt, Wt) ? (xt[at][ct].push(ke), !0) : !1;
61369
- }) || this.outJson.set(ke, !1) : xt[at][ct].push(ke);
61370
- });
61371
- const je = Object.keys(xt).map((ke) => {
61372
- const at = xt[ke];
61373
- return Object.keys(at).map((ct) => {
61374
- const Gt = at[ct];
61375
- return {
61376
- z: +ke,
61377
- h: +ct,
61378
- coordinatesArr: Gt.map(
61379
- (Lt) => Lt.geometry.type === "Polygon" ? Lt.geometry.coordinates[0] : Lt.geometry.coordinates[0][0]
61380
- )
61381
- };
61382
- });
61383
- }).flat().filter((ke) => ke.coordinatesArr.length);
61384
- Ae = yield Promise.all(
61385
- je.map((ke) => {
61386
- const { h: at, z: ct, coordinatesArr: Gt } = ke, Lt = +at <= 20 ? +at / 18 : +at <= 60 ? +at / 27 : +at / 12;
61387
- return O.geoGeometry("extrudePolygon", {
61388
- cacheKey: v,
61389
- userData: {
61390
- z: ct,
61391
- h: at
61392
- },
61393
- mesaage: {
61394
- coordinatesArr: Gt,
61395
- projection: m,
61396
- useGroups: 2,
61397
- depth: [Number(at) * (C || 1)],
61398
- hasBottom: !1,
61399
- sideRepeat: Lt
61400
- }
61401
- });
61402
- })
61403
- );
61404
- }
61405
- yield Promise.all(
61406
- Ae.map((De) => B0(this, null, function* () {
61407
- const { h: xt, z: je } = De.userData, ke = xt + je, at = ke <= 20 ? "20" : ke <= 60 ? "60" : "max";
61408
- let ct = this.options.material;
61409
- ct || (ct = [Fe[at + "Top"], Fe[at + "Side"]]);
61410
- const Gt = yield Pe.draw(
61411
- "ExtrudePolygon",
61412
- {
61413
- key: `$p:-${xt}-${je}`,
61414
- geometry: De,
61415
- material: ct
61416
- },
61417
- this
61418
- );
61419
- 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);
61420
- }))
61421
- ), this.options.sideGradient && this.sideGradient(), this.object3d.name = "建筑", _ || this.lead.updateBaseObjectKey(
61422
- this,
61423
- `building${Ne ? "-grey" : ""}#group`
61424
- );
61425
- });
61426
- }
61427
- sideGradient(r = "#052438", m = 0.05 / 100) {
61428
- this.traverse((v) => {
61429
- if (v instanceof is) {
61430
- const C = v.object3d.material;
61431
- C[1].onBeforeCompile = (_) => {
61432
- _.uniforms.gradientColor = { value: new Color$1(r) }, _.uniforms.maxGradientHeight = {
61433
- value: m
61434
- }, _.uniforms.worldPositionZ = this.worldPositionZ, _.vertexShader = `
61435
- varying vec3 vPosition;
61436
- varying vec3 vWorldPosition;
61437
- ${_.vertexShader}
61438
- `.replace(
61439
- "#include <begin_vertex>",
61440
- `#include <begin_vertex>
61441
- vPosition = position;
61442
- vec4 worldPosition1 = modelMatrix * vec4(position, 1.0);
61443
- vWorldPosition = worldPosition1.xyz;
61444
- `
61445
- ), _.vertexShader = `
61446
- varying vec2 vUv;
61447
- ${_.vertexShader}
61448
- `.replace(
61449
- "#include <uv_vertex>",
61450
- `#include <uv_vertex>
61451
- vUv = uv;
61452
- `
61453
- ), _.fragmentShader = `
61454
- uniform vec3 gradientColor;
61455
- uniform float maxGradientHeight;
61456
- uniform float worldPositionZ;
61457
- varying vec3 vWorldPosition;
61458
- varying vec2 vUv;
61459
-
61460
- ${_.fragmentShader}
61461
- `.replace(
61462
- "#include <dithering_fragment>",
61463
- `
61464
- #include <dithering_fragment>
61465
- if ((vWorldPosition.z-worldPositionZ) <= maxGradientHeight) {
61466
- float gradient = (vWorldPosition.z-worldPositionZ) / maxGradientHeight;
61467
- gl_FragColor.rgb = mix(gl_FragColor.rgb, gradientColor,1.0-gradient);
61468
- }
61469
- `
61470
- );
61471
- }, C[1].needsUpdate = !0;
61472
- }
61473
- });
61474
- }
61475
- update() {
61476
- const r = new Vector3();
61477
- this.object3d.getWorldPosition(r), this.worldPositionZ.value !== r.z && (this.worldPositionZ.value = r.z);
61478
- }
61479
- dispose() {
61480
- super.dispose(), this.outJson.clear();
61481
- }
61482
- }
61483
- class Road extends ht {
61484
- constructor(r) {
61485
- super();
61486
- C0(this, "options");
61487
- C0(this, "outJson", /* @__PURE__ */ new Map());
61488
- C0(this, "linePrimary", []);
61489
- C0(this, "lineSecondary", []);
61490
- this.options = q0({}, r);
61491
- }
61492
- create() {
61493
- return B0(this, null, function* () {
61494
- const { clip: r, grey: m } = this.options;
61495
- this.createGroup();
61496
- 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;
61497
- let Fe = Pe ? yield v.getCachedGeometry({
61498
- cacheKey: Pe
61499
- }) : [];
61500
- if (Fe.length)
61501
- r && this.outJson.set(1, !0);
61502
- else {
61503
- const Ae = {};
61504
- let De;
61505
- r && (De = getBoxMultiPoly(r)), (I.features || I).forEach((je) => {
61506
- const ke = je.properties.w;
61507
- Ae[ke] || (Ae[ke] = []), De ? De.some((ct) => {
61508
- je.geometry.coordinates[1] && console.log(je.geometry.coordinates[1]);
61509
- const Gt = lineString(je.geometry.coordinates[0]);
61510
- if (booleanContains(ct, Gt)) {
61511
- const Wt = [
61512
- je.geometry.coordinates[0].filter((Pt) => booleanPointInPolygon$1(Pt, ct))
61513
- ];
61514
- return Wt[0].length && Ae[ke].push(Ji(q0({}, je), {
61515
- geometry: Ji(q0({}, je.geometry), {
61516
- coordinates: Wt
61517
- })
61518
- })), !0;
61519
- }
61520
- return !1;
61521
- }) || this.outJson.set(je, !1) : Ae[ke].push(je);
61522
- });
61523
- const xt = Object.keys(Ae).map((je) => {
61524
- const ke = Ae[je];
61525
- return {
61526
- w: +je,
61527
- coordinatesArr: ke.map((at) => at.geometry.coordinates[0])
61528
- };
61529
- }).filter((je) => je.coordinatesArr.length);
61530
- Fe = yield Promise.all(
61531
- xt.map((je) => {
61532
- const { w: ke, coordinatesArr: at } = je;
61533
- return v.geoGeometry("line", {
61534
- cacheKey: Pe,
61535
- mesaage: {
61536
- coordinatesArr: at,
61537
- lineWidth: [ke * (Ne || 1)],
61538
- projection: O
61539
- }
61540
- });
61541
- })
61542
- );
61543
- }
61544
- yield Promise.all(
61545
- Fe.map((Ae, De) => B0(this, null, function* () {
61546
- const xt = yield C.draw(
61547
- "Line",
61548
- {
61549
- key: `$p:-${De}`,
61550
- geometry: Ae,
61551
- material: _.getMultiple("road" + w).primary
61552
- },
61553
- this
61554
- );
61555
- this.linePrimary.push(xt);
61556
- }))
61557
- ), this.object3d.name = "道路", m || this.lead.updateBaseObjectKey(this, `road${w ? "-grey" : ""}#group`);
61558
- });
61559
- }
61560
- dispose() {
61561
- super.dispose(), this.linePrimary = [], this.lineSecondary = [], this.outJson.clear();
61562
- }
61563
- }
61564
- class Area extends ht {
61565
- constructor(r) {
61566
- super();
61567
- C0(this, "options");
61568
- C0(this, "area", []);
61569
- C0(this, "outJson", /* @__PURE__ */ new Map());
61570
- this.options = q0({}, r);
61571
- }
61572
- create() {
61573
- return B0(this, null, function* () {
61574
- this.createGroup();
61575
- 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;
61576
- let Ne = C ? yield O.getCachedGeometry({
61577
- cacheKey: C
61578
- }) : [];
61579
- if (Ne.length)
61580
- I && this.outJson.set(1, !0);
61581
- else {
61582
- const Fe = {};
61583
- let Ae;
61584
- I && (Ae = getBoxMultiPoly(I)), (r.features || r).forEach((xt) => {
61585
- const je = xt.properties.o;
61586
- Fe[je] || (Fe[je] = []), Ae ? Ae.some((at) => {
61587
- const ct = polygon(xt.geometry.coordinates);
61588
- if (booleanContains(at, ct))
61589
- return Fe[je].push(xt), !0;
61590
- {
61591
- const Lt = lineString(xt.geometry.coordinates[0]);
61592
- if (booleanCrosses(at, Lt)) {
61593
- const Pt = clipGeojson(at, xt);
61594
- Pt.features[0] && Fe[je].push(Ji(q0({}, xt), {
61595
- geometry: Ji(q0({}, xt.geometry), {
61596
- coordinates: Pt.features[0].geometry.coordinates
61597
- })
61598
- }));
61599
- }
61600
- }
61601
- return !1;
61602
- }) || this.outJson.set(xt, !1) : Fe[je].push(xt);
61603
- });
61604
- const De = Object.keys(Fe).map((xt) => {
61605
- const je = Fe[xt];
61606
- return {
61607
- z: +xt,
61608
- coordinatesArr: je.map(
61609
- (ke) => ke.geometry.type === "Polygon" ? ke.geometry.coordinates[0] : ke.geometry.coordinates[0][0]
61610
- )
61611
- };
61612
- }).filter((xt) => xt.coordinatesArr.length);
61613
- Ne = yield Promise.all(
61614
- De.map((xt) => {
61615
- const { z: je, coordinatesArr: ke } = xt;
61616
- return O.geoGeometry("extrudePolygon", {
61617
- cacheKey: C,
61618
- userData: {
61619
- z: je
61620
- },
61621
- mesaage: {
61622
- coordinatesArr: ke,
61623
- projection: m,
61624
- depth: [0],
61625
- hasBottom: !1,
61626
- hasSide: !1
61627
- }
61628
- });
61629
- })
61630
- );
61631
- }
61632
- yield Promise.all(
61633
- Ne.map((Fe, Ae) => B0(this, null, function* () {
61634
- const { z: De } = Fe.userData, xt = yield Pe.draw(
61635
- "ExtrudePolygon",
61636
- {
61637
- key: `$p:-${Ae}`,
61638
- geometry: Fe,
61639
- material: _
61640
- },
61641
- this
61642
- );
61643
- w != null && w.length && (xt.position.z = w.findIndex((je) => je === +De) * 1e-3), this.area.push(xt);
61644
- }))
61645
- );
61646
- });
61647
- }
61648
- dispose() {
61649
- super.dispose(), this.outJson.clear();
61650
- }
61651
- }
61652
- class Reflector extends Mesh {
61653
- /**
61654
- * Constructs a new reflector.
61655
- *
61656
- * @param {BufferGeometry} geometry - The reflector's geometry.
61657
- * @param {Reflector~Options} [options] - The configuration options.
61658
- */
61659
- constructor(t, r = {}) {
61660
- super(t), this.isReflector = !0, this.type = "Reflector", this.forceUpdate = !1, this.camera = new PerspectiveCamera();
61661
- 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({
61662
- name: I.name !== void 0 ? I.name : "unspecified",
61663
- uniforms: UniformsUtils.clone(I.uniforms),
61664
- fragmentShader: I.fragmentShader,
61665
- vertexShader: I.vertexShader
61666
- });
61667
- 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) {
61668
- 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;
61669
- 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(
61670
- 0.5,
61671
- 0,
61672
- 0,
61673
- 0.5,
61674
- 0,
61675
- 0.5,
61676
- 0,
61677
- 0.5,
61678
- 0,
61679
- 0,
61680
- 0.5,
61681
- 0.5,
61682
- 0,
61683
- 0,
61684
- 0,
61685
- 1
61686
- ), 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);
61687
- const n0 = Lt.projectionMatrix;
61688
- 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;
61689
- const r0 = zt.getRenderTarget(), l0 = zt.xr.enabled, s0 = zt.shadowMap.autoUpdate;
61690
- 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);
61691
- const qt = Kt.viewport;
61692
- qt !== void 0 && zt.state.viewport(qt), m.visible = !0, this.forceUpdate = !1;
61693
- }, this.getRenderTarget = function() {
61694
- return Wt;
61695
- }, this.dispose = function() {
61696
- Wt.dispose(), m.material.dispose();
61697
- };
61698
- }
61699
- }
61700
- Reflector.ReflectorShader = {
61701
- name: "ReflectorShader",
61702
- uniforms: {
61703
- color: {
61704
- value: null
61705
- },
61706
- tDiffuse: {
61707
- value: null
61708
- },
61709
- textureMatrix: {
61710
- value: null
61711
- }
61712
- },
61713
- vertexShader: (
61714
- /* glsl */
61715
- `
61716
- uniform mat4 textureMatrix;
61717
- varying vec4 vUv;
61718
-
61719
- #include <common>
61720
- #include <logdepthbuf_pars_vertex>
61721
-
61722
- void main() {
61723
-
61724
- vUv = textureMatrix * vec4( position, 1.0 );
61725
-
61726
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
61727
-
61728
- #include <logdepthbuf_vertex>
61729
-
61730
- }`
61731
- ),
61732
- fragmentShader: (
61733
- /* glsl */
61734
- `
61735
- uniform vec3 color;
61736
- uniform sampler2D tDiffuse;
61737
- varying vec4 vUv;
61738
-
61739
- #include <logdepthbuf_pars_fragment>
61740
-
61741
- float blendOverlay( float base, float blend ) {
61742
-
61743
- return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
61744
-
61745
- }
61746
-
61747
- vec3 blendOverlay( vec3 base, vec3 blend ) {
61748
-
61749
- return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
61750
-
61751
- }
61752
-
61753
- void main() {
61754
-
61755
- #include <logdepthbuf_fragment>
61756
-
61757
- vec4 base = texture2DProj( tDiffuse, vUv );
61758
- gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
61759
-
61760
- #include <tonemapping_fragment>
61761
- #include <colorspace_fragment>
61762
-
61763
- }`
61764
- )
61765
- };
61766
- class Refractor extends Mesh {
61767
- /**
61768
- * Constructs a new refractor.
61769
- *
61770
- * @param {BufferGeometry} geometry - The refractor's geometry.
61771
- * @param {Refractor~Options} [options] - The configuration options.
61772
- */
61773
- constructor(t, r = {}) {
61774
- super(t), this.isRefractor = !0, this.type = "Refractor", this.camera = new PerspectiveCamera();
61775
- 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;
61776
- Pe.matrixAutoUpdate = !1, Pe.userData.refractor = !0;
61777
- const Ne = new Plane$1(), Fe = new Matrix4(), Ae = new WebGLRenderTarget(C, _, { samples: O, type: HalfFloatType });
61778
- this.material = new ShaderMaterial({
61779
- name: I.name !== void 0 ? I.name : "unspecified",
61780
- uniforms: UniformsUtils.clone(I.uniforms),
61781
- vertexShader: I.vertexShader,
61782
- fragmentShader: I.fragmentShader,
61783
- transparent: !0
61784
- // ensures, refractors are drawn from farthest to closest
61785
- }), this.material.uniforms.color.value = v, this.material.uniforms.tDiffuse.value = Ae.texture, this.material.uniforms.textureMatrix.value = Fe;
61786
- const De = function() {
61787
- const ct = new Vector3(), Gt = new Vector3(), Lt = new Matrix4(), Wt = new Vector3(), Pt = new Vector3();
61788
- return function(Nt) {
61789
- 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;
61790
- };
61791
- }(), xt = function() {
61792
- const ct = new Vector3(), Gt = new Vector3(), Lt = new Quaternion(), Wt = new Vector3();
61793
- return function() {
61794
- m.matrixWorld.decompose(Gt, Lt, Wt), ct.set(0, 0, 1).applyQuaternion(Lt).normalize(), ct.negate(), Ne.setFromNormalAndCoplanarPoint(ct, Gt);
61795
- };
61796
- }(), je = function() {
61797
- const ct = new Plane$1(), Gt = new Vector4(), Lt = new Vector4();
61798
- return function(Pt) {
61799
- 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);
61800
- const zt = Pe.projectionMatrix;
61801
- 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;
61802
- };
61803
- }();
61804
- function ke(ct) {
61805
- Fe.set(
61806
- 0.5,
61807
- 0,
61808
- 0,
61809
- 0.5,
61810
- 0,
61811
- 0.5,
61812
- 0,
61813
- 0.5,
61814
- 0,
61815
- 0,
61816
- 0.5,
61817
- 0.5,
61818
- 0,
61819
- 0,
61820
- 0,
61821
- 1
61822
- ), Fe.multiply(ct.projectionMatrix), Fe.multiply(ct.matrixWorldInverse), Fe.multiply(m.matrixWorld);
61823
- }
61824
- function at(ct, Gt, Lt) {
61825
- m.visible = !1;
61826
- const Wt = ct.getRenderTarget(), Pt = ct.xr.enabled, zt = ct.shadowMap.autoUpdate;
61827
- 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);
61828
- const Nt = Lt.viewport;
61829
- Nt !== void 0 && ct.state.viewport(Nt), m.visible = !0;
61830
- }
61831
- this.onBeforeRender = function(ct, Gt, Lt) {
61832
- Lt.userData.refractor !== !0 && De(Lt) && (xt(), ke(Lt), je(Lt), at(ct, Gt, Lt));
61833
- }, this.getRenderTarget = function() {
61834
- return Ae;
61835
- }, this.dispose = function() {
61836
- Ae.dispose(), m.material.dispose();
61837
- };
61838
- }
61839
- }
61840
- Refractor.RefractorShader = {
61841
- name: "RefractorShader",
61842
- uniforms: {
61843
- color: {
61844
- value: null
61845
- },
61846
- tDiffuse: {
61847
- value: null
61848
- },
61849
- textureMatrix: {
61850
- value: null
61851
- }
61852
- },
61853
- vertexShader: (
61854
- /* glsl */
61855
- `
61856
-
61857
- uniform mat4 textureMatrix;
61858
-
61859
- varying vec4 vUv;
61860
-
61861
- void main() {
61862
-
61863
- vUv = textureMatrix * vec4( position, 1.0 );
61864
- gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
61865
-
61866
- }`
61867
- ),
61868
- fragmentShader: (
61869
- /* glsl */
61870
- `
61871
-
61872
- uniform vec3 color;
61873
- uniform sampler2D tDiffuse;
61874
-
61875
- varying vec4 vUv;
61876
-
61877
- float blendOverlay( float base, float blend ) {
61878
-
61879
- return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
61880
-
61881
- }
61882
-
61883
- vec3 blendOverlay( vec3 base, vec3 blend ) {
61884
-
61885
- return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
61886
-
61887
- }
61888
-
61889
- void main() {
61890
-
61891
- vec4 base = texture2DProj( tDiffuse, vUv );
61892
- gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
61893
-
61894
- #include <tonemapping_fragment>
61895
- #include <colorspace_fragment>
61896
-
61897
- }`
61898
- )
61899
- };
61900
- class Water extends Mesh {
61901
- constructor(t, r = {}) {
61902
- super(t), this.isWater = !0, this.type = "Water";
61903
- 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;
61904
- De.colorSpace = NoColorSpace, xt.colorSpace = NoColorSpace;
61905
- const je = 0.15, ke = je * 0.5, at = new Matrix4(), ct = new Clock();
61906
- if (Reflector === void 0) {
61907
- console.error("THREE.Water: Required component Reflector not found.");
61908
- return;
61909
- }
61910
- if (Refractor === void 0) {
61911
- console.error("THREE.Water: Required component Refractor not found.");
61912
- return;
61913
- }
61914
- const Gt = new Reflector(t, {
61915
- textureWidth: C,
61916
- textureHeight: _,
61917
- clipBias: w
61918
- }), Lt = new Refractor(t, {
61919
- textureWidth: C,
61920
- textureHeight: _,
61921
- clipBias: w
61922
- });
61923
- Gt.matrixAutoUpdate = !1, Lt.matrixAutoUpdate = !1, this.material = new ShaderMaterial({
61924
- name: Fe.name,
61925
- uniforms: UniformsUtils.merge([UniformsLib.fog, Fe.uniforms]),
61926
- vertexShader: Fe.vertexShader,
61927
- fragmentShader: Fe.fragmentShader,
61928
- transparent: !0,
61929
- fog: !0
61930
- }), Ae !== void 0 ? (this.material.defines.USE_FLOWMAP = "", this.material.uniforms.tFlowMap = {
61931
- type: "t",
61932
- value: Ae
61933
- }) : this.material.uniforms.flowDirection = {
61934
- type: "v2",
61935
- value: I
61936
- }, 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;
61937
- function Wt(zt) {
61938
- at.set(
61939
- 0.5,
61940
- 0,
61941
- 0,
61942
- 0.5,
61943
- 0,
61944
- 0.5,
61945
- 0,
61946
- 0.5,
61947
- 0,
61948
- 0,
61949
- 0.5,
61950
- 0.5,
61951
- 0,
61952
- 0,
61953
- 0,
61954
- 1
61955
- ), at.multiply(zt.projectionMatrix), at.multiply(zt.matrixWorldInverse), at.multiply(m.matrixWorld);
61956
- }
61957
- function Pt() {
61958
- const zt = ct.getDelta(), Nt = m.material.uniforms.config;
61959
- 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);
61960
- }
61961
- this.onBeforeRender = function(zt, Nt, Kt) {
61962
- 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;
61963
- };
61964
- }
61965
- }
61966
- Water.WaterShader = {
61967
- name: "WaterShader",
61968
- uniforms: {
61969
- color: {
61970
- type: "c",
61971
- value: null
61972
- },
61973
- reflectivity: {
61974
- type: "f",
61975
- value: 0
61976
- },
61977
- tReflectionMap: {
61978
- type: "t",
61979
- value: null
61980
- },
61981
- tRefractionMap: {
61982
- type: "t",
61983
- value: null
61984
- },
61985
- tNormalMap0: {
61986
- type: "t",
61987
- value: null
61988
- },
61989
- tNormalMap1: {
61990
- type: "t",
61991
- value: null
61992
- },
61993
- textureMatrix: {
61994
- type: "m4",
61995
- value: null
61996
- },
61997
- config: {
61998
- type: "v4",
61999
- value: new Vector4()
62000
- }
62001
- },
62002
- vertexShader: (
62003
- /* glsl */
62004
- `
62005
-
62006
- #include <common>
62007
- #include <fog_pars_vertex>
62008
- #include <logdepthbuf_pars_vertex>
62009
-
62010
- uniform mat4 textureMatrix;
62011
-
62012
- varying vec4 vCoord;
62013
- varying vec2 vUv;
62014
- varying vec3 vToEye;
62015
-
62016
- void main() {
62017
-
62018
- vUv = uv;
62019
- vCoord = textureMatrix * vec4( position, 1.0 );
62020
-
62021
- vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
62022
- vToEye = cameraPosition - worldPosition.xyz;
62023
-
62024
- vec4 mvPosition = viewMatrix * worldPosition; // used in fog_vertex
62025
- gl_Position = projectionMatrix * mvPosition;
62026
-
62027
- #include <logdepthbuf_vertex>
62028
- #include <fog_vertex>
62029
-
62030
- }`
62031
- ),
62032
- fragmentShader: (
62033
- /* glsl */
62034
- `
62035
-
62036
- #include <common>
62037
- #include <fog_pars_fragment>
62038
- #include <logdepthbuf_pars_fragment>
62039
-
62040
- uniform sampler2D tReflectionMap;
62041
- uniform sampler2D tRefractionMap;
62042
- uniform sampler2D tNormalMap0;
62043
- uniform sampler2D tNormalMap1;
62044
-
62045
- #ifdef USE_FLOWMAP
62046
- uniform sampler2D tFlowMap;
62047
- #else
62048
- uniform vec2 flowDirection;
62049
- #endif
62050
-
62051
- uniform vec3 color;
62052
- uniform float reflectivity;
62053
- uniform vec4 config;
62054
-
62055
- varying vec4 vCoord;
62056
- varying vec2 vUv;
62057
- varying vec3 vToEye;
62058
-
62059
- void main() {
62060
-
62061
- #include <logdepthbuf_fragment>
62062
-
62063
- float flowMapOffset0 = config.x;
62064
- float flowMapOffset1 = config.y;
62065
- float halfCycle = config.z;
62066
- float scale = config.w;
62067
-
62068
- vec3 toEye = normalize( vToEye );
62069
-
62070
- // determine flow direction
62071
- vec2 flow;
62072
- #ifdef USE_FLOWMAP
62073
- flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
62074
- #else
62075
- flow = flowDirection;
62076
- #endif
62077
- flow.x *= - 1.0;
62078
-
62079
- // sample normal maps (distort uvs with flowdata)
62080
- vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
62081
- vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
62082
-
62083
- // linear interpolate to get the final normal color
62084
- float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
62085
- vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
62086
-
62087
- // calculate normal vector
62088
- vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b, normalColor.g * 2.0 - 1.0 ) );
62089
-
62090
- // calculate the fresnel term to blend reflection and refraction maps
62091
- // float theta = max( dot( toEye, normal ), 0.0 );
62092
- vec3 adjustedEye = vec3(toEye.x, toEye.z, toEye.y);
62093
- float theta = max( dot( adjustedEye, normal ), 0.0 );
62094
- float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
62095
-
62096
- // calculate final uv coords
62097
- vec3 coord = vCoord.xyz / vCoord.w;
62098
- vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
62099
-
62100
- vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
62101
- vec4 refractColor = texture2D( tRefractionMap, uv );
62102
-
62103
- // multiply water color with the mix of both textures
62104
- gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
62105
-
62106
- #include <tonemapping_fragment>
62107
- #include <colorspace_fragment>
62108
- #include <fog_fragment>
62109
-
62110
- }`
62111
- )
62112
- };
62113
- class CityPlane extends ht {
62114
- constructor(r) {
62115
- super();
62116
- C0(this, "options");
62117
- C0(this, "plane");
62118
- C0(this, "water");
62119
- this.options = q0({
62120
- color: "#0C4557",
62121
- map: null
62122
- }, r);
62123
- }
62124
- create() {
62125
- return B0(this, null, function* () {
62126
- const { width: r, height: m, color: v, map: C, material: _ } = this.options, w = new PlaneGeometry(r, m, 2, 2);
62127
- this.plane = w;
62128
- const I = _ || new MeshBasicMaterial({
62129
- color: v,
62130
- map: C
62131
- });
62132
- this.createMesh(w, I);
62133
- });
62134
- }
62135
- addWater() {
62136
- const r = this.pencil.loader, m = new Water(this.plane.clone(), {
62137
- color: "#ffffff",
62138
- scale: 1,
62139
- flowDirection: new Vector2(0, 0),
62140
- flowSpeed: 1e-9,
62141
- textureWidth: 1024,
62142
- textureHeight: 1024,
62143
- normalMap0: r.getAsset("/image/water/normalMap0.jpg"),
62144
- normalMap1: r.getAsset("/image/water/normalMap1.jpg"),
62145
- reflectivity: 0.04
62146
- });
62147
- this.water = m, m.position.z = 1e-3, this.add(m);
62148
- }
62149
- }
62150
- 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;
62151
- function getCanvasTexture(g) {
62152
- const t = document.createElement("canvas");
62153
- t.width = 256, t.height = 256;
62154
- const r = t.getContext("2d"), m = r.createLinearGradient(0, 0, 0, 256);
62155
- 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);
62156
- const v = new CanvasTexture(t);
62157
- return v.colorSpace = SRGBColorSpace, v.wrapT = RepeatWrapping, v.magFilter = NearestFilter, v.minFilter = NearestFilter, t.remove(), v;
62158
- }
62159
- class Target extends ht {
62160
- constructor(r) {
62161
- super();
62162
- C0(this, "options");
62163
- C0(this, "time", { value: 0 });
62164
- C0(this, "offset", new Vector2(0, 0));
62165
- C0(this, "timer", null);
62166
- C0(this, "inTween", null);
62167
- C0(this, "outTween", null);
62168
- this.options = r;
62169
- }
62170
- createWave(r) {
62171
- const m = width * 3, v = new PlaneGeometry(m, m, 1, 1), C = new ShaderMaterial({
62172
- uniforms: {
62173
- uColor: {
62174
- value: new Color$1(`rgb(${r})`)
62175
- },
62176
- uOpacity: {
62177
- value: 0
62178
- },
62179
- uSpeed: { value: 0.1 },
62180
- uLineCount: { value: 3 },
62181
- uRadius: { value: m / 2 },
62182
- time: this.time
62183
- },
62184
- blending: AdditiveBlending,
62185
- depthWrite: !1,
62186
- transparent: !0,
62187
- vertexShader,
62188
- fragmentShader
62189
- });
62190
- return new Mesh(v, C);
62191
- }
62192
- createRipple(r) {
62193
- const m = new ShaderMaterial({
62194
- uniforms: {
62195
- uTexture: {
62196
- value: r
62197
- },
62198
- uOffset: {
62199
- value: this.offset
62200
- },
62201
- uRepeat: {
62202
- value: 6
62203
- },
62204
- uOpacity: {
62205
- value: 1
62206
- }
62207
- },
62208
- fragmentShader: fs,
62209
- vertexShader: vs,
62210
- transparent: !0,
62211
- depthWrite: !1,
62212
- blending: AdditiveBlending,
62213
- side: DoubleSide
62214
- }), v = width, C = height * 1.5, _ = new CylinderGeometry(
62215
- v,
62216
- v,
62217
- C,
62218
- radialSegments,
62219
- 1,
62220
- !0
62221
- ), w = new Mesh(_, m);
62222
- return w.translateZ(C / 2), w.rotateX(Math.PI / 2), w;
62223
- }
62224
- createCylinder(r) {
62225
- const m = width - 0.1, v = new CylinderGeometry(
62226
- m,
62227
- // top
62228
- m,
62229
- // bottom
62230
- height,
62231
- radialSegments,
62232
- 1,
62233
- !0
62234
- ), C = new MeshBasicMaterial({
62235
- map: r,
62236
- transparent: !0,
62237
- side: DoubleSide,
62238
- opacity: 0.3
62239
- // depthWrite: false,
62240
- // blending: THREE.AdditiveBlending,
62241
- }), _ = new Object3D(), w = new Mesh(v, C);
62242
- return w.translateZ(height / 2), w.rotateX(Math.PI / 2), _.add(w), _.scale.setZ(1), _;
62243
- }
62244
- createTorus(r) {
62245
- const m = new TorusGeometry(width / 3, 0.4, 6, 36), v = new MeshBasicMaterial({
62246
- color: `rgb(${r})`,
62247
- transparent: !0,
62248
- opacity: 0
62249
- }), C = new Mesh(m, v);
62250
- return C.translateZ(1), C;
62251
- }
62252
- create() {
62253
- return B0(this, null, function* () {
62254
- const { scale: r = 0.03 } = this.options;
62255
- this.createGroup();
62256
- const m = this.pencil.loader, v = "241, 241, 86", C = m.getAsset("/image/city/cylinder.webp"), _ = getCanvasTexture(v), w = this.createRipple(_);
62257
- this.object3d.add(w);
62258
- const I = this.createCylinder(C);
62259
- this.object3d.add(I), this.object3d.scale.multiplyScalar(r);
62260
- });
62261
- }
62262
- erase() {
62263
- 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();
62264
- }
62265
- update(r, m) {
62266
- this.time.value += 0.01, this.offset.y -= 0.02;
62267
- }
62268
- }
62269
- const objs$2 = Ji(q0({}, objs$3), {
62270
- Building,
62271
- Road,
62272
- Area,
62273
- CityPlane,
62274
- Target
62275
- }), setWaterMaterial = (g, t = {}) => {
62276
- 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(
62277
- t.waterColor !== void 0 ? t.waterColor : g.material.color
62278
- ), 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 = {
62279
- name: "MirrorShader",
62280
- uniforms: UniformsUtils.merge([
62281
- UniformsLib.fog,
62282
- UniformsLib.lights,
62283
- {
62284
- normalSampler: { value: null },
62285
- mirrorSampler: { value: null },
62286
- alpha: { value: 1 },
62287
- time: { value: 0 },
62288
- size: { value: 1 },
62289
- distortionScale: { value: 20 },
62290
- textureMatrix: { value: new Matrix4() },
62291
- eye: { value: new Vector3() },
62292
- waterColor: { value: new Color$1(5592405) }
62293
- }
62294
- ]),
62295
- vertexShader: (
62296
- /* glsl */
62297
- `
62298
- uniform mat4 textureMatrix;
62299
- uniform float time;
62300
-
62301
- varying vec4 mirrorCoord;
62302
- varying vec4 worldPosition;
62303
-
62304
- #include <common>
62305
- #include <fog_pars_vertex>
62306
- #include <shadowmap_pars_vertex>
62307
- #include <logdepthbuf_pars_vertex>
62308
-
62309
- void main() {
62310
- mirrorCoord = modelMatrix * vec4( position, 1.0 );
62311
- worldPosition = mirrorCoord.xyzw;
62312
- mirrorCoord = textureMatrix * mirrorCoord;
62313
- vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
62314
- gl_Position = projectionMatrix * mvPosition;
62315
-
62316
- #include <beginnormal_vertex>
62317
- #include <defaultnormal_vertex>
62318
- #include <logdepthbuf_vertex>
62319
- #include <fog_vertex>
62320
- #include <shadowmap_vertex>
62321
- }`
62322
- ),
62323
- fragmentShader: (
62324
- /* glsl */
62325
- `
62326
- uniform sampler2D mirrorSampler;
62327
- uniform float alpha;
62328
- uniform float time;
62329
- uniform float size;
62330
- uniform float distortionScale;
62331
- uniform sampler2D normalSampler;
62332
-
62333
-
62334
- uniform vec3 eye;
62335
- uniform vec3 waterColor;
62336
-
62337
- varying vec4 mirrorCoord;
62338
- varying vec4 worldPosition;
62339
-
62340
- vec4 getNoise( vec2 uv ) {
62341
- vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);
62342
- vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );
62343
- vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );
62344
- vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );
62345
- vec4 noise = texture2D( normalSampler, uv0 ) +
62346
- texture2D( normalSampler, uv1 ) +
62347
- texture2D( normalSampler, uv2 ) +
62348
- texture2D( normalSampler, uv3 );
62349
- return noise * 0.5 - 1.0;
62350
- }
62351
-
62352
-
62353
- #include <common>
62354
- #include <packing>
62355
- #include <bsdfs>
62356
- #include <fog_pars_fragment>
62357
- #include <logdepthbuf_pars_fragment>
62358
- #include <lights_pars_begin>
62359
- #include <shadowmap_pars_fragment>
62360
- #include <shadowmask_pars_fragment>
62361
-
62362
- void main() {
62363
-
62364
- #include <logdepthbuf_fragment>
62365
- vec4 noise = getNoise( worldPosition.xz * size );
62366
- vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );
62367
-
62368
-
62369
- vec3 worldToEye = eye-worldPosition.xyz;
62370
-
62371
-
62372
- float distance = length(worldToEye);
62373
-
62374
- vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;
62375
- vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.w + distortion ) );
62376
- vec3 m =mix(reflectionSample, waterColor, 0.5);
62377
- gl_FragColor = vec4(m, alpha );
62378
-
62379
- #include <tonemapping_fragment>
62380
- #include <colorspace_fragment>
62381
- #include <fog_fragment>
62382
- }`
62383
- )
62384
- }, Nt = new ShaderMaterial({
62385
- name: zt.name,
62386
- uniforms: UniformsUtils.clone(zt.uniforms),
62387
- vertexShader: zt.vertexShader,
62388
- fragmentShader: zt.fragmentShader,
62389
- lights: !0,
62390
- side: O,
62391
- fog: Pe
62392
- });
62393
- 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;
62394
- const Kt = g.material;
62395
- g.material = Nt, g.onBeforeRender = function(kt, n0, r0) {
62396
- 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();
62397
- const l0 = new Frustum(), s0 = new Matrix4();
62398
- if (s0.multiplyMatrices(
62399
- r0.projectionMatrix,
62400
- r0.matrixWorldInverse
62401
- ), l0.setFromProjectionMatrix(s0), !l0.intersectsObject(g) || at.dot(Fe) > 0)
62402
- return;
62403
- 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(
62404
- 0.5,
62405
- 0,
62406
- 0,
62407
- 0.5,
62408
- 0,
62409
- 0.5,
62410
- 0,
62411
- 0.5,
62412
- 0,
62413
- 0,
62414
- 0.5,
62415
- 0.5,
62416
- 0,
62417
- 0,
62418
- 0,
62419
- 1
62420
- ), Lt.multiply(Wt.projectionMatrix), Lt.multiply(Wt.matrixWorldInverse), Ne.setFromNormalAndCoplanarPoint(Fe, Ae), Ne.applyMatrix4(Wt.matrixWorldInverse), ke.set(
62421
- Ne.normal.x,
62422
- Ne.normal.y,
62423
- Ne.normal.z,
62424
- Ne.constant
62425
- );
62426
- const qt = Wt.projectionMatrix;
62427
- 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);
62428
- const t0 = kt.getRenderTarget(), Yt = kt.xr.enabled, a0 = kt.shadowMap.autoUpdate;
62429
- 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);
62430
- const g0 = r0.viewport;
62431
- g0 !== void 0 && kt.state.viewport(g0);
62432
- };
62433
- }, type = "FeatureCollection", features = [
61303
+ const type = "FeatureCollection", features = [
62434
61304
  {
62435
61305
  type: "Feature",
62436
61306
  properties: {},
@@ -140402,116 +139272,1754 @@ const objs$2 = Ji(q0({}, objs$3), {
140402
139272
  ]
140403
139273
  }
140404
139274
  }
140405
- ]
139275
+ ]
139276
+ }
139277
+ }, continentsBboxObj = {
139278
+ 2: [
139279
+ -17.535645,
139280
+ -34.785742,
139281
+ 51.390234,
139282
+ 37.340381
139283
+ ],
139284
+ 5: [
139285
+ -81.336621,
139286
+ -54.853613,
139287
+ -34.805469,
139288
+ 12.419971
139289
+ ],
139290
+ 9: [
139291
+ 113.184766,
139292
+ -46.620508,
139293
+ 178.53623,
139294
+ -2.609766
139295
+ ],
139296
+ 10: [
139297
+ -180,
139298
+ -89.998926,
139299
+ 180,
139300
+ -63.22627
139301
+ ],
139302
+ 21: [
139303
+ -168.088379,
139304
+ 7.220068,
139305
+ -11.430664,
139306
+ 83.564844
139307
+ ],
139308
+ 142: [
139309
+ 26.038965,
139310
+ -10.347168,
139311
+ 180,
139312
+ 80.158252
139313
+ ],
139314
+ 150: [
139315
+ -24.475684,
139316
+ 36.025928,
139317
+ 40.108789,
139318
+ 80.477832
139319
+ ]
139320
+ }, continentsCountriesIso = JSON.parse(JSON.stringify(continentsCountriesIso2));
139321
+ continentsCountriesIso.Asia.includes("RU") || continentsCountriesIso.Asia.push("RU");
139322
+ continentsCountriesIso.Europe = continentsCountriesIso.Europe.filter(
139323
+ (g) => g !== "RU"
139324
+ );
139325
+ const continentsBbox = continentsBboxObj, continentsM49 = {
139326
+ Asia: 142,
139327
+ Europe: 150,
139328
+ Africa: 2,
139329
+ Oceania: 9,
139330
+ "North America": 21,
139331
+ "South America": 5,
139332
+ Antarctica: 10
139333
+ }, chinaName = {
139334
+ Asia: "亚洲",
139335
+ Europe: "欧洲",
139336
+ Africa: "非洲",
139337
+ Oceania: "大洋洲",
139338
+ "North America": "北美洲",
139339
+ "South America": "南美洲",
139340
+ Antarctica: "南极洲"
139341
+ }, continentsType = Object.keys(continentsCountriesIso).map((g) => ({
139342
+ name: chinaName[g],
139343
+ en_name: g,
139344
+ adcode: continentsM49[g],
139345
+ lng: 0,
139346
+ lat: 0,
139347
+ level: " continent",
139348
+ parent: 0,
139349
+ c: [],
139350
+ b: [
139351
+ ...continentsBbox[continentsM49[g]]
139352
+ ]
139353
+ })), worldFeaturesFilterJson = worldJson.features.map((g, t) => {
139354
+ if (g.properties.iso_a2 === "CN")
139355
+ return g;
139356
+ const r = g.properties.iso_a2 === "FR", m = g.properties.iso_a2 === "RU", v = r ? 20 : 10;
139357
+ let C = g.geometry.type === "Polygon" ? [g.geometry.coordinates] : g.geometry.coordinates;
139358
+ return C = C.filter((_, w) => _.length === 1 && _[0].length < v ? !1 : !(m && w === 0)), C.length ? Ji(q0({}, g), {
139359
+ geometry: Ji(q0({}, g.geometry), {
139360
+ coordinates: g.geometry.type === "Polygon" ? C[0] : C
139361
+ })
139362
+ }) : null;
139363
+ }).filter((g) => g), continentsJson = continentsType.reduce(
139364
+ (g, t) => (g[t.adcode] = {
139365
+ type: "FeatureCollection",
139366
+ features: worldFeaturesFilterJson.filter((r) => continentsCountriesIso[t.en_name].includes(
139367
+ r.properties.iso_a2
139368
+ ))
139369
+ }, g),
139370
+ {}
139371
+ ), continentsLiteJson = continentsLite, findAdcodeInfo = (g) => g === 0 ? {
139372
+ name: "世界",
139373
+ adcode: 0,
139374
+ lng: 0,
139375
+ lat: 0,
139376
+ level: "world",
139377
+ parent: 0,
139378
+ c: [],
139379
+ b: [...worldExclATABbox]
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
+ });
140406
140350
  }
140407
- }, continentsBboxObj = {
140408
- 2: [
140409
- -17.535645,
140410
- -34.785742,
140411
- 51.390234,
140412
- 37.340381
140413
- ],
140414
- 5: [
140415
- -81.336621,
140416
- -54.853613,
140417
- -34.805469,
140418
- 12.419971
140419
- ],
140420
- 9: [
140421
- 113.184766,
140422
- -46.620508,
140423
- 178.53623,
140424
- -2.609766
140425
- ],
140426
- 10: [
140427
- -180,
140428
- -89.998926,
140429
- 180,
140430
- -63.22627
140431
- ],
140432
- 21: [
140433
- -168.088379,
140434
- 7.220068,
140435
- -11.430664,
140436
- 83.564844
140437
- ],
140438
- 142: [
140439
- 26.038965,
140440
- -10.347168,
140441
- 180,
140442
- 80.158252
140443
- ],
140444
- 150: [
140445
- -24.475684,
140446
- 36.025928,
140447
- 40.108789,
140448
- 80.477832
140449
- ]
140450
- }, continentsCountriesIso = JSON.parse(JSON.stringify(continentsCountriesIso2));
140451
- continentsCountriesIso.Asia.includes("RU") || continentsCountriesIso.Asia.push("RU");
140452
- continentsCountriesIso.Europe = continentsCountriesIso.Europe.filter(
140453
- (g) => g !== "RU"
140454
- );
140455
- const continentsBbox = continentsBboxObj, continentsM49 = {
140456
- Asia: 142,
140457
- Europe: 150,
140458
- Africa: 2,
140459
- Oceania: 9,
140460
- "North America": 21,
140461
- "South America": 5,
140462
- Antarctica: 10
140463
- }, chinaName = {
140464
- Asia: "亚洲",
140465
- Europe: "欧洲",
140466
- Africa: "非洲",
140467
- Oceania: "大洋洲",
140468
- "North America": "北美洲",
140469
- "South America": "南美洲",
140470
- Antarctica: "南极洲"
140471
- }, continentsType = Object.keys(continentsCountriesIso).map((g) => ({
140472
- name: chinaName[g],
140473
- en_name: g,
140474
- adcode: continentsM49[g],
140475
- lng: 0,
140476
- lat: 0,
140477
- level: " continent",
140478
- parent: 0,
140479
- c: [],
140480
- b: [
140481
- ...continentsBbox[continentsM49[g]]
140482
- ]
140483
- })), worldFeaturesFilterJson = worldJson.features.map((g, t) => {
140484
- if (g.properties.iso_a2 === "CN")
140485
- return g;
140486
- const r = g.properties.iso_a2 === "FR", m = g.properties.iso_a2 === "RU", v = r ? 20 : 10;
140487
- let C = g.geometry.type === "Polygon" ? [g.geometry.coordinates] : g.geometry.coordinates;
140488
- return C = C.filter((_, w) => _.length === 1 && _[0].length < v ? !1 : !(m && w === 0)), C.length ? Ji(q0({}, g), {
140489
- geometry: Ji(q0({}, g.geometry), {
140490
- coordinates: g.geometry.type === "Polygon" ? C[0] : C
140491
- })
140492
- }) : null;
140493
- }).filter((g) => g), continentsJson = continentsType.reduce(
140494
- (g, t) => (g[t.adcode] = {
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 = {
140495
140388
  type: "FeatureCollection",
140496
- features: worldFeaturesFilterJson.filter((r) => continentsCountriesIso[t.en_name].includes(
140497
- r.properties.iso_a2
140498
- ))
140499
- }, g),
140500
- {}
140501
- ), continentsLiteJson = continentsLite, findAdcodeInfo = (g) => g === 0 ? {
140502
- name: "世界",
140503
- adcode: 0,
140504
- lng: 0,
140505
- lat: 0,
140506
- level: "world",
140507
- parent: 0,
140508
- c: [],
140509
- b: [...worldExclATABbox]
140510
- } : /^\d{6}$/.test(`${g}`) ? adcodeAll[g] : continentsType.find((t) => t.adcode === g);
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
+ };
140511
141019
  class City$1 extends Base {
140512
141020
  constructor() {
140513
141021
  super(...arguments);
140514
- C0(this, "leadObjs", objs$2);
141022
+ C0(this, "leadObjs", objs$1);
140515
141023
  C0(this, "adcode", 0);
140516
141024
  C0(this, "pcenter", [104, 37.5]);
140517
141025
  C0(this, "pscale", 5e4);
@@ -140955,514 +141463,24 @@ class City extends City$1 {
140955
141463
  this.pencil.camera.near = r * this.multiplyScalar, m && (this.pencil.camera.far = m * this.multiplyScalar), this.pencil.camera.updateProjectionMatrix();
140956
141464
  }
140957
141465
  }
140958
- const hideMaterial = new MeshBasicMaterial({
140959
- colorWrite: !1,
140960
- transparent: !0
140961
- });
140962
- let PlaneMap$1 = class extends ht {
140963
- constructor(r) {
140964
- var m;
140965
- super();
140966
- C0(this, "options");
140967
- C0(this, "isActive", !0);
140968
- C0(this, "groupArr", []);
140969
- C0(this, "areaArr", []);
140970
- C0(this, "lineArr");
140971
- C0(this, "mergeSideArea", null);
140972
- C0(this, "extrudelineArr");
140973
- C0(this, "splitPolygons", 0);
140974
- this.options = q0({
140975
- areaGroup: !0,
140976
- hasSide: !0,
140977
- lineOffset: 0,
140978
- topSegments: 0,
140979
- depth: 2,
140980
- bloom: !1,
140981
- mergeSide: !1,
140982
- onTop: 0
140983
- }, r), ((m = this.options.projection.rotate) == null ? void 0 : m[0]) === -160 && (this.options.projection.projectionType === "winkel3" ? this.splitPolygons = 100 : this.splitPolygons = 300);
140984
- }
140985
- create() {
140986
- return B0(this, null, function* () {
140987
- const {
140988
- geojson: r,
140989
- extrudeLineGeojson: m,
140990
- bbox: v,
140991
- areaGroup: C,
140992
- materialOptions: _,
140993
- hasSide: w,
140994
- mergeSide: I
140995
- } = this.options;
140996
- this.createGroup();
140997
- const O = this.pencil.lead;
140998
- if (C) {
140999
- const Wt = yield Promise.all(
141000
- r.features.map((Pt) => B0(this, null, function* () {
141001
- const { properties: zt } = Pt, Nt = `${this.getPropertiesKey(zt)}`, Kt = yield O.draw("Group", {
141002
- target: this,
141003
- key: Nt
141004
- });
141005
- return Kt.object3d.name = (zt == null ? void 0 : zt.adcode) === "100000_JD" ? "十段线" : zt == null ? void 0 : zt.name, Kt.userData = q0({}, zt), Kt;
141006
- }))
141007
- );
141008
- this.groupArr = Wt;
141009
- }
141010
- const {
141011
- lineMat: Pe,
141012
- extrudeLineMat: Ne,
141013
- topMat: Fe,
141014
- sideMat: Ae,
141015
- bgTopMat: De,
141016
- bgSideMat: xt,
141017
- bgLineMat: je,
141018
- bgExtrudeLineMat: ke
141019
- } = _, [at, ct, Gt, Lt] = yield Promise.all([
141020
- this.addArea(r, {
141021
- material: w ? [Fe, I ? hideMaterial : Ae] : Fe,
141022
- bbox: v,
141023
- areaGroup: C,
141024
- hasSide: w,
141025
- hasTop: !0,
141026
- castShadow: !I,
141027
- onTop: this.options.onTop
141028
- }),
141029
- this.addLine(r, {
141030
- material: Pe,
141031
- onTop: this.options.onTop + 2,
141032
- areaGroup: C
141033
- }),
141034
- m && this.addLine(m, {
141035
- material: Ne,
141036
- onTop: this.options.onTop + 3
141037
- }),
141038
- I && m && this.addArea(m, {
141039
- material: Ae,
141040
- bbox: v,
141041
- castShadow: !0,
141042
- areaGroup: !1,
141043
- hasSide: !0,
141044
- hasTop: !1,
141045
- onTop: this.options.onTop
141046
- })
141047
- ]);
141048
- Lt && (this.mergeSideArea = Lt[0], this.mergeSideArea.object3d.name = "板块合并侧面"), this.areaArr = at, ct.forEach((Wt) => {
141049
- Wt.position.z = this.options.depth + this.options.lineOffset;
141050
- }), this.lineArr = ct, Gt && (Gt.forEach((Wt) => {
141051
- Wt.position.z = this.options.depth + this.options.lineOffset, this.lead.updateBaseObjectKey(
141052
- Wt,
141053
- "$t:#" + this.getPropertiesKey({
141054
- name: "extrudeLine"
141055
- })
141056
- );
141057
- }), this.extrudelineArr = Gt), De && xt && this.setAreaMaterial("bg", [De, xt]), je && this.setLineMaterial("bg", je), ke && this.setExtrudeLineMaterial("bg", ke);
141058
- });
141059
- }
141060
- addArea(r, m) {
141061
- return B0(this, null, function* () {
141062
- const { bbox: v, material: C, onTop: _ } = m, w = this.geojson2Meta(r), I = this.pencil.getPlugin("worker"), O = this.pencil.lead;
141063
- if (this.pencil.mList, m.areaGroup)
141064
- return yield Promise.all(
141065
- w.map((Pe) => B0(this, null, function* () {
141066
- const { coords: Ne, properties: Fe } = Pe, Ae = this.findGroup(this.getPropertiesKey(Fe)), De = yield I.geoGeometry(
141067
- "extrudePolygon",
141068
- {
141069
- mesaage: {
141070
- coordinatesArr: Ne,
141071
- projection: this.options.projection,
141072
- topSegments: this.options.topSegments,
141073
- bbox: v,
141074
- depth: [this.options.depth],
141075
- hasBottom: !1,
141076
- hasSide: m.hasSide,
141077
- hasTop: m.hasTop,
141078
- useGroups: m.hasSide && m.hasTop ? 2 : 0,
141079
- splitPolygons: this.splitPolygons
141080
- }
141081
- }
141082
- ), xt = `${this.getPropertiesKey(Fe)}`, je = yield O.draw(
141083
- "ExtrudePolygon",
141084
- {
141085
- key: xt,
141086
- geometry: De,
141087
- material: C,
141088
- onTop: _
141089
- },
141090
- Ae
141091
- );
141092
- return je.object3d.name = "板块", m != null && m.castShadow && (je.object3d.castShadow = !0), je.userData = q0({}, Fe), je;
141093
- }))
141094
- );
141095
- {
141096
- const Pe = yield I.geoGeometry("extrudePolygon", {
141097
- mesaage: {
141098
- coordinatesArr: w.map(({ coords: Fe }) => Fe).flat(),
141099
- projection: q0({}, this.options.projection),
141100
- topSegments: this.options.topSegments,
141101
- bbox: v,
141102
- depth: [this.options.depth],
141103
- hasSide: m.hasSide,
141104
- hasTop: m.hasTop,
141105
- hasBottom: !1,
141106
- useGroups: 2,
141107
- splitPolygons: this.splitPolygons
141108
- }
141109
- }), Ne = yield O.draw(
141110
- "ExtrudePolygon",
141111
- {
141112
- key: this.getPropertiesKey({
141113
- name: "all"
141114
- }),
141115
- geometry: Pe,
141116
- material: C
141117
- },
141118
- this
141119
- );
141120
- return m != null && m.castShadow && (Ne.object3d.castShadow = !0), Ne.object3d.name = "板块", Ne.userData = {}, [Ne];
141121
- }
141122
- });
141123
- }
141124
- addLine(r, m) {
141125
- return B0(this, null, function* () {
141126
- const { material: v, onTop: C } = m, _ = this.geojson2Meta(r), w = this.pencil.getPlugin("worker"), I = this.pencil.lead;
141127
- if (m.areaGroup)
141128
- return yield Promise.all(
141129
- _.map((O) => B0(this, null, function* () {
141130
- const { coords: Pe, properties: Ne } = O, Fe = this.findGroup(this.getPropertiesKey(Ne)), Ae = yield w.geoGeometry("line", {
141131
- mesaage: {
141132
- coordinatesArr: Pe,
141133
- lineWidth: [1],
141134
- projection: this.options.projection,
141135
- splitPolygons: this.splitPolygons
141136
- }
141137
- }), De = `${this.getPropertiesKey(Ne)}`, xt = yield I.draw(
141138
- "Line",
141139
- {
141140
- key: De,
141141
- geometry: Ae,
141142
- material: v,
141143
- onTop: C
141144
- },
141145
- Fe
141146
- );
141147
- return xt.userData = q0({}, Ne), xt.object3d.name = "线", xt;
141148
- }))
141149
- );
141150
- {
141151
- const O = yield w.geoGeometry("line", {
141152
- mesaage: {
141153
- coordinatesArr: _.map(({ coords: Ne }) => Ne).flat(),
141154
- lineWidth: [1],
141155
- projection: this.options.projection,
141156
- splitPolygons: this.splitPolygons
141157
- }
141158
- }), Pe = yield I.draw(
141159
- "Line",
141160
- {
141161
- key: this.getPropertiesKey({
141162
- name: "all"
141163
- }),
141164
- geometry: O,
141165
- material: v,
141166
- onTop: C
141167
- },
141168
- this
141169
- );
141170
- return Pe.object3d.name = "线", [Pe];
141171
- }
141172
- });
141173
- }
141174
- getPropertiesKey(r) {
141175
- return `${this.key.split("#")[1]}-${r.adcode || r.iso_a2 || r.name}`;
141176
- }
141177
- geojson2Meta(r) {
141178
- return r.features.filter((m) => m.geometry).map((m) => {
141179
- const { type: v, coordinates: C } = m.geometry;
141180
- let _ = [];
141181
- return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
141182
- coords: _,
141183
- properties: m.properties
141184
- };
141185
- });
141186
- }
141187
- update(r, m) {
141188
- const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions;
141189
- this.isActive && [v, C].forEach((_) => {
141190
- !_ || !_.uniforms.lineLightAnimation.value || (_.uniforms.time.value = m);
141191
- });
141192
- }
141193
- findGroup(r, m = !1) {
141194
- return this.pencil.lead.getObject("Group", {
141195
- key: `${m ? this.getPropertiesKey({
141196
- adcode: r
141197
- }) : r}`
141198
- });
141199
- }
141200
- setAreaMaterial(r, m) {
141201
- this.areaArr.forEach((v) => {
141202
- v.setMaterialList(
141203
- r,
141204
- this.mergeSideArea && Array.isArray(m) ? [m[0], hideMaterial] : m
141205
- );
141206
- }), this.mergeSideArea && Array.isArray(m) && this.mergeSideArea.setMaterialList(r, m[1]);
141207
- }
141208
- useAreaMaterial(r) {
141209
- this.areaArr.forEach((m) => {
141210
- m.useMaterial(r);
141211
- }), this.mergeSideArea && this.mergeSideArea.useMaterial(r);
141212
- }
141213
- setLineMaterial(r, m) {
141214
- this.lineArr.forEach((v) => {
141215
- v.setMaterialList(r, m);
141216
- });
141217
- }
141218
- useLineMaterial(r) {
141219
- this.lineArr.forEach((m) => {
141220
- m.useMaterial(r);
141221
- });
141222
- }
141223
- setExtrudeLineMaterial(r, m) {
141224
- var v;
141225
- (v = this.extrudelineArr) == null || v.forEach((C) => {
141226
- C.setMaterialList(r, m);
141227
- });
141228
- }
141229
- useExtrudeLineMaterial(r) {
141230
- var m;
141231
- (m = this.extrudelineArr) == null || m.forEach((v) => {
141232
- v.useMaterial(r);
141233
- });
141234
- }
141235
- changeLineAnimateParams({
141236
- speed: r = 0.5,
141237
- extrude: m = !1
141238
- }) {
141239
- const { lineMat: v, extrudeLineMat: C } = this.options.materialOptions, _ = m ? C : v;
141240
- if (!_) return;
141241
- _.uniforms.time.value = 0, _.uniforms.speed.value = r, _.uniforms.lineLightAnimation.value = 1;
141242
- const { size: w, min: I, max: O } = this.getSize();
141243
- _.uniforms.size.value = Math.max(w.x, w.y) / 2, _.uniforms.uCenter.value = new Vector2(
141244
- (I.x + O.x) / 2,
141245
- (I.y + O.y) / 2
141246
- );
141247
- }
141248
- deactive() {
141249
- this.isActive && (this.options, this.isActive = !1, this.options.bloom && this.toggleExtrudelineBloom(!1), this.useAreaMaterial("bg"), this.useLineMaterial("bg"), this.useExtrudeLineMaterial("bg"));
141250
- }
141251
- render() {
141252
- this.options.bloom && this.toggleExtrudelineBloom(!0);
141253
- }
141254
- toggleExtrudelineBloom(r) {
141255
- var m;
141256
- (m = this.extrudelineArr) == null || m.forEach((v) => {
141257
- r ? v.enableBloom() : v.disableBloom();
141258
- });
141259
- }
141260
- active() {
141261
- this.isActive || (this.isActive = !0, this.useAreaMaterial("origin"), this.useLineMaterial("origin"), this.useExtrudeLineMaterial("origin"), this.options.bloom && this.toggleExtrudelineBloom(!0));
141262
- }
141263
- dispose() {
141264
- super.dispose(), this.areaArr.length = 0, this.lineArr && (this.lineArr.length = 0), this.extrudelineArr && (this.extrudelineArr.length = 0);
141265
- }
141266
- // test(material: THREE.Material) {
141267
- // material.onBeforeCompile = (shader) => {
141268
- // shader.vertexShader = `
141269
- // varying float vHeightPercent;
141270
- // ${shader.vertexShader}
141271
- // `.replace(
141272
- // `#include <fog_vertex>`,
141273
- // `
141274
- // #include <fog_vertex>
141275
- // vec4 zzz =vec4( transformed, 1.0 );
141276
- // //min
141277
- // float min = 1.0;
141278
- // float max = 2.0;
141279
- // float heightPercent = (zzz.z - min) / (max - min);
141280
- // vHeightPercent = heightPercent;
141281
- // `
141282
- // );
141283
- // shader.fragmentShader = `
141284
- // varying float vHeightPercent;
141285
- // ${shader.fragmentShader}
141286
- // `.replace(
141287
- // `#include <dithering_fragment>`,
141288
- // `
141289
- // #include <dithering_fragment>
141290
- // vec3 valleyColor = vec3(0.0, 0.0, 1.0);
141291
- // vec3 peakColor = vec3(1.0, 0.0, 0.0);
141292
- // vec3 interpolatedColor = mix(valleyColor, peakColor, vHeightPercent);
141293
- // gl_FragColor.rgb = interpolatedColor;
141294
- // `
141295
- // );
141296
- // };
141297
- // }
141298
- };
141299
- class ContinentsBg extends ht {
141300
- constructor(r) {
141301
- super();
141302
- C0(this, "options");
141303
- C0(this, "mapArr", []);
141304
- this.options = r;
141305
- }
141306
- create() {
141307
- return B0(this, null, function* () {
141308
- const { depth: r } = this.options, m = this.pencil.mList, v = this.pencil.lead, C = m.getMultiple("continents");
141309
- this.createGroup(), this.object3d.name = "大洲", yield Promise.all(
141310
- Object.values(continentsLiteJson).map((_) => B0(this, null, function* () {
141311
- const w = _.features[0], I = w.properties.adcode;
141312
- if (I === 10) return;
141313
- const O = centroid(w).geometry.coordinates;
141314
- let Pe = 0, Ne = 0, Fe = this.options.scale;
141315
- const Ae = 30, De = 25;
141316
- 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);
141317
- const xt = yield v.draw(
141318
- "PlaneMap",
141319
- {
141320
- key: `${this.key}-${I}`,
141321
- geojson: _,
141322
- projection: {
141323
- center: O,
141324
- scale: Fe,
141325
- rotate: [0, 0],
141326
- projectionType: "equirectangular"
141327
- },
141328
- areaGroup: !1,
141329
- // bbox: bboxworld,
141330
- depth: r,
141331
- materialOptions: q0({}, C)
141332
- },
141333
- this
141334
- );
141335
- xt.userData.projection = f({
141336
- center: O,
141337
- scale: Fe,
141338
- rotate: [0, 0],
141339
- projectionType: "equirectangular"
141340
- }), xt.object3d.name = w.properties.name, xt.userData.name = w.properties.name, xt.position.set(Pe, Ne, 0), this.mapArr.push(xt);
141341
- }))
141342
- );
141343
- });
141344
- }
141345
- getPointInContinentInfo(r) {
141346
- var m;
141347
- 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];
141348
- }
141349
- getPointInContinent(r) {
141350
- return !!this.getPointInContinentInfo(r);
141351
- }
141352
- getLocationPosition(r, m) {
141353
- var C;
141354
- const v = m || ((C = this.getPointInContinentInfo(r)) == null ? void 0 : C.properties.name);
141355
- if (v) {
141356
- const _ = this.mapArr.find((w) => w.userData.name === v);
141357
- if (_) {
141358
- const { projection: w } = _.userData, [I, O] = r, [Pe, Ne] = w([I, O]), Fe = new Vector3(Pe, -Ne, this.options.depth);
141359
- return Fe.applyMatrix4(_.object3d.matrixWorld), [Fe.x, Fe.y, Fe.z];
141360
- }
141361
- }
141362
- }
141363
- render() {
141364
- this.lead.updateBaseObjectKey(this, "continents-group"), this.mapArr.forEach((r) => {
141365
- this.lead.updateBaseObjectKey(r, "continents-" + r.userData.name);
141366
- });
141367
- }
141368
- dispose() {
141369
- this.mapArr.forEach((r) => {
141370
- r.dispose();
141371
- }), this.mapArr.length = 0;
141372
- }
141373
- }
141374
- class PlaneMap extends ht {
141375
- constructor(r) {
141376
- super();
141377
- C0(this, "options");
141378
- C0(this, "extrudePolygon");
141379
- this.options = q0({
141380
- depth: 2
141381
- }, r);
141382
- }
141383
- geojson2Meta(r) {
141384
- return r.features.filter((m) => m.geometry).map((m) => {
141385
- const { type: v, coordinates: C } = m.geometry;
141386
- let _ = [];
141387
- return v === "Polygon" ? _ = C : v === "MultiPolygon" && (_ = C.flat()), {
141388
- coords: _,
141389
- properties: m.properties
141390
- };
141391
- });
141392
- }
141393
- create() {
141394
- return B0(this, null, function* () {
141395
- 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", {
141396
- mesaage: {
141397
- coordinatesArr: v.map(({ coords: at }) => at).flat(),
141398
- projection: q0({}, this.options.projection),
141399
- topSegments: 100,
141400
- bbox: m,
141401
- depth: [this.options.depth],
141402
- hasBottom: !1,
141403
- hasSide: !1
141404
- }
141405
- }), Pe = O.attributes.position.count;
141406
- O.setAttribute(
141407
- "color",
141408
- new BufferAttribute(new Float32Array(Pe * 3), 3)
141409
- );
141410
- const Ne = this.options.depth;
141411
- this.setNoise(O, I.image, Ne);
141412
- const Fe = new Color$1(), Ae = O.attributes.color, De = O.attributes.position, xt = new Color$1("red"), je = new Color$1("green");
141413
- for (let at = 0; at < Pe; at++) {
141414
- const ct = De.getZ(at) / Ne;
141415
- Fe.lerpColors(xt, je, ct), Ae.setXYZ(at, Fe.r, Fe.g, Fe.b);
141416
- }
141417
- const ke = yield _.draw(
141418
- "ExtrudePolygon",
141419
- {
141420
- geometry: O,
141421
- material: new MeshStandardMaterial({
141422
- flatShading: !0,
141423
- vertexColors: !0
141424
- })
141425
- },
141426
- null
141427
- );
141428
- ke.position.z += 1e-3, this.extrudePolygon = ke, this.object3d = ke.object3d;
141429
- });
141430
- }
141431
- setNoise(r, m, v = 1) {
141432
- const C = document.createElement("canvas"), _ = [];
141433
- C.width = m.width, C.height = m.height;
141434
- const w = C.getContext("2d");
141435
- w.drawImage(m, 0, 0);
141436
- const O = w.getImageData(0, 0, m.width, m.height).data;
141437
- for (let Ae = 0; Ae < m.height; Ae++) {
141438
- _[Ae] = [];
141439
- for (let De = 0; De < m.width; De++) {
141440
- const xt = (Ae * m.width + De) * 4, je = O[xt];
141441
- _[Ae][De] = je / 255;
141442
- }
141443
- }
141444
- const Pe = r.attributes.position, Ne = r.attributes.uv, Fe = new Vector2();
141445
- for (let Ae = 0; Ae < Pe.count; Ae++) {
141446
- Fe.fromBufferAttribute(Ne, Ae);
141447
- let De = Math.round(Fe.x * m.width) - 1, xt = Math.round(Fe.y * m.height) - 1;
141448
- De < 0 && (De = 0), xt < 0 && (xt = 0);
141449
- const je = _[xt][De];
141450
- Pe.setZ(Ae, je * v);
141451
- }
141452
- }
141453
- render() {
141454
- this.mList.rmBaseObjectMap(this.extrudePolygon);
141455
- }
141456
- dispose() {
141457
- this.extrudePolygon.dispose(), super.dispose();
141458
- }
141459
- }
141460
- const objs$1 = Ji(q0({}, objs$3), {
141461
- PlaneMap: PlaneMap$1,
141462
- CityPlane,
141463
- ContinentsBg,
141464
- Mountain: PlaneMap
141465
- }), 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) => {
141466
141484
  g.loaderAdd = function() {
141467
141485
  const t = this.loader;
141468
141486
  t.add(["/image/map/jianbian.webp"]), t.add(["/image/map/hp2.webp", "/image/map/fx2.webp"]);
@@ -141812,27 +141830,10 @@ const objs$1 = Ji(q0({}, objs$3), {
141812
141830
  this.mList.addMultiple("plane", t), this.options.drillDownFirstLevelUseBgMats && this.mList.copyMultiple("plane", "bgPlane"), this.initMaterialBg();
141813
141831
  });
141814
141832
  };
141815
- }, getLabelElement = (g) => {
141816
- const t = document.createElement("div");
141817
- return g.replace(
141818
- /省|市|特别行政区|自治区|维吾尔自治区|回族自治区|壮族自治区/,
141819
- ""
141820
- ), t.classList.add(
141821
- "vis-map-label",
141822
- "absolute",
141823
- "top-1/2",
141824
- "left-1/2",
141825
- "-translate-x-1/2",
141826
- "-translate-y-1/2"
141827
- ), t.innerHTML = `
141828
- <div class="text-white text-opacity-80 text-center leading-[1] text-sm whitespace-nowrap">
141829
- ${g}
141830
- </div>
141831
- `, t;
141832
141833
  }, xn = class xn extends Base {
141833
141834
  constructor() {
141834
141835
  super(...arguments);
141835
- C0(this, "leadObjs", objs$1);
141836
+ C0(this, "leadObjs", objs$2);
141836
141837
  C0(this, "mapHistory", []);
141837
141838
  C0(this, "activePlaneMap", null);
141838
141839
  C0(this, "isAnimating", !1);
@@ -142754,7 +142755,10 @@ const objs$1 = Ji(q0({}, objs$3), {
142754
142755
  return _;
142755
142756
  }
142756
142757
  setAdcode(v) {
142757
- return B0(this, arguments, function* ({ adcodes: r, duration: m }) {
142758
+ return B0(this, arguments, function* ({
142759
+ adcodes: r,
142760
+ duration: m
142761
+ }) {
142758
142762
  var _, w, I;
142759
142763
  const { adcodes: C } = this;
142760
142764
  if (!(JSON.stringify(r) === JSON.stringify(C) || this.isAnimating))
@@ -142825,6 +142829,9 @@ const objs$1 = Ji(q0({}, objs$3), {
142825
142829
  enableTransition: v
142826
142830
  });
142827
142831
  }
142832
+ findAdcodeInfo(r) {
142833
+ return findAdcodeInfo(r);
142834
+ }
142828
142835
  dispose() {
142829
142836
  var r, m, v;
142830
142837
  (r = this.cityVis) == null || r.dispose(), (m = this.map) == null || m.dispose(), this.parentBg.forEach((C) => {