cesium_dev_kit 1.0.55 → 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/dist/index.js +24 -24
- 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,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\
|
|
@@ -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\
|
|
@@ -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\
|
|
@@ -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\
|
|
@@ -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(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,10 +2636,10 @@ 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
|
';
|
|
@@ -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
|
+
GeometryAttribute = Cesium$6.GeometryAttribute,
|
|
3472
3472
|
GeometryPipeline = Cesium$6.GeometryPipeline,
|
|
3473
3473
|
Geometry = Cesium$6.Geometry,
|
|
3474
3474
|
defined = Cesium$6.defined,
|
|
@@ -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
|
{
|
|
@@ -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\
|
|
@@ -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;\
|
|
@@ -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\
|