deeptwins-engine-3d 0.1.26 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/constant.d.ts +1 -0
- package/dist/esm/constant.js +12 -1
- package/dist/esm/graphicLayer/PolygonPrimitive.js +15 -4
- package/dist/esm/graphicLayer/PolygonPrimitiveInstance.js +8 -6
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +8 -6
- package/dist/esm/material/{CircleWaveMaterialProperty.js → entity/CircleWaveMaterialProperty.js} +6 -4
- package/dist/esm/material/{DynamicWallMaterialProperty.js → entity/DynamicWallMaterialProperty.js} +6 -4
- package/dist/esm/material/{ImageGlowingMaterialProperty.js → entity/ImageGlowingMaterialProperty.js} +4 -4
- package/dist/esm/material/{ImageMaterialProperty.js → entity/ImageMaterialProperty.js} +1 -1
- package/dist/esm/material/{PolylineTrailLinkMaterialProperty.js → entity/PolylineTrailLinkMaterialProperty.js} +5 -5
- package/dist/esm/material/primitive/BaseMaterialAppearance.d.ts +8 -0
- package/dist/esm/material/primitive/BaseMaterialAppearance.js +27 -0
- package/dist/esm/material/primitive/ImageGlowingMaterialAppearance.d.ts +10 -0
- package/dist/esm/material/primitive/ImageGlowingMaterialAppearance.js +75 -0
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -1
- /package/dist/esm/material/{BaseMaterialProperty.d.ts → entity/BaseMaterialProperty.d.ts} +0 -0
- /package/dist/esm/material/{BaseMaterialProperty.js → entity/BaseMaterialProperty.js} +0 -0
- /package/dist/esm/material/{CircleWaveMaterialProperty.d.ts → entity/CircleWaveMaterialProperty.d.ts} +0 -0
- /package/dist/esm/material/{DynamicWallMaterialProperty.d.ts → entity/DynamicWallMaterialProperty.d.ts} +0 -0
- /package/dist/esm/material/{ImageGlowingMaterialProperty.d.ts → entity/ImageGlowingMaterialProperty.d.ts} +0 -0
- /package/dist/esm/material/{ImageMaterialProperty.d.ts → entity/ImageMaterialProperty.d.ts} +0 -0
- /package/dist/esm/material/{PolylineTrailLinkMaterialProperty.d.ts → entity/PolylineTrailLinkMaterialProperty.d.ts} +0 -0
package/dist/esm/constant.d.ts
CHANGED
|
@@ -114,6 +114,7 @@ export declare const DEFAULT_BASE_LAYER_TYPE: any;
|
|
|
114
114
|
export declare const DEFAULT_BASE_LAYER: any;
|
|
115
115
|
export declare const LAYER_TYPE_TO_CLASS: any;
|
|
116
116
|
export declare const DEFAULT_SKY_BOX: any;
|
|
117
|
+
export declare const DEFAULT_MATERIAL_APPEARANCE: any;
|
|
117
118
|
export declare const DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE: any;
|
|
118
119
|
export declare const DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE: any;
|
|
119
120
|
export declare const DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE: any;
|
package/dist/esm/constant.js
CHANGED
|
@@ -347,6 +347,17 @@ export var DEFAULT_SKY_BOX = {
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
|
|
350
|
+
// 默认的MaterialAppearance配置
|
|
351
|
+
export var DEFAULT_MATERIAL_APPEARANCE = function DEFAULT_MATERIAL_APPEARANCE() {
|
|
352
|
+
return {
|
|
353
|
+
flat: false,
|
|
354
|
+
faceForward: true,
|
|
355
|
+
translucent: true,
|
|
356
|
+
closed: false,
|
|
357
|
+
materialSupport: Cesium.MaterialAppearance.MaterialSupport.TEXTURED
|
|
358
|
+
};
|
|
359
|
+
};
|
|
360
|
+
|
|
350
361
|
// 流动线材质默认的配置
|
|
351
362
|
export var DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE = function DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE() {
|
|
352
363
|
return {
|
|
@@ -514,7 +525,7 @@ export var DEFAULT_PRIMITIVE_OPTIONS = function DEFAULT_PRIMITIVE_OPTIONS() {
|
|
|
514
525
|
releaseGeometryInstances: true,
|
|
515
526
|
allowPicking: true,
|
|
516
527
|
cull: true,
|
|
517
|
-
asynchronous:
|
|
528
|
+
asynchronous: false,
|
|
518
529
|
debugShowBoundingVolume: false,
|
|
519
530
|
shadows: Cesium.ShadowMode.DISABLED
|
|
520
531
|
};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
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
|
+
var _excluded = ["materialAppearance"];
|
|
2
3
|
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
4
|
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
5
|
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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; }
|
|
5
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
9
|
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
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -30,11 +33,19 @@ var PolygonPrimitive = /*#__PURE__*/function (_BasePrimitive) {
|
|
|
30
33
|
value: function createPrimitive() {
|
|
31
34
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
32
35
|
var primitiveInstance = arguments.length > 1 ? arguments[1] : undefined;
|
|
33
|
-
var
|
|
36
|
+
var _ref = options.style || {},
|
|
37
|
+
materialAppearance = _ref.materialAppearance,
|
|
38
|
+
otherStyle = _objectWithoutProperties(_ref, _excluded);
|
|
39
|
+
var style = merge(DEFAULT_POLYGON_PRIMITIVE_OPTIONS(), cloneDeep(otherStyle || {}));
|
|
34
40
|
var primitiveOptions = merge(DEFAULT_PRIMITIVE_OPTIONS(), cloneDeep(options.primitive || {}));
|
|
35
|
-
var appearance =
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
var appearance = {};
|
|
42
|
+
if (materialAppearance) {
|
|
43
|
+
appearance = materialAppearance.appearance;
|
|
44
|
+
} else {
|
|
45
|
+
appearance = new Cesium.PerInstanceColorAppearance({
|
|
46
|
+
translucent: !!(style !== null && style !== void 0 && style.translucent)
|
|
47
|
+
});
|
|
48
|
+
}
|
|
38
49
|
this.primitive = new Cesium.Primitive(_objectSpread({
|
|
39
50
|
geometryInstances: primitiveInstance,
|
|
40
51
|
appearance: appearance
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
var _excluded = ["style"],
|
|
3
|
-
_excluded2 = ["color"],
|
|
3
|
+
_excluded2 = ["color", "materialAppearance", "vertexFormat"],
|
|
4
4
|
_excluded3 = ["color", "height"];
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
@@ -51,19 +51,21 @@ var PolygonPrimitiveInstance = /*#__PURE__*/function (_BasePrimitiveInstanc) {
|
|
|
51
51
|
function _init(options) {
|
|
52
52
|
var _options$style = options.style,
|
|
53
53
|
color = _options$style.color,
|
|
54
|
+
materialAppearance = _options$style.materialAppearance,
|
|
55
|
+
vertexFormat = _options$style.vertexFormat,
|
|
54
56
|
style = _objectWithoutProperties(_options$style, _excluded2),
|
|
55
57
|
positions = options.positions,
|
|
56
58
|
holes = options.holes,
|
|
57
59
|
primitiveInstance = options.primitiveInstance;
|
|
60
|
+
var currVertexFormat = vertexFormat || materialAppearance ? Cesium.VertexFormat.POSITION_AND_ST : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT;
|
|
58
61
|
var instance = new Cesium.GeometryInstance({
|
|
59
62
|
id: this.id,
|
|
60
|
-
geometry: new Cesium.PolygonGeometry(_objectSpread(
|
|
63
|
+
geometry: new Cesium.PolygonGeometry(_objectSpread({
|
|
61
64
|
polygonHierarchy: new Cesium.PolygonHierarchy(positions, holes.map(function (t) {
|
|
62
65
|
return new Cesium.PolygonHierarchy(t);
|
|
63
|
-
}))
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
})),
|
|
66
|
+
})),
|
|
67
|
+
vertexFormat: currVertexFormat
|
|
68
|
+
}, style)),
|
|
67
69
|
attributes: {
|
|
68
70
|
color: color
|
|
69
71
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export declare class DeepTwinsEngine3D {
|
|
|
23
23
|
static CircleWaveMaterialProperty: any;
|
|
24
24
|
static PolylineTrailLinkMaterialProperty: any;
|
|
25
25
|
static ImageMaterialProperty: any;
|
|
26
|
+
static ImageGlowingMaterialAppearance: any;
|
|
26
27
|
static VolumeCloud: any;
|
|
27
28
|
static Heatmap2d: any;
|
|
28
29
|
static Heatmap3d: any;
|
package/dist/esm/index.js
CHANGED
|
@@ -18,13 +18,14 @@ import Drawer from "./drawer/index";
|
|
|
18
18
|
import "./global.css";
|
|
19
19
|
import GroundSkyBox from "./map/GroundSkyBox";
|
|
20
20
|
import Map from "./map/Map";
|
|
21
|
-
import CircleWaveMaterialProperty from "./material/CircleWaveMaterialProperty";
|
|
22
|
-
import DynamicWallMaterialProperty from "./material/DynamicWallMaterialProperty";
|
|
23
|
-
import ImageGlowingMaterialProperty from "./material/ImageGlowingMaterialProperty";
|
|
24
|
-
import ImageMaterialProperty from "./material/ImageMaterialProperty";
|
|
25
|
-
import PolylineTrailLinkMaterialProperty from "./material/PolylineTrailLinkMaterialProperty";
|
|
26
21
|
import VolumeCloud from "./material/VolumeCloud";
|
|
27
22
|
import WeatherEffects from "./material/WeatherEffects";
|
|
23
|
+
import CircleWaveMaterialProperty from "./material/entity/CircleWaveMaterialProperty";
|
|
24
|
+
import DynamicWallMaterialProperty from "./material/entity/DynamicWallMaterialProperty";
|
|
25
|
+
import ImageGlowingMaterialProperty from "./material/entity/ImageGlowingMaterialProperty";
|
|
26
|
+
import ImageMaterialProperty from "./material/entity/ImageMaterialProperty";
|
|
27
|
+
import PolylineTrailLinkMaterialProperty from "./material/entity/PolylineTrailLinkMaterialProperty";
|
|
28
|
+
import ImageGlowingMaterialAppearance from "./material/primitive/ImageGlowingMaterialAppearance";
|
|
28
29
|
import * as Measure from "./measure";
|
|
29
30
|
import PositionProperty from "./property/PositionProperty";
|
|
30
31
|
import ArcGisLayer from "./tileLayer/ArcGisLayer";
|
|
@@ -50,7 +51,7 @@ loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
|
50
51
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
51
52
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
52
53
|
});
|
|
53
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
54
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.28");
|
|
54
55
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
55
56
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
56
57
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -73,6 +74,7 @@ _defineProperty(DeepTwinsEngine3D, "DynamicWallMaterialProperty", DynamicWallMat
|
|
|
73
74
|
_defineProperty(DeepTwinsEngine3D, "CircleWaveMaterialProperty", CircleWaveMaterialProperty);
|
|
74
75
|
_defineProperty(DeepTwinsEngine3D, "PolylineTrailLinkMaterialProperty", PolylineTrailLinkMaterialProperty);
|
|
75
76
|
_defineProperty(DeepTwinsEngine3D, "ImageMaterialProperty", ImageMaterialProperty);
|
|
77
|
+
_defineProperty(DeepTwinsEngine3D, "ImageGlowingMaterialAppearance", ImageGlowingMaterialAppearance);
|
|
76
78
|
_defineProperty(DeepTwinsEngine3D, "VolumeCloud", VolumeCloud);
|
|
77
79
|
_defineProperty(DeepTwinsEngine3D, "Heatmap2d", Heatmap2d);
|
|
78
80
|
_defineProperty(DeepTwinsEngine3D, "Heatmap3d", Heatmap3d);
|
package/dist/esm/material/{CircleWaveMaterialProperty.js → entity/CircleWaveMaterialProperty.js}
RENAMED
|
@@ -20,11 +20,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
20
20
|
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); }
|
|
21
21
|
import * as Cesium from 'deeptwins-cesium';
|
|
22
22
|
import { cloneDeep, isEqual, merge } from 'lodash';
|
|
23
|
-
import { DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE } from "
|
|
24
|
-
import * as utils from "
|
|
23
|
+
import { DEFAULT_CIRCLE_WAVE_MATERIAL_STYLE } from "../../constant";
|
|
24
|
+
import * as utils from "../../tool/utils";
|
|
25
|
+
/* babel-plugin-inline-import '../shader/CircleWaveShader.glsl' */
|
|
26
|
+
var CircleWaveShader = "czm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5));\n float per = fract(time);\n float perDis = 0.5 / count;\n\n // discard if str.z != 0\n float discardByStr = step(0.001, abs(str.z));\n // discard if dis > 0.5\n float discardByDis = step(0.5, dis);\n\n if (discardByStr > 0.0 || discardByDis > 0.0) {\n discard;\n }\n\n float bl = 0.0;\n\n for (int i = 0; i <= 9; i++) {\n float idx = float(i);\n float valid = step(idx, count); // 1.0 if i <= count, else 0.0\n\n float disNum = perDis * idx - dis + per / count;\n float inFirst = step(0.0, disNum) * (1.0 - step(perDis, disNum));\n float inSecond = step(perDis, disNum) * (1.0 - step(2.0 * perDis, disNum));\n\n float bl1 = 1.0 - disNum / perDis;\n float bl2 = 1.0 - abs(1.0 - disNum / perDis);\n\n float thisBl = mix(0.0, bl1, inFirst) + mix(0.0, bl2, inSecond);\n thisBl *= valid; // only apply if i <= count\n\n bl = max(bl, thisBl); // \u4FDD\u7559\u6700\u5F3A\u7684\u4E00\u5C42\u6CE2\u7EB9\n }\n\n material.alpha = pow(bl, gradient);\n return material;\n}\n";
|
|
25
27
|
import BaseMaterialProperty from "./BaseMaterialProperty";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
// 水波纹材质
|
|
28
30
|
var CircleWaveMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
|
|
29
31
|
_inherits(CircleWaveMaterialProperty, _BaseMaterialProperty);
|
|
30
32
|
var _super = _createSuper(CircleWaveMaterialProperty);
|
package/dist/esm/material/{DynamicWallMaterialProperty.js → entity/DynamicWallMaterialProperty.js}
RENAMED
|
@@ -20,11 +20,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
20
20
|
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); }
|
|
21
21
|
import * as Cesium from 'deeptwins-cesium';
|
|
22
22
|
import { cloneDeep, isEqual, merge } from 'lodash';
|
|
23
|
-
import { DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE } from "
|
|
24
|
-
import * as utils from "
|
|
23
|
+
import { DEFAULT_DYNAMIC_WALL_MATERIAL_STYLE } from "../../constant";
|
|
24
|
+
import * as utils from "../../tool/utils";
|
|
25
|
+
/* babel-plugin-inline-import '../shader/DynamicWallShader.glsl' */
|
|
26
|
+
var DynamicWallShader = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n float vertical = 1.0;\n float directionAdd = 1.0;\n // \u4F7F\u7528 abs(a - b) < 0.0001\uFF08\u901A\u8FC7 step\uFF09\u5224\u65AD\u6D6E\u70B9\u76F8\u7B49\uFF0C\u907F\u514D\u7CBE\u5EA6\u8BEF\u5DEE\n // \u5224\u65AD\u6392\u5217\u65B9\u5411\u662F\u5426\u662F\u7EB5\u5411\uFF08freely == vertical\uFF09\n float isVertical = 1.0 - step(0.0001, abs(freely - vertical));\n // \u5224\u65AD\u8FD0\u52A8\u65B9\u5411\u662F\u5426\u662F\u52A0\uFF08direction == directionAdd\uFF09\n float isAdd = 1.0 - step(0.0001, abs(direction - directionAdd));\n\n // \u7EB5\u5411\u6392\u5217\uFF1Auv = (st.s, count * st.t \xB1 time)\n // \u6A2A\u5411\u6392\u5217\uFF1Auv = (count * st.s \xB1 time, st.t)\n vec2 uvVerticalAdd = vec2(fract(st.s), fract(count * st.t + time));\n vec2 uvVerticalSub = vec2(fract(st.s), fract(count * st.t - time));\n vec2 uvHorizontalAdd = vec2(fract(count * st.s + time), fract(st.t));\n vec2 uvHorizontalSub = vec2(fract(count * st.s - time), fract(st.t));\n\n // \u6309\u8FD0\u52A8\u65B9\u5411\u9009\u62E9 mix(a, b, t) \u4F5C\u7528\u7C7B\u4F3C\u4E8E t == 0 ? a : b\n vec2 uvVertical = mix(uvVerticalSub, uvVerticalAdd, isAdd);\n vec2 uvHorizontal = mix(uvHorizontalSub, uvHorizontalAdd, isAdd);\n\n // \u6700\u7EC8\u6839\u636E\u6392\u5217\u65B9\u5411\u9009\u62E9\n vec2 uv = mix(uvHorizontal, uvVertical, isVertical);\n\n vec4 colorImage = texture(image, uv);\n vec3 mixedColor = mix(colorImage.rgb, color.rgb, mixRatio);\n vec4 fragColor;\n fragColor.rgb = mixedColor;\n fragColor = czm_gammaCorrect(fragColor);\n\n material.diffuse = mixedColor;\n material.alpha = colorImage.a * color.a; // \u53EF\u6839\u636E\u9700\u8981\u51B3\u5B9A\u662F\u5426\u76F8\u4E58\n material.emission = fragColor.rgb;\n\n return material;\n}\n";
|
|
25
27
|
import BaseMaterialProperty from "./BaseMaterialProperty";
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
|
|
29
|
+
// 动态墙材质
|
|
28
30
|
var DynamicWallMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
|
|
29
31
|
_inherits(DynamicWallMaterialProperty, _BaseMaterialProperty);
|
|
30
32
|
var _super = _createSuper(DynamicWallMaterialProperty);
|
package/dist/esm/material/{ImageGlowingMaterialProperty.js → entity/ImageGlowingMaterialProperty.js}
RENAMED
|
@@ -19,11 +19,11 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
19
19
|
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); }
|
|
20
20
|
import * as Cesium from 'deeptwins-cesium';
|
|
21
21
|
import { cloneDeep, isEqual, merge } from 'lodash';
|
|
22
|
-
import { DEFAULT_GLOW_MATERIAL_STYLE } from "
|
|
23
|
-
import * as utils from "
|
|
24
|
-
import
|
|
25
|
-
/* babel-plugin-inline-import './shader/ImageGlowingShader.glsl' */
|
|
22
|
+
import { DEFAULT_GLOW_MATERIAL_STYLE } from "../../constant";
|
|
23
|
+
import * as utils from "../../tool/utils";
|
|
24
|
+
/* babel-plugin-inline-import '../shader/ImageGlowingShader.glsl' */
|
|
26
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";
|
|
26
|
+
import BaseMaterialProperty from "./BaseMaterialProperty";
|
|
27
27
|
var ImageGlowingMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
|
|
28
28
|
_inherits(ImageGlowingMaterialProperty, _BaseMaterialProperty);
|
|
29
29
|
var _super = _createSuper(ImageGlowingMaterialProperty);
|
|
@@ -12,7 +12,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
12
12
|
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; } }
|
|
13
13
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
14
14
|
import * as Cesium from 'deeptwins-cesium';
|
|
15
|
-
import * as utils from "
|
|
15
|
+
import * as utils from "../../tool/utils";
|
|
16
16
|
var ImageMaterialProperty = /*#__PURE__*/function (_Cesium$ImageMaterial) {
|
|
17
17
|
_inherits(ImageMaterialProperty, _Cesium$ImageMaterial);
|
|
18
18
|
var _super = _createSuper(ImageMaterialProperty);
|
|
@@ -20,12 +20,12 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
20
20
|
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); }
|
|
21
21
|
import * as Cesium from 'deeptwins-cesium';
|
|
22
22
|
import { cloneDeep, isEqual, merge } from 'lodash';
|
|
23
|
-
import { CAMERA_EVENT_TYPE, DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE } from "
|
|
24
|
-
import BaseLayer from "
|
|
25
|
-
import * as utils from "
|
|
26
|
-
import
|
|
27
|
-
/* babel-plugin-inline-import './shader/PolylineTrailLinkShader.glsl' */
|
|
23
|
+
import { CAMERA_EVENT_TYPE, DEFAULT_POLYLINE_TRAIL_LINK_MATERIAL_STYLE } from "../../constant";
|
|
24
|
+
import BaseLayer from "../../graphicLayer/BaseLayer";
|
|
25
|
+
import * as utils from "../../tool/utils";
|
|
26
|
+
/* babel-plugin-inline-import '../shader/PolylineTrailLinkShader.glsl' */
|
|
28
27
|
var PolylineTrailLinkShader = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = vec2(fract(materialInput.st.s * repeat.x - time), fract(materialInput.st.t * repeat.y));\n vec4 colorImage = texture(image, vec2(fract(st.s - time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = mix(colorImage.rgb, color.rgb, mixRatio);\n return material;\n}\n";
|
|
28
|
+
import BaseMaterialProperty from "./BaseMaterialProperty";
|
|
29
29
|
var PolylineTrailLinkMaterialProperty = /*#__PURE__*/function (_BaseMaterialProperty) {
|
|
30
30
|
_inherits(PolylineTrailLinkMaterialProperty, _BaseMaterialProperty);
|
|
31
31
|
var _super = _createSuper(PolylineTrailLinkMaterialProperty);
|
|
@@ -0,0 +1,27 @@
|
|
|
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
+
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); } }
|
|
4
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
5
|
+
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; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
7
|
+
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); }
|
|
8
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
9
|
+
var BaseMaterialAppearance = /*#__PURE__*/function () {
|
|
10
|
+
function BaseMaterialAppearance(type, style) {
|
|
11
|
+
_classCallCheck(this, BaseMaterialAppearance);
|
|
12
|
+
_defineProperty(this, "type", void 0);
|
|
13
|
+
_defineProperty(this, "style", void 0);
|
|
14
|
+
_defineProperty(this, "material", void 0);
|
|
15
|
+
_defineProperty(this, "appearance", void 0);
|
|
16
|
+
this.type = type + uuidv4();
|
|
17
|
+
this.style = style || {};
|
|
18
|
+
}
|
|
19
|
+
_createClass(BaseMaterialAppearance, [{
|
|
20
|
+
key: "getType",
|
|
21
|
+
value: function getType() {
|
|
22
|
+
return this.type;
|
|
23
|
+
}
|
|
24
|
+
}]);
|
|
25
|
+
return BaseMaterialAppearance;
|
|
26
|
+
}();
|
|
27
|
+
export { BaseMaterialAppearance as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import BaseMaterialAppearance from './BaseMaterialAppearance';
|
|
2
|
+
declare class ImageGlowingMaterialAppearance extends BaseMaterialAppearance {
|
|
3
|
+
private readonly currMaterial;
|
|
4
|
+
private readonly currAppearance;
|
|
5
|
+
constructor(material: any, appearance: any);
|
|
6
|
+
static handleMaterial(style: any): any;
|
|
7
|
+
private _createMaterial;
|
|
8
|
+
private _createAppearance;
|
|
9
|
+
}
|
|
10
|
+
export default ImageGlowingMaterialAppearance;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var _excluded = ["color"];
|
|
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
|
+
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
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
8
|
+
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); } }
|
|
9
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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
|
+
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; }
|
|
18
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
19
|
+
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); }
|
|
20
|
+
import * as Cesium from 'deeptwins-cesium';
|
|
21
|
+
import { cloneDeep, merge } from 'lodash';
|
|
22
|
+
import { DEFAULT_GLOW_MATERIAL_STYLE, DEFAULT_MATERIAL_APPEARANCE } from "../../constant";
|
|
23
|
+
import * as utils from "../../tool/utils";
|
|
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";
|
|
26
|
+
import BaseMaterialAppearance from "./BaseMaterialAppearance";
|
|
27
|
+
var ImageGlowingMaterialAppearance = /*#__PURE__*/function (_BaseMaterialAppearan) {
|
|
28
|
+
_inherits(ImageGlowingMaterialAppearance, _BaseMaterialAppearan);
|
|
29
|
+
var _super = _createSuper(ImageGlowingMaterialAppearance);
|
|
30
|
+
function ImageGlowingMaterialAppearance(material, appearance) {
|
|
31
|
+
var _this;
|
|
32
|
+
_classCallCheck(this, ImageGlowingMaterialAppearance);
|
|
33
|
+
var mergeMaterial = merge(DEFAULT_GLOW_MATERIAL_STYLE(), cloneDeep(material || {}));
|
|
34
|
+
_this = _super.call(this, 'ImageGlowingMaterialAsset', mergeMaterial);
|
|
35
|
+
_defineProperty(_assertThisInitialized(_this), "currMaterial", void 0);
|
|
36
|
+
_defineProperty(_assertThisInitialized(_this), "currAppearance", void 0);
|
|
37
|
+
_this.currMaterial = ImageGlowingMaterialAppearance.handleMaterial(mergeMaterial);
|
|
38
|
+
_this.currAppearance = merge(DEFAULT_MATERIAL_APPEARANCE(), appearance || {});
|
|
39
|
+
_this._createMaterial();
|
|
40
|
+
return _this;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 处理参数
|
|
44
|
+
_createClass(ImageGlowingMaterialAppearance, [{
|
|
45
|
+
key: "_createMaterial",
|
|
46
|
+
value: function _createMaterial() {
|
|
47
|
+
this.material = new Cesium.Material({
|
|
48
|
+
fabric: {
|
|
49
|
+
type: this.type,
|
|
50
|
+
uniforms: _objectSpread({}, this.currMaterial),
|
|
51
|
+
source: ImageGlowingShader
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this._createAppearance();
|
|
55
|
+
}
|
|
56
|
+
}, {
|
|
57
|
+
key: "_createAppearance",
|
|
58
|
+
value: function _createAppearance() {
|
|
59
|
+
this.appearance = new Cesium.MaterialAppearance(_objectSpread({
|
|
60
|
+
material: this.material
|
|
61
|
+
}, this.currAppearance));
|
|
62
|
+
}
|
|
63
|
+
}], [{
|
|
64
|
+
key: "handleMaterial",
|
|
65
|
+
value: function handleMaterial(style) {
|
|
66
|
+
var color = style.color,
|
|
67
|
+
options = _objectWithoutProperties(style, _excluded);
|
|
68
|
+
var backStyle = _objectSpread({}, options);
|
|
69
|
+
backStyle.color = utils.colorString(color);
|
|
70
|
+
return backStyle;
|
|
71
|
+
}
|
|
72
|
+
}]);
|
|
73
|
+
return ImageGlowingMaterialAppearance;
|
|
74
|
+
}(BaseMaterialAppearance);
|
|
75
|
+
export default ImageGlowingMaterialAppearance;
|