deeptwins-engine-3d 0.1.60 → 0.1.62

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.
@@ -423,7 +423,8 @@ export var DEFAULT_BASE_LAYER = {
423
423
  name: '高德影像',
424
424
  type: 'raster',
425
425
  layers: [{
426
- url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
426
+ url: 'https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
427
+ subdomains: ['1', '2', '3', '4'],
427
428
  minimumLevel: 1,
428
429
  maximumLevel: 18,
429
430
  credit: 'gd_img'
@@ -433,7 +434,8 @@ export var DEFAULT_BASE_LAYER = {
433
434
  name: '高德影像注记',
434
435
  type: 'raster',
435
436
  layers: [{
436
- url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
437
+ url: 'https://webst0{s}.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
438
+ subdomains: ['1', '2', '3', '4'],
437
439
  minimumLevel: 1,
438
440
  maximumLevel: 18,
439
441
  credit: 'gd_img'
@@ -448,7 +450,8 @@ export var DEFAULT_BASE_LAYER = {
448
450
  name: '高德电子',
449
451
  type: 'raster',
450
452
  layers: [{
451
- url: 'https://wprd02.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=2&style=7',
453
+ url: 'https://wprd0{s}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=2&style=7',
454
+ subdomains: ['1', '2', '3', '4'],
452
455
  minimumLevel: 1,
453
456
  maximumLevel: 18,
454
457
  credit: 'gd_vec'
@@ -468,7 +471,8 @@ export var DEFAULT_BASE_LAYER = {
468
471
  name: '腾讯影像',
469
472
  type: 'raster',
470
473
  layers: [{
471
- url: 'https://p2.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400',
474
+ url: 'https://p{s}.map.gtimg.com/sateTiles/{z}/{sx}/{sy}/{x}_{reverseY}.jpg?version=400',
475
+ subdomains: ['0', '1', '2', '3'],
472
476
  minimumLevel: 1,
473
477
  maximumLevel: 18,
474
478
  customTags: {
@@ -481,7 +485,8 @@ export var DEFAULT_BASE_LAYER = {
481
485
  },
482
486
  credit: 'tx_img_d'
483
487
  }, {
484
- url: 'https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=2&version=297',
488
+ url: 'https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=2&version=297',
489
+ subdomains: ['0', '1', '2', '3'],
485
490
  minimumLevel: 1,
486
491
  maximumLevel: 18,
487
492
  credit: 'tx_img_z'
@@ -491,7 +496,8 @@ export var DEFAULT_BASE_LAYER = {
491
496
  name: '腾讯电子',
492
497
  type: 'raster',
493
498
  layers: [{
494
- url: 'https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=1&version=297',
499
+ url: 'https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=1&version=297',
500
+ subdomains: ['0', '1', '2', '3'],
495
501
  minimumLevel: 1,
496
502
  maximumLevel: 18,
497
503
  credit: 'tx_vec'
@@ -501,7 +507,8 @@ export var DEFAULT_BASE_LAYER = {
501
507
  name: '腾讯电子黑色风格',
502
508
  type: 'raster',
503
509
  layers: [{
504
- url: 'https://rt3.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=4&scene=0',
510
+ url: 'https://rt{s}.map.gtimg.com/tile?z={z}&x={x}&y={reverseY}&styleid=4&scene=0',
511
+ subdomains: ['0', '1', '2', '3'],
505
512
  minimumLevel: 1,
506
513
  maximumLevel: 18,
507
514
  credit: 'tx_vec'
@@ -654,6 +661,7 @@ export var DEFAULT_IMAGE_MATERIAL_STYLE = function DEFAULT_IMAGE_MATERIAL_STYLE(
654
661
  export var DEFAULT_GLOW_MATERIAL_STYLE = function DEFAULT_GLOW_MATERIAL_STYLE() {
655
662
  return {
656
663
  color: Cesium.Color.WHITE,
664
+ repeat: [1, 1],
657
665
  glowStrength: 2,
658
666
  mixRatio: 0.5
659
667
  };
@@ -15,7 +15,7 @@ export default class BaseSource {
15
15
  remove(): void;
16
16
  setData(data: any): this | undefined;
17
17
  _toDestroy(): void;
18
- static analysisSourceType(data: any): "other" | "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "clampedPolygonGrid";
18
+ static analysisSourceType(data: any): "wkt" | "sourceId" | "sourceInstance" | "geoJson" | "clampedPolygonGrid" | "other";
19
19
  static wktToGeoJon(wkt: string): any;
20
20
  static geoJsonToGeoCartesian3Array(geoJson: any): any[];
21
21
  static handleFeaturePoint(feature: any): any;
@@ -8,6 +8,7 @@ export declare class DeepTwinsEngine3D {
8
8
  static WmtsLayer: any;
9
9
  static ArcGisLayer: any;
10
10
  static BarrierLayer: any;
11
+ static FactorLayer: any;
11
12
  static DeepTwins: any;
12
13
  static WeatherEffects: any;
13
14
  static Drawer: any;
package/dist/esm/index.js CHANGED
@@ -22,6 +22,7 @@ import "./global.css";
22
22
  import BarrierLayer from "./lowAltitude/BarrierLayer";
23
23
  import FlightPlanning from "./lowAltitude/FlightPlanning";
24
24
  import FlightRiskEvaluation from "./lowAltitude/FlightRiskEvaluation";
25
+ import FactorLayer from "./lowAltitude/FactorLayer";
25
26
  import GridDraw from "./lowAltitude/GridDraw";
26
27
  import PoiLayer from "./lowAltitude/PoiLayer";
27
28
  import VisitLayer from "./lowAltitude/VisitLayer";
@@ -62,11 +63,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
62
63
  // 全局加载css
63
64
  loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
64
65
  // 打印版本信息
65
- console.log('DeepTwinsEngine3D Version:', "0.1.60");
66
+ console.log('DeepTwinsEngine3D Version:', "0.1.62");
66
67
  export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
67
68
  _classCallCheck(this, DeepTwinsEngine3D);
68
69
  });
69
- _defineProperty(DeepTwinsEngine3D, "Version", "0.1.60");
70
+ _defineProperty(DeepTwinsEngine3D, "Version", "0.1.62");
70
71
  _defineProperty(DeepTwinsEngine3D, "Map", Map);
71
72
  _defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
72
73
  _defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
@@ -74,6 +75,7 @@ _defineProperty(DeepTwinsEngine3D, "WmsLayer", WmsLayer);
74
75
  _defineProperty(DeepTwinsEngine3D, "WmtsLayer", WmtsLayer);
75
76
  _defineProperty(DeepTwinsEngine3D, "ArcGisLayer", ArcGisLayer);
76
77
  _defineProperty(DeepTwinsEngine3D, "BarrierLayer", BarrierLayer);
78
+ _defineProperty(DeepTwinsEngine3D, "FactorLayer", FactorLayer);
77
79
  _defineProperty(DeepTwinsEngine3D, "DeepTwins", DeepTwins);
78
80
  _defineProperty(DeepTwinsEngine3D, "WeatherEffects", WeatherEffects);
79
81
  _defineProperty(DeepTwinsEngine3D, "Drawer", Drawer);
@@ -0,0 +1,32 @@
1
+ import BaseGridMvtLayer from './BaseGridMvtLayer';
2
+ /**
3
+ * 要素图层 - 基于背景MVT数据筛选地面网格进行渲染
4
+ */
5
+ declare class FactorLayer extends BaseGridMvtLayer {
6
+ constructor(map: any, options?: any);
7
+ /**
8
+ * 创建 primitives
9
+ */
10
+ private _createPrimitives;
11
+ /**
12
+ * 对当前要素过滤并指定颜色
13
+ */
14
+ private _colorFeature;
15
+ /**
16
+ * 销毁 primitives
17
+ */
18
+ private _destroyPrimitives;
19
+ /**
20
+ * 显示 primitives
21
+ */
22
+ private _showPrimitives;
23
+ /**
24
+ * 隐藏 primitives
25
+ */
26
+ private _hidePrimitives;
27
+ /**
28
+ * 更新 primitives
29
+ */
30
+ private _updatePrimitives;
31
+ }
32
+ export default FactorLayer;
@@ -0,0 +1,199 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
10
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
13
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
14
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
15
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
16
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
17
+ import * as Cesium from 'deeptwins-cesium';
18
+ import BaseGridMvtLayer from "./BaseGridMvtLayer";
19
+
20
+ /**
21
+ * 要素图层 - 基于背景MVT数据筛选地面网格进行渲染
22
+ */
23
+ var FactorLayer = /*#__PURE__*/function (_BaseGridMvtLayer) {
24
+ _inherits(FactorLayer, _BaseGridMvtLayer);
25
+ var _super = _createSuper(FactorLayer);
26
+ function FactorLayer(map) {
27
+ var _this;
28
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29
+ _classCallCheck(this, FactorLayer);
30
+ _this = _super.call(this, map, _objectSpread({
31
+ dataType: 'background',
32
+ displayHeight: 100,
33
+ boxHeight: 10
34
+ }, options));
35
+ _this.createMvtLayer({
36
+ createPrimitives: function createPrimitives(_tileNum, renderData, viewer) {
37
+ var targetViewer = viewer || _this.getMap();
38
+ return _this._createPrimitives(renderData, targetViewer);
39
+ },
40
+ destroyPrimitives: function destroyPrimitives(_tileNum, primitives) {
41
+ return _this._destroyPrimitives(primitives);
42
+ },
43
+ showPrimitives: function showPrimitives(_tileNum, primitives) {
44
+ return _this._showPrimitives(primitives);
45
+ },
46
+ hidePrimitives: function hidePrimitives(_tileNum, primitives) {
47
+ return _this._hidePrimitives(primitives);
48
+ },
49
+ updatePrimitives: function updatePrimitives(_tileNum, _primitives) {
50
+ return _this._updatePrimitives(_tileNum, _primitives);
51
+ }
52
+ });
53
+ return _this;
54
+ }
55
+
56
+ /**
57
+ * 创建 primitives
58
+ */
59
+ _createClass(FactorLayer, [{
60
+ key: "_createPrimitives",
61
+ value: function _createPrimitives(renderData, viewer) {
62
+ var _this$options$display, _this$options$boxHeig;
63
+ if (!this._isViewerReady()) {
64
+ return [];
65
+ }
66
+ var features = (renderData === null || renderData === void 0 ? void 0 : renderData.default) || [];
67
+ var instances = [];
68
+ var displayHeight = (_this$options$display = this.options.displayHeight) !== null && _this$options$display !== void 0 ? _this$options$display : 100;
69
+ var boxHeight = (_this$options$boxHeig = this.options.boxHeight) !== null && _this$options$boxHeig !== void 0 ? _this$options$boxHeig : 10;
70
+ for (var i = 0; i < features.length; i++) {
71
+ var feature = features[i];
72
+ if (!feature || !feature.lnglat || !feature.gridSize) {
73
+ continue;
74
+ }
75
+ var color = this._colorFeature(feature) ? Cesium.Color.fromCssColorString(this._colorFeature(feature)) : null;
76
+ if (!color) {
77
+ continue;
78
+ }
79
+ var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(feature.lnglat[0], feature.lnglat[1], displayHeight));
80
+ var instance = new Cesium.GeometryInstance({
81
+ geometry: Cesium.BoxGeometry.fromDimensions({
82
+ vertexFormat: Cesium.VertexFormat.POSITION_AND_NORMAL,
83
+ dimensions: new Cesium.Cartesian3(feature.gridSize[0], feature.gridSize[1], boxHeight)
84
+ }),
85
+ modelMatrix: modelMatrix,
86
+ attributes: {
87
+ color: Cesium.ColorGeometryInstanceAttribute.fromColor(color)
88
+ }
89
+ });
90
+ instances.push(instance);
91
+ }
92
+ if (!this._isViewerReady() || instances.length === 0) {
93
+ return [];
94
+ }
95
+ var primitive = new Cesium.Primitive({
96
+ geometryInstances: instances,
97
+ appearance: new Cesium.PerInstanceColorAppearance({
98
+ translucent: false,
99
+ closed: true
100
+ })
101
+ });
102
+ if (this._isViewerReady()) {
103
+ viewer.scene.primitives.add(primitive);
104
+ }
105
+ return [primitive];
106
+ }
107
+
108
+ /**
109
+ * 对当前要素过滤并指定颜色
110
+ */
111
+ }, {
112
+ key: "_colorFeature",
113
+ value: function _colorFeature(feature) {
114
+ var _this$options;
115
+ var properties = (feature === null || feature === void 0 ? void 0 : feature.properties) || {};
116
+ if (typeof ((_this$options = this.options) === null || _this$options === void 0 ? void 0 : _this$options.colorFeature) === 'function') {
117
+ var _this$options2;
118
+ return (_this$options2 = this.options) === null || _this$options2 === void 0 ? void 0 : _this$options2.colorFeature(properties, feature);
119
+ }
120
+ return false;
121
+ }
122
+
123
+ /**
124
+ * 销毁 primitives
125
+ */
126
+ }, {
127
+ key: "_destroyPrimitives",
128
+ value: function _destroyPrimitives(primitives) {
129
+ var _this2 = this;
130
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
131
+ return;
132
+ }
133
+ primitives.forEach(function (primitive) {
134
+ if (!primitive) {
135
+ return;
136
+ }
137
+ try {
138
+ primitive.show = false;
139
+ if (_this2._isViewerReady()) {
140
+ var isDestroyed = typeof primitive.isDestroyed === 'function' ? primitive.isDestroyed() : false;
141
+ if (!isDestroyed) {
142
+ _this2.getMap().scene.primitives.remove(primitive);
143
+ }
144
+ if (typeof primitive.destroy === 'function' && !isDestroyed) {
145
+ primitive.destroy();
146
+ }
147
+ }
148
+ } catch (error) {
149
+ console.warn('销毁绿地 primitive 失败', error);
150
+ }
151
+ });
152
+ primitives.length = 0;
153
+ }
154
+
155
+ /**
156
+ * 显示 primitives
157
+ */
158
+ }, {
159
+ key: "_showPrimitives",
160
+ value: function _showPrimitives(primitives) {
161
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
162
+ return;
163
+ }
164
+ primitives.forEach(function (primitive) {
165
+ if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
166
+ primitive.show = true;
167
+ }
168
+ });
169
+ }
170
+
171
+ /**
172
+ * 隐藏 primitives
173
+ */
174
+ }, {
175
+ key: "_hidePrimitives",
176
+ value: function _hidePrimitives(primitives) {
177
+ if (!(primitives !== null && primitives !== void 0 && primitives.length)) {
178
+ return;
179
+ }
180
+ primitives.forEach(function (primitive) {
181
+ if (primitive && typeof primitive.isDestroyed === 'function' && !primitive.isDestroyed()) {
182
+ primitive.show = false;
183
+ }
184
+ });
185
+ }
186
+
187
+ /**
188
+ * 更新 primitives
189
+ */
190
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
191
+ }, {
192
+ key: "_updatePrimitives",
193
+ value: function _updatePrimitives(_tileNum, _primitives) {
194
+ // 预留接口,可根据需要实现更新逻辑
195
+ }
196
+ }]);
197
+ return FactorLayer;
198
+ }(BaseGridMvtLayer);
199
+ export default FactorLayer;
@@ -1,4 +1,4 @@
1
- var _excluded = ["color"];
1
+ var _excluded = ["color", "repeat"];
2
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -22,7 +22,7 @@ import { cloneDeep, isEqual, merge } from 'lodash';
22
22
  import { DEFAULT_GLOW_MATERIAL_STYLE } from "../../constant";
23
23
  import * as utils from "../../tool/utils";
24
24
  /* babel-plugin-inline-import '../shader/ImageGlowingShader.glsl' */
25
- var ImageGlowingShader = "uniform sampler2D image;\nuniform float glowStrength;\nuniform vec4 color;\nuniform float mixRatio;\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n\n // \u91C7\u6837\u56FE\u7247\n vec4 texColor = texture(image, st);\n\n // \u989C\u8272\u6DF7\u5408\uFF1Amix(\u539F\u59CB\u989C\u8272, \u76EE\u6807\u989C\u8272, mixRatio)\n vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);\n\n // \u53D1\u5149\u589E\u5F3A\n material.diffuse = mixedColor * glowStrength;\n\n // \u900F\u660E\u5EA6\u968F\u989C\u8272\u53D8\u5316\n material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);\n\n return material;\n}\n";
25
+ var ImageGlowingShader = "uniform sampler2D image;\nuniform float glowStrength;\nuniform vec4 color;\nuniform float mixRatio;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = fract(materialInput.st * repeat);\n\n // \u91C7\u6837\u56FE\u7247\n vec4 texColor = texture(image, st);\n\n // \u989C\u8272\u6DF7\u5408\uFF1Amix(\u539F\u59CB\u989C\u8272, \u76EE\u6807\u989C\u8272, mixRatio)\n vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);\n\n // \u53D1\u5149\u589E\u5F3A\n material.diffuse = mixedColor * glowStrength;\n\n // \u900F\u660E\u5EA6\u968F\u989C\u8272\u53D8\u5316\n material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);\n\n return material;\n}\n";
26
26
  import BaseMaterialProperty from "./BaseMaterialProperty";
27
27
  var ImageGlowingMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
28
28
  _inherits(ImageGlowingMaterialProperty, _BaseMaterialProperty);
@@ -76,9 +76,11 @@ var ImageGlowingMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty)
76
76
  key: "handleStyle",
77
77
  value: function handleStyle(style) {
78
78
  var color = style.color,
79
+ repeat = style.repeat,
79
80
  options = _objectWithoutProperties(style, _excluded);
80
81
  var backStyle = _objectSpread({}, options);
81
82
  backStyle.color = utils.colorString(color);
83
+ backStyle.repeat = utils.arrCartesian2(repeat);
82
84
  return backStyle;
83
85
  }
84
86
  }]);
@@ -1,4 +1,4 @@
1
- var _excluded = ["color"];
1
+ var _excluded = ["color", "repeat"];
2
2
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -22,7 +22,7 @@ import { cloneDeep, merge } from 'lodash';
22
22
  import { DEFAULT_GLOW_MATERIAL_STYLE, DEFAULT_MATERIAL_APPEARANCE } from "../../constant";
23
23
  import * as utils from "../../tool/utils";
24
24
  /* babel-plugin-inline-import '../shader/ImageGlowingShader.glsl' */
25
- var ImageGlowingShader = "uniform sampler2D image;\nuniform float glowStrength;\nuniform vec4 color;\nuniform float mixRatio;\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n\n // \u91C7\u6837\u56FE\u7247\n vec4 texColor = texture(image, st);\n\n // \u989C\u8272\u6DF7\u5408\uFF1Amix(\u539F\u59CB\u989C\u8272, \u76EE\u6807\u989C\u8272, mixRatio)\n vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);\n\n // \u53D1\u5149\u589E\u5F3A\n material.diffuse = mixedColor * glowStrength;\n\n // \u900F\u660E\u5EA6\u968F\u989C\u8272\u53D8\u5316\n material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);\n\n return material;\n}\n";
25
+ var ImageGlowingShader = "uniform sampler2D image;\nuniform float glowStrength;\nuniform vec4 color;\nuniform float mixRatio;\nuniform vec2 repeat;\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = fract(materialInput.st * repeat);\n\n // \u91C7\u6837\u56FE\u7247\n vec4 texColor = texture(image, st);\n\n // \u989C\u8272\u6DF7\u5408\uFF1Amix(\u539F\u59CB\u989C\u8272, \u76EE\u6807\u989C\u8272, mixRatio)\n vec3 mixedColor = mix(texColor.rgb, texColor.rgb * color.rgb, mixRatio);\n\n // \u53D1\u5149\u589E\u5F3A\n material.diffuse = mixedColor * glowStrength;\n\n // \u900F\u660E\u5EA6\u968F\u989C\u8272\u53D8\u5316\n material.alpha = texColor.a * mix(color.a, 1.0, 1.0 - mixRatio);\n\n return material;\n}\n";
26
26
  import BaseMaterialAppearance from "./BaseMaterialAppearance";
27
27
  var ImageGlowingMaterialAppearance = /*#__PURE__*/function (_BaseMaterialAppearan) {
28
28
  _inherits(ImageGlowingMaterialAppearance, _BaseMaterialAppearan);
@@ -64,9 +64,11 @@ var ImageGlowingMaterialAppearance = /*#__PURE__*/function (_BaseMaterialAppeara
64
64
  key: "handleMaterial",
65
65
  value: function handleMaterial(style) {
66
66
  var color = style.color,
67
+ repeat = style.repeat,
67
68
  options = _objectWithoutProperties(style, _excluded);
68
69
  var backStyle = _objectSpread({}, options);
69
70
  backStyle.color = utils.colorString(color);
71
+ backStyle.repeat = utils.arrCartesian2(repeat);
70
72
  return backStyle;
71
73
  }
72
74
  }]);
@@ -2,10 +2,11 @@ uniform sampler2D image;
2
2
  uniform float glowStrength;
3
3
  uniform vec4 color;
4
4
  uniform float mixRatio;
5
+ uniform vec2 repeat;
5
6
 
6
7
  czm_material czm_getMaterial(czm_materialInput materialInput) {
7
8
  czm_material material = czm_getDefaultMaterial(materialInput);
8
- vec2 st = materialInput.st;
9
+ vec2 st = fract(materialInput.st * repeat);
9
10
 
10
11
  // 采样图片
11
12
  vec4 texColor = texture(image, st);