cesium_dev_kit 1.0.55 → 1.0.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/dist/index.js +52 -41
- package/dist/index.min.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -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 = texture2D(image, vec2(1.0 - fract(time - st.s), st.t)).a * color.a;\n\
|
|
1603
1603
|
}
|
|
1604
1604
|
},
|
|
1605
1605
|
|
|
@@ -1705,10 +1705,11 @@ 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\
|
|
1712
|
+
out vec4 myOutputColor;\n\
|
|
1712
1713
|
uniform float u_radius;\n\
|
|
1713
1714
|
uniform vec4 u_scanColor;\n\
|
|
1714
1715
|
\n\
|
|
@@ -1747,7 +1748,7 @@ Shaders.prototype = {
|
|
|
1747
1748
|
}\n\
|
|
1748
1749
|
\n\
|
|
1749
1750
|
void main(){\n\
|
|
1750
|
-
|
|
1751
|
+
myOutputColor = texture(colorTexture, v_textureCoordinates);\n\
|
|
1751
1752
|
float depth = getDepth( texture(depthTexture, v_textureCoordinates));\n\
|
|
1752
1753
|
vec4 viewPos = toEye(v_textureCoordinates, depth);\n\
|
|
1753
1754
|
vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n\
|
|
@@ -1764,9 +1765,9 @@ Shaders.prototype = {
|
|
|
1764
1765
|
f = pow(f, float(' + options.width + '));\n\
|
|
1765
1766
|
}\n\
|
|
1766
1767
|
if(float(' + options.border + ') > 0.0){\n\
|
|
1767
|
-
|
|
1768
|
+
myOutputColor = mix(myOutputColor, u_scanColor, f + f0);\n\
|
|
1768
1769
|
} else {\n\
|
|
1769
|
-
|
|
1770
|
+
myOutputColor = mix(myOutputColor, u_scanColor, f);\n\
|
|
1770
1771
|
}\n\
|
|
1771
1772
|
}\n\
|
|
1772
1773
|
}\n\
|
|
@@ -1778,10 +1779,11 @@ Shaders.prototype = {
|
|
|
1778
1779
|
if (options && options.get) {
|
|
1779
1780
|
return 'uniform sampler2D colorTexture;\n\
|
|
1780
1781
|
uniform sampler2D depthTexture;\n\
|
|
1781
|
-
|
|
1782
|
+
in vec2 v_textureCoordinates;\n\
|
|
1782
1783
|
uniform vec4 u_scanCenterEC;\n\
|
|
1783
1784
|
uniform vec3 u_scanPlaneNormalEC;\n\
|
|
1784
1785
|
uniform float u_radius;\n\
|
|
1786
|
+
out vec4 myOutputColor;\n\
|
|
1785
1787
|
uniform vec4 u_scanColor;\n\
|
|
1786
1788
|
\n\
|
|
1787
1789
|
vec4 toEye(in vec2 uv, in float depth){\n\
|
|
@@ -1806,7 +1808,7 @@ Shaders.prototype = {
|
|
|
1806
1808
|
}\n\
|
|
1807
1809
|
\n\
|
|
1808
1810
|
void main(){\n\
|
|
1809
|
-
|
|
1811
|
+
myOutputColor = texture(colorTexture, v_textureCoordinates);\n\
|
|
1810
1812
|
float depth = getDepth(texture(depthTexture, v_textureCoordinates));\n\
|
|
1811
1813
|
vec4 viewPos = toEye(v_textureCoordinates, depth);\n\
|
|
1812
1814
|
vec3 prjOnPlane = pointProjectOnPlane(u_scanPlaneNormalEC.xyz, u_scanCenterEC.xyz, viewPos.xyz);\n\
|
|
@@ -1814,7 +1816,7 @@ Shaders.prototype = {
|
|
|
1814
1816
|
if(dis < u_radius){\n\
|
|
1815
1817
|
float f = 1.0 - abs(u_radius - dis) / u_radius;\n\
|
|
1816
1818
|
f = pow(f, float(' + options.border + '));\n\
|
|
1817
|
-
|
|
1819
|
+
myOutputColor = mix(myOutputColor, u_scanColor, f);\n\
|
|
1818
1820
|
}\n\
|
|
1819
1821
|
}\n\
|
|
1820
1822
|
';
|
|
@@ -1940,7 +1942,7 @@ Base.prototype = {
|
|
|
1940
1942
|
//黑夜特效
|
|
1941
1943
|
setDarkEffect: function (options) {
|
|
1942
1944
|
options = options || {};
|
|
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' + '
|
|
1945
|
+
var fs = 'uniform sampler2D colorTexture;\n' + 'out vec4 myOutputColor;\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' + ' myOutputColor = vec4(color.r*0.2,color.g * 0.4,color.b*0.6, 1.0);\n' + '}\n';
|
|
1944
1946
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
1945
1947
|
name: 'darkEffect',
|
|
1946
1948
|
fragmentShader: fs,
|
|
@@ -1955,7 +1957,7 @@ Base.prototype = {
|
|
|
1955
1957
|
// 场景蓝光
|
|
1956
1958
|
setBlurBloom: function (options) {
|
|
1957
1959
|
if (this._viewer && options) {
|
|
1958
|
-
var fs = 'uniform float height;\n' + 'uniform float width;\n' + 'uniform sampler2D colorTexture1;\n' + '\n' + '
|
|
1960
|
+
var fs = 'uniform float height;\n' + 'uniform float width;\n' + 'out vec4 myOutputColor;\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' + 'gmyOutputColor = result;\n' + '}\n';
|
|
1959
1961
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
1960
1962
|
name: 'blur_x_direction',
|
|
1961
1963
|
fragmentShader: fs,
|
|
@@ -1971,7 +1973,8 @@ Base.prototype = {
|
|
|
1971
1973
|
setRainEffect: function () {
|
|
1972
1974
|
if (this._viewer) {
|
|
1973
1975
|
var fs = 'uniform sampler2D colorTexture;\n\
|
|
1974
|
-
out
|
|
1976
|
+
out vec4 myOutputColor;\n\
|
|
1977
|
+
in vec2 v_textureCoordinates;\n\
|
|
1975
1978
|
\n\
|
|
1976
1979
|
float hash(float x){\n\
|
|
1977
1980
|
return fract(sin(x*23.3)*13.13);\n\
|
|
@@ -1989,7 +1992,7 @@ Base.prototype = {
|
|
|
1989
1992
|
float v=1.-sin(hash(floor(uv.x*100.))*2.);\n\
|
|
1990
1993
|
float b=clamp(abs(sin(20.*time*v+uv.y*(5./(2.+v))))-.95,0.,1.)*20.;\n\
|
|
1991
1994
|
c*=v*b;\n\
|
|
1992
|
-
|
|
1995
|
+
myOutputColor = mix(texture(colorTexture, v_textureCoordinates), vec4(c, 1), 0.2);\n\
|
|
1993
1996
|
}\n\
|
|
1994
1997
|
';
|
|
1995
1998
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
@@ -2002,7 +2005,8 @@ Base.prototype = {
|
|
|
2002
2005
|
setSnowEffect: function () {
|
|
2003
2006
|
if (this._viewer) {
|
|
2004
2007
|
var fs = 'uniform sampler2D colorTexture;\n\
|
|
2005
|
-
|
|
2008
|
+
in vec2 v_textureCoordinates;\n\
|
|
2009
|
+
out vec4 myOutputColor;\n\
|
|
2006
2010
|
\n\
|
|
2007
2011
|
float snow(vec2 uv,float scale){\n\
|
|
2008
2012
|
float time = czm_frameNumber / 60.0;\n\
|
|
@@ -2034,7 +2038,7 @@ Base.prototype = {
|
|
|
2034
2038
|
c+=snow(uv,6.);\n\
|
|
2035
2039
|
c+=snow(uv,5.);\n\
|
|
2036
2040
|
finalColor=(vec3(c));\n\
|
|
2037
|
-
|
|
2041
|
+
myOutputColor = mix(texture(colorTexture, v_textureCoordinates), vec4(finalColor,1), 0.3);\n\
|
|
2038
2042
|
\n\
|
|
2039
2043
|
}\n\
|
|
2040
2044
|
';
|
|
@@ -2047,7 +2051,7 @@ Base.prototype = {
|
|
|
2047
2051
|
// 雾天
|
|
2048
2052
|
setFogEffect: function () {
|
|
2049
2053
|
if (this._viewer) {
|
|
2050
|
-
var fs = 'float getDistance(sampler2D depthTexture, vec2 texCoords) \n' + '{ \n' + ' float depth = czm_unpackDepth(
|
|
2054
|
+
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' + 'out vec4 myOutputColor;\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' + ' myOutputColor = alphaBlend(finalFogColor, sceneColor); \n' + '} \n';
|
|
2051
2055
|
return this._viewer.scene.postProcessStages.add(new Cesium$4.PostProcessStage({
|
|
2052
2056
|
fragmentShader: fs,
|
|
2053
2057
|
uniforms: {
|
|
@@ -2636,11 +2640,12 @@ Base.prototype = {
|
|
|
2636
2640
|
ShaderSource = Cesium$4.ShaderSource;
|
|
2637
2641
|
//片元着色器,直接从源码复制
|
|
2638
2642
|
var SkyBoxFS = 'uniform samplerCube u_cubeMap;\n\
|
|
2639
|
-
out
|
|
2643
|
+
out vec4 myOutputColor;\n\
|
|
2644
|
+
in vec3 v_texCoord;\n\
|
|
2640
2645
|
void main()\n\
|
|
2641
2646
|
{\n\
|
|
2642
|
-
vec4 color =
|
|
2643
|
-
|
|
2647
|
+
vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n\
|
|
2648
|
+
myOutputColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n\
|
|
2644
2649
|
}\n\
|
|
2645
2650
|
';
|
|
2646
2651
|
|
|
@@ -3468,7 +3473,7 @@ Primitive.prototype = {
|
|
|
3468
3473
|
ComponentDatatype = Cesium$6.ComponentDatatype,
|
|
3469
3474
|
PrimitiveType = Cesium$6.PrimitiveType,
|
|
3470
3475
|
BoundingSphere = Cesium$6.BoundingSphere,
|
|
3471
|
-
|
|
3476
|
+
GeometryAttribute = Cesium$6.GeometryAttribute,
|
|
3472
3477
|
GeometryPipeline = Cesium$6.GeometryPipeline,
|
|
3473
3478
|
Geometry = Cesium$6.Geometry,
|
|
3474
3479
|
defined = Cesium$6.defined,
|
|
@@ -3728,11 +3733,12 @@ Primitive.prototype = {
|
|
|
3728
3733
|
//创建片源着色器
|
|
3729
3734
|
const createFragmentShader = function () {
|
|
3730
3735
|
var fragmentShader = `
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3736
|
+
in vec3 v_positionEC;
|
|
3737
|
+
in vec3 v_normalEC;
|
|
3738
|
+
in vec2 v_st;
|
|
3739
|
+
out vec4 myOutputColor;
|
|
3734
3740
|
uniform vec4 color;
|
|
3735
|
-
|
|
3741
|
+
in vec4 v_pickColor;
|
|
3736
3742
|
uniform sampler2D myImage;
|
|
3737
3743
|
void main()
|
|
3738
3744
|
{
|
|
@@ -3754,9 +3760,9 @@ Primitive.prototype = {
|
|
|
3754
3760
|
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
3761
|
material.diffuse =(1.0-colorImage.a)*vec3(1.0,2.0,1.0)+colorImage.rgb*vec3(1.0,2.0,1.0);
|
|
3756
3762
|
#ifdef FLAT
|
|
3757
|
-
|
|
3763
|
+
myOutputColor = vec4(material.diffuse + material.emission, material.alpha);
|
|
3758
3764
|
#else
|
|
3759
|
-
|
|
3765
|
+
myOutputColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
|
3760
3766
|
#endif
|
|
3761
3767
|
}
|
|
3762
3768
|
`;
|
|
@@ -4096,9 +4102,10 @@ Primitive.prototype = {
|
|
|
4096
4102
|
}\n\
|
|
4097
4103
|
';
|
|
4098
4104
|
const ViewshedLineFS = 'uniform vec4 u_bgColor;\n\
|
|
4105
|
+
out vec4 myOutputColor;\n\
|
|
4099
4106
|
void main()\n\
|
|
4100
4107
|
{\n\
|
|
4101
|
-
|
|
4108
|
+
myOutputColor = u_bgColor;\n\
|
|
4102
4109
|
}\n\
|
|
4103
4110
|
';
|
|
4104
4111
|
function ShadowPrimitive(options) {
|
|
@@ -4484,12 +4491,13 @@ Primitive.prototype = {
|
|
|
4484
4491
|
';
|
|
4485
4492
|
},
|
|
4486
4493
|
getFSPolyline: function () {
|
|
4487
|
-
return '
|
|
4494
|
+
return 'in vec4 v_color;\
|
|
4495
|
+
out vec4 myOutputColor;\
|
|
4488
4496
|
void main()\
|
|
4489
4497
|
{\
|
|
4490
4498
|
float d = distance(gl_PointCoord, vec2(0.5,0.5));\
|
|
4491
4499
|
if(d < 0.5){\
|
|
4492
|
-
|
|
4500
|
+
myOutputColor = v_color;\
|
|
4493
4501
|
}else{\
|
|
4494
4502
|
discard;\
|
|
4495
4503
|
}\
|
|
@@ -4678,9 +4686,10 @@ Primitive.prototype = {
|
|
|
4678
4686
|
});
|
|
4679
4687
|
};
|
|
4680
4688
|
WaterPrimitive.prototype.getFS = function () {
|
|
4681
|
-
return '
|
|
4682
|
-
|
|
4683
|
-
out
|
|
4689
|
+
return 'in vec3 v_positionMC;\n\
|
|
4690
|
+
in vec3 v_positionEC;\n\
|
|
4691
|
+
out vec4 myOutputColor;\n\
|
|
4692
|
+
in vec2 v_st;\n\
|
|
4684
4693
|
\n\
|
|
4685
4694
|
void main()\n\
|
|
4686
4695
|
{\n\
|
|
@@ -4698,10 +4707,10 @@ Primitive.prototype = {
|
|
|
4698
4707
|
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
|
4699
4708
|
czm_material material = czm_getMaterial(materialInput);\n\
|
|
4700
4709
|
#ifdef FLAT\n\
|
|
4701
|
-
|
|
4710
|
+
myOutputColor = vec4(material.diffuse + material.emission, material.alpha);\n\
|
|
4702
4711
|
#else\n\
|
|
4703
|
-
|
|
4704
|
-
|
|
4712
|
+
myOutputColor = czm_phong(normalize(positionToEyeEC), material);\n\
|
|
4713
|
+
myOutputColor.a = 0.5;\n\
|
|
4705
4714
|
#endif\n\
|
|
4706
4715
|
}\n\
|
|
4707
4716
|
';
|
|
@@ -4836,14 +4845,15 @@ Primitive.prototype = {
|
|
|
4836
4845
|
';
|
|
4837
4846
|
};
|
|
4838
4847
|
TexturePrimitive.prototype.getFS = function () {
|
|
4839
|
-
return '
|
|
4848
|
+
return 'in vec2 v_st;\
|
|
4849
|
+
out vec4 myOutputColor;\
|
|
4840
4850
|
void main()\
|
|
4841
4851
|
{\
|
|
4842
4852
|
czm_materialInput materialInput;\
|
|
4843
4853
|
czm_material material=czm_getMaterial(materialInput,v_st);\
|
|
4844
4854
|
vec4 color=vec4(material.diffuse + material.emission,material.alpha);\
|
|
4845
4855
|
if(color.x==1.0&&color.y==1.0&&color.z==1.0&&color.w==1.0) color=vec4(vec3(0.0,0.0,0.0),0.0);\
|
|
4846
|
-
|
|
4856
|
+
myOutputColor =color;\
|
|
4847
4857
|
}\
|
|
4848
4858
|
';
|
|
4849
4859
|
};
|
|
@@ -11308,17 +11318,18 @@ Plugin.prototype = {
|
|
|
11308
11318
|
ShaderSource = Cesium$c.ShaderSource;
|
|
11309
11319
|
//片元着色器,直接从源码复制
|
|
11310
11320
|
var SkyBoxFS = 'uniform samplerCube u_cubeMap;\n\
|
|
11311
|
-
|
|
11321
|
+
in vec3 v_texCoord;\n\
|
|
11322
|
+
out vec4 myOutputColor;\n\
|
|
11312
11323
|
void main()\n\
|
|
11313
11324
|
{\n\
|
|
11314
|
-
vec4 color =
|
|
11315
|
-
|
|
11325
|
+
vec4 color = texture(u_cubeMap, normalize(v_texCoord));\n\
|
|
11326
|
+
myOutputColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n\
|
|
11316
11327
|
}\n\
|
|
11317
11328
|
';
|
|
11318
11329
|
|
|
11319
11330
|
//顶点着色器有修改,主要是乘了一个旋转矩阵
|
|
11320
|
-
var SkyBoxVS = '
|
|
11321
|
-
|
|
11331
|
+
var SkyBoxVS = 'in vec3 position;\n\
|
|
11332
|
+
out vec3 v_texCoord;\n\
|
|
11322
11333
|
uniform mat3 u_rotateMatrix;\n\
|
|
11323
11334
|
void main()\n\
|
|
11324
11335
|
{\n\
|