Add existing to tracked
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
#ifdef MRT
|
||||
layout (location = 0) out vec4 out_FragData_0;
|
||||
layout (location = 1) out vec4 out_FragData_1;
|
||||
#else
|
||||
layout (location = 0) out vec4 out_FragColor;
|
||||
#endif
|
||||
|
||||
uniform vec4 u_bgColor;
|
||||
uniform sampler2D u_depthTexture;
|
||||
|
||||
in vec2 v_textureCoordinates;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)
|
||||
{
|
||||
#ifdef MRT
|
||||
out_FragData_0 = u_bgColor;
|
||||
out_FragData_1 = vec4(u_bgColor.a);
|
||||
#else
|
||||
out_FragColor = u_bgColor;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
discard;
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "#ifdef MRT\n\
|
||||
layout (location = 0) out vec4 out_FragData_0;\n\
|
||||
layout (location = 1) out vec4 out_FragData_1;\n\
|
||||
#else\n\
|
||||
layout (location = 0) out vec4 out_FragColor;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
uniform vec4 u_bgColor;\n\
|
||||
uniform sampler2D u_depthTexture;\n\
|
||||
\n\
|
||||
in vec2 v_textureCoordinates;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
if (texture(u_depthTexture, v_textureCoordinates).r < 1.0)\n\
|
||||
{\n\
|
||||
#ifdef MRT\n\
|
||||
out_FragData_0 = u_bgColor;\n\
|
||||
out_FragData_1 = vec4(u_bgColor.a);\n\
|
||||
#else\n\
|
||||
out_FragColor = u_bgColor;\n\
|
||||
#endif\n\
|
||||
return;\n\
|
||||
}\n\
|
||||
\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
in vec3 v_positionEC;
|
||||
in vec3 v_normalEC;
|
||||
in vec3 v_tangentEC;
|
||||
in vec3 v_bitangentEC;
|
||||
in vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 positionToEyeEC = -v_positionEC;
|
||||
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);
|
||||
|
||||
vec3 normalEC = normalize(v_normalEC);
|
||||
#ifdef FACE_FORWARD
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||||
#endif
|
||||
|
||||
czm_materialInput materialInput;
|
||||
materialInput.normalEC = normalEC;
|
||||
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;
|
||||
materialInput.positionToEyeEC = positionToEyeEC;
|
||||
materialInput.st = v_st;
|
||||
czm_material material = czm_getMaterial(materialInput);
|
||||
|
||||
#ifdef FLAT
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||||
#else
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||||
#endif
|
||||
}
|
||||
Generated
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 v_positionEC;\n\
|
||||
in vec3 v_normalEC;\n\
|
||||
in vec3 v_tangentEC;\n\
|
||||
in vec3 v_bitangentEC;\n\
|
||||
in vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec3 positionToEyeEC = -v_positionEC;\n\
|
||||
mat3 tangentToEyeMatrix = czm_tangentToEyeSpaceMatrix(v_normalEC, v_tangentEC, v_bitangentEC);\n\
|
||||
\n\
|
||||
vec3 normalEC = normalize(v_normalEC);\n\
|
||||
#ifdef FACE_FORWARD\n\
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
czm_materialInput materialInput;\n\
|
||||
materialInput.normalEC = normalEC;\n\
|
||||
materialInput.tangentToEyeMatrix = tangentToEyeMatrix;\n\
|
||||
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
||||
materialInput.st = v_st;\n\
|
||||
czm_material material = czm_getMaterial(materialInput);\n\
|
||||
\n\
|
||||
#ifdef FLAT\n\
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
|
||||
#else\n\
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 normal;
|
||||
in vec3 tangent;
|
||||
in vec3 bitangent;
|
||||
in vec2 st;
|
||||
in float batchId;
|
||||
|
||||
out vec3 v_positionEC;
|
||||
out vec3 v_normalEC;
|
||||
out vec3 v_tangentEC;
|
||||
out vec3 v_bitangentEC;
|
||||
out vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||||
v_tangentEC = czm_normal * tangent; // tangent in eye coordinates
|
||||
v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates
|
||||
v_st = st;
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 normal;\n\
|
||||
in vec3 tangent;\n\
|
||||
in vec3 bitangent;\n\
|
||||
in vec2 st;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec3 v_positionEC;\n\
|
||||
out vec3 v_normalEC;\n\
|
||||
out vec3 v_tangentEC;\n\
|
||||
out vec3 v_bitangentEC;\n\
|
||||
out vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n\
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates\n\
|
||||
v_tangentEC = czm_normal * tangent; // tangent in eye coordinates\n\
|
||||
v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates\n\
|
||||
v_st = st;\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
in vec3 v_positionEC;
|
||||
in vec3 v_normalEC;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 positionToEyeEC = -v_positionEC;
|
||||
|
||||
vec3 normalEC = normalize(v_normalEC);
|
||||
#ifdef FACE_FORWARD
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||||
#endif
|
||||
|
||||
czm_materialInput materialInput;
|
||||
materialInput.normalEC = normalEC;
|
||||
materialInput.positionToEyeEC = positionToEyeEC;
|
||||
czm_material material = czm_getMaterial(materialInput);
|
||||
|
||||
#ifdef FLAT
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||||
#else
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||||
#endif
|
||||
}
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 v_positionEC;\n\
|
||||
in vec3 v_normalEC;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec3 positionToEyeEC = -v_positionEC;\n\
|
||||
\n\
|
||||
vec3 normalEC = normalize(v_normalEC);\n\
|
||||
#ifdef FACE_FORWARD\n\
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
czm_materialInput materialInput;\n\
|
||||
materialInput.normalEC = normalEC;\n\
|
||||
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
||||
czm_material material = czm_getMaterial(materialInput);\n\
|
||||
\n\
|
||||
#ifdef FLAT\n\
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
|
||||
#else\n\
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 normal;
|
||||
in float batchId;
|
||||
|
||||
out vec3 v_positionEC;
|
||||
out vec3 v_normalEC;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 normal;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec3 v_positionEC;\n\
|
||||
out vec3 v_normalEC;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n\
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
in vec3 v_positionMC;
|
||||
in vec3 v_positionEC;
|
||||
in vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
czm_materialInput materialInput;
|
||||
|
||||
vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));
|
||||
#ifdef FACE_FORWARD
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||||
#endif
|
||||
|
||||
materialInput.s = v_st.s;
|
||||
materialInput.st = v_st;
|
||||
materialInput.str = vec3(v_st, 0.0);
|
||||
|
||||
// Convert tangent space material normal to eye space
|
||||
materialInput.normalEC = normalEC;
|
||||
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);
|
||||
|
||||
// Convert view vector to world space
|
||||
vec3 positionToEyeEC = -v_positionEC;
|
||||
materialInput.positionToEyeEC = positionToEyeEC;
|
||||
|
||||
czm_material material = czm_getMaterial(materialInput);
|
||||
|
||||
#ifdef FLAT
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||||
#else
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||||
#endif
|
||||
}
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 v_positionMC;\n\
|
||||
in vec3 v_positionEC;\n\
|
||||
in vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
czm_materialInput materialInput;\n\
|
||||
\n\
|
||||
vec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n\
|
||||
#ifdef FACE_FORWARD\n\
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
materialInput.s = v_st.s;\n\
|
||||
materialInput.st = v_st;\n\
|
||||
materialInput.str = vec3(v_st, 0.0);\n\
|
||||
\n\
|
||||
// Convert tangent space material normal to eye space\n\
|
||||
materialInput.normalEC = normalEC;\n\
|
||||
materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\n\
|
||||
\n\
|
||||
// Convert view vector to world space\n\
|
||||
vec3 positionToEyeEC = -v_positionEC;\n\
|
||||
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
||||
\n\
|
||||
czm_material material = czm_getMaterial(materialInput);\n\
|
||||
\n\
|
||||
#ifdef FLAT\n\
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
|
||||
#else\n\
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec2 st;
|
||||
in float batchId;
|
||||
|
||||
out vec3 v_positionMC;
|
||||
out vec3 v_positionEC;
|
||||
out vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_positionMC = position3DHigh + position3DLow; // position in model coordinates
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||||
v_st = st;
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec2 st;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec3 v_positionMC;\n\
|
||||
out vec3 v_positionEC;\n\
|
||||
out vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_positionMC = position3DHigh + position3DLow; // position in model coordinates\n\
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n\
|
||||
v_st = st;\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
in vec3 v_positionEC;
|
||||
in vec3 v_normalEC;
|
||||
in vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 positionToEyeEC = -v_positionEC;
|
||||
|
||||
vec3 normalEC = normalize(v_normalEC);
|
||||
#ifdef FACE_FORWARD
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||||
#endif
|
||||
|
||||
vec4 color = czm_gammaCorrect(v_color);
|
||||
|
||||
czm_materialInput materialInput;
|
||||
materialInput.normalEC = normalEC;
|
||||
materialInput.positionToEyeEC = positionToEyeEC;
|
||||
czm_material material = czm_getDefaultMaterial(materialInput);
|
||||
material.diffuse = color.rgb;
|
||||
material.alpha = color.a;
|
||||
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||||
}
|
||||
Generated
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 v_positionEC;\n\
|
||||
in vec3 v_normalEC;\n\
|
||||
in vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec3 positionToEyeEC = -v_positionEC;\n\
|
||||
\n\
|
||||
vec3 normalEC = normalize(v_normalEC);\n\
|
||||
#ifdef FACE_FORWARD\n\
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
vec4 color = czm_gammaCorrect(v_color);\n\
|
||||
\n\
|
||||
czm_materialInput materialInput;\n\
|
||||
materialInput.normalEC = normalEC;\n\
|
||||
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
||||
czm_material material = czm_getDefaultMaterial(materialInput);\n\
|
||||
material.diffuse = color.rgb;\n\
|
||||
material.alpha = color.a;\n\
|
||||
\n\
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 normal;
|
||||
in vec4 color;
|
||||
in float batchId;
|
||||
|
||||
out vec3 v_positionEC;
|
||||
out vec3 v_normalEC;
|
||||
out vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||||
v_color = color;
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 normal;\n\
|
||||
in vec4 color;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec3 v_positionEC;\n\
|
||||
out vec3 v_normalEC;\n\
|
||||
out vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n\
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates\n\
|
||||
v_color = color;\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
in vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
out_FragColor = czm_gammaCorrect(v_color);
|
||||
}
|
||||
Generated
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
out_FragColor = czm_gammaCorrect(v_color);\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec4 color;
|
||||
in float batchId;
|
||||
|
||||
out vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_color = color;
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec4 color;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 prevPosition3DHigh;
|
||||
in vec3 prevPosition3DLow;
|
||||
in vec3 nextPosition3DHigh;
|
||||
in vec3 nextPosition3DLow;
|
||||
in vec2 expandAndWidth;
|
||||
in vec4 color;
|
||||
in float batchId;
|
||||
|
||||
out vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
float expandDir = expandAndWidth.x;
|
||||
float width = abs(expandAndWidth.y) + 0.5;
|
||||
bool usePrev = expandAndWidth.y < 0.0;
|
||||
|
||||
vec4 p = czm_computePosition();
|
||||
vec4 prev = czm_computePrevPosition();
|
||||
vec4 next = czm_computeNextPosition();
|
||||
|
||||
float angle;
|
||||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
||||
gl_Position = czm_viewportOrthographic * positionWC;
|
||||
|
||||
v_color = color;
|
||||
}
|
||||
Generated
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 prevPosition3DHigh;\n\
|
||||
in vec3 prevPosition3DLow;\n\
|
||||
in vec3 nextPosition3DHigh;\n\
|
||||
in vec3 nextPosition3DLow;\n\
|
||||
in vec2 expandAndWidth;\n\
|
||||
in vec4 color;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
float expandDir = expandAndWidth.x;\n\
|
||||
float width = abs(expandAndWidth.y) + 0.5;\n\
|
||||
bool usePrev = expandAndWidth.y < 0.0;\n\
|
||||
\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
vec4 prev = czm_computePrevPosition();\n\
|
||||
vec4 next = czm_computeNextPosition();\n\
|
||||
\n\
|
||||
float angle;\n\
|
||||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n\
|
||||
gl_Position = czm_viewportOrthographic * positionWC;\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 prevPosition3DHigh;
|
||||
in vec3 prevPosition3DLow;
|
||||
in vec3 nextPosition3DHigh;
|
||||
in vec3 nextPosition3DLow;
|
||||
in vec2 expandAndWidth;
|
||||
in vec2 st;
|
||||
in float batchId;
|
||||
|
||||
out float v_width;
|
||||
out vec2 v_st;
|
||||
out float v_polylineAngle;
|
||||
|
||||
void main()
|
||||
{
|
||||
float expandDir = expandAndWidth.x;
|
||||
float width = abs(expandAndWidth.y) + 0.5;
|
||||
bool usePrev = expandAndWidth.y < 0.0;
|
||||
|
||||
vec4 p = czm_computePosition();
|
||||
vec4 prev = czm_computePrevPosition();
|
||||
vec4 next = czm_computeNextPosition();
|
||||
|
||||
float angle;
|
||||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);
|
||||
gl_Position = czm_viewportOrthographic * positionWC;
|
||||
|
||||
v_width = width;
|
||||
v_st.s = st.s;
|
||||
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);
|
||||
v_polylineAngle = angle;
|
||||
}
|
||||
Generated
Vendored
+35
@@ -0,0 +1,35 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 prevPosition3DHigh;\n\
|
||||
in vec3 prevPosition3DLow;\n\
|
||||
in vec3 nextPosition3DHigh;\n\
|
||||
in vec3 nextPosition3DLow;\n\
|
||||
in vec2 expandAndWidth;\n\
|
||||
in vec2 st;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out float v_width;\n\
|
||||
out vec2 v_st;\n\
|
||||
out float v_polylineAngle;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
float expandDir = expandAndWidth.x;\n\
|
||||
float width = abs(expandAndWidth.y) + 0.5;\n\
|
||||
bool usePrev = expandAndWidth.y < 0.0;\n\
|
||||
\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
vec4 prev = czm_computePrevPosition();\n\
|
||||
vec4 next = czm_computeNextPosition();\n\
|
||||
\n\
|
||||
float angle;\n\
|
||||
vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n\
|
||||
gl_Position = czm_viewportOrthographic * positionWC;\n\
|
||||
\n\
|
||||
v_width = width;\n\
|
||||
v_st.s = st.s;\n\
|
||||
v_st.t = czm_writeNonPerspective(st.t, gl_Position.w);\n\
|
||||
v_polylineAngle = angle;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
in vec3 v_positionEC;
|
||||
in vec3 v_normalEC;
|
||||
in vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 positionToEyeEC = -v_positionEC;
|
||||
|
||||
vec3 normalEC = normalize(v_normalEC);
|
||||
#ifdef FACE_FORWARD
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);
|
||||
#endif
|
||||
|
||||
czm_materialInput materialInput;
|
||||
materialInput.normalEC = normalEC;
|
||||
materialInput.positionToEyeEC = positionToEyeEC;
|
||||
materialInput.st = v_st;
|
||||
czm_material material = czm_getMaterial(materialInput);
|
||||
|
||||
#ifdef FLAT
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);
|
||||
#else
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);
|
||||
#endif
|
||||
}
|
||||
Generated
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 v_positionEC;\n\
|
||||
in vec3 v_normalEC;\n\
|
||||
in vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec3 positionToEyeEC = -v_positionEC;\n\
|
||||
\n\
|
||||
vec3 normalEC = normalize(v_normalEC);\n\
|
||||
#ifdef FACE_FORWARD\n\
|
||||
normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
czm_materialInput materialInput;\n\
|
||||
materialInput.normalEC = normalEC;\n\
|
||||
materialInput.positionToEyeEC = positionToEyeEC;\n\
|
||||
materialInput.st = v_st;\n\
|
||||
czm_material material = czm_getMaterial(materialInput);\n\
|
||||
\n\
|
||||
#ifdef FLAT\n\
|
||||
out_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\
|
||||
#else\n\
|
||||
out_FragColor = czm_phong(normalize(positionToEyeEC), material, czm_lightDirectionEC);\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
in vec3 position3DHigh;
|
||||
in vec3 position3DLow;
|
||||
in vec3 normal;
|
||||
in vec2 st;
|
||||
in float batchId;
|
||||
|
||||
out vec3 v_positionEC;
|
||||
out vec3 v_normalEC;
|
||||
out vec2 v_st;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 p = czm_computePosition();
|
||||
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates
|
||||
v_st = st;
|
||||
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;
|
||||
}
|
||||
Generated
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec3 position3DHigh;\n\
|
||||
in vec3 position3DLow;\n\
|
||||
in vec3 normal;\n\
|
||||
in vec2 st;\n\
|
||||
in float batchId;\n\
|
||||
\n\
|
||||
out vec3 v_positionEC;\n\
|
||||
out vec3 v_normalEC;\n\
|
||||
out vec2 v_st;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
vec4 p = czm_computePosition();\n\
|
||||
\n\
|
||||
v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates\n\
|
||||
v_normalEC = czm_normal * normal; // normal in eye coordinates\n\
|
||||
v_st = st;\n\
|
||||
\n\
|
||||
gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\
|
||||
}\n\
|
||||
";
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
uniform vec3 u_radiiAndDynamicAtmosphereColor;
|
||||
|
||||
uniform float u_atmosphereLightIntensity;
|
||||
uniform float u_atmosphereRayleighScaleHeight;
|
||||
uniform float u_atmosphereMieScaleHeight;
|
||||
uniform float u_atmosphereMieAnisotropy;
|
||||
uniform vec3 u_atmosphereRayleighCoefficient;
|
||||
uniform vec3 u_atmosphereMieCoefficient;
|
||||
|
||||
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.
|
||||
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.
|
||||
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
||||
|
||||
/**
|
||||
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as
|
||||
* the transmittance value for the ray.
|
||||
*
|
||||
* @param {czm_ray} primaryRay The ray from the camera to the position.
|
||||
* @param {float} primaryRayLength The length of the primary ray.
|
||||
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.
|
||||
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.
|
||||
* @param {vec3} mieColor The variable the Mie scattering will be written to.
|
||||
* @param {float} opacity The variable the transmittance will be written to.
|
||||
* @glslFunction
|
||||
*/
|
||||
void computeScattering(
|
||||
czm_ray primaryRay,
|
||||
float primaryRayLength,
|
||||
vec3 lightDirection,
|
||||
float atmosphereInnerRadius,
|
||||
out vec3 rayleighColor,
|
||||
out vec3 mieColor,
|
||||
out float opacity
|
||||
) {
|
||||
|
||||
// Initialize the default scattering amounts to 0.
|
||||
rayleighColor = vec3(0.0);
|
||||
mieColor = vec3(0.0);
|
||||
opacity = 0.0;
|
||||
|
||||
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;
|
||||
|
||||
vec3 origin = vec3(0.0);
|
||||
|
||||
// Calculate intersection from the camera to the outer ring of the atmosphere.
|
||||
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);
|
||||
|
||||
// Return empty colors if no intersection with the atmosphere geometry.
|
||||
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {
|
||||
return;
|
||||
}
|
||||
|
||||
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)
|
||||
// we implement a split strategy: sky or horizon.
|
||||
// For performance reasons, instead of a if/else branch
|
||||
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0
|
||||
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);
|
||||
// Value close to 0.0: close to the horizon
|
||||
// Value close to 1.0: above in the sky
|
||||
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));
|
||||
|
||||
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.
|
||||
float start_0 = primaryRayAtmosphereIntersect.start;
|
||||
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);
|
||||
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.
|
||||
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));
|
||||
|
||||
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)
|
||||
// (1) from outer space we have to use more ray steps to get a realistic rendering
|
||||
// (2) within atmosphere we need fewer steps for faster rendering
|
||||
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters
|
||||
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));
|
||||
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.
|
||||
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.
|
||||
|
||||
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.
|
||||
float rayPositionLength = primaryRayAtmosphereIntersect.start;
|
||||
// (1) Outside the atmosphere: constant rayStepLength
|
||||
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps
|
||||
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;
|
||||
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));
|
||||
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));
|
||||
|
||||
vec3 rayleighAccumulation = vec3(0.0);
|
||||
vec3 mieAccumulation = vec3(0.0);
|
||||
vec2 opticalDepth = vec2(0.0);
|
||||
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);
|
||||
|
||||
// Sample positions on the primary ray.
|
||||
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {
|
||||
|
||||
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot
|
||||
// loop with non-constant condition, so it has to break early instead
|
||||
if (i >= PRIMARY_STEPS) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Calculate sample position along viewpoint ray.
|
||||
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);
|
||||
|
||||
// Calculate height of sample position above ellipsoid.
|
||||
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;
|
||||
|
||||
// Calculate and accumulate density of particles at the sample position.
|
||||
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;
|
||||
opticalDepth += sampleDensity;
|
||||
|
||||
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.
|
||||
czm_ray lightRay = czm_ray(samplePosition, lightDirection);
|
||||
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);
|
||||
|
||||
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);
|
||||
float lightPositionLength = 0.0;
|
||||
|
||||
vec2 lightOpticalDepth = vec2(0.0);
|
||||
|
||||
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.
|
||||
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {
|
||||
|
||||
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot
|
||||
// loop with non-constant condition, so it has to break early instead
|
||||
if (j >= LIGHT_STEPS) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Calculate sample position along light ray.
|
||||
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);
|
||||
|
||||
// Calculate height of the light sample position above ellipsoid.
|
||||
float lightHeight = length(lightPosition) - atmosphereInnerRadius;
|
||||
|
||||
// Calculate density of photons at the light sample position.
|
||||
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;
|
||||
|
||||
// Increment distance on light ray.
|
||||
lightPositionLength += lightStepLength;
|
||||
}
|
||||
|
||||
// Compute attenuation via the primary ray and the light ray.
|
||||
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));
|
||||
|
||||
// Accumulate the scattering.
|
||||
rayleighAccumulation += sampleDensity.x * attenuation;
|
||||
mieAccumulation += sampleDensity.y * attenuation;
|
||||
|
||||
// Increment distance on primary ray.
|
||||
rayPositionLength += (rayStepLength += rayStepLengthIncrease);
|
||||
}
|
||||
|
||||
// Compute the scattering amount.
|
||||
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;
|
||||
mieColor = u_atmosphereMieCoefficient * mieAccumulation;
|
||||
|
||||
// Compute the transmittance i.e. how much light is passing through the atmosphere.
|
||||
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));
|
||||
}
|
||||
|
||||
vec4 computeAtmosphereColor(
|
||||
vec3 positionWC,
|
||||
vec3 lightDirection,
|
||||
vec3 rayleighColor,
|
||||
vec3 mieColor,
|
||||
float opacity
|
||||
) {
|
||||
// Setup the primary ray: from the camera position to the vertex position.
|
||||
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;
|
||||
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);
|
||||
|
||||
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);
|
||||
float cosAngleSq = cosAngle * cosAngle;
|
||||
|
||||
float G = u_atmosphereMieAnisotropy;
|
||||
float GSq = G * G;
|
||||
|
||||
// The Rayleigh phase function.
|
||||
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);
|
||||
// The Mie phase function.
|
||||
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));
|
||||
|
||||
// The final color is generated by combining the effects of the Rayleigh and Mie scattering.
|
||||
vec3 rayleigh = rayleighPhase * rayleighColor;
|
||||
vec3 mie = miePhase * mieColor;
|
||||
|
||||
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;
|
||||
|
||||
return vec4(color, opacity);
|
||||
}
|
||||
+189
@@ -0,0 +1,189 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "uniform vec3 u_radiiAndDynamicAtmosphereColor;\n\
|
||||
\n\
|
||||
uniform float u_atmosphereLightIntensity;\n\
|
||||
uniform float u_atmosphereRayleighScaleHeight;\n\
|
||||
uniform float u_atmosphereMieScaleHeight;\n\
|
||||
uniform float u_atmosphereMieAnisotropy;\n\
|
||||
uniform vec3 u_atmosphereRayleighCoefficient;\n\
|
||||
uniform vec3 u_atmosphereMieCoefficient;\n\
|
||||
\n\
|
||||
const float ATMOSPHERE_THICKNESS = 111e3; // The thickness of the atmosphere in meters.\n\
|
||||
const int PRIMARY_STEPS_MAX = 16; // Maximum number of times the ray from the camera to the world position (primary ray) is sampled.\n\
|
||||
const int LIGHT_STEPS_MAX = 4; // Maximum number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\
|
||||
\n\
|
||||
/**\n\
|
||||
* This function computes the colors contributed by Rayliegh and Mie scattering on a given ray, as well as\n\
|
||||
* the transmittance value for the ray.\n\
|
||||
*\n\
|
||||
* @param {czm_ray} primaryRay The ray from the camera to the position.\n\
|
||||
* @param {float} primaryRayLength The length of the primary ray.\n\
|
||||
* @param {vec3} lightDirection The direction of the light to calculate the scattering from.\n\
|
||||
* @param {vec3} rayleighColor The variable the Rayleigh scattering will be written to.\n\
|
||||
* @param {vec3} mieColor The variable the Mie scattering will be written to.\n\
|
||||
* @param {float} opacity The variable the transmittance will be written to.\n\
|
||||
* @glslFunction\n\
|
||||
*/\n\
|
||||
void computeScattering(\n\
|
||||
czm_ray primaryRay,\n\
|
||||
float primaryRayLength,\n\
|
||||
vec3 lightDirection,\n\
|
||||
float atmosphereInnerRadius,\n\
|
||||
out vec3 rayleighColor,\n\
|
||||
out vec3 mieColor,\n\
|
||||
out float opacity\n\
|
||||
) {\n\
|
||||
\n\
|
||||
// Initialize the default scattering amounts to 0.\n\
|
||||
rayleighColor = vec3(0.0);\n\
|
||||
mieColor = vec3(0.0);\n\
|
||||
opacity = 0.0;\n\
|
||||
\n\
|
||||
float atmosphereOuterRadius = atmosphereInnerRadius + ATMOSPHERE_THICKNESS;\n\
|
||||
\n\
|
||||
vec3 origin = vec3(0.0);\n\
|
||||
\n\
|
||||
// Calculate intersection from the camera to the outer ring of the atmosphere.\n\
|
||||
czm_raySegment primaryRayAtmosphereIntersect = czm_raySphereIntersectionInterval(primaryRay, origin, atmosphereOuterRadius);\n\
|
||||
\n\
|
||||
// Return empty colors if no intersection with the atmosphere geometry.\n\
|
||||
if (primaryRayAtmosphereIntersect == czm_emptyRaySegment) {\n\
|
||||
return;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// To deal with smaller values of PRIMARY_STEPS (e.g. 4)\n\
|
||||
// we implement a split strategy: sky or horizon.\n\
|
||||
// For performance reasons, instead of a if/else branch\n\
|
||||
// a soft choice is implemented through a weight 0.0 <= w_stop_gt_lprl <= 1.0\n\
|
||||
float x = 1e-7 * primaryRayAtmosphereIntersect.stop / length(primaryRayLength);\n\
|
||||
// Value close to 0.0: close to the horizon\n\
|
||||
// Value close to 1.0: above in the sky\n\
|
||||
float w_stop_gt_lprl = 0.5 * (1.0 + czm_approximateTanh(x));\n\
|
||||
\n\
|
||||
// The ray should start from the first intersection with the outer atmopshere, or from the camera position, if it is inside the atmosphere.\n\
|
||||
float start_0 = primaryRayAtmosphereIntersect.start;\n\
|
||||
primaryRayAtmosphereIntersect.start = max(primaryRayAtmosphereIntersect.start, 0.0);\n\
|
||||
// The ray should end at the exit from the atmosphere or at the distance to the vertex, whichever is smaller.\n\
|
||||
primaryRayAtmosphereIntersect.stop = min(primaryRayAtmosphereIntersect.stop, length(primaryRayLength));\n\
|
||||
\n\
|
||||
// For the number of ray steps, distinguish inside or outside atmosphere (outer space)\n\
|
||||
// (1) from outer space we have to use more ray steps to get a realistic rendering\n\
|
||||
// (2) within atmosphere we need fewer steps for faster rendering\n\
|
||||
float x_o_a = start_0 - ATMOSPHERE_THICKNESS; // ATMOSPHERE_THICKNESS used as an ad-hoc constant, no precise meaning here, only the order of magnitude matters\n\
|
||||
float w_inside_atmosphere = 1.0 - 0.5 * (1.0 + czm_approximateTanh(x_o_a));\n\
|
||||
int PRIMARY_STEPS = PRIMARY_STEPS_MAX - int(w_inside_atmosphere * 12.0); // Number of times the ray from the camera to the world position (primary ray) is sampled.\n\
|
||||
int LIGHT_STEPS = LIGHT_STEPS_MAX - int(w_inside_atmosphere * 2.0); // Number of times the light is sampled from the light source's intersection with the atmosphere to a sample position on the primary ray.\n\
|
||||
\n\
|
||||
// Setup for sampling positions along the ray - starting from the intersection with the outer ring of the atmosphere.\n\
|
||||
float rayPositionLength = primaryRayAtmosphereIntersect.start;\n\
|
||||
// (1) Outside the atmosphere: constant rayStepLength\n\
|
||||
// (2) Inside atmosphere: variable rayStepLength to compensate the rough rendering of the smaller number of ray steps\n\
|
||||
float totalRayLength = primaryRayAtmosphereIntersect.stop - rayPositionLength;\n\
|
||||
float rayStepLengthIncrease = w_inside_atmosphere * ((1.0 - w_stop_gt_lprl) * totalRayLength / (float(PRIMARY_STEPS * (PRIMARY_STEPS + 1)) / 2.0));\n\
|
||||
float rayStepLength = max(1.0 - w_inside_atmosphere, w_stop_gt_lprl) * totalRayLength / max(7.0 * w_inside_atmosphere, float(PRIMARY_STEPS));\n\
|
||||
\n\
|
||||
vec3 rayleighAccumulation = vec3(0.0);\n\
|
||||
vec3 mieAccumulation = vec3(0.0);\n\
|
||||
vec2 opticalDepth = vec2(0.0);\n\
|
||||
vec2 heightScale = vec2(u_atmosphereRayleighScaleHeight, u_atmosphereMieScaleHeight);\n\
|
||||
\n\
|
||||
// Sample positions on the primary ray.\n\
|
||||
for (int i = 0; i < PRIMARY_STEPS_MAX; ++i) {\n\
|
||||
\n\
|
||||
// The loop should be: for (int i = 0; i < PRIMARY_STEPS; ++i) {...} but WebGL1 cannot\n\
|
||||
// loop with non-constant condition, so it has to break early instead\n\
|
||||
if (i >= PRIMARY_STEPS) {\n\
|
||||
break;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Calculate sample position along viewpoint ray.\n\
|
||||
vec3 samplePosition = primaryRay.origin + primaryRay.direction * (rayPositionLength + rayStepLength);\n\
|
||||
\n\
|
||||
// Calculate height of sample position above ellipsoid.\n\
|
||||
float sampleHeight = length(samplePosition) - atmosphereInnerRadius;\n\
|
||||
\n\
|
||||
// Calculate and accumulate density of particles at the sample position.\n\
|
||||
vec2 sampleDensity = exp(-sampleHeight / heightScale) * rayStepLength;\n\
|
||||
opticalDepth += sampleDensity;\n\
|
||||
\n\
|
||||
// Generate ray from the sample position segment to the light source, up to the outer ring of the atmosphere.\n\
|
||||
czm_ray lightRay = czm_ray(samplePosition, lightDirection);\n\
|
||||
czm_raySegment lightRayAtmosphereIntersect = czm_raySphereIntersectionInterval(lightRay, origin, atmosphereOuterRadius);\n\
|
||||
\n\
|
||||
float lightStepLength = lightRayAtmosphereIntersect.stop / float(LIGHT_STEPS);\n\
|
||||
float lightPositionLength = 0.0;\n\
|
||||
\n\
|
||||
vec2 lightOpticalDepth = vec2(0.0);\n\
|
||||
\n\
|
||||
// Sample positions along the light ray, to accumulate incidence of light on the latest sample segment.\n\
|
||||
for (int j = 0; j < LIGHT_STEPS_MAX; ++j) {\n\
|
||||
\n\
|
||||
// The loop should be: for (int j = 0; i < LIGHT_STEPS; ++j) {...} but WebGL1 cannot\n\
|
||||
// loop with non-constant condition, so it has to break early instead\n\
|
||||
if (j >= LIGHT_STEPS) {\n\
|
||||
break;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Calculate sample position along light ray.\n\
|
||||
vec3 lightPosition = samplePosition + lightDirection * (lightPositionLength + lightStepLength * 0.5);\n\
|
||||
\n\
|
||||
// Calculate height of the light sample position above ellipsoid.\n\
|
||||
float lightHeight = length(lightPosition) - atmosphereInnerRadius;\n\
|
||||
\n\
|
||||
// Calculate density of photons at the light sample position.\n\
|
||||
lightOpticalDepth += exp(-lightHeight / heightScale) * lightStepLength;\n\
|
||||
\n\
|
||||
// Increment distance on light ray.\n\
|
||||
lightPositionLength += lightStepLength;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Compute attenuation via the primary ray and the light ray.\n\
|
||||
vec3 attenuation = exp(-((u_atmosphereMieCoefficient * (opticalDepth.y + lightOpticalDepth.y)) + (u_atmosphereRayleighCoefficient * (opticalDepth.x + lightOpticalDepth.x))));\n\
|
||||
\n\
|
||||
// Accumulate the scattering.\n\
|
||||
rayleighAccumulation += sampleDensity.x * attenuation;\n\
|
||||
mieAccumulation += sampleDensity.y * attenuation;\n\
|
||||
\n\
|
||||
// Increment distance on primary ray.\n\
|
||||
rayPositionLength += (rayStepLength += rayStepLengthIncrease);\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Compute the scattering amount.\n\
|
||||
rayleighColor = u_atmosphereRayleighCoefficient * rayleighAccumulation;\n\
|
||||
mieColor = u_atmosphereMieCoefficient * mieAccumulation;\n\
|
||||
\n\
|
||||
// Compute the transmittance i.e. how much light is passing through the atmosphere.\n\
|
||||
opacity = length(exp(-((u_atmosphereMieCoefficient * opticalDepth.y) + (u_atmosphereRayleighCoefficient * opticalDepth.x))));\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec4 computeAtmosphereColor(\n\
|
||||
vec3 positionWC,\n\
|
||||
vec3 lightDirection,\n\
|
||||
vec3 rayleighColor,\n\
|
||||
vec3 mieColor,\n\
|
||||
float opacity\n\
|
||||
) {\n\
|
||||
// Setup the primary ray: from the camera position to the vertex position.\n\
|
||||
vec3 cameraToPositionWC = positionWC - czm_viewerPositionWC;\n\
|
||||
vec3 cameraToPositionWCDirection = normalize(cameraToPositionWC);\n\
|
||||
\n\
|
||||
float cosAngle = dot(cameraToPositionWCDirection, lightDirection);\n\
|
||||
float cosAngleSq = cosAngle * cosAngle;\n\
|
||||
\n\
|
||||
float G = u_atmosphereMieAnisotropy;\n\
|
||||
float GSq = G * G;\n\
|
||||
\n\
|
||||
// The Rayleigh phase function.\n\
|
||||
float rayleighPhase = 3.0 / (50.2654824574) * (1.0 + cosAngleSq);\n\
|
||||
// The Mie phase function.\n\
|
||||
float miePhase = 3.0 / (25.1327412287) * ((1.0 - GSq) * (cosAngleSq + 1.0)) / (pow(1.0 + GSq - 2.0 * cosAngle * G, 1.5) * (2.0 + GSq));\n\
|
||||
\n\
|
||||
// The final color is generated by combining the effects of the Rayleigh and Mie scattering.\n\
|
||||
vec3 rayleigh = rayleighPhase * rayleighColor;\n\
|
||||
vec3 mie = miePhase * mieColor;\n\
|
||||
\n\
|
||||
vec3 color = (rayleigh + mie) * u_atmosphereLightIntensity;\n\
|
||||
\n\
|
||||
return vec4(color, opacity);\n\
|
||||
}\n\
|
||||
";
|
||||
+212
@@ -0,0 +1,212 @@
|
||||
uniform sampler2D u_atlas;
|
||||
uniform float u_coarseDepthTestDistance;
|
||||
uniform float u_threePointDepthTestDistance;
|
||||
|
||||
#ifdef VECTOR_TILE
|
||||
uniform vec4 u_highlightColor;
|
||||
#endif
|
||||
|
||||
in vec2 v_textureCoordinates;
|
||||
in vec4 v_pickColor;
|
||||
in vec4 v_color;
|
||||
flat in vec2 v_splitDirectionAndEllipsoidDepthEC;
|
||||
|
||||
#ifdef SDF
|
||||
in vec4 v_outlineColor;
|
||||
in float v_outlineWidth;
|
||||
#endif
|
||||
|
||||
in vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||||
const float SHIFT_LEFT1 = 2.0;
|
||||
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
||||
|
||||
float getGlobeDepthAtCoords(vec2 st)
|
||||
{
|
||||
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));
|
||||
if (logDepthOrDepth == 0.0)
|
||||
{
|
||||
return 0.0; // not on the globe
|
||||
}
|
||||
|
||||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);
|
||||
return eyeCoordinate.z / eyeCoordinate.w;
|
||||
}
|
||||
|
||||
#ifdef SDF
|
||||
|
||||
// Get the distance from the edge of a glyph at a given position sampling an SDF texture.
|
||||
float getDistance(vec2 position)
|
||||
{
|
||||
return texture(u_atlas, position).r;
|
||||
}
|
||||
|
||||
// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.
|
||||
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)
|
||||
{
|
||||
float distance = getDistance(position);
|
||||
|
||||
if (outlineWidth > 0.0)
|
||||
{
|
||||
// Don't get the outline edge exceed the SDF_EDGE
|
||||
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);
|
||||
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
||||
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);
|
||||
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);
|
||||
return vec4(sdfColor.rgb, sdfColor.a * alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);
|
||||
return vec4(v_color.rgb, v_color.a * alpha);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
bool getDepthTestEnabled() {
|
||||
float temp = v_compressed.y;
|
||||
temp = temp * SHIFT_RIGHT1;
|
||||
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;
|
||||
return temp2 != 0.0;
|
||||
}
|
||||
|
||||
float getRelativeEyeDepth(float eyeDepth, float distanceToEllipsoid, float epsilon) {
|
||||
float depthDifferential = eyeDepth - distanceToEllipsoid;
|
||||
float depthRatio = abs(depthDifferential / distanceToEllipsoid);
|
||||
if (depthRatio < epsilon) {
|
||||
// The approximations are imprecise, so use an epsilon check for small value differences and assume a value of 0.0
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return depthDifferential;
|
||||
}
|
||||
|
||||
// Extra manual depth testing is done to allow more control over how a billboard is occluded
|
||||
// by the globe when near and far from the camera.
|
||||
void doDepthTest(float eyeDepth, float globeDepth) {
|
||||
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
||||
// Since discarding vertices is not possible, the vertex shader sets eyeDepth to 0 to indicate the depth test failed. Apply the discard here.
|
||||
if (eyeDepth > -u_threePointDepthTestDistance) {
|
||||
if (eyeDepth == 0.0) {
|
||||
discard;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
bool useGlobeDepth = eyeDepth > -u_coarseDepthTestDistance;
|
||||
if (useGlobeDepth && globeDepth == 0.0) {
|
||||
// Pixel is not on the globe, so there is no distance to compare against. Pass.
|
||||
return;
|
||||
}
|
||||
|
||||
// If the camera is close, compare against the globe depth texture that includes depth from the 3D tile pass.
|
||||
if (useGlobeDepth && getRelativeEyeDepth(eyeDepth, globeDepth, czm_epsilon1) < 0.0) {
|
||||
discard;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOG_DEPTH
|
||||
void writeDepth(float eyeDepth, float globeDepth, float distanceToEllipsoid) {
|
||||
// If we've made it here, the manual depth test above determined that this fragment should be visible.
|
||||
// But the automatic depth test must still run in order to write the result to the depth buffer, and its results may
|
||||
// disagree with our manual depth test's results. To prefer our manual results when in front of the globe, apply an offset towards the camera.
|
||||
|
||||
float depthArg = v_depthFromNearPlusOne;
|
||||
|
||||
if (globeDepth != 0.0 && getRelativeEyeDepth(eyeDepth, distanceToEllipsoid, czm_epsilon3) > 0.0) {
|
||||
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;
|
||||
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);
|
||||
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);
|
||||
depthArg = min(depthArg, globeOnTop);
|
||||
}
|
||||
|
||||
czm_writeLogDepth(depthArg);
|
||||
}
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
if (v_splitDirectionAndEllipsoidDepthEC.x < 0.0 && gl_FragCoord.x > czm_splitPosition) {
|
||||
discard;
|
||||
}
|
||||
if (v_splitDirectionAndEllipsoidDepthEC.x > 0.0 && gl_FragCoord.x < czm_splitPosition) {
|
||||
discard;
|
||||
}
|
||||
|
||||
if (getDepthTestEnabled()) {
|
||||
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;
|
||||
float eyeDepth = v_compressed.x;
|
||||
float globeDepth = getGlobeDepthAtCoords(fragSt);
|
||||
float distanceToEllipsoid = -v_splitDirectionAndEllipsoidDepthEC.y;
|
||||
doDepthTest(eyeDepth, globeDepth);
|
||||
|
||||
#ifdef LOG_DEPTH
|
||||
writeDepth(eyeDepth, globeDepth, distanceToEllipsoid);
|
||||
#endif
|
||||
}
|
||||
|
||||
vec4 color = texture(u_atlas, v_textureCoordinates);
|
||||
|
||||
#ifdef SDF
|
||||
float outlineWidth = v_outlineWidth;
|
||||
vec4 outlineColor = v_outlineColor;
|
||||
|
||||
// Get the current distance
|
||||
float distance = getDistance(v_textureCoordinates);
|
||||
|
||||
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))
|
||||
float smoothing = fwidth(distance);
|
||||
// Get an offset that is approximately half the distance to the neighbor pixels
|
||||
// 0.354 is approximately half of 1/sqrt(2)
|
||||
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));
|
||||
|
||||
// Sample the center point
|
||||
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
||||
|
||||
// Sample the 4 neighbors
|
||||
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||||
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||||
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||||
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);
|
||||
|
||||
// Equally weight the center sample and the 4 neighboring samples
|
||||
color = (center + color1 + color2 + color3 + color4)/5.0;
|
||||
#else
|
||||
// If no derivatives available (IE 10?), just do a single sample
|
||||
float smoothing = 1.0/32.0;
|
||||
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);
|
||||
#endif
|
||||
|
||||
color = czm_gammaCorrect(color);
|
||||
#else
|
||||
color = czm_gammaCorrect(color);
|
||||
color *= czm_gammaCorrect(v_color);
|
||||
#endif
|
||||
|
||||
// Fully transparent parts of the billboard are not pickable.
|
||||
#if !defined(OPAQUE) && !defined(TRANSLUCENT)
|
||||
if (color.a < 0.005) // matches 0/255 and 1/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#else
|
||||
// The billboard is rendered twice. The opaque pass discards translucent fragments
|
||||
// and the translucent pass discards opaque fragments.
|
||||
#ifdef OPAQUE
|
||||
if (color.a < 0.995) // matches < 254/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#else
|
||||
if (color.a >= 0.995) // matches 254/255 and 255/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VECTOR_TILE
|
||||
color *= u_highlightColor;
|
||||
#endif
|
||||
out_FragColor = color;
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "uniform sampler2D u_atlas;\n\
|
||||
uniform float u_coarseDepthTestDistance;\n\
|
||||
uniform float u_threePointDepthTestDistance;\n\
|
||||
\n\
|
||||
#ifdef VECTOR_TILE\n\
|
||||
uniform vec4 u_highlightColor;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
in vec2 v_textureCoordinates;\n\
|
||||
in vec4 v_pickColor;\n\
|
||||
in vec4 v_color;\n\
|
||||
flat in vec2 v_splitDirectionAndEllipsoidDepthEC;\n\
|
||||
\n\
|
||||
#ifdef SDF\n\
|
||||
in vec4 v_outlineColor;\n\
|
||||
in float v_outlineWidth;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
in vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize\n\
|
||||
const float SHIFT_LEFT1 = 2.0;\n\
|
||||
const float SHIFT_RIGHT1 = 1.0 / 2.0;\n\
|
||||
\n\
|
||||
float getGlobeDepthAtCoords(vec2 st)\n\
|
||||
{\n\
|
||||
float logDepthOrDepth = czm_unpackDepth(texture(czm_globeDepthTexture, st));\n\
|
||||
if (logDepthOrDepth == 0.0)\n\
|
||||
{\n\
|
||||
return 0.0; // not on the globe\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(gl_FragCoord.xy, logDepthOrDepth);\n\
|
||||
return eyeCoordinate.z / eyeCoordinate.w;\n\
|
||||
}\n\
|
||||
\n\
|
||||
#ifdef SDF\n\
|
||||
\n\
|
||||
// Get the distance from the edge of a glyph at a given position sampling an SDF texture.\n\
|
||||
float getDistance(vec2 position)\n\
|
||||
{\n\
|
||||
return texture(u_atlas, position).r;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Samples the sdf texture at the given position and produces a color based on the fill color and the outline.\n\
|
||||
vec4 getSDFColor(vec2 position, float outlineWidth, vec4 outlineColor, float smoothing)\n\
|
||||
{\n\
|
||||
float distance = getDistance(position);\n\
|
||||
\n\
|
||||
if (outlineWidth > 0.0)\n\
|
||||
{\n\
|
||||
// Don't get the outline edge exceed the SDF_EDGE\n\
|
||||
float outlineEdge = clamp(SDF_EDGE - outlineWidth, 0.0, SDF_EDGE);\n\
|
||||
float outlineFactor = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\n\
|
||||
vec4 sdfColor = mix(outlineColor, v_color, outlineFactor);\n\
|
||||
float alpha = smoothstep(outlineEdge - smoothing, outlineEdge + smoothing, distance);\n\
|
||||
return vec4(sdfColor.rgb, sdfColor.a * alpha);\n\
|
||||
}\n\
|
||||
else\n\
|
||||
{\n\
|
||||
float alpha = smoothstep(SDF_EDGE - smoothing, SDF_EDGE + smoothing, distance);\n\
|
||||
return vec4(v_color.rgb, v_color.a * alpha);\n\
|
||||
}\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
bool getDepthTestEnabled() {\n\
|
||||
float temp = v_compressed.y;\n\
|
||||
temp = temp * SHIFT_RIGHT1;\n\
|
||||
float temp2 = (temp - floor(temp)) * SHIFT_LEFT1;\n\
|
||||
return temp2 != 0.0;\n\
|
||||
}\n\
|
||||
\n\
|
||||
float getRelativeEyeDepth(float eyeDepth, float distanceToEllipsoid, float epsilon) {\n\
|
||||
float depthDifferential = eyeDepth - distanceToEllipsoid;\n\
|
||||
float depthRatio = abs(depthDifferential / distanceToEllipsoid);\n\
|
||||
if (depthRatio < epsilon) {\n\
|
||||
// The approximations are imprecise, so use an epsilon check for small value differences and assume a value of 0.0\n\
|
||||
return 0.0;\n\
|
||||
}\n\
|
||||
\n\
|
||||
return depthDifferential;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// Extra manual depth testing is done to allow more control over how a billboard is occluded\n\
|
||||
// by the globe when near and far from the camera.\n\
|
||||
void doDepthTest(float eyeDepth, float globeDepth) {\n\
|
||||
\n\
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK\n\
|
||||
// Since discarding vertices is not possible, the vertex shader sets eyeDepth to 0 to indicate the depth test failed. Apply the discard here.\n\
|
||||
if (eyeDepth > -u_threePointDepthTestDistance) {\n\
|
||||
if (eyeDepth == 0.0) {\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
return;\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
bool useGlobeDepth = eyeDepth > -u_coarseDepthTestDistance;\n\
|
||||
if (useGlobeDepth && globeDepth == 0.0) {\n\
|
||||
// Pixel is not on the globe, so there is no distance to compare against. Pass.\n\
|
||||
return;\n\
|
||||
}\n\
|
||||
\n\
|
||||
// If the camera is close, compare against the globe depth texture that includes depth from the 3D tile pass.\n\
|
||||
if (useGlobeDepth && getRelativeEyeDepth(eyeDepth, globeDepth, czm_epsilon1) < 0.0) {\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
}\n\
|
||||
\n\
|
||||
#ifdef LOG_DEPTH\n\
|
||||
void writeDepth(float eyeDepth, float globeDepth, float distanceToEllipsoid) {\n\
|
||||
// If we've made it here, the manual depth test above determined that this fragment should be visible.\n\
|
||||
// But the automatic depth test must still run in order to write the result to the depth buffer, and its results may\n\
|
||||
// disagree with our manual depth test's results. To prefer our manual results when in front of the globe, apply an offset towards the camera.\n\
|
||||
\n\
|
||||
float depthArg = v_depthFromNearPlusOne;\n\
|
||||
\n\
|
||||
if (globeDepth != 0.0 && getRelativeEyeDepth(eyeDepth, distanceToEllipsoid, czm_epsilon3) > 0.0) {\n\
|
||||
float globeDepthFromNearPlusOne = (-globeDepth - czm_currentFrustum.x) + 1.0;\n\
|
||||
float nudge = max(globeDepthFromNearPlusOne * 5e-6, czm_epsilon7);\n\
|
||||
float globeOnTop = max(1.0, globeDepthFromNearPlusOne - nudge);\n\
|
||||
depthArg = min(depthArg, globeOnTop);\n\
|
||||
}\n\
|
||||
\n\
|
||||
czm_writeLogDepth(depthArg);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
if (v_splitDirectionAndEllipsoidDepthEC.x < 0.0 && gl_FragCoord.x > czm_splitPosition) {\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
if (v_splitDirectionAndEllipsoidDepthEC.x > 0.0 && gl_FragCoord.x < czm_splitPosition) {\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
\n\
|
||||
if (getDepthTestEnabled()) {\n\
|
||||
vec2 fragSt = gl_FragCoord.xy / czm_viewport.zw;\n\
|
||||
float eyeDepth = v_compressed.x;\n\
|
||||
float globeDepth = getGlobeDepthAtCoords(fragSt);\n\
|
||||
float distanceToEllipsoid = -v_splitDirectionAndEllipsoidDepthEC.y;\n\
|
||||
doDepthTest(eyeDepth, globeDepth);\n\
|
||||
\n\
|
||||
#ifdef LOG_DEPTH\n\
|
||||
writeDepth(eyeDepth, globeDepth, distanceToEllipsoid);\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec4 color = texture(u_atlas, v_textureCoordinates);\n\
|
||||
\n\
|
||||
#ifdef SDF\n\
|
||||
float outlineWidth = v_outlineWidth;\n\
|
||||
vec4 outlineColor = v_outlineColor;\n\
|
||||
\n\
|
||||
// Get the current distance\n\
|
||||
float distance = getDistance(v_textureCoordinates);\n\
|
||||
\n\
|
||||
#if (__VERSION__ == 300 || defined(GL_OES_standard_derivatives))\n\
|
||||
float smoothing = fwidth(distance);\n\
|
||||
// Get an offset that is approximately half the distance to the neighbor pixels\n\
|
||||
// 0.354 is approximately half of 1/sqrt(2)\n\
|
||||
vec2 sampleOffset = 0.354 * vec2(dFdx(v_textureCoordinates) + dFdy(v_textureCoordinates));\n\
|
||||
\n\
|
||||
// Sample the center point\n\
|
||||
vec4 center = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n\
|
||||
\n\
|
||||
// Sample the 4 neighbors\n\
|
||||
vec4 color1 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\n\
|
||||
vec4 color2 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, sampleOffset.y), outlineWidth, outlineColor, smoothing);\n\
|
||||
vec4 color3 = getSDFColor(v_textureCoordinates + vec2(-sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\n\
|
||||
vec4 color4 = getSDFColor(v_textureCoordinates + vec2(sampleOffset.x, -sampleOffset.y), outlineWidth, outlineColor, smoothing);\n\
|
||||
\n\
|
||||
// Equally weight the center sample and the 4 neighboring samples\n\
|
||||
color = (center + color1 + color2 + color3 + color4)/5.0;\n\
|
||||
#else\n\
|
||||
// If no derivatives available (IE 10?), just do a single sample\n\
|
||||
float smoothing = 1.0/32.0;\n\
|
||||
color = getSDFColor(v_textureCoordinates, outlineWidth, outlineColor, smoothing);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
color = czm_gammaCorrect(color);\n\
|
||||
#else\n\
|
||||
color = czm_gammaCorrect(color);\n\
|
||||
color *= czm_gammaCorrect(v_color);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
// Fully transparent parts of the billboard are not pickable.\n\
|
||||
#if !defined(OPAQUE) && !defined(TRANSLUCENT)\n\
|
||||
if (color.a < 0.005) // matches 0/255 and 1/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
#else\n\
|
||||
// The billboard is rendered twice. The opaque pass discards translucent fragments\n\
|
||||
// and the translucent pass discards opaque fragments.\n\
|
||||
#ifdef OPAQUE\n\
|
||||
if (color.a < 0.995) // matches < 254/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
#else\n\
|
||||
if (color.a >= 0.995) // matches 254/255 and 255/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef VECTOR_TILE\n\
|
||||
color *= u_highlightColor;\n\
|
||||
#endif\n\
|
||||
out_FragColor = color;\n\
|
||||
}\n\
|
||||
";
|
||||
+378
@@ -0,0 +1,378 @@
|
||||
uniform float u_threePointDepthTestDistance;
|
||||
in vec2 direction;
|
||||
in vec4 positionHighAndScale;
|
||||
in vec4 positionLowAndRotation;
|
||||
in vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)
|
||||
in vec4 compressedAttribute1; // aligned axis, translucency by distance, image width
|
||||
in vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free
|
||||
in vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)
|
||||
in vec4 scaleByDistance; // near, nearScale, far, farScale
|
||||
in vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale
|
||||
in vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistanceSq, dimensions
|
||||
in vec2 sdf; // sdf outline color (rgb) and width (w)
|
||||
in float splitDirection; // splitDirection
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
||||
in vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates
|
||||
#endif
|
||||
#ifdef VECTOR_TILE
|
||||
in float a_batchId;
|
||||
#endif
|
||||
|
||||
out vec2 v_textureCoordinates;
|
||||
out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize
|
||||
|
||||
out vec4 v_pickColor;
|
||||
out vec4 v_color;
|
||||
flat out vec2 v_splitDirectionAndEllipsoidDepthEC; // x: splitDirection, y: ellipsoid depth in eye coordinates
|
||||
#ifdef SDF
|
||||
out vec4 v_outlineColor;
|
||||
out float v_outlineWidth;
|
||||
#endif
|
||||
|
||||
const float UPPER_BOUND = 32768.0;
|
||||
|
||||
const float SHIFT_LEFT16 = 65536.0;
|
||||
const float SHIFT_LEFT12 = 4096.0;
|
||||
const float SHIFT_LEFT8 = 256.0;
|
||||
const float SHIFT_LEFT7 = 128.0;
|
||||
const float SHIFT_LEFT5 = 32.0;
|
||||
const float SHIFT_LEFT3 = 8.0;
|
||||
const float SHIFT_LEFT2 = 4.0;
|
||||
const float SHIFT_LEFT1 = 2.0;
|
||||
|
||||
const float SHIFT_RIGHT12 = 1.0 / 4096.0;
|
||||
const float SHIFT_RIGHT8 = 1.0 / 256.0;
|
||||
const float SHIFT_RIGHT7 = 1.0 / 128.0;
|
||||
const float SHIFT_RIGHT5 = 1.0 / 32.0;
|
||||
const float SHIFT_RIGHT3 = 1.0 / 8.0;
|
||||
const float SHIFT_RIGHT2 = 1.0 / 4.0;
|
||||
const float SHIFT_RIGHT1 = 1.0 / 2.0;
|
||||
|
||||
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)
|
||||
{
|
||||
// Note the halfSize cannot be computed in JavaScript because it is sent via
|
||||
// compressed vertex attributes that coerce it to an integer.
|
||||
vec2 halfSize = imageSize * scale * 0.5;
|
||||
halfSize *= ((direction * 2.0) - 1.0);
|
||||
|
||||
vec2 originTranslate = origin * abs(halfSize);
|
||||
|
||||
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
||||
if (validAlignedAxis || rotation != 0.0)
|
||||
{
|
||||
float angle = rotation;
|
||||
if (validAlignedAxis)
|
||||
{
|
||||
vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);
|
||||
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /
|
||||
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));
|
||||
}
|
||||
|
||||
float cosTheta = cos(angle);
|
||||
float sinTheta = sin(angle);
|
||||
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
|
||||
halfSize = rotationMatrix * halfSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
mpp = czm_metersPerPixel(positionEC);
|
||||
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);
|
||||
positionEC.xy += (translate + pixelOffset) * mpp;
|
||||
|
||||
return positionEC;
|
||||
}
|
||||
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
||||
float getGlobeDepth(vec4 positionEC)
|
||||
{
|
||||
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);
|
||||
|
||||
float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));
|
||||
|
||||
if (globeDepth == 0.0)
|
||||
{
|
||||
return 0.0; // not on the globe
|
||||
}
|
||||
|
||||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);
|
||||
return eyeCoordinate.z / eyeCoordinate.w;
|
||||
}
|
||||
#endif
|
||||
void main()
|
||||
{
|
||||
// Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition
|
||||
|
||||
// unpack attributes
|
||||
vec3 positionHigh = positionHighAndScale.xyz;
|
||||
vec3 positionLow = positionLowAndRotation.xyz;
|
||||
float scale = positionHighAndScale.w;
|
||||
|
||||
#if defined(ROTATION) || defined(ALIGNED_AXIS)
|
||||
float rotation = positionLowAndRotation.w;
|
||||
#else
|
||||
float rotation = 0.0;
|
||||
#endif
|
||||
|
||||
float compressed = compressedAttribute0.x;
|
||||
|
||||
vec2 pixelOffset;
|
||||
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);
|
||||
compressed -= pixelOffset.x * SHIFT_LEFT7;
|
||||
pixelOffset.x -= UPPER_BOUND;
|
||||
|
||||
vec2 origin;
|
||||
origin.x = floor(compressed * SHIFT_RIGHT5);
|
||||
compressed -= origin.x * SHIFT_LEFT5;
|
||||
|
||||
origin.y = floor(compressed * SHIFT_RIGHT3);
|
||||
compressed -= origin.y * SHIFT_LEFT3;
|
||||
|
||||
origin -= vec2(1.0);
|
||||
|
||||
float show = floor(compressed * SHIFT_RIGHT2);
|
||||
compressed -= show * SHIFT_LEFT2;
|
||||
|
||||
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);
|
||||
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);
|
||||
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;
|
||||
|
||||
float temp = compressedAttribute0.y * SHIFT_RIGHT8;
|
||||
pixelOffset.y = -(floor(temp) - UPPER_BOUND);
|
||||
|
||||
vec2 translate;
|
||||
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;
|
||||
|
||||
temp = compressedAttribute0.z * SHIFT_RIGHT8;
|
||||
translate.x = floor(temp) - UPPER_BOUND;
|
||||
translate.x *= SHIFT_RIGHT2; // undo translateX scaling (helps preserve subpixel precision, see BillboardCollection.js attribute writer for more info)
|
||||
|
||||
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;
|
||||
translate.y -= UPPER_BOUND;
|
||||
translate.y *= SHIFT_RIGHT2;
|
||||
|
||||
temp = compressedAttribute1.x * SHIFT_RIGHT8;
|
||||
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);
|
||||
|
||||
vec2 imageSize = vec2(floor(temp), temp2);
|
||||
|
||||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||||
vec4 translucencyByDistance;
|
||||
translucencyByDistance.x = compressedAttribute1.z;
|
||||
translucencyByDistance.z = compressedAttribute1.w;
|
||||
|
||||
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||||
|
||||
temp = compressedAttribute1.y * SHIFT_RIGHT8;
|
||||
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;
|
||||
#endif
|
||||
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
||||
temp = compressedAttribute3.w;
|
||||
temp = temp * SHIFT_RIGHT12;
|
||||
|
||||
vec2 dimensions;
|
||||
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;
|
||||
dimensions.x = floor(temp);
|
||||
#endif
|
||||
|
||||
#ifdef ALIGNED_AXIS
|
||||
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));
|
||||
temp = compressedAttribute2.z * SHIFT_RIGHT5;
|
||||
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;
|
||||
#else
|
||||
vec3 alignedAxis = vec3(0.0);
|
||||
bool validAlignedAxis = false;
|
||||
#endif
|
||||
|
||||
vec4 color = czm_decodeRGB8(compressedAttribute2.x);
|
||||
vec4 pickColor = czm_decodeRGB8(compressedAttribute2.y);
|
||||
|
||||
temp = compressedAttribute2.z * SHIFT_RIGHT8;
|
||||
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;
|
||||
temp = floor(temp) * SHIFT_RIGHT8;
|
||||
|
||||
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;
|
||||
pickColor.a /= 255.0;
|
||||
|
||||
color.a = floor(temp);
|
||||
color.a /= 255.0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
||||
|
||||
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);
|
||||
positionEC.xyz *= show;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)
|
||||
float lengthSq;
|
||||
if (czm_sceneMode == czm_sceneMode2D)
|
||||
{
|
||||
// 2D camera distance is a special case
|
||||
// treat all billboards as flattened to the z=0.0 plane
|
||||
lengthSq = czm_eyeHeight2D.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
lengthSq = dot(positionEC.xyz, positionEC.xyz);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EYE_DISTANCE_SCALING
|
||||
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);
|
||||
scale *= distanceScale;
|
||||
translate *= distanceScale;
|
||||
// push vertex behind near plane for clipping
|
||||
if (scale == 0.0)
|
||||
{
|
||||
positionEC.xyz = vec3(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
float translucency = 1.0;
|
||||
#ifdef EYE_DISTANCE_TRANSLUCENCY
|
||||
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);
|
||||
// push vertex behind near plane for clipping
|
||||
if (translucency == 0.0)
|
||||
{
|
||||
positionEC.xyz = vec3(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EYE_DISTANCE_PIXEL_OFFSET
|
||||
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);
|
||||
pixelOffset *= pixelOffsetScale;
|
||||
#endif
|
||||
|
||||
#ifdef DISTANCE_DISPLAY_CONDITION
|
||||
float nearSq = compressedAttribute3.x;
|
||||
float farSq = compressedAttribute3.y;
|
||||
if (lengthSq < nearSq || lengthSq > farSq)
|
||||
{
|
||||
positionEC.xyz = vec3(0.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
mat2 rotationMatrix;
|
||||
float mpp;
|
||||
|
||||
float enableDepthCheck = 1.0;
|
||||
#ifdef DISABLE_DEPTH_DISTANCE
|
||||
float disableDepthTestDistanceSq = compressedAttribute3.z;
|
||||
if (disableDepthTestDistanceSq == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)
|
||||
{
|
||||
disableDepthTestDistanceSq = czm_minimumDisableDepthTestDistance;
|
||||
}
|
||||
|
||||
if (lengthSq < disableDepthTestDistanceSq || disableDepthTestDistanceSq < 0.0)
|
||||
{
|
||||
enableDepthCheck = 0.0;
|
||||
}
|
||||
#endif
|
||||
|
||||
v_splitDirectionAndEllipsoidDepthEC.y = czm_infinity;
|
||||
vec3 ellipsoidCenter = czm_view[3].xyz;
|
||||
vec3 rayDirection = normalize(positionEC.xyz);
|
||||
czm_ray ray = czm_ray(vec3(0.0), rayDirection);
|
||||
vec3 ellipsoid_inverseRadii = czm_ellipsoidInverseRadii;
|
||||
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);
|
||||
|
||||
if (!czm_isEmpty(intersection))
|
||||
{
|
||||
v_splitDirectionAndEllipsoidDepthEC.y = intersection.start;
|
||||
}
|
||||
|
||||
v_compressed.y = enableDepthCheck;
|
||||
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK
|
||||
if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) && (enableDepthCheck == 1.0)) {
|
||||
float depthsilon = 10.0;
|
||||
vec2 depthOrigin;
|
||||
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin.
|
||||
// Otherwise, transform the label origin to -1, 0, 1 (right, center, left).
|
||||
depthOrigin.x = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));
|
||||
depthOrigin.x = czm_branchFreeTernary(depthOrigin.x == 0.0, origin.x, depthOrigin.x - 2.0);
|
||||
depthOrigin.y = origin.y;
|
||||
|
||||
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||||
float globeDepth1 = getGlobeDepth(pEC1);
|
||||
|
||||
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)
|
||||
{
|
||||
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||||
float globeDepth2 = getGlobeDepth(pEC2);
|
||||
|
||||
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)
|
||||
{
|
||||
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||||
float globeDepth3 = getGlobeDepth(pEC3);
|
||||
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)
|
||||
{
|
||||
// "Discard" this vertex, as three key points fail depth test.
|
||||
positionEC.xyz = vec3(0.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// Write out the eyespace depth before applying the screen space offset, but after potentially "discarding" the vertex
|
||||
// by setting its eyespace position to zero, via the three-point depth test above.
|
||||
v_compressed.x = positionEC.z;
|
||||
|
||||
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);
|
||||
gl_Position = czm_projection * positionEC;
|
||||
v_textureCoordinates = textureCoordinates;
|
||||
|
||||
#ifdef LOG_DEPTH
|
||||
czm_vertexLogDepth();
|
||||
#endif
|
||||
|
||||
#ifdef DISABLE_DEPTH_DISTANCE
|
||||
|
||||
if (disableDepthTestDistanceSq != 0.0)
|
||||
{
|
||||
// Don't try to "multiply both sides" by w. Greater/less-than comparisons won't work for negative values of w.
|
||||
float zclip = gl_Position.z / gl_Position.w;
|
||||
bool clipped = (zclip < -1.0 || zclip > 1.0);
|
||||
// disableDepthTestDistanceSq can be less than zero if it's explicitly set to -1 in JS (as a sentinel value equivalent to infinity)
|
||||
if (!clipped && (disableDepthTestDistanceSq < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistanceSq)))
|
||||
{
|
||||
// Position z on the near plane.
|
||||
gl_Position.z = -gl_Position.w;
|
||||
#ifdef LOG_DEPTH
|
||||
v_depthFromNearPlusOne = 1.0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDF
|
||||
vec4 outlineColor = czm_decodeRGB8(sdf.x);
|
||||
float outlineWidth;
|
||||
|
||||
temp = sdf.y;
|
||||
temp = temp * SHIFT_RIGHT8;
|
||||
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;
|
||||
temp = floor(temp) * SHIFT_RIGHT8;
|
||||
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;
|
||||
outlineColor.a = floor(temp);
|
||||
outlineColor.a /= 255.0;
|
||||
|
||||
v_outlineWidth = outlineWidth / 255.0;
|
||||
v_outlineColor = outlineColor;
|
||||
v_outlineColor.a *= translucency;
|
||||
#endif
|
||||
|
||||
v_pickColor = pickColor;
|
||||
|
||||
v_color = color;
|
||||
v_color.a *= translucency;
|
||||
v_splitDirectionAndEllipsoidDepthEC.x = splitDirection;
|
||||
}
|
||||
+380
@@ -0,0 +1,380 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "uniform float u_threePointDepthTestDistance;\n\
|
||||
in vec2 direction;\n\
|
||||
in vec4 positionHighAndScale;\n\
|
||||
in vec4 positionLowAndRotation;\n\
|
||||
in vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)\n\
|
||||
in vec4 compressedAttribute1; // aligned axis, translucency by distance, image width\n\
|
||||
in vec4 compressedAttribute2; // label horizontal origin, image height, color, pick color, size in meters, valid aligned axis, 13 bits free\n\
|
||||
in vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)\n\
|
||||
in vec4 scaleByDistance; // near, nearScale, far, farScale\n\
|
||||
in vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale\n\
|
||||
in vec4 compressedAttribute3; // distance display condition near, far, disableDepthTestDistanceSq, dimensions\n\
|
||||
in vec2 sdf; // sdf outline color (rgb) and width (w)\n\
|
||||
in float splitDirection; // splitDirection\n\
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK\n\
|
||||
in vec4 textureCoordinateBoundsOrLabelTranslate; // the min and max x and y values for the texture coordinates\n\
|
||||
#endif\n\
|
||||
#ifdef VECTOR_TILE\n\
|
||||
in float a_batchId;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
out vec2 v_textureCoordinates;\n\
|
||||
out vec4 v_compressed; // x: eyeDepth, y: applyTranslate & enableDepthCheck, z: dimensions, w: imageSize\n\
|
||||
\n\
|
||||
out vec4 v_pickColor;\n\
|
||||
out vec4 v_color;\n\
|
||||
flat out vec2 v_splitDirectionAndEllipsoidDepthEC; // x: splitDirection, y: ellipsoid depth in eye coordinates\n\
|
||||
#ifdef SDF\n\
|
||||
out vec4 v_outlineColor;\n\
|
||||
out float v_outlineWidth;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
const float UPPER_BOUND = 32768.0;\n\
|
||||
\n\
|
||||
const float SHIFT_LEFT16 = 65536.0;\n\
|
||||
const float SHIFT_LEFT12 = 4096.0;\n\
|
||||
const float SHIFT_LEFT8 = 256.0;\n\
|
||||
const float SHIFT_LEFT7 = 128.0;\n\
|
||||
const float SHIFT_LEFT5 = 32.0;\n\
|
||||
const float SHIFT_LEFT3 = 8.0;\n\
|
||||
const float SHIFT_LEFT2 = 4.0;\n\
|
||||
const float SHIFT_LEFT1 = 2.0;\n\
|
||||
\n\
|
||||
const float SHIFT_RIGHT12 = 1.0 / 4096.0;\n\
|
||||
const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\
|
||||
const float SHIFT_RIGHT7 = 1.0 / 128.0;\n\
|
||||
const float SHIFT_RIGHT5 = 1.0 / 32.0;\n\
|
||||
const float SHIFT_RIGHT3 = 1.0 / 8.0;\n\
|
||||
const float SHIFT_RIGHT2 = 1.0 / 4.0;\n\
|
||||
const float SHIFT_RIGHT1 = 1.0 / 2.0;\n\
|
||||
\n\
|
||||
vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters, out mat2 rotationMatrix, out float mpp)\n\
|
||||
{\n\
|
||||
// Note the halfSize cannot be computed in JavaScript because it is sent via\n\
|
||||
// compressed vertex attributes that coerce it to an integer.\n\
|
||||
vec2 halfSize = imageSize * scale * 0.5;\n\
|
||||
halfSize *= ((direction * 2.0) - 1.0);\n\
|
||||
\n\
|
||||
vec2 originTranslate = origin * abs(halfSize);\n\
|
||||
\n\
|
||||
#if defined(ROTATION) || defined(ALIGNED_AXIS)\n\
|
||||
if (validAlignedAxis || rotation != 0.0)\n\
|
||||
{\n\
|
||||
float angle = rotation;\n\
|
||||
if (validAlignedAxis)\n\
|
||||
{\n\
|
||||
vec4 projectedAlignedAxis = czm_modelView3D * vec4(alignedAxis, 0.0);\n\
|
||||
angle += sign(-projectedAlignedAxis.x) * acos(sign(projectedAlignedAxis.y) * (projectedAlignedAxis.y * projectedAlignedAxis.y) /\n\
|
||||
(projectedAlignedAxis.x * projectedAlignedAxis.x + projectedAlignedAxis.y * projectedAlignedAxis.y));\n\
|
||||
}\n\
|
||||
\n\
|
||||
float cosTheta = cos(angle);\n\
|
||||
float sinTheta = sin(angle);\n\
|
||||
rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\
|
||||
halfSize = rotationMatrix * halfSize;\n\
|
||||
}\n\
|
||||
else\n\
|
||||
{\n\
|
||||
rotationMatrix = mat2(1.0, 0.0, 0.0, 1.0);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
mpp = czm_metersPerPixel(positionEC);\n\
|
||||
positionEC.xy += (originTranslate + halfSize) * czm_branchFreeTernary(sizeInMeters, 1.0, mpp);\n\
|
||||
positionEC.xy += (translate + pixelOffset) * mpp;\n\
|
||||
\n\
|
||||
return positionEC;\n\
|
||||
}\n\
|
||||
\n\
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK\n\
|
||||
float getGlobeDepth(vec4 positionEC)\n\
|
||||
{\n\
|
||||
vec4 posWC = czm_eyeToWindowCoordinates(positionEC);\n\
|
||||
\n\
|
||||
float globeDepth = czm_unpackDepth(texture(czm_globeDepthTexture, posWC.xy / czm_viewport.zw));\n\
|
||||
\n\
|
||||
if (globeDepth == 0.0)\n\
|
||||
{\n\
|
||||
return 0.0; // not on the globe\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec4 eyeCoordinate = czm_windowToEyeCoordinates(posWC.xy, globeDepth);\n\
|
||||
return eyeCoordinate.z / eyeCoordinate.w;\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
// Modifying this shader may also require modifications to Billboard._computeScreenSpacePosition\n\
|
||||
\n\
|
||||
// unpack attributes\n\
|
||||
vec3 positionHigh = positionHighAndScale.xyz;\n\
|
||||
vec3 positionLow = positionLowAndRotation.xyz;\n\
|
||||
float scale = positionHighAndScale.w;\n\
|
||||
\n\
|
||||
#if defined(ROTATION) || defined(ALIGNED_AXIS)\n\
|
||||
float rotation = positionLowAndRotation.w;\n\
|
||||
#else\n\
|
||||
float rotation = 0.0;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
float compressed = compressedAttribute0.x;\n\
|
||||
\n\
|
||||
vec2 pixelOffset;\n\
|
||||
pixelOffset.x = floor(compressed * SHIFT_RIGHT7);\n\
|
||||
compressed -= pixelOffset.x * SHIFT_LEFT7;\n\
|
||||
pixelOffset.x -= UPPER_BOUND;\n\
|
||||
\n\
|
||||
vec2 origin;\n\
|
||||
origin.x = floor(compressed * SHIFT_RIGHT5);\n\
|
||||
compressed -= origin.x * SHIFT_LEFT5;\n\
|
||||
\n\
|
||||
origin.y = floor(compressed * SHIFT_RIGHT3);\n\
|
||||
compressed -= origin.y * SHIFT_LEFT3;\n\
|
||||
\n\
|
||||
origin -= vec2(1.0);\n\
|
||||
\n\
|
||||
float show = floor(compressed * SHIFT_RIGHT2);\n\
|
||||
compressed -= show * SHIFT_LEFT2;\n\
|
||||
\n\
|
||||
vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\n\
|
||||
vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\n\
|
||||
vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n\
|
||||
\n\
|
||||
float temp = compressedAttribute0.y * SHIFT_RIGHT8;\n\
|
||||
pixelOffset.y = -(floor(temp) - UPPER_BOUND);\n\
|
||||
\n\
|
||||
vec2 translate;\n\
|
||||
translate.y = (temp - floor(temp)) * SHIFT_LEFT16;\n\
|
||||
\n\
|
||||
temp = compressedAttribute0.z * SHIFT_RIGHT8;\n\
|
||||
translate.x = floor(temp) - UPPER_BOUND;\n\
|
||||
translate.x *= SHIFT_RIGHT2; // undo translateX scaling (helps preserve subpixel precision, see BillboardCollection.js attribute writer for more info)\n\
|
||||
\n\
|
||||
translate.y += (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
||||
translate.y -= UPPER_BOUND;\n\
|
||||
translate.y *= SHIFT_RIGHT2;\n\
|
||||
\n\
|
||||
temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\
|
||||
float temp2 = floor(compressedAttribute2.w * SHIFT_RIGHT2);\n\
|
||||
\n\
|
||||
vec2 imageSize = vec2(floor(temp), temp2);\n\
|
||||
\n\
|
||||
#ifdef EYE_DISTANCE_TRANSLUCENCY\n\
|
||||
vec4 translucencyByDistance;\n\
|
||||
translucencyByDistance.x = compressedAttribute1.z;\n\
|
||||
translucencyByDistance.z = compressedAttribute1.w;\n\
|
||||
\n\
|
||||
translucencyByDistance.y = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n\
|
||||
\n\
|
||||
temp = compressedAttribute1.y * SHIFT_RIGHT8;\n\
|
||||
translucencyByDistance.w = ((temp - floor(temp)) * SHIFT_LEFT8) / 255.0;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK\n\
|
||||
temp = compressedAttribute3.w;\n\
|
||||
temp = temp * SHIFT_RIGHT12;\n\
|
||||
\n\
|
||||
vec2 dimensions;\n\
|
||||
dimensions.y = (temp - floor(temp)) * SHIFT_LEFT12;\n\
|
||||
dimensions.x = floor(temp);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef ALIGNED_AXIS\n\
|
||||
vec3 alignedAxis = czm_octDecode(floor(compressedAttribute1.y * SHIFT_RIGHT8));\n\
|
||||
temp = compressedAttribute2.z * SHIFT_RIGHT5;\n\
|
||||
bool validAlignedAxis = (temp - floor(temp)) * SHIFT_LEFT1 > 0.0;\n\
|
||||
#else\n\
|
||||
vec3 alignedAxis = vec3(0.0);\n\
|
||||
bool validAlignedAxis = false;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
vec4 color = czm_decodeRGB8(compressedAttribute2.x);\n\
|
||||
vec4 pickColor = czm_decodeRGB8(compressedAttribute2.y);\n\
|
||||
\n\
|
||||
temp = compressedAttribute2.z * SHIFT_RIGHT8;\n\
|
||||
bool sizeInMeters = floor((temp - floor(temp)) * SHIFT_LEFT7) > 0.0;\n\
|
||||
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
||||
\n\
|
||||
pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
||||
pickColor.a /= 255.0;\n\
|
||||
\n\
|
||||
color.a = floor(temp);\n\
|
||||
color.a /= 255.0;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
|
||||
\n\
|
||||
positionEC = czm_eyeOffset(positionEC, eyeOffset.xyz);\n\
|
||||
positionEC.xyz *= show;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || defined(EYE_DISTANCE_PIXEL_OFFSET) || defined(DISTANCE_DISPLAY_CONDITION) || defined(DISABLE_DEPTH_DISTANCE)\n\
|
||||
float lengthSq;\n\
|
||||
if (czm_sceneMode == czm_sceneMode2D)\n\
|
||||
{\n\
|
||||
// 2D camera distance is a special case\n\
|
||||
// treat all billboards as flattened to the z=0.0 plane\n\
|
||||
lengthSq = czm_eyeHeight2D.y;\n\
|
||||
}\n\
|
||||
else\n\
|
||||
{\n\
|
||||
lengthSq = dot(positionEC.xyz, positionEC.xyz);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef EYE_DISTANCE_SCALING\n\
|
||||
float distanceScale = czm_nearFarScalar(scaleByDistance, lengthSq);\n\
|
||||
scale *= distanceScale;\n\
|
||||
translate *= distanceScale;\n\
|
||||
// push vertex behind near plane for clipping\n\
|
||||
if (scale == 0.0)\n\
|
||||
{\n\
|
||||
positionEC.xyz = vec3(0.0);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
float translucency = 1.0;\n\
|
||||
#ifdef EYE_DISTANCE_TRANSLUCENCY\n\
|
||||
translucency = czm_nearFarScalar(translucencyByDistance, lengthSq);\n\
|
||||
// push vertex behind near plane for clipping\n\
|
||||
if (translucency == 0.0)\n\
|
||||
{\n\
|
||||
positionEC.xyz = vec3(0.0);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef EYE_DISTANCE_PIXEL_OFFSET\n\
|
||||
float pixelOffsetScale = czm_nearFarScalar(pixelOffsetScaleByDistance, lengthSq);\n\
|
||||
pixelOffset *= pixelOffsetScale;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef DISTANCE_DISPLAY_CONDITION\n\
|
||||
float nearSq = compressedAttribute3.x;\n\
|
||||
float farSq = compressedAttribute3.y;\n\
|
||||
if (lengthSq < nearSq || lengthSq > farSq)\n\
|
||||
{\n\
|
||||
positionEC.xyz = vec3(0.0);\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
mat2 rotationMatrix;\n\
|
||||
float mpp;\n\
|
||||
\n\
|
||||
float enableDepthCheck = 1.0;\n\
|
||||
#ifdef DISABLE_DEPTH_DISTANCE\n\
|
||||
float disableDepthTestDistanceSq = compressedAttribute3.z;\n\
|
||||
if (disableDepthTestDistanceSq == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n\
|
||||
{\n\
|
||||
disableDepthTestDistanceSq = czm_minimumDisableDepthTestDistance;\n\
|
||||
}\n\
|
||||
\n\
|
||||
if (lengthSq < disableDepthTestDistanceSq || disableDepthTestDistanceSq < 0.0)\n\
|
||||
{\n\
|
||||
enableDepthCheck = 0.0;\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
v_splitDirectionAndEllipsoidDepthEC.y = czm_infinity;\n\
|
||||
vec3 ellipsoidCenter = czm_view[3].xyz;\n\
|
||||
vec3 rayDirection = normalize(positionEC.xyz);\n\
|
||||
czm_ray ray = czm_ray(vec3(0.0), rayDirection);\n\
|
||||
vec3 ellipsoid_inverseRadii = czm_ellipsoidInverseRadii;\n\
|
||||
czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoidCenter, ellipsoid_inverseRadii);\n\
|
||||
\n\
|
||||
if (!czm_isEmpty(intersection))\n\
|
||||
{\n\
|
||||
v_splitDirectionAndEllipsoidDepthEC.y = intersection.start;\n\
|
||||
}\n\
|
||||
\n\
|
||||
v_compressed.y = enableDepthCheck;\n\
|
||||
\n\
|
||||
#ifdef VS_THREE_POINT_DEPTH_CHECK\n\
|
||||
if (lengthSq < (u_threePointDepthTestDistance * u_threePointDepthTestDistance) && (enableDepthCheck == 1.0)) {\n\
|
||||
float depthsilon = 10.0;\n\
|
||||
vec2 depthOrigin;\n\
|
||||
// Horizontal origin for labels comes from a special attribute. If that value is 0, this is a billboard - use the regular origin.\n\
|
||||
// Otherwise, transform the label origin to -1, 0, 1 (right, center, left).\n\
|
||||
depthOrigin.x = floor(compressedAttribute2.w - (temp2 * SHIFT_LEFT2));\n\
|
||||
depthOrigin.x = czm_branchFreeTernary(depthOrigin.x == 0.0, origin.x, depthOrigin.x - 2.0);\n\
|
||||
depthOrigin.y = origin.y;\n\
|
||||
\n\
|
||||
vec4 pEC1 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n\
|
||||
float globeDepth1 = getGlobeDepth(pEC1);\n\
|
||||
\n\
|
||||
if (globeDepth1 != 0.0 && pEC1.z + depthsilon < globeDepth1)\n\
|
||||
{\n\
|
||||
vec4 pEC2 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(0.0, 1.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n\
|
||||
float globeDepth2 = getGlobeDepth(pEC2);\n\
|
||||
\n\
|
||||
if (globeDepth2 != 0.0 && pEC2.z + depthsilon < globeDepth2)\n\
|
||||
{\n\
|
||||
vec4 pEC3 = addScreenSpaceOffset(positionEC, dimensions, scale, vec2(1.0), depthOrigin, vec2(0.0), pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n\
|
||||
float globeDepth3 = getGlobeDepth(pEC3);\n\
|
||||
if (globeDepth3 != 0.0 && pEC3.z + depthsilon < globeDepth3)\n\
|
||||
{\n\
|
||||
// \"Discard\" this vertex, as three key points fail depth test.\n\
|
||||
positionEC.xyz = vec3(0.0);\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
// Write out the eyespace depth before applying the screen space offset, but after potentially \"discarding\" the vertex\n\
|
||||
// by setting its eyespace position to zero, via the three-point depth test above.\n\
|
||||
v_compressed.x = positionEC.z;\n\
|
||||
\n\
|
||||
positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters, rotationMatrix, mpp);\n\
|
||||
gl_Position = czm_projection * positionEC;\n\
|
||||
v_textureCoordinates = textureCoordinates;\n\
|
||||
\n\
|
||||
#ifdef LOG_DEPTH\n\
|
||||
czm_vertexLogDepth();\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef DISABLE_DEPTH_DISTANCE\n\
|
||||
\n\
|
||||
if (disableDepthTestDistanceSq != 0.0)\n\
|
||||
{\n\
|
||||
// Don't try to \"multiply both sides\" by w. Greater/less-than comparisons won't work for negative values of w.\n\
|
||||
float zclip = gl_Position.z / gl_Position.w;\n\
|
||||
bool clipped = (zclip < -1.0 || zclip > 1.0);\n\
|
||||
// disableDepthTestDistanceSq can be less than zero if it's explicitly set to -1 in JS (as a sentinel value equivalent to infinity)\n\
|
||||
if (!clipped && (disableDepthTestDistanceSq < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistanceSq)))\n\
|
||||
{\n\
|
||||
// Position z on the near plane.\n\
|
||||
gl_Position.z = -gl_Position.w;\n\
|
||||
#ifdef LOG_DEPTH\n\
|
||||
v_depthFromNearPlusOne = 1.0;\n\
|
||||
#endif\n\
|
||||
}\n\
|
||||
}\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
#ifdef SDF\n\
|
||||
vec4 outlineColor = czm_decodeRGB8(sdf.x);\n\
|
||||
float outlineWidth;\n\
|
||||
\n\
|
||||
temp = sdf.y;\n\
|
||||
temp = temp * SHIFT_RIGHT8;\n\
|
||||
float temp3 = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
||||
temp = floor(temp) * SHIFT_RIGHT8;\n\
|
||||
outlineWidth = (temp - floor(temp)) * SHIFT_LEFT8;\n\
|
||||
outlineColor.a = floor(temp);\n\
|
||||
outlineColor.a /= 255.0;\n\
|
||||
\n\
|
||||
v_outlineWidth = outlineWidth / 255.0;\n\
|
||||
v_outlineColor = outlineColor;\n\
|
||||
v_outlineColor.a *= translucency;\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
v_pickColor = pickColor;\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
v_color.a *= translucency;\n\
|
||||
v_splitDirectionAndEllipsoidDepthEC.x = splitDirection;\n\
|
||||
}\n\
|
||||
";
|
||||
+100
@@ -0,0 +1,100 @@
|
||||
in vec2 v_textureCoordinates;
|
||||
const float M_PI = 3.141592653589793;
|
||||
|
||||
float vdcRadicalInverse(int i)
|
||||
{
|
||||
float r;
|
||||
float base = 2.0;
|
||||
float value = 0.0;
|
||||
float invBase = 1.0 / base;
|
||||
float invBi = invBase;
|
||||
for (int x = 0; x < 100; x++)
|
||||
{
|
||||
if (i <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
r = mod(float(i), base);
|
||||
value += r * invBi;
|
||||
invBi *= invBase;
|
||||
i = int(float(i) * invBase);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
vec2 hammersley2D(int i, int N)
|
||||
{
|
||||
return vec2(float(i) / float(N), vdcRadicalInverse(i));
|
||||
}
|
||||
|
||||
vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)
|
||||
{
|
||||
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;
|
||||
float phi = 2.0 * M_PI * xi.x;
|
||||
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));
|
||||
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
||||
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);
|
||||
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);
|
||||
vec3 tangentX = normalize(cross(upVector, N));
|
||||
vec3 tangentY = cross(N, tangentX);
|
||||
return tangentX * H.x + tangentY * H.y + N * H.z;
|
||||
}
|
||||
|
||||
/**
|
||||
* Estimate the geometric self-shadowing of the microfacets in a surface,
|
||||
* using the Smith Joint GGX visibility function.
|
||||
* Note: Vis = G / (4 * NdotL * NdotV)
|
||||
* see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3
|
||||
* see Real-Time Rendering. Page 331 to 336.
|
||||
* see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)
|
||||
*
|
||||
* @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.
|
||||
* @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.
|
||||
* @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.
|
||||
*/
|
||||
float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)
|
||||
{
|
||||
float alphaRoughnessSq = alphaRoughness * alphaRoughness;
|
||||
|
||||
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
|
||||
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);
|
||||
|
||||
float GGX = GGXV + GGXL; // 2.0 if NdotL = NdotV = 1.0
|
||||
if (GGX > 0.0)
|
||||
{
|
||||
return 0.5 / GGX; // 1/4 if NdotL = NdotV = 1.0
|
||||
}
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
vec2 integrateBrdf(float roughness, float NdotV)
|
||||
{
|
||||
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);
|
||||
float A = 0.0;
|
||||
float B = 0.0;
|
||||
const int NumSamples = 1024;
|
||||
float alphaRoughness = roughness * roughness;
|
||||
for (int i = 0; i < NumSamples; i++)
|
||||
{
|
||||
vec2 xi = hammersley2D(i, NumSamples);
|
||||
vec3 H = importanceSampleGGX(xi, alphaRoughness, vec3(0.0, 0.0, 1.0));
|
||||
vec3 L = 2.0 * dot(V, H) * H - V;
|
||||
float NdotL = clamp(L.z, 0.0, 1.0);
|
||||
float NdotH = clamp(H.z, 0.0, 1.0);
|
||||
float VdotH = clamp(dot(V, H), 0.0, 1.0);
|
||||
if (NdotL > 0.0)
|
||||
{
|
||||
float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);
|
||||
float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;
|
||||
float Fc = pow(1.0 - VdotH, 5.0);
|
||||
A += (1.0 - Fc) * G_Vis;
|
||||
B += Fc * G_Vis;
|
||||
}
|
||||
}
|
||||
return vec2(A, B) / float(NumSamples);
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec2 v_textureCoordinates;\n\
|
||||
const float M_PI = 3.141592653589793;\n\
|
||||
\n\
|
||||
float vdcRadicalInverse(int i)\n\
|
||||
{\n\
|
||||
float r;\n\
|
||||
float base = 2.0;\n\
|
||||
float value = 0.0;\n\
|
||||
float invBase = 1.0 / base;\n\
|
||||
float invBi = invBase;\n\
|
||||
for (int x = 0; x < 100; x++)\n\
|
||||
{\n\
|
||||
if (i <= 0)\n\
|
||||
{\n\
|
||||
break;\n\
|
||||
}\n\
|
||||
r = mod(float(i), base);\n\
|
||||
value += r * invBi;\n\
|
||||
invBi *= invBase;\n\
|
||||
i = int(float(i) * invBase);\n\
|
||||
}\n\
|
||||
return value;\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec2 hammersley2D(int i, int N)\n\
|
||||
{\n\
|
||||
return vec2(float(i) / float(N), vdcRadicalInverse(i));\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec3 importanceSampleGGX(vec2 xi, float alphaRoughness, vec3 N)\n\
|
||||
{\n\
|
||||
float alphaRoughnessSquared = alphaRoughness * alphaRoughness;\n\
|
||||
float phi = 2.0 * M_PI * xi.x;\n\
|
||||
float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (alphaRoughnessSquared - 1.0) * xi.y));\n\
|
||||
float sinTheta = sqrt(1.0 - cosTheta * cosTheta);\n\
|
||||
vec3 H = vec3(sinTheta * cos(phi), sinTheta * sin(phi), cosTheta);\n\
|
||||
vec3 upVector = abs(N.z) < 0.999 ? vec3(0.0, 0.0, 1.0) : vec3(1.0, 0.0, 0.0);\n\
|
||||
vec3 tangentX = normalize(cross(upVector, N));\n\
|
||||
vec3 tangentY = cross(N, tangentX);\n\
|
||||
return tangentX * H.x + tangentY * H.y + N * H.z;\n\
|
||||
}\n\
|
||||
\n\
|
||||
/**\n\
|
||||
* Estimate the geometric self-shadowing of the microfacets in a surface,\n\
|
||||
* using the Smith Joint GGX visibility function.\n\
|
||||
* Note: Vis = G / (4 * NdotL * NdotV)\n\
|
||||
* see Eric Heitz. 2014. Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs. Journal of Computer Graphics Techniques, 3\n\
|
||||
* see Real-Time Rendering. Page 331 to 336.\n\
|
||||
* see https://google.github.io/filament/Filament.md.html#materialsystem/specularbrdf/geometricshadowing(specularg)\n\
|
||||
*\n\
|
||||
* @param {float} alphaRoughness The roughness of the material, expressed as the square of perceptual roughness.\n\
|
||||
* @param {float} NdotL The cosine of the angle between the surface normal and the direction to the light source.\n\
|
||||
* @param {float} NdotV The cosine of the angle between the surface normal and the direction to the camera.\n\
|
||||
*/\n\
|
||||
float smithVisibilityGGX(float alphaRoughness, float NdotL, float NdotV)\n\
|
||||
{\n\
|
||||
float alphaRoughnessSq = alphaRoughness * alphaRoughness;\n\
|
||||
\n\
|
||||
float GGXV = NdotL * sqrt(NdotV * NdotV * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
|
||||
float GGXL = NdotV * sqrt(NdotL * NdotL * (1.0 - alphaRoughnessSq) + alphaRoughnessSq);\n\
|
||||
\n\
|
||||
float GGX = GGXV + GGXL; // 2.0 if NdotL = NdotV = 1.0\n\
|
||||
if (GGX > 0.0)\n\
|
||||
{\n\
|
||||
return 0.5 / GGX; // 1/4 if NdotL = NdotV = 1.0\n\
|
||||
}\n\
|
||||
return 0.0;\n\
|
||||
}\n\
|
||||
\n\
|
||||
vec2 integrateBrdf(float roughness, float NdotV)\n\
|
||||
{\n\
|
||||
vec3 V = vec3(sqrt(1.0 - NdotV * NdotV), 0.0, NdotV);\n\
|
||||
float A = 0.0;\n\
|
||||
float B = 0.0;\n\
|
||||
const int NumSamples = 1024;\n\
|
||||
float alphaRoughness = roughness * roughness;\n\
|
||||
for (int i = 0; i < NumSamples; i++)\n\
|
||||
{\n\
|
||||
vec2 xi = hammersley2D(i, NumSamples);\n\
|
||||
vec3 H = importanceSampleGGX(xi, alphaRoughness, vec3(0.0, 0.0, 1.0));\n\
|
||||
vec3 L = 2.0 * dot(V, H) * H - V;\n\
|
||||
float NdotL = clamp(L.z, 0.0, 1.0);\n\
|
||||
float NdotH = clamp(H.z, 0.0, 1.0);\n\
|
||||
float VdotH = clamp(dot(V, H), 0.0, 1.0);\n\
|
||||
if (NdotL > 0.0)\n\
|
||||
{\n\
|
||||
float G = smithVisibilityGGX(alphaRoughness, NdotL, NdotV);\n\
|
||||
float G_Vis = 4.0 * G * VdotH * NdotL / NdotH;\n\
|
||||
float Fc = pow(1.0 - VdotH, 5.0);\n\
|
||||
A += (1.0 - Fc) * G_Vis;\n\
|
||||
B += Fc * G_Vis;\n\
|
||||
}\n\
|
||||
}\n\
|
||||
return vec2(A, B) / float(NumSamples);\n\
|
||||
}\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
out_FragColor = vec4(integrateBrdf(v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n\
|
||||
}\n\
|
||||
";
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
in vec4 v_pickColor;
|
||||
in vec4 v_color;
|
||||
in vec4 v_outlineColor;
|
||||
in float v_innerRadiusFrac;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Distance between fragment and point center, 0 to 0.5.
|
||||
float distanceToCenter = length(gl_PointCoord - vec2(0.5));
|
||||
float delta = fwidth(distanceToCenter);
|
||||
|
||||
float outerLimit = 0.5;
|
||||
float innerLimit = 0.5 * v_innerRadiusFrac;
|
||||
|
||||
float outerAlpha = 1.0 - smoothstep(max(0.0, outerLimit - delta), outerLimit, distanceToCenter);
|
||||
float innerAlpha = 1.0 - smoothstep(innerLimit - delta, innerLimit, distanceToCenter);
|
||||
|
||||
vec4 color = vec4(mix(v_outlineColor.rgb, v_color.rgb, innerAlpha), outerAlpha);
|
||||
color.a *= mix(v_outlineColor.a, v_color.a, innerAlpha);
|
||||
|
||||
if (color.a < 0.005) // matches 0/255 and 1/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
out_FragColor = czm_gammaCorrect(color);
|
||||
czm_writeLogDepth();
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec4 v_pickColor;\n\
|
||||
in vec4 v_color;\n\
|
||||
in vec4 v_outlineColor;\n\
|
||||
in float v_innerRadiusFrac;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
// Distance between fragment and point center, 0 to 0.5.\n\
|
||||
float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n\
|
||||
float delta = fwidth(distanceToCenter);\n\
|
||||
\n\
|
||||
float outerLimit = 0.5;\n\
|
||||
float innerLimit = 0.5 * v_innerRadiusFrac;\n\
|
||||
\n\
|
||||
float outerAlpha = 1.0 - smoothstep(max(0.0, outerLimit - delta), outerLimit, distanceToCenter);\n\
|
||||
float innerAlpha = 1.0 - smoothstep(innerLimit - delta, innerLimit, distanceToCenter);\n\
|
||||
\n\
|
||||
vec4 color = vec4(mix(v_outlineColor.rgb, v_color.rgb, innerAlpha), outerAlpha);\n\
|
||||
color.a *= mix(v_outlineColor.a, v_color.a, innerAlpha);\n\
|
||||
\n\
|
||||
if (color.a < 0.005) // matches 0/255 and 1/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
\n\
|
||||
out_FragColor = czm_gammaCorrect(color);\n\
|
||||
czm_writeLogDepth();\n\
|
||||
}\n\
|
||||
";
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
#ifdef USE_FLOAT64
|
||||
in vec3 positionHigh;
|
||||
in vec3 positionLow;
|
||||
#else
|
||||
in vec3 position;
|
||||
#endif
|
||||
in vec4 pickColor;
|
||||
in vec4 showPixelSizeColorAlpha;
|
||||
in vec3 outlineWidthColorAlpha;
|
||||
|
||||
out vec4 v_pickColor;
|
||||
out vec4 v_color;
|
||||
out vec4 v_outlineColor;
|
||||
out float v_innerRadiusFrac;
|
||||
|
||||
void main()
|
||||
{
|
||||
// Unpack attributes.
|
||||
float show = showPixelSizeColorAlpha.x;
|
||||
float pixelSize = showPixelSizeColorAlpha.y;
|
||||
vec4 color = czm_decodeRGB8(showPixelSizeColorAlpha.z);
|
||||
float alpha = showPixelSizeColorAlpha.w;
|
||||
float outlineWidth = outlineWidthColorAlpha.x;
|
||||
vec4 outlineColor = czm_decodeRGB8(outlineWidthColorAlpha.y);
|
||||
float outlineAlpha = outlineWidthColorAlpha.z;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float innerRadius = 0.5 * pixelSize * czm_pixelRatio;
|
||||
float outerRadius = (0.5 * pixelSize + outlineWidth) * czm_pixelRatio;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef USE_FLOAT64
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
||||
#else
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
gl_Position = czm_projection * positionEC;
|
||||
czm_vertexLogDepth();
|
||||
|
||||
v_pickColor = pickColor / 255.0;
|
||||
|
||||
v_color = color;
|
||||
v_color.a *= alpha * show;
|
||||
|
||||
v_outlineColor = outlineColor;
|
||||
v_outlineColor.a *= outlineAlpha * show;
|
||||
|
||||
v_innerRadiusFrac = innerRadius / outerRadius;
|
||||
|
||||
gl_PointSize = 2.0 * outerRadius * show;
|
||||
gl_Position *= show;
|
||||
}
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "#ifdef USE_FLOAT64\n\
|
||||
in vec3 positionHigh;\n\
|
||||
in vec3 positionLow;\n\
|
||||
#else\n\
|
||||
in vec3 position;\n\
|
||||
#endif\n\
|
||||
in vec4 pickColor;\n\
|
||||
in vec4 showPixelSizeColorAlpha;\n\
|
||||
in vec3 outlineWidthColorAlpha;\n\
|
||||
\n\
|
||||
out vec4 v_pickColor;\n\
|
||||
out vec4 v_color;\n\
|
||||
out vec4 v_outlineColor;\n\
|
||||
out float v_innerRadiusFrac;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
// Unpack attributes.\n\
|
||||
float show = showPixelSizeColorAlpha.x;\n\
|
||||
float pixelSize = showPixelSizeColorAlpha.y;\n\
|
||||
vec4 color = czm_decodeRGB8(showPixelSizeColorAlpha.z);\n\
|
||||
float alpha = showPixelSizeColorAlpha.w;\n\
|
||||
float outlineWidth = outlineWidthColorAlpha.x;\n\
|
||||
vec4 outlineColor = czm_decodeRGB8(outlineWidthColorAlpha.y);\n\
|
||||
float outlineAlpha = outlineWidthColorAlpha.z;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
float innerRadius = 0.5 * pixelSize * czm_pixelRatio;\n\
|
||||
float outerRadius = (0.5 * pixelSize + outlineWidth) * czm_pixelRatio;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
#ifdef USE_FLOAT64\n\
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
|
||||
#else\n\
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
gl_Position = czm_projection * positionEC;\n\
|
||||
czm_vertexLogDepth();\n\
|
||||
\n\
|
||||
v_pickColor = pickColor / 255.0;\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
v_color.a *= alpha * show;\n\
|
||||
\n\
|
||||
v_outlineColor = outlineColor;\n\
|
||||
v_outlineColor.a *= outlineAlpha * show;\n\
|
||||
\n\
|
||||
v_innerRadiusFrac = innerRadius / outerRadius;\n\
|
||||
\n\
|
||||
gl_PointSize = 2.0 * outerRadius * show;\n\
|
||||
gl_Position *= show;\n\
|
||||
}\n\
|
||||
";
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
in vec4 v_pickColor;
|
||||
in vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (v_color.a < 0.005) // matches 0/255 and 1/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
out_FragColor = czm_gammaCorrect(v_color);
|
||||
czm_writeLogDepth();
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec4 v_pickColor;\n\
|
||||
in vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
if (v_color.a < 0.005) // matches 0/255 and 1/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
\n\
|
||||
out_FragColor = czm_gammaCorrect(v_color);\n\
|
||||
czm_writeLogDepth();\n\
|
||||
}\n\
|
||||
";
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#ifdef USE_FLOAT64
|
||||
in vec3 positionHigh;
|
||||
in vec3 positionLow;
|
||||
#else
|
||||
in vec3 position;
|
||||
#endif
|
||||
in vec4 pickColor;
|
||||
in vec3 showColorAlpha;
|
||||
|
||||
out vec4 v_pickColor;
|
||||
out vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
float show = showColorAlpha.x;
|
||||
vec4 color = czm_decodeRGB8(showColorAlpha.y);
|
||||
float alpha = showColorAlpha.z;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef USE_FLOAT64
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;
|
||||
#else
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
gl_Position = czm_projection * positionEC;
|
||||
czm_vertexLogDepth();
|
||||
|
||||
v_pickColor = pickColor / 255.0;
|
||||
|
||||
v_color = color;
|
||||
v_color.a *= alpha * show;
|
||||
|
||||
gl_Position *= show;
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "#ifdef USE_FLOAT64\n\
|
||||
in vec3 positionHigh;\n\
|
||||
in vec3 positionLow;\n\
|
||||
#else\n\
|
||||
in vec3 position;\n\
|
||||
#endif\n\
|
||||
in vec4 pickColor;\n\
|
||||
in vec3 showColorAlpha;\n\
|
||||
\n\
|
||||
out vec4 v_pickColor;\n\
|
||||
out vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
float show = showColorAlpha.x;\n\
|
||||
vec4 color = czm_decodeRGB8(showColorAlpha.y);\n\
|
||||
float alpha = showColorAlpha.z;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
#ifdef USE_FLOAT64\n\
|
||||
vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\
|
||||
vec4 positionEC = czm_modelViewRelativeToEye * p;\n\
|
||||
#else\n\
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
gl_Position = czm_projection * positionEC;\n\
|
||||
czm_vertexLogDepth();\n\
|
||||
\n\
|
||||
v_pickColor = pickColor / 255.0;\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
v_color.a *= alpha * show;\n\
|
||||
\n\
|
||||
gl_Position *= show;\n\
|
||||
}\n\
|
||||
";
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
in vec4 v_pickColor;
|
||||
in vec4 v_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
if (v_color.a < 0.005) // matches 0/255 and 1/255
|
||||
{
|
||||
discard;
|
||||
}
|
||||
|
||||
out_FragColor = czm_gammaCorrect(v_color);
|
||||
czm_writeLogDepth();
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "in vec4 v_pickColor;\n\
|
||||
in vec4 v_color;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
if (v_color.a < 0.005) // matches 0/255 and 1/255\n\
|
||||
{\n\
|
||||
discard;\n\
|
||||
}\n\
|
||||
\n\
|
||||
out_FragColor = czm_gammaCorrect(v_color);\n\
|
||||
czm_writeLogDepth();\n\
|
||||
}\n\
|
||||
";
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
#ifdef USE_FLOAT64
|
||||
in vec3 positionHigh;
|
||||
in vec3 positionLow;
|
||||
in vec3 prevPositionHigh;
|
||||
in vec3 prevPositionLow;
|
||||
in vec3 nextPositionHigh;
|
||||
in vec3 nextPositionLow;
|
||||
#else
|
||||
in vec3 position;
|
||||
in vec3 prevPosition;
|
||||
in vec3 nextPosition;
|
||||
#endif
|
||||
in vec4 pickColor;
|
||||
in vec4 showColorWidthAndTexCoord;
|
||||
in float alpha;
|
||||
|
||||
out vec4 v_pickColor;
|
||||
out vec4 v_color;
|
||||
out vec2 v_st;
|
||||
out float v_width;
|
||||
out float v_polylineAngle;
|
||||
|
||||
void main()
|
||||
{
|
||||
float show = showColorWidthAndTexCoord.x;
|
||||
vec4 color = czm_decodeRGB8(showColorWidthAndTexCoord.y);
|
||||
float width = showColorWidthAndTexCoord.z;
|
||||
float texCoord = showColorWidthAndTexCoord.w;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool usePrevious = texCoord == 1.0;
|
||||
float expandDir = gl_VertexID % 2 == 1 ? 1.0 : -1.0;
|
||||
float polylineAngle;
|
||||
|
||||
#ifdef USE_FLOAT64
|
||||
vec4 positionEC = czm_translateRelativeToEye(positionHigh, positionLow);
|
||||
vec4 prevPositionEC = czm_translateRelativeToEye(prevPositionHigh, prevPositionLow);
|
||||
vec4 nextPositionEC = czm_translateRelativeToEye(nextPositionHigh, nextPositionLow);
|
||||
vec4 positionWC = getPolylineWindowCoordinates(positionEC, prevPositionEC, nextPositionEC, expandDir, width, usePrevious, polylineAngle);
|
||||
#else
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);
|
||||
vec4 prevPositionEC = czm_modelView * vec4(prevPosition, 1.0);
|
||||
vec4 nextPositionEC = czm_modelView * vec4(nextPosition, 1.0);
|
||||
// Positions are already in eye space; use the EC variant to skip the redundant transform.
|
||||
vec4 positionWC = getPolylineWindowCoordinatesEC(positionEC, prevPositionEC, nextPositionEC, expandDir, width, usePrevious, polylineAngle);
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
gl_Position = czm_viewportOrthographic * positionWC * show;
|
||||
|
||||
v_pickColor = pickColor / 255.0;
|
||||
|
||||
v_color = color;
|
||||
v_color.a *= alpha / 255.0 * show;
|
||||
|
||||
v_st.s = texCoord;
|
||||
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);
|
||||
|
||||
v_width = width;
|
||||
v_polylineAngle = polylineAngle;
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "#ifdef USE_FLOAT64\n\
|
||||
in vec3 positionHigh;\n\
|
||||
in vec3 positionLow;\n\
|
||||
in vec3 prevPositionHigh;\n\
|
||||
in vec3 prevPositionLow;\n\
|
||||
in vec3 nextPositionHigh;\n\
|
||||
in vec3 nextPositionLow;\n\
|
||||
#else\n\
|
||||
in vec3 position;\n\
|
||||
in vec3 prevPosition;\n\
|
||||
in vec3 nextPosition;\n\
|
||||
#endif\n\
|
||||
in vec4 pickColor;\n\
|
||||
in vec4 showColorWidthAndTexCoord;\n\
|
||||
in float alpha;\n\
|
||||
\n\
|
||||
out vec4 v_pickColor;\n\
|
||||
out vec4 v_color;\n\
|
||||
out vec2 v_st;\n\
|
||||
out float v_width;\n\
|
||||
out float v_polylineAngle;\n\
|
||||
\n\
|
||||
void main()\n\
|
||||
{\n\
|
||||
float show = showColorWidthAndTexCoord.x;\n\
|
||||
vec4 color = czm_decodeRGB8(showColorWidthAndTexCoord.y);\n\
|
||||
float width = showColorWidthAndTexCoord.z;\n\
|
||||
float texCoord = showColorWidthAndTexCoord.w;\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
bool usePrevious = texCoord == 1.0;\n\
|
||||
float expandDir = gl_VertexID % 2 == 1 ? 1.0 : -1.0;\n\
|
||||
float polylineAngle;\n\
|
||||
\n\
|
||||
#ifdef USE_FLOAT64\n\
|
||||
vec4 positionEC = czm_translateRelativeToEye(positionHigh, positionLow);\n\
|
||||
vec4 prevPositionEC = czm_translateRelativeToEye(prevPositionHigh, prevPositionLow);\n\
|
||||
vec4 nextPositionEC = czm_translateRelativeToEye(nextPositionHigh, nextPositionLow);\n\
|
||||
vec4 positionWC = getPolylineWindowCoordinates(positionEC, prevPositionEC, nextPositionEC, expandDir, width, usePrevious, polylineAngle);\n\
|
||||
#else\n\
|
||||
vec4 positionEC = czm_modelView * vec4(position, 1.0);\n\
|
||||
vec4 prevPositionEC = czm_modelView * vec4(prevPosition, 1.0);\n\
|
||||
vec4 nextPositionEC = czm_modelView * vec4(nextPosition, 1.0);\n\
|
||||
// Positions are already in eye space; use the EC variant to skip the redundant transform.\n\
|
||||
vec4 positionWC = getPolylineWindowCoordinatesEC(positionEC, prevPositionEC, nextPositionEC, expandDir, width, usePrevious, polylineAngle);\n\
|
||||
#endif\n\
|
||||
\n\
|
||||
///////////////////////////////////////////////////////////////////////////\n\
|
||||
\n\
|
||||
gl_Position = czm_viewportOrthographic * positionWC * show;\n\
|
||||
\n\
|
||||
v_pickColor = pickColor / 255.0;\n\
|
||||
\n\
|
||||
v_color = color;\n\
|
||||
v_color.a *= alpha / 255.0 * show;\n\
|
||||
\n\
|
||||
v_st.s = texCoord;\n\
|
||||
v_st.t = czm_writeNonPerspective(clamp(expandDir, 0.0, 1.0), gl_Position.w);\n\
|
||||
\n\
|
||||
v_width = width;\n\
|
||||
v_polylineAngle = polylineAngle;\n\
|
||||
}\n\
|
||||
";
|
||||
Generated
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* A built-in GLSL floating-point constant for converting radians to degrees.
|
||||
*
|
||||
* @alias czm_degreesPerRadian
|
||||
* @glslConstant
|
||||
*
|
||||
* @see CesiumMath.DEGREES_PER_RADIAN
|
||||
*
|
||||
* @example
|
||||
* // GLSL declaration
|
||||
* const float czm_degreesPerRadian = ...;
|
||||
*
|
||||
* // Example
|
||||
* float deg = czm_degreesPerRadian * rad;
|
||||
*/
|
||||
const float czm_degreesPerRadian = 57.29577951308232;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* A built-in GLSL floating-point constant for converting radians to degrees.\n\
|
||||
*\n\
|
||||
* @alias czm_degreesPerRadian\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see CesiumMath.DEGREES_PER_RADIAN\n\
|
||||
*\n\
|
||||
* @example\n\
|
||||
* // GLSL declaration\n\
|
||||
* const float czm_degreesPerRadian = ...;\n\
|
||||
*\n\
|
||||
* // Example\n\
|
||||
* float deg = czm_degreesPerRadian * rad;\n\
|
||||
*/\n\
|
||||
const float czm_degreesPerRadian = 57.29577951308232;\n\
|
||||
";
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* A built-in GLSL vec2 constant for defining the depth range.
|
||||
* This is a workaround to a bug where IE11 does not implement gl_DepthRange.
|
||||
*
|
||||
* @alias czm_depthRange
|
||||
* @glslConstant
|
||||
*
|
||||
* @example
|
||||
* // GLSL declaration
|
||||
* float depthRangeNear = czm_depthRange.near;
|
||||
* float depthRangeFar = czm_depthRange.far;
|
||||
*
|
||||
*/
|
||||
const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* A built-in GLSL vec2 constant for defining the depth range.\n\
|
||||
* This is a workaround to a bug where IE11 does not implement gl_DepthRange.\n\
|
||||
*\n\
|
||||
* @alias czm_depthRange\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @example\n\
|
||||
* // GLSL declaration\n\
|
||||
* float depthRangeNear = czm_depthRange.near;\n\
|
||||
* float depthRangeFar = czm_depthRange.far;\n\
|
||||
*\n\
|
||||
*/\n\
|
||||
const czm_depthRangeStruct czm_depthRange = czm_depthRangeStruct(0.0, 1.0);\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.1
|
||||
*
|
||||
* @name czm_epsilon1
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon1 = 0.1;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.1\n\
|
||||
*\n\
|
||||
* @name czm_epsilon1\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon1 = 0.1;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.01
|
||||
*
|
||||
* @name czm_epsilon2
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon2 = 0.01;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.01\n\
|
||||
*\n\
|
||||
* @name czm_epsilon2\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon2 = 0.01;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.001
|
||||
*
|
||||
* @name czm_epsilon3
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon3 = 0.001;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.001\n\
|
||||
*\n\
|
||||
* @name czm_epsilon3\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon3 = 0.001;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.0001
|
||||
*
|
||||
* @name czm_epsilon4
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon4 = 0.0001;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.0001\n\
|
||||
*\n\
|
||||
* @name czm_epsilon4\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon4 = 0.0001;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.00001
|
||||
*
|
||||
* @name czm_epsilon5
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon5 = 0.00001;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.00001\n\
|
||||
*\n\
|
||||
* @name czm_epsilon5\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon5 = 0.00001;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.000001
|
||||
*
|
||||
* @name czm_epsilon6
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon6 = 0.000001;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.000001\n\
|
||||
*\n\
|
||||
* @name czm_epsilon6\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon6 = 0.000001;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* 0.0000001
|
||||
*
|
||||
* @name czm_epsilon7
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_epsilon7 = 0.0000001;
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* 0.0000001\n\
|
||||
*\n\
|
||||
* @name czm_epsilon7\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_epsilon7 = 0.0000001;\n\
|
||||
";
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* DOC_TBA
|
||||
*
|
||||
* @name czm_infinity
|
||||
* @glslConstant
|
||||
*/
|
||||
const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* DOC_TBA\n\
|
||||
*\n\
|
||||
* @name czm_infinity\n\
|
||||
* @glslConstant\n\
|
||||
*/\n\
|
||||
const float czm_infinity = 5906376272000.0; // Distance from the Sun to Pluto in meters. TODO: What is best given lowp, mediump, and highp?\n\
|
||||
";
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* A built-in GLSL floating-point constant for <code>1/pi</code>.
|
||||
*
|
||||
* @alias czm_oneOverPi
|
||||
* @glslConstant
|
||||
*
|
||||
* @see CesiumMath.ONE_OVER_PI
|
||||
*
|
||||
* @example
|
||||
* // GLSL declaration
|
||||
* const float czm_oneOverPi = ...;
|
||||
*
|
||||
* // Example
|
||||
* float pi = 1.0 / czm_oneOverPi;
|
||||
*/
|
||||
const float czm_oneOverPi = 0.3183098861837907;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* A built-in GLSL floating-point constant for <code>1/pi</code>.\n\
|
||||
*\n\
|
||||
* @alias czm_oneOverPi\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see CesiumMath.ONE_OVER_PI\n\
|
||||
*\n\
|
||||
* @example\n\
|
||||
* // GLSL declaration\n\
|
||||
* const float czm_oneOverPi = ...;\n\
|
||||
*\n\
|
||||
* // Example\n\
|
||||
* float pi = 1.0 / czm_oneOverPi;\n\
|
||||
*/\n\
|
||||
const float czm_oneOverPi = 0.3183098861837907;\n\
|
||||
";
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* A built-in GLSL floating-point constant for <code>1/2pi</code>.
|
||||
*
|
||||
* @alias czm_oneOverTwoPi
|
||||
* @glslConstant
|
||||
*
|
||||
* @see CesiumMath.ONE_OVER_TWO_PI
|
||||
*
|
||||
* @example
|
||||
* // GLSL declaration
|
||||
* const float czm_oneOverTwoPi = ...;
|
||||
*
|
||||
* // Example
|
||||
* float pi = 2.0 * czm_oneOverTwoPi;
|
||||
*/
|
||||
const float czm_oneOverTwoPi = 0.15915494309189535;
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* A built-in GLSL floating-point constant for <code>1/2pi</code>.\n\
|
||||
*\n\
|
||||
* @alias czm_oneOverTwoPi\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see CesiumMath.ONE_OVER_TWO_PI\n\
|
||||
*\n\
|
||||
* @example\n\
|
||||
* // GLSL declaration\n\
|
||||
* const float czm_oneOverTwoPi = ...;\n\
|
||||
*\n\
|
||||
* // Example\n\
|
||||
* float pi = 2.0 * czm_oneOverTwoPi;\n\
|
||||
*/\n\
|
||||
const float czm_oneOverTwoPi = 0.15915494309189535;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}
|
||||
*
|
||||
* @name czm_passCesium3DTile
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTile = 6.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTile\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTile = 6.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}
|
||||
*
|
||||
* @name czm_passCesium3DTileClassification
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTileClassification = 7.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTileClassification\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTileClassification = 7.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}
|
||||
*
|
||||
* @name czm_passCesium3DTileClassificationIgnoreShow
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTileClassificationIgnoreShow = 8.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_CLASSIFICATION_IGNORE_SHOW}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTileClassificationIgnoreShow\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTileClassificationIgnoreShow = 8.0;\n\
|
||||
";
|
||||
Generated
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_EDGES}
|
||||
*
|
||||
* @name czm_passCesium3DTileEdges
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTileEdges = 4.0;
|
||||
|
||||
Generated
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_EDGES}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTileEdges\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTileEdges = 4.0;\n\
|
||||
\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_EDGES_DIRECT}
|
||||
*
|
||||
* @name czm_passCesium3DTileEdgesDirect
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTileEdgesDirect = 12.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_EDGES_DIRECT}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTileEdgesDirect\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTileEdgesDirect = 12.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_PLANAR_FILL_ID}
|
||||
*
|
||||
* @name czm_passCesium3DTilePlanarFillId
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCesium3DTilePlanarFillId = 5.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CESIUM_3D_TILE_PLANAR_FILL_ID}\n\
|
||||
*\n\
|
||||
* @name czm_passCesium3DTilePlanarFillId\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCesium3DTilePlanarFillId = 5.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}
|
||||
*
|
||||
* @name czm_passClassification
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passClassification = 8.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#CLASSIFICATION}\n\
|
||||
*\n\
|
||||
* @name czm_passClassification\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passClassification = 8.0;\n\
|
||||
";
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#COMPUTE}
|
||||
*
|
||||
* @name czm_passCompute
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passCompute = 1.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#COMPUTE}\n\
|
||||
*\n\
|
||||
* @name czm_passCompute\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passCompute = 1.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}
|
||||
*
|
||||
* @name czm_passEnvironment
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passEnvironment = 0.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#ENVIRONMENT}\n\
|
||||
*\n\
|
||||
* @name czm_passEnvironment\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passEnvironment = 0.0;\n\
|
||||
";
|
||||
Generated
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#GAUSSIAN_SPLATS}
|
||||
*
|
||||
* @name czm_passGaussianSplats
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passGaussianSplats = 12.0;
|
||||
Generated
Vendored
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#GAUSSIAN_SPLATS}\n\
|
||||
*\n\
|
||||
* @name czm_passGaussianSplats\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passGaussianSplats = 12.0;\n\
|
||||
";
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#GLOBE}
|
||||
*
|
||||
* @name czm_passGlobe
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passGlobe = 2.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#GLOBE}\n\
|
||||
*\n\
|
||||
* @name czm_passGlobe\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passGlobe = 2.0;\n\
|
||||
";
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#OPAQUE}
|
||||
*
|
||||
* @name czm_passOpaque
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passOpaque = 9.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#OPAQUE}\n\
|
||||
*\n\
|
||||
* @name czm_passOpaque\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passOpaque = 9.0;\n\
|
||||
";
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* The automatic GLSL constant for {@link Pass#OVERLAY}
|
||||
*
|
||||
* @name czm_passOverlay
|
||||
* @glslConstant
|
||||
*
|
||||
* @see czm_pass
|
||||
*/
|
||||
const float czm_passOverlay = 13.0;
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
//This file is automatically rebuilt by the Cesium build process.
|
||||
export default "/**\n\
|
||||
* The automatic GLSL constant for {@link Pass#OVERLAY}\n\
|
||||
*\n\
|
||||
* @name czm_passOverlay\n\
|
||||
* @glslConstant\n\
|
||||
*\n\
|
||||
* @see czm_pass\n\
|
||||
*/\n\
|
||||
const float czm_passOverlay = 13.0;\n\
|
||||
";
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user