diff --git a/Source/Renderer/Context.js b/Source/Renderer/Context.js index 77d26c021712..9dd5eba7c0ff 100644 --- a/Source/Renderer/Context.js +++ b/Source/Renderer/Context.js @@ -591,7 +591,7 @@ define([ }, /** - * true returns if the context's floating point textures support 6 decimal places of precision. + * Returns true if the context's floating point textures support 6 decimal places of precision. * @memberof Context.prototype * @type {Boolean} * @see {@link https://www.khronos.org/registry/webgl/extensions/OES_texture_float/} diff --git a/Source/Renderer/checkFloatTexturePrecision.js b/Source/Renderer/checkFloatTexturePrecision.js index c30ec61a40fb..3da3deb22aa6 100644 --- a/Source/Renderer/checkFloatTexturePrecision.js +++ b/Source/Renderer/checkFloatTexturePrecision.js @@ -21,7 +21,7 @@ define([ * Checks if the context's floating point textures support 6 decimal places of precision. * * @param {Context} context A context wrapping a gl implementation. - * @returns {Boolean} whether or not the context's floating point textures support 6 decimal places of precision + * @returns {Boolean} Whether or not the context's floating point textures support 6 decimal places of precision * * @private */ diff --git a/Source/Shaders/CheckFloatTexturePrecisionFS.glsl b/Source/Shaders/CheckFloatTexturePrecisionFS.glsl index a2eadb4bd827..8f77d167cef5 100644 --- a/Source/Shaders/CheckFloatTexturePrecisionFS.glsl +++ b/Source/Shaders/CheckFloatTexturePrecisionFS.glsl @@ -1,6 +1,7 @@ uniform sampler2D u_floatTexture; -void main() { +void main() +{ float actual = texture2D(u_floatTexture, vec2(0.5, 0.5)).r; float expected = 123456.0; gl_FragColor = vec4(abs(actual - expected), 0.0, 0.0, 1.0); diff --git a/Source/Shaders/ShadowVolumeAppearanceFS.glsl b/Source/Shaders/ShadowVolumeAppearanceFS.glsl index ab8903295863..d42c278e5111 100644 --- a/Source/Shaders/ShadowVolumeAppearanceFS.glsl +++ b/Source/Shaders/ShadowVolumeAppearanceFS.glsl @@ -20,12 +20,14 @@ varying vec4 v_color; #endif #ifdef NORMAL_EC -vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) { +vec3 getEyeCoordinate3FromWindowCoordinate(vec2 fragCoord, float logDepthOrDepth) +{ vec4 eyeCoordinate = czm_windowToEyeCoordinates(fragCoord, logDepthOrDepth); return eyeCoordinate.xyz / eyeCoordinate.w; } -vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) { +vec3 vectorFromOffset(vec4 eyeCoordinate, vec2 positiveOffset) +{ vec2 glFragCoordXY = gl_FragCoord.xy; // Sample depths at both offset and negative offset float upOrRightLogDepth = czm_unpackDepth(texture2D(czm_globeDepthTexture, (glFragCoordXY + positiveOffset) / czm_viewport.zw)); @@ -71,7 +73,8 @@ void main(void) #ifdef PICK #ifdef CULL_FRAGMENTS - if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0) { + if (0.0 <= uv.x && uv.x <= 1.0 && 0.0 <= uv.y && uv.y <= 1.0) + { gl_FragColor.a = 1.0; // 0.0 alpha leads to discard from ShaderSource.createPickFragmentShaderSource czm_writeDepthClampedToFarPlane(); } @@ -81,7 +84,8 @@ void main(void) #else // PICK #ifdef CULL_FRAGMENTS - if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y) { + if (uv.x <= 0.0 || 1.0 <= uv.x || uv.y <= 0.0 || 1.0 <= uv.y) + { discard; } #endif diff --git a/Source/Shaders/ShadowVolumeAppearanceVS.glsl b/Source/Shaders/ShadowVolumeAppearanceVS.glsl index f1e2e6b0c2e0..b5d486c7de68 100644 --- a/Source/Shaders/ShadowVolumeAppearanceVS.glsl +++ b/Source/Shaders/ShadowVolumeAppearanceVS.glsl @@ -26,7 +26,8 @@ varying vec3 v_vMaxAndInverseDistance; #endif // TEXTURE_COORDINATES #if defined(TEXTURE_COORDINATES) && !defined(SPHERICAL) && defined(UINT8_PACKING) -vec4 clampAndMagnitude(vec4 sd) { +vec4 clampAndMagnitude(vec4 sd) +{ vec4 d = sd; d.x = czm_branchFreeTernary(sd.x < 128.0, d.x, (255.0 - sd.x)); d.x = floor(0.5 + d.x); @@ -36,12 +37,14 @@ vec4 clampAndMagnitude(vec4 sd) { return d; } -float unpackLowLessThan100k(vec4 sd) { +float unpackLowLessThan100k(vec4 sd) +{ vec4 d = clampAndMagnitude(sd); return (1000.0 * d.x + 10.0 * d.y + 0.1 * d.z + 0.001 * d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0); } -vec3 southwest_LOW(vec4 x, vec4 y, vec4 z) { +vec3 southwest_LOW(vec4 x, vec4 y, vec4 z) +{ vec3 value; value.x = unpackLowLessThan100k(x); value.y = unpackLowLessThan100k(y); @@ -49,11 +52,14 @@ vec3 southwest_LOW(vec4 x, vec4 y, vec4 z) { return value; } -float unpackHighMagLessThan100Million(vec4 sd) { +float unpackHighMagLessThan100Million(vec4 sd) +{ vec4 d = clampAndMagnitude(sd); return (1000000.0 * d.x + 10000.0 * d.y + 100.0 * d.z + d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0); } -vec3 southwest_HIGH(vec4 x, vec4 y, vec4 z) { + +vec3 southwest_HIGH(vec4 x, vec4 y, vec4 z) +{ vec3 value; value.x = unpackHighMagLessThan100Million(x); value.y = unpackHighMagLessThan100Million(y); @@ -62,7 +68,8 @@ vec3 southwest_HIGH(vec4 x, vec4 y, vec4 z) { } #ifdef COLUMBUS_VIEW_2D -vec4 unpackPlanes2D_HIGH(vec4 x, vec4 y, vec4 z, vec4 w) { +vec4 unpackPlanes2D_HIGH(vec4 x, vec4 y, vec4 z, vec4 w) +{ vec4 value; value.x = unpackHighMagLessThan100Million(x); value.y = unpackHighMagLessThan100Million(y); @@ -71,7 +78,8 @@ vec4 unpackPlanes2D_HIGH(vec4 x, vec4 y, vec4 z, vec4 w) { return value; } -vec4 unpackPlanes2D_LOW(vec4 x, vec4 y, vec4 z, vec4 w) { +vec4 unpackPlanes2D_LOW(vec4 x, vec4 y, vec4 z, vec4 w) +{ vec4 value; value.x = unpackLowLessThan100k(x); value.y = unpackLowLessThan100k(y); @@ -81,12 +89,14 @@ vec4 unpackPlanes2D_LOW(vec4 x, vec4 y, vec4 z, vec4 w) { } #else -float unpackLowLessThan1000k(vec4 sd) { +float unpackLowLessThan1000k(vec4 sd) +{ vec4 d = clampAndMagnitude(sd); return (10000.0 * d.x + 100.0 * d.y + d.z + 0.01 * d.w) * czm_branchFreeTernary(sd.x < 128.0, 1.0, -1.0); } -vec3 unpackExtent(vec4 x, vec4 y, vec4 z) { +vec3 unpackExtent(vec4 x, vec4 y, vec4 z) +{ vec3 value; value.x = unpackLowLessThan1000k(x); value.y = unpackLowLessThan1000k(y);