gy-cesium 0.0.1 → 0.0.2

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.
@@ -223911,7 +223911,7 @@ class TilesetLoader extends CesiumLoader {
223911
223911
  this.load3DTile();
223912
223912
  }
223913
223913
  getModelName() {
223914
- return this.id || this.url.slice(this.url.lastIndexOf("/"));
223914
+ return this.id || this.url.slice(this.url.lastIndexOf("/") + 1);
223915
223915
  }
223916
223916
  getControlValue() {
223917
223917
  return {
@@ -224228,7 +224228,7 @@ class GltfLoader extends CesiumLoader {
224228
224228
  this.lat = lat;
224229
224229
  }
224230
224230
  getModelName() {
224231
- return this.id || this.url.slice(this.url.lastIndexOf("/"));
224231
+ return this.id || this.url.slice(this.url.lastIndexOf("/") + 1);
224232
224232
  }
224233
224233
  getControlValue() {
224234
224234
  return {
@@ -224517,6 +224517,626 @@ class GyEdgeDetectionStage {
224517
224517
  );
224518
224518
  }
224519
224519
  }
224520
+ class CT {
224521
+ constructor() {
224522
+ __publicField(this, "PI");
224523
+ __publicField(this, "a");
224524
+ __publicField(this, "b");
224525
+ __publicField(this, "f");
224526
+ __publicField(this, "e_sq");
224527
+ __publicField(this, "ee");
224528
+ __publicField(this, "WGSF");
224529
+ __publicField(this, "WGSe2");
224530
+ __publicField(this, "WGSa");
224531
+ __publicField(this, "EPSILON");
224532
+ __publicField(this, "M_PI");
224533
+ this["PI"] = 3.141592653589793;
224534
+ this["a"] = 6378137;
224535
+ this["b"] = 63567523142e-4;
224536
+ this["f"] = (this["a"] - this["b"]) / this["a"];
224537
+ this["e_sq"] = this["f"] * (2 - this["f"]);
224538
+ this["ee"] = 0.00669437999013;
224539
+ this["WGSF"] = 1 / 298.257223563;
224540
+ this["WGSe2"] = this["WGSF"] * (2 - this["WGSF"]);
224541
+ this["WGSa"] = 6378137;
224542
+ this["EPSILON"] = 1e-12;
224543
+ }
224544
+ CalculateCoordinates(_0x311499, _0x3be8f2, _0x128914, _0x193d11) {
224545
+ _0x193d11 = _0x193d11 * Math["cos"](2 * this["PI"] / 360 * _0x128914);
224546
+ 360 < _0x3be8f2 && (_0x3be8f2 %= 360);
224547
+ _0x3be8f2 < 0 && (_0x3be8f2 = 360 + _0x3be8f2 % 360);
224548
+ let _0x47393b, _0x1a04d8;
224549
+ _0x311499 = null;
224550
+ _0x128914 = this["lonLat2WebMercator"](_0x311499);
224551
+ if (_0x3be8f2 <= 90) {
224552
+ _0x47393b = _0x193d11 * Math["cos"](2 * this["PI"] / 360 * _0x3be8f2);
224553
+ _0x1a04d8 = _0x193d11 * Math["sin"](2 * this["PI"] / 360 * _0x3be8f2);
224554
+ _0x311499 = {
224555
+ "x": _0x128914["x"] + _0x47393b,
224556
+ "y": _0x128914["y"] - _0x1a04d8
224557
+ };
224558
+ } else if (90 < _0x3be8f2 && _0x3be8f2 <= 180) {
224559
+ _0x47393b = _0x193d11 * Math["sin"](2 * this["PI"] / 360 * (_0x3be8f2 - 90));
224560
+ _0x1a04d8 = _0x193d11 * Math["cos"](2 * this["PI"] / 360 * (_0x3be8f2 - 90));
224561
+ _0x311499 = {
224562
+ "x": _0x128914["x"] - _0x47393b,
224563
+ "y": _0x128914["y"] - _0x1a04d8
224564
+ };
224565
+ } else if (180 < _0x3be8f2 && _0x3be8f2 <= 270) {
224566
+ _0x47393b = _0x193d11 * Math["cos"](2 * this["PI"] / 360 * (_0x3be8f2 - 180));
224567
+ _0x1a04d8 = _0x193d11 * Math["sin"](2 * this["PI"] / 360 * (_0x3be8f2 - 180));
224568
+ _0x311499 = {
224569
+ "x": _0x128914["x"] - _0x47393b,
224570
+ "y": _0x128914["y"] + _0x1a04d8
224571
+ };
224572
+ } else {
224573
+ _0x47393b = _0x193d11 * Math["sin"](2 * this["PI"] / 360 * (_0x3be8f2 - 270));
224574
+ _0x1a04d8 = _0x193d11 * Math["cos"](2 * this["PI"] / 360 * (_0x3be8f2 - 270));
224575
+ _0x311499 = {
224576
+ "x": _0x128914["x"] + _0x47393b,
224577
+ "y": _0x128914["y"] + _0x1a04d8
224578
+ };
224579
+ }
224580
+ let height = _0x193d11 * Math["sin"](2 * this["PI"] / 360 * _0x128914);
224581
+ return {
224582
+ "lng": (_0x311499 = this["webMercator2LonLat"](_0x311499))["x"],
224583
+ "lat": _0x311499["y"],
224584
+ "height": height
224585
+ };
224586
+ }
224587
+ lonLat2WebMercator(_0x537c44) {
224588
+ return {
224589
+ "x": _0x537c44["x"] * this["a"] / 180,
224590
+ "y": Math["log"](Math["tan"]((90 + _0x537c44["y"]) * this["PI"] / 360)) / (this["PI"] / 180) * this["a"] / 180
224591
+ };
224592
+ }
224593
+ webMercator2LonLat(_0x4345f7) {
224594
+ let _0x1f54d8 = _0x4345f7["x"] / this["a"] * 180;
224595
+ _0x4345f7 = _0x4345f7["y"] / this["a"] * 180;
224596
+ return {
224597
+ "x": _0x1f54d8,
224598
+ "y": 180 / this["PI"] * (2 * Math["exp"](_0x4345f7 * this["PI"] / 180) - this["PI"] / 2)
224599
+ };
224600
+ }
224601
+ get_atan(_0x13e419, _0x59bb8f) {
224602
+ let _0x534065 = 0;
224603
+ return 0 == _0x13e419 ? _0x534065 = this["PI"] / 2 : 0 == _0x59bb8f ? _0x534065 = this["PI"] : (_0x534065 = Math["atan"](Math["abs"](_0x59bb8f / _0x13e419)), 0 < _0x59bb8f && _0x13e419 < 0 ? _0x534065 = this["PI"] - _0x534065 : _0x59bb8f < 0 && _0x13e419 < 0 ? _0x534065 = this["PI"] + _0x534065 : _0x59bb8f < 0 && 0 < _0x13e419 && (_0x534065 = 2 * this["M_PI"] - _0x534065)), _0x534065;
224604
+ }
224605
+ ConvertLLAToXYZ(_0x5c23c9) {
224606
+ let _0x321bda = this["PI"] / 180 * _0x5c23c9["longitude"], _0x686efd = this["PI"] / 180 * _0x5c23c9["latitude"], _0x5449c8 = _0x5c23c9["altitude"];
224607
+ _0x5c23c9 = this["a"] / Math["sqrt"](1 - this["ee"] * Math["sin"](_0x686efd) * Math["sin"](_0x686efd));
224608
+ return {
224609
+ "x": (_0x5c23c9 + _0x5449c8) * Math["cos"](_0x686efd) * Math["cos"](_0x321bda),
224610
+ "y": (_0x5c23c9 + _0x5449c8) * Math["cos"](_0x686efd) * Math["sin"](_0x321bda),
224611
+ "z": (_0x5c23c9 * (1 - this["ee"]) + _0x5449c8) * Math["sin"](_0x686efd)
224612
+ };
224613
+ }
224614
+ ConvertXYZToLLA(_0x36204b) {
224615
+ let _0x4c78cb = this["get_atan"](_0x36204b["x"], _0x36204b["y"]);
224616
+ _0x4c78cb < 0 && (_0x4c78cb += this["PI"]);
224617
+ let _0x158999;
224618
+ let _0x5882a3 = this["get_atan"](Math["sqrt"](_0x36204b["x"] * _0x36204b["x"] + _0x36204b["y"] * _0x36204b["y"]), _0x36204b["z"]);
224619
+ let _0x5a0dcc = Math["sqrt"](1 - this["WGSe2"] * Math["sin"](_0x5882a3) * Math["sin"](_0x5882a3));
224620
+ let _0x10d911 = (this["WGSa"], 0);
224621
+ for (; _0x158999 = _0x5882a3, _0x5a0dcc = Math["sqrt"](1 - this["WGSe2"] * Math["sin"](_0x158999) * Math["sin"](_0x158999)), _0x10d911 = this["WGSa"] / _0x5a0dcc, _0x5882a3 = this["get_atan"](Math["sqrt"](_0x36204b["x"] * _0x36204b["x"] + _0x36204b["y"] * _0x36204b["y"]), _0x36204b["z"] + _0x10d911 * this["WGSe2"] * Math["sin"](_0x158999)), Math["abs"](_0x5882a3 - _0x158999) > this["EPSILON"]; )
224622
+ ;
224623
+ let _0x319191 = Math["sqrt"](_0x36204b["x"] * _0x36204b["x"] + _0x36204b["y"] * _0x36204b["y"]) / Math["cos"](_0x5882a3) - this["WGSa"] / Math["sqrt"](1 - this["WGSe2"] * Math["sin"](_0x5882a3) * Math["sin"](_0x5882a3));
224624
+ return {
224625
+ "longitude": 180 * _0x4c78cb / this["PI"],
224626
+ "latitude": 180 * _0x5882a3 / this["PI"],
224627
+ "altitude": _0x319191
224628
+ };
224629
+ }
224630
+ enu_to_ecef(_0x12eecc, _0x2cfc45) {
224631
+ let _0x36f99b = _0x2cfc45["distance"];
224632
+ let _0x1e1948 = _0x2cfc45["azimuth"];
224633
+ let _0x4ad99b = _0x2cfc45["elevation"];
224634
+ let _0x470df7 = 0 <= _0x4ad99b ? _0x36f99b * Math["sin"](this["PI"] / 180 * _0x4ad99b) : -1 * _0x36f99b * Math["sin"](this["PI"] / 180 * Math["abs"](_0x4ad99b));
224635
+ let _0x4fa13f = _0x36f99b * Math["cos"](this["PI"] / 180 * Math["abs"](_0x4ad99b));
224636
+ let _0x2bb9a2 = 0;
224637
+ let _0x58517b;
224638
+ _0x58517b = _0x1e1948 <= 90 ? (_0x2bb9a2 = _0x4fa13f * Math["sin"](this["PI"] / 180 * _0x1e1948), _0x4fa13f * Math["cos"](this["PI"] / 180 * _0x1e1948)) : 90 < _0x1e1948 && _0x1e1948 < 180 ? (_0x2bb9a2 = _0x4fa13f * Math["cos"](this["PI"] / 180 * (_0x1e1948 - 90)), -1 * _0x4fa13f * Math["sin"](this["PI"] / 180 * (_0x1e1948 - 90))) : 180 < _0x1e1948 && _0x1e1948 < 270 ? (_0x2bb9a2 = -1 * _0x4fa13f * Math["sin"](this["PI"] / 180 * (_0x1e1948 - 180)), -1 * _0x4fa13f * Math["cos"](this["PI"] / 180 * (_0x1e1948 - 180))) : (_0x2bb9a2 = -1 * _0x4fa13f * Math["sin"](this["PI"] / 180 * (360 - _0x1e1948)), _0x4fa13f * Math["cos"](this["PI"] / 180 * (360 - _0x1e1948)));
224639
+ let _0x27179b = this["radians"](_0x12eecc["latitude"]);
224640
+ let _0x36f306 = this["radians"](_0x12eecc["longitude"]);
224641
+ _0x2cfc45 = _0x12eecc["altitude"];
224642
+ _0x36f99b = Math["sin"](_0x27179b);
224643
+ _0x4ad99b = this["a"] / Math["sqrt"](1 - this["e_sq"] * _0x36f99b * _0x36f99b);
224644
+ _0x4fa13f = Math["sin"](_0x27179b);
224645
+ _0x1e1948 = Math["cos"](_0x27179b);
224646
+ _0x12eecc = Math["sin"](_0x36f306);
224647
+ _0x36f99b = Math["cos"](_0x36f306);
224648
+ _0x27179b = (_0x2cfc45 + _0x4ad99b) * _0x1e1948 * _0x36f99b;
224649
+ _0x36f306 = (_0x2cfc45 + _0x4ad99b) * _0x1e1948 * _0x12eecc;
224650
+ _0x2cfc45 = (_0x2cfc45 + (1 - this["e_sq"]) * _0x4ad99b) * _0x4fa13f;
224651
+ _0x4ad99b = _0x1e1948 * _0x470df7 - _0x4fa13f * _0x58517b;
224652
+ _0x1e1948 = _0x4fa13f * _0x470df7 + _0x1e1948 * _0x58517b;
224653
+ _0x58517b = _0x36f99b * _0x4ad99b - _0x12eecc * _0x2bb9a2;
224654
+ _0x2bb9a2 = _0x12eecc * _0x4ad99b + _0x36f99b * _0x2bb9a2;
224655
+ return this["ConvertXYZToLLA"]({
224656
+ "x": _0x58517b + _0x27179b,
224657
+ "y": _0x2bb9a2 + _0x36f306,
224658
+ "z": _0x1e1948 + _0x2cfc45
224659
+ });
224660
+ }
224661
+ radians(_0x3a79ee) {
224662
+ return this["PI"] / 180 * _0x3a79ee;
224663
+ }
224664
+ }
224665
+ class VideoShed3d {
224666
+ constructor(viewer, cesiumObj, oldOpt) {
224667
+ __publicField(this, "viewer");
224668
+ __publicField(this, "CT");
224669
+ __publicField(this, "options");
224670
+ __publicField(this, "near");
224671
+ __publicField(this, "cameraPosition");
224672
+ __publicField(this, "position");
224673
+ __publicField(this, "alpha");
224674
+ __publicField(this, "video");
224675
+ __publicField(this, "debugFrustum");
224676
+ __publicField(this, "aspectRatio");
224677
+ __publicField(this, "fov");
224678
+ __publicField(this, "activeVideoListener");
224679
+ __publicField(this, "videoTexture");
224680
+ __publicField(this, "orientation");
224681
+ __publicField(this, "viewShadowMap");
224682
+ __publicField(this, "cameraFrustum");
224683
+ __publicField(this, "postProcess");
224684
+ __publicField(this, "_camerafov");
224685
+ __publicField(this, "_cameraPosition");
224686
+ __publicField(this, "_debugFrustum");
224687
+ __publicField(this, "_position");
224688
+ __publicField(this, "_aspectRatio");
224689
+ __publicField(this, "url");
224690
+ __publicField(this, "id");
224691
+ __publicField(this, "oldOpt");
224692
+ __publicField(this, "cesiumObj");
224693
+ var _a;
224694
+ this["viewer"] = viewer;
224695
+ this.activeVideoListener = null;
224696
+ this.id = oldOpt.id || null;
224697
+ this["CT"] = new CT();
224698
+ this.cesiumObj = cesiumObj;
224699
+ this.setOptions(oldOpt);
224700
+ let _0xd1600e = this.initCameraParam();
224701
+ this["near"] = _0xd1600e["near"] || 0.1;
224702
+ this["cameraPosition"] = _0xd1600e["cameraPosition"];
224703
+ this["position"] = _0xd1600e["position"];
224704
+ this["alpha"] = _0xd1600e["alpha"] || 1;
224705
+ this["video"] = this.options["video"];
224706
+ this.url = ((_a = this.options.video) == null ? void 0 : _a.src) || "";
224707
+ this["debugFrustum"] = defaultValue(_0xd1600e["debugFrustum"], true);
224708
+ this["aspectRatio"] = this.options["aspectRatio"] || 1;
224709
+ this["fov"] = _0xd1600e["fov"] || 400;
224710
+ if (this["cameraPosition"] && this["position"]) {
224711
+ this["activeVideo"]();
224712
+ this["getOrientation"]();
224713
+ this["createShadowMap"]();
224714
+ this["addCameraFrustum"]();
224715
+ this["addPostProcess"]();
224716
+ this["viewer"]["scene"]["primitives"]["add"](this);
224717
+ } else {
224718
+ console.error("_scanPlaneBackCommand");
224719
+ }
224720
+ }
224721
+ setOptions(oldOpt) {
224722
+ this.oldOpt = oldOpt;
224723
+ let lonlat;
224724
+ if (this.cesiumObj.hideEarth) {
224725
+ let x = (oldOpt.x || 0) / 1e5;
224726
+ let y = (oldOpt.y || 0) / 1e5;
224727
+ lonlat = this.cesiumObj.lonlatToWGS84(this.cesiumObj.HIDEMODELLONLAT[0] + x, this.cesiumObj.HIDEMODELLONLAT[1] + y);
224728
+ } else {
224729
+ lonlat = this.cesiumObj.lonlatToWGS84(oldOpt.lon, oldOpt.lat);
224730
+ }
224731
+ let options = {
224732
+ id: oldOpt.id || null,
224733
+ video: oldOpt.video,
224734
+ position: {
224735
+ x: lonlat[0],
224736
+ y: lonlat[1],
224737
+ z: oldOpt.height || 300
224738
+ },
224739
+ rotation: {
224740
+ x: oldOpt.rotateX || 0,
224741
+ y: oldOpt.rotateY || 0
224742
+ },
224743
+ near: oldOpt.near || 0,
224744
+ far: oldOpt.far || 1e4,
224745
+ fov: oldOpt.fov || 60,
224746
+ aspectRatio: oldOpt.aspectRatio || 1,
224747
+ alpha: oldOpt.alpha || 1,
224748
+ debugFrustum: oldOpt.debugFrustum || false
224749
+ };
224750
+ this.options = options;
224751
+ }
224752
+ getModelName() {
224753
+ return this.id || this.url.slice(this.url.lastIndexOf("/") + 1);
224754
+ }
224755
+ getControlValue() {
224756
+ return {
224757
+ x: this.oldOpt.x || 0,
224758
+ y: this.oldOpt.y || 0,
224759
+ lon: this.oldOpt.lon,
224760
+ lat: this.oldOpt.lat,
224761
+ height: this.oldOpt.height,
224762
+ rotateX: this.oldOpt.rotateX,
224763
+ rotateY: this.oldOpt.rotateY,
224764
+ far: this.oldOpt.far,
224765
+ fov: this.oldOpt.fov,
224766
+ aspectRatio: this.oldOpt.aspectRatio,
224767
+ alpha: this.oldOpt.alpha,
224768
+ debugFrustum: this.oldOpt.debugFrustum
224769
+ };
224770
+ }
224771
+ flyTo() {
224772
+ let lonlat;
224773
+ if (this.cesiumObj.hideEarth) {
224774
+ let x = (this.oldOpt.x || 0) / 1e5;
224775
+ let y = (this.oldOpt.y || 0) / 1e5;
224776
+ lonlat = this.cesiumObj.lonlatToWGS84(this.cesiumObj.HIDEMODELLONLAT[0] + x, this.cesiumObj.HIDEMODELLONLAT[1] + y);
224777
+ } else {
224778
+ lonlat = this.cesiumObj.lonlatToWGS84(this.oldOpt.lon, this.oldOpt.lat);
224779
+ }
224780
+ this.cesiumObj.changeCamera(lonlat[0], lonlat[1], this.oldOpt.height + 300, {
224781
+ isFly: true,
224782
+ heading: 0
224783
+ });
224784
+ }
224785
+ getControlOptions() {
224786
+ let arr = [
224787
+ {
224788
+ name: "\u7ECF\u5EA6",
224789
+ value: "lon",
224790
+ type: "number",
224791
+ step: 1e-5
224792
+ },
224793
+ {
224794
+ name: "\u7EAC\u5EA6",
224795
+ value: "lat",
224796
+ type: "number",
224797
+ step: 1e-5
224798
+ }
224799
+ ];
224800
+ if (this.cesiumObj.hideEarth) {
224801
+ arr = [
224802
+ {
224803
+ name: "x\u504F\u79FB",
224804
+ value: "x",
224805
+ type: "number",
224806
+ step: 1
224807
+ },
224808
+ {
224809
+ name: "y\u504F\u79FB",
224810
+ value: "y",
224811
+ type: "number",
224812
+ step: 1
224813
+ }
224814
+ ];
224815
+ }
224816
+ let defaultArr = [
224817
+ {
224818
+ name: "\u9AD8\u5EA6",
224819
+ value: "height",
224820
+ type: "number"
224821
+ },
224822
+ {
224823
+ name: "rotateX",
224824
+ value: "rotateX",
224825
+ type: "slider",
224826
+ min: -180,
224827
+ max: 180
224828
+ },
224829
+ {
224830
+ name: "rotateY",
224831
+ value: "rotateY",
224832
+ type: "slider",
224833
+ min: -180,
224834
+ max: 180
224835
+ },
224836
+ {
224837
+ name: "\u8DDD\u79BB",
224838
+ value: "far",
224839
+ type: "number"
224840
+ },
224841
+ {
224842
+ name: "\u5F20\u89D2",
224843
+ value: "fov",
224844
+ type: "number"
224845
+ },
224846
+ {
224847
+ name: "\u957F\u5BBD\u6BD4",
224848
+ value: "aspectRatio",
224849
+ type: "number",
224850
+ min: 1e-6,
224851
+ step: 0.1
224852
+ },
224853
+ {
224854
+ name: "\u900F\u660E\u5EA6",
224855
+ value: "alpha",
224856
+ type: "slider",
224857
+ min: 0,
224858
+ max: 1,
224859
+ step: 0.01
224860
+ },
224861
+ {
224862
+ name: "\u662F\u5426\u663E\u793A\u8F85\u52A9\u7EBF",
224863
+ value: "debugFrustum",
224864
+ type: "switch"
224865
+ }
224866
+ ];
224867
+ arr = arr.concat(defaultArr);
224868
+ return arr;
224869
+ }
224870
+ initCameraParam() {
224871
+ let _0x2be8d1 = this["CT"]["enu_to_ecef"]({
224872
+ "longitude": +this["options"]["position"]["x"],
224873
+ "latitude": +this["options"]["position"]["y"],
224874
+ "altitude": +this["options"]["position"]["z"]
224875
+ }, {
224876
+ "distance": this["options"]["far"],
224877
+ "azimuth": +this["options"]["rotation"]["y"],
224878
+ "elevation": +this["options"]["rotation"]["x"]
224879
+ });
224880
+ _0x2be8d1 = Cartesian3["fromDegrees"](_0x2be8d1["longitude"], _0x2be8d1["latitude"], _0x2be8d1["altitude"]);
224881
+ Cartesian3["fromDegrees"](+this["options"]["position"]["x"], +this["options"]["position"]["y"], 0);
224882
+ return {
224883
+ "cameraPosition": Cartesian3["fromDegrees"](+this["options"]["position"]["x"], +this["options"]["position"]["y"], +this["options"]["position"]["z"]),
224884
+ "position": _0x2be8d1,
224885
+ "alpha": this["options"]["alpha"],
224886
+ "near": this["options"]["near"],
224887
+ "fov": this["options"]["fov"],
224888
+ "debugFrustum": this["options"]["debugFrustum"]
224889
+ };
224890
+ }
224891
+ activeVideo() {
224892
+ let _0x11c16c = this["video"], _0x6d8d73 = this;
224893
+ if (_0x11c16c) {
224894
+ if (!this["activeVideoListener"]) {
224895
+ this["activeVideoListener"] = function() {
224896
+ _0x6d8d73["videoTexture"] && _0x6d8d73["videoTexture"]["destroy"](), _0x6d8d73["videoTexture"] = new Texture({
224897
+ "context": _0x6d8d73["viewer"]["scene"]["context"],
224898
+ "source": _0x11c16c,
224899
+ "width": 1,
224900
+ "height": 1,
224901
+ "pixelFormat": PixelFormat$1["RGBA"],
224902
+ "pixelDatatype": PixelDatatype$1["UNSIGNED_BYTE"]
224903
+ });
224904
+ };
224905
+ }
224906
+ this["viewer"]["clock"]["onTick"]["addEventListener"](this["activeVideoListener"]);
224907
+ }
224908
+ }
224909
+ getOrientation() {
224910
+ let _0x2b2efa = Cartesian3["normalize"](Cartesian3["subtract"](this["position"], this["cameraPosition"], new Cartesian3()), new Cartesian3());
224911
+ let _0x596983 = Cartesian3["normalize"](this["cameraPosition"], new Cartesian3());
224912
+ let _0x49c7c1 = new Camera(this["viewer"]["scene"]);
224913
+ _0x49c7c1["position"] = this["cameraPosition"], _0x49c7c1["direction"] = _0x2b2efa, _0x49c7c1["up"] = _0x596983, _0x2b2efa = _0x49c7c1["directionWC"], _0x596983 = _0x49c7c1["upWC"];
224914
+ let _0x5d0daa = _0x49c7c1["rightWC"], _0x1f1c0c = new Cartesian3(), _0x4476f3 = new Matrix3(), _0x49c7c12 = new Quaternion(), _0x5d0daa2 = Cartesian3["negate"](_0x5d0daa, _0x1f1c0c);
224915
+ return Matrix3["setColumn"](_0x4476f3, 0, _0x5d0daa2, _0x4476f3), Matrix3["setColumn"](_0x4476f3, 1, _0x596983, _0x4476f3), Matrix3["setColumn"](_0x4476f3, 2, _0x2b2efa, _0x4476f3), _0x49c7c12 = Quaternion["fromRotationMatrix"](_0x4476f3, _0x49c7c12), this["orientation"] = _0x49c7c12;
224916
+ }
224917
+ createShadowMap() {
224918
+ let _0x4a7c7b = new Camera(this["viewer"]["scene"]);
224919
+ _0x4a7c7b["position"] = this["cameraPosition"];
224920
+ _0x4a7c7b["direction"] = Cartesian3["subtract"](this["position"], this["cameraPosition"], new Cartesian3(0, 0, 0));
224921
+ _0x4a7c7b["up"] = Cartesian3["normalize"](this["cameraPosition"], new Cartesian3(0, 0, 0));
224922
+ let _0x97c279 = Cartesian3["distance"](this["position"], this["cameraPosition"]);
224923
+ _0x4a7c7b["frustum"] = new PerspectiveFrustum({
224924
+ "fov": CesiumMath$1["toRadians"](this["fov"]),
224925
+ "aspectRatio": this["aspectRatio"],
224926
+ "near": this["near"],
224927
+ "far": _0x97c279
224928
+ });
224929
+ this["viewShadowMap"] = new ShadowMap({
224930
+ "lightCamera": _0x4a7c7b,
224931
+ "enable": false,
224932
+ "darkness": 1,
224933
+ "isPointLight": false,
224934
+ "isSpotLight": true,
224935
+ "cascadesEnabled": false,
224936
+ "context": this["viewer"]["scene"]["context"],
224937
+ "pointLightRadius": _0x97c279
224938
+ });
224939
+ }
224940
+ addCameraFrustum() {
224941
+ this["cameraFrustum"] = new Primitive$3({
224942
+ "geometryInstances": new GeometryInstance({
224943
+ "geometry": new FrustumOutlineGeometry({
224944
+ "origin": this["cameraPosition"],
224945
+ "orientation": this["orientation"],
224946
+ "frustum": this["viewShadowMap"]["_lightCamera"]["frustum"]
224947
+ }),
224948
+ "attributes": {
224949
+ "color": ColorGeometryInstanceAttribute["fromColor"](Color["YELLOW"]["withAlpha"](0.5))
224950
+ }
224951
+ }),
224952
+ "appearance": new PerInstanceColorAppearance({
224953
+ closed: false,
224954
+ flat: true,
224955
+ faceForward: true
224956
+ }),
224957
+ "asynchronous": false,
224958
+ cull: true,
224959
+ "show": this["debugFrustum"]
224960
+ });
224961
+ this["viewer"]["scene"]["primitives"]["add"](this["cameraFrustum"]);
224962
+ }
224963
+ addPostProcess() {
224964
+ let _0xf1ae24 = this;
224965
+ let _0x4d4140 = _0xf1ae24["viewShadowMap"]["_isPointLight"] ? _0xf1ae24["viewShadowMap"]["_pointBias"] : _0xf1ae24["viewShadowMap"]["_primitiveBias"];
224966
+ this["postProcess"] = new PostProcessStage({
224967
+ "fragmentShader": `
224968
+ uniform float mixNum;
224969
+ uniform sampler2D colorTexture;
224970
+ uniform sampler2D stcshadow;
224971
+ uniform sampler2D videoTexture;
224972
+ uniform sampler2D depthTexture;
224973
+ uniform mat4 _shadowMap_matrix;
224974
+ uniform vec4 shadowMap_lightPositionEC;
224975
+ uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness;
224976
+ uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth;
224977
+ in vec2 v_textureCoordinates;
224978
+ vec4 toEye(in vec2 uv, in float depth){
224979
+ vec2 xy = vec2((uv.x * 2.0 - 1.0),(uv.y * 2.0 - 1.0));
224980
+ vec4 posInCamera =czm_inverseProjection * vec4(xy, depth, 1.0);
224981
+ posInCamera =posInCamera / posInCamera.w;
224982
+ return posInCamera;
224983
+ }
224984
+ float getDepth(in vec4 depth){
224985
+ float z_window = czm_unpackDepth(depth);
224986
+ z_window = czm_reverseLogDepth(z_window);
224987
+ float n_range = czm_depthRange.near;
224988
+ float f_range = czm_depthRange.far;
224989
+ return (2.0 * z_window - n_range - f_range) / (f_range - n_range);
224990
+ }
224991
+ float _czm_sampleShadowMap(sampler2D shadowMap, vec2 uv){
224992
+ return texture(shadowMap, uv).r;
224993
+ }
224994
+ float _czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth){
224995
+ return step(depth, _czm_sampleShadowMap(shadowMap, uv));
224996
+ }
224997
+ float _czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters){
224998
+ float depthBias = shadowParameters.depthBias;
224999
+ float depth = shadowParameters.depth;
225000
+ float nDotL = shadowParameters.nDotL;
225001
+ float normalShadingSmooth = shadowParameters.normalShadingSmooth;
225002
+ float darkness = shadowParameters.darkness;
225003
+ vec2 uv = shadowParameters.texCoords;
225004
+ depth -= depthBias;
225005
+ vec2 texelStepSize = shadowParameters.texelStepSize;
225006
+ float radius = 1.0;
225007
+ float dx0 = -texelStepSize.x * radius;
225008
+ float dy0 = -texelStepSize.y * radius;
225009
+ float dx1 = texelStepSize.x * radius;
225010
+ float dy1 = texelStepSize.y * radius;
225011
+ float visibility = ( _czm_shadowDepthCompare(shadowMap, uv, depth) +_czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) + _czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth) ) * (1.0 / 9.0) ;
225012
+ return visibility;
225013
+ }
225014
+ vec3 pointProjectOnPlane(in vec3 planeNormal, in vec3 planeOrigin, in vec3 point){
225015
+ vec3 v01 = point -planeOrigin;
225016
+ float d = dot(planeNormal, v01) ;
225017
+ return (point - planeNormal * d);
225018
+ }
225019
+ float ptm(vec3 pt){
225020
+ return sqrt(pt.x*pt.x + pt.y*pt.y + pt.z*pt.z);
225021
+ }
225022
+ void main() {
225023
+ const float PI = 3.141592653589793;
225024
+ vec4 color = texture(colorTexture, v_textureCoordinates);
225025
+ vec4 currD = texture(depthTexture, v_textureCoordinates);
225026
+ if(currD.r>=1.0){
225027
+ out_FragColor = color;
225028
+ return;
225029
+ }
225030
+ float depth = getDepth(currD);
225031
+ vec4 positionEC = toEye(v_textureCoordinates, depth);
225032
+ vec3 normalEC = vec3(1.0);
225033
+ czm_shadowParameters shadowParameters;
225034
+ shadowParameters.texelStepSize = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.xy;
225035
+ shadowParameters.depthBias = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.z;
225036
+ shadowParameters.normalShadingSmooth = shadowMap_texelSizeDepthBiasAndNormalShadingSmooth.w;
225037
+ shadowParameters.darkness = shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness.w;
225038
+ shadowParameters.depthBias *= max(depth * 0.01, 1.0);
225039
+ vec3 directionEC = normalize(positionEC.xyz - shadowMap_lightPositionEC.xyz);
225040
+ float nDotL = clamp(dot(normalEC, -directionEC), 0.0, 1.0);
225041
+ vec4 shadowPosition = _shadowMap_matrix * positionEC;
225042
+ shadowPosition /= shadowPosition.w;
225043
+ if (any(lessThan(shadowPosition.xyz, vec3(0.0))) || any(greaterThan(shadowPosition.xyz, vec3(1.0)))) {
225044
+ out_FragColor = color;
225045
+ return;
225046
+ }
225047
+ shadowParameters.texCoords = shadowPosition.xy;
225048
+ shadowParameters.depth = shadowPosition.z;
225049
+ shadowParameters.nDotL = nDotL;
225050
+ float visibility = _czm_shadowVisibility(stcshadow, shadowParameters);
225051
+ vec4 videoColor = texture(videoTexture,shadowPosition.xy);
225052
+ if(visibility==1.0){
225053
+ out_FragColor = mix(color,vec4(videoColor.xyz,1.0),mixNum*videoColor.a);
225054
+ }else{
225055
+ if(abs(shadowPosition.z-0.0)<0.01){
225056
+ return;
225057
+ }
225058
+ out_FragColor = color;
225059
+ }
225060
+ }`,
225061
+ "uniforms": {
225062
+ "mixNum": function() {
225063
+ return _0xf1ae24["alpha"];
225064
+ },
225065
+ "stcshadow": function() {
225066
+ return _0xf1ae24["viewShadowMap"]["_shadowMapTexture"];
225067
+ },
225068
+ "videoTexture": function() {
225069
+ return _0xf1ae24["videoTexture"];
225070
+ },
225071
+ "_shadowMap_matrix": function() {
225072
+ return _0xf1ae24["viewShadowMap"]["_shadowMapMatrix"];
225073
+ },
225074
+ "shadowMap_lightPositionEC": function() {
225075
+ return _0xf1ae24["viewShadowMap"]["_lightPositionEC"];
225076
+ },
225077
+ "shadowMap_texelSizeDepthBiasAndNormalShadingSmooth": function() {
225078
+ let _0x5af988 = new Cartesian2();
225079
+ return _0x5af988["x"] = 1 / _0xf1ae24["viewShadowMap"]["_textureSize"]["x"], _0x5af988["y"] = 1 / _0xf1ae24["viewShadowMap"]["_textureSize"]["y"], Cartesian4["fromElements"](_0x5af988["x"], _0x5af988["y"], _0x4d4140["depthBias"], _0x4d4140["normalShadingSmooth"], this["combinedUniforms1"]);
225080
+ },
225081
+ "shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness": function() {
225082
+ return Cartesian4["fromElements"](_0x4d4140["normalOffsetScale"], _0xf1ae24["viewShadowMap"]["_distance"], _0xf1ae24["viewShadowMap"]["maximumDistance"], _0xf1ae24["viewShadowMap"]["_darkness"], this["combinedUniforms2"]);
225083
+ }
225084
+ }
225085
+ });
225086
+ this["viewer"]["scene"]["postProcessStages"]["add"](this["postProcess"]);
225087
+ }
225088
+ getStyle() {
225089
+ return this["options"];
225090
+ }
225091
+ updateStyle(_0x3da6ca) {
225092
+ this["viewer"]["scene"]["primitives"]["remove"](this["cameraFrustum"]);
225093
+ _0x3da6ca.video = this.oldOpt.video;
225094
+ this.setOptions(_0x3da6ca);
225095
+ let _0x310a9a = this["initCameraParam"]();
225096
+ this["near"] = _0x310a9a["near"] || 0.1;
225097
+ this["cameraPosition"] = _0x310a9a["cameraPosition"];
225098
+ this["position"] = _0x310a9a["position"];
225099
+ this["alpha"] = _0x310a9a["alpha"] || 1;
225100
+ this["debugFrustum"] = defaultValue(_0x310a9a["debugFrustum"], true);
225101
+ this["aspectRatio"] = _0x3da6ca["aspectRatio"] || 1;
225102
+ this["fov"] = _0x310a9a["fov"] || 400;
225103
+ this["cameraPosition"] && this["position"] ? (this["getOrientation"](), this["createShadowMap"](), this["addCameraFrustum"]()) : console["log"]("\u4F4D\u7F6E\u5750\u6807\u9519\u8BEF");
225104
+ }
225105
+ deActiveVideo() {
225106
+ this["activeVideoListener"] && (this["viewer"]["clock"]["onTick"]["removeEventListener"](this["activeVideoListener"]), delete this["activeVideoListener"]);
225107
+ }
225108
+ update(_0x23699d) {
225109
+ this["viewShadowMap"] && this["viewer"]["scene"]["frameState"]["shadowMaps"]["push"](this["viewShadowMap"]);
225110
+ }
225111
+ setFrustumVisible(_0xab7ebd) {
225112
+ this["cameraFrustum"] && (this["debugFrustum"] = _0xab7ebd, this["cameraFrustum"]["show"] = this["debugFrustum"]);
225113
+ }
225114
+ destroy() {
225115
+ this["viewer"]["scene"]["postProcessStages"]["remove"](this["postProcess"]);
225116
+ this["viewer"]["scene"]["primitives"]["remove"](this["cameraFrustum"]);
225117
+ this["activeVideoListener"] && this["viewer"]["clock"]["onTick"]["removeEventListener"](this["activeVideoListener"]);
225118
+ this["activeVideoListener"] && delete this["activeVideoListener"];
225119
+ delete this["postProcess"];
225120
+ delete this["viewShadowMap"];
225121
+ delete this["cameraPosition"];
225122
+ delete this["position"];
225123
+ delete this["alpha"];
225124
+ delete this["_camerafov"];
225125
+ delete this["_cameraPosition"];
225126
+ delete this["videoTexture"];
225127
+ delete this["cameraFrustum"];
225128
+ delete this["_debugFrustum"];
225129
+ delete this["_position"];
225130
+ delete this["_aspectRatio"];
225131
+ delete this["url"];
225132
+ delete this["orientation"];
225133
+ this["viewer"]["scene"]["primitives"]["remove"](this);
225134
+ delete this["viewer"];
225135
+ }
225136
+ remove() {
225137
+ this["destroy"]();
225138
+ }
225139
+ }
224520
225140
  const BASEURL = "/gy-cesium";
224521
225141
  let model1 = null;
224522
225142
  let model3 = null;
@@ -224833,17 +225453,14 @@ class CesiumModel {
224833
225453
  return new GltfLoader(this, url2, opt);
224834
225454
  }
224835
225455
  addVideoShadow(videoElement, opt) {
224836
- this.lonlatToWGS84(opt.lon, opt.lat);
224837
- if (this.hideEarth) {
224838
- let x = (opt.x || 0) / 1e5;
224839
- let y = (opt.y || 0) / 1e5;
224840
- this.lonlatToWGS84(this.HIDEMODELLONLAT[0] + x, this.HIDEMODELLONLAT[1] + y);
225456
+ var _a;
225457
+ if (!this.hideEarth && (!opt.lon || !opt.lat)) {
225458
+ console.error("\u8BF7\u6DFB\u52A0\u7ECF\u7EAC\u5EA6\uFF01");
225459
+ return;
224841
225460
  }
224842
- this.changeCamera(...this.lonlatToWGS84(116.403042, 39.899806), 500, {
224843
- isFly: false,
224844
- heading: 0,
224845
- pitch: -89
224846
- });
225461
+ opt.video = videoElement;
225462
+ let videoShed3d = new VideoShed3d(this.view, this, opt);
225463
+ (_a = this.modelControlsFun) == null ? void 0 : _a.call(this, [videoShed3d]);
224847
225464
  }
224848
225465
  loadGltfModel(opt) {
224849
225466
  return new Promise((resolve2) => {
@@ -225314,7 +225931,7 @@ const __vue2_script$1 = defineComponent({
225314
225931
  watch(modelFinish, (v7) => {
225315
225932
  console.log(cesiumCon.model.value);
225316
225933
  cesiumCon.model.value.modelControlsFun = (models) => {
225317
- modelList = models;
225934
+ modelList = modelList.concat(...models);
225318
225935
  init();
225319
225936
  };
225320
225937
  });
@@ -225495,7 +226112,7 @@ var __component__$1 = /* @__PURE__ */ normalizeComponent(
225495
226112
  staticRenderFns$1,
225496
226113
  false,
225497
226114
  __vue2_injectStyles$1,
225498
- "b43f6898",
226115
+ "1053e9b0",
225499
226116
  null,
225500
226117
  null
225501
226118
  );
@@ -225511,13 +226128,17 @@ const __vue2_script = defineComponent({
225511
226128
  name: "GyCesiumVideoShadow",
225512
226129
  props: {
225513
226130
  videoUrl: {
225514
- type: Object,
225515
- default: () => ({})
226131
+ type: String,
226132
+ default: ""
225516
226133
  },
225517
226134
  modelId: {
225518
226135
  type: String,
225519
226136
  default: ""
225520
226137
  },
226138
+ id: {
226139
+ type: String,
226140
+ default: null
226141
+ },
225521
226142
  lon: {
225522
226143
  type: Number,
225523
226144
  default: null
@@ -225548,7 +226169,7 @@ const __vue2_script = defineComponent({
225548
226169
  },
225549
226170
  aspectRatio: {
225550
226171
  type: Number,
225551
- default: 60
226172
+ default: 1
225552
226173
  },
225553
226174
  alpha: {
225554
226175
  type: Number,
@@ -225578,6 +226199,7 @@ const __vue2_script = defineComponent({
225578
226199
  });
225579
226200
  const getVideoOptions = () => {
225580
226201
  return {
226202
+ id: props.id,
225581
226203
  lon: props.lon,
225582
226204
  lat: props.lat,
225583
226205
  height: props.height,
@@ -225591,7 +226213,6 @@ const __vue2_script = defineComponent({
225591
226213
  };
225592
226214
  };
225593
226215
  const init = () => {
225594
- console.log(trailer.value);
225595
226216
  if (cesiumCon && cesiumCon.model.value && modelFinish.value && trailer.value) {
225596
226217
  let opt = getVideoOptions();
225597
226218
  cesiumCon.model.value.addVideoShadow(trailer.value, opt);
@@ -225606,7 +226227,7 @@ var render = function() {
225606
226227
  var _vm = this;
225607
226228
  var _h = _vm.$createElement;
225608
226229
  var _c = _vm._self._c || _h;
225609
- return _c("video", {
226230
+ return _vm.videoUrl ? _c("video", {
225610
226231
  ref: "trailer",
225611
226232
  staticClass: "video-main",
225612
226233
  attrs: {
@@ -225619,7 +226240,7 @@ var render = function() {
225619
226240
  domProps: {
225620
226241
  "muted": true
225621
226242
  }
225622
- });
226243
+ }) : _vm._e();
225623
226244
  };
225624
226245
  var staticRenderFns = [];
225625
226246
  const GyCesiumVideoShadow_vue_vue_type_style_index_0_lang = "";