cesium_dev_kit 1.0.54 → 1.0.56
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 +9 -10
- package/dist/index.js +55 -55
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
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 安装后可以直接在项目中使用。
|
|
@@ -145,7 +143,7 @@ export default {
|
|
|
145
143
|
*/
|
|
146
144
|
```
|
|
147
145
|
|
|
148
|
-
##
|
|
146
|
+
## 使用范例
|
|
149
147
|
|
|
150
148
|
[https://github.com/dengxiaoning/cesium_kit_test](https://github.com/dengxiaoning/cesium_kit_test)这是一个 vue 项目已安装 cesium_dev_kit,其中有使用 demo,可直接下载到本地运行查看参照
|
|
151
149
|
|
|
@@ -162,7 +160,8 @@ export default {
|
|
|
162
160
|
[cesium-d3kit](https://github.com/zhangti0708/cesium-d3kit)<br/>
|
|
163
161
|
[drawarrowforcesium](https://gitcode.net/mirrors/gitgitczl/drawarrowforcesium)<br/>
|
|
164
162
|
[vue3-ts-cesium-map-show](https://gitee.com/hawk86104/vue3-ts-cesium-map-show)<br/>
|
|
165
|
-
|
|
163
|
+
|
|
164
|
+
本项目包括但不限于借鉴和参考以上资料,非常感谢作者分享
|
|
166
165
|
|
|
167
166
|
## 项目不足与优化
|
|
168
167
|
|
|
@@ -170,4 +169,4 @@ export default {
|
|
|
170
169
|
- 2、未配备使用文档(请参考案例)
|
|
171
170
|
- 3、未作异常捕捉和处理
|
|
172
171
|
|
|
173
|
-
<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\
|
|
@@ -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
|
+
in 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
|
+
in 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' + 'in 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' + 'in 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
|
+
in 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
|
+
in 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(texture2D(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' + '
|
|
2050
|
+
var fs = 'float getDistance(sampler2D depthTexture, vec2 texCoords) \n' + '{ \n' + ' float depth = czm_unpackDepth(texture2D(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' + 'in 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,17 +2636,17 @@ Base.prototype = {
|
|
|
2636
2636
|
ShaderSource = Cesium$4.ShaderSource;
|
|
2637
2637
|
//片元着色器,直接从源码复制
|
|
2638
2638
|
var SkyBoxFS = 'uniform samplerCube u_cubeMap;\n\
|
|
2639
|
-
|
|
2639
|
+
in vec3 v_texCoord;\n\
|
|
2640
2640
|
void main()\n\
|
|
2641
2641
|
{\n\
|
|
2642
|
-
vec4 color =
|
|
2642
|
+
vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n\
|
|
2643
2643
|
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n\
|
|
2644
2644
|
}\n\
|
|
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\
|
|
@@ -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
|
+
in vec3 v_positionEC;
|
|
3732
|
+
in vec3 v_normalEC;
|
|
3733
|
+
in vec2 v_st;
|
|
3734
3734
|
uniform vec4 color;
|
|
3735
|
-
|
|
3735
|
+
in 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 'in 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 'in vec3 v_positionMC;\n\
|
|
4682
|
+
in vec3 v_positionEC;\n\
|
|
4683
|
+
in 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 'in 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;\
|
|
@@ -11308,17 +11308,17 @@ Plugin.prototype = {
|
|
|
11308
11308
|
ShaderSource = Cesium$c.ShaderSource;
|
|
11309
11309
|
//片元着色器,直接从源码复制
|
|
11310
11310
|
var SkyBoxFS = 'uniform samplerCube u_cubeMap;\n\
|
|
11311
|
-
|
|
11311
|
+
in vec3 v_texCoord;\n\
|
|
11312
11312
|
void main()\n\
|
|
11313
11313
|
{\n\
|
|
11314
|
-
vec4 color =
|
|
11314
|
+
vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n\
|
|
11315
11315
|
gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n\
|
|
11316
11316
|
}\n\
|
|
11317
11317
|
';
|
|
11318
11318
|
|
|
11319
11319
|
//顶点着色器有修改,主要是乘了一个旋转矩阵
|
|
11320
|
-
var SkyBoxVS = '
|
|
11321
|
-
|
|
11320
|
+
var SkyBoxVS = 'in vec3 position;\n\
|
|
11321
|
+
out vec3 v_texCoord;\n\
|
|
11322
11322
|
uniform mat3 u_rotateMatrix;\n\
|
|
11323
11323
|
void main()\n\
|
|
11324
11324
|
{\n\
|