cesium_dev_kit 1.0.53 → 1.0.55
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 +28 -90
- package/dist/index.js +52 -52
- package/dist/index.min.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,68 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
## cesium_dev_kit
|
|
2
|
+
|
|
3
|
+
<p align="left">
|
|
2
4
|
<a href="https://npmjs.com/package/node"><img src="https://img.shields.io/node/v/vite.svg" alt="node compatility"></a>
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<a href="https://npmjs.com/package/vite"><img src="https://img.shields.io/badge/vite-v2.6.10-blue" alt="vite package"></a>
|
|
6
|
-
<a href="https://jestjs.io"><img src="https://github.com/openlayers/openlayers/workflows/Test/badge.svg" alt="Test Status"></a>
|
|
5
|
+
<a href="https://www.npmjs.com/package/cesium_dev_kit"><img src="https://img.shields.io/npm/v/cesium_dev_kit.svg" alt="npm"></a>
|
|
6
|
+
<a href="https://www.npmjs.com/package/cesium_dev_kit"><img src="https://img.shields.io/npm/dt/cesium_dev_kit.svg" alt="downloads"></a>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
-
## cesium_dev_kit
|
|
10
|
-
|
|
11
9
|
## 简介
|
|
12
10
|
|
|
13
11
|
旨在封装一个 Cesium 基本操作的工具包,提供简单的方法调用来实现复杂的 API 操作;达到节省阅读 Cesium 原文档时间,从而降低入门难度提升学习信心,同时也希望能提高工作效率减少重复劳动;案例中封装了常用功能配备使用案例,npm 安装后可以直接在项目中使用。
|
|
14
12
|
|
|
15
|
-
##
|
|
16
|
-
|
|
17
|
-
```md
|
|
18
|
-
├── public # 静态资源
|
|
19
|
-
│ ├── static # 模型文件
|
|
20
|
-
│ │ ├── data # 3dtiles 及 model
|
|
21
|
-
| └── favicon.ico # favicon 图标
|
|
22
|
-
├── src # 源代码
|
|
23
|
-
| ├── api # api 请求
|
|
24
|
-
| ├── assets # 主题 变量等资源
|
|
25
|
-
| | ├── scss # scss 变量
|
|
26
|
-
| | └──theme # elemet 主题
|
|
27
|
-
| ├── libs
|
|
28
|
-
| | ├── directive # 全局指令
|
|
29
|
-
| | └──element.ts # elemet 全局样式重写
|
|
30
|
-
| ├──components # 全局公共组件
|
|
31
|
-
| ├──hooks # 全局 hooks
|
|
32
|
-
| ├── config # 全局公共配置
|
|
33
|
-
| ├── layout # 全局 layout
|
|
34
|
-
| ├── locale # 国际化
|
|
35
|
-
| ├── plugin # 三方插件
|
|
36
|
-
| ├── router # 全局路由
|
|
37
|
-
| ├── store # 全局 vuex
|
|
38
|
-
| ├── utils # 全局公用方法
|
|
39
|
-
| | └──cesiumPluginsExtends # cesium 扩展工具包
|
|
40
|
-
| ├── views # 所有页面
|
|
41
|
-
| | └──example # cesium 扩展工具包案例
|
|
42
|
-
| ├── App.tsx # 入口页面
|
|
43
|
-
| ├── main.ts # 入口文件
|
|
44
|
-
| ├── permission.ts #权限认证
|
|
45
|
-
| └── shims-vue.d.ts # ts 声明文件
|
|
46
|
-
├── static # 静态资源
|
|
47
|
-
| ├── img # img
|
|
48
|
-
| └── svg # svg
|
|
49
|
-
├── .editorconfig # editorconfig
|
|
50
|
-
├── .env.development # 环境变量 开发
|
|
51
|
-
├── .env.production # 环境变量 生产
|
|
52
|
-
├── .eslintignore # eslintignore
|
|
53
|
-
├── .eslintrc.js # eslint 配置项
|
|
54
|
-
├── .gitignore # gitignore
|
|
55
|
-
├── .babelrc # babel 配置项
|
|
56
|
-
├── index.html # html 模板
|
|
57
|
-
├── package.json # package.json
|
|
58
|
-
├── README.md # README
|
|
59
|
-
├── tsconfig.json # tsconfig
|
|
60
|
-
└── vite.config.ts # vite 配置文件
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
##
|
|
64
|
-
|
|
65
|
-
## 项目演示
|
|
13
|
+
## 功能展示
|
|
66
14
|
|
|
67
15
|
- 材质
|
|
68
16
|

|
|
@@ -79,27 +27,23 @@
|
|
|
79
27
|
|
|
80
28
|
[https://www.benpaodehenji.com/cesiumDevKit](https://www.benpaodehenji.com/cesiumDevKit)
|
|
81
29
|
|
|
82
|
-
##
|
|
30
|
+
## 安装
|
|
83
31
|
|
|
84
|
-
|
|
32
|
+
```shell
|
|
85
33
|
|
|
86
|
-
|
|
87
|
-
c:\> git clone https://github.com/dengxiaoning/cesium_dev_kit.git
|
|
88
|
-
c:\> cd cesium_dev_kit
|
|
89
|
-
c:\> npm install
|
|
90
|
-
c:\> npm run dev
|
|
34
|
+
npm install cesium_dev_kit
|
|
91
35
|
|
|
92
36
|
```
|
|
93
37
|
|
|
94
|
-
|
|
38
|
+
## 引入
|
|
95
39
|
|
|
96
|
-
```
|
|
40
|
+
```
|
|
97
41
|
|
|
98
|
-
|
|
42
|
+
import { initCesium } from 'cesium_dev_kit'
|
|
99
43
|
|
|
100
44
|
```
|
|
101
45
|
|
|
102
|
-
|
|
46
|
+
## 使用
|
|
103
47
|
|
|
104
48
|
```javaScript
|
|
105
49
|
// test.vue
|
|
@@ -148,7 +92,17 @@ export default {
|
|
|
148
92
|
</script>
|
|
149
93
|
```
|
|
150
94
|
|
|
151
|
-
|
|
95
|
+
## API
|
|
96
|
+
|
|
97
|
+
### initCesium
|
|
98
|
+
|
|
99
|
+
**参数**
|
|
100
|
+
|
|
101
|
+
- `cesiumGlobal` **Object** Ceiusm 对象
|
|
102
|
+
- `containerId` **String** 容器 id
|
|
103
|
+
- `viewerConfig` **Object** viewer 基础配置(与官网一致)
|
|
104
|
+
- `extreaConfig` **Object** 额外参数配置,如 {logo:true// 是否显示 logo, depthTest:true //开启深度检测}
|
|
105
|
+
- `MapImageryList` **Object** 配置底图,参考 ImageryProvider
|
|
152
106
|
|
|
153
107
|
```javaScript
|
|
154
108
|
/**
|
|
@@ -189,7 +143,7 @@ export default {
|
|
|
189
143
|
*/
|
|
190
144
|
```
|
|
191
145
|
|
|
192
|
-
|
|
146
|
+
## 使用范例
|
|
193
147
|
|
|
194
148
|
[https://github.com/dengxiaoning/cesium_kit_test](https://github.com/dengxiaoning/cesium_kit_test)这是一个 vue 项目已安装 cesium_dev_kit,其中有使用 demo,可直接下载到本地运行查看参照
|
|
195
149
|
|
|
@@ -201,29 +155,13 @@ export default {
|
|
|
201
155
|
|
|
202
156
|
支持现代(chrome,Firefox,Microsoft edge,etc.)浏览器, 不支持 IE
|
|
203
157
|
|
|
204
|
-
## CesiumGlsl 文档
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
https://cesium.com/downloads/cesiumjs/releases/b23/Documentation/index.html
|
|
208
|
-
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
## iconify 使用方法
|
|
212
|
-
|
|
213
|
-
[官网 https://icon-sets.iconify.design](https://icon-sets.iconify.design)
|
|
214
|
-
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
<CIcon icon-class="bx:time-five" icon-color="#333" />
|
|
218
|
-
|
|
219
|
-
```
|
|
220
|
-
|
|
221
158
|
## 鸣谢
|
|
222
159
|
|
|
223
160
|
[cesium-d3kit](https://github.com/zhangti0708/cesium-d3kit)<br/>
|
|
224
161
|
[drawarrowforcesium](https://gitcode.net/mirrors/gitgitczl/drawarrowforcesium)<br/>
|
|
225
162
|
[vue3-ts-cesium-map-show](https://gitee.com/hawk86104/vue3-ts-cesium-map-show)<br/>
|
|
226
|
-
|
|
163
|
+
|
|
164
|
+
本项目包括但不限于借鉴和参考以上资料,非常感谢作者分享
|
|
227
165
|
|
|
228
166
|
## 项目不足与优化
|
|
229
167
|
|
|
@@ -231,4 +169,4 @@ https://cesium.com/downloads/cesiumjs/releases/b23/Documentation/index.html
|
|
|
231
169
|
- 2、未配备使用文档(请参考案例)
|
|
232
170
|
- 3、未作异常捕捉和处理
|
|
233
171
|
|
|
234
|
-
<small
|
|
172
|
+
<small>感兴趣朋友可以一起讨论交流继续完善功能,让工作效率更高、开发更加容易、生活更加惬意。</small>
|
package/dist/index.js
CHANGED
|
@@ -1565,10 +1565,10 @@ Shaders.prototype = {
|
|
|
1565
1565
|
czm_material material = czm_getDefaultMaterial(materialInput);\n\
|
|
1566
1566
|
vec2 st = materialInput.st;\n\
|
|
1567
1567
|
\n\
|
|
1568
|
-
if(
|
|
1568
|
+
if(texture(image, vec2(0.0, 0.0)).a == 1.0){\n\
|
|
1569
1569
|
discard;\n\
|
|
1570
1570
|
}else{\n\
|
|
1571
|
-
material.alpha =
|
|
1571
|
+
material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;\n\
|
|
1572
1572
|
}\n\
|
|
1573
1573
|
\n\
|
|
1574
1574
|
material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n\
|
|
@@ -1586,7 +1586,7 @@ Shaders.prototype = {
|
|
|
1586
1586
|
czm_material material = czm_getDefaultMaterial(materialInput);\n\
|
|
1587
1587
|
vec2 st = materialInput.st;\n\
|
|
1588
1588
|
\n\
|
|
1589
|
-
vec4 colorImage =
|
|
1589
|
+
vec4 colorImage = texture(image, vec2(fract(1.0 *st.s - time), fract(st.t)));\n\
|
|
1590
1590
|
\n\
|
|
1591
1591
|
vec4 fragColor;\n\
|
|
1592
1592
|
fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n\
|
|
@@ -1599,7 +1599,7 @@ Shaders.prototype = {
|
|
|
1599
1599
|
}\n\
|
|
1600
1600
|
';
|
|
1601
1601
|
// material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n\
|
|
1602
|
-
// material.alpha =
|
|
1602
|
+
// material.alpha = texture(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;\n\
|
|
1603
1603
|
}
|
|
1604
1604
|
},
|
|
1605
1605
|
|
|
@@ -1617,11 +1617,11 @@ Shaders.prototype = {
|
|
|
1617
1617
|
if (options.freely == 'vertical') {
|
|
1618
1618
|
//(由下到上)
|
|
1619
1619
|
|
|
1620
|
-
materail += 'vec4 colorImage =
|
|
1620
|
+
materail += 'vec4 colorImage = texture(image, vec2(fract(float(' + options.count + ')*st.t ' + options.direction + ' time), fract(st.s)));\n ';
|
|
1621
1621
|
} else {
|
|
1622
1622
|
//(逆时针)
|
|
1623
1623
|
|
|
1624
|
-
materail += 'vec4 colorImage =
|
|
1624
|
+
materail += 'vec4 colorImage = texture(image, vec2(fract(float(' + options.count + ')*st.s ' + options.direction + ' time), fract(st.t)));\n ';
|
|
1625
1625
|
}
|
|
1626
1626
|
//泛光
|
|
1627
1627
|
materail += 'vec4 fragColor;\n\
|
|
@@ -1705,7 +1705,7 @@ Shaders.prototype = {
|
|
|
1705
1705
|
if (options && options.get) {
|
|
1706
1706
|
return 'uniform sampler2D colorTexture;\n\
|
|
1707
1707
|
uniform sampler2D depthTexture;\n\
|
|
1708
|
-
|
|
1708
|
+
out vec2 v_textureCoordinates;\n\
|
|
1709
1709
|
uniform vec4 u_scanCenterEC;\n\
|
|
1710
1710
|
uniform vec3 u_scanPlaneNormalEC;\n\
|
|
1711
1711
|
uniform vec3 u_scanLineNormalEC;\n\
|
|
@@ -1747,8 +1747,8 @@ Shaders.prototype = {
|
|
|
1747
1747
|
}\n\
|
|
1748
1748
|
\n\
|
|
1749
1749
|
void main(){\n\
|
|
1750
|
-
gl_FragColor =
|
|
1751
|
-
float depth = getDepth(
|
|
1750
|
+
gl_FragColor = texture(colorTexture, v_textureCoordinates);\n\
|
|
1751
|
+
float depth = getDepth( texture(depthTexture, v_textureCoordinates));\n\
|
|
1752
1752
|
vec4 viewPos = toEye(v_textureCoordinates, depth);\n\
|
|
1753
1753
|
vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n\
|
|
1754
1754
|
float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n\
|
|
@@ -1778,7 +1778,7 @@ Shaders.prototype = {
|
|
|
1778
1778
|
if (options && options.get) {
|
|
1779
1779
|
return 'uniform sampler2D colorTexture;\n\
|
|
1780
1780
|
uniform sampler2D depthTexture;\n\
|
|
1781
|
-
|
|
1781
|
+
out vec2 v_textureCoordinates;\n\
|
|
1782
1782
|
uniform vec4 u_scanCenterEC;\n\
|
|
1783
1783
|
uniform vec3 u_scanPlaneNormalEC;\n\
|
|
1784
1784
|
uniform float u_radius;\n\
|
|
@@ -1806,8 +1806,8 @@ Shaders.prototype = {
|
|
|
1806
1806
|
}\n\
|
|
1807
1807
|
\n\
|
|
1808
1808
|
void main(){\n\
|
|
1809
|
-
gl_FragColor =
|
|
1810
|
-
float depth = getDepth(
|
|
1809
|
+
gl_FragColor = texture(colorTexture, v_textureCoordinates);\n\
|
|
1810
|
+
float depth = getDepth(texture(depthTexture, v_textureCoordinates));\n\
|
|
1811
1811
|
vec4 viewPos = toEye(v_textureCoordinates, depth);\n\
|
|
1812
1812
|
vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n\
|
|
1813
1813
|
float dis = length(prjOnPlane.xyz - u_scanCenterEC.xyz);\n\
|
|
@@ -1940,7 +1940,7 @@ Base.prototype = {
|
|
|
1940
1940
|
//黑夜特效
|
|
1941
1941
|
setDarkEffect: function (options) {
|
|
1942
1942
|
options = options || {};
|
|
1943
|
-
var fs = 'uniform sampler2D colorTexture;\n' + '
|
|
1943
|
+
var fs = 'uniform sampler2D colorTexture;\n' + 'out vec2 v_textureCoordinates;\n' + 'uniform float scale;\n' + 'uniform vec3 offset;\n' + 'void main() {\n' + ' // vec4 color = texture(colorTexture, v_textureCoordinates);\n' + ' vec4 color = texture(colorTexture, v_textureCoordinates);\n' + ' // float gray = 0.2989*color.r+0.5870*color.g+0.1140*color.b;\n' + ' // gl_FragColor = vec4(gray,gray,2.0*(gray+1.0), 1.0);\n' + ' gl_FragColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);\n' + '}\n';
|
|
1944
1944
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
1945
1945
|
name: 'darkEffect',
|
|
1946
1946
|
fragmentShader: fs,
|
|
@@ -1955,7 +1955,7 @@ Base.prototype = {
|
|
|
1955
1955
|
// 场景蓝光
|
|
1956
1956
|
setBlurBloom: function (options) {
|
|
1957
1957
|
if (this._viewer && options) {
|
|
1958
|
-
var fs = 'uniform float height;\n' + 'uniform float width;\n' + 'uniform sampler2D colorTexture1;\n' + '\n' + '
|
|
1958
|
+
var fs = 'uniform float height;\n' + 'uniform float width;\n' + 'uniform sampler2D colorTexture1;\n' + '\n' + 'out vec2 v_textureCoordinates;\n' + '\n' + 'const int SAMPLES = 9;\n' + 'void main()\n' + '{\n' + 'vec2 st = v_textureCoordinates;\n' + 'float wr = float(1.0 / width);\n' + 'float hr = float(1.0 / height);\n' + 'vec4 result = vec4(0.0);\n' + 'int count = 0;\n' + 'for(int i = -SAMPLES; i <= SAMPLES; ++i){\n' + 'for(int j = -SAMPLES; j <= SAMPLES; ++j){\n' + 'vec2 offset = vec2(float(i) * wr, float(j) * hr);\n' + 'result += texture(colorTexture1, st + offset);\n' + '}\n' + '}\n' + 'result = result / float(count);\n' + 'gl_FragColor = result;\n' + '}\n';
|
|
1959
1959
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
1960
1960
|
name: 'blur_x_direction',
|
|
1961
1961
|
fragmentShader: fs,
|
|
@@ -1971,7 +1971,7 @@ Base.prototype = {
|
|
|
1971
1971
|
setRainEffect: function () {
|
|
1972
1972
|
if (this._viewer) {
|
|
1973
1973
|
var fs = 'uniform sampler2D colorTexture;\n\
|
|
1974
|
-
|
|
1974
|
+
out vec2 v_textureCoordinates;\n\
|
|
1975
1975
|
\n\
|
|
1976
1976
|
float hash(float x){\n\
|
|
1977
1977
|
return fract(sin(x*23.3)*13.13);\n\
|
|
@@ -1989,7 +1989,7 @@ Base.prototype = {
|
|
|
1989
1989
|
float v=1.-sin(hash(floor(uv.x*100.))*2.);\n\
|
|
1990
1990
|
float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n\
|
|
1991
1991
|
c*=v*b;\n\
|
|
1992
|
-
gl_FragColor = mix(
|
|
1992
|
+
gl_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);\n\
|
|
1993
1993
|
}\n\
|
|
1994
1994
|
';
|
|
1995
1995
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
@@ -2002,7 +2002,7 @@ Base.prototype = {
|
|
|
2002
2002
|
setSnowEffect: function () {
|
|
2003
2003
|
if (this._viewer) {
|
|
2004
2004
|
var fs = 'uniform sampler2D colorTexture;\n\
|
|
2005
|
-
|
|
2005
|
+
out vec2 v_textureCoordinates;\n\
|
|
2006
2006
|
\n\
|
|
2007
2007
|
float snow(vec2 uv,float scale){\n\
|
|
2008
2008
|
float time = czm_frameNumber / 60.0;\n\
|
|
@@ -2034,7 +2034,7 @@ Base.prototype = {
|
|
|
2034
2034
|
c+=snow(uv,6.);\n\
|
|
2035
2035
|
c+=snow(uv,5.);\n\
|
|
2036
2036
|
finalColor=(vec3(c));\n\
|
|
2037
|
-
gl_FragColor = mix(
|
|
2037
|
+
gl_FragColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);\n\
|
|
2038
2038
|
\n\
|
|
2039
2039
|
}\n\
|
|
2040
2040
|
';
|
|
@@ -2047,7 +2047,7 @@ Base.prototype = {
|
|
|
2047
2047
|
// 雾天
|
|
2048
2048
|
setFogEffect: function () {
|
|
2049
2049
|
if (this._viewer) {
|
|
2050
|
-
var fs = 'float getDistance(sampler2D depthTexture, vec2 texCoords) \n' + '{ \n' + ' float depth = czm_unpackDepth(
|
|
2050
|
+
var fs = 'float getDistance(sampler2D depthTexture, vec2 texCoords) \n' + '{ \n' + ' float depth = czm_unpackDepth(texture(depthTexture, texCoords)); \n' + ' if (depth == 0.0) { \n' + ' return czm_infinity; \n' + ' } \n' + ' vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, depth); \n' + ' return -eyeCoordinate.z / eyeCoordinate.w; \n' + '} \n' + 'float interpolateByDistance(vec4 nearFarScalar, float distance) \n' + '{ \n' + ' float startDistance = nearFarScalar.x; \n' + ' float startValue = nearFarScalar.y; \n' + ' float endDistance = nearFarScalar.z; \n' + ' float endValue = nearFarScalar.w; \n' + ' float t = clamp((distance - startDistance) / (endDistance - startDistance), 0.0, 1.0); \n' + ' return mix(startValue, endValue, t); \n' + '} \n' + 'vec4 alphaBlend(vec4 sourceColor, vec4 destinationColor) \n' + '{ \n' + ' return sourceColor * vec4(sourceColor.aaa, 1.0) + destinationColor * (1.0 - sourceColor.a); \n' + '} \n' + 'uniform sampler2D colorTexture; \n' + 'uniform sampler2D depthTexture; \n' + 'uniform vec4 fogByDistance; \n' + 'uniform vec4 fogColor; \n' + 'out vec2 v_textureCoordinates; \n' + 'void main(void) \n' + '{ \n' + ' float distance = getDistance(depthTexture, v_textureCoordinates); \n' + ' vec4 sceneColor = texture(colorTexture, v_textureCoordinates); \n' + ' float blendAmount = interpolateByDistance(fogByDistance, distance); \n' + ' vec4 finalFogColor = vec4(fogColor.rgb, fogColor.a * blendAmount); \n' + ' gl_FragColor = alphaBlend(finalFogColor, sceneColor); \n' + '} \n';
|
|
2051
2051
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
2052
2052
|
fragmentShader: fs,
|
|
2053
2053
|
uniforms: {
|
|
@@ -2636,7 +2636,7 @@ Base.prototype = {
|
|
|
2636
2636
|
ShaderSource = Cesium$4.ShaderSource;
|
|
2637
2637
|
//片元着色器,直接从源码复制
|
|
2638
2638
|
var SkyBoxFS = 'uniform samplerCube u_cubeMap;\n\
|
|
2639
|
-
|
|
2639
|
+
out vec3 v_texCoord;\n\
|
|
2640
2640
|
void main()\n\
|
|
2641
2641
|
{\n\
|
|
2642
2642
|
vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n\
|
|
@@ -2645,8 +2645,8 @@ Base.prototype = {
|
|
|
2645
2645
|
';
|
|
2646
2646
|
|
|
2647
2647
|
//顶点着色器有修改,主要是乘了一个旋转矩阵
|
|
2648
|
-
var SkyBoxVS = '
|
|
2649
|
-
|
|
2648
|
+
var SkyBoxVS = 'in vec3 position;\n\
|
|
2649
|
+
out vec3 v_texCoord;\n\
|
|
2650
2650
|
uniform mat3 u_rotateMatrix;\n\
|
|
2651
2651
|
void main()\n\
|
|
2652
2652
|
{\n\
|
|
@@ -3468,7 +3468,7 @@ Primitive.prototype = {
|
|
|
3468
3468
|
ComponentDatatype = Cesium$6.ComponentDatatype,
|
|
3469
3469
|
PrimitiveType = Cesium$6.PrimitiveType,
|
|
3470
3470
|
BoundingSphere = Cesium$6.BoundingSphere,
|
|
3471
|
-
|
|
3471
|
+
Geometryin = Cesium$6.GeometryAttribute,
|
|
3472
3472
|
GeometryPipeline = Cesium$6.GeometryPipeline,
|
|
3473
3473
|
Geometry = Cesium$6.Geometry,
|
|
3474
3474
|
defined = Cesium$6.defined,
|
|
@@ -3705,14 +3705,14 @@ Primitive.prototype = {
|
|
|
3705
3705
|
//创建顶点着色器
|
|
3706
3706
|
const creaateVertexShader = function () {
|
|
3707
3707
|
var vertexShader = `
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3708
|
+
in vec3 position;
|
|
3709
|
+
in vec3 normal;
|
|
3710
|
+
in vec2 st;
|
|
3711
|
+
in float batchId;
|
|
3712
|
+
out vec3 v_positionEC;
|
|
3713
|
+
out vec3 v_normalEC;
|
|
3714
|
+
out vec2 v_st;
|
|
3715
|
+
out vec4 v_pickColor;
|
|
3716
3716
|
void main()
|
|
3717
3717
|
{
|
|
3718
3718
|
v_positionEC = (czm_modelView * vec4(position, 1.0)).xyz; // position in eye coordinates
|
|
@@ -3728,11 +3728,11 @@ Primitive.prototype = {
|
|
|
3728
3728
|
//创建片源着色器
|
|
3729
3729
|
const createFragmentShader = function () {
|
|
3730
3730
|
var fragmentShader = `
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3731
|
+
out vec3 v_positionEC;
|
|
3732
|
+
out vec3 v_normalEC;
|
|
3733
|
+
out vec2 v_st;
|
|
3734
3734
|
uniform vec4 color;
|
|
3735
|
-
|
|
3735
|
+
out vec4 v_pickColor;
|
|
3736
3736
|
uniform sampler2D myImage;
|
|
3737
3737
|
void main()
|
|
3738
3738
|
{
|
|
@@ -3750,7 +3750,7 @@ Primitive.prototype = {
|
|
|
3750
3750
|
float dt_a11 = fract(czm_frameNumber / 100.0) * 3.14159265 * 2.0;
|
|
3751
3751
|
float dt_a12 = sin(dt_a11);
|
|
3752
3752
|
float vst=smoothstep(0.7, 1.0, dt_a12)+0.4;
|
|
3753
|
-
vec4 colorImage =
|
|
3753
|
+
vec4 colorImage = texture(myImage, vec2(fract(st.s- czm_frameNumber*0.003), st.t));
|
|
3754
3754
|
material.alpha =mix(0.1,1.0,clamp((1.0-st.t) * color.a,0.0,1.0)) +(1.0-sign(st.t-czm_frameNumber*0.001))*0.2*(1.0-colorImage.r)+0.4 ;
|
|
3755
3755
|
material.diffuse =(1.0-colorImage.a)*vec3(1.0,2.0,1.0)+colorImage.rgb*vec3(1.0,2.0,1.0);
|
|
3756
3756
|
#ifdef FLAT
|
|
@@ -4468,11 +4468,11 @@ Primitive.prototype = {
|
|
|
4468
4468
|
}));
|
|
4469
4469
|
},
|
|
4470
4470
|
getVSPolylie: function () {
|
|
4471
|
-
return '
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4471
|
+
return 'in vec3 position3DHigh;\
|
|
4472
|
+
in vec3 position3DLow;\
|
|
4473
|
+
in vec4 color;\
|
|
4474
|
+
out vec4 v_color;\
|
|
4475
|
+
in float batchId;\
|
|
4476
4476
|
void main()\
|
|
4477
4477
|
{\
|
|
4478
4478
|
vec4 p = czm_computePosition();\
|
|
@@ -4484,7 +4484,7 @@ Primitive.prototype = {
|
|
|
4484
4484
|
';
|
|
4485
4485
|
},
|
|
4486
4486
|
getFSPolyline: function () {
|
|
4487
|
-
return '
|
|
4487
|
+
return 'out vec4 v_color;\
|
|
4488
4488
|
void main()\
|
|
4489
4489
|
{\
|
|
4490
4490
|
float d = distance(gl_PointCoord, vec2(0.5,0.5));\
|
|
@@ -4678,9 +4678,9 @@ Primitive.prototype = {
|
|
|
4678
4678
|
});
|
|
4679
4679
|
};
|
|
4680
4680
|
WaterPrimitive.prototype.getFS = function () {
|
|
4681
|
-
return '
|
|
4682
|
-
|
|
4683
|
-
|
|
4681
|
+
return 'out vec3 v_positionMC;\n\
|
|
4682
|
+
out vec3 v_positionEC;\n\
|
|
4683
|
+
out vec2 v_st;\n\
|
|
4684
4684
|
\n\
|
|
4685
4685
|
void main()\n\
|
|
4686
4686
|
{\n\
|
|
@@ -4821,11 +4821,11 @@ Primitive.prototype = {
|
|
|
4821
4821
|
});
|
|
4822
4822
|
};
|
|
4823
4823
|
TexturePrimitive.prototype.getVS = function () {
|
|
4824
|
-
return '
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4824
|
+
return 'in vec3 position3DHigh;\
|
|
4825
|
+
in vec3 position3DLow;\
|
|
4826
|
+
in vec2 st;\
|
|
4827
|
+
in float batchId;\
|
|
4828
|
+
out vec2 v_st;\
|
|
4829
4829
|
void main()\
|
|
4830
4830
|
{\
|
|
4831
4831
|
vec4 p = czm_computePosition();\
|
|
@@ -4836,7 +4836,7 @@ Primitive.prototype = {
|
|
|
4836
4836
|
';
|
|
4837
4837
|
};
|
|
4838
4838
|
TexturePrimitive.prototype.getFS = function () {
|
|
4839
|
-
return '
|
|
4839
|
+
return 'out vec2 v_st;\
|
|
4840
4840
|
void main()\
|
|
4841
4841
|
{\
|
|
4842
4842
|
czm_materialInput materialInput;\
|
|
@@ -4850,7 +4850,7 @@ Primitive.prototype = {
|
|
|
4850
4850
|
TexturePrimitive.prototype.getMS = function () {
|
|
4851
4851
|
return 'czm_material czm_getMaterial(czm_materialInput materialInput,vec2 v_st)\
|
|
4852
4852
|
{\
|
|
4853
|
-
vec4 color =
|
|
4853
|
+
vec4 color = texture(image, v_st);\
|
|
4854
4854
|
czm_material material = czm_getDefaultMaterial(materialInput);\
|
|
4855
4855
|
material.diffuse= color.rgb;\
|
|
4856
4856
|
material.alpha=color.a;\
|