@vesium/special 1.0.1-beta.28 → 1.0.1-beta.57
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/README.md +30 -26
- package/dist/index.cjs +0 -248
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.iife.js +3 -249
- package/dist/index.iife.min.js +0 -82
- package/dist/index.min.cjs +0 -82
- package/dist/index.min.mjs +1 -82
- package/dist/index.mjs +1 -248
- package/package.json +17 -20
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.ts +0 -173
- package/dist/index.iife.js.map +0 -1
- package/dist/index.iife.min.js.map +0 -1
- package/dist/index.min.cjs.map +0 -1
- package/dist/index.min.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,36 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://github.com/vesiumjs/vesium/raw/main/assets/logo.svg" align="center" width="15%" />
|
|
3
|
+
</p>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<h1 align="center">
|
|
6
|
+
<span style="color:#52B783">V</span><span style="color:#38485D">esium</span>
|
|
7
|
+
</h1>
|
|
6
8
|
|
|
9
|
+
<p align="center">Vue Composition API and Vue Components for CesiumJS</p>
|
|
7
10
|
|
|
8
11
|
<p align="center">
|
|
9
|
-
<
|
|
12
|
+
<a href="https://github.com/vesiumjs/vesium/releases" target="__blank"><img src="https://img.shields.io/github/v/tag/vesiumjs/vesium" alt="Github tag"></a>
|
|
13
|
+
<a href="https://www.npmjs.com/package/vesium" target="__blank"><img src="https://img.shields.io/npm/v/vesium?color=a1b858&label=npm" alt="NPM Version"></a>
|
|
14
|
+
<a href="https://github.com/vesiumjs/vesium/blob/main/LICENSE" target="__blank"><img src="https://img.shields.io/github/license/vesiumjs/vesium" alt="Github tag"></a>
|
|
15
|
+
<a href="https://github.com/vesiumjs/vesium" target="__blank"><img alt="GitHub Stars" src="https://img.shields.io/github/stars/vesiumjs/vesium?style=social"></a>
|
|
10
16
|
</p>
|
|
11
17
|
|
|
12
|
-
<h1 align="center">Vesium</h1>
|
|
13
|
-
|
|
14
|
-
<p align="center">Vue component and composition-api library for Cesium.</p>
|
|
15
|
-
|
|
16
18
|
<p align="center">
|
|
17
|
-
<a href="https://
|
|
18
|
-
|
|
19
|
-
<a href="https://github.com/
|
|
19
|
+
<a href="https://github.com/vesiumjs/vesium/blob/main/README.zh.md" target="__blank">中文</a>
|
|
20
|
+
|
|
|
21
|
+
<a href="https://github.com/vesiumjs/vesium/blob/main/README.md" target="__blank">English</a>
|
|
20
22
|
</p>
|
|
21
23
|
|
|
22
|
-
> 🚧 This project is under development, and the API may change frequently.
|
|
24
|
+
> 🚧 This project is under active development, and the API may change frequently. Any version may introduce breaking changes.
|
|
25
|
+
|
|
26
|
+
## Documentation
|
|
27
|
+
|
|
28
|
+
To view the documentation, visit <a href="https://vesium.geovue.org" target="__blank">cesium.geovue.org</a>
|
|
23
29
|
|
|
24
30
|
## Features
|
|
25
31
|
|
|
26
|
-
- 🎯 **Intuitive** - VueUse-style API design
|
|
27
|
-
- 💪 **Type
|
|
32
|
+
- 🎯 **Intuitive** - VueUse-style API design familiar to Vue developers
|
|
33
|
+
- 💪 **Type Safe** - Written in TypeScript with full TS support
|
|
28
34
|
- 🏪 **Modular** - Tree-shakeable ESM modules
|
|
29
|
-
- 🌐 **
|
|
35
|
+
- 🌐 **Comprehensive** - Full coverage of common Cesium functionality
|
|
30
36
|
- 🎮 **Interactive** - Rich interactive capabilities with map elements
|
|
31
|
-
- ⚡️ **Lightweight** - No
|
|
37
|
+
- ⚡️ **Lightweight** - No redundant dependencies
|
|
32
38
|
|
|
33
|
-
##
|
|
39
|
+
## Installation
|
|
34
40
|
|
|
35
41
|
```bash
|
|
36
42
|
# npm
|
|
@@ -43,16 +49,14 @@ yarn add cesium @vueuse/core vesium
|
|
|
43
49
|
pnpm add cesium @vueuse/core vesium
|
|
44
50
|
```
|
|
45
51
|
|
|
46
|
-
|
|
47
|
-
<div ref="cesiumContainer" style="width: 100%; height: 100%" />
|
|
48
|
-
</template>
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## 🌸 Credits
|
|
52
|
+
## Related Projects
|
|
52
53
|
|
|
53
|
-
- [VueUse](https://github.com/vueuse/vueuse) - Collection of Vue Composition Utilities
|
|
54
54
|
- [Cesium](https://github.com/CesiumGS/cesium) - An open-source JavaScript library for world-class 3D globes and maps
|
|
55
55
|
|
|
56
|
+
- [VueUse](https://github.com/vueuse/vueuse) - Collection of essential Vue Composition API utilities
|
|
57
|
+
|
|
58
|
+
- [VitePress](https://github.com/vuejs/vitepress) - Vite & Vue-powered static site generator
|
|
59
|
+
|
|
56
60
|
## 📄 License
|
|
57
61
|
|
|
58
|
-
[MIT](./LICENSE)
|
|
62
|
+
Vesium is released under the [MIT License](./LICENSE).
|
package/dist/index.cjs
CHANGED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
6
|
-
const cesium = require("cesium");
|
|
7
|
-
function isFunction(val) {
|
|
8
|
-
return typeof val === "function";
|
|
9
|
-
}
|
|
10
|
-
function cesiumEquals(left, right) {
|
|
11
|
-
return left === right || isFunction(left == null ? void 0 : left.equals) && left.equals(right) || isFunction(right == null ? void 0 : right.equals) && right.equals(left);
|
|
12
|
-
}
|
|
13
|
-
function isCesiumConstant(value) {
|
|
14
|
-
return !cesium.defined(value) || !!value.isConstant;
|
|
15
|
-
}
|
|
16
|
-
function getMaterialCache(type) {
|
|
17
|
-
return cesium.Material._materialCache.getMaterial(type);
|
|
18
|
-
}
|
|
19
|
-
function addMaterialCache(type, material) {
|
|
20
|
-
return cesium.Material._materialCache.addMaterial(type, material);
|
|
21
|
-
}
|
|
22
|
-
function isProperty(value) {
|
|
23
|
-
return value && isFunction(value.getValue);
|
|
24
|
-
}
|
|
25
|
-
function toPropertyValue(value, time) {
|
|
26
|
-
return isProperty(value) ? value.getValue(time) : value;
|
|
27
|
-
}
|
|
28
|
-
function toProperty(value, isConstant = false) {
|
|
29
|
-
return isProperty(value) ? value : isFunction(value) ? new cesium.CallbackProperty(value, isConstant) : new cesium.ConstantProperty(value);
|
|
30
|
-
}
|
|
31
|
-
function createPropertyField(scope, field, maybeProperty, readonly) {
|
|
32
|
-
let removeOwnerListener;
|
|
33
|
-
const ownerBinding = (value) => {
|
|
34
|
-
var _a;
|
|
35
|
-
removeOwnerListener == null ? void 0 : removeOwnerListener();
|
|
36
|
-
if (cesium.defined(value == null ? void 0 : value.definitionChanged)) {
|
|
37
|
-
removeOwnerListener = (_a = value == null ? void 0 : value.definitionChanged) == null ? void 0 : _a.addEventListener(() => {
|
|
38
|
-
scope.definitionChanged.raiseEvent(scope, field, value, value);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
const privateField = `_${field}`;
|
|
43
|
-
const property = toProperty(maybeProperty);
|
|
44
|
-
scope[privateField] = property;
|
|
45
|
-
ownerBinding(property);
|
|
46
|
-
{
|
|
47
|
-
Object.defineProperty(scope, field, {
|
|
48
|
-
get() {
|
|
49
|
-
return scope[privateField];
|
|
50
|
-
},
|
|
51
|
-
set(value) {
|
|
52
|
-
const previous = scope[privateField];
|
|
53
|
-
if (scope[privateField] !== value) {
|
|
54
|
-
scope[privateField] = value;
|
|
55
|
-
ownerBinding(value);
|
|
56
|
-
if (cesium.defined(scope.definitionChanged)) {
|
|
57
|
-
scope.definitionChanged.raiseEvent(scope, field, value, previous);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
const EllipseRadarScanMaterialSource = "uniform vec4 color;\nuniform float speed;\n\n#define PI 3.14159265359\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n\n float dis = distance(st, vec2(0.5, 0.5));\n\n vec2 scrPt = st * 2.0 - 1.0;\n float time = czm_frameNumber * speed / 1000.0;\n mat2 rot;\n float theta = -time * 1.0 * PI - 2.2;\n float cosTheta, sinTheta;\n cosTheta = cos(theta);\n sinTheta = sin(theta);\n rot[0][0] = cosTheta;\n rot[0][1] = -sinTheta;\n rot[1][0] = sinTheta;\n rot[1][1] = cosTheta;\n vec2 scrPtRot = rot * scrPt;\n float angle = 1.0 - (atan(scrPtRot.y, scrPtRot.x) / 6.2831 + 0.5);\n float falloff = length(scrPtRot);\n material.alpha = pow(angle, 2.0) * falloff;\n material.diffuse = color.rgb;\n\n if(dis > 0.47) {\n float perDis = 0.5 / 1.0;\n float disNum;\n float bl = .0;\n for(int i = 0; i <= 9; i++) {\n if(float(i) <= 1.0) {\n disNum = perDis * float(i) - dis;\n if(disNum > 0.0) {\n if(disNum < perDis) {\n bl = 1.0 - disNum / perDis;\n } else if(disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n float alpha = 1.0 - (0.5 - dis) / 0.03;\n if(material.alpha < alpha) {\n material.alpha = alpha;\n }\n }\n }\n }\n }\n return material;\n}\n";
|
|
65
|
-
const EllipseRadarScanMaterialType = "EllipseRadarScan";
|
|
66
|
-
const EllipseRadarScanMaterialDefaultUniforms = {
|
|
67
|
-
color: cesium.Color.YELLOW,
|
|
68
|
-
speed: 10
|
|
69
|
-
};
|
|
70
|
-
addMaterialCache(EllipseRadarScanMaterialType, {
|
|
71
|
-
fabric: {
|
|
72
|
-
type: EllipseRadarScanMaterialType,
|
|
73
|
-
source: EllipseRadarScanMaterialSource,
|
|
74
|
-
uniforms: { ...EllipseRadarScanMaterialDefaultUniforms }
|
|
75
|
-
},
|
|
76
|
-
translucent(material) {
|
|
77
|
-
const uniforms = material.uniforms;
|
|
78
|
-
return uniforms.color.alpha < 1 || uniforms.color.alpha < 1;
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
class EllipseRadarScanMaterialProperty {
|
|
82
|
-
constructor(options = {}) {
|
|
83
|
-
__publicField(this, "color");
|
|
84
|
-
__publicField(this, "speed");
|
|
85
|
-
/**
|
|
86
|
-
* @internal
|
|
87
|
-
*/
|
|
88
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
89
|
-
createPropertyField(this, "color", options.color);
|
|
90
|
-
createPropertyField(this, "speed", options.speed);
|
|
91
|
-
}
|
|
92
|
-
get isConstant() {
|
|
93
|
-
return isCesiumConstant(this.color) && isCesiumConstant(this.speed);
|
|
94
|
-
}
|
|
95
|
-
getType(_time) {
|
|
96
|
-
return EllipseRadarScanMaterialType;
|
|
97
|
-
}
|
|
98
|
-
get definitionChanged() {
|
|
99
|
-
return this._definitionChanged;
|
|
100
|
-
}
|
|
101
|
-
getValue(time, result) {
|
|
102
|
-
const uniforms = EllipseRadarScanMaterialDefaultUniforms;
|
|
103
|
-
const data = Object.assign(result ?? {}, {
|
|
104
|
-
color: toPropertyValue(this.color, time) ?? uniforms.color,
|
|
105
|
-
speed: toPropertyValue(this.speed, time) ?? uniforms.speed
|
|
106
|
-
});
|
|
107
|
-
return data;
|
|
108
|
-
}
|
|
109
|
-
equals(other) {
|
|
110
|
-
return cesiumEquals(this.color, other == null ? void 0 : other.color) && cesiumEquals(this.speed, other == null ? void 0 : other.speed);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
const RadarScanMaterialSource = "uniform vec4 color;\nuniform float speed;\n\n#define PI 3.14159265359\n\n\n\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 scrPt = st * 2.0 - 1.0;\n float time = czm_frameNumber * speed / 1000.0;\n mat2 rot;\n float theta = -time * 1.0 * PI - 2.2;\n float cosTheta, sinTheta;\n cosTheta = cos(theta);\n sinTheta = sin(theta);\n rot[0][0] = cosTheta;\n rot[0][1] = -sinTheta;\n rot[1][0] = sinTheta;\n rot[1][1] = cosTheta;\n vec2 scrPtRot = rot * scrPt;\n float angle = 1.0 - (atan(scrPtRot.y, scrPtRot.x) / 6.2831 + 0.5);\n float falloff = length(scrPtRot);\n material.alpha = pow(angle, 2.0) * falloff;\n material.diffuse = color.rgb;\n return material;\n}\n";
|
|
114
|
-
const RadarScanMaterialType = "RadarScan";
|
|
115
|
-
const RadarScanMaterialDefaultUniforms = {
|
|
116
|
-
color: cesium.Color.YELLOW,
|
|
117
|
-
speed: 10
|
|
118
|
-
};
|
|
119
|
-
addMaterialCache(RadarScanMaterialType, {
|
|
120
|
-
fabric: {
|
|
121
|
-
type: RadarScanMaterialType,
|
|
122
|
-
source: RadarScanMaterialSource,
|
|
123
|
-
uniforms: { ...RadarScanMaterialDefaultUniforms }
|
|
124
|
-
},
|
|
125
|
-
translucent(material) {
|
|
126
|
-
const uniforms = material.uniforms;
|
|
127
|
-
return uniforms.color.alpha < 1 || uniforms.color.alpha < 1;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
class RadarScanMaterialProperty {
|
|
131
|
-
constructor(options = {}) {
|
|
132
|
-
__publicField(this, "color");
|
|
133
|
-
__publicField(this, "speed");
|
|
134
|
-
/**
|
|
135
|
-
* @internal
|
|
136
|
-
*/
|
|
137
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
138
|
-
createPropertyField(this, "color", options.color);
|
|
139
|
-
createPropertyField(this, "speed", options.speed);
|
|
140
|
-
}
|
|
141
|
-
get isConstant() {
|
|
142
|
-
return isCesiumConstant(this.color) && isCesiumConstant(this.speed);
|
|
143
|
-
}
|
|
144
|
-
getType(_time) {
|
|
145
|
-
return RadarScanMaterialType;
|
|
146
|
-
}
|
|
147
|
-
get definitionChanged() {
|
|
148
|
-
return this._definitionChanged;
|
|
149
|
-
}
|
|
150
|
-
getValue(time, result) {
|
|
151
|
-
const uniforms = RadarScanMaterialDefaultUniforms;
|
|
152
|
-
const data = Object.assign(result ?? {}, {
|
|
153
|
-
color: toPropertyValue(this.color, time) ?? uniforms.color,
|
|
154
|
-
speed: toPropertyValue(this.speed, time) ?? uniforms.speed
|
|
155
|
-
});
|
|
156
|
-
return data;
|
|
157
|
-
}
|
|
158
|
-
equals(other) {
|
|
159
|
-
return cesiumEquals(this.color, other == null ? void 0 : other.color) && cesiumEquals(this.speed, other == null ? void 0 : other.speed);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
const WaterRippleMaterialType = "WaterRipple";
|
|
163
|
-
const WaterRippleMaterialDefaultUniforms = {
|
|
164
|
-
baseWaterColor: new cesium.Color(0.2, 0.3, 0.6, 1),
|
|
165
|
-
blendColor: new cesium.Color(0, 1, 0.699, 1),
|
|
166
|
-
specularMap: cesium.Material.DefaultImageId,
|
|
167
|
-
normalMap: cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),
|
|
168
|
-
frequency: 1e4,
|
|
169
|
-
animationSpeed: 0.01,
|
|
170
|
-
amplitude: 1,
|
|
171
|
-
specularIntensity: 0.5,
|
|
172
|
-
fadeFactor: 1
|
|
173
|
-
};
|
|
174
|
-
const WaterRippleMaterial = getMaterialCache("Water");
|
|
175
|
-
addMaterialCache(WaterRippleMaterialType, {
|
|
176
|
-
fabric: {
|
|
177
|
-
type: WaterRippleMaterialType,
|
|
178
|
-
source: WaterRippleMaterial.fabric.source,
|
|
179
|
-
uniforms: { ...WaterRippleMaterialDefaultUniforms }
|
|
180
|
-
},
|
|
181
|
-
translucent(material) {
|
|
182
|
-
const uniforms = material.uniforms;
|
|
183
|
-
return uniforms.baseWaterColor.alpha < 1 || uniforms.blendColor.alpha < 1;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
class WaterRippleMaterialProperty {
|
|
187
|
-
constructor(options = {}) {
|
|
188
|
-
__publicField(this, "baseWaterColor");
|
|
189
|
-
__publicField(this, "blendColor");
|
|
190
|
-
__publicField(this, "specularMap");
|
|
191
|
-
__publicField(this, "normalMap");
|
|
192
|
-
__publicField(this, "frequency");
|
|
193
|
-
__publicField(this, "animationSpeed");
|
|
194
|
-
__publicField(this, "amplitude");
|
|
195
|
-
__publicField(this, "specularIntensity");
|
|
196
|
-
__publicField(this, "fadeFactor");
|
|
197
|
-
/**
|
|
198
|
-
* @internal
|
|
199
|
-
*/
|
|
200
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
201
|
-
createPropertyField(this, "baseWaterColor", options.baseWaterColor);
|
|
202
|
-
createPropertyField(this, "blendColor", options.blendColor);
|
|
203
|
-
createPropertyField(this, "specularMap", options.specularMap);
|
|
204
|
-
createPropertyField(this, "normalMap", options.normalMap);
|
|
205
|
-
createPropertyField(this, "frequency", options.frequency);
|
|
206
|
-
createPropertyField(this, "animationSpeed", options.animationSpeed);
|
|
207
|
-
createPropertyField(this, "amplitude", options.amplitude);
|
|
208
|
-
createPropertyField(this, "specularIntensity", options.specularIntensity);
|
|
209
|
-
createPropertyField(this, "fadeFactor", options.fadeFactor);
|
|
210
|
-
}
|
|
211
|
-
get isConstant() {
|
|
212
|
-
return isCesiumConstant(this.baseWaterColor) && isCesiumConstant(this.blendColor) && isCesiumConstant(this.specularMap) && isCesiumConstant(this.normalMap) && isCesiumConstant(this.frequency) && isCesiumConstant(this.animationSpeed) && isCesiumConstant(this.amplitude) && isCesiumConstant(this.specularIntensity) && isCesiumConstant(this.fadeFactor);
|
|
213
|
-
}
|
|
214
|
-
getType(_time) {
|
|
215
|
-
return WaterRippleMaterialType;
|
|
216
|
-
}
|
|
217
|
-
get definitionChanged() {
|
|
218
|
-
return this._definitionChanged;
|
|
219
|
-
}
|
|
220
|
-
getValue(time, result) {
|
|
221
|
-
const uniforms = WaterRippleMaterialDefaultUniforms;
|
|
222
|
-
const data = Object.assign(result ?? {}, {
|
|
223
|
-
baseWaterColor: toPropertyValue(this.baseWaterColor, time) ?? uniforms.baseWaterColor,
|
|
224
|
-
blendColor: toPropertyValue(this.blendColor, time) ?? uniforms.blendColor,
|
|
225
|
-
specularMap: toPropertyValue(this.specularMap, time) ?? uniforms.specularMap,
|
|
226
|
-
normalMap: toPropertyValue(this.normalMap, time) ?? uniforms.normalMap,
|
|
227
|
-
frequency: toPropertyValue(this.frequency, time) ?? uniforms.frequency,
|
|
228
|
-
animationSpeed: toPropertyValue(this.animationSpeed, time) ?? uniforms.animationSpeed,
|
|
229
|
-
amplitude: toPropertyValue(this.amplitude, time) ?? uniforms.amplitude,
|
|
230
|
-
specularIntensity: toPropertyValue(this.specularIntensity, time) ?? uniforms.specularIntensity,
|
|
231
|
-
fadeFactor: toPropertyValue(this.fadeFactor, time) ?? uniforms.fadeFactor
|
|
232
|
-
});
|
|
233
|
-
return data;
|
|
234
|
-
}
|
|
235
|
-
equals(other) {
|
|
236
|
-
return cesiumEquals(this.baseWaterColor, other == null ? void 0 : other.baseWaterColor) && cesiumEquals(this.blendColor, other == null ? void 0 : other.blendColor) && cesiumEquals(this.specularMap, other == null ? void 0 : other.specularMap) && cesiumEquals(this.normalMap, other == null ? void 0 : other.normalMap) && cesiumEquals(this.frequency, other == null ? void 0 : other.frequency) && cesiumEquals(this.animationSpeed, other == null ? void 0 : other.animationSpeed) && cesiumEquals(this.amplitude, other == null ? void 0 : other.amplitude) && cesiumEquals(this.specularIntensity, other == null ? void 0 : other.specularIntensity) && cesiumEquals(this.fadeFactor, other == null ? void 0 : other.fadeFactor);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
exports.EllipseRadarScanMaterialDefaultUniforms = EllipseRadarScanMaterialDefaultUniforms;
|
|
240
|
-
exports.EllipseRadarScanMaterialProperty = EllipseRadarScanMaterialProperty;
|
|
241
|
-
exports.EllipseRadarScanMaterialType = EllipseRadarScanMaterialType;
|
|
242
|
-
exports.RadarScanMaterialDefaultUniforms = RadarScanMaterialDefaultUniforms;
|
|
243
|
-
exports.RadarScanMaterialProperty = RadarScanMaterialProperty;
|
|
244
|
-
exports.RadarScanMaterialType = RadarScanMaterialType;
|
|
245
|
-
exports.WaterRippleMaterialDefaultUniforms = WaterRippleMaterialDefaultUniforms;
|
|
246
|
-
exports.WaterRippleMaterialProperty = WaterRippleMaterialProperty;
|
|
247
|
-
exports.WaterRippleMaterialType = WaterRippleMaterialType;
|
|
248
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.iife.js
CHANGED
|
@@ -1,250 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
"use strict";var __defProp = Object.defineProperty;
|
|
3
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
1
|
+
(function() {
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
function cesiumEquals(left, right) {
|
|
10
|
-
return left === right || isFunction(left == null ? void 0 : left.equals) && left.equals(right) || isFunction(right == null ? void 0 : right.equals) && right.equals(left);
|
|
11
|
-
}
|
|
12
|
-
function isCesiumConstant(value) {
|
|
13
|
-
return !cesium.defined(value) || !!value.isConstant;
|
|
14
|
-
}
|
|
15
|
-
function getMaterialCache(type) {
|
|
16
|
-
return cesium.Material._materialCache.getMaterial(type);
|
|
17
|
-
}
|
|
18
|
-
function addMaterialCache(type, material) {
|
|
19
|
-
return cesium.Material._materialCache.addMaterial(type, material);
|
|
20
|
-
}
|
|
21
|
-
function isProperty(value) {
|
|
22
|
-
return value && isFunction(value.getValue);
|
|
23
|
-
}
|
|
24
|
-
function toPropertyValue(value, time) {
|
|
25
|
-
return isProperty(value) ? value.getValue(time) : value;
|
|
26
|
-
}
|
|
27
|
-
function toProperty(value, isConstant = false) {
|
|
28
|
-
return isProperty(value) ? value : isFunction(value) ? new cesium.CallbackProperty(value, isConstant) : new cesium.ConstantProperty(value);
|
|
29
|
-
}
|
|
30
|
-
function createPropertyField(scope, field, maybeProperty, readonly) {
|
|
31
|
-
let removeOwnerListener;
|
|
32
|
-
const ownerBinding = (value) => {
|
|
33
|
-
var _a;
|
|
34
|
-
removeOwnerListener == null ? void 0 : removeOwnerListener();
|
|
35
|
-
if (cesium.defined(value == null ? void 0 : value.definitionChanged)) {
|
|
36
|
-
removeOwnerListener = (_a = value == null ? void 0 : value.definitionChanged) == null ? void 0 : _a.addEventListener(() => {
|
|
37
|
-
scope.definitionChanged.raiseEvent(scope, field, value, value);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
const privateField = `_${field}`;
|
|
42
|
-
const property = toProperty(maybeProperty);
|
|
43
|
-
scope[privateField] = property;
|
|
44
|
-
ownerBinding(property);
|
|
45
|
-
{
|
|
46
|
-
Object.defineProperty(scope, field, {
|
|
47
|
-
get() {
|
|
48
|
-
return scope[privateField];
|
|
49
|
-
},
|
|
50
|
-
set(value) {
|
|
51
|
-
const previous = scope[privateField];
|
|
52
|
-
if (scope[privateField] !== value) {
|
|
53
|
-
scope[privateField] = value;
|
|
54
|
-
ownerBinding(value);
|
|
55
|
-
if (cesium.defined(scope.definitionChanged)) {
|
|
56
|
-
scope.definitionChanged.raiseEvent(scope, field, value, previous);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
const EllipseRadarScanMaterialSource = "uniform vec4 color;\nuniform float speed;\n\n#define PI 3.14159265359\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n\n float dis = distance(st, vec2(0.5, 0.5));\n\n vec2 scrPt = st * 2.0 - 1.0;\n float time = czm_frameNumber * speed / 1000.0;\n mat2 rot;\n float theta = -time * 1.0 * PI - 2.2;\n float cosTheta, sinTheta;\n cosTheta = cos(theta);\n sinTheta = sin(theta);\n rot[0][0] = cosTheta;\n rot[0][1] = -sinTheta;\n rot[1][0] = sinTheta;\n rot[1][1] = cosTheta;\n vec2 scrPtRot = rot * scrPt;\n float angle = 1.0 - (atan(scrPtRot.y, scrPtRot.x) / 6.2831 + 0.5);\n float falloff = length(scrPtRot);\n material.alpha = pow(angle, 2.0) * falloff;\n material.diffuse = color.rgb;\n\n if(dis > 0.47) {\n float perDis = 0.5 / 1.0;\n float disNum;\n float bl = .0;\n for(int i = 0; i <= 9; i++) {\n if(float(i) <= 1.0) {\n disNum = perDis * float(i) - dis;\n if(disNum > 0.0) {\n if(disNum < perDis) {\n bl = 1.0 - disNum / perDis;\n } else if(disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n float alpha = 1.0 - (0.5 - dis) / 0.03;\n if(material.alpha < alpha) {\n material.alpha = alpha;\n }\n }\n }\n }\n }\n return material;\n}\n";
|
|
64
|
-
const EllipseRadarScanMaterialType = "EllipseRadarScan";
|
|
65
|
-
const EllipseRadarScanMaterialDefaultUniforms = {
|
|
66
|
-
color: cesium.Color.YELLOW,
|
|
67
|
-
speed: 10
|
|
68
|
-
};
|
|
69
|
-
addMaterialCache(EllipseRadarScanMaterialType, {
|
|
70
|
-
fabric: {
|
|
71
|
-
type: EllipseRadarScanMaterialType,
|
|
72
|
-
source: EllipseRadarScanMaterialSource,
|
|
73
|
-
uniforms: { ...EllipseRadarScanMaterialDefaultUniforms }
|
|
74
|
-
},
|
|
75
|
-
translucent(material) {
|
|
76
|
-
const uniforms = material.uniforms;
|
|
77
|
-
return uniforms.color.alpha < 1 || uniforms.color.alpha < 1;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
class EllipseRadarScanMaterialProperty {
|
|
81
|
-
constructor(options = {}) {
|
|
82
|
-
__publicField(this, "color");
|
|
83
|
-
__publicField(this, "speed");
|
|
84
|
-
/**
|
|
85
|
-
* @internal
|
|
86
|
-
*/
|
|
87
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
88
|
-
createPropertyField(this, "color", options.color);
|
|
89
|
-
createPropertyField(this, "speed", options.speed);
|
|
90
|
-
}
|
|
91
|
-
get isConstant() {
|
|
92
|
-
return isCesiumConstant(this.color) && isCesiumConstant(this.speed);
|
|
93
|
-
}
|
|
94
|
-
getType(_time) {
|
|
95
|
-
return EllipseRadarScanMaterialType;
|
|
96
|
-
}
|
|
97
|
-
get definitionChanged() {
|
|
98
|
-
return this._definitionChanged;
|
|
99
|
-
}
|
|
100
|
-
getValue(time, result) {
|
|
101
|
-
const uniforms = EllipseRadarScanMaterialDefaultUniforms;
|
|
102
|
-
const data = Object.assign(result ?? {}, {
|
|
103
|
-
color: toPropertyValue(this.color, time) ?? uniforms.color,
|
|
104
|
-
speed: toPropertyValue(this.speed, time) ?? uniforms.speed
|
|
105
|
-
});
|
|
106
|
-
return data;
|
|
107
|
-
}
|
|
108
|
-
equals(other) {
|
|
109
|
-
return cesiumEquals(this.color, other == null ? void 0 : other.color) && cesiumEquals(this.speed, other == null ? void 0 : other.speed);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const RadarScanMaterialSource = "uniform vec4 color;\nuniform float speed;\n\n#define PI 3.14159265359\n\n\n\n\nczm_material czm_getMaterial(czm_materialInput materialInput) {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec2 scrPt = st * 2.0 - 1.0;\n float time = czm_frameNumber * speed / 1000.0;\n mat2 rot;\n float theta = -time * 1.0 * PI - 2.2;\n float cosTheta, sinTheta;\n cosTheta = cos(theta);\n sinTheta = sin(theta);\n rot[0][0] = cosTheta;\n rot[0][1] = -sinTheta;\n rot[1][0] = sinTheta;\n rot[1][1] = cosTheta;\n vec2 scrPtRot = rot * scrPt;\n float angle = 1.0 - (atan(scrPtRot.y, scrPtRot.x) / 6.2831 + 0.5);\n float falloff = length(scrPtRot);\n material.alpha = pow(angle, 2.0) * falloff;\n material.diffuse = color.rgb;\n return material;\n}\n";
|
|
113
|
-
const RadarScanMaterialType = "RadarScan";
|
|
114
|
-
const RadarScanMaterialDefaultUniforms = {
|
|
115
|
-
color: cesium.Color.YELLOW,
|
|
116
|
-
speed: 10
|
|
117
|
-
};
|
|
118
|
-
addMaterialCache(RadarScanMaterialType, {
|
|
119
|
-
fabric: {
|
|
120
|
-
type: RadarScanMaterialType,
|
|
121
|
-
source: RadarScanMaterialSource,
|
|
122
|
-
uniforms: { ...RadarScanMaterialDefaultUniforms }
|
|
123
|
-
},
|
|
124
|
-
translucent(material) {
|
|
125
|
-
const uniforms = material.uniforms;
|
|
126
|
-
return uniforms.color.alpha < 1 || uniforms.color.alpha < 1;
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
class RadarScanMaterialProperty {
|
|
130
|
-
constructor(options = {}) {
|
|
131
|
-
__publicField(this, "color");
|
|
132
|
-
__publicField(this, "speed");
|
|
133
|
-
/**
|
|
134
|
-
* @internal
|
|
135
|
-
*/
|
|
136
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
137
|
-
createPropertyField(this, "color", options.color);
|
|
138
|
-
createPropertyField(this, "speed", options.speed);
|
|
139
|
-
}
|
|
140
|
-
get isConstant() {
|
|
141
|
-
return isCesiumConstant(this.color) && isCesiumConstant(this.speed);
|
|
142
|
-
}
|
|
143
|
-
getType(_time) {
|
|
144
|
-
return RadarScanMaterialType;
|
|
145
|
-
}
|
|
146
|
-
get definitionChanged() {
|
|
147
|
-
return this._definitionChanged;
|
|
148
|
-
}
|
|
149
|
-
getValue(time, result) {
|
|
150
|
-
const uniforms = RadarScanMaterialDefaultUniforms;
|
|
151
|
-
const data = Object.assign(result ?? {}, {
|
|
152
|
-
color: toPropertyValue(this.color, time) ?? uniforms.color,
|
|
153
|
-
speed: toPropertyValue(this.speed, time) ?? uniforms.speed
|
|
154
|
-
});
|
|
155
|
-
return data;
|
|
156
|
-
}
|
|
157
|
-
equals(other) {
|
|
158
|
-
return cesiumEquals(this.color, other == null ? void 0 : other.color) && cesiumEquals(this.speed, other == null ? void 0 : other.speed);
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
const WaterRippleMaterialType = "WaterRipple";
|
|
162
|
-
const WaterRippleMaterialDefaultUniforms = {
|
|
163
|
-
baseWaterColor: new cesium.Color(0.2, 0.3, 0.6, 1),
|
|
164
|
-
blendColor: new cesium.Color(0, 1, 0.699, 1),
|
|
165
|
-
specularMap: cesium.Material.DefaultImageId,
|
|
166
|
-
normalMap: cesium.buildModuleUrl("Assets/Textures/waterNormals.jpg"),
|
|
167
|
-
frequency: 1e4,
|
|
168
|
-
animationSpeed: 0.01,
|
|
169
|
-
amplitude: 1,
|
|
170
|
-
specularIntensity: 0.5,
|
|
171
|
-
fadeFactor: 1
|
|
172
|
-
};
|
|
173
|
-
const WaterRippleMaterial = getMaterialCache("Water");
|
|
174
|
-
addMaterialCache(WaterRippleMaterialType, {
|
|
175
|
-
fabric: {
|
|
176
|
-
type: WaterRippleMaterialType,
|
|
177
|
-
source: WaterRippleMaterial.fabric.source,
|
|
178
|
-
uniforms: { ...WaterRippleMaterialDefaultUniforms }
|
|
179
|
-
},
|
|
180
|
-
translucent(material) {
|
|
181
|
-
const uniforms = material.uniforms;
|
|
182
|
-
return uniforms.baseWaterColor.alpha < 1 || uniforms.blendColor.alpha < 1;
|
|
183
|
-
}
|
|
184
|
-
});
|
|
185
|
-
class WaterRippleMaterialProperty {
|
|
186
|
-
constructor(options = {}) {
|
|
187
|
-
__publicField(this, "baseWaterColor");
|
|
188
|
-
__publicField(this, "blendColor");
|
|
189
|
-
__publicField(this, "specularMap");
|
|
190
|
-
__publicField(this, "normalMap");
|
|
191
|
-
__publicField(this, "frequency");
|
|
192
|
-
__publicField(this, "animationSpeed");
|
|
193
|
-
__publicField(this, "amplitude");
|
|
194
|
-
__publicField(this, "specularIntensity");
|
|
195
|
-
__publicField(this, "fadeFactor");
|
|
196
|
-
/**
|
|
197
|
-
* @internal
|
|
198
|
-
*/
|
|
199
|
-
__publicField(this, "_definitionChanged", new cesium.Event());
|
|
200
|
-
createPropertyField(this, "baseWaterColor", options.baseWaterColor);
|
|
201
|
-
createPropertyField(this, "blendColor", options.blendColor);
|
|
202
|
-
createPropertyField(this, "specularMap", options.specularMap);
|
|
203
|
-
createPropertyField(this, "normalMap", options.normalMap);
|
|
204
|
-
createPropertyField(this, "frequency", options.frequency);
|
|
205
|
-
createPropertyField(this, "animationSpeed", options.animationSpeed);
|
|
206
|
-
createPropertyField(this, "amplitude", options.amplitude);
|
|
207
|
-
createPropertyField(this, "specularIntensity", options.specularIntensity);
|
|
208
|
-
createPropertyField(this, "fadeFactor", options.fadeFactor);
|
|
209
|
-
}
|
|
210
|
-
get isConstant() {
|
|
211
|
-
return isCesiumConstant(this.baseWaterColor) && isCesiumConstant(this.blendColor) && isCesiumConstant(this.specularMap) && isCesiumConstant(this.normalMap) && isCesiumConstant(this.frequency) && isCesiumConstant(this.animationSpeed) && isCesiumConstant(this.amplitude) && isCesiumConstant(this.specularIntensity) && isCesiumConstant(this.fadeFactor);
|
|
212
|
-
}
|
|
213
|
-
getType(_time) {
|
|
214
|
-
return WaterRippleMaterialType;
|
|
215
|
-
}
|
|
216
|
-
get definitionChanged() {
|
|
217
|
-
return this._definitionChanged;
|
|
218
|
-
}
|
|
219
|
-
getValue(time, result) {
|
|
220
|
-
const uniforms = WaterRippleMaterialDefaultUniforms;
|
|
221
|
-
const data = Object.assign(result ?? {}, {
|
|
222
|
-
baseWaterColor: toPropertyValue(this.baseWaterColor, time) ?? uniforms.baseWaterColor,
|
|
223
|
-
blendColor: toPropertyValue(this.blendColor, time) ?? uniforms.blendColor,
|
|
224
|
-
specularMap: toPropertyValue(this.specularMap, time) ?? uniforms.specularMap,
|
|
225
|
-
normalMap: toPropertyValue(this.normalMap, time) ?? uniforms.normalMap,
|
|
226
|
-
frequency: toPropertyValue(this.frequency, time) ?? uniforms.frequency,
|
|
227
|
-
animationSpeed: toPropertyValue(this.animationSpeed, time) ?? uniforms.animationSpeed,
|
|
228
|
-
amplitude: toPropertyValue(this.amplitude, time) ?? uniforms.amplitude,
|
|
229
|
-
specularIntensity: toPropertyValue(this.specularIntensity, time) ?? uniforms.specularIntensity,
|
|
230
|
-
fadeFactor: toPropertyValue(this.fadeFactor, time) ?? uniforms.fadeFactor
|
|
231
|
-
});
|
|
232
|
-
return data;
|
|
233
|
-
}
|
|
234
|
-
equals(other) {
|
|
235
|
-
return cesiumEquals(this.baseWaterColor, other == null ? void 0 : other.baseWaterColor) && cesiumEquals(this.blendColor, other == null ? void 0 : other.blendColor) && cesiumEquals(this.specularMap, other == null ? void 0 : other.specularMap) && cesiumEquals(this.normalMap, other == null ? void 0 : other.normalMap) && cesiumEquals(this.frequency, other == null ? void 0 : other.frequency) && cesiumEquals(this.animationSpeed, other == null ? void 0 : other.animationSpeed) && cesiumEquals(this.amplitude, other == null ? void 0 : other.amplitude) && cesiumEquals(this.specularIntensity, other == null ? void 0 : other.specularIntensity) && cesiumEquals(this.fadeFactor, other == null ? void 0 : other.fadeFactor);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
exports.EllipseRadarScanMaterialDefaultUniforms = EllipseRadarScanMaterialDefaultUniforms;
|
|
239
|
-
exports.EllipseRadarScanMaterialProperty = EllipseRadarScanMaterialProperty;
|
|
240
|
-
exports.EllipseRadarScanMaterialType = EllipseRadarScanMaterialType;
|
|
241
|
-
exports.RadarScanMaterialDefaultUniforms = RadarScanMaterialDefaultUniforms;
|
|
242
|
-
exports.RadarScanMaterialProperty = RadarScanMaterialProperty;
|
|
243
|
-
exports.RadarScanMaterialType = RadarScanMaterialType;
|
|
244
|
-
exports.WaterRippleMaterialDefaultUniforms = WaterRippleMaterialDefaultUniforms;
|
|
245
|
-
exports.WaterRippleMaterialProperty = WaterRippleMaterialProperty;
|
|
246
|
-
exports.WaterRippleMaterialType = WaterRippleMaterialType;
|
|
247
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
248
|
-
return exports;
|
|
249
|
-
}({}, Cesium);
|
|
250
|
-
//# sourceMappingURL=index.iife.js.map
|
|
3
|
+
|
|
4
|
+
})();
|