From 80f5976420f9a61f67f6ffa25c82d4ffb95c7575 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Tue, 26 Sep 2017 16:49:23 +0300 Subject: [PATCH 001/104] added optional logarithmic depth buffer --- Source/Scene/GlobeSurfaceShaderSet.js | 3 ++ Source/Scene/GlobeSurfaceTileProvider.js | 3 ++ Source/Scene/Scene.js | 31 +++++++++++++++++---- Source/Shaders/GlobeFS.glsl | 6 ++++ Source/Shaders/GlobeVS.glsl | 2 ++ Source/Widgets/CesiumWidget/CesiumWidget.js | 3 +- Source/Widgets/Viewer/Viewer.js | 3 +- 7 files changed, 43 insertions(+), 8 deletions(-) diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index 2442df1a5efb..9f69571ae84c 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -112,6 +112,9 @@ define([ vs.defines.push(quantizationDefine); fs.defines.push('TEXTURE_UNITS ' + numberOfDayTextures); + if (frameState.logDepthBuffer) { + fs.defines.push('LOG_DEPTH_BUFFER'); + } if (applyBrightness) { fs.defines.push('APPLY_BRIGHTNESS'); } diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 00c047e2b83d..123570ea88cc 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -763,6 +763,9 @@ define([ function createTileUniformMap(frameState) { var uniformMap = { + u_far : function() { + return frameState.camera._scene._frustumCommandsList[0].far; + }, u_initialColor : function() { return this.properties.initialColor; }, diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 2e649fa00944..3ed5464c693b 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -230,6 +230,8 @@ define([ */ function Scene(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); + this.logDepthBuffer = defaultValue(options.logDepthBuffer, false); + var canvas = options.canvas; var contextOptions = options.contextOptions; var creditContainer = options.creditContainer; @@ -256,6 +258,7 @@ define([ this._jobScheduler = new JobScheduler(); this._frameState = new FrameState(context, new CreditDisplay(creditContainer), this._jobScheduler); this._frameState.scene3DOnly = defaultValue(options.scene3DOnly, false); + this._frameState.logDepthBuffer = this.logDepthBuffer; var ps = new PassState(context); ps.viewport = new BoundingRectangle(); @@ -676,8 +679,16 @@ define([ // initial guess at frustums. var near = camera.frustum.near; var far = camera.frustum.far; - var numFrustums = Math.ceil(Math.log(far / near) / Math.log(this.farToNearRatio)); - updateFrustums(near, far, this.farToNearRatio, numFrustums, this._frustumCommandsList, false, undefined); + var numFrustums; + var farToNearRatio; + if (this.logDepthBuffer) { + numFrustums = 1; + farToNearRatio = far / near; + } else { + numFrustums = Math.ceil(Math.log(far / near) / Math.log(this.farToNearRatio)); + farToNearRatio = this.farToNearRatio; + } + updateFrustums(near, far, farToNearRatio, numFrustums, this._frustumCommandsList, false, undefined); // give frameState, camera, and screen space camera controller initial state before rendering updateFrameState(this, 0.0, JulianDate.now()); @@ -1527,12 +1538,18 @@ define([ // Exploit temporal coherence. If the frustums haven't changed much, use the frustums computed // last frame, else compute the new frustums and sort them by frustum again. var is2D = scene.mode === SceneMode.SCENE2D; - var farToNearRatio = scene.farToNearRatio; + var farToNearRatio = scene.farToNearRatio; var numFrustums; + if (!is2D) { // The multifrustum for 3D/CV is non-uniformly distributed. - numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); + if (scene.logDepthBuffer) { + numFrustums = 1; + farToNearRatio = far / near; + } else { + numFrustums = Math.ceil(Math.log(far / near) / Math.log(scene.farToNearRatio)); + } } else { // The multifrustum for 2D is uniformly distributed. To avoid z-fighting in 2D, // the camera i smoved to just before the frustum and the frustum depth is scaled @@ -1542,8 +1559,10 @@ define([ numFrustums = Math.ceil(Math.max(1.0, far - near) / scene.nearToFarDistance2D); } - if (near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && - (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)))))) { + if ((scene.logDepthBuffer && + !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)) || + (near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && + (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8))))))) { updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, scene.nearToFarDistance2D); createPotentiallyVisibleSet(scene); } diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 34f8bc02c4ca..e727d3d7a74e 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -1,6 +1,8 @@ //#define SHOW_TILE_BOUNDARIES +#extension GL_EXT_frag_depth : enable uniform vec4 u_initialColor; +uniform float u_far; #if TEXTURE_UNITS > 0 uniform sampler2D u_dayTextures[TEXTURE_UNITS]; @@ -54,6 +56,7 @@ uniform vec2 u_lightingFadeDistance; varying vec3 v_positionMC; varying vec3 v_positionEC; +varying vec4 v_position; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; varying vec3 v_normalEC; @@ -205,6 +208,9 @@ void main() #else gl_FragColor = finalColor; #endif +#ifdef LOG_DEPTH_BUFFER + gl_FragDepthEXT = log(v_position.w + 1.) / log(u_far + 1.); +#endif } #ifdef SHOW_REFLECTIVE_OCEAN diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index a9cbc9ed2382..4c5ed05ad33e 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -17,6 +17,7 @@ uniform vec2 u_southMercatorYAndOneOverHeight; varying vec3 v_positionMC; varying vec3 v_positionEC; +varying vec4 v_position; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; @@ -151,6 +152,7 @@ void main() v_textureCoordinates = vec3(textureCoordinates, webMercatorT); + v_position = gl_Position; #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz; v_positionMC = position3DWC; // position in model coordinates diff --git a/Source/Widgets/CesiumWidget/CesiumWidget.js b/Source/Widgets/CesiumWidget/CesiumWidget.js index da432e22142a..1f7a1eed698a 100644 --- a/Source/Widgets/CesiumWidget/CesiumWidget.js +++ b/Source/Widgets/CesiumWidget/CesiumWidget.js @@ -261,7 +261,8 @@ define([ scene3DOnly : defaultValue(options.scene3DOnly, false), terrainExaggeration : options.terrainExaggeration, shadows : options.shadows, - mapMode2D : options.mapMode2D + mapMode2D : options.mapMode2D, + logDepthBuffer : options.logDepthBuffer }); this._scene = scene; diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index 2d0e990e488b..7300a1fcb3cc 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -434,7 +434,8 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to terrainExaggeration : options.terrainExaggeration, shadows : options.shadows, terrainShadows : options.terrainShadows, - mapMode2D : options.mapMode2D + mapMode2D : options.mapMode2D, + logDepthBuffer : options.logDepthBuffer }); var dataSourceCollection = options.dataSources; From 36264f77e04cde992e51dcc787155e8776237041 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Wed, 27 Sep 2017 15:30:31 +0300 Subject: [PATCH 002/104] fixed pickinig issue with log depth buffer --- Source/Scene/Scene.js | 12 ++++++++---- Source/Scene/SceneTransforms.js | 6 ++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 3ed5464c693b..be0b2e83fbc7 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1559,10 +1559,14 @@ define([ numFrustums = Math.ceil(Math.max(1.0, far - near) / scene.nearToFarDistance2D); } - if ((scene.logDepthBuffer && - !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)) || - (near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && - (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8))))))) { + var farChange; + if (frustumCommandsList.length !== 0){ + farChange = far / frustumCommandsList[numberOfFrustums - 1].far; + } + if ((near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && + ((scene.logDepthBuffer && + (isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8))) || + (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)))))))) { updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, scene.nearToFarDistance2D); createPotentiallyVisibleSet(scene); } diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 8dbb0a652fb0..1c3dc135a8c9 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -306,6 +306,12 @@ define([ var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; + if (scene.logDepthBuffer) { + var frustumCommand = scene._frustumCommandsList[0]; + var far = frustumCommand.far; + var near = frustumCommand.near; + depth = far * (1 - near/(Math.exp(depth * Math.log(far + 1.)) - 1)) / (far - near); + } ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; From e15adbf74933213598ca5e505c80f9dac6a71a65 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Wed, 27 Sep 2017 15:56:28 +0300 Subject: [PATCH 003/104] removed trailing decimal point to avoid eslint warn --- Source/Scene/SceneTransforms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 1c3dc135a8c9..33c303a5e672 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -310,7 +310,7 @@ define([ var frustumCommand = scene._frustumCommandsList[0]; var far = frustumCommand.far; var near = frustumCommand.near; - depth = far * (1 - near/(Math.exp(depth * Math.log(far + 1.)) - 1)) / (far - near); + depth = far * (1 - near/(Math.exp(depth * Math.log(far + 1)) - 1)) / (far - near); } ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; From bd5428ff9479518719bb51b1fc78beb4aef84516 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Wed, 27 Sep 2017 16:18:19 +0300 Subject: [PATCH 004/104] added to CONTRIBUTORS --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 119d7c8ecb62..0c4d20107eaf 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -72,6 +72,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Dave Whipps](https://github.com/dwhipps) * [Geoscan](https://www.geoscan.aero) * [Andrey Orlov](https://github.com/AndreyOrlov) + * [George Vinokhodov](https://github.com/Vineg) * [The Imagineers](https://www.theimagineers.com/) * [Heerco Grond](https://github.com/HeercoGrond) * [Camptocamp SA](https://www.camptocamp.com/) From ceedc326d648f0f997dc61b36209a945305ba1e2 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Wed, 27 Sep 2017 17:45:10 +0300 Subject: [PATCH 005/104] fallback to multifrustum if no fragDepth extension --- Source/Scene/Scene.js | 12 +++++++++++- Source/Shaders/GlobeFS.glsl | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index be0b2e83fbc7..44c6f649bf7a 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -230,7 +230,6 @@ define([ */ function Scene(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); - this.logDepthBuffer = defaultValue(options.logDepthBuffer, false); var canvas = options.canvas; var contextOptions = options.contextOptions; @@ -253,6 +252,17 @@ define([ creditContainer.style['padding-right'] = '5px'; canvas.parentNode.appendChild(creditContainer); } + if (options.logDepthBuffer) { + if (context.fragmentDepth) { + this.logDepthBuffer = true; + } else { + console.log('Can\'t use logarithmic depth buffer, since fragDepth extension not supported.\ +Fall back to multifrustum view'); + this.logDepthBuffer = false; + } + } else { + this.logDepthBuffer = false; + } this._id = createGuid(); this._jobScheduler = new JobScheduler(); diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index e727d3d7a74e..56ee64969775 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -1,5 +1,7 @@ //#define SHOW_TILE_BOUNDARIES +#ifdef GL_EXT_frag_depth #extension GL_EXT_frag_depth : enable +#endif uniform vec4 u_initialColor; uniform float u_far; From d70db84948273e2a9aebcc2b42afcfdfcafe6a3d Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Thu, 28 Sep 2017 14:50:56 +0300 Subject: [PATCH 006/104] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index aa13b9f20e12..8793e10c9b77 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,7 @@ Change Log * Fixed loading of binary glTFs containing CRN or KTX textures. [#5753](https://github.com/AnalyticalGraphicsInc/cesium/pull/5753) * Fixed specular computation for certain models using the `KHR_materials_common` extension. [#5773](https://github.com/AnalyticalGraphicsInc/cesium/pull/5773) * Fixed a picking bug in the `3D Tiles Interactivity` Sandcastle demo. [#5703](https://github.com/AnalyticalGraphicsInc/cesium/issues/5703) +* Added option "logDepthBuffer" to Cesium.Viewer. With this option globe is rendered in 1 frustum with logarithmic depth. It helps to avoid artifacts on the connection of two frustums. ### 1.36 - 2017-08-01 From a79138da454e30cde55dfa6d4a46960f771dfb6e Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 13 Oct 2017 17:45:57 +0300 Subject: [PATCH 007/104] added log depth to objects, removed option to turn it off --- Source/Scene/BillboardCollection.js | 2 ++ Source/Scene/ClassificationPrimitive.js | 14 +++++----- Source/Scene/EllipsoidPrimitive.js | 1 + Source/Scene/GlobeSurfaceTileProvider.js | 5 ++-- Source/Scene/Model.js | 26 ++++++++++++++++--- Source/Scene/PointCloud3DTileContent.js | 11 ++++++-- Source/Scene/Scene.js | 13 ++++------ Source/Scene/SceneTransforms.js | 2 +- .../PerInstanceColorAppearanceFS.glsl | 6 +++++ .../PerInstanceColorAppearanceVS.glsl | 2 ++ .../PerInstanceFlatColorAppearanceFS.glsl | 6 +++++ .../PerInstanceFlatColorAppearanceVS.glsl | 2 ++ .../PolylineMaterialAppearanceVS.glsl | 4 ++- .../TexturedMaterialAppearanceFS.glsl | 8 +++++- Source/Shaders/BillboardCollectionFS.glsl | 6 +++++ Source/Shaders/BillboardCollectionVS.glsl | 2 ++ .../Shaders/Builtin/Functions/logDepth.glsl | 6 +++++ Source/Shaders/DepthPlaneFS.glsl | 8 +++++- Source/Shaders/EllipsoidFS.glsl | 14 ++-------- Source/Shaders/GlobeFS.glsl | 5 +--- Source/Shaders/PolylineFS.glsl | 6 +++++ Source/Shaders/PolylineVS.glsl | 2 ++ Source/Shaders/ShadowVolumeFS.glsl | 3 ++- Source/Shaders/ShadowVolumeVS.glsl | 2 ++ Source/Widgets/CesiumWidget/CesiumWidget.js | 3 +-- Source/Widgets/Viewer/Viewer.js | 3 +-- 26 files changed, 115 insertions(+), 47 deletions(-) create mode 100644 Source/Shaders/Builtin/Functions/logDepth.glsl diff --git a/Source/Scene/BillboardCollection.js b/Source/Scene/BillboardCollection.js index ec9c06b36195..017c69b4e38f 100644 --- a/Source/Scene/BillboardCollection.js +++ b/Source/Scene/BillboardCollection.js @@ -4,6 +4,7 @@ define([ '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Color', + '../Core/combine', '../Core/ComponentDatatype', '../Core/defaultValue', '../Core/defined', @@ -39,6 +40,7 @@ define([ Cartesian2, Cartesian3, Color, + combine, ComponentDatatype, defaultValue, defined, diff --git a/Source/Scene/ClassificationPrimitive.js b/Source/Scene/ClassificationPrimitive.js index 49da56ec4403..7002deebe39d 100644 --- a/Source/Scene/ClassificationPrimitive.js +++ b/Source/Scene/ClassificationPrimitive.js @@ -1,5 +1,6 @@ define([ '../Core/ColorGeometryInstanceAttribute', + '../Core/combine', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', @@ -25,6 +26,7 @@ define([ './StencilOperation' ], function( ColorGeometryInstanceAttribute, + combine, defaultValue, defined, defineProperties, @@ -569,7 +571,7 @@ define([ } } - function createColorCommands(classificationPrimitive, colorCommands) { + function createColorCommands(classificationPrimitive, colorCommands, frameState) { var primitive = classificationPrimitive._primitive; var length = primitive._va.length * 3; colorCommands.length = length * 2; @@ -634,7 +636,7 @@ define([ } } - function createPickCommands(classificationPrimitive, pickCommands) { + function createPickCommands(classificationPrimitive, pickCommands, frameState) { var primitive = classificationPrimitive._primitive; var pickOffsets = primitive._pickOffsets; var length = pickOffsets.length * 3; @@ -710,9 +712,9 @@ define([ } } - function createCommands(classificationPrimitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) { - createColorCommands(classificationPrimitive, colorCommands); - createPickCommands(classificationPrimitive, pickCommands); + function createCommands(classificationPrimitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands, frameState) { + createColorCommands(classificationPrimitive, colorCommands, frameState); + createPickCommands(classificationPrimitive, pickCommands, frameState); } function boundingVolumeIndex(commandIndex, length) { @@ -870,7 +872,7 @@ define([ createShaderProgram(that, frameState); }; primitiveOptions._createCommandsFunction = function(primitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) { - createCommands(that, undefined, undefined, true, false, colorCommands, pickCommands); + createCommands(that, undefined, undefined, true, false, colorCommands, pickCommands, frameState); }; if (defined(this._updateAndQueueCommandsFunction)) { diff --git a/Source/Scene/EllipsoidPrimitive.js b/Source/Scene/EllipsoidPrimitive.js index cd4ceff8f342..ae94ae608c2e 100644 --- a/Source/Scene/EllipsoidPrimitive.js +++ b/Source/Scene/EllipsoidPrimitive.js @@ -262,6 +262,7 @@ define([ * @exception {DeveloperError} this.material must be defined. */ EllipsoidPrimitive.prototype.update = function(frameState) { + if (!this.show || (frameState.mode !== SceneMode.SCENE3D) || (!defined(this.center)) || diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 123570ea88cc..1fbe406dcc11 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -6,6 +6,7 @@ define([ '../Core/Cartesian4', '../Core/Color', '../Core/ColorGeometryInstanceAttribute', + '../Core/Combine', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', @@ -50,6 +51,7 @@ define([ Cartesian4, Color, ColorGeometryInstanceAttribute, + combine, defaultValue, defined, defineProperties, @@ -763,9 +765,6 @@ define([ function createTileUniformMap(frameState) { var uniformMap = { - u_far : function() { - return frameState.camera._scene._frustumCommandsList[0].far; - }, u_initialColor : function() { return this.properties.initialColor; }, diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 5fb81de4deea..5b36f3943ccf 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1,4 +1,4 @@ -define([ + define([ '../Core/BoundingSphere', '../Core/Cartesian2', '../Core/Cartesian3', @@ -2027,11 +2027,16 @@ define([ return defined(gltf.asset) ? defaultValue(gltf.asset.premultipliedAlpha, false) : false; } - function modifyShaderForColor(shader, premultipliedAlpha) { + function modifyShaderForColorAndDepth(shader, premultipliedAlpha) { shader = ShaderSource.replaceMain(shader, 'gltf_blend_main'); + shader = '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n' + + shader; shader += 'uniform vec4 gltf_color; \n' + 'uniform float gltf_colorBlend; \n' + + 'varying vec4 v_position; \n' + 'void main() \n' + '{ \n' + ' gltf_blend_main(); \n'; @@ -2055,6 +2060,20 @@ define([ ' float highlight = ceil(gltf_colorBlend); \n' + ' gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n' + ' gl_FragColor.a *= gltf_color.a; \n' + + ' czm_logDepth(v_position.w); \n' + + '} \n'; + + return shader; + } + + function modifyVertexShaderForDepth(shader) { + shader = ShaderSource.replaceMain(shader, 'gltf_morph_main'); + shader += + 'varying vec4 v_position; \n' + + 'void main() \n' + + '{ \n' + + ' gltf_morph_main(); \n' + + ' v_position = u_projectionMatrix * (u_modelViewMatrix * vec4(a_position,1.0)); \n' + '} \n'; return shader; @@ -2110,7 +2129,8 @@ define([ } var premultipliedAlpha = hasPremultipliedAlpha(model); - var blendFS = modifyShaderForColor(fs, premultipliedAlpha); + var blendFS = modifyShaderForColorAndDepth(fs, premultipliedAlpha); + vs = modifyVertexShaderForDepth(vs); var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); var drawFS = modifyShader(blendFS, id, model._fragmentShaderLoaded); diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 7e447c28412f..0fb361e9bb55 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -898,6 +898,7 @@ define([ var vs = 'attribute vec3 a_position; \n' + 'varying vec4 v_color; \n' + + 'varying vec4 v_position; \n' + 'uniform vec2 u_pointSizeAndTilesetTime; \n' + 'uniform vec4 u_constantColor; \n' + 'uniform vec4 u_highlightColor; \n' + @@ -1014,7 +1015,8 @@ define([ } vs += ' v_color = color; \n' + - ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n'; + ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n' + + ' v_position = gl_Position; \n'; if (hasNormals && backFaceCulling) { vs += ' float visible = step(-normal.z, 0.0); \n' + @@ -1027,10 +1029,15 @@ define([ vs += '} \n'; - var fs = 'varying vec4 v_color; \n' + + var fs = '#ifdef GL_EXT_frag_depth \n' + + ' #extension GL_EXT_frag_depth : enable \n' + + '#endif \n' + + 'varying vec4 v_color; \n' + + 'varying vec4 v_position; \n' + 'void main() \n' + '{ \n' + ' gl_FragColor = v_color; \n' + + ' czm_logDepth(v_position.w); \n' + '} \n'; var drawVS = vs; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 44c6f649bf7a..54c146bf8b56 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -252,15 +252,11 @@ define([ creditContainer.style['padding-right'] = '5px'; canvas.parentNode.appendChild(creditContainer); } - if (options.logDepthBuffer) { - if (context.fragmentDepth) { - this.logDepthBuffer = true; - } else { - console.log('Can\'t use logarithmic depth buffer, since fragDepth extension not supported.\ -Fall back to multifrustum view'); - this.logDepthBuffer = false; - } + if (context.fragmentDepth) { + this.logDepthBuffer = true; } else { + console.log('Can\'t use logarithmic depth buffer, since fragDepth extension not supported.' + + 'Fall back to multifrustum view'); this.logDepthBuffer = false; } @@ -293,6 +289,7 @@ Fall back to multifrustum view'); this._computeCommandList = []; this._frustumCommandsList = []; + var that = this; this._overlayCommandList = []; this._pickFramebuffer = undefined; diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 33c303a5e672..db3738feaba4 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -310,7 +310,7 @@ define([ var frustumCommand = scene._frustumCommandsList[0]; var far = frustumCommand.far; var near = frustumCommand.near; - depth = far * (1 - near/(Math.exp(depth * Math.log(far + 1)) - 1)) / (far - near); + depth = far * (1 - 1 /(Math.exp(depth * Math.log(far / near + 1)) - 1)) / (far - near); } ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl index 6bef5b438655..d78b3daf6805 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl @@ -1,6 +1,11 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; +varying vec4 v_position; void main() { @@ -19,4 +24,5 @@ void main() material.alpha = v_color.a; gl_FragColor = czm_phong(normalize(positionToEyeEC), material); + czm_logDepth(v_position.w); } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl index b429e64c6896..82ed45a4edaa 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl @@ -7,6 +7,7 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; +varying vec4 v_position; void main() { @@ -17,4 +18,5 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; + v_position = gl_Position; } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl index 3649a0883f23..93ae1c912931 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl @@ -1,6 +1,12 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec4 v_color; +varying vec4 v_position; void main() { gl_FragColor = v_color; + czm_logDepth(v_position.w); } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl index ce015c678423..570328ea1d9f 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl @@ -4,6 +4,7 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; +varying vec4 v_position; void main() { @@ -12,4 +13,5 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; + v_position = gl_Position; } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 6b61f09369c6..3a171d2fa2fa 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -9,8 +9,9 @@ attribute vec2 st; attribute float batchId; varying float v_width; -varying vec2 v_st; +varying vec2 v_st; varying float v_polylineAngle; +varying vec4 v_position; void main() { @@ -27,4 +28,5 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC; + v_position = (czm_modelViewRelativeToEye * p);\n\; } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl index 1a52fc8d7e84..56ef7f5b8d44 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl @@ -1,3 +1,7 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; @@ -6,7 +10,7 @@ void main() { vec3 positionToEyeEC = -v_positionEC; - vec3 normalEC = normalize(v_normalEC);; + vec3 normalEC = normalize(v_normalEC); #ifdef FACE_FORWARD normalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC); #endif @@ -22,4 +26,6 @@ void main() #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif + + czm_logDepth(-v_positionEC.z); } diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index 64b133fdbf27..9ccd4c8ed2be 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -1,6 +1,11 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + uniform sampler2D u_atlas; varying vec2 v_textureCoordinates; +varying vec4 v_position; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -45,4 +50,5 @@ void main() #else gl_FragColor = color; #endif + czm_logDepth(-v_position.z); } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index b7dede3a6d20..19a02873ecc4 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -12,6 +12,7 @@ attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, f attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance varying vec2 v_textureCoordinates; +varying vec4 v_position; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -254,6 +255,7 @@ void main() vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); + v_position = positionEC; v_textureCoordinates = textureCoordinates; #ifdef DISABLE_DEPTH_DISTANCE diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl new file mode 100644 index 000000000000..0f5f8c47ae86 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/logDepth.glsl @@ -0,0 +1,6 @@ +void czm_logDepth(float z) +{ +#ifdef GL_EXT_frag_depth + gl_FragDepthEXT = log(z / czm_currentFrustum.x + 1.) / log( czm_currentFrustum.y / czm_currentFrustum.x + 1.); +#endif +} diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 4d898e118716..4d4bf13fb038 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -1,3 +1,7 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec4 positionEC; void main() @@ -7,7 +11,9 @@ void main() vec3 direction = normalize(positionEC.xyz); czm_ray ray = czm_ray(vec3(0.0), direction); - + + czm_logDepth(-positionEC.z); + czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); if (!czm_isEmpty(intersection)) { diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index a982dbcddd1a..083d77edc516 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -90,18 +90,8 @@ void main() gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a); gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a); - + #ifdef WRITE_DEPTH -#ifdef GL_EXT_frag_depth - t = (intersection.start != 0.0) ? intersection.start : intersection.stop; - vec3 positionEC = czm_pointAlongRay(ray, t); - vec4 positionCC = czm_projection * vec4(positionEC, 1.0); - float z = positionCC.z / positionCC.w; - - float n = czm_depthRange.near; - float f = czm_depthRange.far; - - gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5; -#endif + czm_logDepth(v_positionEC.z); #endif } diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 56ee64969775..75184e304eee 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -4,7 +4,6 @@ #endif uniform vec4 u_initialColor; -uniform float u_far; #if TEXTURE_UNITS > 0 uniform sampler2D u_dayTextures[TEXTURE_UNITS]; @@ -210,9 +209,7 @@ void main() #else gl_FragColor = finalColor; #endif -#ifdef LOG_DEPTH_BUFFER - gl_FragDepthEXT = log(v_position.w + 1.) / log(u_far + 1.); -#endif + czm_logDepth(v_position.w); } #ifdef SHOW_REFLECTIVE_OCEAN diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index e409035aed29..1f8f23648750 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -1,4 +1,9 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif + varying vec2 v_st; +varying vec4 v_position; void main() { @@ -10,4 +15,5 @@ void main() czm_material material = czm_getMaterial(materialInput); gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); + czm_logDepth(-v_position.z); } diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index ce95b001a470..8cf5da174f0c 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -16,6 +16,7 @@ varying vec2 v_st; varying float v_width; varying vec4 czm_pickColor; varying float v_polylineAngle; +varying vec4 v_position; void main() { @@ -92,6 +93,7 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; + v_position = gl_Position; v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0)); v_width = width; diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index 4eac3f5ee824..56f18aa1d4b7 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -5,6 +5,7 @@ // emulated noperspective varying float v_WindowZ; varying vec4 v_color; +varying vec4 v_position; void writeDepthClampedToFarPlane() { @@ -16,5 +17,5 @@ void writeDepthClampedToFarPlane() void main(void) { gl_FragColor = v_color; - writeDepthClampedToFarPlane(); + czm_logDepth(v_position.w); } diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index a85fc04a548e..a3dec21f637a 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -12,6 +12,7 @@ uniform float u_globeMinimumAltitude; // emulated noperspective varying float v_WindowZ; varying vec4 v_color; +varying vec4 v_position; vec4 depthClampFarPlane(vec4 vertexInClipCoordinates) { @@ -35,4 +36,5 @@ void main() #endif gl_Position = depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); + v_position = gl_Position; } diff --git a/Source/Widgets/CesiumWidget/CesiumWidget.js b/Source/Widgets/CesiumWidget/CesiumWidget.js index 1f7a1eed698a..da432e22142a 100644 --- a/Source/Widgets/CesiumWidget/CesiumWidget.js +++ b/Source/Widgets/CesiumWidget/CesiumWidget.js @@ -261,8 +261,7 @@ define([ scene3DOnly : defaultValue(options.scene3DOnly, false), terrainExaggeration : options.terrainExaggeration, shadows : options.shadows, - mapMode2D : options.mapMode2D, - logDepthBuffer : options.logDepthBuffer + mapMode2D : options.mapMode2D }); this._scene = scene; diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index 7300a1fcb3cc..2d0e990e488b 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -434,8 +434,7 @@ Either specify options.terrainProvider instead or set options.baseLayerPicker to terrainExaggeration : options.terrainExaggeration, shadows : options.shadows, terrainShadows : options.terrainShadows, - mapMode2D : options.mapMode2D, - logDepthBuffer : options.logDepthBuffer + mapMode2D : options.mapMode2D }); var dataSourceCollection = options.dataSources; From 4a79331ae7d25f210e514358342bdae602f4b33c Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 13 Oct 2017 18:00:58 +0300 Subject: [PATCH 008/104] removed unused variable --- Source/Scene/Scene.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 54c146bf8b56..db7151d944da 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -289,7 +289,6 @@ define([ this._computeCommandList = []; this._frustumCommandsList = []; - var that = this; this._overlayCommandList = []; this._pickFramebuffer = undefined; From 50c019ccd7fa6355ca0c2ed72ac07b564aedd11c Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 13 Oct 2017 18:20:42 +0300 Subject: [PATCH 009/104] fix wrong require --- Source/Scene/GlobeSurfaceTileProvider.js | 2 +- Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl | 2 ++ Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index 1fbe406dcc11..26ec3d725821 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -6,7 +6,7 @@ define([ '../Core/Cartesian4', '../Core/Color', '../Core/ColorGeometryInstanceAttribute', - '../Core/Combine', + '../Core/combine', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index 5bb9d0188828..38c9542cde12 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -9,6 +9,7 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; +varying vec4 v_position; void main() { @@ -25,4 +26,5 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; + v_position = (czm_modelViewRelativeToEye * p); } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 3a171d2fa2fa..6bd317ec3906 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -28,5 +28,5 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC; - v_position = (czm_modelViewRelativeToEye * p);\n\; + v_position = (czm_modelViewRelativeToEye * p); } From 043ebcca1ddacf8dcc121d994a28761a31d5fd52 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 13 Oct 2017 20:54:08 +0300 Subject: [PATCH 010/104] moved extension to logDepth function --- Source/Scene/Model.js | 4 ---- Source/Scene/PointCloud3DTileContent.js | 5 +---- .../Shaders/Appearances/PerInstanceColorAppearanceFS.glsl | 4 ---- .../Appearances/PerInstanceFlatColorAppearanceFS.glsl | 4 ---- .../Shaders/Appearances/TexturedMaterialAppearanceFS.glsl | 4 ---- Source/Shaders/BillboardCollectionFS.glsl | 4 ---- Source/Shaders/Builtin/Functions/logDepth.glsl | 3 +++ Source/Shaders/DepthPlaneFS.glsl | 4 ---- Source/Shaders/EllipsoidFS.glsl | 6 ------ Source/Shaders/GlobeFS.glsl | 4 ---- Source/Shaders/PolylineFS.glsl | 4 ---- Source/Shaders/ShadowVolumeFS.glsl | 4 ---- 12 files changed, 4 insertions(+), 46 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 4cbc9ca847ab..6ee0e51a2c48 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2014,10 +2014,6 @@ function modifyShaderForColorAndDepth(shader, premultipliedAlpha) { shader = ShaderSource.replaceMain(shader, 'gltf_blend_main'); - shader = '#ifdef GL_EXT_frag_depth \n' + - '#extension GL_EXT_frag_depth : enable \n' + - '#endif \n' + - shader; shader += 'uniform vec4 gltf_color; \n' + 'uniform float gltf_colorBlend; \n' + diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 1e9e44912a46..43f0789d3de5 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -1031,10 +1031,7 @@ define([ vs += '} \n'; - var fs = '#ifdef GL_EXT_frag_depth \n' + - ' #extension GL_EXT_frag_depth : enable \n' + - '#endif \n' + - 'varying vec4 v_color; \n' + + var fs = 'varying vec4 v_color; \n' + 'varying vec4 v_position; \n' + 'void main() \n' + '{ \n' + diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl index d78b3daf6805..7ec3960f4535 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl index 93ae1c912931..80cb20472f35 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - varying vec4 v_color; varying vec4 v_position; diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl index 56ef7f5b8d44..c1da24fa15cb 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index 9ccd4c8ed2be..c2edfc9366b8 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - uniform sampler2D u_atlas; varying vec2 v_textureCoordinates; diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl index 0f5f8c47ae86..25c19cca1bcf 100644 --- a/Source/Shaders/Builtin/Functions/logDepth.glsl +++ b/Source/Shaders/Builtin/Functions/logDepth.glsl @@ -1,3 +1,6 @@ +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif void czm_logDepth(float z) { #ifdef GL_EXT_frag_depth diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 4d4bf13fb038..5361950e5b66 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - varying vec4 positionEC; void main() diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index 083d77edc516..500f5ddd643d 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -1,9 +1,3 @@ -#ifdef WRITE_DEPTH -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif -#endif - uniform vec3 u_radii; uniform vec3 u_oneOverEllipsoidRadiiSquared; diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 75184e304eee..18872c6f24ca 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -1,8 +1,4 @@ //#define SHOW_TILE_BOUNDARIES -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - uniform vec4 u_initialColor; #if TEXTURE_UNITS > 0 diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index 1f8f23648750..a4f052f5baec 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - varying vec2 v_st; varying vec4 v_position; diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index 56f18aa1d4b7..3341933dd9f8 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -1,7 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif - // emulated noperspective varying float v_WindowZ; varying vec4 v_color; From 3d5cd2b84893739caf178c41f8cd8f32dd3e9cf1 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 10 Nov 2017 13:08:24 +0300 Subject: [PATCH 011/104] fixed polyline v_position --- Source/Shaders/PolylineVS.glsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 8cf5da174f0c..682708924b2c 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -93,7 +93,7 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; - v_position = gl_Position; + v_position = czm_modelViewRelativeToEye * p; v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0)); v_width = width; From 451761c2b4719c326a783831cc030c47e2d199c1 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Mon, 20 Nov 2017 15:40:23 +0300 Subject: [PATCH 012/104] Modified 3d tiles vertex shader. --- Source/Scene/Model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index f3e0806363f1..0a661dd3e9fb 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2054,7 +2054,7 @@ 'void main() \n' + '{ \n' + ' gltf_morph_main(); \n' + - ' v_position = u_projectionMatrix * (u_modelViewMatrix * vec4(a_position,1.0)); \n' + + ' v_position = gl_Position; \n' + '} \n'; return shader; From db0630f6ed413c3883de44d0fa8df07c4b8c5868 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Tue, 5 Dec 2017 12:04:16 +0300 Subject: [PATCH 013/104] fixed 3d tiles picking --- Source/Scene/Model.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 0a661dd3e9fb..3ca77e3fdf2e 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2012,12 +2012,11 @@ return defined(gltf.asset) ? defaultValue(gltf.asset.premultipliedAlpha, false) : false; } - function modifyShaderForColorAndDepth(shader, premultipliedAlpha) { + function modifyShaderForColor(shader, premultipliedAlpha) { shader = ShaderSource.replaceMain(shader, 'gltf_blend_main'); shader += 'uniform vec4 gltf_color; \n' + 'uniform float gltf_colorBlend; \n' + - 'varying vec4 v_position; \n' + 'void main() \n' + '{ \n' + ' gltf_blend_main(); \n'; @@ -2041,6 +2040,18 @@ ' float highlight = ceil(gltf_colorBlend); \n' + ' gl_FragColor.rgb *= mix(gltf_color.rgb, vec3(1.0), highlight); \n' + ' gl_FragColor.a *= gltf_color.a; \n' + + '} \n'; + + return shader; + } + + function modifyFsShaderForDepth(shader) { + shader = ShaderSource.replaceMain(shader, 'czm_main'); + shader += + 'varying vec4 v_position; \n' + + 'void main() \n' + + '{ \n' + + ' czm_main(); \n' + ' czm_logDepth(v_position.w); \n' + '} \n'; @@ -2110,7 +2121,8 @@ } var premultipliedAlpha = hasPremultipliedAlpha(model); - var blendFS = modifyShaderForColorAndDepth(fs, premultipliedAlpha); + fs = modifyFsShaderForDepth(fs); + var blendFS = modifyShaderForColor(fs, premultipliedAlpha); vs = modifyVertexShaderForDepth(vs); var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); From 8191c36512c79c67f8566f94622f4a1db490ece1 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 29 Dec 2017 18:18:17 +0300 Subject: [PATCH 014/104] fixed polyline depth --- Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index 38c9542cde12..ee902a01ddf5 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -27,4 +27,5 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; v_position = (czm_modelViewRelativeToEye * p); + v_position.w = -v_position.z; } From 665909cbefa06f49368f70207f93aebfa089a238 Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Tue, 9 Jan 2018 19:03:24 +0300 Subject: [PATCH 015/104] fixed interpolation issue --- Source/Scene/Model.js | 8 +++---- Source/Scene/PointCloud3DTileContent.js | 8 +++---- Source/Scene/SceneTransforms.js | 24 ++++++++++++++++--- .../Appearances/AllMaterialAppearanceVS.glsl | 2 ++ .../PerInstanceColorAppearanceFS.glsl | 4 ++-- .../PerInstanceColorAppearanceVS.glsl | 4 ++-- .../PerInstanceFlatColorAppearanceFS.glsl | 4 ++-- .../PerInstanceFlatColorAppearanceVS.glsl | 4 ++-- .../PolylineColorAppearanceVS.glsl | 5 ++-- .../PolylineMaterialAppearanceVS.glsl | 4 ++-- .../TexturedMaterialAppearanceFS.glsl | 3 ++- .../TexturedMaterialAppearanceVS.glsl | 2 ++ Source/Shaders/BillboardCollectionFS.glsl | 4 ++-- Source/Shaders/BillboardCollectionVS.glsl | 4 ++-- .../Shaders/Builtin/Functions/logDepth.glsl | 4 ++-- Source/Shaders/DepthPlaneFS.glsl | 2 +- Source/Shaders/EllipsoidFS.glsl | 5 ++-- Source/Shaders/EllipsoidVS.glsl | 2 ++ Source/Shaders/GlobeFS.glsl | 4 ++-- Source/Shaders/GlobeVS.glsl | 4 ++-- Source/Shaders/PolylineFS.glsl | 4 ++-- Source/Shaders/PolylineVS.glsl | 4 ++-- Source/Shaders/ShadowVolumeFS.glsl | 4 ++-- Source/Shaders/ShadowVolumeVS.glsl | 4 ++-- 24 files changed, 70 insertions(+), 47 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index ffdf00a40100..96d5a34832a0 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -2055,11 +2055,11 @@ function modifyFsShaderForDepth(shader) { shader = ShaderSource.replaceMain(shader, 'czm_main'); shader += - 'varying vec4 v_position; \n' + + 'varying float v_inverse_depth; \n' + 'void main() \n' + '{ \n' + ' czm_main(); \n' + - ' czm_logDepth(v_position.w); \n' + + ' czm_logDepth(v_inverse_depth); \n' + '} \n'; return shader; @@ -2068,11 +2068,11 @@ function modifyVertexShaderForDepth(shader) { shader = ShaderSource.replaceMain(shader, 'gltf_morph_main'); shader += - 'varying vec4 v_position; \n' + + 'varying float v_inverse_depth; \n' + 'void main() \n' + '{ \n' + ' gltf_morph_main(); \n' + - ' v_position = gl_Position; \n' + + ' v_inverse_depth = 1. / gl_Position.w; \n' + '} \n'; return shader; diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 43f0789d3de5..e48ed93b902b 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -898,7 +898,7 @@ define([ var vs = 'attribute vec3 a_position; \n' + 'varying vec4 v_color; \n' + - 'varying vec4 v_position; \n' + + 'varying float v_inverse_depth; \n' + 'uniform vec2 u_pointSizeAndTilesetTime; \n' + 'uniform vec4 u_constantColor; \n' + 'uniform vec4 u_highlightColor; \n' + @@ -1016,7 +1016,7 @@ define([ vs += ' v_color = color; \n' + ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n' + - ' v_position = gl_Position; \n'; + ' v_inverse_depth = 1. / gl_Position.w; \n'; if (hasNormals && backFaceCulling) { vs += ' float visible = step(-normal.z, 0.0); \n' + @@ -1032,11 +1032,11 @@ define([ vs += '} \n'; var fs = 'varying vec4 v_color; \n' + - 'varying vec4 v_position; \n' + + 'varying float v_inverse_depth; \n' + 'void main() \n' + '{ \n' + ' gl_FragColor = v_color; \n' + - ' czm_logDepth(v_position.w); \n' + + ' czm_logDepth(v_inverse_depth); \n' + '} \n'; var drawVS = vs; diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index db3738feaba4..517b5d5ff1a9 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -4,6 +4,7 @@ define([ '../Core/Cartesian3', '../Core/Cartesian4', '../Core/Cartographic', + '../Core/Color', '../Core/defined', '../Core/DeveloperError', '../Core/Math', @@ -18,6 +19,7 @@ define([ Cartesian3, Cartesian4, Cartographic, + Color, defined, DeveloperError, CesiumMath, @@ -310,7 +312,13 @@ define([ var frustumCommand = scene._frustumCommandsList[0]; var far = frustumCommand.far; var near = frustumCommand.near; - depth = far * (1 - 1 /(Math.exp(depth * Math.log(far / near + 1)) - 1)) / (far - near); + /* transforming logarithmic depth of form + * log(z / near) / log( far / near); + * to perspective form + * (far - far * near / z) / (far - near) + */ + console.log(Math.exp(depth * Math.log(far / near)) * near); + depth = far * (1 - 1 /(Math.exp(depth * Math.log(far / near)))) / (far - near); } ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; @@ -336,8 +344,18 @@ define([ var w = 1.0 / worldCoords.w; Cartesian3.multiplyByScalar(worldCoords, w, worldCoords); } - - return Cartesian3.fromCartesian4(worldCoords, result); + result = Cartesian3.fromCartesian4(worldCoords, result); +// window.vw.entities.add({ +// name : 'Red sphere with black outline', +// position: result, +// ellipsoid : { +// radii : new Cartesian3(30.0, 30.0, 30.0), +// material : Color.RED.withAlpha(0.5), +// outline : true, +// outlineColor : Color.BLACK +// } +// }); + return result; }; return SceneTransforms; diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl index 33d9d300a304..48b8db4416a2 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl @@ -11,6 +11,7 @@ varying vec3 v_normalEC; varying vec3 v_tangentEC; varying vec3 v_bitangentEC; varying vec2 v_st; +v_inverse_depth = -1. / v_positionEC.z; void main() { @@ -21,6 +22,7 @@ void main() v_tangentEC = czm_normal * tangent; // tangent in eye coordinates v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates v_st = st; + v_inverse_depth = -1. / v_positionEC.z; gl_Position = czm_modelViewProjectionRelativeToEye * p; } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl index 7ec3960f4535..abf0c39b733f 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl @@ -1,7 +1,7 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -20,5 +20,5 @@ void main() material.alpha = v_color.a; gl_FragColor = czm_phong(normalize(positionToEyeEC), material); - czm_logDepth(v_position.w); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl index 82ed45a4edaa..e54c2648f2dc 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl @@ -7,7 +7,7 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -18,5 +18,5 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_position = gl_Position; + v_inverse_depth = 1. / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl index 80cb20472f35..08eebb3b5e98 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl @@ -1,8 +1,8 @@ varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void main() { gl_FragColor = v_color; - czm_logDepth(v_position.w); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl index 570328ea1d9f..32332459a445 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl @@ -4,7 +4,7 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -13,5 +13,5 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_position = gl_Position; + v_inverse_depth = 1. / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index ee902a01ddf5..16a28d53975a 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -9,7 +9,7 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -26,6 +26,5 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; - v_position = (czm_modelViewRelativeToEye * p); - v_position.w = -v_position.z; + v_inverse_depth = -1. / (czm_modelViewRelativeToEye * p).z; } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 6bd317ec3906..358ebd7e69d9 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -11,7 +11,7 @@ attribute float batchId; varying float v_width; varying vec2 v_st; varying float v_polylineAngle; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -28,5 +28,5 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC; - v_position = (czm_modelViewRelativeToEye * p); + v_inverse_depth = -1. / (czm_modelViewRelativeToEye * p).z; } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl index c1da24fa15cb..9e2c4a91c157 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl @@ -1,6 +1,7 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; +varying float v_inverse_depth; void main() { @@ -23,5 +24,5 @@ void main() gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif - czm_logDepth(-v_positionEC.z); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl index 19c102bba321..e9243376a0fa 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl @@ -7,6 +7,7 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; +varying float v_inverse_depth; void main() { @@ -14,6 +15,7 @@ void main() v_positionEC = (czm_modelViewRelativeToEye * p).xyz; // position in eye coordinates v_normalEC = czm_normal * normal; // normal in eye coordinates + v_inverse_depth = -1. / v_positionEC.z; v_st = st; gl_Position = czm_modelViewProjectionRelativeToEye * p; diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index c2edfc9366b8..5285f3b3f8fb 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -1,7 +1,7 @@ uniform sampler2D u_atlas; varying vec2 v_textureCoordinates; -varying vec4 v_position; +varying float v_inverse_depth; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -46,5 +46,5 @@ void main() #else gl_FragColor = color; #endif - czm_logDepth(-v_position.z); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 19a02873ecc4..1e58d25cc08f 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -12,7 +12,7 @@ attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, f attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance varying vec2 v_textureCoordinates; -varying vec4 v_position; +varying float v_inverse_depth; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -255,7 +255,7 @@ void main() vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - v_position = positionEC; + v_inverse_depth = -1. / positionEC.z; v_textureCoordinates = textureCoordinates; #ifdef DISABLE_DEPTH_DISTANCE diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl index 25c19cca1bcf..0b3527458917 100644 --- a/Source/Shaders/Builtin/Functions/logDepth.glsl +++ b/Source/Shaders/Builtin/Functions/logDepth.glsl @@ -1,9 +1,9 @@ #ifdef GL_EXT_frag_depth #extension GL_EXT_frag_depth : enable #endif -void czm_logDepth(float z) +void czm_logDepth(float w) { #ifdef GL_EXT_frag_depth - gl_FragDepthEXT = log(z / czm_currentFrustum.x + 1.) / log( czm_currentFrustum.y / czm_currentFrustum.x + 1.); + gl_FragDepthEXT = -log(w * czm_currentFrustum.x) / log( czm_currentFrustum.y / czm_currentFrustum.x); #endif } diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 5361950e5b66..64da577930e2 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -8,7 +8,7 @@ void main() vec3 direction = normalize(positionEC.xyz); czm_ray ray = czm_ray(vec3(0.0), direction); - czm_logDepth(-positionEC.z); + czm_logDepth(-1. / positionEC.z); czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); if (!czm_isEmpty(intersection)) diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index 500f5ddd643d..acfddb472c02 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -2,6 +2,7 @@ uniform vec3 u_radii; uniform vec3 u_oneOverEllipsoidRadiiSquared; varying vec3 v_positionEC; +varying float v_inverse_depth; vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side) { @@ -85,7 +86,5 @@ void main() gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a); gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a); -#ifdef WRITE_DEPTH - czm_logDepth(v_positionEC.z); -#endif + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/EllipsoidVS.glsl b/Source/Shaders/EllipsoidVS.glsl index af801899fd64..9c6252dd4221 100644 --- a/Source/Shaders/EllipsoidVS.glsl +++ b/Source/Shaders/EllipsoidVS.glsl @@ -3,6 +3,7 @@ attribute vec3 position; uniform vec3 u_radii; varying vec3 v_positionEC; +varying float v_inverse_depth; void main() { @@ -14,6 +15,7 @@ void main() v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates gl_Position = czm_modelViewProjection * p; // position in clip coordinates + v_inverse_depth = 1. / v_positionEC.z; // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index 8b9acefb87b7..52443f92b010 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -57,7 +57,7 @@ uniform float u_minimumBrightness; varying vec3 v_positionMC; varying vec3 v_positionEC; -varying vec4 v_position; +varying float v_inverse_depth; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; varying vec3 v_normalEC; @@ -228,7 +228,7 @@ void main() #else gl_FragColor = finalColor; #endif - czm_logDepth(v_position.w); + czm_logDepth(v_inverse_depth); } #ifdef SHOW_REFLECTIVE_OCEAN diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index c4e555c79b3b..23ee727f924a 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -17,7 +17,7 @@ uniform vec2 u_southMercatorYAndOneOverHeight; varying vec3 v_positionMC; varying vec3 v_positionEC; -varying vec4 v_position; +varying float v_inverse_depth; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; @@ -157,7 +157,7 @@ void main() v_textureCoordinates = vec3(textureCoordinates, webMercatorT); - v_position = gl_Position; + v_inverse_depth = 1. / gl_Position.w; #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz; v_positionMC = position3DWC; // position in model coordinates diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index a4f052f5baec..f162dcfa4b50 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -1,5 +1,5 @@ varying vec2 v_st; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -11,5 +11,5 @@ void main() czm_material material = czm_getMaterial(materialInput); gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); - czm_logDepth(-v_position.z); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 682708924b2c..4015531d8c92 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -16,7 +16,7 @@ varying vec2 v_st; varying float v_width; varying vec4 czm_pickColor; varying float v_polylineAngle; -varying vec4 v_position; +varying float v_inverse_depth; void main() { @@ -93,7 +93,7 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; - v_position = czm_modelViewRelativeToEye * p; + v_inverse_depth = 1. / (czm_modelViewRelativeToEye * p).z; v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0)); v_width = width; diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index 3341933dd9f8..354fbc34a3a2 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -1,7 +1,7 @@ // emulated noperspective varying float v_WindowZ; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; void writeDepthClampedToFarPlane() { @@ -13,5 +13,5 @@ void writeDepthClampedToFarPlane() void main(void) { gl_FragColor = v_color; - czm_logDepth(v_position.w); + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index a3dec21f637a..c02cf7681094 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -12,7 +12,7 @@ uniform float u_globeMinimumAltitude; // emulated noperspective varying float v_WindowZ; varying vec4 v_color; -varying vec4 v_position; +varying float v_inverse_depth; vec4 depthClampFarPlane(vec4 vertexInClipCoordinates) { @@ -36,5 +36,5 @@ void main() #endif gl_Position = depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); - v_position = gl_Position; + v_inverse_depth = 1. / gl_Position.w; } From 22bfd3492ef90a55ea083884b4e3c727ce48328a Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Tue, 9 Jan 2018 19:46:24 +0300 Subject: [PATCH 016/104] removed unnecessary variable --- Source/Scene/Model.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 5eacd3e309fa..8c2bf2c014e8 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1913,7 +1913,6 @@ var premultipliedAlpha = hasPremultipliedAlpha(model); fs = modifyFsShaderForDepth(fs); - var blendFS = modifyShaderForColor(fs, premultipliedAlpha); vs = modifyVertexShaderForDepth(vs); var finalFS = modifyShaderForColor(fs, premultipliedAlpha); if (ClippingPlaneCollection.isSupported()) { From 417c3f9b61ba71b45ac39afae3a3c62f42b5cc7e Mon Sep 17 00:00:00 2001 From: George Vinokhodov Date: Fri, 9 Feb 2018 15:51:22 +0300 Subject: [PATCH 017/104] fixed some artifacts --- Source/Renderer/ShaderSource.js | 3 +++ Source/Scene/Model.js | 6 +++--- Source/Shaders/Builtin/Functions/logDepth.glsl | 3 --- Source/Shaders/ShadowVolumeFS.glsl | 4 ++-- Source/Shaders/ShadowVolumeVS.glsl | 7 ++++--- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Source/Renderer/ShaderSource.js b/Source/Renderer/ShaderSource.js index b1f4684b93df..9fe1ff4cbd6c 100644 --- a/Source/Renderer/ShaderSource.js +++ b/Source/Renderer/ShaderSource.js @@ -228,6 +228,9 @@ define([ precision highp float;\n\ #else\n\ precision mediump float;\n\ +#endif\n\n\ +#ifdef GL_EXT_frag_depth\n\ +#extension GL_EXT_frag_depth : enable\n\ #endif\n\n'; } diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index b2186a8a71d8..4be3d050426c 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1853,7 +1853,7 @@ function modifyFsShaderForDepth(shader) { shader = ShaderSource.replaceMain(shader, 'czm_main'); shader += - 'varying float v_inverse_depth; \n' + + 'varying float v_inverse_depth;\n' + 'void main() \n' + '{ \n' + ' czm_main(); \n' + @@ -1866,11 +1866,11 @@ function modifyVertexShaderForDepth(shader) { shader = ShaderSource.replaceMain(shader, 'gltf_morph_main'); shader += - 'varying float v_inverse_depth; \n' + + 'varying float v_inverse_depth;\n' + 'void main() \n' + '{ \n' + ' gltf_morph_main(); \n' + - ' v_inverse_depth = 1. / gl_Position.w; \n' + + ' v_inverse_depth = 1. / ((u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0)).w); \n' + '} \n'; return shader; diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl index 0b3527458917..9c3f6487f028 100644 --- a/Source/Shaders/Builtin/Functions/logDepth.glsl +++ b/Source/Shaders/Builtin/Functions/logDepth.glsl @@ -1,6 +1,3 @@ -#ifdef GL_EXT_frag_depth -#extension GL_EXT_frag_depth : enable -#endif void czm_logDepth(float w) { #ifdef GL_EXT_frag_depth diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index 71fcf81bebde..b6df103f05b0 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -8,7 +8,7 @@ uniform vec4 u_highlightColor; varying vec4 v_color; #endif -varying float v_inverse_depth; +varying float v_depth; void main(void) { @@ -18,5 +18,5 @@ void main(void) gl_FragColor = v_color; #endif //czm_writeDepthClampedToFarPlane(); - czm_logDepth(v_inverse_depth); + czm_logDepth(1. / v_depth); } diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index da6775f26474..a305d810b8c2 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -19,7 +19,7 @@ uniform float u_globeMinimumAltitude; #ifndef VECTOR_TILE varying vec4 v_color; #endif -varying float v_inverse_depth; +varying float v_depth; void main() { @@ -37,7 +37,8 @@ void main() //extrudeDirection is zero for the top layer position = position + vec4(extrudeDirection * delta, 0.0); #endif - gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); + vec4 positionEC = czm_modelViewProjectionRelativeToEye * position; + gl_Position = czm_depthClampFarPlane(positionEC); #endif - v_inverse_depth = 1. / gl_Position.w; + v_depth = gl_Position.w; } From f5ad7c635bd1144d9ae284a4a09af31628563a1e Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Feb 2018 15:48:56 -0500 Subject: [PATCH 018/104] Use uniform semantic for model-view-projection matrix. --- Source/Scene/BillboardCollection.js | 2 -- Source/Scene/ClassificationModel.js | 25 +++++++++++-------- Source/Scene/EllipsoidPrimitive.js | 1 - Source/Scene/Model.js | 32 +++--------------------- Source/Scene/ModelUtility.js | 38 +++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 42 deletions(-) diff --git a/Source/Scene/BillboardCollection.js b/Source/Scene/BillboardCollection.js index b19e251314a2..2f5737f4558b 100644 --- a/Source/Scene/BillboardCollection.js +++ b/Source/Scene/BillboardCollection.js @@ -4,7 +4,6 @@ define([ '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Color', - '../Core/combine', '../Core/ComponentDatatype', '../Core/defaultValue', '../Core/defined', @@ -40,7 +39,6 @@ define([ Cartesian2, Cartesian3, Color, - combine, ComponentDatatype, defaultValue, defined, diff --git a/Source/Scene/ClassificationModel.js b/Source/Scene/ClassificationModel.js index f5955f6bb818..76dd0de637c0 100644 --- a/Source/Scene/ClassificationModel.js +++ b/Source/Scene/ClassificationModel.js @@ -663,23 +663,25 @@ define([ } function createProgram(model) { - var positionName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, 'POSITION'); - var batchIdName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, '_BATCHID'); + var gltf = model.gltf; + + var positionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'POSITION'); + var batchIdName = ModelUtility.getAttributeOrUniformBySemantic(gltf, '_BATCHID'); var attributeLocations = {}; attributeLocations[positionName] = 0; attributeLocations[batchIdName] = 1; - var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, 'MODELVIEWPROJECTION'); + var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION'); var uniformDecl; var computePosition; if (!defined(modelViewProjectionName)) { - var projectionName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, 'PROJECTION'); - var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, 'MODELVIEW'); + var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); + var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEW'); if (!defined(modelViewName)) { - modelViewName = ModelUtility.getAttributeOrUniformBySemantic(model.gltf, 'CESIUM_RTC_MODELVIEW'); + modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'CESIUM_RTC_MODELVIEW'); } uniformDecl = @@ -700,19 +702,22 @@ define([ ' gl_Position = czm_depthClampFarPlane(positionInClipCoords);\n' + '}\n'; var fs = - '#ifdef GL_EXT_frag_depth\n' + - '#extension GL_EXT_frag_depth : enable\n' + - '#endif\n' + + //'#ifdef GL_EXT_frag_depth\n' + + //'#extension GL_EXT_frag_depth : enable\n' + + //'#endif\n' + 'void main() \n' + '{ \n' + ' gl_FragColor = vec4(1.0); \n' + - ' czm_writeDepthClampedToFarPlane();\n' + + //' czm_writeDepthClampedToFarPlane();\n' + '}\n'; if (model.extensionsUsed.WEB3D_quantized_attributes) { vs = modifyShaderForQuantizedAttributes(vs, model); } + vs = ModelUtility.modifyVertexShaderForLogDepth(gltf, vs); + fs = ModelUtility.modifyFragmentShaderForLogDepth(fs); + var drawVS = modifyShader(vs, model._vertexShaderLoaded); var drawFS = modifyShader(fs, model._classificationShaderLoaded); diff --git a/Source/Scene/EllipsoidPrimitive.js b/Source/Scene/EllipsoidPrimitive.js index ae94ae608c2e..cd4ceff8f342 100644 --- a/Source/Scene/EllipsoidPrimitive.js +++ b/Source/Scene/EllipsoidPrimitive.js @@ -262,7 +262,6 @@ define([ * @exception {DeveloperError} this.material must be defined. */ EllipsoidPrimitive.prototype.update = function(frameState) { - if (!this.show || (frameState.mode !== SceneMode.SCENE3D) || (!defined(this.center)) || diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 4be3d050426c..8d33b3dc6eef 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1,4 +1,4 @@ - define([ +define([ '../Core/BoundingSphere', '../Core/Cartesian2', '../Core/Cartesian3', @@ -1850,32 +1850,6 @@ return shader; } - function modifyFsShaderForDepth(shader) { - shader = ShaderSource.replaceMain(shader, 'czm_main'); - shader += - 'varying float v_inverse_depth;\n' + - 'void main() \n' + - '{ \n' + - ' czm_main(); \n' + - ' czm_logDepth(v_inverse_depth); \n' + - '} \n'; - - return shader; - } - - function modifyVertexShaderForDepth(shader) { - shader = ShaderSource.replaceMain(shader, 'gltf_morph_main'); - shader += - 'varying float v_inverse_depth;\n' + - 'void main() \n' + - '{ \n' + - ' gltf_morph_main(); \n' + - ' v_inverse_depth = 1. / ((u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0)).w); \n' + - '} \n'; - - return shader; - } - function modifyShader(shader, programName, callback) { if (defined(callback)) { shader = callback(shader, programName); @@ -1926,8 +1900,8 @@ } var premultipliedAlpha = hasPremultipliedAlpha(model); - fs = modifyFsShaderForDepth(fs); - vs = modifyVertexShaderForDepth(vs); + fs = ModelUtility.modifyFragmentShaderForLogDepth(fs); + vs = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, vs); var finalFS = modifyShaderForColor(fs, premultipliedAlpha); if (ClippingPlaneCollection.isSupported()) { finalFS = modifyShaderForClippingPlanes(finalFS); diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 671ce0e0db14..2af8d0173f67 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -277,6 +277,44 @@ define([ }; }; + ModelUtility.modifyFragmentShaderForLogDepth = function(shader) { + shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); + shader += + 'varying float v_inverse_depth;\n' + + 'void main() \n' + + '{ \n' + + ' czm_depth_main(); \n' + + ' czm_logDepth(v_inverse_depth); \n' + + '} \n'; + + return shader; + }; + + ModelUtility.modifyVertexShaderForLogDepth = function(gltf, shader) { + var positionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'POSITION'); + var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION'); + if (!defined(modelViewProjectionName)) { + var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); + var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEW'); + if (!defined(modelViewName)) { + modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'CESIUM_RTC_MODELVIEW'); + } + modelViewProjectionName = projectionName + ' * ' + modelViewName; + } + + shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); + shader += + 'varying float v_inverse_depth;\n' + + 'void main() \n' + + '{ \n' + + ' czm_depth_main(); \n' + + //' v_inverse_depth = 1.0 / ((u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0)).w); \n' + + ' v_inverse_depth = 1.0 / (' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)).w; \n' + + '} \n'; + + return shader; + }; + function getScalarUniformFunction(value) { var that = { value : value, From 23f99c29f6ca6c24787b28e845fbc8569aca3373 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Feb 2018 18:01:26 -0500 Subject: [PATCH 019/104] Use decoded position attribute for log z. --- Source/Scene/ModelUtility.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 2af8d0173f67..41a391e2ee6e 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -292,6 +292,11 @@ define([ ModelUtility.modifyVertexShaderForLogDepth = function(gltf, shader) { var positionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'POSITION'); + var decodedPositionName = positionName.replace('a_', 'gltf_a_dec_'); + if (shader.indexOf(decodedPositionName) !== -1) { + positionName = decodedPositionName; + } + var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION'); if (!defined(modelViewProjectionName)) { var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); From 33cfca71256a070292b3f01ca5d090fb222e1f47 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Feb 2018 13:36:19 -0500 Subject: [PATCH 020/104] Fix classification model log depth. --- Source/Scene/ClassificationModel.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Source/Scene/ClassificationModel.js b/Source/Scene/ClassificationModel.js index 76dd0de637c0..484a19415ba5 100644 --- a/Source/Scene/ClassificationModel.js +++ b/Source/Scene/ClassificationModel.js @@ -715,12 +715,12 @@ define([ vs = modifyShaderForQuantizedAttributes(vs, model); } - vs = ModelUtility.modifyVertexShaderForLogDepth(gltf, vs); - fs = ModelUtility.modifyFragmentShaderForLogDepth(fs); - var drawVS = modifyShader(vs, model._vertexShaderLoaded); var drawFS = modifyShader(fs, model._classificationShaderLoaded); + drawVS = ModelUtility.modifyVertexShaderForLogDepth(gltf, drawVS); + drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); + model._shaderProgram = { vertexShaderSource : drawVS, fragmentShaderSource : drawFS, @@ -731,6 +731,9 @@ define([ var pickVS = modifyShader(vs, model._pickVertexShaderLoaded); var pickFS = modifyShader(fs, model._pickFragmentShaderLoaded); + pickVS = ModelUtility.modifyVertexShaderForLogDepth(gltf, pickVS); + pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); + model._pickShaderProgram = { vertexShaderSource : pickVS, fragmentShaderSource : pickFS, From caf032a59070a8abc499ad3d600dc6f6cccd55a6 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Feb 2018 16:23:00 -0500 Subject: [PATCH 021/104] Write globe log depth on pick. --- Source/Scene/GlobeSurfaceShaderSet.js | 2 ++ Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl | 4 ++-- Source/Shaders/ShadowVolumeFS.glsl | 2 +- Source/Shaders/ShadowVolumeVS.glsl | 3 +-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index 149215ea2096..a6f5290a49d1 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -245,9 +245,11 @@ define([ // pass through fragment shader. only depth is rendered for the globe on a pick pass var fs = + 'varying float v_inverse_depth;\n' + 'void main()\n' + '{\n' + ' gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n' + + ' czm_logDepth(v_inverse_depth);\n' + '}\n'; pickShader = this._pickShaderPrograms[flags] = ShaderProgram.fromCache({ diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl index 48b8db4416a2..6303472f2aaa 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl @@ -11,7 +11,7 @@ varying vec3 v_normalEC; varying vec3 v_tangentEC; varying vec3 v_bitangentEC; varying vec2 v_st; -v_inverse_depth = -1. / v_positionEC.z; +varying float v_inverse_depth; void main() { @@ -22,7 +22,7 @@ void main() v_tangentEC = czm_normal * tangent; // tangent in eye coordinates v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates v_st = st; - v_inverse_depth = -1. / v_positionEC.z; + v_inverse_depth = -1.0 / v_positionEC.z; gl_Position = czm_modelViewProjectionRelativeToEye * p; } diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index b6df103f05b0..49133e99af11 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -18,5 +18,5 @@ void main(void) gl_FragColor = v_color; #endif //czm_writeDepthClampedToFarPlane(); - czm_logDepth(1. / v_depth); + czm_logDepth(1.0 / v_depth); } diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index a305d810b8c2..bf795fdd1abf 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -37,8 +37,7 @@ void main() //extrudeDirection is zero for the top layer position = position + vec4(extrudeDirection * delta, 0.0); #endif - vec4 positionEC = czm_modelViewProjectionRelativeToEye * position; - gl_Position = czm_depthClampFarPlane(positionEC); + gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); #endif v_depth = gl_Position.w; } From 8d4951956ab9d98d84506be9695027fc405f2b4d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 13 Feb 2018 16:06:21 -0500 Subject: [PATCH 022/104] Fix issue with the BIM tileset. --- Source/Scene/Model.js | 8 ++++++-- Source/Scene/ModelUtility.js | 15 +++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 8d33b3dc6eef..5a117e19c976 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1900,8 +1900,6 @@ define([ } var premultipliedAlpha = hasPremultipliedAlpha(model); - fs = ModelUtility.modifyFragmentShaderForLogDepth(fs); - vs = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, vs); var finalFS = modifyShaderForColor(fs, premultipliedAlpha); if (ClippingPlaneCollection.isSupported()) { finalFS = modifyShaderForClippingPlanes(finalFS); @@ -1910,6 +1908,9 @@ define([ var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); var drawFS = modifyShader(finalFS, id, model._fragmentShaderLoaded); + drawVS = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, drawVS); + drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); + model._rendererResources.programs[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : drawVS, @@ -1926,6 +1927,9 @@ define([ pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform'); } + pickVS = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, pickVS); + pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); + model._rendererResources.pickPrograms[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : pickVS, diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 41a391e2ee6e..3e5cf536e43c 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -280,11 +280,12 @@ define([ ModelUtility.modifyFragmentShaderForLogDepth = function(shader) { shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); shader += - 'varying float v_inverse_depth;\n' + + '\n' + + 'varying float v_depth; \n' + 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' czm_logDepth(v_inverse_depth); \n' + + ' czm_logDepth(1.0 / v_depth); \n' + '} \n'; return shader; @@ -301,7 +302,9 @@ define([ if (!defined(modelViewProjectionName)) { var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEW'); - if (!defined(modelViewName)) { + if (shader.indexOf('czm_instanced_modelView ') !== -1) { + modelViewName = 'czm_instanced_modelView'; + } else if (!defined(modelViewName)) { modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'CESIUM_RTC_MODELVIEW'); } modelViewProjectionName = projectionName + ' * ' + modelViewName; @@ -309,12 +312,12 @@ define([ shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); shader += - 'varying float v_inverse_depth;\n' + + '\n' + + 'varying float v_depth;\n' + 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - //' v_inverse_depth = 1.0 / ((u_projectionMatrix * u_modelViewMatrix * vec4(a_position,1.0)).w); \n' + - ' v_inverse_depth = 1.0 / (' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)).w; \n' + + ' v_depth = (' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)).w; \n' + '} \n'; return shader; From b6db3814442e2338b3daf55991584c9077790d51 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 13 Feb 2018 16:59:46 -0500 Subject: [PATCH 023/104] Fix depth for polylines in a polyline collection. --- Source/Scene/Scene.js | 3 +-- .../Shaders/Appearances/PerInstanceColorAppearanceVS.glsl | 6 +++--- .../Appearances/PerInstanceFlatColorAppearanceVS.glsl | 6 +++--- Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl | 2 +- .../Shaders/Appearances/PolylineMaterialAppearanceVS.glsl | 6 +++--- .../Shaders/Appearances/TexturedMaterialAppearanceVS.glsl | 6 +++--- Source/Shaders/BillboardCollectionVS.glsl | 2 +- Source/Shaders/DepthPlaneFS.glsl | 4 ++-- Source/Shaders/GlobeVS.glsl | 2 +- Source/Shaders/PolylineVS.glsl | 2 +- Source/Shaders/ShadowVolumeVS.glsl | 2 +- 11 files changed, 20 insertions(+), 21 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 3ea111d877cc..6e71a9516d04 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1745,8 +1745,7 @@ define([ farChange = far / frustumCommandsList[numberOfFrustums - 1].far; } if ((near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && - ((scene.logDepthBuffer && - (isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8))) || + ((scene.logDepthBuffer && isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8)) || (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)))))))) { updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, scene.nearToFarDistance2D); createPotentiallyVisibleSet(scene); diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl index e54c2648f2dc..777a36080e6f 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl @@ -9,14 +9,14 @@ varying vec3 v_normalEC; varying vec4 v_color; varying float v_inverse_depth; -void main() +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; - v_inverse_depth = 1. / gl_Position.w; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl index 32332459a445..f840c3a02cf7 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl @@ -6,12 +6,12 @@ attribute float batchId; varying vec4 v_color; varying float v_inverse_depth; -void main() +void main() { vec4 p = czm_computePosition(); v_color = color; - + gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1. / gl_Position.w; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index 16a28d53975a..c85213647c18 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -26,5 +26,5 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; - v_inverse_depth = -1. / (czm_modelViewRelativeToEye * p).z; + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 358ebd7e69d9..448e484afe94 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -9,9 +9,9 @@ attribute vec2 st; attribute float batchId; varying float v_width; -varying vec2 v_st; +varying vec2 v_st; varying float v_polylineAngle; -varying float v_inverse_depth; +varying float v_inverse_depth; void main() { @@ -28,5 +28,5 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC; - v_inverse_depth = -1. / (czm_modelViewRelativeToEye * p).z; + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl index e9243376a0fa..3673351ba78a 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl @@ -9,14 +9,14 @@ varying vec3 v_normalEC; varying vec2 v_st; varying float v_inverse_depth; -void main() +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_inverse_depth = -1. / v_positionEC.z; v_st = st; - + gl_Position = czm_modelViewProjectionRelativeToEye * p; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 4d0176f1b084..e6bce42c8828 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -258,7 +258,7 @@ void main() vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - v_inverse_depth = -1. / positionEC.z; + v_inverse_depth = -1.0 / positionEC.z; v_textureCoordinates = textureCoordinates; #ifdef DISABLE_DEPTH_DISTANCE diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 64da577930e2..0ea5f88f9c1d 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -4,11 +4,11 @@ void main() { // TODO: make arbitrary ellipsoid czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC(); - + vec3 direction = normalize(positionEC.xyz); czm_ray ray = czm_ray(vec3(0.0), direction); - czm_logDepth(-1. / positionEC.z); + czm_logDepth(-1.0 / positionEC.z); czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); if (!czm_isEmpty(intersection)) diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index 8aec6ee6c283..d8fae1bfe816 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -157,7 +157,7 @@ void main() v_textureCoordinates = vec3(textureCoordinates, webMercatorT); - v_inverse_depth = 1. / gl_Position.w; + v_inverse_depth = 1.0 / gl_Position.w; #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL) v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz; v_positionMC = position3DWC; // position in model coordinates diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 4015531d8c92..9ee70b977c3f 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -93,7 +93,7 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; - v_inverse_depth = 1. / (czm_modelViewRelativeToEye * p).z; + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0)); v_width = width; diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index bf795fdd1abf..c731f502454e 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -39,5 +39,5 @@ void main() #endif gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); #endif - v_depth = gl_Position.w; + v_depth = gl_Position.w; } From c94e5ad61b4b34a0c56621ae1f95447db11e58d2 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 13 Feb 2018 17:26:36 -0500 Subject: [PATCH 024/104] Update moon. --- Source/Shaders/EllipsoidFS.glsl | 24 +++++++++++++++--------- Source/Shaders/EllipsoidVS.glsl | 8 +++----- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index acfddb472c02..81e94ecae151 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -2,7 +2,6 @@ uniform vec3 u_radii; uniform vec3 u_oneOverEllipsoidRadiiSquared; varying vec3 v_positionEC; -varying float v_inverse_depth; vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side) { @@ -37,17 +36,17 @@ void main() // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii // in the vertex shader. Only when it is larger than some constant, march along the ray. // Otherwise perform one intersection test which will be the common case. - + // Test if the ray intersects a sphere with the ellipsoid's maximum radius. // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test // may cause false negatives. This will discard fragments before marching the ray forward. float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5; vec3 direction = normalize(v_positionEC); vec3 ellipsoidCenter = czm_modelView[3].xyz; - + float t1 = -1.0; float t2 = -1.0; - + float b = -2.0 * dot(direction, ellipsoidCenter); float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius; @@ -56,22 +55,22 @@ void main() t1 = (-b - sqrt(discriminant)) * 0.5; t2 = (-b + sqrt(discriminant)) * 0.5; } - + if (t1 < 0.0 && t2 < 0.0) { discard; } - + float t = min(t1, t2); if (t < 0.0) { t = 0.0; } - + // March ray forward to intersection with larger sphere and find // actual intersection point with ellipsoid. czm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii); czm_ray ray = czm_ray(t * direction, direction); czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); - + if (czm_isEmpty(intersection)) { discard; @@ -86,5 +85,12 @@ void main() gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a); gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a); - czm_logDepth(v_inverse_depth); +#ifdef WRITE_DEPTH +#ifdef GL_EXT_frag_depth + t = (intersection.start != 0.0) ? intersection.start : intersection.stop; + vec3 positionEC = czm_pointAlongRay(ray, t); + vec4 positionCC = czm_projection * vec4(positionEC, 1.0); + czm_logDepth(1.0 / positionCC.w); +#endif +#endif } diff --git a/Source/Shaders/EllipsoidVS.glsl b/Source/Shaders/EllipsoidVS.glsl index 9c6252dd4221..98c1269cd66a 100644 --- a/Source/Shaders/EllipsoidVS.glsl +++ b/Source/Shaders/EllipsoidVS.glsl @@ -3,9 +3,8 @@ attribute vec3 position; uniform vec3 u_radii; varying vec3 v_positionEC; -varying float v_inverse_depth; -void main() +void main() { // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates. // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry, @@ -15,10 +14,9 @@ void main() v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates gl_Position = czm_modelViewProjection * p; // position in clip coordinates - v_inverse_depth = 1. / v_positionEC.z; - // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums - // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the + // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums + // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the // ellipsoid (does not write depth) that was rendered in the farther frustum. // // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates From 7d716e984fa7f7ebd2547593816344f063d31de4 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 15 Feb 2018 16:37:16 -0500 Subject: [PATCH 025/104] Add missing log depth to appearances, point primitives and vector tile polylines. --- .../Appearances/AllMaterialAppearanceFS.glsl | 3 +++ .../Appearances/AllMaterialAppearanceVS.glsl | 2 +- .../Appearances/BasicMaterialAppearanceFS.glsl | 9 ++++++--- .../Appearances/BasicMaterialAppearanceVS.glsl | 6 ++++-- .../EllipsoidSurfaceAppearanceFS.glsl | 17 ++++++++++------- .../EllipsoidSurfaceAppearanceVS.glsl | 6 ++++-- Source/Shaders/PointPrimitiveCollectionFS.glsl | 2 ++ Source/Shaders/PointPrimitiveCollectionVS.glsl | 3 +++ Source/Shaders/Vector3DTilePolylinesVS.glsl | 3 +++ 9 files changed, 36 insertions(+), 15 deletions(-) diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl index 672750f1f023..745f0fd43853 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl @@ -3,6 +3,7 @@ varying vec3 v_normalEC; varying vec3 v_tangentEC; varying vec3 v_bitangentEC; varying vec2 v_st; +varying float v_inverse_depth; void main() { @@ -26,4 +27,6 @@ void main() #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif + + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl index 6303472f2aaa..6cd5de782fcf 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl @@ -22,7 +22,7 @@ void main() v_tangentEC = czm_normal * tangent; // tangent in eye coordinates v_bitangentEC = czm_normal * bitangent; // bitangent in eye coordinates v_st = st; - v_inverse_depth = -1.0 / v_positionEC.z; gl_Position = czm_modelViewProjectionRelativeToEye * p; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl index 95be0556c016..b26987f45854 100644 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl @@ -1,9 +1,10 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; +varying float v_inverse_depth; void main() { - vec3 positionToEyeEC = -v_positionEC; + vec3 positionToEyeEC = -v_positionEC; vec3 normalEC = normalize(v_normalEC); #ifdef FACE_FORWARD @@ -14,10 +15,12 @@ void main() materialInput.normalEC = normalEC; materialInput.positionToEyeEC = positionToEyeEC; czm_material material = czm_getMaterial(materialInput); - -#ifdef FLAT + +#ifdef FLAT gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif + + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl index 0d496a877e7c..ea184f96fab0 100644 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl @@ -5,13 +5,15 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; +varying float v_inverse_depth; -void main() +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; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl index 7b1054b4acc9..19db3fbf7a99 100644 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl @@ -1,33 +1,36 @@ varying vec3 v_positionMC; varying vec3 v_positionEC; varying vec2 v_st; +varying float v_inverse_depth; 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; + vec3 positionToEyeEC = -v_positionEC; materialInput.positionToEyeEC = positionToEyeEC; czm_material material = czm_getMaterial(materialInput); - -#ifdef FLAT + +#ifdef FLAT gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif + + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl index 1bd13c9a5382..98d73454ce9d 100644 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl @@ -6,14 +6,16 @@ attribute float batchId; varying vec3 v_positionMC; varying vec3 v_positionEC; varying vec2 v_st; +varying float v_inverse_depth; -void main() +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; + v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/PointPrimitiveCollectionFS.glsl b/Source/Shaders/PointPrimitiveCollectionFS.glsl index 42b5703fe74d..7cb1e9c997fd 100644 --- a/Source/Shaders/PointPrimitiveCollectionFS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionFS.glsl @@ -2,6 +2,7 @@ varying vec4 v_color; varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; +varying float v_inverse_depth; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -46,4 +47,5 @@ void main() #else gl_FragColor = color; #endif + czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index 05c576606b8d..abf8f86761d3 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -11,6 +11,7 @@ varying vec4 v_color; varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; +varying float v_inverse_depth; #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -180,6 +181,8 @@ void main() v_pixelDistance = 2.0 / totalSize; gl_PointSize = totalSize; + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + #ifdef RENDER_FOR_PICK v_pickColor = pickColor; #endif diff --git a/Source/Shaders/Vector3DTilePolylinesVS.glsl b/Source/Shaders/Vector3DTilePolylinesVS.glsl index e30c2559ee63..832ab7d80428 100644 --- a/Source/Shaders/Vector3DTilePolylinesVS.glsl +++ b/Source/Shaders/Vector3DTilePolylinesVS.glsl @@ -6,6 +6,8 @@ attribute float a_batchId; uniform mat4 u_modifiedModelView; +varying float v_inverse_depth; + void main() { float expandDir = expandAndWidth.x; @@ -19,4 +21,5 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; + v_inverse_depth = 1.0 / (czm_projection * u_modifiedModelView * currentPosition).w; } From 567a110033a39ff8b6717a5e5982f03d27e57664 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 15 Feb 2018 17:01:20 -0500 Subject: [PATCH 026/104] Fix disable depth test distance. --- Source/Shaders/BillboardCollectionVS.glsl | 3 ++- Source/Shaders/PointPrimitiveCollectionVS.glsl | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index e6bce42c8828..80a2ca42f2f8 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -258,7 +258,7 @@ void main() vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - v_inverse_depth = -1.0 / positionEC.z; + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; v_textureCoordinates = textureCoordinates; #ifdef DISABLE_DEPTH_DISTANCE @@ -277,6 +277,7 @@ void main() { // Position z on the near plane. gl_Position.z = -gl_Position.w; + v_inverse_depth = 1.0 / czm_currentFrustum.x; } } #endif diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index abf8f86761d3..a8f4de6f371d 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -151,6 +151,7 @@ void main() vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); + v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; @@ -168,6 +169,7 @@ void main() { // Position z on the near plane. gl_Position.z = -gl_Position.w; + v_inverse_depth = 1.0 / czm_currentFrustum.x; } } #endif @@ -181,8 +183,6 @@ void main() v_pixelDistance = 2.0 / totalSize; gl_PointSize = totalSize; - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; - #ifdef RENDER_FOR_PICK v_pickColor = pickColor; #endif From 7c46e11acfcca8f52af1de2d55f63ce46cf615cd Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 16 Feb 2018 14:17:06 -0500 Subject: [PATCH 027/104] Minor clean up. --- Source/Scene/ClassificationPrimitive.js | 14 ++++++-------- Source/Scene/GlobeSurfaceShaderSet.js | 3 --- Source/Scene/PointCloud3DTileContent.js | 2 +- Source/Scene/Scene.js | 19 +++++++------------ Source/Scene/SceneTransforms.js | 5 ++--- 5 files changed, 16 insertions(+), 27 deletions(-) diff --git a/Source/Scene/ClassificationPrimitive.js b/Source/Scene/ClassificationPrimitive.js index 8ef08a09ffba..c4ec4affb04b 100644 --- a/Source/Scene/ClassificationPrimitive.js +++ b/Source/Scene/ClassificationPrimitive.js @@ -1,6 +1,5 @@ define([ '../Core/ColorGeometryInstanceAttribute', - '../Core/combine', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', @@ -26,7 +25,6 @@ define([ './StencilOperation' ], function( ColorGeometryInstanceAttribute, - combine, defaultValue, defined, defineProperties, @@ -594,7 +592,7 @@ define([ }); } - function createColorCommands(classificationPrimitive, colorCommands, frameState) { + function createColorCommands(classificationPrimitive, colorCommands) { var primitive = classificationPrimitive._primitive; var length = primitive._va.length * 3; colorCommands.length = length; @@ -669,7 +667,7 @@ define([ } } - function createPickCommands(classificationPrimitive, pickCommands, frameState) { + function createPickCommands(classificationPrimitive, pickCommands) { var primitive = classificationPrimitive._primitive; var pickOffsets = primitive._pickOffsets; var length = pickOffsets.length * 3; @@ -737,9 +735,9 @@ define([ } } - function createCommands(classificationPrimitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands, frameState) { - createColorCommands(classificationPrimitive, colorCommands, frameState); - createPickCommands(classificationPrimitive, pickCommands, frameState); + function createCommands(classificationPrimitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) { + createColorCommands(classificationPrimitive, colorCommands); + createPickCommands(classificationPrimitive, pickCommands); } function boundingVolumeIndex(commandIndex, length) { @@ -892,7 +890,7 @@ define([ createShaderProgram(that, frameState); }; primitiveOptions._createCommandsFunction = function(primitive, appearance, material, translucent, twoPasses, colorCommands, pickCommands) { - createCommands(that, undefined, undefined, true, false, colorCommands, pickCommands, frameState); + createCommands(that, undefined, undefined, true, false, colorCommands, pickCommands); }; if (defined(this._updateAndQueueCommandsFunction)) { diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index a6f5290a49d1..41df7c8e554e 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -117,9 +117,6 @@ define([ vs.defines.push(quantizationDefine); fs.defines.push('TEXTURE_UNITS ' + numberOfDayTextures); - if (frameState.logDepthBuffer) { - fs.defines.push('LOG_DEPTH_BUFFER'); - } if (applyBrightness) { fs.defines.push('APPLY_BRIGHTNESS'); } diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index bd0b46144e59..f312745e6909 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -1101,7 +1101,7 @@ define([ vs += ' v_color = color; \n' + ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n' + - ' v_inverse_depth = 1. / gl_Position.w; \n'; + ' v_inverse_depth = 1.0 / gl_Position.w; \n'; if (hasNormals && backFaceCulling) { vs += ' float visible = step(-normal.z, 0.0); \n' + diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 6e71a9516d04..8cef52d6c191 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -239,7 +239,6 @@ define([ */ function Scene(options) { options = defaultValue(options, defaultValue.EMPTY_OBJECT); - var canvas = options.canvas; var contextOptions = options.contextOptions; var creditContainer = options.creditContainer; @@ -262,20 +261,16 @@ define([ creditContainer.style['padding-right'] = '5px'; canvas.parentNode.appendChild(creditContainer); } - if (context.fragmentDepth) { - this.logDepthBuffer = true; - } else { - this.logDepthBuffer = false; - } if (!defined(creditViewport)) { creditViewport = canvas.parentNode; } + this._logDepthBuffer = context.fragmentDepth; + this._id = createGuid(); this._jobScheduler = new JobScheduler(); this._frameState = new FrameState(context, new CreditDisplay(creditContainer, ' • ', creditViewport), this._jobScheduler); this._frameState.scene3DOnly = defaultValue(options.scene3DOnly, false); - this._frameState.logDepthBuffer = this.logDepthBuffer; this._removeCreditContainer = !hasCreditContainer; this._creditContainer = creditContainer; @@ -773,7 +768,7 @@ define([ var far = camera.frustum.far; var numFrustums; var farToNearRatio; - if (this.logDepthBuffer) { + if (this._logDepthBuffer) { numFrustums = 1; farToNearRatio = far / near; } else { @@ -1719,13 +1714,13 @@ define([ // Exploit temporal coherence. If the frustums haven't changed much, use the frustums computed // last frame, else compute the new frustums and sort them by frustum again. var is2D = scene.mode === SceneMode.SCENE2D; - + var logDepth = scene._logDepthBuffer && !(camera.frustum instanceof OrthographicFrustum || camera.frustum instanceof OrthographicOffCenterFrustum); var farToNearRatio = scene.farToNearRatio; var numFrustums; if (!is2D) { // The multifrustum for 3D/CV is non-uniformly distributed. - if (scene.logDepthBuffer) { + if (logDepth) { numFrustums = 1; farToNearRatio = far / near; } else { @@ -1733,7 +1728,7 @@ define([ } } else { // The multifrustum for 2D is uniformly distributed. To avoid z-fighting in 2D, - // the camera i smoved to just before the frustum and the frustum depth is scaled + // the camera is moved to just before the frustum and the frustum depth is scaled // to be in [1.0, nearToFarDistance2D]. far = Math.min(far, camera.position.z + scene.nearToFarDistance2D); near = Math.min(near, far); @@ -1745,7 +1740,7 @@ define([ farChange = far / frustumCommandsList[numberOfFrustums - 1].far; } if ((near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && - ((scene.logDepthBuffer && isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8)) || + ((logDepth && isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8)) || (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)))))))) { updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, scene.nearToFarDistance2D); createPotentiallyVisibleSet(scene); diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 9191f5a84b40..cd6331aa1034 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -308,7 +308,7 @@ define([ var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; - if (scene.logDepthBuffer) { + if (scene._logDepthBuffer) { var frustumCommand = scene._frustumCommandsList[0]; var far = frustumCommand.far; var near = frustumCommand.near; @@ -343,8 +343,7 @@ define([ var w = 1.0 / worldCoords.w; Cartesian3.multiplyByScalar(worldCoords, w, worldCoords); } - result = Cartesian3.fromCartesian4(worldCoords, result); - return result; + return Cartesian3.fromCartesian4(worldCoords, result); }; return SceneTransforms; From e331d4ce4eb123f8600a8c274f97dd034e15fffe Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 16 Feb 2018 17:58:39 -0500 Subject: [PATCH 028/104] Use derived commands to enable log depth and disable when using an orthographic projection. --- Source/Renderer/ShaderSource.js | 3 - Source/Scene/Camera.js | 1 + Source/Scene/Scene.js | 69 +++++++++++++++++-- .../Shaders/Builtin/Functions/logDepth.glsl | 2 +- 4 files changed, 66 insertions(+), 9 deletions(-) diff --git a/Source/Renderer/ShaderSource.js b/Source/Renderer/ShaderSource.js index 9fe1ff4cbd6c..b1f4684b93df 100644 --- a/Source/Renderer/ShaderSource.js +++ b/Source/Renderer/ShaderSource.js @@ -228,9 +228,6 @@ define([ precision highp float;\n\ #else\n\ precision mediump float;\n\ -#endif\n\n\ -#ifdef GL_EXT_frag_depth\n\ -#extension GL_EXT_frag_depth : enable\n\ #endif\n\n'; } diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index e7e7719b898c..eca553c44f84 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -3229,6 +3229,7 @@ define([ Cartesian3.clone(camera.right, result.right); Matrix4.clone(camera._transform, result.transform); result._transformChanged = true; + result.frustum = camera.frustum; return result; }; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 8cef52d6c191..eb3bf9e680a6 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -695,6 +695,7 @@ define([ this._cameraClone = Camera.clone(camera); this._screenSpaceCameraController = new ScreenSpaceCameraController(this); this._mapMode2D = defaultValue(options.mapMode2D, MapMode2D.INFINITE_SCROLL); + this._frustumChanged = true; // Keeps track of the state of a frame. FrameState is the state across // the primitives of the scene. This state is for internally keeping track @@ -1431,9 +1432,20 @@ define([ } var derivedCommands = command.derivedCommands; - if (command.dirty && defined(derivedCommands)) { + if ((scene._frustumChanged || command.dirty) && defined(derivedCommands)) { command.dirty = false; + var frustum = scene.camera.frustum; + var useLogDepth = scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum); + if (useLogDepth) { + derivedCommands.logDepth = createLogDepthCommand(command, context, derivedCommands.logDepth); + command = derivedCommands.logDepth.logDepthCommand; + } + + if (scene.frameState.passes.pick) { + return; + } + if (shadowsEnabled && (command.receiveShadows || command.castShadows)) { derivedCommands.shadows = ShadowMap.createDerivedCommands(shadowMaps, lightShadowMaps, command, shadowsDirty, context, derivedCommands.shadows); } @@ -1540,9 +1552,7 @@ define([ command.debugOverlappingFrustums = 0; } - if (!scene.frameState.passes.pick) { - updateDerivedCommands(scene, command); - } + updateDerivedCommands(scene, command); var frustumCommandsList = scene._frustumCommandsList; var length = frustumCommandsList.length; @@ -1871,6 +1881,8 @@ define([ command.derivedCommands.shadows.receiveCommand.execute(context, passState); } else if (scene.frameState.passes.depth && defined(command.derivedCommands.depth)) { command.derivedCommands.depth.depthOnlyCommand.execute(context, passState); + } else if (scene._logDepthBuffer && defined(command.derivedCommands.logDepth)) { + command.derivedCommands.logDepth.logDepthCommand.execute(context, passState); } else { command.execute(context, passState); } @@ -3067,8 +3079,9 @@ define([ tryAndCatchError(this, time, update); this._postUpdate.raiseEvent(this, time); + this._frustumChanged = this._camera !== this._cameraClone.frustum; var cameraChanged = checkForCameraUpdates(this); - var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || (this.mode === SceneMode.MORPHING); + var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || (this.mode === SceneMode.MORPHING); if (!shouldRender && defined(this.maximumRenderTimeChange) && defined(this._lastRenderTime)) { var difference = Math.abs(JulianDate.secondsDifference(this._lastRenderTime, time)); shouldRender = shouldRender || difference > this.maximumRenderTimeChange; @@ -3370,6 +3383,52 @@ define([ return result; } + function getLogDepthShaderProgram(context, shaderProgram) { + var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); + if (!defined(shader)) { + var attributeLocations = shaderProgram._attributeLocations; + var fs = shaderProgram.fragmentShaderSource.clone(); + fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; + fs.defines.push('LOG_DEPTH'); + + var extension = + '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n'; + fs.sources.push(extension); + + shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'logDepth', { + vertexShaderSource : shaderProgram.vertexShaderSource, + fragmentShaderSource : fs, + attributeLocations : attributeLocations + }); + } + + return shader; + } + + function createLogDepthCommand(command, context, result) { + if (!defined(result)) { + result = {}; + } + + var shader; + if (defined(result.logDepthCommand)) { + shader = result.logDepthCommand.shaderProgram; + } + + result.logDepthCommand = DrawCommand.shallowClone(command, result.logDepthCommand); + + if (!defined(shader) || result.shaderProgramId !== command.shaderProgram.id) { + result.logDepthCommand.shaderProgram = getLogDepthShaderProgram(context, command.shaderProgram); + result.shaderProgramId = command.shaderProgram.id; + } else { + result.logDepthCommand.shaderProgram = shader; + } + + return result; + } + function renderTranslucentDepthForPick(scene, drawingBufferPosition) { // PERFORMANCE_IDEA: render translucent only and merge with the previous frame var context = scene._context; diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl index 9c3f6487f028..823b43b39dda 100644 --- a/Source/Shaders/Builtin/Functions/logDepth.glsl +++ b/Source/Shaders/Builtin/Functions/logDepth.glsl @@ -1,6 +1,6 @@ void czm_logDepth(float w) { -#ifdef GL_EXT_frag_depth +#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) gl_FragDepthEXT = -log(w * czm_currentFrustum.x) / log( czm_currentFrustum.y / czm_currentFrustum.x); #endif } From 75bd3ba44819ee8efec39d539d4fbabcb55dd283 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 19 Feb 2018 15:53:10 -0500 Subject: [PATCH 029/104] Fix picking. --- Source/Renderer/ShaderSource.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Renderer/ShaderSource.js b/Source/Renderer/ShaderSource.js index b1f4684b93df..f70c7d8c250a 100644 --- a/Source/Renderer/ShaderSource.js +++ b/Source/Renderer/ShaderSource.js @@ -313,7 +313,7 @@ define([ return new ShaderSource({ sources : this.sources, defines : this.defines, - pickColorQuantifier : this.pickColorQualifier, + pickColorQualifier : this.pickColorQualifier, includeBuiltIns : this.includeBuiltIns }); }; From d681755611f2fc47f28e33db61a9ec0583a4abe3 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 20 Feb 2018 15:27:34 -0500 Subject: [PATCH 030/104] Fix shadow mapping and use log depth with OIT. --- Source/Scene/Camera.js | 2 +- Source/Scene/OIT.js | 6 ++++++ Source/Scene/Scene.js | 21 +++++++++++++++++---- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index eca553c44f84..50b48178c9d3 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -3229,7 +3229,7 @@ define([ Cartesian3.clone(camera.right, result.right); Matrix4.clone(camera._transform, result.transform); result._transformChanged = true; - result.frustum = camera.frustum; + result.frustum = camera.frustum.clone(); return result; }; diff --git a/Source/Scene/OIT.js b/Source/Scene/OIT.js index c7a38d68700d..c7e0746c363b 100644 --- a/Source/Scene/OIT.js +++ b/Source/Scene/OIT.js @@ -554,12 +554,14 @@ define([ for (j = 0; j < length; ++j) { command = commands[j]; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } @@ -568,12 +570,14 @@ define([ for (j = 0; j < length; ++j) { command = commands[j]; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } @@ -599,12 +603,14 @@ define([ for (var j = 0; j < length; ++j) { command = commands[j]; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index eb3bf9e680a6..cadb5afbdb4a 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1437,9 +1437,12 @@ define([ var frustum = scene.camera.frustum; var useLogDepth = scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum); + var logDepthCommand; + var logDepthDerivedCommands; if (useLogDepth) { derivedCommands.logDepth = createLogDepthCommand(command, context, derivedCommands.logDepth); - command = derivedCommands.logDepth.logDepthCommand; + logDepthCommand = derivedCommands.logDepth.logDepthCommand; + logDepthDerivedCommands = logDepthCommand.derivedCommands; } if (scene.frameState.passes.pick) { @@ -1448,13 +1451,21 @@ define([ if (shadowsEnabled && (command.receiveShadows || command.castShadows)) { derivedCommands.shadows = ShadowMap.createDerivedCommands(shadowMaps, lightShadowMaps, command, shadowsDirty, context, derivedCommands.shadows); + if (useLogDepth) { + logDepthDerivedCommands.shadows = ShadowMap.createDerivedCommands(shadowMaps, lightShadowMaps, logDepthCommand, shadowsDirty, context, logDepthDerivedCommands.shadows); + } + } + + if (useLogDepth) { + command = logDepthCommand; + derivedCommands = logDepthDerivedCommands; } var oit = scene._oit; if (command.pass === Pass.TRANSLUCENT && defined(oit) && oit.isSupported()) { if (lightShadowsEnabled && command.receiveShadows) { derivedCommands.oit = defined(derivedCommands.oit) ? derivedCommands.oit : {}; - derivedCommands.oit.shadows = oit.createDerivedCommands(command.derivedCommands.shadows.receiveCommand, context, derivedCommands.oit.shadows); + derivedCommands.oit.shadows = oit.createDerivedCommands(derivedCommands.shadows.receiveCommand, context, derivedCommands.oit.shadows); } else { derivedCommands.oit = oit.createDerivedCommands(command, context, derivedCommands.oit); } @@ -1872,6 +1883,10 @@ define([ var shadowsEnabled = scene.frameState.shadowHints.shadowsEnabled; var lightShadowsEnabled = shadowsEnabled && (scene.frameState.shadowHints.lightShadowMaps.length > 0); + if (scene._logDepthBuffer && defined(command.derivedCommands.logDepth)) { + command = command.derivedCommands.logDepth.logDepthCommand; + } + if (scene.debugShowCommands || scene.debugShowFrustums) { executeDebugCommand(command, scene, passState); } else if (lightShadowsEnabled && command.receiveShadows && defined(command.derivedCommands.shadows)) { @@ -1881,8 +1896,6 @@ define([ command.derivedCommands.shadows.receiveCommand.execute(context, passState); } else if (scene.frameState.passes.depth && defined(command.derivedCommands.depth)) { command.derivedCommands.depth.depthOnlyCommand.execute(context, passState); - } else if (scene._logDepthBuffer && defined(command.derivedCommands.logDepth)) { - command.derivedCommands.logDepth.logDepthCommand.execute(context, passState); } else { command.execute(context, passState); } From 6e07e898dd6f10ac97c2520ec237ab7494c718f9 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 20 Feb 2018 16:22:30 -0500 Subject: [PATCH 031/104] Fix depth plane. --- Source/Scene/DepthPlane.js | 42 +++++++++++++++++++++++++++++--------- Source/Scene/Scene.js | 3 ++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/Source/Scene/DepthPlane.js b/Source/Scene/DepthPlane.js index 1a4e59a89917..c366e487e141 100644 --- a/Source/Scene/DepthPlane.js +++ b/Source/Scene/DepthPlane.js @@ -12,6 +12,7 @@ define([ '../Renderer/Pass', '../Renderer/RenderState', '../Renderer/ShaderProgram', + '../Renderer/ShaderSource', '../Renderer/VertexArray', '../Shaders/DepthPlaneFS', '../Shaders/DepthPlaneVS', @@ -30,6 +31,7 @@ define([ Pass, RenderState, ShaderProgram, + ShaderSource, VertexArray, DepthPlaneFS, DepthPlaneVS, @@ -45,6 +47,7 @@ define([ this._va = undefined; this._command = undefined; this._mode = undefined; + this._useLogDepth = false; } var depthQuadScratch = FeatureDetection.supportsTypedArrays() ? new Float32Array(12) : []; @@ -100,7 +103,7 @@ define([ return depthQuadScratch; } - DepthPlane.prototype.update = function(frameState) { + DepthPlane.prototype.update = function(frameState, useLogDepth) { this._mode = frameState.mode; if (frameState.mode !== SceneMode.SCENE3D) { return; @@ -125,22 +128,41 @@ define([ } }); - this._sp = ShaderProgram.fromCache({ + this._command = new DrawCommand({ + renderState : this._rs, + boundingVolume : new BoundingSphere(Cartesian3.ZERO, ellipsoid.maximumRadius), + pass : Pass.OPAQUE, + owner : this + }); + } + + if (!defined(this._sp) || this._useLogDepth !== useLogDepth) { + this._useLogDepth = useLogDepth; + + var fs = new ShaderSource({ + sources : [DepthPlaneFS] + }); + if (useLogDepth) { + var extension = + '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n\n'; + + fs.sources.push(extension); + fs.defines.push('LOG_DEPTH'); + } + + this._sp = ShaderProgram.replaceCache({ + shaderProgram : this._sp, context : context, vertexShaderSource : DepthPlaneVS, - fragmentShaderSource : DepthPlaneFS, + fragmentShaderSource : fs, attributeLocations : { position : 0 } }); - this._command = new DrawCommand({ - renderState : this._rs, - shaderProgram : this._sp, - boundingVolume : new BoundingSphere(Cartesian3.ZERO, ellipsoid.maximumRadius), - pass : Pass.OPAQUE, - owner : this - }); + this._command.shaderProgram = this._sp; } // update depth plane diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index cadb5afbdb4a..f9e63fae933b 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -2700,10 +2700,11 @@ define([ var clearGlobeDepth = environmentState.clearGlobeDepth = defined(globe) && (!globe.depthTestAgainstTerrain || scene.mode === SceneMode.SCENE2D); var useDepthPlane = environmentState.useDepthPlane = clearGlobeDepth && scene.mode === SceneMode.SCENE3D; if (useDepthPlane) { + var useLogDepth = scene._logDepthBuffer && !(scene.camera.frustum instanceof OrthographicFrustum || scene.camera.frustum instanceof OrthographicOffCenterFrustum); // Update the depth plane that is rendered in 3D when the primitives are // not depth tested against terrain so primitives on the backface // of the globe are not picked. - scene._depthPlane.update(frameState); + scene._depthPlane.update(frameState, useLogDepth); } var occluder = (frameState.mode === SceneMode.SCENE3D) ? frameState.occluder: undefined; From 90a089bde012cbeb20d191f700a23f66ca5b8248 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 22 Feb 2018 15:50:52 -0500 Subject: [PATCH 032/104] Re-add multi-frustum for log depth. --- Source/Scene/Scene.js | 21 ++++++++++++--------- Source/Scene/SkyAtmosphere.js | 3 ++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index f9e63fae933b..d349b49a788b 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -767,15 +767,15 @@ define([ // initial guess at frustums. var near = camera.frustum.near; var far = camera.frustum.far; - var numFrustums; var farToNearRatio; + if (this._logDepthBuffer) { - numFrustums = 1; - farToNearRatio = far / near; + farToNearRatio = this.farToNearRatio * this.farToNearRatio; } else { - numFrustums = Math.ceil(Math.log(far / near) / Math.log(this.farToNearRatio)); farToNearRatio = this.farToNearRatio; } + + var numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); updateFrustums(near, far, farToNearRatio, numFrustums, this._frustumCommandsList, false, undefined); // give frameState, camera, and screen space camera controller initial state before rendering @@ -783,7 +783,7 @@ define([ this.initializeFrame(); } - var OPAQUE_FRUSTUM_NEAR_OFFSET = 0.9999; + var OPAQUE_FRUSTUM_NEAR_OFFSET = 0.9; function updateGlobeListeners(scene, globe) { for (var i = 0; i < scene._removeGlobeCallbacks.length; ++i) { @@ -1742,11 +1742,9 @@ define([ if (!is2D) { // The multifrustum for 3D/CV is non-uniformly distributed. if (logDepth) { - numFrustums = 1; - farToNearRatio = far / near; - } else { - numFrustums = Math.ceil(Math.log(far / near) / Math.log(scene.farToNearRatio)); + farToNearRatio *= farToNearRatio; } + numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); } else { // The multifrustum for 2D is uniformly distributed. To avoid z-fighting in 2D, // the camera is moved to just before the frustum and the frustum depth is scaled @@ -3094,6 +3092,11 @@ define([ this._postUpdate.raiseEvent(this, time); this._frustumChanged = this._camera !== this._cameraClone.frustum; + if (this._frustumChanged && this._logDepthBuffer && !(this._camera.frustum instanceof OrthographicFrustum || this._camera.frustum instanceof OrthographicOffCenterFrustum)) { + this._camera.frustum.near = 0.1; + this._camera.frustum.far = 10000000000.0; + } + var cameraChanged = checkForCameraUpdates(this); var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || (this.mode === SceneMode.MORPHING); if (!shouldRender && defined(this.maximumRenderTimeChange) && defined(this._lastRenderTime)) { diff --git a/Source/Scene/SkyAtmosphere.js b/Source/Scene/SkyAtmosphere.js index e37242aaddb1..f2f88087fcfb 100644 --- a/Source/Scene/SkyAtmosphere.js +++ b/Source/Scene/SkyAtmosphere.js @@ -199,7 +199,8 @@ define([ enabled : true, face : CullFace.FRONT }, - blending : BlendingState.ALPHA_BLEND + blending : BlendingState.ALPHA_BLEND, + depthMask : false }); var vs = new ShaderSource({ From 462d229b626b476402e17366985b5dde3d9cb92c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 22 Feb 2018 16:46:15 -0500 Subject: [PATCH 033/104] Clamp shadow volume depth to far plane only when not using log depth. --- Source/Scene/ClassificationModel.js | 8 ++++---- Source/Scene/Scene.js | 2 +- .../Shaders/Appearances/PerInstanceColorAppearanceFS.glsl | 6 +++--- Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl | 4 ++++ .../Builtin/Functions/writeDepthClampedToFarPlane.glsl | 5 +++-- Source/Shaders/ShadowVolumeFS.glsl | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Source/Scene/ClassificationModel.js b/Source/Scene/ClassificationModel.js index 484a19415ba5..eaafe4b0aa5c 100644 --- a/Source/Scene/ClassificationModel.js +++ b/Source/Scene/ClassificationModel.js @@ -702,13 +702,13 @@ define([ ' gl_Position = czm_depthClampFarPlane(positionInClipCoords);\n' + '}\n'; var fs = - //'#ifdef GL_EXT_frag_depth\n' + - //'#extension GL_EXT_frag_depth : enable\n' + - //'#endif\n' + + '#ifdef GL_EXT_frag_depth\n' + + '#extension GL_EXT_frag_depth : enable\n' + + '#endif\n' + 'void main() \n' + '{ \n' + ' gl_FragColor = vec4(1.0); \n' + - //' czm_writeDepthClampedToFarPlane();\n' + + ' czm_writeDepthClampedToFarPlane();\n' + '}\n'; if (model.extensionsUsed.WEB3D_quantized_attributes) { diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index d349b49a788b..fef73d84dccd 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -3093,7 +3093,7 @@ define([ this._frustumChanged = this._camera !== this._cameraClone.frustum; if (this._frustumChanged && this._logDepthBuffer && !(this._camera.frustum instanceof OrthographicFrustum || this._camera.frustum instanceof OrthographicOffCenterFrustum)) { - this._camera.frustum.near = 0.1; + this._camera.frustum.near = 1.0; this._camera.frustum.far = 10000000000.0; } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl index abf0c39b733f..c2541082af81 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl @@ -6,19 +6,19 @@ varying float v_inverse_depth; 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_getDefaultMaterial(materialInput); material.diffuse = v_color.rgb; material.alpha = v_color.a; - + gl_FragColor = czm_phong(normalize(positionToEyeEC), material); czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl b/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl index 76940c00575f..bec295024033 100644 --- a/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl +++ b/Source/Shaders/Builtin/Functions/depthClampFarPlane.glsl @@ -1,5 +1,7 @@ // emulated noperspective +#ifndef LOG_DEPTH varying float v_WindowZ; +#endif /** * Clamps a vertex to the far plane. @@ -17,7 +19,9 @@ varying float v_WindowZ; */ vec4 czm_depthClampFarPlane(vec4 coords) { +#ifndef LOG_DEPTH v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w; coords.z = min(coords.z, coords.w); +#endif return coords; } diff --git a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl b/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl index 3425bc387622..bf8cf3209b45 100644 --- a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl +++ b/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.glsl @@ -1,6 +1,7 @@ // emulated noperspective +#ifndef LOG_DEPTH varying float v_WindowZ; - +#endif /** * Clamps a vertex to the far plane by writing the fragments depth. *

@@ -18,7 +19,7 @@ varying float v_WindowZ; */ void czm_writeDepthClampedToFarPlane() { -#ifdef GL_EXT_frag_depth +#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH) gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0); #endif } diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index 49133e99af11..de10419ba5e2 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -17,6 +17,6 @@ void main(void) #else gl_FragColor = v_color; #endif - //czm_writeDepthClampedToFarPlane(); + czm_writeDepthClampedToFarPlane(); czm_logDepth(1.0 / v_depth); } From 27447fc15652d42e0fff715776832769329a0908 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 23 Feb 2018 15:25:49 -0500 Subject: [PATCH 034/104] Generate log depth shaders with derived commands when possible. --- Source/Scene/GlobeSurfaceShaderSet.js | 2 - Source/Scene/PointCloud3DTileContent.js | 10 +--- Source/Scene/Scene.js | 56 +++++++++++++++++-- Source/Scene/SceneTransforms.js | 15 ++--- .../Appearances/AllMaterialAppearanceFS.glsl | 3 - .../Appearances/AllMaterialAppearanceVS.glsl | 2 - .../BasicMaterialAppearanceFS.glsl | 3 - .../BasicMaterialAppearanceVS.glsl | 2 - .../EllipsoidSurfaceAppearanceFS.glsl | 3 - .../EllipsoidSurfaceAppearanceVS.glsl | 2 - .../PerInstanceColorAppearanceFS.glsl | 2 - .../PerInstanceColorAppearanceVS.glsl | 2 - .../PerInstanceFlatColorAppearanceFS.glsl | 2 - .../PerInstanceFlatColorAppearanceVS.glsl | 2 - .../PolylineColorAppearanceVS.glsl | 10 +++- .../PolylineMaterialAppearanceVS.glsl | 10 +++- .../TexturedMaterialAppearanceFS.glsl | 9 +-- .../TexturedMaterialAppearanceVS.glsl | 2 - Source/Shaders/BillboardCollectionFS.glsl | 10 +++- Source/Shaders/BillboardCollectionVS.glsl | 14 ++++- Source/Shaders/DepthPlaneFS.glsl | 6 +- Source/Shaders/GlobeFS.glsl | 2 - Source/Shaders/GlobeVS.glsl | 2 - .../Shaders/PointPrimitiveCollectionFS.glsl | 10 +++- .../Shaders/PointPrimitiveCollectionVS.glsl | 14 ++++- Source/Shaders/PolylineFS.glsl | 9 ++- Source/Shaders/PolylineVS.glsl | 10 +++- Source/Shaders/ShadowVolumeFS.glsl | 3 - Source/Shaders/ShadowVolumeVS.glsl | 2 - Source/Shaders/Vector3DTilePolylinesVS.glsl | 9 ++- 30 files changed, 144 insertions(+), 84 deletions(-) diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index 41df7c8e554e..c46fe650b6bf 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -242,11 +242,9 @@ define([ // pass through fragment shader. only depth is rendered for the globe on a pick pass var fs = - 'varying float v_inverse_depth;\n' + 'void main()\n' + '{\n' + ' gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n' + - ' czm_logDepth(v_inverse_depth);\n' + '}\n'; pickShader = this._pickShaderPrograms[flags] = ShaderProgram.fromCache({ diff --git a/Source/Scene/PointCloud3DTileContent.js b/Source/Scene/PointCloud3DTileContent.js index 4657894f7930..4941ee3240af 100644 --- a/Source/Scene/PointCloud3DTileContent.js +++ b/Source/Scene/PointCloud3DTileContent.js @@ -970,7 +970,6 @@ define([ var vs = 'attribute vec3 a_position; \n' + 'varying vec4 v_color; \n' + - 'varying float v_inverse_depth; \n' + 'uniform vec4 u_pointSizeAndTilesetTimeAndGeometricErrorAndDepthMultiplier; \n' + 'uniform vec4 u_constantColor; \n' + 'uniform vec4 u_highlightColor; \n'; @@ -1102,8 +1101,7 @@ define([ } vs += ' v_color = color; \n' + - ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n' + - ' v_inverse_depth = 1.0 / gl_Position.w; \n'; + ' gl_Position = czm_modelViewProjection * vec4(position, 1.0); \n'; if (hasNormals && backFaceCulling) { vs += ' float visible = step(-normal.z, 0.0); \n' + @@ -1118,8 +1116,7 @@ define([ vs += '} \n'; - var fs = 'varying vec4 v_color; \n' + - 'varying float v_inverse_depth; \n'; + var fs = 'varying vec4 v_color; \n'; if (hasClippedContent) { fs += 'uniform int u_clippingPlanesLength;' + @@ -1143,8 +1140,7 @@ define([ ' } \n'; } - fs += ' czm_logDepth(v_inverse_depth); \n' + - '} \n'; + fs += '} \n'; var drawVS = vs; var drawFS = fs; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index fef73d84dccd..3a82fe05bd91 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -3400,22 +3400,70 @@ define([ return result; } + var logDepthRegex = /\s+czm_logDepth\(/; + function getLogDepthShaderProgram(context, shaderProgram) { var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); if (!defined(shader)) { var attributeLocations = shaderProgram._attributeLocations; + var vs = shaderProgram.vertexShaderSource.clone(); var fs = shaderProgram.fragmentShaderSource.clone(); + + vs.defines = defined(vs.defines) ? vs.defines.slice(0) : []; + vs.defines.push('LOG_DEPTH'); fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; fs.defines.push('LOG_DEPTH'); - var extension = + var logSource = '#ifdef GL_EXT_frag_depth \n' + '#extension GL_EXT_frag_depth : enable \n' + - '#endif \n'; - fs.sources.push(extension); + '#endif \n\n'; + + var writesLogDepth = false; + var sources = fs.sources; + var length = sources.length; + var i; + for (i = 0; i < length; ++i) { + if (logDepthRegex.test(sources[i])) { + writesLogDepth = true; + break; + } + } + + if (!writesLogDepth) { + for (i = 0; i < length; i++) { + sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); + } + + logSource += + 'varying float v_depth; \n' + + 'void main() \n' + + '{ \n' + + ' czm_log_depth_main(); \n' + + ' czm_logDepth(1.0 / v_depth); \n' + + '} \n'; + + var vertexSources = vs.sources; + length = vertexSources.length; + for (i = 0; i < length; ++i) { + vertexSources[i] = ShaderSource.replaceMain(vertexSources[i], 'czm_log_depth_main'); + } + + var logMain = + '\n\n' + + 'varying float v_depth; \n' + + 'void main() \n' + + '{ \n' + + ' czm_log_depth_main(); \n' + + ' v_depth = gl_Position.w; \n' + + '} \n'; + vertexSources.push(logMain); + } + + sources.push(logSource); shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'logDepth', { - vertexShaderSource : shaderProgram.vertexShaderSource, + vertexShaderSource : vs, fragmentShaderSource : fs, attributeLocations : attributeLocations }); diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index cd6331aa1034..df6135436bce 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -4,7 +4,6 @@ define([ '../Core/Cartesian3', '../Core/Cartesian4', '../Core/Cartographic', - '../Core/Color', '../Core/defined', '../Core/DeveloperError', '../Core/Math', @@ -19,7 +18,6 @@ define([ Cartesian3, Cartesian4, Cartographic, - Color, defined, DeveloperError, CesiumMath, @@ -308,16 +306,15 @@ define([ var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; - if (scene._logDepthBuffer) { + if (scene._logDepthBuffer && !(scene.camera.frustum instanceof OrthographicFrustum || scene.camera.frustum instanceof OrthographicOffCenterFrustum)) { var frustumCommand = scene._frustumCommandsList[0]; var far = frustumCommand.far; var near = frustumCommand.near; - /* transforming logarithmic depth of form - * log(z / near) / log( far / near); - * to perspective form - * (far - far * near / z) / (far - near) - */ - depth = far * (1 - 1 /(Math.exp(depth * Math.log(far / near)))) / (far - near); + // transforming logarithmic depth of form + // log(z / near) / log( far / near); + // to perspective form + // (far - far * near / z) / (far - near) + depth = far * (1.0 - 1.0 /(Math.exp(depth * Math.log(far / near)))) / (far - near); } ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl index 745f0fd43853..672750f1f023 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceFS.glsl @@ -3,7 +3,6 @@ varying vec3 v_normalEC; varying vec3 v_tangentEC; varying vec3 v_bitangentEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { @@ -27,6 +26,4 @@ void main() #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif - - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl index 6cd5de782fcf..33d9d300a304 100644 --- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.glsl @@ -11,7 +11,6 @@ varying vec3 v_normalEC; varying vec3 v_tangentEC; varying vec3 v_bitangentEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { @@ -24,5 +23,4 @@ void main() v_st = st; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl index b26987f45854..aaf9e7efcdc5 100644 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.glsl @@ -1,6 +1,5 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; -varying float v_inverse_depth; void main() { @@ -21,6 +20,4 @@ void main() #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif - - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl index ea184f96fab0..d17aa17009b9 100644 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.glsl @@ -5,7 +5,6 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; -varying float v_inverse_depth; void main() { @@ -15,5 +14,4 @@ void main() v_normalEC = czm_normal * normal; // normal in eye coordinates gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl index 19db3fbf7a99..095ea101bd20 100644 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.glsl @@ -1,7 +1,6 @@ varying vec3 v_positionMC; varying vec3 v_positionEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { @@ -31,6 +30,4 @@ void main() #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif - - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl index 98d73454ce9d..6f4e11300a7c 100644 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.glsl @@ -6,7 +6,6 @@ attribute float batchId; varying vec3 v_positionMC; varying vec3 v_positionEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { @@ -17,5 +16,4 @@ void main() v_st = st; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl index c2541082af81..c2709e847ea9 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.glsl @@ -1,7 +1,6 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; -varying float v_inverse_depth; void main() { @@ -20,5 +19,4 @@ void main() material.alpha = v_color.a; gl_FragColor = czm_phong(normalize(positionToEyeEC), material); - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl index 777a36080e6f..5d0711b68949 100644 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.glsl @@ -7,7 +7,6 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec4 v_color; -varying float v_inverse_depth; void main() { @@ -18,5 +17,4 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl index 08eebb3b5e98..3649a0883f23 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl @@ -1,8 +1,6 @@ varying vec4 v_color; -varying float v_inverse_depth; void main() { gl_FragColor = v_color; - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl index f840c3a02cf7..f38d44046db4 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.glsl @@ -4,7 +4,6 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; -varying float v_inverse_depth; void main() { @@ -13,5 +12,4 @@ void main() v_color = color; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index c85213647c18..d36b19a1462b 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -9,7 +9,10 @@ attribute vec4 color; attribute float batchId; varying vec4 v_color; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif void main() { @@ -26,5 +29,8 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; +#endif } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 448e484afe94..068c5cb52467 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -11,7 +11,10 @@ attribute float batchId; varying float v_width; varying vec2 v_st; varying float v_polylineAngle; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif void main() { @@ -28,5 +31,8 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC; - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; +#endif } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl index 9e2c4a91c157..92dcf9dbc37d 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.glsl @@ -1,11 +1,10 @@ varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { - vec3 positionToEyeEC = -v_positionEC; + vec3 positionToEyeEC = -v_positionEC; vec3 normalEC = normalize(v_normalEC); #ifdef FACE_FORWARD @@ -17,12 +16,10 @@ void main() materialInput.positionToEyeEC = positionToEyeEC; materialInput.st = v_st; czm_material material = czm_getMaterial(materialInput); - -#ifdef FLAT + +#ifdef FLAT gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); #else gl_FragColor = czm_phong(normalize(positionToEyeEC), material); #endif - - czm_logDepth(v_inverse_depth); } diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl index 3673351ba78a..7ceb6e0b5239 100644 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.glsl @@ -7,7 +7,6 @@ attribute float batchId; varying vec3 v_positionEC; varying vec3 v_normalEC; varying vec2 v_st; -varying float v_inverse_depth; void main() { @@ -18,5 +17,4 @@ void main() v_st = st; gl_Position = czm_modelViewProjectionRelativeToEye * p; - v_inverse_depth = 1.0 / gl_Position.w; } diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index 414516c3e132..d947d70cd1a6 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -5,7 +5,10 @@ uniform vec4 u_highlightColor; #endif varying vec2 v_textureCoordinates; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -54,5 +57,8 @@ void main() #else gl_FragColor = color; #endif - czm_logDepth(v_inverse_depth); + +#ifdef LOG_DEPTH + czm_logDepth(v_inverseDepth); +#endif } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 80a2ca42f2f8..8224c2463911 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -15,7 +15,10 @@ attribute float a_batchId; #endif varying vec2 v_textureCoordinates; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -258,9 +261,12 @@ void main() vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; v_textureCoordinates = textureCoordinates; +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; +#endif + #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) @@ -277,7 +283,9 @@ void main() { // Position z on the near plane. gl_Position.z = -gl_Position.w; - v_inverse_depth = 1.0 / czm_currentFrustum.x; +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / czm_currentFrustum.x; +#endif } } #endif diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 0ea5f88f9c1d..daa2df27f3b5 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -8,8 +8,6 @@ void main() vec3 direction = normalize(positionEC.xyz); czm_ray ray = czm_ray(vec3(0.0), direction); - czm_logDepth(-1.0 / positionEC.z); - czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid); if (!czm_isEmpty(intersection)) { @@ -19,4 +17,8 @@ void main() { discard; } + +#ifdef LOG_DEPTH + czm_logDepth(-1.0 / positionEC.z); +#endif } diff --git a/Source/Shaders/GlobeFS.glsl b/Source/Shaders/GlobeFS.glsl index b9d68f808cd9..f41b6eb34b31 100644 --- a/Source/Shaders/GlobeFS.glsl +++ b/Source/Shaders/GlobeFS.glsl @@ -63,7 +63,6 @@ uniform float u_minimumBrightness; varying vec3 v_positionMC; varying vec3 v_positionEC; -varying float v_inverse_depth; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; varying vec3 v_normalEC; @@ -253,7 +252,6 @@ void main() #else gl_FragColor = finalColor; #endif - czm_logDepth(v_inverse_depth); } #ifdef SHOW_REFLECTIVE_OCEAN diff --git a/Source/Shaders/GlobeVS.glsl b/Source/Shaders/GlobeVS.glsl index d8fae1bfe816..30c2afc014a6 100644 --- a/Source/Shaders/GlobeVS.glsl +++ b/Source/Shaders/GlobeVS.glsl @@ -17,7 +17,6 @@ uniform vec2 u_southMercatorYAndOneOverHeight; varying vec3 v_positionMC; varying vec3 v_positionEC; -varying float v_inverse_depth; varying vec3 v_textureCoordinates; varying vec3 v_normalMC; @@ -157,7 +156,6 @@ void main() v_textureCoordinates = vec3(textureCoordinates, webMercatorT); - v_inverse_depth = 1.0 / gl_Position.w; #if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL) v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz; v_positionMC = position3DWC; // position in model coordinates diff --git a/Source/Shaders/PointPrimitiveCollectionFS.glsl b/Source/Shaders/PointPrimitiveCollectionFS.glsl index 7cb1e9c997fd..fff4abe1f55b 100644 --- a/Source/Shaders/PointPrimitiveCollectionFS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionFS.glsl @@ -2,7 +2,10 @@ varying vec4 v_color; varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -47,5 +50,8 @@ void main() #else gl_FragColor = color; #endif - czm_logDepth(v_inverse_depth); + +#ifdef LOG_DEPTH + czm_logDepth(v_inverseDepth); +#endif } diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index a8f4de6f371d..bdfe2f2a911c 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -11,7 +11,10 @@ varying vec4 v_color; varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; @@ -151,7 +154,10 @@ void main() vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; +#endif #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; @@ -169,7 +175,9 @@ void main() { // Position z on the near plane. gl_Position.z = -gl_Position.w; - v_inverse_depth = 1.0 / czm_currentFrustum.x; +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / czm_currentFrustum.x; +#endif } } #endif diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index 141b02910a40..eb0d6910b8ae 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -3,7 +3,10 @@ uniform vec4 u_highlightColor; #endif varying vec2 v_st; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif void main() { @@ -15,8 +18,10 @@ void main() czm_material material = czm_getMaterial(materialInput); gl_FragColor = vec4(material.diffuse + material.emission, material.alpha); - czm_logDepth(v_inverse_depth); #ifdef VECTOR_TILE gl_FragColor *= u_highlightColor; #endif +#ifdef LOG_DEPTH + czm_logDepth(v_inverseDepth); +#endif } diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 9ee70b977c3f..4d71c38a3965 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -16,7 +16,10 @@ varying vec2 v_st; varying float v_width; varying vec4 czm_pickColor; varying float v_polylineAngle; -varying float v_inverse_depth; + +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif void main() { @@ -93,9 +96,12 @@ void main() vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle); gl_Position = czm_viewportOrthographic * positionWC * show; - v_inverse_depth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0)); v_width = width; czm_pickColor = pickColor; + +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; +#endif } diff --git a/Source/Shaders/ShadowVolumeFS.glsl b/Source/Shaders/ShadowVolumeFS.glsl index de10419ba5e2..51e951b07b99 100644 --- a/Source/Shaders/ShadowVolumeFS.glsl +++ b/Source/Shaders/ShadowVolumeFS.glsl @@ -8,8 +8,6 @@ uniform vec4 u_highlightColor; varying vec4 v_color; #endif -varying float v_depth; - void main(void) { #ifdef VECTOR_TILE @@ -18,5 +16,4 @@ void main(void) gl_FragColor = v_color; #endif czm_writeDepthClampedToFarPlane(); - czm_logDepth(1.0 / v_depth); } diff --git a/Source/Shaders/ShadowVolumeVS.glsl b/Source/Shaders/ShadowVolumeVS.glsl index c731f502454e..9d3c550b3cd5 100644 --- a/Source/Shaders/ShadowVolumeVS.glsl +++ b/Source/Shaders/ShadowVolumeVS.glsl @@ -19,7 +19,6 @@ uniform float u_globeMinimumAltitude; #ifndef VECTOR_TILE varying vec4 v_color; #endif -varying float v_depth; void main() { @@ -39,5 +38,4 @@ void main() #endif gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position); #endif - v_depth = gl_Position.w; } diff --git a/Source/Shaders/Vector3DTilePolylinesVS.glsl b/Source/Shaders/Vector3DTilePolylinesVS.glsl index 832ab7d80428..81d43e0a1d8e 100644 --- a/Source/Shaders/Vector3DTilePolylinesVS.glsl +++ b/Source/Shaders/Vector3DTilePolylinesVS.glsl @@ -6,7 +6,9 @@ attribute float a_batchId; uniform mat4 u_modifiedModelView; -varying float v_inverse_depth; +#ifdef LOG_DEPTH +varying float v_inverseDepth; +#endif void main() { @@ -21,5 +23,8 @@ void main() float angle; vec4 positionWC = getPolylineWindowCoordinatesEC(p, prev, next, expandDir, width, usePrev, angle); gl_Position = czm_viewportOrthographic * positionWC; - v_inverse_depth = 1.0 / (czm_projection * u_modifiedModelView * currentPosition).w; + +#ifdef LOG_DEPTH + v_inverseDepth = 1.0 / (czm_projection * u_modifiedModelView * currentPosition).w; +#endif } From 0a628dbfa535b06b51c8af97a33c7ffae858aec3 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 23 Feb 2018 19:54:41 -0500 Subject: [PATCH 035/104] Make log z functions for vertex and fragment shader. Change log z function. --- Source/Scene/DepthPlane.js | 6 ++- Source/Scene/EllipsoidPrimitive.js | 41 +++++++++++++++++-- Source/Scene/ModelUtility.js | 6 +-- Source/Scene/Scene.js | 9 ++-- .../PolylineColorAppearanceVS.glsl | 6 +-- .../PolylineMaterialAppearanceVS.glsl | 6 +-- Source/Shaders/BillboardCollectionFS.glsl | 8 +--- Source/Shaders/BillboardCollectionVS.glsl | 8 +--- .../Shaders/Builtin/Functions/logDepth.glsl | 6 --- .../Shaders/Builtin/Functions/vertexLogZ.glsl | 17 ++++++++ .../Shaders/Builtin/Functions/writeLogZ.glsl | 18 ++++++++ Source/Shaders/DepthPlaneFS.glsl | 5 +-- Source/Shaders/DepthPlaneVS.glsl | 2 + Source/Shaders/EllipsoidFS.glsl | 2 +- .../Shaders/PointPrimitiveCollectionFS.glsl | 8 +--- .../Shaders/PointPrimitiveCollectionVS.glsl | 8 +--- Source/Shaders/PolylineFS.glsl | 9 +--- Source/Shaders/PolylineVS.glsl | 6 +-- Source/Shaders/Vector3DTilePolylinesVS.glsl | 6 +-- 19 files changed, 100 insertions(+), 77 deletions(-) delete mode 100644 Source/Shaders/Builtin/Functions/logDepth.glsl create mode 100644 Source/Shaders/Builtin/Functions/vertexLogZ.glsl create mode 100644 Source/Shaders/Builtin/Functions/writeLogZ.glsl diff --git a/Source/Scene/DepthPlane.js b/Source/Scene/DepthPlane.js index c366e487e141..d8ea2af635eb 100644 --- a/Source/Scene/DepthPlane.js +++ b/Source/Scene/DepthPlane.js @@ -139,6 +139,9 @@ define([ if (!defined(this._sp) || this._useLogDepth !== useLogDepth) { this._useLogDepth = useLogDepth; + var vs = new ShaderSource({ + sources : [DepthPlaneVS] + }); var fs = new ShaderSource({ sources : [DepthPlaneFS] }); @@ -150,12 +153,13 @@ define([ fs.sources.push(extension); fs.defines.push('LOG_DEPTH'); + vs.defines.push('LOG_DEPTH'); } this._sp = ShaderProgram.replaceCache({ shaderProgram : this._sp, context : context, - vertexShaderSource : DepthPlaneVS, + vertexShaderSource : vs, fragmentShaderSource : fs, attributeLocations : { position : 0 diff --git a/Source/Scene/EllipsoidPrimitive.js b/Source/Scene/EllipsoidPrimitive.js index cd4ceff8f342..a21756b310c0 100644 --- a/Source/Scene/EllipsoidPrimitive.js +++ b/Source/Scene/EllipsoidPrimitive.js @@ -8,6 +8,8 @@ define([ '../Core/destroyObject', '../Core/DeveloperError', '../Core/Matrix4', + '../Core/OrthographicFrustum', + '../Core/OrthographicOffCenterFrustum', '../Core/VertexFormat', '../Renderer/BufferUsage', '../Renderer/DrawCommand', @@ -32,6 +34,8 @@ define([ destroyObject, DeveloperError, Matrix4, + OrthographicFrustum, + OrthographicOffCenterFrustum, VertexFormat, BufferUsage, DrawCommand, @@ -196,6 +200,8 @@ define([ */ this._depthTestEnabled = defaultValue(options.depthTestEnabled, true); + this._useLogDepth = false; + this._sp = undefined; this._rs = undefined; this._va = undefined; @@ -251,6 +257,11 @@ define([ return vertexArray; } + var logDepthExtension = + '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n\n'; + /** * Called when {@link Viewer} or {@link CesiumWidget} render the scene to * get the draw commands needed to render this primitive. @@ -343,11 +354,20 @@ define([ var lightingChanged = this.onlySunLighting !== this._onlySunLighting; this._onlySunLighting = this.onlySunLighting; + var frustum = frameState.camera.frustum; + var useLogDepth = context.fragmentDepth && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum); + var useLogDepthChanged = this._useLogDepth !== useLogDepth; + this._useLogDepth = useLogDepth; + var colorCommand = this._colorCommand; + var vs; var fs; // Recompile shader when material, lighting, or translucency changes - if (materialChanged || lightingChanged || translucencyChanged) { + if (materialChanged || lightingChanged || translucencyChanged || useLogDepthChanged) { + vs = new ShaderSource({ + sources : [EllipsoidVS] + }); fs = new ShaderSource({ sources : [this.material.shaderSource, EllipsoidFS] }); @@ -357,11 +377,16 @@ define([ if (!translucent && context.fragmentDepth) { fs.defines.push('WRITE_DEPTH'); } + if (this._useLogDepth) { + vs.defines.push('LOG_DEPTH'); + fs.defines.push('LOG_DEPTH'); + fs.sources.push(logDepthExtension); + } this._sp = ShaderProgram.replaceCache({ context : context, shaderProgram : this._sp, - vertexShaderSource : EllipsoidVS, + vertexShaderSource : vs, fragmentShaderSource : fs, attributeLocations : attributeLocations }); @@ -398,7 +423,10 @@ define([ } // Recompile shader when material changes - if (materialChanged || lightingChanged || !defined(this._pickSP)) { + if (materialChanged || lightingChanged || !defined(this._pickSP) || useLogDepthChanged) { + vs = new ShaderSource({ + sources : [EllipsoidVS] + }); fs = new ShaderSource({ sources : [this.material.shaderSource, EllipsoidFS], pickColorQualifier : 'uniform' @@ -409,11 +437,16 @@ define([ if (!translucent && context.fragmentDepth) { fs.defines.push('WRITE_DEPTH'); } + if (this._useLogDepth) { + vs.defines.push('LOG_DEPTH'); + fs.defines.push('LOG_DEPTH'); + fs.sources.push(logDepthExtension); + } this._pickSP = ShaderProgram.replaceCache({ context : context, shaderProgram : this._pickSP, - vertexShaderSource : EllipsoidVS, + vertexShaderSource : vs, fragmentShaderSource : fs, attributeLocations : attributeLocations }); diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 3e5cf536e43c..33a6b70ec548 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -281,11 +281,10 @@ define([ shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); shader += '\n' + - 'varying float v_depth; \n' + 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' czm_logDepth(1.0 / v_depth); \n' + + ' czm_writeLogZ(); \n' + '} \n'; return shader; @@ -313,11 +312,10 @@ define([ shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); shader += '\n' + - 'varying float v_depth;\n' + 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' v_depth = (' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)).w; \n' + + ' czm_vertexLogZ(' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)); \n' + '} \n'; return shader; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 3a82fe05bd91..f41b3587f2bf 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -3400,7 +3400,7 @@ define([ return result; } - var logDepthRegex = /\s+czm_logDepth\(/; + var logDepthRegex = /\s+czm_writeLogZ\(/; function getLogDepthShaderProgram(context, shaderProgram) { var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); @@ -3436,11 +3436,11 @@ define([ } logSource += - 'varying float v_depth; \n' + + '\n' + 'void main() \n' + '{ \n' + ' czm_log_depth_main(); \n' + - ' czm_logDepth(1.0 / v_depth); \n' + + ' czm_writeLogZ(); \n' + '} \n'; var vertexSources = vs.sources; @@ -3451,11 +3451,10 @@ define([ var logMain = '\n\n' + - 'varying float v_depth; \n' + 'void main() \n' + '{ \n' + ' czm_log_depth_main(); \n' + - ' v_depth = gl_Position.w; \n' + + ' czm_vertexLogZ(); \n' + '} \n'; vertexSources.push(logMain); } diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index d36b19a1462b..9515f6cbcc45 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -10,10 +10,6 @@ attribute float batchId; varying vec4 v_color; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - void main() { float expandDir = expandAndWidth.x; @@ -31,6 +27,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index 068c5cb52467..e91e4067fb70 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -12,10 +12,6 @@ varying float v_width; varying vec2 v_st; varying float v_polylineAngle; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - void main() { float expandDir = expandAndWidth.x; @@ -33,6 +29,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index d947d70cd1a6..8d6488b06121 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -6,10 +6,6 @@ uniform vec4 u_highlightColor; varying vec2 v_textureCoordinates; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; #else @@ -58,7 +54,5 @@ void main() gl_FragColor = color; #endif -#ifdef LOG_DEPTH - czm_logDepth(v_inverseDepth); -#endif + czm_writeLogZ(); } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 8224c2463911..0b0d469b582c 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -16,10 +16,6 @@ attribute float a_batchId; varying vec2 v_textureCoordinates; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; #else @@ -264,7 +260,7 @@ void main() v_textureCoordinates = textureCoordinates; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); #endif #ifdef DISABLE_DEPTH_DISTANCE @@ -284,7 +280,7 @@ void main() // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / czm_currentFrustum.x; + czm_vertexLogZ(vec4(czm_currentFrustum.x)); #endif } } diff --git a/Source/Shaders/Builtin/Functions/logDepth.glsl b/Source/Shaders/Builtin/Functions/logDepth.glsl deleted file mode 100644 index 823b43b39dda..000000000000 --- a/Source/Shaders/Builtin/Functions/logDepth.glsl +++ /dev/null @@ -1,6 +0,0 @@ -void czm_logDepth(float w) -{ -#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) - gl_FragDepthEXT = -log(w * czm_currentFrustum.x) / log( czm_currentFrustum.y / czm_currentFrustum.x); -#endif -} diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl new file mode 100644 index 000000000000..a750550fdaab --- /dev/null +++ b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl @@ -0,0 +1,17 @@ +#ifdef LOG_DEPTH +varying float v_logZ; +#endif + +void czm_vertexLogZ() +{ +#ifdef LOG_DEPTH + v_logZ = 1.0 + gl_Position.w; +#endif +} + +void czm_vertexLogZ(vec4 clipCoords) +{ +#ifdef LOG_DEPTH + v_logZ = 1.0 + clipCoords.w; +#endif +} diff --git a/Source/Shaders/Builtin/Functions/writeLogZ.glsl b/Source/Shaders/Builtin/Functions/writeLogZ.glsl new file mode 100644 index 000000000000..31e1451c80e5 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/writeLogZ.glsl @@ -0,0 +1,18 @@ +#ifdef LOG_DEPTH +varying float v_logZ; +#endif + +void czm_writeLogZ(float logZ) +{ +#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) + float Fcoef = 2.0 / log2(czm_currentFrustum.y + 1.0); + float Fcoef_half = 0.5 * Fcoef; + gl_FragDepthEXT = log2(logZ) * Fcoef_half; +#endif +} + +void czm_writeLogZ() { +#ifdef LOG_DEPTH + czm_writeLogZ(v_logZ); +#endif +} diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index daa2df27f3b5..53ebb87a9fc3 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -1,4 +1,5 @@ varying vec4 positionEC; +varying float flogz; void main() { @@ -18,7 +19,5 @@ void main() discard; } -#ifdef LOG_DEPTH - czm_logDepth(-1.0 / positionEC.z); -#endif + czm_writeLogZ(); } diff --git a/Source/Shaders/DepthPlaneVS.glsl b/Source/Shaders/DepthPlaneVS.glsl index e28f3767ba67..6ddb496a5309 100644 --- a/Source/Shaders/DepthPlaneVS.glsl +++ b/Source/Shaders/DepthPlaneVS.glsl @@ -6,4 +6,6 @@ void main() { positionEC = czm_modelView * position; gl_Position = czm_projection * positionEC; + + czm_vertexLogZ(); } diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index 81e94ecae151..a0da7525f0b8 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -90,7 +90,7 @@ void main() t = (intersection.start != 0.0) ? intersection.start : intersection.stop; vec3 positionEC = czm_pointAlongRay(ray, t); vec4 positionCC = czm_projection * vec4(positionEC, 1.0); - czm_logDepth(1.0 / positionCC.w); + czm_writeLogZ(1.0 + positionCC.w); #endif #endif } diff --git a/Source/Shaders/PointPrimitiveCollectionFS.glsl b/Source/Shaders/PointPrimitiveCollectionFS.glsl index fff4abe1f55b..47847cdd280b 100644 --- a/Source/Shaders/PointPrimitiveCollectionFS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionFS.glsl @@ -3,10 +3,6 @@ varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; #endif @@ -51,7 +47,5 @@ void main() gl_FragColor = color; #endif -#ifdef LOG_DEPTH - czm_logDepth(v_inverseDepth); -#endif + czm_writeLogZ(); } diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index bdfe2f2a911c..d4d7cba61c6e 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -12,10 +12,6 @@ varying vec4 v_outlineColor; varying float v_innerPercent; varying float v_pixelDistance; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - #ifdef RENDER_FOR_PICK varying vec4 v_pickColor; #endif @@ -156,7 +152,7 @@ void main() gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); #endif #ifdef DISABLE_DEPTH_DISTANCE @@ -176,7 +172,7 @@ void main() // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / czm_currentFrustum.x; + czm_vertexLogZ(vec4(czm_currentFrustum.x)); #endif } } diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index eb0d6910b8ae..e634f43efe03 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -4,10 +4,6 @@ uniform vec4 u_highlightColor; varying vec2 v_st; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - void main() { czm_materialInput materialInput; @@ -21,7 +17,6 @@ void main() #ifdef VECTOR_TILE gl_FragColor *= u_highlightColor; #endif -#ifdef LOG_DEPTH - czm_logDepth(v_inverseDepth); -#endif + + czm_writeLogZ(); } diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 4d71c38a3965..9f7d5bbe2325 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -17,10 +17,6 @@ varying float v_width; varying vec4 czm_pickColor; varying float v_polylineAngle; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - void main() { float texCoord = texCoordExpandAndBatchIndex.x; @@ -102,6 +98,6 @@ void main() czm_pickColor = pickColor; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_modelViewProjectionRelativeToEye * p).w; + czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/Vector3DTilePolylinesVS.glsl b/Source/Shaders/Vector3DTilePolylinesVS.glsl index 81d43e0a1d8e..111bafdc1f7f 100644 --- a/Source/Shaders/Vector3DTilePolylinesVS.glsl +++ b/Source/Shaders/Vector3DTilePolylinesVS.glsl @@ -6,10 +6,6 @@ attribute float a_batchId; uniform mat4 u_modifiedModelView; -#ifdef LOG_DEPTH -varying float v_inverseDepth; -#endif - void main() { float expandDir = expandAndWidth.x; @@ -25,6 +21,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - v_inverseDepth = 1.0 / (czm_projection * u_modifiedModelView * currentPosition).w; + czm_vertexLogZ(czm_projection * u_modifiedModelView * currentPosition); #endif } From afcc7eda927c73ca723075f20d33f55123c7ddee Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 26 Feb 2018 17:12:40 -0500 Subject: [PATCH 036/104] Fix depth picking. Simplify frag depth write. Update gl_Position.z. --- Source/Scene/SceneTransforms.js | 24 ++++++++++--------- .../Shaders/Builtin/Functions/vertexLogZ.glsl | 8 +++++++ .../Shaders/Builtin/Functions/writeLogZ.glsl | 4 +--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index df6135436bce..9eb26db93d5d 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -302,20 +302,23 @@ define([ var context = scene.context; var uniformState = context.uniformState; - var viewport = scene._passState.viewport; - var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); - ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; - ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; + var currentFrustum = uniformState.currentFrustum; + var near = currentFrustum.x; + var far = currentFrustum.y; + if (scene._logDepthBuffer && !(scene.camera.frustum instanceof OrthographicFrustum || scene.camera.frustum instanceof OrthographicOffCenterFrustum)) { - var frustumCommand = scene._frustumCommandsList[0]; - var far = frustumCommand.far; - var near = frustumCommand.near; // transforming logarithmic depth of form - // log(z / near) / log( far / near); + // log2(z + 1) / log2( far + 1); // to perspective form // (far - far * near / z) / (far - near) - depth = far * (1.0 - 1.0 /(Math.exp(depth * Math.log(far / near)))) / (far - near); + depth = Math.pow(2.0, depth * Math.log2(far + 1.0)) - 1.0; + depth = far * (1.0 - 1.0 / depth) / (far - near); } + + var viewport = scene._passState.viewport; + var ndc = Cartesian4.clone(Cartesian4.UNIT_W, scratchNDC); + ndc.x = (drawingBufferPosition.x - viewport.x) / viewport.width * 2.0 - 1.0; + ndc.y = (drawingBufferPosition.y - viewport.y) / viewport.height * 2.0 - 1.0; ndc.z = (depth * 2.0) - 1.0; ndc.w = 1.0; @@ -325,11 +328,10 @@ define([ if (defined(frustum._offCenterFrustum)) { frustum = frustum._offCenterFrustum; } - var currentFrustum = uniformState.currentFrustum; worldCoords = scratchWorldCoords; worldCoords.x = (ndc.x * (frustum.right - frustum.left) + frustum.left + frustum.right) * 0.5; worldCoords.y = (ndc.y * (frustum.top - frustum.bottom) + frustum.bottom + frustum.top) * 0.5; - worldCoords.z = (ndc.z * (currentFrustum.x - currentFrustum.y) - currentFrustum.x - currentFrustum.y) * 0.5; + worldCoords.z = (ndc.z * (near - far) - near - far) * 0.5; worldCoords.w = 1.0; worldCoords = Matrix4.multiplyByVector(uniformState.inverseView, worldCoords, worldCoords); diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl index a750550fdaab..f5e2134712da 100644 --- a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl @@ -2,10 +2,17 @@ varying float v_logZ; #endif +void czm_updateZ() { + float Fcoef = 2.0 / log2(czm_currentFrustum.y + 1.0); + gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * Fcoef - 1.0; + gl_Position.z *= gl_Position.w; +} + void czm_vertexLogZ() { #ifdef LOG_DEPTH v_logZ = 1.0 + gl_Position.w; + czm_updateZ(); #endif } @@ -13,5 +20,6 @@ void czm_vertexLogZ(vec4 clipCoords) { #ifdef LOG_DEPTH v_logZ = 1.0 + clipCoords.w; + czm_updateZ(); #endif } diff --git a/Source/Shaders/Builtin/Functions/writeLogZ.glsl b/Source/Shaders/Builtin/Functions/writeLogZ.glsl index 31e1451c80e5..626ea2386898 100644 --- a/Source/Shaders/Builtin/Functions/writeLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/writeLogZ.glsl @@ -5,9 +5,7 @@ varying float v_logZ; void czm_writeLogZ(float logZ) { #if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) - float Fcoef = 2.0 / log2(czm_currentFrustum.y + 1.0); - float Fcoef_half = 0.5 * Fcoef; - gl_FragDepthEXT = log2(logZ) * Fcoef_half; + gl_FragDepthEXT = log2(logZ) / log2(czm_currentFrustum.y + 1.0); #endif } From 9cea9953b36bec27aad533228aba5d608fae407a Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 2 Mar 2018 14:58:18 -0500 Subject: [PATCH 037/104] Fix log depth issue with the skip LOD optimization. --- Source/Renderer/AutomaticUniforms.js | 14 +++++++++++ Source/Renderer/UniformState.js | 14 +++++++++++ Source/Scene/Cesium3DTileBatchTable.js | 24 +++++++++++++++++-- .../Shaders/Builtin/Functions/vertexLogZ.glsl | 3 +-- .../Shaders/Builtin/Functions/writeLogZ.glsl | 5 ++-- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/Source/Renderer/AutomaticUniforms.js b/Source/Renderer/AutomaticUniforms.js index 3e218afd105e..d1ce1890eb39 100644 --- a/Source/Renderer/AutomaticUniforms.js +++ b/Source/Renderer/AutomaticUniforms.js @@ -1121,6 +1121,20 @@ define([ } }), + /** + * The log of the current frustums far plane. Used for computing the log depth. + * + * @alias czm_logFarDistance + * @glslUniform + */ + czm_logFarDistance : new AutomaticUniform({ + size : 1, + datatype : WebGLConstants.FLOAT, + getValue : function(uniformState) { + return uniformState.logFarDistance; + } + }), + /** * An automatic GLSL uniform representing the sun position in world coordinates. * diff --git a/Source/Renderer/UniformState.js b/Source/Renderer/UniformState.js index 89c87d7a88b8..f2d8c5875054 100644 --- a/Source/Renderer/UniformState.js +++ b/Source/Renderer/UniformState.js @@ -61,6 +61,7 @@ define([ this._entireFrustum = new Cartesian2(); this._currentFrustum = new Cartesian2(); this._frustumPlanes = new Cartesian4(); + this._logFarDistance = undefined; this._frameState = undefined; this._temeToPseudoFixed = Matrix3.clone(Matrix4.IDENTITY); @@ -641,6 +642,17 @@ define([ } }, + /** + * The log of the current frustum's far distance. Used to compute the log depth. + * @memberof UniformState.prototype + * @type {Number} + */ + logFarDistance : { + get : function() { + return this._logFarDistance; + } + }, + /** * The the height (x) and the height squared (y) * in meters of the camera above the 2D world plane. This uniform is only valid @@ -975,6 +987,8 @@ define([ this._currentFrustum.x = frustum.near; this._currentFrustum.y = frustum.far; + this._logFarDistance = 2.0 / Math.log2(frustum.far + 1.0); + if (defined(frustum._offCenterFrustum)) { frustum = frustum._offCenterFrustum; } diff --git a/Source/Scene/Cesium3DTileBatchTable.js b/Source/Scene/Cesium3DTileBatchTable.js index 2273cdd0f2d0..732b4d7b74c1 100644 --- a/Source/Scene/Cesium3DTileBatchTable.js +++ b/Source/Scene/Cesium3DTileBatchTable.js @@ -1347,7 +1347,7 @@ define([ if (bivariateVisibilityTest) { if (command.pass !== Pass.TRANSLUCENT && !finalResolution) { if (!defined(derivedCommands.zback)) { - derivedCommands.zback = deriveZBackfaceCommand(derivedCommands.originalCommand); + derivedCommands.zback = deriveZBackfaceCommand(frameState.context, derivedCommands.originalCommand); } tileset._backfaceCommands.push(derivedCommands.zback); } @@ -1432,7 +1432,24 @@ define([ return derivedCommand; } - function deriveZBackfaceCommand(command) { + function getDisableLogDepthFragmentShaderProgram(context, shaderProgram) { + var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'zBackfaceLogDepth'); + if (!defined(shader)) { + var fs = shaderProgram.fragmentShaderSource.clone(); + fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; + fs.defines.push('DISABLE_LOG_DEPTH_FRAGMENT_WRITE'); + + shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'zBackfaceLogDepth', { + vertexShaderSource : shaderProgram.vertexShaderSource, + fragmentShaderSource : fs, + attributeLocations : shaderProgram._attributeLocations + }); + } + + return shader; + } + + function deriveZBackfaceCommand(context, command) { // Write just backface depth of unresolved tiles so resolved stenciled tiles do not appear in front var derivedCommand = DrawCommand.shallowClone(command); var rs = clone(derivedCommand.renderState, true); @@ -1455,6 +1472,9 @@ define([ derivedCommand.renderState = RenderState.fromCache(rs); derivedCommand.castShadows = false; derivedCommand.receiveShadows = false; + // Disable the depth writes in the fragment shader. The back face commands were causing the higher resolution + // tiles to disappear. + derivedCommand.shaderProgram = getDisableLogDepthFragmentShaderProgram(context, command.shaderProgram); return derivedCommand; } diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl index f5e2134712da..3f4f517a5e0b 100644 --- a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl @@ -3,8 +3,7 @@ varying float v_logZ; #endif void czm_updateZ() { - float Fcoef = 2.0 / log2(czm_currentFrustum.y + 1.0); - gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * Fcoef - 1.0; + gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; gl_Position.z *= gl_Position.w; } diff --git a/Source/Shaders/Builtin/Functions/writeLogZ.glsl b/Source/Shaders/Builtin/Functions/writeLogZ.glsl index 626ea2386898..6cd5da08d3b6 100644 --- a/Source/Shaders/Builtin/Functions/writeLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/writeLogZ.glsl @@ -4,8 +4,9 @@ varying float v_logZ; void czm_writeLogZ(float logZ) { -#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) - gl_FragDepthEXT = log2(logZ) / log2(czm_currentFrustum.y + 1.0); +#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE) + float halfLogFarDistance = czm_logFarDistance * 0.5; + gl_FragDepthEXT = log2(logZ) * halfLogFarDistance; #endif } From 122ca66fa1789149c856b2bf3370ffa34abf6c0b Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 2 Mar 2018 18:17:42 -0500 Subject: [PATCH 038/104] Fix shadows. --- Source/Scene/ShadowMapShader.js | 19 ++++++++++++++++--- .../Shaders/Builtin/Functions/vertexLogZ.glsl | 4 ++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Source/Scene/ShadowMapShader.js b/Source/Scene/ShadowMapShader.js index 8f2142b28226..d130f340ffc8 100644 --- a/Source/Scene/ShadowMapShader.js +++ b/Source/Scene/ShadowMapShader.js @@ -202,17 +202,30 @@ define([ fsSource += 'uniform sampler2D shadowMap_texture; \n'; } + var returnPositionEC; + if (hasPositionVarying) { + returnPositionEC = ' return vec4(' + positionVaryingName + ', 1.0); \n'; + } else { + returnPositionEC = + '#ifndef LOG_DEPTH \n' + + ' return czm_windowToEyeCoordinates(gl_FragCoord); \n' + + '#else \n' + + ' return czm_windowToEyeCoordinates(v_glPosition); \n' + + '#endif \n'; + } + fsSource += 'uniform mat4 shadowMap_matrix; \n' + 'uniform vec3 shadowMap_lightDirectionEC; \n' + 'uniform vec4 shadowMap_lightPositionEC; \n' + 'uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \n' + 'uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n' + + '#ifdef LOG_DEPTH \n' + + 'varying vec4 v_glPosition; \n' + + '#endif \n' + 'vec4 getPositionEC() \n' + '{ \n' + - (hasPositionVarying ? - ' return vec4(' + positionVaryingName + ', 1.0); \n' : - ' return czm_windowToEyeCoordinates(gl_FragCoord); \n') + + returnPositionEC + '} \n' + 'vec3 getNormalEC() \n' + '{ \n' + diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl index 3f4f517a5e0b..c074887512ef 100644 --- a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl @@ -1,10 +1,14 @@ #ifdef LOG_DEPTH varying float v_logZ; +varying vec4 v_glPosition; #endif void czm_updateZ() { +#ifdef LOG_DEPTH + v_glPosition = gl_Position; gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; gl_Position.z *= gl_Position.w; +#endif } void czm_vertexLogZ() From bcc2dc4606d29e6b37c9e0022f06fc7e8b1bf32e Mon Sep 17 00:00:00 2001 From: Sean Lilley Date: Mon, 5 Mar 2018 15:08:03 -0500 Subject: [PATCH 039/104] Updated CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 207c8089940e..4310f054c67e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ Change Log ##### Fixes :wrench: * Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302) +* Added option `logDepthBuffer` to `Viewer`. With this option the globe is typically rendered in a single frustum using logarithmic depth. This helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) ### 1.43 - 2018-03-01 @@ -215,7 +216,6 @@ _This is an npm-only release to fix an issue with using Cesium in Node.js.__ * Fixed loading of binary glTFs containing CRN or KTX textures. [#5753](https://github.com/AnalyticalGraphicsInc/cesium/pull/5753) * Fixed specular computation for certain models using the `KHR_materials_common` extension. [#5773](https://github.com/AnalyticalGraphicsInc/cesium/pull/5773) * Fixed a picking bug in the `3D Tiles Interactivity` Sandcastle demo. [#5703](https://github.com/AnalyticalGraphicsInc/cesium/issues/5703) -* Added option "logDepthBuffer" to Cesium.Viewer. With this option globe is rendered in 1 frustum with logarithmic depth. It helps to avoid artifacts on the connection of two frustums. * Updated knockout from 3.4.0 to 3.4.2 [#5703](https://github.com/AnalyticalGraphicsInc/cesium/pull/5829) ### 1.36 - 2017-08-01 From 4ee738d05f7feef8b4c503a715ebb2d4f80e88d9 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 5 Mar 2018 15:52:37 -0500 Subject: [PATCH 040/104] Fix 2D. Update some tests. --- Source/Scene/Scene.js | 4 +- Specs/DataSources/EntityClusterSpec.js | 54 +++++++++++++------------- Specs/DataSources/KmlDataSourceSpec.js | 9 +++-- Specs/Scene/MultifrustumSpec.js | 11 +++++- 4 files changed, 46 insertions(+), 32 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index f0b92fdeced8..53e502f86bfc 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1443,6 +1443,8 @@ define([ derivedCommands.logDepth = createLogDepthCommand(command, context, derivedCommands.logDepth); logDepthCommand = derivedCommands.logDepth.logDepthCommand; logDepthDerivedCommands = logDepthCommand.derivedCommands; + } else { + derivedCommands.logDepth = undefined; } if (scene.frameState.passes.pick) { @@ -3097,7 +3099,7 @@ define([ tryAndCatchError(this, time, update); this._postUpdate.raiseEvent(this, time); - this._frustumChanged = this._camera !== this._cameraClone.frustum; + this._frustumChanged = this._camera.frustum !== this._cameraClone.frustum; if (this._frustumChanged && this._logDepthBuffer && !(this._camera.frustum instanceof OrthographicFrustum || this._camera.frustum instanceof OrthographicOffCenterFrustum)) { this._camera.frustum.near = 1.0; this._camera.frustum.far = 10000000000.0; diff --git a/Specs/DataSources/EntityClusterSpec.js b/Specs/DataSources/EntityClusterSpec.js index e73142fb4b39..5cdad2ac453e 100644 --- a/Specs/DataSources/EntityClusterSpec.js +++ b/Specs/DataSources/EntityClusterSpec.js @@ -31,6 +31,8 @@ defineSuite([ var scene; var cluster; + var depth = 0.1; + beforeAll(function() { scene = createScene({ canvas : createCanvas(10, 10) @@ -151,13 +153,13 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -184,13 +186,13 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); cluster.enabled = true; cluster.update(scene.frameState); @@ -207,13 +209,13 @@ defineSuite([ var label = cluster.getLabel(entity); label.id = entity; label.text = 'a'; - label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); label = cluster.getLabel(entity); label.id = entity; label.text = 'b'; - label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -240,13 +242,13 @@ defineSuite([ var label = cluster.getLabel(entity); label.id = entity; label.text = 'a'; - label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); label = cluster.getLabel(entity); label.id = entity; label.text = 'b'; - label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + label.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); cluster.enabled = true; cluster.update(scene.frameState); @@ -263,13 +265,13 @@ defineSuite([ var point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -296,13 +298,13 @@ defineSuite([ var point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); cluster.enabled = true; cluster.update(scene.frameState); @@ -319,13 +321,13 @@ defineSuite([ var point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -428,13 +430,13 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -461,25 +463,25 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, 0), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, 0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0, scene.canvas.clientHeight), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0, scene.canvas.clientHeight), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.5); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -506,13 +508,13 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.9); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.9); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -550,13 +552,13 @@ defineSuite([ var point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.9); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); entity = new Entity(); point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.9); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); var frameState = scene.frameState; cluster.update(frameState); @@ -587,7 +589,7 @@ defineSuite([ var entityCollection = dataSource.entities; entityCollection.add({ - position : SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), 0.9), + position : SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth), billboard : { image : createBillboardImage() }, @@ -597,7 +599,7 @@ defineSuite([ }); entityCollection.add({ - position : SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), 0.9), + position : SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth), billboard : { image : createBillboardImage() }, diff --git a/Specs/DataSources/KmlDataSourceSpec.js b/Specs/DataSources/KmlDataSourceSpec.js index 909c02ab113f..6e2b3562d879 100644 --- a/Specs/DataSources/KmlDataSourceSpec.js +++ b/Specs/DataSources/KmlDataSourceSpec.js @@ -19,6 +19,7 @@ defineSuite([ 'Core/JulianDate', 'Core/Math', 'Core/NearFarScalar', + 'Core/PerspectiveFrustum', 'Core/Rectangle', 'Core/RequestErrorEvent', 'Core/Resource', @@ -57,6 +58,7 @@ defineSuite([ JulianDate, CesiumMath, NearFarScalar, + PerspectiveFrustum, Rectangle, RequestErrorEvent, Resource, @@ -136,10 +138,7 @@ defineSuite([ upWC : new Cartesian3(0.0, 1.0, 0.0), pitch : 0.0, heading : 0.0, - frustum : { - aspectRatio : 1.0, - fov : CesiumMath.PI_OVER_FOUR - }, + frustum : new PerspectiveFrustum(), computeViewRectangle : function() { return Rectangle.MAX_VALUE; }, @@ -152,6 +151,8 @@ defineSuite([ clientHeight : 512 } }; + options.camera.frustum.fov = CesiumMath.PI_OVER_FOUR; + options.camera.frustum.aspectRatio = 1.0; beforeEach(function() { // Reset camera - x value will change during onStop tests diff --git a/Specs/Scene/MultifrustumSpec.js b/Specs/Scene/MultifrustumSpec.js index 9bf98da5430e..8c7da972d5f7 100644 --- a/Specs/Scene/MultifrustumSpec.js +++ b/Specs/Scene/MultifrustumSpec.js @@ -205,7 +205,16 @@ defineSuite([ expect(billboardCall).toBeDefined(); expect(billboardCall.args.length).toEqual(2); - expect(billboardCall.object.shaderProgram.fragmentShaderSource.sources[1]).toContain('czm_Debug_main'); + + var found = false; + var sources = billboardCall.object.shaderProgram.fragmentShaderSource.sources; + for (var j = 0; j < sources.length; ++j) { + if (sources[i].indexOf('czm_Debug_main') !== -1) { + found = true; + break; + } + } + expect(found).toBe(true); }); function createPrimitive(bounded, closestFrustum) { From 0d90d985b0179003b2ea66ead964331d8e07b69a Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 6 Mar 2018 15:24:42 -0500 Subject: [PATCH 041/104] Fix a few tests and updates from review. --- Source/Core/Math.js | 12 ++++++++++++ Source/Renderer/AutomaticUniforms.js | 2 ++ Source/Renderer/UniformState.js | 2 +- Source/Scene/Camera.js | 11 ++++++++--- Source/Scene/Expression.js | 2 +- Source/Scene/SceneTransforms.js | 2 +- Source/Shaders/DepthPlaneFS.glsl | 1 - Specs/Scene/ClassificationPrimitiveSpec.js | 6 ++++-- 8 files changed, 29 insertions(+), 9 deletions(-) diff --git a/Source/Core/Math.js b/Source/Core/Math.js index 04631d636090..a498300c9ac6 100644 --- a/Source/Core/Math.js +++ b/Source/Core/Math.js @@ -849,6 +849,18 @@ define([ */ CesiumMath.cbrt = defined(Math.cbrt) ? Math.cbrt : cbrt; + function log2(x) { + return Math.log(x) * Math.LOG2E; + } + + /** + * Finds the base 2 logarithm of a number. + * + * @param {Number} number The number. + * @returns {Number} The result. + */ + CesiumMath.log2 = defined(Math.log2) ? Math.log2 : log2; + /** * @private */ diff --git a/Source/Renderer/AutomaticUniforms.js b/Source/Renderer/AutomaticUniforms.js index d1ce1890eb39..82c0b64ad9fd 100644 --- a/Source/Renderer/AutomaticUniforms.js +++ b/Source/Renderer/AutomaticUniforms.js @@ -1126,6 +1126,8 @@ define([ * * @alias czm_logFarDistance * @glslUniform + * + * @private */ czm_logFarDistance : new AutomaticUniform({ size : 1, diff --git a/Source/Renderer/UniformState.js b/Source/Renderer/UniformState.js index f2d8c5875054..27ced786160e 100644 --- a/Source/Renderer/UniformState.js +++ b/Source/Renderer/UniformState.js @@ -987,7 +987,7 @@ define([ this._currentFrustum.x = frustum.near; this._currentFrustum.y = frustum.far; - this._logFarDistance = 2.0 / Math.log2(frustum.far + 1.0); + this._logFarDistance = 2.0 / CesiumMath.log2(frustum.far + 1.0); if (defined(frustum._offCenterFrustum)) { frustum = frustum._offCenterFrustum; diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 50b48178c9d3..842055d8bbc0 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2577,7 +2577,7 @@ define([ * Return the distance from the camera to the front of the bounding sphere. * * @param {BoundingSphere} boundingSphere The bounding sphere in world coordinates. - * @returns {Number} The distance to the bounding sphere. + * @returns {Number} The signed distance to the bounding sphere. */ Camera.prototype.distanceToBoundingSphere = function(boundingSphere) { //>>includeStart('debug', pragmas.debug); @@ -2587,8 +2587,10 @@ define([ //>>includeEnd('debug'); var toCenter = Cartesian3.subtract(this.positionWC, boundingSphere.center, scratchToCenter); - var proj = Cartesian3.multiplyByScalar(this.directionWC, Cartesian3.dot(toCenter, this.directionWC), scratchProj); - return Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); + var distance = -Cartesian3.dot(toCenter, this.directionWC); + var proj = Cartesian3.multiplyByScalar(this.directionWC, distance, scratchProj); + var unsignedDistance = Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); + return distance < 0.0 ? -unsignedDistance : unsignedDistance; }; var scratchPixelSize = new Cartesian2(); @@ -2615,6 +2617,9 @@ define([ //>>includeEnd('debug'); var distance = this.distanceToBoundingSphere(boundingSphere); + if (distance < 0.0) { + return 0.0; + } var pixelSize = this.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, scratchPixelSize); return Math.max(pixelSize.x, pixelSize.y); }; diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js index bdc718663116..32c8f98f97ab 100644 --- a/Source/Scene/Expression.js +++ b/Source/Scene/Expression.js @@ -279,7 +279,7 @@ define([ } function log2(number) { - return CesiumMath.logBase(number, 2.0); + return CesiumMath.log2(number, 2.0); } function getEvaluateUnaryComponentwise(operation) { diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index 9eb26db93d5d..ce8688e31204 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -311,7 +311,7 @@ define([ // log2(z + 1) / log2( far + 1); // to perspective form // (far - far * near / z) / (far - near) - depth = Math.pow(2.0, depth * Math.log2(far + 1.0)) - 1.0; + depth = Math.pow(2.0, depth * CesiumMath.log2(far + 1.0)) - 1.0; depth = far * (1.0 - 1.0 / depth) / (far - near); } diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 53ebb87a9fc3..142bd49dd14a 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -1,5 +1,4 @@ varying vec4 positionEC; -varying float flogz; void main() { diff --git a/Specs/Scene/ClassificationPrimitiveSpec.js b/Specs/Scene/ClassificationPrimitiveSpec.js index 959a793d14d7..f4dfa7a5e3ba 100644 --- a/Specs/Scene/ClassificationPrimitiveSpec.js +++ b/Specs/Scene/ClassificationPrimitiveSpec.js @@ -326,7 +326,9 @@ defineSuite([ verifyClassificationPrimitiveRender(primitive, boxColor); }); - it('renders in Columbus view when scene3DOnly is false', function() { + // Rendering in 2D/CV is broken: + // https://github.com/AnalyticalGraphicsInc/cesium/issues/6308 + xit('renders in Columbus view when scene3DOnly is false', function() { if (!ClassificationPrimitive.isSupported(scene)) { return; } @@ -340,7 +342,7 @@ defineSuite([ verifyClassificationPrimitiveRender(primitive, boxColor); }); - it('renders in 2D when scene3DOnly is false', function() { + xit('renders in 2D when scene3DOnly is false', function() { if (!ClassificationPrimitive.isSupported(scene)) { return; } From 22ecbe674fc0dc1e72ae25f274af4e10b19a88e4 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 7 Mar 2018 17:05:48 -0500 Subject: [PATCH 042/104] Add option to disable log depth. Fix frustum equality and frustum changed flag. --- Source/Core/OrthographicFrustum.js | 2 +- Source/Core/OrthographicOffCenterFrustum.js | 2 +- Source/Core/PerspectiveFrustum.js | 2 +- Source/Core/PerspectiveOffCenterFrustum.js | 2 +- Source/Scene/Scene.js | 24 ++++++++++-- Source/Shaders/EllipsoidFS.glsl | 15 ++++++++ .../PointCloudEyeDomeLighting.glsl | 37 ++++++++++--------- Source/Shaders/Vector3DTilePolylinesVS.glsl | 2 +- 8 files changed, 61 insertions(+), 25 deletions(-) diff --git a/Source/Core/OrthographicFrustum.js b/Source/Core/OrthographicFrustum.js index b3377b99fde1..b2dd5ef7e074 100644 --- a/Source/Core/OrthographicFrustum.js +++ b/Source/Core/OrthographicFrustum.js @@ -259,7 +259,7 @@ define([ * @returns {Boolean} true if they are equal, false otherwise. */ OrthographicFrustum.prototype.equals = function(other) { - if (!defined(other)) { + if (!defined(other) || !(other instanceof OrthographicFrustum)) { return false; } diff --git a/Source/Core/OrthographicOffCenterFrustum.js b/Source/Core/OrthographicOffCenterFrustum.js index 63dd0c40dfbf..09877fba03b2 100644 --- a/Source/Core/OrthographicOffCenterFrustum.js +++ b/Source/Core/OrthographicOffCenterFrustum.js @@ -361,7 +361,7 @@ define([ * @returns {Boolean} true if they are equal, false otherwise. */ OrthographicOffCenterFrustum.prototype.equals = function(other) { - return (defined(other) && + return (defined(other) && other instanceof OrthographicOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && diff --git a/Source/Core/PerspectiveFrustum.js b/Source/Core/PerspectiveFrustum.js index 5926554f69dc..3186170bbd77 100644 --- a/Source/Core/PerspectiveFrustum.js +++ b/Source/Core/PerspectiveFrustum.js @@ -354,7 +354,7 @@ define([ * @returns {Boolean} true if they are equal, false otherwise. */ PerspectiveFrustum.prototype.equals = function(other) { - if (!defined(other)) { + if (!defined(other) || !(other instanceof PerspectiveFrustum)) { return false; } diff --git a/Source/Core/PerspectiveOffCenterFrustum.js b/Source/Core/PerspectiveOffCenterFrustum.js index 7b031d85e77c..30319a5b2556 100644 --- a/Source/Core/PerspectiveOffCenterFrustum.js +++ b/Source/Core/PerspectiveOffCenterFrustum.js @@ -412,7 +412,7 @@ define([ * @returns {Boolean} true if they are equal, false otherwise. */ PerspectiveOffCenterFrustum.prototype.equals = function(other) { - return (defined(other) && + return (defined(other) && other instanceof PerspectiveOffCenterFrustum && this.right === other.right && this.left === other.left && this.top === other.top && diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 53e502f86bfc..08cffe66c3b2 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -266,6 +266,7 @@ define([ } this._logDepthBuffer = context.fragmentDepth; + this._logDepthBufferChanged = true; this._id = createGuid(); this._jobScheduler = new JobScheduler(); @@ -1379,6 +1380,22 @@ define([ //>>includeEnd('debug'); this._minimumDisableDepthTestDistance = value; } + }, + + /** + * Whether or not to use a logarithmic depth buffer. Enabling this option will allow for less frustums in the multi-frustum, + * increasing performance. This property relies on {@link Context#fragmentDepth} being supported. + */ + logDepthBuffer : { + get : function() { + return this._logDepthBuffer; + }, + set : function(value) { + if (this._context.fragmentDepth && this._logDepthBuffer !== value) { + this._logDepthBuffer = value; + this._logDepthBufferChanged = true; + } + } } }); @@ -1432,7 +1449,7 @@ define([ } var derivedCommands = command.derivedCommands; - if ((scene._frustumChanged || command.dirty) && defined(derivedCommands)) { + if ((scene._logDepthBufferChanged || scene._frustumChanged || command.dirty) && defined(derivedCommands)) { command.dirty = false; var frustum = scene.camera.frustum; @@ -3099,14 +3116,14 @@ define([ tryAndCatchError(this, time, update); this._postUpdate.raiseEvent(this, time); - this._frustumChanged = this._camera.frustum !== this._cameraClone.frustum; + this._frustumChanged = !this._camera.frustum.equals(this._cameraClone.frustum); if (this._frustumChanged && this._logDepthBuffer && !(this._camera.frustum instanceof OrthographicFrustum || this._camera.frustum instanceof OrthographicOffCenterFrustum)) { this._camera.frustum.near = 1.0; this._camera.frustum.far = 10000000000.0; } var cameraChanged = checkForCameraUpdates(this); - var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || (this.mode === SceneMode.MORPHING); + var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || this._logDepthBufferChanged || (this.mode === SceneMode.MORPHING); if (!shouldRender && defined(this.maximumRenderTimeChange) && defined(this._lastRenderTime)) { var difference = Math.abs(JulianDate.secondsDifference(this._lastRenderTime, time)); shouldRender = shouldRender || difference > this.maximumRenderTimeChange; @@ -3115,6 +3132,7 @@ define([ if (shouldRender) { this._lastRenderTime = JulianDate.clone(time, this._lastRenderTime); this._renderRequested = false; + this._logDepthBufferChanged = false; // Render this._preRender.raiseEvent(this, time); diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index a0da7525f0b8..ab29498065a4 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -1,3 +1,9 @@ +#ifdef WRITE_DEPTH +#ifdef GL_EXT_frag_depth +#extension GL_EXT_frag_depth : enable +#endif +#endif + uniform vec3 u_radii; uniform vec3 u_oneOverEllipsoidRadiiSquared; @@ -90,7 +96,16 @@ void main() t = (intersection.start != 0.0) ? intersection.start : intersection.stop; vec3 positionEC = czm_pointAlongRay(ray, t); vec4 positionCC = czm_projection * vec4(positionEC, 1.0); +#ifdef LOG_DEPTH czm_writeLogZ(1.0 + positionCC.w); +#else + float z = positionCC.z / positionCC.w; + + float n = czm_depthRange.near; + float f = czm_depthRange.far; + + gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5; +#endif #endif #endif } diff --git a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl index 9a6f86d448f5..e24bb51e64ad 100644 --- a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl +++ b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl @@ -25,25 +25,28 @@ void main() { discard; } - else - { - vec4 color = texture2D(u_pointCloud_colorTexture, v_textureCoordinates); - // sample from neighbors up, down, left, right - float distX = u_distancesAndEdlStrength.x; - float distY = u_distancesAndEdlStrength.y; + vec4 color = texture2D(u_pointCloud_colorTexture, v_textureCoordinates); - vec2 responseAndCount = vec2(0.0); + // sample from neighbors up, down, left, right + float distX = u_distancesAndEdlStrength.x; + float distY = u_distancesAndEdlStrength.y; - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, distY)); - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(distX, 0)); - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, -distY)); - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(-distX, 0)); + vec2 responseAndCount = vec2(0.0); - float response = responseAndCount.x / responseAndCount.y; - float shade = exp(-response * 300.0 * u_distancesAndEdlStrength.z); - color.rgb *= shade; - gl_FragColor = vec4(color); - gl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(ecAlphaDepth.xyz, 1.0)).z; - } + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, distY)); + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(distX, 0)); + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, -distY)); + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(-distX, 0)); + + float response = responseAndCount.x / responseAndCount.y; + float shade = exp(-response * 300.0 * u_distancesAndEdlStrength.z); + color.rgb *= shade; + gl_FragColor = vec4(color); + +#ifdef LOG_DEPTH + czm_writeLogZ(1.0 + (czm_projection * vec4(ecAlphaDepth.xyz, 1.0)).w); +#else + gl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(ecAlphaDepth.xyz, 1.0)).z; +#endif } diff --git a/Source/Shaders/Vector3DTilePolylinesVS.glsl b/Source/Shaders/Vector3DTilePolylinesVS.glsl index 111bafdc1f7f..dc869998cdc7 100644 --- a/Source/Shaders/Vector3DTilePolylinesVS.glsl +++ b/Source/Shaders/Vector3DTilePolylinesVS.glsl @@ -21,6 +21,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - czm_vertexLogZ(czm_projection * u_modifiedModelView * currentPosition); + czm_vertexLogZ(czm_projection * p); #endif } From e72c849d9489e92de35b4866c2b9c649924e88fd Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 8 Mar 2018 17:38:25 -0500 Subject: [PATCH 043/104] Fix billboards not being occluded by the near plane. Fix more tests. --- Source/Shaders/BillboardCollectionVS.glsl | 8 ++++---- Source/Shaders/PointPrimitiveCollectionVS.glsl | 9 ++++----- Specs/Scene/BillboardCollectionSpec.js | 2 +- Specs/Scene/LabelCollectionSpec.js | 12 ++++++++---- Specs/Scene/PointPrimitiveCollectionSpec.js | 2 +- Specs/Scene/SceneSpec.js | 15 +++++++++++++++ 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 0b0d469b582c..023ceb06bad1 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -255,14 +255,14 @@ void main() } #endif +#ifdef LOG_DEPTH + czm_vertexLogZ(czm_projection * positionEC); +#endif + vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); v_textureCoordinates = textureCoordinates; -#ifdef LOG_DEPTH - czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); -#endif - #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index d4d7cba61c6e..ffd1a9f59d72 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -147,14 +147,13 @@ void main() } #endif - vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); - - gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); - #ifdef LOG_DEPTH - czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); + czm_vertexLogZ(czm_projection * positionEC); #endif + vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); + gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); + #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) diff --git a/Specs/Scene/BillboardCollectionSpec.js b/Specs/Scene/BillboardCollectionSpec.js index 2e7404ba4114..5f3af46dd85b 100644 --- a/Specs/Scene/BillboardCollectionSpec.js +++ b/Specs/Scene/BillboardCollectionSpec.js @@ -1401,7 +1401,7 @@ defineSuite([ var expected = BoundingSphere.fromPoints(projectedPositions); expected.center = new Cartesian3(0.0, expected.center.x, expected.center.y); expect(actual.center).toEqualEpsilon(expected.center, CesiumMath.EPSILON8); - expect(actual.radius).toBeGreaterThan(expected.radius); + expect(actual.radius).toBeGreaterThanOrEqualTo(expected.radius); }); it('computes bounding sphere in 2D', function() { diff --git a/Specs/Scene/LabelCollectionSpec.js b/Specs/Scene/LabelCollectionSpec.js index 251f2d23fbac..47a9876fdda0 100644 --- a/Specs/Scene/LabelCollectionSpec.js +++ b/Specs/Scene/LabelCollectionSpec.js @@ -554,15 +554,20 @@ defineSuite([ it('does not render labels that are behind the viewer', function() { var label = labels.add({ - position : new Cartesian3(20.0, 0.0, 0.0), // Behind camera + position : Cartesian3.ZERO, // in front of the camera text : 'x', horizontalOrigin : HorizontalOrigin.CENTER, verticalOrigin : VerticalOrigin.CENTER }); + expect(scene).toRenderAndCall(function(rgba) { + expect(rgba[0]).toBeGreaterThan(10); + }); + + label.position = new Cartesian3(20.0, 0.0, 0.0); // Behind camera expect(scene).toRender([0, 0, 0, 255]); - label.position = Cartesian3.ZERO; // Back in front of camera + label.position = new Cartesian3(1.0, 0.0, 0.0); // Back in front of camera expect(scene).toRenderAndCall(function(rgba) { expect(rgba[0]).toBeGreaterThan(10); }); @@ -2000,7 +2005,6 @@ defineSuite([ }); it('computes bounding sphere in Columbus view', function() { - // Disable collision detection to allow controlled camera position, // hence predictable bounding sphere size var originalEnableCollisionDetection = scene.screenSpaceCameraController.enableCollisionDetection; @@ -2030,7 +2034,7 @@ defineSuite([ var expected = BoundingSphere.fromPoints(projectedPositions); expected.center = new Cartesian3(0.0, expected.center.x, expected.center.y); expect(actual.center).toEqualEpsilon(expected.center, CesiumMath.EPSILON8); - expect(actual.radius).toBeGreaterThan(expected.radius); + expect(actual.radius).toBeGreaterThanOrEqualTo(expected.radius); scene.screenSpaceCameraController.enableCollisionDetection = originalEnableCollisionDetection; }); diff --git a/Specs/Scene/PointPrimitiveCollectionSpec.js b/Specs/Scene/PointPrimitiveCollectionSpec.js index 05d3deaec437..381908d6c52d 100644 --- a/Specs/Scene/PointPrimitiveCollectionSpec.js +++ b/Specs/Scene/PointPrimitiveCollectionSpec.js @@ -907,7 +907,7 @@ defineSuite([ var expected = BoundingSphere.fromPoints(projectedPositions); expected.center = new Cartesian3(0.0, expected.center.x, expected.center.y); expect(actual.center).toEqualEpsilon(expected.center, CesiumMath.EPSILON8); - expect(actual.radius).toBeGreaterThan(expected.radius); + expect(actual.radius).toBeGreaterThanOrEqualTo(expected.radius); }); it('computes bounding sphere in 2D', function() { diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 43783f889c5b..8c852341361a 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -249,6 +249,9 @@ defineSuite([ }); it('debugCommandFilter does not filter commands', function() { + var originalLogDepth = scene.logDepthBuffer; + scene.logDepthBuffer = false; + var c = new DrawCommand({ shaderProgram : simpleShaderProgram, renderState : simpleRenderState, @@ -262,9 +265,14 @@ defineSuite([ expect(scene.debugCommandFilter).toBeUndefined(); scene.renderForSpecs(); expect(c.execute).toHaveBeenCalled(); + + scene.logDepthBuffer = originalLogDepth; }); it('debugShowBoundingVolume draws a bounding sphere', function() { + var originalLogDepth = scene.logDepthBuffer; + scene.logDepthBuffer = false; + var radius = 10.0; var center = Cartesian3.add(scene.camera.position, scene.camera.direction, new Cartesian3()); @@ -283,9 +291,14 @@ defineSuite([ expect(scene).toRenderAndCall(function(rgba) { expect(rgba[0]).not.toEqual(0); // Red bounding sphere }); + + scene.logDepthBuffer = originalLogDepth; }); it('debugShowCommands tints commands', function() { + var originalLogDepth = scene.logDepthBuffer; + scene.logDepthBuffer = false; + var c = new DrawCommand({ shaderProgram : simpleShaderProgram, renderState : simpleRenderState, @@ -306,6 +319,8 @@ defineSuite([ scene.renderForSpecs(); expect(c._debugColor).toBeDefined(); scene.debugShowCommands = false; + + scene.logDepthBuffer = originalLogDepth; }); it('debugShowFramesPerSecond', function() { From 3c9c92b9ec5f61ca5dc5aaa4821ef42f0eb93f40 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Mar 2018 14:21:03 -0500 Subject: [PATCH 044/104] Fix shadow maps without varying eye coordinate. Fix tests. --- Source/Scene/ShadowMapShader.js | 4 ++-- Source/Shaders/Builtin/Functions/vertexLogZ.glsl | 5 +++-- Specs/Scene/ShadowMapSpec.js | 15 ++++++++++++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Source/Scene/ShadowMapShader.js b/Source/Scene/ShadowMapShader.js index d130f340ffc8..0cf1cd5cc45a 100644 --- a/Source/Scene/ShadowMapShader.js +++ b/Source/Scene/ShadowMapShader.js @@ -210,7 +210,7 @@ define([ '#ifndef LOG_DEPTH \n' + ' return czm_windowToEyeCoordinates(gl_FragCoord); \n' + '#else \n' + - ' return czm_windowToEyeCoordinates(v_glPosition); \n' + + ' return vec4(v_logPositionEC, 1.0); \n' + '#endif \n'; } @@ -221,7 +221,7 @@ define([ 'uniform vec4 shadowMap_normalOffsetScaleDistanceMaxDistanceAndDarkness; \n' + 'uniform vec4 shadowMap_texelSizeDepthBiasAndNormalShadingSmooth; \n' + '#ifdef LOG_DEPTH \n' + - 'varying vec4 v_glPosition; \n' + + 'varying vec3 v_logPositionEC; \n' + '#endif \n' + 'vec4 getPositionEC() \n' + '{ \n' + diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl index c074887512ef..5cbdd861b379 100644 --- a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl +++ b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl @@ -1,11 +1,12 @@ #ifdef LOG_DEPTH varying float v_logZ; -varying vec4 v_glPosition; +varying vec3 v_logPositionEC; #endif void czm_updateZ() { #ifdef LOG_DEPTH - v_glPosition = gl_Position; + v_logPositionEC = (czm_inverseProjection * gl_Position).xyz; + gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; gl_Position.z *= gl_Position.w; #endif diff --git a/Specs/Scene/ShadowMapSpec.js b/Specs/Scene/ShadowMapSpec.js index 7439d663470a..f6d9783848d7 100644 --- a/Specs/Scene/ShadowMapSpec.js +++ b/Specs/Scene/ShadowMapSpec.js @@ -1116,9 +1116,18 @@ defineSuite([ scene.render(); } - // Expect derived commands to be updated twice for both the floor and box, - // once on the first frame and again when the shadow map is dirty - expect(spy.calls.count()).toEqual(4); + var callCount; + if (!scene.logDepthBuffer) { + // Expect derived commands to be updated twice for both the floor and box, + // once on the first frame and again when the shadow map is dirty + callCount = 4; + } else { + // Same as without log z, but doubled. The derived cast commands do not write log z, but + // the derived receive commands do. + callCount = 8; + } + + expect(spy.calls.count()).toEqual(callCount); box.show = false; floor.show = false; From 1440a9a79dda51a1894e4f825b3e405dabd6a344 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Mar 2018 16:00:36 -0500 Subject: [PATCH 045/104] Ignore nodes when searching for model semantics. Fix tests. --- Source/Scene/ModelUtility.js | 16 ++++++++-------- Source/Scene/Scene.js | 19 +++++++++++++------ Specs/Scene/Vector3DTileGeometrySpec.js | 4 ++-- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 33a6b70ec548..fd48103357bd 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -52,7 +52,7 @@ define([ }; }; - ModelUtility.getAttributeOrUniformBySemantic = function(gltf, semantic, programId) { + ModelUtility.getAttributeOrUniformBySemantic = function(gltf, semantic, programId, ignoreNodes) { var techniques = gltf.techniques; var parameter; for (var techniqueName in techniques) { @@ -67,7 +67,7 @@ define([ for (var attributeName in attributes) { if (attributes.hasOwnProperty(attributeName)) { parameter = parameters[attributes[attributeName]]; - if (defined(parameter) && parameter.semantic === semantic) { + if (defined(parameter) && parameter.semantic === semantic && (!ignoreNodes || !defined(parameter.node))) { return attributeName; } } @@ -75,7 +75,7 @@ define([ for (var uniformName in uniforms) { if (uniforms.hasOwnProperty(uniformName)) { parameter = parameters[uniforms[uniformName]]; - if (defined(parameter) && parameter.semantic === semantic) { + if (defined(parameter) && parameter.semantic === semantic && (!ignoreNodes || !defined(parameter.node))) { return uniformName; } } @@ -297,14 +297,14 @@ define([ positionName = decodedPositionName; } - var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION'); - if (!defined(modelViewProjectionName)) { - var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); - var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEW'); + var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION', undefined, true); + if (!defined(modelViewProjectionName) || shader.indexOf(modelViewProjectionName) === -1) { + var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION', undefined, true); + var modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEW', undefined, true); if (shader.indexOf('czm_instanced_modelView ') !== -1) { modelViewName = 'czm_instanced_modelView'; } else if (!defined(modelViewName)) { - modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'CESIUM_RTC_MODELVIEW'); + modelViewName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'CESIUM_RTC_MODELVIEW', undefined, true); } modelViewProjectionName = projectionName + ' * ' + modelViewName; } diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 08cffe66c3b2..42db4f815e26 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -3430,6 +3430,7 @@ define([ } var logDepthRegex = /\s+czm_writeLogZ\(/; + var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/; function getLogDepthShaderProgram(context, shaderProgram) { var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); @@ -3443,11 +3444,7 @@ define([ fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; fs.defines.push('LOG_DEPTH'); - var logSource = - '#ifdef GL_EXT_frag_depth \n' + - '#extension GL_EXT_frag_depth : enable \n' + - '#endif \n\n'; - + var addExtension = true; var writesLogDepth = false; var sources = fs.sources; var length = sources.length; @@ -3455,8 +3452,18 @@ define([ for (i = 0; i < length; ++i) { if (logDepthRegex.test(sources[i])) { writesLogDepth = true; - break; } + if (extensionRegex.test(sources[i])) { + addExtension = false; + } + } + + var logSource = ''; + if (addExtension) { + logSource += + '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n\n'; } if (!writesLogDepth) { diff --git a/Specs/Scene/Vector3DTileGeometrySpec.js b/Specs/Scene/Vector3DTileGeometrySpec.js index 0d9b28d4b17c..ee6c8dbc48ea 100644 --- a/Specs/Scene/Vector3DTileGeometrySpec.js +++ b/Specs/Scene/Vector3DTileGeometrySpec.js @@ -355,7 +355,7 @@ defineSuite([ }); it('renders a single ellipsoid' + webglMessage, function() { - var radii = new Cartesian3(1000000.0, 1000000.0, 1000000.0); + var radii = new Cartesian3(500000.0, 500000.0, 500000.0); var ellipsoid = packEllipsoids([{ modelMatrix : Matrix4.IDENTITY, radii : radii @@ -390,7 +390,7 @@ defineSuite([ }); it('renders a single sphere' + webglMessage, function() { - var radius = 1000000.0; + var radius = 500000.0; var sphere = packSpheres([{ radius : radius, modelMatrix : Matrix4.IDENTITY From 27118ee283c0d9da68e0c06acd922a6259acd90f Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Mar 2018 16:46:54 -0500 Subject: [PATCH 046/104] Fix depth picking point clouds with EDL. --- Source/Scene/Scene.js | 20 +++++++++----------- Specs/Scene/Vector3DTileGeometrySpec.js | 4 ++-- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 42db4f815e26..d862db260cd4 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -777,7 +777,7 @@ define([ } var numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); - updateFrustums(near, far, farToNearRatio, numFrustums, this._frustumCommandsList, false, undefined); + updateFrustums(near, far, farToNearRatio, numFrustums, this._logDepthBuffer, this._frustumCommandsList, false, undefined); // give frameState, camera, and screen space camera controller initial state before rendering updateFrameState(this, 0.0, JulianDate.now()); @@ -1553,7 +1553,7 @@ define([ clearPasses(frameState.passes); } - function updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, nearToFarDistance2D) { + function updateFrustums(near, far, farToNearRatio, numFrustums, logDepth, frustumCommandsList, is2D, nearToFarDistance2D) { frustumCommandsList.length = numFrustums; for (var m = 0; m < numFrustums; ++m) { var curNear; @@ -1561,7 +1561,10 @@ define([ if (!is2D) { curNear = Math.max(near, Math.pow(farToNearRatio, m) * near); - curFar = Math.min(far, farToNearRatio * curNear); + curFar = farToNearRatio * curNear; + if (!logDepth) { + curFar = Math.min(far, curFar); + } } else { curNear = Math.min(far - nearToFarDistance2D, near + m * nearToFarDistance2D); curFar = Math.min(far, curNear + nearToFarDistance2D); @@ -1773,14 +1776,9 @@ define([ numFrustums = Math.ceil(Math.max(1.0, far - near) / scene.nearToFarDistance2D); } - var farChange; - if (frustumCommandsList.length !== 0){ - farChange = far / frustumCommandsList[numberOfFrustums - 1].far; - } - if ((near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && - ((logDepth && isFinite(farChange) && !CesiumMath.equalsEpsilon(1, farChange, CesiumMath.EPSILON8)) || - (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8)))))))) { - updateFrustums(near, far, farToNearRatio, numFrustums, frustumCommandsList, is2D, scene.nearToFarDistance2D); + if (near !== Number.MAX_VALUE && (numFrustums !== numberOfFrustums || (frustumCommandsList.length !== 0 && + (near < frustumCommandsList[0].near || (far > frustumCommandsList[numberOfFrustums - 1].far && (logDepth || !CesiumMath.equalsEpsilon(far, frustumCommandsList[numberOfFrustums - 1].far, CesiumMath.EPSILON8))))))) { + updateFrustums(near, far, farToNearRatio, numFrustums, logDepth, frustumCommandsList, is2D, scene.nearToFarDistance2D); createPotentiallyVisibleSet(scene); } diff --git a/Specs/Scene/Vector3DTileGeometrySpec.js b/Specs/Scene/Vector3DTileGeometrySpec.js index ee6c8dbc48ea..4be21f4c0efd 100644 --- a/Specs/Scene/Vector3DTileGeometrySpec.js +++ b/Specs/Scene/Vector3DTileGeometrySpec.js @@ -662,13 +662,13 @@ defineSuite([ geometry = scene.primitives.add(new Vector3DTileGeometry({ ellipsoids : packEllipsoids([{ modelMatrix : Matrix4.IDENTITY, - radii : new Cartesian3(1000000.0, 1000000.0, 1000000.0) + radii : new Cartesian3(500000.0, 500000.0, 500000.0) }]), ellipsoidBatchIds : new Uint16Array([0]), center : center, modelMatrix : modelMatrix, batchTable : batchTable, - boundingVolume : new BoundingSphere(center, 1000000.0) + boundingVolume : new BoundingSphere(center, 500000.0) })); return loadGeometries(geometry).then(function() { scene.camera.setView({ From 7fdf9c9915ceae2ef4853757e14050c74846a649 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Fri, 9 Mar 2018 19:53:16 -0500 Subject: [PATCH 047/104] Fix depth picking tests. --- Source/Scene/Vector3DTilePrimitive.js | 1 - Specs/Scene/PointCloud3DTileContentSpec.js | 13 ------ Specs/Scene/SceneSpec.js | 46 ++++++---------------- 3 files changed, 12 insertions(+), 48 deletions(-) diff --git a/Source/Scene/Vector3DTilePrimitive.js b/Source/Scene/Vector3DTilePrimitive.js index 4b1e64a39b56..f10af4c2117d 100644 --- a/Source/Scene/Vector3DTilePrimitive.js +++ b/Source/Scene/Vector3DTilePrimitive.js @@ -1056,7 +1056,6 @@ define([ commandLength = commandsIgnoreShow.length; for (i = 0; i < commandLength; ++i) { command = commandsIgnoreShow[i]; - command.pass = pass; commandList.push(command); } } diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js index d7fdad687e6b..64beb31e2a14 100644 --- a/Specs/Scene/PointCloud3DTileContentSpec.js +++ b/Specs/Scene/PointCloud3DTileContentSpec.js @@ -497,19 +497,6 @@ defineSuite([ }); }); - it('modulates attenuation using the baseResolution parameter', function() { - return attenuationTest(function(scene, tileset) { - tileset.pointCloudShading.attenuation = true; - tileset.pointCloudShading.geometricErrorScale = 1.0; - tileset.pointCloudShading.maximumAttenuation = undefined; - tileset.pointCloudShading.baseResolution = CesiumMath.EPSILON20; - tileset.maximumScreenSpaceError = 16; - expect(scene).toRenderPixelCountAndCall(function(pixelCount) { - expect(pixelCount).toEqual(noAttenuationPixelCount); - }); - }); - }); - it('modulates attenuation using the baseResolution parameter', function() { return attenuationTest(function(scene, tileset) { // pointCloudNoColorUrl is a single tile with GeometricError = 0, diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 8c852341361a..741d670211e1 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -726,7 +726,6 @@ defineSuite([ scene.destroyForSpecs(); }); - var pickedPosition3D = new Cartesian3(-455845.46867895435, -5210337.548977215, 3637549.8562320103); var pickedPosition2D = new Cartesian3(-455861.7055871038, -5210523.137686572, 3637866.6638769475); it('pickPosition', function() { @@ -734,7 +733,7 @@ defineSuite([ return; } - var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-0.0001, -0.0001, 0.0001, 0.0001); scene.camera.setView({ destination : rectangle }); var canvas = scene.canvas; @@ -753,7 +752,9 @@ defineSuite([ expect(scene).toRenderAndCall(function() { var position = scene.pickPosition(windowPosition); - expect(position).toEqualEpsilon(pickedPosition3D, CesiumMath.EPSILON6); + expect(position.x).toBeGreaterThan(Ellipsoid.WGS84.minimumRadius); + expect(position.y).toEqualEpsilon(0.0, CesiumMath.EPSILON5); + expect(position.z).toEqualEpsilon(0.0, CesiumMath.EPSILON5); }); }); @@ -764,7 +765,7 @@ defineSuite([ scene.morphToColumbusView(0.0); - var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-0.0001, -0.0001, 0.0001, 0.0001); scene.camera.setView({ destination : rectangle }); var canvas = scene.canvas; @@ -783,7 +784,9 @@ defineSuite([ expect(scene).toRenderAndCall(function() { var position = scene.pickPosition(windowPosition); - expect(position).toEqualEpsilon(pickedPosition2D, CesiumMath.EPSILON6); + expect(position.x).toBeGreaterThan(Ellipsoid.WGS84.minimumRadius); + expect(position.y).toEqualEpsilon(0.0, CesiumMath.EPSILON5); + expect(position.z).toEqualEpsilon(0.0, CesiumMath.EPSILON5); }); }); @@ -794,7 +797,7 @@ defineSuite([ scene.morphTo2D(0.0); - var rectangle = Rectangle.fromDegrees(-100.0, 30.0, -90.0, 40.0); + var rectangle = Rectangle.fromDegrees(-0.0001, -0.0001, 0.0001, 0.0001); scene.camera.setView({ destination : rectangle }); var canvas = scene.canvas; @@ -813,7 +816,9 @@ defineSuite([ expect(scene).toRenderAndCall(function() { var position = scene.pickPosition(windowPosition); - expect(position).toEqualEpsilon(pickedPosition2D, CesiumMath.EPSILON6); + expect(position.x).toBeGreaterThan(Ellipsoid.WGS84.minimumRadius); + expect(position.y).toEqualEpsilon(0.0, CesiumMath.EPSILON5); + expect(position.z).toEqualEpsilon(0.0, CesiumMath.EPSILON5); }); }); @@ -880,33 +885,6 @@ defineSuite([ var position = scene.pickPosition(windowPosition); expect(position).toBeDefined(); }); - - var rectanglePrimitive2 = createRectangle(rectangle); - rectanglePrimitive2.appearance.material.uniforms.color = new Color(0.0, 1.0, 0.0, 0.5); - primitives.add(rectanglePrimitive2); - - expect(scene).toRenderAndCall(function() { - var position = scene.pickPosition(windowPosition); - expect(position).toBeDefined(); - - var commandList = scene.frameState.commandList; - expect(commandList.length).toEqual(2); - - var command1 = commandList[0]; - var command2 = commandList[1]; - - expect(command1.derivedCommands).toBeDefined(); - expect(command2.derivedCommands).toBeDefined(); - - expect(command1.derivedCommands.depth).toBeDefined(); - expect(command2.derivedCommands.depth).toBeDefined(); - - expect(command1.derivedCommands.depth.depthOnlyCommand).toBeDefined(); - expect(command2.derivedCommands.depth.depthOnlyCommand).toBeDefined(); - - expect(command1.derivedCommands.depth.depthOnlyCommand.shaderProgram).toEqual(command2.derivedCommands.depth.depthOnlyCommand.shaderProgram); - expect(command1.derivedCommands.depth.depthOnlyCommand.renderState).toEqual(command2.derivedCommands.depth.depthOnlyCommand.renderState); - }); }); it('pickPosition caches results per frame',function(){ From d94aa07aefa9603ed5fa4185bc8b7958c82ee580 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 15:45:35 -0400 Subject: [PATCH 048/104] Updates from review. Fix more tests. --- CHANGES.md | 8 ++- Source/Scene/Camera.js | 5 +- Source/Scene/ModelUtility.js | 4 +- Source/Scene/Scene.js | 48 +++++++++--------- Source/Scene/SceneTransitioner.js | 16 +++++- Source/Scene/Vector3DTilePrimitive.js | 3 +- .../PolylineColorAppearanceVS.glsl | 2 +- .../PolylineMaterialAppearanceVS.glsl | 2 +- Source/Shaders/BillboardCollectionFS.glsl | 2 +- Source/Shaders/BillboardCollectionVS.glsl | 4 +- .../Builtin/Functions/vertexLogDepth.glsl | 49 +++++++++++++++++++ .../Shaders/Builtin/Functions/vertexLogZ.glsl | 29 ----------- .../Builtin/Functions/writeLogDepth.glsl | 40 +++++++++++++++ .../Shaders/Builtin/Functions/writeLogZ.glsl | 17 ------- Source/Shaders/DepthPlaneFS.glsl | 2 +- Source/Shaders/DepthPlaneVS.glsl | 2 +- Source/Shaders/EllipsoidFS.glsl | 2 +- .../Shaders/PointPrimitiveCollectionFS.glsl | 2 +- .../Shaders/PointPrimitiveCollectionVS.glsl | 4 +- Source/Shaders/PolylineFS.glsl | 2 +- Source/Shaders/PolylineVS.glsl | 2 +- .../PointCloudEyeDomeLighting.glsl | 2 +- Source/Shaders/Vector3DTilePolylinesVS.glsl | 2 +- Specs/Scene/PointCloud3DTileContentSpec.js | 3 +- Specs/Scene/SceneSpec.js | 18 +++---- Specs/Scene/ShadowMapSpec.js | 2 +- 26 files changed, 168 insertions(+), 104 deletions(-) create mode 100644 Source/Shaders/Builtin/Functions/vertexLogDepth.glsl delete mode 100644 Source/Shaders/Builtin/Functions/vertexLogZ.glsl create mode 100644 Source/Shaders/Builtin/Functions/writeLogDepth.glsl delete mode 100644 Source/Shaders/Builtin/Functions/writeLogZ.glsl diff --git a/CHANGES.md b/CHANGES.md index 4310f054c67e..66f77c6c12e9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,9 +3,15 @@ Change Log ### 1.44 - 2018-04-02 +##### Breaking Changes :mega: +* `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. + +##### Additions :tada: +* Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) +* Added `Math.log2` to compute the base 2 logarithm of a number. + ##### Fixes :wrench: * Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302) -* Added option `logDepthBuffer` to `Viewer`. With this option the globe is typically rendered in a single frustum using logarithmic depth. This helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) ### 1.43 - 2018-03-01 diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 842055d8bbc0..915ca86bc001 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2574,7 +2574,10 @@ define([ var scratchProj = new Cartesian3(); /** - * Return the distance from the camera to the front of the bounding sphere. + * Return the signed distance from the camera to the front of the bounding sphere. + *

+ * Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. + *

* * @param {BoundingSphere} boundingSphere The bounding sphere in world coordinates. * @returns {Number} The signed distance to the bounding sphere. diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index fd48103357bd..642723081012 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -284,7 +284,7 @@ define([ 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' czm_writeLogZ(); \n' + + ' czm_writeLogDepth(); \n' + '} \n'; return shader; @@ -315,7 +315,7 @@ define([ 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' czm_vertexLogZ(' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)); \n' + + ' czm_vertexLogDepth(' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)); \n' + '} \n'; return shader; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index d862db260cd4..3bc47456775a 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -266,7 +266,7 @@ define([ } this._logDepthBuffer = context.fragmentDepth; - this._logDepthBufferChanged = true; + this._logDepthBufferDirty = true; this._id = createGuid(); this._jobScheduler = new JobScheduler(); @@ -458,6 +458,7 @@ define([ * @default 1.0 */ this.morphTime = 1.0; + /** * The far-to-near ratio of the multi-frustum. The default is 1,000.0. * @@ -466,6 +467,13 @@ define([ */ this.farToNearRatio = 1000.0; + /** + * The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer. The default is 1e6. + * @type {Number} + * @default 1000000.0 + */ + this.logarithmicDepthFarToNearRatio = 1000000.0; + /** * Determines the uniform depth size in meters of each frustum of the multifrustum in 2D. If a primitive or model close * to the surface shows z-fighting, decreasing this will eliminate the artifact, but decrease performance. On the @@ -698,6 +706,11 @@ define([ this._mapMode2D = defaultValue(options.mapMode2D, MapMode2D.INFINITE_SCROLL); this._frustumChanged = true; + if (this._logDepthBuffer) { + this._camera.frustum.near = 1.0; + this._camera.frustum.far = 10000000000.0; + } + // Keeps track of the state of a frame. FrameState is the state across // the primitives of the scene. This state is for internally keeping track // of celestial and environment effects that need to be updated/rendered in @@ -768,13 +781,7 @@ define([ // initial guess at frustums. var near = camera.frustum.near; var far = camera.frustum.far; - var farToNearRatio; - - if (this._logDepthBuffer) { - farToNearRatio = this.farToNearRatio * this.farToNearRatio; - } else { - farToNearRatio = this.farToNearRatio; - } + var farToNearRatio = this._logDepthBuffer ? this.logarithmicDepthFarToNearRatio : this.farToNearRatio; var numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); updateFrustums(near, far, farToNearRatio, numFrustums, this._logDepthBuffer, this._frustumCommandsList, false, undefined); @@ -1386,14 +1393,14 @@ define([ * Whether or not to use a logarithmic depth buffer. Enabling this option will allow for less frustums in the multi-frustum, * increasing performance. This property relies on {@link Context#fragmentDepth} being supported. */ - logDepthBuffer : { + logarithmicDepthBuffer : { get : function() { return this._logDepthBuffer; }, set : function(value) { if (this._context.fragmentDepth && this._logDepthBuffer !== value) { this._logDepthBuffer = value; - this._logDepthBufferChanged = true; + this._logDepthBufferDirty = true; } } } @@ -1449,7 +1456,7 @@ define([ } var derivedCommands = command.derivedCommands; - if ((scene._logDepthBufferChanged || scene._frustumChanged || command.dirty) && defined(derivedCommands)) { + if ((scene._logDepthBufferDirty || scene._frustumChanged || command.dirty) && defined(derivedCommands)) { command.dirty = false; var frustum = scene.camera.frustum; @@ -1758,14 +1765,11 @@ define([ // last frame, else compute the new frustums and sort them by frustum again. var is2D = scene.mode === SceneMode.SCENE2D; var logDepth = scene._logDepthBuffer && !(camera.frustum instanceof OrthographicFrustum || camera.frustum instanceof OrthographicOffCenterFrustum); - var farToNearRatio = scene.farToNearRatio; + var farToNearRatio = logDepth ? scene.logarithmicDepthFarToNearRatio : scene.farToNearRatio; var numFrustums; if (!is2D) { // The multifrustum for 3D/CV is non-uniformly distributed. - if (logDepth) { - farToNearRatio *= farToNearRatio; - } numFrustums = Math.ceil(Math.log(far / near) / Math.log(farToNearRatio)); } else { // The multifrustum for 2D is uniformly distributed. To avoid z-fighting in 2D, @@ -3115,13 +3119,9 @@ define([ this._postUpdate.raiseEvent(this, time); this._frustumChanged = !this._camera.frustum.equals(this._cameraClone.frustum); - if (this._frustumChanged && this._logDepthBuffer && !(this._camera.frustum instanceof OrthographicFrustum || this._camera.frustum instanceof OrthographicOffCenterFrustum)) { - this._camera.frustum.near = 1.0; - this._camera.frustum.far = 10000000000.0; - } var cameraChanged = checkForCameraUpdates(this); - var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || this._logDepthBufferChanged || (this.mode === SceneMode.MORPHING); + var shouldRender = !this.requestRenderMode || this._renderRequested || cameraChanged || this._frustumChanged || this._logDepthBufferDirty || (this.mode === SceneMode.MORPHING); if (!shouldRender && defined(this.maximumRenderTimeChange) && defined(this._lastRenderTime)) { var difference = Math.abs(JulianDate.secondsDifference(this._lastRenderTime, time)); shouldRender = shouldRender || difference > this.maximumRenderTimeChange; @@ -3130,7 +3130,7 @@ define([ if (shouldRender) { this._lastRenderTime = JulianDate.clone(time, this._lastRenderTime); this._renderRequested = false; - this._logDepthBufferChanged = false; + this._logDepthBufferDirty = false; // Render this._preRender.raiseEvent(this, time); @@ -3427,7 +3427,7 @@ define([ return result; } - var logDepthRegex = /\s+czm_writeLogZ\(/; + var logDepthRegex = /\s+czm_writeLogDepth\(/; var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/; function getLogDepthShaderProgram(context, shaderProgram) { @@ -3474,7 +3474,7 @@ define([ 'void main() \n' + '{ \n' + ' czm_log_depth_main(); \n' + - ' czm_writeLogZ(); \n' + + ' czm_writeLogDepth(); \n' + '} \n'; var vertexSources = vs.sources; @@ -3488,7 +3488,7 @@ define([ 'void main() \n' + '{ \n' + ' czm_log_depth_main(); \n' + - ' czm_vertexLogZ(); \n' + + ' czm_vertexLogDepth(); \n' + '} \n'; vertexSources.push(logMain); } diff --git a/Source/Scene/SceneTransitioner.js b/Source/Scene/SceneTransitioner.js index 318182e4e8fc..43dc3dce89ab 100644 --- a/Source/Scene/SceneTransitioner.js +++ b/Source/Scene/SceneTransitioner.js @@ -857,10 +857,10 @@ define([ destroyMorphHandler(transitioner); + var camera = scene.camera; if (transitioner._previousMode !== SceneMode.MORPHING || transitioner._morphCancelled) { transitioner._morphCancelled = false; - var camera = scene.camera; Cartesian3.clone(camera3D.position, camera.position); Cartesian3.clone(camera3D.direction, camera.direction); Cartesian3.clone(camera3D.up, camera.up); @@ -870,6 +870,12 @@ define([ camera.frustum = camera3D.frustum.clone(); } + var frustum = camera.frustum; + if (scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum)) { + frustum.near = 1.0; + frustum.far = 10000000000.0; + } + var wasMorphing = defined(transitioner._completeMorph); transitioner._completeMorph = undefined; scene.camera.update(scene.mode); @@ -910,10 +916,10 @@ define([ destroyMorphHandler(transitioner); + var camera = scene.camera; if (transitioner._previousModeMode !== SceneMode.MORPHING || transitioner._morphCancelled) { transitioner._morphCancelled = false; - var camera = scene.camera; Cartesian3.clone(cameraCV.position, camera.position); Cartesian3.clone(cameraCV.direction, camera.direction); Cartesian3.clone(cameraCV.up, camera.up); @@ -921,6 +927,12 @@ define([ Cartesian3.normalize(camera.right, camera.right); } + var frustum = camera.frustum; + if (scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum)) { + frustum.near = 1.0; + frustum.far = 10000000000.0; + } + var wasMorphing = defined(transitioner._completeMorph); transitioner._completeMorph = undefined; scene.camera.update(scene.mode); diff --git a/Source/Scene/Vector3DTilePrimitive.js b/Source/Scene/Vector3DTilePrimitive.js index f10af4c2117d..1bd40fe145cc 100644 --- a/Source/Scene/Vector3DTilePrimitive.js +++ b/Source/Scene/Vector3DTilePrimitive.js @@ -1055,8 +1055,7 @@ define([ commandLength = commandsIgnoreShow.length; for (i = 0; i < commandLength; ++i) { - command = commandsIgnoreShow[i]; - commandList.push(command); + commandList.push(commandsIgnoreShow[i]); } } diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl index 9515f6cbcc45..17ce3ec48e27 100644 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.glsl @@ -27,6 +27,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl index e91e4067fb70..bdfae0e27569 100644 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.glsl @@ -29,6 +29,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/BillboardCollectionFS.glsl b/Source/Shaders/BillboardCollectionFS.glsl index 8d6488b06121..79a38c69f003 100644 --- a/Source/Shaders/BillboardCollectionFS.glsl +++ b/Source/Shaders/BillboardCollectionFS.glsl @@ -54,5 +54,5 @@ void main() gl_FragColor = color; #endif - czm_writeLogZ(); + czm_writeLogDepth(); } diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 023ceb06bad1..cf0f97840e3d 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -256,7 +256,7 @@ void main() #endif #ifdef LOG_DEPTH - czm_vertexLogZ(czm_projection * positionEC); + czm_vertexLogDepth(czm_projection * positionEC); #endif vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); @@ -280,7 +280,7 @@ void main() // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH - czm_vertexLogZ(vec4(czm_currentFrustum.x)); + czm_vertexLogDepth(vec4(czm_currentFrustum.x)); #endif } } diff --git a/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl b/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl new file mode 100644 index 000000000000..673f4240df54 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl @@ -0,0 +1,49 @@ +#ifdef LOG_DEPTH +varying float v_logZ; +varying vec3 v_logPositionEC; +#endif + +void czm_updatePositionDepth() { +#ifdef LOG_DEPTH + v_logPositionEC = (czm_inverseProjection * gl_Position).xyz; + + gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; + gl_Position.z *= gl_Position.w; +#endif +} + +/** + * Writes the logarithmic depth to gl_Position using the already computed gl_Position. + * + * @name czm_vertexLogDepth + * @glslFunction + */ +void czm_vertexLogDepth() +{ +#ifdef LOG_DEPTH + v_logZ = 1.0 + gl_Position.w; + czm_updatePositionDepth(); +#endif +} + +/** + * Writes the logarithmic depth to gl_Position using the provided clip coordinates. + *

+ * An example use case for this function would be moving the vertex in window coordinates + * before converting back to clip coordinates. Use the original vertex clip coordinates. + *

+ * @name czm_vertexLogDepth + * @glslFunction + * + * @param {vec4} clipCoords The vertex in clip coordinates. + * + * @example + * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0)); + */ +void czm_vertexLogDepth(vec4 clipCoords) +{ +#ifdef LOG_DEPTH + v_logZ = 1.0 + clipCoords.w; + czm_updatePositionDepth(); +#endif +} diff --git a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl b/Source/Shaders/Builtin/Functions/vertexLogZ.glsl deleted file mode 100644 index 5cbdd861b379..000000000000 --- a/Source/Shaders/Builtin/Functions/vertexLogZ.glsl +++ /dev/null @@ -1,29 +0,0 @@ -#ifdef LOG_DEPTH -varying float v_logZ; -varying vec3 v_logPositionEC; -#endif - -void czm_updateZ() { -#ifdef LOG_DEPTH - v_logPositionEC = (czm_inverseProjection * gl_Position).xyz; - - gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; - gl_Position.z *= gl_Position.w; -#endif -} - -void czm_vertexLogZ() -{ -#ifdef LOG_DEPTH - v_logZ = 1.0 + gl_Position.w; - czm_updateZ(); -#endif -} - -void czm_vertexLogZ(vec4 clipCoords) -{ -#ifdef LOG_DEPTH - v_logZ = 1.0 + clipCoords.w; - czm_updateZ(); -#endif -} diff --git a/Source/Shaders/Builtin/Functions/writeLogDepth.glsl b/Source/Shaders/Builtin/Functions/writeLogDepth.glsl new file mode 100644 index 000000000000..60a591aad01e --- /dev/null +++ b/Source/Shaders/Builtin/Functions/writeLogDepth.glsl @@ -0,0 +1,40 @@ +#ifdef LOG_DEPTH +varying float v_logZ; +#endif + +/** + * Writes the fragment depth to the logarithmic depth buffer. + *

+ * Use this when the vertex shader does not calls {@link czm_vertexlogDepth}, for example, when + * ray-casting geometry using a full screen quad. + *

+ * @name czm_writeLogDepth + * @glslFunction + * + * @param {float} logZ The w coordinate of the vertex in clip coordinates plus 1.0. + * + * @example + * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0); + */ +void czm_writeLogDepth(float logZ) +{ +#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE) + float halfLogFarDistance = czm_logFarDistance * 0.5; + gl_FragDepthEXT = log2(logZ) * halfLogFarDistance; +#endif +} + +/** + * Writes the fragment depth to the logarithmic depth buffer. + *

+ * Use this when the vertex shader calls {@link czm_vertexlogDepth}. + *

+ * + * @name czm_writeLogDepth + * @glslFunction + */ +void czm_writeLogDepth() { +#ifdef LOG_DEPTH + czm_writeLogDepth(v_logZ); +#endif +} diff --git a/Source/Shaders/Builtin/Functions/writeLogZ.glsl b/Source/Shaders/Builtin/Functions/writeLogZ.glsl deleted file mode 100644 index 6cd5da08d3b6..000000000000 --- a/Source/Shaders/Builtin/Functions/writeLogZ.glsl +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef LOG_DEPTH -varying float v_logZ; -#endif - -void czm_writeLogZ(float logZ) -{ -#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE) - float halfLogFarDistance = czm_logFarDistance * 0.5; - gl_FragDepthEXT = log2(logZ) * halfLogFarDistance; -#endif -} - -void czm_writeLogZ() { -#ifdef LOG_DEPTH - czm_writeLogZ(v_logZ); -#endif -} diff --git a/Source/Shaders/DepthPlaneFS.glsl b/Source/Shaders/DepthPlaneFS.glsl index 142bd49dd14a..41385729ae4b 100644 --- a/Source/Shaders/DepthPlaneFS.glsl +++ b/Source/Shaders/DepthPlaneFS.glsl @@ -18,5 +18,5 @@ void main() discard; } - czm_writeLogZ(); + czm_writeLogDepth(); } diff --git a/Source/Shaders/DepthPlaneVS.glsl b/Source/Shaders/DepthPlaneVS.glsl index 6ddb496a5309..028b56c43700 100644 --- a/Source/Shaders/DepthPlaneVS.glsl +++ b/Source/Shaders/DepthPlaneVS.glsl @@ -7,5 +7,5 @@ void main() positionEC = czm_modelView * position; gl_Position = czm_projection * positionEC; - czm_vertexLogZ(); + czm_vertexLogDepth(); } diff --git a/Source/Shaders/EllipsoidFS.glsl b/Source/Shaders/EllipsoidFS.glsl index ab29498065a4..d028e502b96d 100644 --- a/Source/Shaders/EllipsoidFS.glsl +++ b/Source/Shaders/EllipsoidFS.glsl @@ -97,7 +97,7 @@ void main() vec3 positionEC = czm_pointAlongRay(ray, t); vec4 positionCC = czm_projection * vec4(positionEC, 1.0); #ifdef LOG_DEPTH - czm_writeLogZ(1.0 + positionCC.w); + czm_writeLogDepth(1.0 + positionCC.w); #else float z = positionCC.z / positionCC.w; diff --git a/Source/Shaders/PointPrimitiveCollectionFS.glsl b/Source/Shaders/PointPrimitiveCollectionFS.glsl index 47847cdd280b..92a9ee788615 100644 --- a/Source/Shaders/PointPrimitiveCollectionFS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionFS.glsl @@ -47,5 +47,5 @@ void main() gl_FragColor = color; #endif - czm_writeLogZ(); + czm_writeLogDepth(); } diff --git a/Source/Shaders/PointPrimitiveCollectionVS.glsl b/Source/Shaders/PointPrimitiveCollectionVS.glsl index ffd1a9f59d72..6b23bb152840 100644 --- a/Source/Shaders/PointPrimitiveCollectionVS.glsl +++ b/Source/Shaders/PointPrimitiveCollectionVS.glsl @@ -148,7 +148,7 @@ void main() #endif #ifdef LOG_DEPTH - czm_vertexLogZ(czm_projection * positionEC); + czm_vertexLogDepth(czm_projection * positionEC); #endif vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); @@ -171,7 +171,7 @@ void main() // Position z on the near plane. gl_Position.z = -gl_Position.w; #ifdef LOG_DEPTH - czm_vertexLogZ(vec4(czm_currentFrustum.x)); + czm_vertexLogDepth(vec4(czm_currentFrustum.x)); #endif } } diff --git a/Source/Shaders/PolylineFS.glsl b/Source/Shaders/PolylineFS.glsl index e634f43efe03..604a7b805219 100644 --- a/Source/Shaders/PolylineFS.glsl +++ b/Source/Shaders/PolylineFS.glsl @@ -18,5 +18,5 @@ void main() gl_FragColor *= u_highlightColor; #endif - czm_writeLogZ(); + czm_writeLogDepth(); } diff --git a/Source/Shaders/PolylineVS.glsl b/Source/Shaders/PolylineVS.glsl index 9f7d5bbe2325..a43949d08a21 100644 --- a/Source/Shaders/PolylineVS.glsl +++ b/Source/Shaders/PolylineVS.glsl @@ -98,6 +98,6 @@ void main() czm_pickColor = pickColor; #ifdef LOG_DEPTH - czm_vertexLogZ(czm_modelViewProjectionRelativeToEye * p); + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p); #endif } diff --git a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl index e24bb51e64ad..3cdfc984b540 100644 --- a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl +++ b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.glsl @@ -45,7 +45,7 @@ void main() gl_FragColor = vec4(color); #ifdef LOG_DEPTH - czm_writeLogZ(1.0 + (czm_projection * vec4(ecAlphaDepth.xyz, 1.0)).w); + czm_writeLogDepth(1.0 + (czm_projection * vec4(ecAlphaDepth.xyz, 1.0)).w); #else gl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(ecAlphaDepth.xyz, 1.0)).z; #endif diff --git a/Source/Shaders/Vector3DTilePolylinesVS.glsl b/Source/Shaders/Vector3DTilePolylinesVS.glsl index dc869998cdc7..08690062050f 100644 --- a/Source/Shaders/Vector3DTilePolylinesVS.glsl +++ b/Source/Shaders/Vector3DTilePolylinesVS.glsl @@ -21,6 +21,6 @@ void main() gl_Position = czm_viewportOrthographic * positionWC; #ifdef LOG_DEPTH - czm_vertexLogZ(czm_projection * p); + czm_vertexLogDepth(czm_projection * p); #endif } diff --git a/Specs/Scene/PointCloud3DTileContentSpec.js b/Specs/Scene/PointCloud3DTileContentSpec.js index 64beb31e2a14..9b110ba2c1dd 100644 --- a/Specs/Scene/PointCloud3DTileContentSpec.js +++ b/Specs/Scene/PointCloud3DTileContentSpec.js @@ -441,11 +441,12 @@ defineSuite([ }); }); - var noAttenuationPixelCount = 16; + var noAttenuationPixelCount; function attenuationTest(postLoadCallback) { var scene = createScene({ canvas : createCanvas(10, 10) }); + noAttenuationPixelCount = scene.logarithmicDepthBuffer ? 20 : 16; var center = new Cartesian3.fromRadians(centerLongitude, centerLatitude, 5.0); scene.camera.lookAt(center, new HeadingPitchRange(0.0, -1.57, 5.0)); scene.fxaa = false; diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 741d670211e1..e159676f1513 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -249,8 +249,8 @@ defineSuite([ }); it('debugCommandFilter does not filter commands', function() { - var originalLogDepth = scene.logDepthBuffer; - scene.logDepthBuffer = false; + var originalLogDepth = scene.logarithmicDepthBuffer; + scene.logarithmicDepthBuffer = false; var c = new DrawCommand({ shaderProgram : simpleShaderProgram, @@ -266,12 +266,12 @@ defineSuite([ scene.renderForSpecs(); expect(c.execute).toHaveBeenCalled(); - scene.logDepthBuffer = originalLogDepth; + scene.logarithmicDepthBuffer = originalLogDepth; }); it('debugShowBoundingVolume draws a bounding sphere', function() { - var originalLogDepth = scene.logDepthBuffer; - scene.logDepthBuffer = false; + var originalLogDepth = scene.logarithmicDepthBuffer; + scene.logarithmicDepthBuffer = false; var radius = 10.0; var center = Cartesian3.add(scene.camera.position, scene.camera.direction, new Cartesian3()); @@ -292,12 +292,12 @@ defineSuite([ expect(rgba[0]).not.toEqual(0); // Red bounding sphere }); - scene.logDepthBuffer = originalLogDepth; + scene.logarithmicDepthBuffer = originalLogDepth; }); it('debugShowCommands tints commands', function() { - var originalLogDepth = scene.logDepthBuffer; - scene.logDepthBuffer = false; + var originalLogDepth = scene.logarithmicDepthBuffer; + scene.logarithmicDepthBuffer = false; var c = new DrawCommand({ shaderProgram : simpleShaderProgram, @@ -320,7 +320,7 @@ defineSuite([ expect(c._debugColor).toBeDefined(); scene.debugShowCommands = false; - scene.logDepthBuffer = originalLogDepth; + scene.logarithmicDepthBuffer = originalLogDepth; }); it('debugShowFramesPerSecond', function() { diff --git a/Specs/Scene/ShadowMapSpec.js b/Specs/Scene/ShadowMapSpec.js index f6d9783848d7..3b702985d4e9 100644 --- a/Specs/Scene/ShadowMapSpec.js +++ b/Specs/Scene/ShadowMapSpec.js @@ -1117,7 +1117,7 @@ defineSuite([ } var callCount; - if (!scene.logDepthBuffer) { + if (!scene.logarithmicDepthBuffer) { // Expect derived commands to be updated twice for both the floor and box, // once on the first frame and again when the shadow map is dirty callCount = 4; From 1d5adab28771a50a69ab6296eefe81b60285c0f8 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 16:14:13 -0400 Subject: [PATCH 049/104] Fix tests broken by last commit. --- Source/Scene/Primitive.js | 2 +- Source/Scene/Scene.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/Scene/Primitive.js b/Source/Scene/Primitive.js index 59455919c3cb..199ec0e3bea4 100644 --- a/Source/Scene/Primitive.js +++ b/Source/Scene/Primitive.js @@ -1011,7 +1011,7 @@ define([ 'varying float v_WindowZ;\n' + 'void main() {\n' + ' czm_non_depth_clamp_main();\n' + - '#ifdef GL_EXT_frag_depth\n' + + '#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n' + ' gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n' + '#endif\n' + '}\n'; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 3bc47456775a..57fab8eaa923 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -701,16 +701,17 @@ define([ var camera = new Camera(this); this._camera = camera; - this._cameraClone = Camera.clone(camera); this._screenSpaceCameraController = new ScreenSpaceCameraController(this); this._mapMode2D = defaultValue(options.mapMode2D, MapMode2D.INFINITE_SCROLL); - this._frustumChanged = true; if (this._logDepthBuffer) { this._camera.frustum.near = 1.0; this._camera.frustum.far = 10000000000.0; } + this._cameraClone = Camera.clone(camera); + this._frustumChanged = true; + // Keeps track of the state of a frame. FrameState is the state across // the primitives of the scene. This state is for internally keeping track // of celestial and environment effects that need to be updated/rendered in From e029f10d063a4aa706f7b4656d55bc038adaecf5 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 16:24:39 -0400 Subject: [PATCH 050/104] Fix batched classification test. --- Specs/Scene/ClassificationPrimitiveSpec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Specs/Scene/ClassificationPrimitiveSpec.js b/Specs/Scene/ClassificationPrimitiveSpec.js index f4dfa7a5e3ba..20026dfe32a1 100644 --- a/Specs/Scene/ClassificationPrimitiveSpec.js +++ b/Specs/Scene/ClassificationPrimitiveSpec.js @@ -91,7 +91,7 @@ defineSuite([ beforeEach(function() { scene.morphTo3D(0); - rectangle = Rectangle.fromDegrees(-80.0, 20.0, -70.0, 30.0); + rectangle = Rectangle.fromDegrees(-75.0, 25.0, -70.0, 30.0); var depthColorAttribute = ColorGeometryInstanceAttribute.fromColor(new Color(0.0, 0.0, 1.0, 1.0)); depthColor = depthColorAttribute.value; From f14a2cf485c5893d1d6a8c0fdf9cce781106e169 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 16:49:27 -0400 Subject: [PATCH 051/104] Fix inverted classification test. --- Specs/Scene/Vector3DTileGeometrySpec.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Specs/Scene/Vector3DTileGeometrySpec.js b/Specs/Scene/Vector3DTileGeometrySpec.js index 4be21f4c0efd..d9ad9629df3d 100644 --- a/Specs/Scene/Vector3DTileGeometrySpec.js +++ b/Specs/Scene/Vector3DTileGeometrySpec.js @@ -570,7 +570,7 @@ defineSuite([ }); it('renders with inverted classification' + webglMessage, function() { - var radii = new Cartesian3(10.0, 10.0, 1000.0); + var radii = new Cartesian3(100.0, 100.0, 1000.0); var ellipsoids = packEllipsoids([{ modelMatrix : Matrix4.IDENTITY, radii : radii @@ -597,18 +597,16 @@ defineSuite([ batchTable : batchTable })); return loadGeometries(geometry).then(function() { - scene.camera.lookAtTransform(modelMatrix, new Cartesian3(radii.x, 0.0, 1.0)); + scene.camera.lookAtTransform(modelMatrix, new Cartesian3(0.0, 0.0, 1.0)); + expect(scene).toRender([255, 255, 255, 255]); + scene.camera.lookAtTransform(modelMatrix, new Cartesian3(radii.x, 0.0, 1.0)); expect(scene).toRender([255, 0, 0, 255]); scene.invertClassification = true; scene.invertClassificationColor = new Color(0.25, 0.25, 0.25, 1.0); - expect(scene).toRender([64, 0, 0, 255]); - scene.camera.lookAtTransform(modelMatrix, new Cartesian3(0.0, 0.0, 1.0)); - expect(scene).toRender([255, 255, 255, 255]); - scene.invertClassification = false; }); }); From 7c06ec8df7accad3690fdbec6de867f8976d734c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 17:10:10 -0400 Subject: [PATCH 052/104] Fix tests when log depth isn't supported. --- Specs/DataSources/EntityClusterSpec.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Specs/DataSources/EntityClusterSpec.js b/Specs/DataSources/EntityClusterSpec.js index 5cdad2ac453e..57b5706a9dc8 100644 --- a/Specs/DataSources/EntityClusterSpec.js +++ b/Specs/DataSources/EntityClusterSpec.js @@ -30,8 +30,8 @@ defineSuite([ var scene; var cluster; - - var depth = 0.1; + var depth; + var farDepth; beforeAll(function() { scene = createScene({ @@ -86,6 +86,13 @@ defineSuite([ scene.initializeFrame(); scene.render(); + + if (scene.logarithmicDepthBuffer) { + depth = farDepth = 0.1; + } else { + depth = 0.5; + farDepth = 0.9; + } }); afterAll(function() { @@ -508,13 +515,13 @@ defineSuite([ var billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), farDepth); entity = new Entity(); billboard = cluster.getBillboard(entity); billboard.id = entity; billboard.image = createBillboardImage(); - billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); + billboard.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), farDepth); var frameState = scene.frameState; cluster.update(frameState); @@ -552,13 +559,13 @@ defineSuite([ var point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), depth); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(0.0, 0.0), farDepth); entity = new Entity(); point = cluster.getPoint(entity); point.id = entity; point.pixelSize = 1; - point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), depth); + point.position = SceneTransforms.drawingBufferToWgs84Coordinates(scene, new Cartesian2(scene.canvas.clientWidth, scene.canvas.clientHeight), farDepth); var frameState = scene.frameState; cluster.update(frameState); From 5913ffe87c6b3a6e503aff471daf4f9090e389fb Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 12 Mar 2018 19:46:39 -0400 Subject: [PATCH 053/104] Fixes after merge. --- Source/Scene/ClassificationModel.js | 12 ++++---- Source/Scene/Model.js | 44 +++++++++++++++++++++++------ Source/Scene/ModelUtility.js | 34 ++++++++++++---------- 3 files changed, 62 insertions(+), 28 deletions(-) diff --git a/Source/Scene/ClassificationModel.js b/Source/Scene/ClassificationModel.js index eaafe4b0aa5c..2308c1bebdf1 100644 --- a/Source/Scene/ClassificationModel.js +++ b/Source/Scene/ClassificationModel.js @@ -675,7 +675,7 @@ define([ var modelViewProjectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'MODELVIEWPROJECTION'); var uniformDecl; - var computePosition; + var toClip; if (!defined(modelViewProjectionName)) { var projectionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'PROJECTION'); @@ -687,12 +687,14 @@ define([ uniformDecl = 'uniform mat4 ' + modelViewName + ';\n' + 'uniform mat4 ' + projectionName + ';\n'; - computePosition = ' vec4 positionInClipCoords = ' + projectionName + ' * ' + modelViewName + ' * vec4(' + positionName + ', 1.0);\n'; + toClip = projectionName + ' * ' + modelViewName + ' * vec4(' + positionName + ', 1.0)'; } else { uniformDecl = 'uniform mat4 ' + modelViewProjectionName + ';\n'; - computePosition = ' vec4 positionInClipCoords = ' + modelViewProjectionName + ' * vec4(' + positionName + ', 1.0);\n'; + toClip = modelViewProjectionName + ' * vec4(' + positionName + ', 1.0)'; } + var computePosition = ' vec4 positionInClipCoords = ' + toClip + ';\n'; + var vs = 'attribute vec3 ' + positionName + ';\n' + 'attribute float ' + batchIdName + ';\n' + @@ -718,7 +720,7 @@ define([ var drawVS = modifyShader(vs, model._vertexShaderLoaded); var drawFS = modifyShader(fs, model._classificationShaderLoaded); - drawVS = ModelUtility.modifyVertexShaderForLogDepth(gltf, drawVS); + drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClip); drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); model._shaderProgram = { @@ -731,7 +733,7 @@ define([ var pickVS = modifyShader(vs, model._pickVertexShaderLoaded); var pickFS = modifyShader(fs, model._pickFragmentShaderLoaded); - pickVS = ModelUtility.modifyVertexShaderForLogDepth(gltf, pickVS); + pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClip); pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); model._pickShaderProgram = { diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 85990ae8a704..0ac3c0c8046a 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1927,6 +1927,7 @@ define([ var program = model._sourcePrograms[id]; var shaders = model._sourceShaders; var quantizedVertexShaders = model._quantizedVertexShaders; + var toClipCoordinatesGLSL = model._toClipCoordinatesGLSL[id]; var vs = shaders[program.vertexShader].extras._pipeline.source; var fs = shaders[program.fragmentShader].extras._pipeline.source; @@ -1943,6 +1944,9 @@ define([ var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); var drawFS = modifyShader(fs, id, model._fragmentShaderLoaded); + drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL); + drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); + var pickFS, pickVS; if (model.allowPicking) { // PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181 @@ -1952,6 +1956,9 @@ define([ if (!model._pickFragmentShaderLoaded) { pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform'); } + + pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL); + pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); } createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context); } @@ -1960,6 +1967,7 @@ define([ var program = model._sourcePrograms[id]; var shaders = model._sourceShaders; var quantizedVertexShaders = model._quantizedVertexShaders; + var toClipCoordinatesGLSL = model._toClipCoordinatesGLSL[id]; var clippingPlaneCollection = model.clippingPlanes; var addClippingPlaneCode = isClippingEnabled(model); @@ -1982,6 +1990,9 @@ define([ var drawVS = modifyShader(vs, id, model._vertexShaderLoaded); var drawFS = modifyShader(finalFS, id, model._fragmentShaderLoaded); + drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL); + drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); + var pickFS, pickVS; if (model.allowPicking) { // PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181 @@ -1995,6 +2006,9 @@ define([ if (addClippingPlaneCode) { pickFS = modifyShaderForClippingPlanes(pickFS, clippingPlaneCollection); } + + pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL); + pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); } createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context); } @@ -2014,9 +2028,6 @@ define([ } } - drawVS = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, drawVS); - drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS); - model._rendererResources.programs[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : drawVS, @@ -2025,9 +2036,6 @@ define([ }); if (model.allowPicking) { - pickVS = ModelUtility.modifyVertexShaderForLogDepth(model.gltf, pickVS); - pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS); - model._rendererResources.pickPrograms[id] = ShaderProgram.fromCache({ context : context, vertexShaderSource : pickVS, @@ -3314,10 +3322,30 @@ define([ var scene3DOnly = frameState.scene3DOnly; // Retain references to updated source shaders and programs for rebuilding as needed - model._sourcePrograms = model.gltf.programs; - model._sourceShaders = model.gltf.shaders; + var programs = model._sourcePrograms = model.gltf.programs; + var shaders = model._sourceShaders = model.gltf.shaders; model._hasPremultipliedAlpha = hasPremultipliedAlpha(model); + var quantizedVertexShaders = model._quantizedVertexShaders; + var toClipCoordinates = model._toClipCoordinatesGLSL = {}; + for (var id in programs) { + if (programs.hasOwnProperty(id)) { + var program = programs[id]; + var shader = shaders[program.vertexShader].extras._pipeline.source; + if (model.extensionsUsed.WEB3D_quantized_attributes) { + var quantizedVS = quantizedVertexShaders[id]; + if (!defined(quantizedVS)) { + quantizedVS = modifyShaderForQuantizedAttributes(shader, id, model); + quantizedVertexShaders[id] = quantizedVS; + } + shader = quantizedVS; + } + + shader = modifyShader(shader, id, model._vertexShaderLoaded); + toClipCoordinates[id] = ModelUtility.toClipCoordinatesGLSL(model.gltf, shader); + } + } + ModelUtility.checkSupportedGlExtensions(model.gltf.glExtensionsUsed, context); if (model._loadRendererResourcesFromCache) { var resources = model._rendererResources; diff --git a/Source/Scene/ModelUtility.js b/Source/Scene/ModelUtility.js index 09b2d1b8b3bf..7717822aa971 100644 --- a/Source/Scene/ModelUtility.js +++ b/Source/Scene/ModelUtility.js @@ -278,20 +278,7 @@ define([ }; }; - ModelUtility.modifyFragmentShaderForLogDepth = function(shader) { - shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); - shader += - '\n' + - 'void main() \n' + - '{ \n' + - ' czm_depth_main(); \n' + - ' czm_writeLogDepth(); \n' + - '} \n'; - - return shader; - }; - - ModelUtility.modifyVertexShaderForLogDepth = function(gltf, shader) { + ModelUtility.toClipCoordinatesGLSL = function(gltf, shader) { var positionName = ModelUtility.getAttributeOrUniformBySemantic(gltf, 'POSITION'); var decodedPositionName = positionName.replace('a_', 'gltf_a_dec_'); if (shader.indexOf(decodedPositionName) !== -1) { @@ -310,13 +297,30 @@ define([ modelViewProjectionName = projectionName + ' * ' + modelViewName; } + return modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)'; + }; + + ModelUtility.modifyFragmentShaderForLogDepth = function(shader) { + shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); + shader += + '\n' + + 'void main() \n' + + '{ \n' + + ' czm_depth_main(); \n' + + ' czm_writeLogDepth(); \n' + + '} \n'; + + return shader; + }; + + ModelUtility.modifyVertexShaderForLogDepth = function(shader, toClipCoordinatesGLSL) { shader = ShaderSource.replaceMain(shader, 'czm_depth_main'); shader += '\n' + 'void main() \n' + '{ \n' + ' czm_depth_main(); \n' + - ' czm_vertexLogDepth(' + modelViewProjectionName + ' * vec4(' + positionName + '.xyz, 1.0)); \n' + + ' czm_vertexLogDepth(' + toClipCoordinatesGLSL + '); \n' + '} \n'; return shader; From a648dea34554ae068133c11d35f1d0ae25f2691c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 14 Mar 2018 14:50:01 -0400 Subject: [PATCH 054/104] Updates from review. --- Source/Scene/Expression.js | 2 +- Source/Scene/Scene.js | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/Scene/Expression.js b/Source/Scene/Expression.js index 32c8f98f97ab..02a958f6747e 100644 --- a/Source/Scene/Expression.js +++ b/Source/Scene/Expression.js @@ -279,7 +279,7 @@ define([ } function log2(number) { - return CesiumMath.log2(number, 2.0); + return CesiumMath.log2(number); } function getEvaluateUnaryComponentwise(operation) { diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 57fab8eaa923..f6d565f445ff 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -265,9 +265,6 @@ define([ creditViewport = canvas.parentNode; } - this._logDepthBuffer = context.fragmentDepth; - this._logDepthBufferDirty = true; - this._id = createGuid(); this._jobScheduler = new JobScheduler(); this._frameState = new FrameState(context, new CreditDisplay(creditContainer, ' • ', creditViewport), this._jobScheduler); @@ -290,6 +287,10 @@ define([ this._primitives = new PrimitiveCollection(); this._groundPrimitives = new PrimitiveCollection(); + this._logDepthBuffer = undefined; + this._logDepthBufferDirty = true; + this.logarithmicDepthBuffer = context.fragmentDepth; + this._tweens = new TweenCollection(); this._shaderFrameCount = 0; @@ -792,7 +793,7 @@ define([ this.initializeFrame(); } - var OPAQUE_FRUSTUM_NEAR_OFFSET = 0.9; + var OPAQUE_FRUSTUM_NEAR_OFFSET; function updateGlobeListeners(scene, globe) { for (var i = 0; i < scene._removeGlobeCallbacks.length; ++i) { @@ -1402,6 +1403,8 @@ define([ if (this._context.fragmentDepth && this._logDepthBuffer !== value) { this._logDepthBuffer = value; this._logDepthBufferDirty = true; + + OPAQUE_FRUSTUM_NEAR_OFFSET = this._logDepthBuffer ? 0.9 : 0.9999; } } } From b6de470a15681ff472948031cc201fa58fd9aeba Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 19 Mar 2018 18:50:47 -0400 Subject: [PATCH 055/104] Fix translucent overlap. Fix geometry showing through depth plane. Update default near/far distances. --- Source/Scene/DepthPlane.js | 1 + Source/Scene/Scene.js | 3 ++- Source/Shaders/Builtin/Functions/vertexLogDepth.glsl | 2 +- Source/Shaders/Builtin/Functions/writeLogDepth.glsl | 6 +++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Scene/DepthPlane.js b/Source/Scene/DepthPlane.js index d8ea2af635eb..4df50d2663ef 100644 --- a/Source/Scene/DepthPlane.js +++ b/Source/Scene/DepthPlane.js @@ -154,6 +154,7 @@ define([ fs.sources.push(extension); fs.defines.push('LOG_DEPTH'); vs.defines.push('LOG_DEPTH'); + vs.defines.push('DISABLE_GL_POSITION_LOG_DEPTH'); } this._sp = ShaderProgram.replaceCache({ diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index f6d565f445ff..45202b97b57c 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -705,8 +705,9 @@ define([ this._screenSpaceCameraController = new ScreenSpaceCameraController(this); this._mapMode2D = defaultValue(options.mapMode2D, MapMode2D.INFINITE_SCROLL); + this.logarithmicDepthFarToNearRatio = 1000000000.0; if (this._logDepthBuffer) { - this._camera.frustum.near = 1.0; + this._camera.frustum.near = 0.1; this._camera.frustum.far = 10000000000.0; } diff --git a/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl b/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl index 673f4240df54..1a16d725f5ce 100644 --- a/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl +++ b/Source/Shaders/Builtin/Functions/vertexLogDepth.glsl @@ -4,7 +4,7 @@ varying vec3 v_logPositionEC; #endif void czm_updatePositionDepth() { -#ifdef LOG_DEPTH +#if defined(LOG_DEPTH) && !defined(DISABLE_GL_POSITION_LOG_DEPTH) v_logPositionEC = (czm_inverseProjection * gl_Position).xyz; gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0; diff --git a/Source/Shaders/Builtin/Functions/writeLogDepth.glsl b/Source/Shaders/Builtin/Functions/writeLogDepth.glsl index 60a591aad01e..49d01bd2e72f 100644 --- a/Source/Shaders/Builtin/Functions/writeLogDepth.glsl +++ b/Source/Shaders/Builtin/Functions/writeLogDepth.glsl @@ -20,7 +20,11 @@ void czm_writeLogDepth(float logZ) { #if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE) float halfLogFarDistance = czm_logFarDistance * 0.5; - gl_FragDepthEXT = log2(logZ) * halfLogFarDistance; + float depth = log2(logZ); + if (depth < log2(czm_currentFrustum.x)) { + discard; + } + gl_FragDepthEXT = depth * halfLogFarDistance; #endif } From 1525950363bac581a6cb5cbffcb02faa06fb38fa Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 20 Mar 2018 15:31:59 -0400 Subject: [PATCH 056/104] Fix picking depth which had a hardcoded value for the near plane. --- Source/Scene/Scene.js | 9 ++++----- Source/Scene/SceneTransforms.js | 2 +- Source/Scene/SceneTransitioner.js | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 45202b97b57c..d4f6a5da71e4 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -289,7 +289,7 @@ define([ this._logDepthBuffer = undefined; this._logDepthBufferDirty = true; - this.logarithmicDepthBuffer = context.fragmentDepth; + this.logarithmicDepthBuffer = false;//context.fragmentDepth; this._tweens = new TweenCollection(); @@ -469,11 +469,11 @@ define([ this.farToNearRatio = 1000.0; /** - * The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer. The default is 1e6. + * The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer. The default is 1e9. * @type {Number} - * @default 1000000.0 + * @default 1e9 */ - this.logarithmicDepthFarToNearRatio = 1000000.0; + this.logarithmicDepthFarToNearRatio = 1e9; /** * Determines the uniform depth size in meters of each frustum of the multifrustum in 2D. If a primitive or model close @@ -705,7 +705,6 @@ define([ this._screenSpaceCameraController = new ScreenSpaceCameraController(this); this._mapMode2D = defaultValue(options.mapMode2D, MapMode2D.INFINITE_SCROLL); - this.logarithmicDepthFarToNearRatio = 1000000000.0; if (this._logDepthBuffer) { this._camera.frustum.near = 0.1; this._camera.frustum.far = 10000000000.0; diff --git a/Source/Scene/SceneTransforms.js b/Source/Scene/SceneTransforms.js index ce8688e31204..96c32e4f738c 100644 --- a/Source/Scene/SceneTransforms.js +++ b/Source/Scene/SceneTransforms.js @@ -312,7 +312,7 @@ define([ // to perspective form // (far - far * near / z) / (far - near) depth = Math.pow(2.0, depth * CesiumMath.log2(far + 1.0)) - 1.0; - depth = far * (1.0 - 1.0 / depth) / (far - near); + depth = far * (1.0 - near / depth) / (far - near); } var viewport = scene._passState.viewport; diff --git a/Source/Scene/SceneTransitioner.js b/Source/Scene/SceneTransitioner.js index 43dc3dce89ab..5cb7f5b77e9c 100644 --- a/Source/Scene/SceneTransitioner.js +++ b/Source/Scene/SceneTransitioner.js @@ -872,7 +872,7 @@ define([ var frustum = camera.frustum; if (scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum)) { - frustum.near = 1.0; + frustum.near = 0.1; frustum.far = 10000000000.0; } @@ -929,7 +929,7 @@ define([ var frustum = camera.frustum; if (scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum)) { - frustum.near = 1.0; + frustum.near = 0.1; frustum.far = 10000000000.0; } From 6a5a6b0c03cf179a4aae367e339862b8afc2aa9b Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 20 Mar 2018 15:43:46 -0400 Subject: [PATCH 057/104] Fix issue setting enabling/disabling log depth. --- Source/Scene/Scene.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index d4f6a5da71e4..b77f6acd360e 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -289,7 +289,7 @@ define([ this._logDepthBuffer = undefined; this._logDepthBufferDirty = true; - this.logarithmicDepthBuffer = false;//context.fragmentDepth; + this.logarithmicDepthBuffer = context.fragmentDepth; this._tweens = new TweenCollection(); @@ -1400,7 +1400,8 @@ define([ return this._logDepthBuffer; }, set : function(value) { - if (this._context.fragmentDepth && this._logDepthBuffer !== value) { + value = this._context.fragmentDepth && value; + if (this._logDepthBuffer !== value) { this._logDepthBuffer = value; this._logDepthBufferDirty = true; From fb3a2b2fe9ae4e4dce56055cf599d7fd50dcbd5a Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 20 Mar 2018 17:08:33 -0400 Subject: [PATCH 058/104] Fix eslint errors. --- Specs/Scene/MultifrustumSpec.js | 3 ++- Specs/Scene/SceneSpec.js | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Specs/Scene/MultifrustumSpec.js b/Specs/Scene/MultifrustumSpec.js index 8c7da972d5f7..e28a5dd2099b 100644 --- a/Specs/Scene/MultifrustumSpec.js +++ b/Specs/Scene/MultifrustumSpec.js @@ -196,7 +196,8 @@ defineSuite([ var calls = DrawCommand.prototype.execute.calls.all(); var billboardCall; - for (var i = 0; i < calls.length; ++i) { + var i; + for (i = 0; i < calls.length; ++i) { if (calls[i].object.owner instanceof BillboardCollection) { billboardCall = calls[i]; break; diff --git a/Specs/Scene/SceneSpec.js b/Specs/Scene/SceneSpec.js index 333e1a457605..567fc1213ce8 100644 --- a/Specs/Scene/SceneSpec.js +++ b/Specs/Scene/SceneSpec.js @@ -726,8 +726,6 @@ defineSuite([ scene.destroyForSpecs(); }); - var pickedPosition2D = new Cartesian3(-455861.7055871038, -5210523.137686572, 3637866.6638769475); - it('pickPosition', function() { if (!scene.pickPositionSupported) { return; From 530f41d4ac9bb3d3a7f1519abaa830416b9f8591 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 26 Mar 2018 14:22:04 -0400 Subject: [PATCH 059/104] Fix polyline geometry. --- Source/Scene/Scene.js | 52 ++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 47ebfe3793ed..e9f0db0116f3 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -3432,7 +3432,8 @@ define([ return result; } - var logDepthRegex = /\s+czm_writeLogDepth\(/; + var writeLogDepthRegex = /\s+czm_writeLogDepth\(/; + var vertexlogDepthRegex = /\s+czm_vertexLogDepth\(/; var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/; function getLogDepthShaderProgram(context, shaderProgram) { @@ -3447,13 +3448,39 @@ define([ fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; fs.defines.push('LOG_DEPTH'); - var addExtension = true; + var i; + var logMain; var writesLogDepth = false; - var sources = fs.sources; + var sources = vs.sources; var length = sources.length; - var i; for (i = 0; i < length; ++i) { - if (logDepthRegex.test(sources[i])) { + if (vertexlogDepthRegex.test(sources[i])) { + writesLogDepth = true; + break; + } + } + + if (!writesLogDepth) { + for (i = 0; i < length; ++i) { + sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); + } + + logMain = + '\n\n' + + 'void main() \n' + + '{ \n' + + ' czm_log_depth_main(); \n' + + ' czm_vertexLogDepth(); \n' + + '} \n'; + sources.push(logMain); + } + + var addExtension = true; + writesLogDepth = false; + sources = fs.sources; + length = sources.length; + for (i = 0; i < length; ++i) { + if (writeLogDepthRegex.test(sources[i])) { writesLogDepth = true; } if (extensionRegex.test(sources[i])) { @@ -3481,21 +3508,6 @@ define([ ' czm_log_depth_main(); \n' + ' czm_writeLogDepth(); \n' + '} \n'; - - var vertexSources = vs.sources; - length = vertexSources.length; - for (i = 0; i < length; ++i) { - vertexSources[i] = ShaderSource.replaceMain(vertexSources[i], 'czm_log_depth_main'); - } - - var logMain = - '\n\n' + - 'void main() \n' + - '{ \n' + - ' czm_log_depth_main(); \n' + - ' czm_vertexLogDepth(); \n' + - '} \n'; - vertexSources.push(logMain); } sources.push(logSource); From 979b5417993b7c1c1e5b61af64b6129901ed6f6c Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 2 Apr 2018 16:41:21 -0400 Subject: [PATCH 060/104] Update CHANGES.md. --- CHANGES.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 456c661c3070..c74dbf86736a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,13 +1,21 @@ Change Log ========== +### 1.46 - 2018-05-01 + +##### Breaking Changes :mega: +* `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. + +##### Additions :tada: +* Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) +* Added `Math.log2` to compute the base 2 logarithm of a number. + ### 1.44 - 2018-04-02 ##### Breaking Changes :mega: * `GeometryVisualizer` now requires `primitive` and `groundPrimitive` parameters. [#6316](https://github.com/AnalyticalGraphicsInc/cesium/pull/6316) * For all classes/functions that take a `Resource` instance, all additional parameters that are part of the `Resource` class have been removed. This generally includes `proxy`, `headers` and `query` parameters. * All low level load functions including `loadArrayBuffer`, `loadBlob`, `loadImage`, `loadJson`, `loadJsonp`, `loadText`, `loadXML` and `loadWithXhr` have been removed. Please use the equivalent `fetch` functions on the `Resource` class. -* `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. ##### Deprecated :hourglass_flowing_sand: * `ClippingPlaneCollection` is now supported in Internet Explorer, so `ClippingPlaneCollection.isSupported` has been deprecated and will be removed in Cesium 1.45. @@ -38,8 +46,6 @@ Change Log * All ground geometry from one `DataSource` will render in front of all ground geometry from another `DataSource` in the same collection with a lower index. * Use `DataSourceCollection.raise`, `DataSourceCollection.lower`, `DataSourceCollection.raiseToTop` and `DataSourceCollection.lowerToBottom` functions to change the ordering of a `DataSource` in the collection. * Improved processing order of 3D tiles. [#6364](https://github.com/AnalyticalGraphicsInc/cesium/pull/6364) -* Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) -* Added `Math.log2` to compute the base 2 logarithm of a number. ##### Fixes :wrench: * Fixed support of glTF-supplied tangent vectors. [#6302](https://github.com/AnalyticalGraphicsInc/cesium/pull/6302) From 88a8de1a45628394ae6a3c813ee081062a047ec4 Mon Sep 17 00:00:00 2001 From: roderickgreen Date: Mon, 2 Apr 2018 23:02:58 -0400 Subject: [PATCH 061/104] Fixes #3945: Flickering when adding a new polygon entity --- CONTRIBUTORS.md | 2 + .../DataSources/StaticGeometryColorBatch.js | 2 + .../StaticGeometryPerMaterialBatch.js | 2 + .../DataSources/StaticOutlineGeometryBatch.js | 2 + .../StaticGeometryColorBatchSpec.js | 62 ++++++++++++++++ .../StaticGeometryPerMaterialBatchSpec.js | 73 +++++++++++++++++++ .../StaticOutlineGeometryBatchSpec.js | 65 +++++++++++++++++ 7 files changed, 208 insertions(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 6e7bb89fe518..67402d648316 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -102,6 +102,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Natanael Rivera](https://github.com/nrivera-Novetta/) * [Justin Burr](https://github.com/jburr-nc/) * [Jeremy Marzano](https://github.com/JeremyMarzano-ISPA/) +* [Orbit Logic](http://www.orbitlogic.com) + * [Roderick Green](https://github.com/roderickgreen/) ## [Individual CLA](Documentation/Contributors/CLAs/individual-cla-agi-v1.0.txt) * [Victor Berchet](https://github.com/vicb) diff --git a/Source/DataSources/StaticGeometryColorBatch.js b/Source/DataSources/StaticGeometryColorBatch.js index 086ba3a08979..a56555b00428 100644 --- a/Source/DataSources/StaticGeometryColorBatch.js +++ b/Source/DataSources/StaticGeometryColorBatch.js @@ -156,6 +156,7 @@ define([ } primitive = new Primitive({ + show : false, asynchronous : true, geometryInstances : geometries, appearance : new this.appearanceType({ @@ -184,6 +185,7 @@ define([ this.createPrimitive = false; this.waitingOnCreate = true; } else if (defined(primitive) && primitive.ready) { + primitive.show = true; if (defined(this.oldPrimitive)) { primitives.remove(this.oldPrimitive); this.oldPrimitive = undefined; diff --git a/Source/DataSources/StaticGeometryPerMaterialBatch.js b/Source/DataSources/StaticGeometryPerMaterialBatch.js index 792e0e0f7c49..e39eb7042240 100644 --- a/Source/DataSources/StaticGeometryPerMaterialBatch.js +++ b/Source/DataSources/StaticGeometryPerMaterialBatch.js @@ -153,6 +153,7 @@ define([ } primitive = new Primitive({ + show : false, asynchronous : true, geometryInstances : geometries, appearance : new this.appearanceType({ @@ -182,6 +183,7 @@ define([ this.primitive = primitive; this.createPrimitive = false; } else if (defined(primitive) && primitive.ready) { + primitive.show = true; if (defined(this.oldPrimitive)) { primitives.remove(this.oldPrimitive); this.oldPrimitive = undefined; diff --git a/Source/DataSources/StaticOutlineGeometryBatch.js b/Source/DataSources/StaticOutlineGeometryBatch.js index 20e0a558590b..ff882923f7a1 100644 --- a/Source/DataSources/StaticOutlineGeometryBatch.js +++ b/Source/DataSources/StaticOutlineGeometryBatch.js @@ -111,6 +111,7 @@ define([ } primitive = new Primitive({ + show : false, asynchronous : true, geometryInstances : geometries, appearance : new PerInstanceColorAppearance({ @@ -142,6 +143,7 @@ define([ this.createPrimitive = false; this.waitingOnCreate = true; } else if (defined(primitive) && primitive.ready) { + primitive.show = true; if (defined(this.oldPrimitive)) { primitives.remove(this.oldPrimitive); this.oldPrimitive = undefined; diff --git a/Specs/DataSources/StaticGeometryColorBatchSpec.js b/Specs/DataSources/StaticGeometryColorBatchSpec.js index 92a2e3c99b5d..3586a6d036f2 100644 --- a/Specs/DataSources/StaticGeometryColorBatchSpec.js +++ b/Specs/DataSources/StaticGeometryColorBatchSpec.js @@ -274,4 +274,66 @@ defineSuite([ batch.removeAllPrimitives(); }); }); + + it('shows only one primitive while rebuilding primitive', function() { + var batch = new StaticGeometryColorBatch(scene.primitives, PerInstanceColorAppearance, undefined, false, ShadowMode.DISABLED); + + function buildEntity() { + return new Entity({ + position : new Cartesian3(1234, 5678, 9101112), + ellipse : { + semiMajorAxis : 2, + semiMinorAxis : 1, + material : Color.RED.withAlpha(0.5), + height : 0 + } + }); + } + + function renderScene() { + scene.initializeFrame(); + var isUpdated = batch.update(time); + scene.render(time); + return isUpdated; + } + + var entity1 = buildEntity(); + var entity2 = buildEntity(); + + var updater1 = new EllipseGeometryUpdater(entity1, scene); + var updater2 = new EllipseGeometryUpdater(entity2, scene); + + batch.add(time, updater1); + return pollToPromise(renderScene) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + }) + .then(function() { + batch.add(time, updater2); + }) + .then(function() { + return pollToPromise(function() { + renderScene(); + return scene.primitives.length === 2; + }); + }) + .then(function() { + var showCount = 0; + expect(scene.primitives.length).toEqual(2); + showCount += !!scene.primitives.get(0).show; + showCount += !!scene.primitives.get(1).show; + expect(showCount).toEqual(1); + }) + .then(function() { + return pollToPromise(renderScene); + }) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + batch.removeAllPrimitives(); + }); + }); }); diff --git a/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js b/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js index bd80c13c6ca1..c1464f6b350f 100644 --- a/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js +++ b/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js @@ -1,5 +1,6 @@ defineSuite([ 'DataSources/StaticGeometryPerMaterialBatch', + 'Core/Cartesian2', 'Core/Cartesian3', 'Core/Color', 'Core/DistanceDisplayCondition', @@ -26,6 +27,7 @@ defineSuite([ 'Specs/pollToPromise' ], function( StaticGeometryPerMaterialBatch, + Cartesian2, Cartesian3, Color, DistanceDisplayCondition, @@ -240,4 +242,75 @@ defineSuite([ batch.removeAllPrimitives(); }); }); + + it('shows only one primitive while rebuilding primitive', function() { + var batch = new StaticGeometryPerMaterialBatch(scene.primitives, MaterialAppearance, undefined, false, ShadowMode.DISABLED); + + function buildEntity() { + var material = new GridMaterialProperty({ + color : Color.YELLOW, + cellAlpha : 0.3, + lineCount : new Cartesian2(8, 8), + lineThickness : new Cartesian2(2.0, 2.0) + }); + + return new Entity({ + position : new Cartesian3(1234, 5678, 9101112), + ellipse : { + semiMajorAxis : 2, + semiMinorAxis : 1, + height : 0, + material: material + } + }); + } + + function renderScene() { + scene.initializeFrame(); + var isUpdated = batch.update(time); + scene.render(time); + return isUpdated; + } + + var entity1 = buildEntity(); + var entity2 = buildEntity(); + + var updater1 = new EllipseGeometryUpdater(entity1, scene); + var updater2 = new EllipseGeometryUpdater(entity2, scene); + + batch.add(time, updater1); + return pollToPromise(renderScene) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + }) + .then(function() { + batch.add(time, updater2); + }) + .then(function() { + return pollToPromise(function() { + renderScene(); + return scene.primitives.length === 2; + }); + }) + .then(function() { + var showCount = 0; + expect(scene.primitives.length).toEqual(2); + showCount += !!scene.primitives.get(0).show; + showCount += !!scene.primitives.get(1).show; + expect(showCount).toEqual(1); + }) + + .then(function() { + return pollToPromise(renderScene); + }) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + + batch.removeAllPrimitives(); + }); + }); }); diff --git a/Specs/DataSources/StaticOutlineGeometryBatchSpec.js b/Specs/DataSources/StaticOutlineGeometryBatchSpec.js index 35ae2727939b..dd90cc876c5a 100644 --- a/Specs/DataSources/StaticOutlineGeometryBatchSpec.js +++ b/Specs/DataSources/StaticOutlineGeometryBatchSpec.js @@ -184,4 +184,69 @@ defineSuite([ batch.removeAllPrimitives(); }); }); + + it('shows only one primitive while rebuilding primitive', function() { + var batch = new StaticOutlineGeometryBatch(scene.primitives, scene, false, ShadowMode.DISABLED); + + function buildEntity() { + return new Entity({ + position : new Cartesian3(1234, 5678, 9101112), + ellipse : { + semiMajorAxis : 2, + semiMinorAxis : 1, + height : 0, + outline : true, + outlineColor : Color.RED.withAlpha(0.5) + } + }); + } + + function renderScene() { + scene.initializeFrame(); + var isUpdated = batch.update(time); + scene.render(time); + return isUpdated; + } + + var entity1 = buildEntity(); + var entity2 = buildEntity(); + + var updater1 = new EllipseGeometryUpdater(entity1, scene); + var updater2 = new EllipseGeometryUpdater(entity2, scene); + + batch.add(time, updater1); + return pollToPromise(renderScene) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + }) + .then(function() { + batch.add(time, updater2); + }) + .then(function() { + return pollToPromise(function() { + renderScene(); + return scene.primitives.length === 2; + }); + }) + .then(function() { + var showCount = 0; + expect(scene.primitives.length).toEqual(2); + showCount += !!scene.primitives.get(0).show; + showCount += !!scene.primitives.get(1).show; + expect(showCount).toEqual(1); + }) + + .then(function() { + return pollToPromise(renderScene); + }) + .then(function() { + expect(scene.primitives.length).toEqual(1); + var primitive = scene.primitives.get(0); + expect(primitive.show).toBeTruthy(); + + batch.removeAllPrimitives(); + }); + }); }); From 4dd219ffb9edac9c605070fe63b4418f57a71226 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 5 Apr 2018 14:23:59 -0400 Subject: [PATCH 062/104] Fix Draco compressed models. --- Source/Scene/Model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 74c6d78a140d..9aa1769fef2d 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -3390,7 +3390,7 @@ define([ if (programs.hasOwnProperty(id)) { var program = programs[id]; var shader = shaders[program.vertexShader].extras._pipeline.source; - if (model.extensionsUsed.WEB3D_quantized_attributes) { + if (model.extensionsUsed.WEB3D_quantized_attributes || model._dequantizeInShader) { var quantizedVS = quantizedVertexShaders[id]; if (!defined(quantizedVS)) { quantizedVS = modifyShaderForQuantizedAttributes(shader, id, model); From b5f83d9e360575a843e3c98fadaf1dd8e8e67199 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 5 Apr 2018 14:38:43 -0400 Subject: [PATCH 063/104] Update CHANGES.md --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c74dbf86736a..5464839e5a7f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,13 +1,14 @@ Change Log ========== -### 1.46 - 2018-05-01 +### 1.45 - 2018-05-01 ##### Breaking Changes :mega: * `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. ##### Additions :tada: * Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) +* When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. * Added `Math.log2` to compute the base 2 logarithm of a number. ### 1.44 - 2018-04-02 From d546e45fa788e4a32d3f453837639ddfdb3144bd Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 5 Apr 2018 15:22:34 -0400 Subject: [PATCH 064/104] Move derived commands to own class. --- Source/Scene/DerivedCommand.js | 217 +++++++++++++++++++++++++++++ Source/Scene/OIT.js | 12 +- Source/Scene/Scene.js | 246 +++++---------------------------- 3 files changed, 256 insertions(+), 219 deletions(-) create mode 100644 Source/Scene/DerivedCommand.js diff --git a/Source/Scene/DerivedCommand.js b/Source/Scene/DerivedCommand.js new file mode 100644 index 000000000000..9a8c77dcdf18 --- /dev/null +++ b/Source/Scene/DerivedCommand.js @@ -0,0 +1,217 @@ +define([ + '../Core/defined', + '../Renderer/DrawCommand', + '../Renderer/RenderState', + '../Renderer/ShaderSource' + ], function( + defined, + DrawCommand, + RenderState, + ShaderSource) { + 'use strict'; + + /** + * @private + */ + function DerivedCommand() {} + + var fragDepthRegex = /\bgl_FragDepthEXT\b/; + var discardRegex = /\bdiscard\b/; + + function getDepthOnlyShaderProgram(context, shaderProgram) { + var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'depthOnly'); + if (!defined(shader)) { + var attributeLocations = shaderProgram._attributeLocations; + var fs = shaderProgram.fragmentShaderSource; + + var writesDepthOrDiscards = false; + var sources = fs.sources; + var length = sources.length; + for (var i = 0; i < length; ++i) { + if (fragDepthRegex.test(sources[i]) || discardRegex.test(sources[i])) { + writesDepthOrDiscards = true; + break; + } + } + + if (!writesDepthOrDiscards) { + fs = new ShaderSource({ + sources : ['void main() { gl_FragColor = vec4(1.0); }'] + }); + } + + shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'depthOnly', { + vertexShaderSource : shaderProgram.vertexShaderSource, + fragmentShaderSource : fs, + attributeLocations : attributeLocations + }); + } + + return shader; + } + + function getDepthOnlyRenderState(scene, renderState) { + var cache = scene._depthOnlyRenderStateCache; + var depthOnlyState = cache[renderState.id]; + if (!defined(depthOnlyState)) { + var rs = RenderState.getState(renderState); + rs.depthMask = true; + rs.colorMask = { + red : false, + green : false, + blue : false, + alpha : false + }; + + depthOnlyState = RenderState.fromCache(rs); + cache[renderState.id] = depthOnlyState; + } + + return depthOnlyState; + } + + DerivedCommand.createDepthOnlyDerivedCommand = function(scene, command, context, result) { + // For a depth only pass, we bind a framebuffer with only a depth attachment (no color attachments), + // do not write color, and write depth. If the fragment shader doesn't modify the fragment depth + // or discard, the driver can replace the fragment shader with a pass-through shader. We're unsure if this + // actually happens so we modify the shader to use a pass-through fragment shader. + + if (!defined(result)) { + result = {}; + } + + var shader; + var renderState; + if (defined(result.depthOnlyCommand)) { + shader = result.depthOnlyCommand.shaderProgram; + renderState = result.depthOnlyCommand.renderState; + } + + result.depthOnlyCommand = DrawCommand.shallowClone(command, result.depthOnlyCommand); + + if (!defined(shader) || result.shaderProgramId !== command.shaderProgram.id) { + result.depthOnlyCommand.shaderProgram = getDepthOnlyShaderProgram(context, command.shaderProgram); + result.depthOnlyCommand.renderState = getDepthOnlyRenderState(scene, command.renderState); + result.shaderProgramId = command.shaderProgram.id; + } else { + result.depthOnlyCommand.shaderProgram = shader; + result.depthOnlyCommand.renderState = renderState; + } + + return result; + }; + + var writeLogDepthRegex = /\s+czm_writeLogDepth\(/; + var vertexlogDepthRegex = /\s+czm_vertexLogDepth\(/; + var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/; + + function getLogDepthShaderProgram(context, shaderProgram) { + var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); + if (!defined(shader)) { + var attributeLocations = shaderProgram._attributeLocations; + var vs = shaderProgram.vertexShaderSource.clone(); + var fs = shaderProgram.fragmentShaderSource.clone(); + + vs.defines = defined(vs.defines) ? vs.defines.slice(0) : []; + vs.defines.push('LOG_DEPTH'); + fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; + fs.defines.push('LOG_DEPTH'); + + var i; + var logMain; + var writesLogDepth = false; + var sources = vs.sources; + var length = sources.length; + for (i = 0; i < length; ++i) { + if (vertexlogDepthRegex.test(sources[i])) { + writesLogDepth = true; + break; + } + } + + if (!writesLogDepth) { + for (i = 0; i < length; ++i) { + sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); + } + + logMain = + '\n\n' + + 'void main() \n' + + '{ \n' + + ' czm_log_depth_main(); \n' + + ' czm_vertexLogDepth(); \n' + + '} \n'; + sources.push(logMain); + } + + var addExtension = true; + writesLogDepth = false; + sources = fs.sources; + length = sources.length; + for (i = 0; i < length; ++i) { + if (writeLogDepthRegex.test(sources[i])) { + writesLogDepth = true; + } + if (extensionRegex.test(sources[i])) { + addExtension = false; + } + } + + var logSource = ''; + if (addExtension) { + logSource += + '#ifdef GL_EXT_frag_depth \n' + + '#extension GL_EXT_frag_depth : enable \n' + + '#endif \n\n'; + } + + if (!writesLogDepth) { + for (i = 0; i < length; i++) { + sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); + } + + logSource += + '\n' + + 'void main() \n' + + '{ \n' + + ' czm_log_depth_main(); \n' + + ' czm_writeLogDepth(); \n' + + '} \n'; + } + + sources.push(logSource); + + shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'logDepth', { + vertexShaderSource : vs, + fragmentShaderSource : fs, + attributeLocations : attributeLocations + }); + } + + return shader; + } + + DerivedCommand.createLogDepthCommand = function(command, context, result) { + if (!defined(result)) { + result = {}; + } + + var shader; + if (defined(result.command)) { + shader = result.command.shaderProgram; + } + + result.command = DrawCommand.shallowClone(command, result.command); + + if (!defined(shader) || result.shaderProgramId !== command.shaderProgram.id) { + result.command.shaderProgram = getLogDepthShaderProgram(context, command.shaderProgram); + result.shaderProgramId = command.shaderProgram.id; + } else { + result.command.shaderProgram = shader; + } + + return result; + }; + + return DerivedCommand; +}); diff --git a/Source/Scene/OIT.js b/Source/Scene/OIT.js index c7e0746c363b..88592c369d14 100644 --- a/Source/Scene/OIT.js +++ b/Source/Scene/OIT.js @@ -554,14 +554,14 @@ define([ for (j = 0; j < length; ++j) { command = commands[j]; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } @@ -570,14 +570,14 @@ define([ for (j = 0; j < length; ++j) { command = commands[j]; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.alphaCommand : command.derivedCommands.oit.alphaCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } @@ -603,14 +603,14 @@ define([ for (var j = 0; j < length; ++j) { command = commands[j]; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } if (defined(invertClassification)) { command = invertClassification.unclassifiedCommand; - command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.logDepthCommand : command; + command = defined(command.derivedCommands.logDepth) ? command.derivedCommands.logDepth.command : command; derivedCommand = (shadowsEnabled && command.receiveShadows) ? command.derivedCommands.oit.shadows.translucentCommand : command.derivedCommands.oit.translucentCommand; executeFunction(derivedCommand, scene, context, passState, debugFramebuffer); } diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index 5f7496a0e314..ef15edd788ae 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -55,6 +55,7 @@ define([ './CreditDisplay', './DebugCameraPrimitive', './DepthPlane', + './DerivedCommand', './DeviceOrientationCameraController', './Fog', './FrameState', @@ -134,6 +135,7 @@ define([ CreditDisplay, DebugCameraPrimitive, DepthPlane, + DerivedCommand, DeviceOrientationCameraController, Fog, FrameState, @@ -287,9 +289,8 @@ define([ this._primitives = new PrimitiveCollection(); this._groundPrimitives = new PrimitiveCollection(); - this._logDepthBuffer = undefined; + this._logDepthBuffer = context.fragmentDepth; this._logDepthBufferDirty = true; - this.logarithmicDepthBuffer = context.fragmentDepth; this._tweens = new TweenCollection(); @@ -461,7 +462,12 @@ define([ this.morphTime = 1.0; /** - * The far-to-near ratio of the multi-frustum. The default is 1,000.0. + * The far-to-near ratio of the multi-frustum when using a normal depth buffer. + *

+ * This value is used to create the near and far values for each frustum of the multi-frustum. It is only used + * when {@link Scene#logarithmicDepthBuffer} is false. When logarithmicDepthBuffer is + * true, use {@link Scene#logarithmicDepthFarToNearRatio}. + *

* * @type {Number} * @default 1000.0 @@ -469,7 +475,13 @@ define([ this.farToNearRatio = 1000.0; /** - * The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer. The default is 1e9. + * The far-to-near ratio of the multi-frustum when using a logarithmic depth buffer. + *

+ * This value is used to create the near and far values for each frustum of the multi-frustum. It is only used + * when {@link Scene#logarithmicDepthBuffer} is true. When logarithmicDepthBuffer is + * false, use {@link Scene#farToNearRatio}. + *

+ * * @type {Number} * @default 1e9 */ @@ -478,7 +490,8 @@ define([ /** * Determines the uniform depth size in meters of each frustum of the multifrustum in 2D. If a primitive or model close * to the surface shows z-fighting, decreasing this will eliminate the artifact, but decrease performance. On the - * other hand, increasing this will increase performance but may cause z-fighting among primitives close to thesurface. + * other hand, increasing this will increase performance but may cause z-fighting among primitives close to the surface. + * * @type {Number} * @default 1.75e6 */ @@ -793,8 +806,6 @@ define([ this.initializeFrame(); } - var OPAQUE_FRUSTUM_NEAR_OFFSET; - function updateGlobeListeners(scene, globe) { for (var i = 0; i < scene._removeGlobeCallbacks.length; ++i) { scene._removeGlobeCallbacks[i](); @@ -1404,10 +1415,17 @@ define([ if (this._logDepthBuffer !== value) { this._logDepthBuffer = value; this._logDepthBufferDirty = true; - - OPAQUE_FRUSTUM_NEAR_OFFSET = this._logDepthBuffer ? 0.9 : 0.9999; } } + }, + + /** + * @private + */ + opaqueFrustumNearOffset : { + get : function() { + return this._logDepthBuffer ? 0.9 : 0.9999; + } } }); @@ -1469,8 +1487,8 @@ define([ var logDepthCommand; var logDepthDerivedCommands; if (useLogDepth) { - derivedCommands.logDepth = createLogDepthCommand(command, context, derivedCommands.logDepth); - logDepthCommand = derivedCommands.logDepth.logDepthCommand; + derivedCommands.logDepth = DerivedCommand.createLogDepthCommand(command, context, derivedCommands.logDepth); + logDepthCommand = derivedCommands.logDepth.command; logDepthDerivedCommands = logDepthCommand.derivedCommands; } else { derivedCommands.logDepth = undefined; @@ -1502,7 +1520,7 @@ define([ } } - derivedCommands.depth = createDepthOnlyDerivedCommand(scene, command, context, derivedCommands.depth); + derivedCommands.depth = DerivedCommand.createDepthOnlyDerivedCommand(scene, command, context, derivedCommands.depth); } } @@ -1908,7 +1926,7 @@ define([ var lightShadowsEnabled = shadowsEnabled && (scene.frameState.shadowHints.lightShadowMaps.length > 0); if (scene._logDepthBuffer && defined(command.derivedCommands.logDepth)) { - command = command.derivedCommands.logDepth.logDepthCommand; + command = command.derivedCommands.logDepth.command; } if (scene.debugShowCommands || scene.debugShowFrustums) { @@ -2156,7 +2174,7 @@ define([ us.updateFrustum(frustum); } else { // Avoid tearing artifacts between adjacent frustums in the opaque passes - frustum.near = index !== 0 ? frustumCommands.near * OPAQUE_FRUSTUM_NEAR_OFFSET : frustumCommands.near; + frustum.near = index !== 0 ? frustumCommands.near * scene.opaqueFrustumNearOffset : frustumCommands.near; frustum.far = frustumCommands.far; us.updateFrustum(frustum); } @@ -3346,204 +3364,6 @@ define([ return object; }; - var fragDepthRegex = /\bgl_FragDepthEXT\b/; - var discardRegex = /\bdiscard\b/; - - function getDepthOnlyShaderProgram(context, shaderProgram) { - var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'depthOnly'); - if (!defined(shader)) { - var attributeLocations = shaderProgram._attributeLocations; - var fs = shaderProgram.fragmentShaderSource; - - var writesDepthOrDiscards = false; - var sources = fs.sources; - var length = sources.length; - for (var i = 0; i < length; ++i) { - if (fragDepthRegex.test(sources[i]) || discardRegex.test(sources[i])) { - writesDepthOrDiscards = true; - break; - } - } - - if (!writesDepthOrDiscards) { - fs = new ShaderSource({ - sources : ['void main() { gl_FragColor = vec4(1.0); }'] - }); - } - - shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'depthOnly', { - vertexShaderSource : shaderProgram.vertexShaderSource, - fragmentShaderSource : fs, - attributeLocations : attributeLocations - }); - } - - return shader; - } - - function getDepthOnlyRenderState(scene, renderState) { - var cache = scene._depthOnlyRenderStateCache; - var depthOnlyState = cache[renderState.id]; - if (!defined(depthOnlyState)) { - var rs = RenderState.getState(renderState); - rs.depthMask = true; - rs.colorMask = { - red : false, - green : false, - blue : false, - alpha : false - }; - - depthOnlyState = RenderState.fromCache(rs); - cache[renderState.id] = depthOnlyState; - } - - return depthOnlyState; - } - - function createDepthOnlyDerivedCommand(scene, command, context, result) { - // For a depth only pass, we bind a framebuffer with only a depth attachment (no color attachments), - // do not write color, and write depth. If the fragment shader doesn't modify the fragment depth - // or discard, the driver can replace the fragment shader with a pass-through shader. We're unsure if this - // actually happens so we modify the shader to use a pass-through fragment shader. - - if (!defined(result)) { - result = {}; - } - - var shader; - var renderState; - if (defined(result.depthOnlyCommand)) { - shader = result.depthOnlyCommand.shaderProgram; - renderState = result.depthOnlyCommand.renderState; - } - - result.depthOnlyCommand = DrawCommand.shallowClone(command, result.depthOnlyCommand); - - if (!defined(shader) || result.shaderProgramId !== command.shaderProgram.id) { - result.depthOnlyCommand.shaderProgram = getDepthOnlyShaderProgram(context, command.shaderProgram); - result.depthOnlyCommand.renderState = getDepthOnlyRenderState(scene, command.renderState); - result.shaderProgramId = command.shaderProgram.id; - } else { - result.depthOnlyCommand.shaderProgram = shader; - result.depthOnlyCommand.renderState = renderState; - } - - return result; - } - - var writeLogDepthRegex = /\s+czm_writeLogDepth\(/; - var vertexlogDepthRegex = /\s+czm_vertexLogDepth\(/; - var extensionRegex = /\s*#extension\s+GL_EXT_frag_depth\s*:\s*enable/; - - function getLogDepthShaderProgram(context, shaderProgram) { - var shader = context.shaderCache.getDerivedShaderProgram(shaderProgram, 'logDepth'); - if (!defined(shader)) { - var attributeLocations = shaderProgram._attributeLocations; - var vs = shaderProgram.vertexShaderSource.clone(); - var fs = shaderProgram.fragmentShaderSource.clone(); - - vs.defines = defined(vs.defines) ? vs.defines.slice(0) : []; - vs.defines.push('LOG_DEPTH'); - fs.defines = defined(fs.defines) ? fs.defines.slice(0) : []; - fs.defines.push('LOG_DEPTH'); - - var i; - var logMain; - var writesLogDepth = false; - var sources = vs.sources; - var length = sources.length; - for (i = 0; i < length; ++i) { - if (vertexlogDepthRegex.test(sources[i])) { - writesLogDepth = true; - break; - } - } - - if (!writesLogDepth) { - for (i = 0; i < length; ++i) { - sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); - } - - logMain = - '\n\n' + - 'void main() \n' + - '{ \n' + - ' czm_log_depth_main(); \n' + - ' czm_vertexLogDepth(); \n' + - '} \n'; - sources.push(logMain); - } - - var addExtension = true; - writesLogDepth = false; - sources = fs.sources; - length = sources.length; - for (i = 0; i < length; ++i) { - if (writeLogDepthRegex.test(sources[i])) { - writesLogDepth = true; - } - if (extensionRegex.test(sources[i])) { - addExtension = false; - } - } - - var logSource = ''; - if (addExtension) { - logSource += - '#ifdef GL_EXT_frag_depth \n' + - '#extension GL_EXT_frag_depth : enable \n' + - '#endif \n\n'; - } - - if (!writesLogDepth) { - for (i = 0; i < length; i++) { - sources[i] = ShaderSource.replaceMain(sources[i], 'czm_log_depth_main'); - } - - logSource += - '\n' + - 'void main() \n' + - '{ \n' + - ' czm_log_depth_main(); \n' + - ' czm_writeLogDepth(); \n' + - '} \n'; - } - - sources.push(logSource); - - shader = context.shaderCache.createDerivedShaderProgram(shaderProgram, 'logDepth', { - vertexShaderSource : vs, - fragmentShaderSource : fs, - attributeLocations : attributeLocations - }); - } - - return shader; - } - - function createLogDepthCommand(command, context, result) { - if (!defined(result)) { - result = {}; - } - - var shader; - if (defined(result.logDepthCommand)) { - shader = result.logDepthCommand.shaderProgram; - } - - result.logDepthCommand = DrawCommand.shallowClone(command, result.logDepthCommand); - - if (!defined(shader) || result.shaderProgramId !== command.shaderProgram.id) { - result.logDepthCommand.shaderProgram = getLogDepthShaderProgram(context, command.shaderProgram); - result.shaderProgramId = command.shaderProgram.id; - } else { - result.logDepthCommand.shaderProgram = shader; - } - - return result; - } - function renderTranslucentDepthForPick(scene, drawingBufferPosition) { // PERFORMANCE_IDEA: render translucent only and merge with the previous frame var context = scene._context; @@ -3694,7 +3514,7 @@ define([ uniformState.update(this.frameState); uniformState.updateFrustum(frustum); } else { - frustum.near = renderedFrustum.near * (i !== 0 ? OPAQUE_FRUSTUM_NEAR_OFFSET : 1.0); + frustum.near = renderedFrustum.near * (i !== 0 ? this.opaqueFrustumNearOffset : 1.0); frustum.far = renderedFrustum.far; uniformState.updateFrustum(frustum); } From e17dbcc2702cd67ad4e792b347c4ca1b2d73f30d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Thu, 5 Apr 2018 15:39:31 -0400 Subject: [PATCH 065/104] Update multi-frustum tests. --- Specs/Renderer/AutomaticUniformSpec.js | 11 +++++++++++ Specs/Scene/MultifrustumSpec.js | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/Specs/Renderer/AutomaticUniformSpec.js b/Specs/Renderer/AutomaticUniformSpec.js index 72baabf820d2..f439c7e1af6a 100644 --- a/Specs/Renderer/AutomaticUniformSpec.js +++ b/Specs/Renderer/AutomaticUniformSpec.js @@ -1307,4 +1307,15 @@ defineSuite([ }).contextToRender(); }); + it('has czm_logFarDistance', function() { + var fs = + 'void main() {' + + ' gl_FragColor = vec4(czm_logFarDistance == (2.0 / log2(czm_currentFrustum.y + 1.0)));' + + '}'; + expect({ + context : context, + fragmentShader : fs + }).contextToRender(); + }); + }, 'WebGL'); diff --git a/Specs/Scene/MultifrustumSpec.js b/Specs/Scene/MultifrustumSpec.js index e28a5dd2099b..2bb926965d0d 100644 --- a/Specs/Scene/MultifrustumSpec.js +++ b/Specs/Scene/MultifrustumSpec.js @@ -63,7 +63,13 @@ defineSuite([ var blueImage; var whiteImage; + var logDepth; + beforeAll(function() { + scene = createScene(); + logDepth = scene.logarithmicDepthBuffer; + scene.destroyForSpecs(); + return when.join( Resource.fetchImage('./Data/Images/Green.png').then(function(image) { greenImage = image; @@ -81,6 +87,8 @@ defineSuite([ context = scene.context; primitives = scene.primitives; + scene.logarithmicDepthBuffer = false; + var camera = scene.camera; camera.position = new Cartesian3(); camera.direction = Cartesian3.negate(Cartesian3.UNIT_Z, new Cartesian3()); @@ -350,4 +358,19 @@ defineSuite([ createBillboards(); scene.renderForSpecs(); }); + + it('log depth uses less frustums', function() { + if (!logDepth) { + return; + } + + createBillboards(); + + scene.render(); + expect(scene._frustumCommandsList.length).toEqual(3); + + scene.logarithmicDepthBuffer = true; + scene.render(); + expect(scene._frustumCommandsList.length).toEqual(1); + }); }, 'WebGL'); From d6de977ac44fbaf6438476559e0596eca9c5336a Mon Sep 17 00:00:00 2001 From: Roderick Green Date: Thu, 5 Apr 2018 16:14:55 -0400 Subject: [PATCH 066/104] apply polygon flicker fix to StaticGroundGeometryColorBatch --- .../StaticGroundGeometryColorBatch.js | 2 + .../StaticGroundGeometryColorBatchSpec.js | 68 +++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/Source/DataSources/StaticGroundGeometryColorBatch.js b/Source/DataSources/StaticGroundGeometryColorBatch.js index c41ae6d881d6..9dcfc20bfde6 100644 --- a/Source/DataSources/StaticGroundGeometryColorBatch.js +++ b/Source/DataSources/StaticGroundGeometryColorBatch.js @@ -111,6 +111,7 @@ define([ } primitive = new GroundPrimitive({ + show : false, asynchronous : true, geometryInstances : geometries, classificationType : this.classificationType @@ -134,6 +135,7 @@ define([ this.createPrimitive = false; this.waitingOnCreate = true; } else if (defined(primitive) && primitive.ready) { + primitive.show = true; if (defined(this.oldPrimitive)) { primitives.remove(this.oldPrimitive); this.oldPrimitive = undefined; diff --git a/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js b/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js index 4216a08e2455..d1d471a35e44 100644 --- a/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js +++ b/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js @@ -169,4 +169,72 @@ defineSuite([ batch.removeAllPrimitives(); }); }); + + it('shows only one primitive while rebuilding primitive', function() { + if (!GroundPrimitive.isSupported(scene)) { + return; + } + + var batch = new StaticGroundGeometryColorBatch(scene.groundPrimitives, ClassificationType.BOTH); + function buildEntity() { + return new Entity({ + position : new Cartesian3(1234, 5678, 9101112), + ellipse : { + semiMajorAxis : 2, + semiMinorAxis : 1, + height : 0, + outline : true, + outlineColor : Color.RED.withAlpha(0.5) + } + }); + } + + function renderScene() { + scene.initializeFrame(); + var isUpdated = batch.update(time); + scene.render(time); + return isUpdated; + } + + var entity1 = buildEntity(); + var entity2 = buildEntity(); + + var updater1 = new EllipseGeometryUpdater(entity1, scene); + var updater2 = new EllipseGeometryUpdater(entity2, scene); + + batch.add(time, updater1); + return pollToPromise(renderScene) + .then(function() { + expect(scene.groundPrimitives.length).toEqual(1); + var primitive = scene.groundPrimitives.get(0); + expect(primitive.show).toBeTruthy(); + }) + .then(function() { + batch.add(time, updater2); + }) + .then(function() { + return pollToPromise(function() { + renderScene(); + return scene.groundPrimitives.length === 2; + }); + }) + .then(function() { + var showCount = 0; + expect(scene.groundPrimitives.length).toEqual(2); + showCount += !!scene.groundPrimitives.get(0).show; + showCount += !!scene.groundPrimitives.get(1).show; + expect(showCount).toEqual(1); + }) + + .then(function() { + return pollToPromise(renderScene); + }) + .then(function() { + expect(scene.groundPrimitives.length).toEqual(1); + var primitive = scene.groundPrimitives.get(0); + expect(primitive.show).toBeTruthy(); + + batch.removeAllPrimitives(); + }); + }); }); From 6e9fc3e6446e5b261f6e943859f867c54bc6269d Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 9 Apr 2018 09:13:06 -0400 Subject: [PATCH 067/104] Use eye coordinates instead of window coordinates in the billboard vertex shader. --- Source/Shaders/BillboardCollectionVS.glsl | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index cf0f97840e3d..039bd3323928 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -71,23 +71,23 @@ vec4 computePositionWindowCoordinates(vec4 positionEC, vec2 imageSize, float sca positionEC.xy += halfSize; } - vec4 positionWC = czm_eyeToWindowCoordinates(positionEC); + float mpp = czm_metersPerPixel(positionEC); - if (sizeInMeters) + if (!sizeInMeters) { - originTranslate /= czm_metersPerPixel(positionEC); + originTranslate *= mpp; } - positionWC.xy += originTranslate; + positionEC.xy += originTranslate; if (!sizeInMeters) { - positionWC.xy += halfSize; + positionEC.xy += halfSize * mpp; } - positionWC.xy += translate; - positionWC.xy += (pixelOffset * czm_resolutionScale); + positionEC.xy += translate * mpp; + positionEC.xy += (pixelOffset * czm_resolutionScale) * mpp; - return positionWC; + return positionEC; } void main() @@ -255,14 +255,14 @@ void main() } #endif -#ifdef LOG_DEPTH - czm_vertexLogDepth(czm_projection * positionEC); -#endif - vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); - gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0); + gl_Position = czm_projection * positionWC; v_textureCoordinates = textureCoordinates; +#ifdef LOG_DEPTH + czm_vertexLogDepth(); +#endif + #ifdef DISABLE_DEPTH_DISTANCE float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z; if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0) From bed9f0ee992364d7ebf8f2be6320d38012d07c53 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 10 Apr 2018 15:39:42 -0400 Subject: [PATCH 068/104] Fix NaNs returned by barycentricCoordinates. --- Source/Core/barycentricCoordinates.js | 75 ++++++++++++++++-------- Specs/Core/barycentricCoordinatesSpec.js | 9 +++ 2 files changed, 61 insertions(+), 23 deletions(-) diff --git a/Source/Core/barycentricCoordinates.js b/Source/Core/barycentricCoordinates.js index 6316440fc479..085223fd2399 100644 --- a/Source/Core/barycentricCoordinates.js +++ b/Source/Core/barycentricCoordinates.js @@ -2,12 +2,14 @@ define([ './Cartesian2', './Cartesian3', './Check', - './defined' + './defined', + './Math' ], function( Cartesian2, Cartesian3, Check, - defined) { + defined, + CesiumMath) { 'use strict'; var scratchCartesian1 = new Cartesian3(); @@ -47,34 +49,61 @@ define([ } // Implementation based on http://www.blackpawn.com/texts/pointinpoly/default.html. - var v0, v1, v2; - var dot00, dot01, dot02, dot11, dot12; + var v0; + var v1; + var v2; + var dot00; + var dot01; + var dot02; + var dot11; + var dot12; if(!defined(p0.z)) { - v0 = Cartesian2.subtract(p1, p0, scratchCartesian1); - v1 = Cartesian2.subtract(p2, p0, scratchCartesian2); - v2 = Cartesian2.subtract(point, p0, scratchCartesian3); + if (Cartesian2.equalsEpsilon(point, p0, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_X, result); + } + if (Cartesian2.equalsEpsilon(point, p1, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_Y, result); + } + if (Cartesian2.equalsEpsilon(point, p2, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_Z, result); + } - dot00 = Cartesian2.dot(v0, v0); - dot01 = Cartesian2.dot(v0, v1); - dot02 = Cartesian2.dot(v0, v2); - dot11 = Cartesian2.dot(v1, v1); - dot12 = Cartesian2.dot(v1, v2); + v0 = Cartesian2.subtract(p1, p0, scratchCartesian1); + v1 = Cartesian2.subtract(p2, p0, scratchCartesian2); + v2 = Cartesian2.subtract(point, p0, scratchCartesian3); + + dot00 = Cartesian2.dot(v0, v0); + dot01 = Cartesian2.dot(v0, v1); + dot02 = Cartesian2.dot(v0, v2); + dot11 = Cartesian2.dot(v1, v1); + dot12 = Cartesian2.dot(v1, v2); } else { - v0 = Cartesian3.subtract(p1, p0, scratchCartesian1); - v1 = Cartesian3.subtract(p2, p0, scratchCartesian2); - v2 = Cartesian3.subtract(point, p0, scratchCartesian3); + if (Cartesian3.equalsEpsilon(point, p0, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_X, result); + } + if (Cartesian3.equalsEpsilon(point, p1, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_Y, result); + } + if (Cartesian3.equalsEpsilon(point, p2, CesiumMath.EPSILON14)) { + return Cartesian3.clone(Cartesian3.UNIT_Z, result); + } + + v0 = Cartesian3.subtract(p1, p0, scratchCartesian1); + v1 = Cartesian3.subtract(p2, p0, scratchCartesian2); + v2 = Cartesian3.subtract(point, p0, scratchCartesian3); - dot00 = Cartesian3.dot(v0, v0); - dot01 = Cartesian3.dot(v0, v1); - dot02 = Cartesian3.dot(v0, v2); - dot11 = Cartesian3.dot(v1, v1); - dot12 = Cartesian3.dot(v1, v2); + dot00 = Cartesian3.dot(v0, v0); + dot01 = Cartesian3.dot(v0, v1); + dot02 = Cartesian3.dot(v0, v2); + dot11 = Cartesian3.dot(v1, v1); + dot12 = Cartesian3.dot(v1, v2); } - var q = 1.0 / (dot00 * dot11 - dot01 * dot01); - result.y = (dot11 * dot02 - dot01 * dot12) * q; - result.z = (dot00 * dot12 - dot01 * dot02) * q; + var q = dot00 * dot11 - dot01 * dot01; + var invQ = 1.0 / q; + result.y = (dot11 * dot02 - dot01 * dot12) * invQ; + result.z = (dot00 * dot12 - dot01 * dot02) * invQ; result.x = 1.0 - result.y - result.z; return result; } diff --git a/Specs/Core/barycentricCoordinatesSpec.js b/Specs/Core/barycentricCoordinatesSpec.js index 8f425e1b87da..2738d2876340 100644 --- a/Specs/Core/barycentricCoordinatesSpec.js +++ b/Specs/Core/barycentricCoordinatesSpec.js @@ -48,6 +48,15 @@ defineSuite([ expect(barycentricCoordinates(point, p0, p1, p2)).toEqualEpsilon(new Cartesian3(scalar, scalar, scalar), CesiumMath.EPSILON14); }); + it('evaluates with equal length sides', function() { + var p0 = new Cartesian3(9635312487071484, 13827945400273020, -16479219993905144); + var p1 = new Cartesian3(12832234.180639317, -10455085.701705107, 750010.7274386138); + var p2 = new Cartesian3(-9689011.10628853, -13420063.892507521, 750010.7274386119); + expect(barycentricCoordinates(p0, p0, p1, p2)).toEqual(Cartesian3.UNIT_X); + expect(barycentricCoordinates(p1, p0, p1, p2)).toEqual(Cartesian3.UNIT_Y); + expect(barycentricCoordinates(p2, p0, p1, p2)).toEqual(Cartesian3.UNIT_Z); + }); + it('throws without point', function() { expect(function() { barycentricCoordinates(); From 87cfb66e73bd41d0259177b0bae29f4acf9adecc Mon Sep 17 00:00:00 2001 From: Roderick Green Date: Tue, 10 Apr 2018 13:45:10 -0600 Subject: [PATCH 069/104] Minor code cleanup --- Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js | 1 - Specs/DataSources/StaticGroundGeometryColorBatchSpec.js | 1 - Specs/DataSources/StaticOutlineGeometryBatchSpec.js | 1 - 3 files changed, 3 deletions(-) diff --git a/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js b/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js index c1464f6b350f..297d4084ab30 100644 --- a/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js +++ b/Specs/DataSources/StaticGeometryPerMaterialBatchSpec.js @@ -301,7 +301,6 @@ defineSuite([ showCount += !!scene.primitives.get(1).show; expect(showCount).toEqual(1); }) - .then(function() { return pollToPromise(renderScene); }) diff --git a/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js b/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js index d1d471a35e44..32d95f9f05f6 100644 --- a/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js +++ b/Specs/DataSources/StaticGroundGeometryColorBatchSpec.js @@ -225,7 +225,6 @@ defineSuite([ showCount += !!scene.groundPrimitives.get(1).show; expect(showCount).toEqual(1); }) - .then(function() { return pollToPromise(renderScene); }) diff --git a/Specs/DataSources/StaticOutlineGeometryBatchSpec.js b/Specs/DataSources/StaticOutlineGeometryBatchSpec.js index dd90cc876c5a..ba79994bc5bf 100644 --- a/Specs/DataSources/StaticOutlineGeometryBatchSpec.js +++ b/Specs/DataSources/StaticOutlineGeometryBatchSpec.js @@ -237,7 +237,6 @@ defineSuite([ showCount += !!scene.primitives.get(1).show; expect(showCount).toEqual(1); }) - .then(function() { return pollToPromise(renderScene); }) From 83db3486ece6cd94f18ec8f9637aad0540d92e8d Mon Sep 17 00:00:00 2001 From: Roderick Green Date: Tue, 10 Apr 2018 13:45:19 -0600 Subject: [PATCH 070/104] Updated CHANGES.md --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a59dc50a0861..6d9488ada1b9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,10 +8,10 @@ Change Log * Fixed glTF support to handle meshes with and without tangent vectors, and with/without morph targets, sharing one material. [#6421](https://github.com/AnalyticalGraphicsInc/cesium/pull/6421) * Fixed glTF support to handle skinned meshes when no skin is supplied. [#6061](https://github.com/AnalyticalGraphicsInc/cesium/issues/6061) * Allow loadWithXhr to work with string URLs in a web worker. -* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) +* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) - +* Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) From 3419ad53aa43db28bc9c6fb2c14f37a5ce334c13 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 10 Apr 2018 16:11:39 -0400 Subject: [PATCH 071/104] Fix debug show globe and pick depth. --- Source/Scene/GlobeDepth.js | 21 ++++++++++---- Source/Scene/PickDepth.js | 21 ++++++++++---- Source/Scene/Scene.js | 29 ++++++++++--------- .../Builtin/Functions/reverseLogDepth.glsl | 10 +++++++ 4 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 Source/Shaders/Builtin/Functions/reverseLogDepth.glsl diff --git a/Source/Scene/GlobeDepth.js b/Source/Scene/GlobeDepth.js index 043690568771..2c6b74bdce2f 100644 --- a/Source/Scene/GlobeDepth.js +++ b/Source/Scene/GlobeDepth.js @@ -8,6 +8,7 @@ define([ '../Renderer/Framebuffer', '../Renderer/PixelDatatype', '../Renderer/RenderState', + '../Renderer/ShaderSource', '../Renderer/Texture', '../Shaders/PostProcessFilters/PassThrough' ], function( @@ -20,6 +21,7 @@ define([ Framebuffer, PixelDatatype, RenderState, + ShaderSource, Texture, PassThrough) { 'use strict'; @@ -45,23 +47,30 @@ define([ this._useScissorTest = false; this._scissorRectangle = undefined; + this._useLogDepth = undefined; + this._debugGlobeDepthViewportCommand = undefined; } - function executeDebugGlobeDepth(globeDepth, context, passState) { - if (!defined(globeDepth._debugGlobeDepthViewportCommand)) { - var fs = + function executeDebugGlobeDepth(globeDepth, context, passState, useLogDepth) { + if (!defined(globeDepth._debugGlobeDepthViewportCommand) || useLogDepth !== globeDepth._useLogDepth) { + var fsSource = 'uniform sampler2D u_texture;\n' + 'varying vec2 v_textureCoordinates;\n' + 'void main()\n' + '{\n' + ' float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n' + + ' z_window = czm_reverseLogDepth(z_window); \n' + ' float n_range = czm_depthRange.near;\n' + ' float f_range = czm_depthRange.far;\n' + ' float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n' + ' float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n' + ' gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n' + '}\n'; + var fs = new ShaderSource({ + defines : [useLogDepth ? 'LOG_DEPTH' : ''], + sources : [fsSource] + }); globeDepth._debugGlobeDepthViewportCommand = context.createViewportQuadCommand(fs, { uniformMap : { @@ -71,6 +80,8 @@ define([ }, owner : globeDepth }); + + globeDepth._useLogDepth = useLogDepth; } globeDepth._debugGlobeDepthViewportCommand.execute(context, passState); @@ -207,8 +218,8 @@ define([ globeDepth._clearColorCommand.framebuffer = globeDepth.framebuffer; } - GlobeDepth.prototype.executeDebugGlobeDepth = function(context, passState) { - executeDebugGlobeDepth(this, context, passState); + GlobeDepth.prototype.executeDebugGlobeDepth = function(context, passState, useLogDepth) { + executeDebugGlobeDepth(this, context, passState, useLogDepth); }; GlobeDepth.prototype.update = function(context, passState) { diff --git a/Source/Scene/PickDepth.js b/Source/Scene/PickDepth.js index 16486ec01cad..f812a34317e9 100644 --- a/Source/Scene/PickDepth.js +++ b/Source/Scene/PickDepth.js @@ -5,6 +5,7 @@ define([ '../Renderer/Framebuffer', '../Renderer/PixelDatatype', '../Renderer/RenderState', + '../Renderer/ShaderSource', '../Renderer/Texture' ], function( defined, @@ -13,6 +14,7 @@ define([ Framebuffer, PixelDatatype, RenderState, + ShaderSource, Texture) { 'use strict'; @@ -26,23 +28,30 @@ define([ this._textureToCopy = undefined; this._copyDepthCommand = undefined; + this._useLogDepth = undefined; + this._debugPickDepthViewportCommand = undefined; } - function executeDebugPickDepth(pickDepth, context, passState) { - if (!defined(pickDepth._debugPickDepthViewportCommand)) { - var fs = + function executeDebugPickDepth(pickDepth, context, passState, useLogDepth) { + if (!defined(pickDepth._debugPickDepthViewportCommand) || useLogDepth !== pickDepth._useLogDepth) { + var fsSource = 'uniform sampler2D u_texture;\n' + 'varying vec2 v_textureCoordinates;\n' + 'void main()\n' + '{\n' + ' float z_window = czm_unpackDepth(texture2D(u_texture, v_textureCoordinates));\n' + + ' z_window = czm_reverseLogDepth(z_window); \n' + ' float n_range = czm_depthRange.near;\n' + ' float f_range = czm_depthRange.far;\n' + ' float z_ndc = (2.0 * z_window - n_range - f_range) / (f_range - n_range);\n' + ' float scale = pow(z_ndc * 0.5 + 0.5, 8.0);\n' + ' gl_FragColor = vec4(mix(vec3(0.0), vec3(1.0), scale), 1.0);\n' + '}\n'; + var fs = new ShaderSource({ + defines : [useLogDepth ? 'LOG_DEPTH' : ''], + sources : [fsSource] + }); pickDepth._debugPickDepthViewportCommand = context.createViewportQuadCommand(fs, { uniformMap : { @@ -52,6 +61,8 @@ define([ }, owner : pickDepth }); + + pickDepth._useLogDepth = useLogDepth; } pickDepth._debugPickDepthViewportCommand.execute(context, passState); @@ -123,8 +134,8 @@ define([ pickDepth._copyDepthCommand.framebuffer = pickDepth.framebuffer; } - PickDepth.prototype.executeDebugPickDepth = function(context, passState) { - executeDebugPickDepth(this, context, passState); + PickDepth.prototype.executeDebugPickDepth = function(context, passState, useLogDepth) { + executeDebugPickDepth(this, context, passState, useLogDepth); }; PickDepth.prototype.update = function(context, depthTexture) { diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index ef15edd788ae..da28e35093e9 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -1615,8 +1615,6 @@ define([ command.debugOverlappingFrustums = 0; } - updateDerivedCommands(scene, command); - var frustumCommandsList = scene._frustumCommandsList; var length = frustumCommandsList.length; @@ -1651,6 +1649,8 @@ define([ cf[command.debugOverlappingFrustums] = defined(cf[command.debugOverlappingFrustums]) ? cf[command.debugOverlappingFrustums] + 1 : 1; ++scene._debugFrustumStatistics.totalCommands; } + + updateDerivedCommands(scene, command); } var scratchCullingVolume = new CullingVolume(); @@ -2936,19 +2936,9 @@ define([ var context = scene._context; var environmentState = scene._environmentState; - var useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer; - if (scene.debugShowGlobeDepth && useGlobeDepthFramebuffer) { - var gd = getDebugGlobeDepth(scene, scene.debugShowDepthFrustum - 1); - gd.executeDebugGlobeDepth(context, passState); - } - - if (scene.debugShowPickDepth && useGlobeDepthFramebuffer) { - var pd = getPickDepth(scene, scene.debugShowDepthFrustum - 1); - pd.executeDebugPickDepth(context, passState); - } - var useOIT = environmentState.useOIT; var useFXAA = environmentState.useFXAA; + var useGlobeDepthFramebuffer = environmentState.useGlobeDepthFramebuffer; if (useOIT) { passState.framebuffer = useFXAA ? scene._fxaa.getColorFramebuffer() : undefined; @@ -2969,6 +2959,19 @@ define([ passState.framebuffer = environmentState.originalFramebuffer; scene._globeDepth.executeCopyColor(context, passState); } + + var frustum = scene.camera.frustum; + var useLogDepth = scene._logDepthBuffer && !(frustum instanceof OrthographicFrustum || frustum instanceof OrthographicOffCenterFrustum); + + if (scene.debugShowGlobeDepth && useGlobeDepthFramebuffer) { + var gd = getDebugGlobeDepth(scene, scene.debugShowDepthFrustum - 1); + gd.executeDebugGlobeDepth(context, passState, useLogDepth); + } + + if (scene.debugShowPickDepth && useGlobeDepthFramebuffer) { + var pd = getPickDepth(scene, scene.debugShowDepthFrustum - 1); + pd.executeDebugPickDepth(context, passState, useLogDepth); + } } function callAfterRenderFunctions(scene) { diff --git a/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl b/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl new file mode 100644 index 000000000000..e8719f24a9ba --- /dev/null +++ b/Source/Shaders/Builtin/Functions/reverseLogDepth.glsl @@ -0,0 +1,10 @@ +float czm_reverseLogDepth(float logZ) +{ +#ifdef LOG_DEPTH + float near = czm_currentFrustum.x; + float far = czm_currentFrustum.y; + logZ = pow(2.0, logZ * log2(far + 1.0)) - 1.0; + logZ = far * (1.0 - near / logZ) / (far - near); +#endif + return logZ; +} From d7d14a59e5a93fa8e2b68f7652b93b2e3fcc10ae Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Tue, 10 Apr 2018 16:16:21 -0400 Subject: [PATCH 072/104] Rename from review. --- Source/Shaders/BillboardCollectionVS.glsl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Shaders/BillboardCollectionVS.glsl b/Source/Shaders/BillboardCollectionVS.glsl index 039bd3323928..9707d718b7fa 100644 --- a/Source/Shaders/BillboardCollectionVS.glsl +++ b/Source/Shaders/BillboardCollectionVS.glsl @@ -39,7 +39,7 @@ 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 computePositionWindowCoordinates(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters) +vec4 addScreenSpaceOffset(vec4 positionEC, vec2 imageSize, float scale, vec2 direction, vec2 origin, vec2 translate, vec2 pixelOffset, vec3 alignedAxis, bool validAlignedAxis, float rotation, bool sizeInMeters) { // Note the halfSize cannot be computed in JavaScript because it is sent via // compressed vertex attributes that coerce it to an integer. @@ -255,8 +255,8 @@ void main() } #endif - vec4 positionWC = computePositionWindowCoordinates(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); - gl_Position = czm_projection * positionWC; + positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters); + gl_Position = czm_projection * positionEC; v_textureCoordinates = textureCoordinates; #ifdef LOG_DEPTH From 94e22b74dc533fb6a5e92b9a437dad1245df13ce Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Wed, 11 Apr 2018 11:08:24 -0400 Subject: [PATCH 073/104] fix bug with unpickable Models and shader modification --- CHANGES.md | 3 ++- Source/Scene/Model.js | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a59dc50a0861..b3ee8970a20c 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,9 +8,10 @@ Change Log * Fixed glTF support to handle meshes with and without tangent vectors, and with/without morph targets, sharing one material. [#6421](https://github.com/AnalyticalGraphicsInc/cesium/pull/6421) * Fixed glTF support to handle skinned meshes when no skin is supplied. [#6061](https://github.com/AnalyticalGraphicsInc/cesium/issues/6061) * Allow loadWithXhr to work with string URLs in a web worker. -* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) +* `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) +* Fixed a bug causing crashes when setting colors on un-pickable models. [$6442](https://github.com/AnalyticalGraphicsInc/cesium/issues/6442) ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) diff --git a/Source/Scene/Model.js b/Source/Scene/Model.js index 57c931ef4b53..fdf9522d45e0 100644 --- a/Source/Scene/Model.js +++ b/Source/Scene/Model.js @@ -1973,7 +1973,7 @@ define([ /////////////////////////////////////////////////////////////////////////// // When building programs for the first time, do not include modifiers for clipping planes and color - // since this is the version of the program that will be cached. + // since this is the version of the program that will be cached for use with other Models. function createProgram(id, model, context) { var program = model._sourcePrograms[id]; var shaders = model._sourceShaders; @@ -4578,12 +4578,14 @@ define([ var pickProgram = rendererPickPrograms[programId]; nodeCommand.command.shaderProgram = renderProgram; - nodeCommand.pickCommand.shaderProgram = pickProgram; if (defined(nodeCommand.command2D)) { nodeCommand.command2D.shaderProgram = renderProgram; } - if (defined(nodeCommand.pickCommand2D)) { - nodeCommand.pickCommand2D.shaderProgram = pickProgram; + if (model.allowPicking) { + nodeCommand.pickCommand.shaderProgram = pickProgram; + if (defined(nodeCommand.pickCommand2D)) { + nodeCommand.pickCommand2D.shaderProgram = pickProgram; + } } } From 6123a9a19f08f4ebdbb9f0e76372e3db6e412165 Mon Sep 17 00:00:00 2001 From: Scott Hunter Date: Thu, 12 Apr 2018 16:34:35 -0400 Subject: [PATCH 074/104] Prefer the following built-in Math methods when available: `sign`, `sinh`, `cosh`, `cbrt`, `log2`. --- Source/Core/Math.js | 56 +++++++++++++++++------------------------- Specs/Core/MathSpec.js | 8 ++++++ 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/Source/Core/Math.js b/Source/Core/Math.js index a498300c9ac6..b59f9be8f1cc 100644 --- a/Source/Core/Math.js +++ b/Source/Core/Math.js @@ -195,16 +195,14 @@ define([ * @param {Number} value The value to return the sign of. * @returns {Number} The sign of value. */ - CesiumMath.sign = function(value) { - if (value > 0) { - return 1; + CesiumMath.sign = defaultValue(Math.sign, function sign(value) { + value = +value; // coerce to number + if (value === 0 || value !== value) { + // zero or NaN + return value; } - if (value < 0) { - return -1; - } - - return 0; - }; + return value > 0 ? 1 : -1; + }); /** * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. @@ -264,12 +262,9 @@ define([ * @param {Number} value The number whose hyperbolic sine is to be returned. * @returns {Number} The hyperbolic sine of value. */ - CesiumMath.sinh = function(value) { - var part1 = Math.pow(Math.E, value); - var part2 = Math.pow(Math.E, -1.0 * value); - - return (part1 - part2) * 0.5; - }; + CesiumMath.sinh = defaultValue(Math.sinh, function sinh(value) { + return (Math.exp(value) - Math.exp(-value)) / 2.0; + }); /** * Returns the hyperbolic cosine of a number. @@ -290,12 +285,9 @@ define([ * @param {Number} value The number whose hyperbolic cosine is to be returned. * @returns {Number} The hyperbolic cosine of value. */ - CesiumMath.cosh = function(value) { - var part1 = Math.pow(Math.E, value); - var part2 = Math.pow(Math.E, -1.0 * value); - - return (part1 + part2) * 0.5; - }; + CesiumMath.cosh = defaultValue(Math.cosh, function cosh(value) { + return (Math.exp(value) + Math.exp(-value)) / 2.0; + }); /** * Computes the linear interpolation of two values. @@ -334,7 +326,7 @@ define([ * @type {Number} * @constant */ - CesiumMath.PI_OVER_TWO = Math.PI * 0.5; + CesiumMath.PI_OVER_TWO = Math.PI / 2.0; /** * pi/3 @@ -366,7 +358,7 @@ define([ * @type {Number} * @constant */ - CesiumMath.THREE_PI_OVER_TWO = (3.0 * Math.PI) * 0.5; + CesiumMath.THREE_PI_OVER_TWO = 3.0 * Math.PI / 2.0; /** * 2pi @@ -835,11 +827,6 @@ define([ return Math.log(number) / Math.log(base); }; - function cbrt(number) { - var result = Math.pow(Math.abs(number), 1.0 / 3.0); - return number < 0.0 ? -result : result; - } - /** * Finds the cube root of a number. * Returns NaN if number is not provided. @@ -847,11 +834,10 @@ define([ * @param {Number} [number] The number. * @returns {Number} The result. */ - CesiumMath.cbrt = defined(Math.cbrt) ? Math.cbrt : cbrt; - - function log2(x) { - return Math.log(x) * Math.LOG2E; - } + CesiumMath.cbrt = defaultValue(Math.cbrt, function cbrt(number) { + var result = Math.pow(Math.abs(number), 1.0 / 3.0); + return number < 0.0 ? -result : result; + }); /** * Finds the base 2 logarithm of a number. @@ -859,7 +845,9 @@ define([ * @param {Number} number The number. * @returns {Number} The result. */ - CesiumMath.log2 = defined(Math.log2) ? Math.log2 : log2; + CesiumMath.log2 = defaultValue(Math.log2, function log2(number) { + return Math.log(number) * Math.LOG2E; + }); /** * @private diff --git a/Specs/Core/MathSpec.js b/Specs/Core/MathSpec.js index 26a4e1b523ed..4026ea42c290 100644 --- a/Specs/Core/MathSpec.js +++ b/Specs/Core/MathSpec.js @@ -16,6 +16,14 @@ defineSuite([ expect(CesiumMath.sign(0)).toEqual(0); }); + it('sign of -0', function() { + expect(CesiumMath.sign(-0)).toEqual(-0); + }); + + it('sign of NaN', function() { + expect(CesiumMath.sign(NaN)).toBeNaN(); + }); + it('signNotZero of -2', function() { expect(CesiumMath.signNotZero(-2)).toEqual(-1); }); From f5e7443ec904bffb992e51207e4355001b841a65 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Mon, 16 Apr 2018 16:25:11 -0400 Subject: [PATCH 075/104] Fix signed distance to bounding sphere. --- Source/Scene/Camera.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index 915ca86bc001..dd98dd2a8c35 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2592,7 +2592,7 @@ define([ var toCenter = Cartesian3.subtract(this.positionWC, boundingSphere.center, scratchToCenter); var distance = -Cartesian3.dot(toCenter, this.directionWC); var proj = Cartesian3.multiplyByScalar(this.directionWC, distance, scratchProj); - var unsignedDistance = Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); + var unsignedDistance = Math.abs(Cartesian3.magnitude(proj) - boundingSphere.radius); return distance < 0.0 ? -unsignedDistance : unsignedDistance; }; From 21441b9f85ea837cfe5f2f2580f9009f20093ea0 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 15:06:08 -0700 Subject: [PATCH 076/104] Reapply loadWithHttpRequest --- Source/Core/Resource.js | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index a45f34af8a00..2185ad5c99ca 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1,3 +1,4 @@ +/*globals process, require, Buffer*/ define([ '../ThirdParty/Uri', '../ThirdParty/when', @@ -1772,6 +1773,56 @@ define([ image.src = url; }; + function loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType) { + // Note: only the 'json' responseType transforms the loaded buffer + var URL = require('url').parse(url); + var http_s = URL.protocol === 'https:' ? require('https') : require('http'); + var zlib = require('zlib'); + var options = { + protocol : URL.protocol, + hostname : URL.hostname, + port : URL.port, + path : URL.path, + query : URL.query, + method : method, + headers : headers + }; + + var req = http_s.request(options, function(res) { + if (res.statusCode < 200 || res.statusCode >= 300) { + deferred.reject(new RequestErrorEvent(res.statusCode, res, res.headers)); + return; + } + + var chunkArray = []; // Array of buffers to receive the response + res.on('data', function(chunk) { + chunkArray.push(chunk); + }); + res.on('end', function() { + var response = Buffer.concat(chunkArray); // Concatenate all buffers + if (res.headers['content-encoding'] === 'gzip') { // Must deal with decompression + zlib.gunzip(response, function(error, result) { + if (error) { + deferred.reject(new RuntimeError('Error decompressing response.')); + } else if (responseType === 'json') { + deferred.resolve(JSON.parse(result.toString('utf8'))); + } else { + deferred.resolve(new Uint8Array(result).buffer); // Convert Buffer to ArrayBuffer + } + }); + } else { + deferred.resolve(responseType === 'json' ? JSON.parse(response.toString('utf8')) : response); + } + }); + }); + + req.end(); + + req.on('error', function(e) { + deferred.reject(new RequestErrorEvent()); + }); + } + Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) { var dataUriRegexResult = dataUriRegex.exec(url); if (dataUriRegexResult !== null) { @@ -1779,6 +1830,11 @@ define([ return; } + if (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]') { + loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType); + return; + } + var xhr = new XMLHttpRequest(); if (TrustedServers.contains(url)) { From e4a3c1918e651d870ec81fd385b4ef88ba77a76d Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 15:19:43 -0700 Subject: [PATCH 077/104] Build --- Source/Cesium.js | 839 ++++++++++++++++++ Source/Shaders/AdjustTranslucentFS.js | 29 + .../Appearances/AllMaterialAppearanceFS.js | 34 + .../Appearances/AllMaterialAppearanceVS.js | 31 + .../Appearances/BasicMaterialAppearanceFS.js | 28 + .../Appearances/BasicMaterialAppearanceVS.js | 22 + .../EllipsoidSurfaceAppearanceFS.js | 38 + .../EllipsoidSurfaceAppearanceVS.js | 24 + .../PerInstanceColorAppearanceFS.js | 27 + .../PerInstanceColorAppearanceVS.js | 25 + .../PerInstanceFlatColorAppearanceFS.js | 11 + .../PerInstanceFlatColorAppearanceVS.js | 20 + .../Appearances/PolylineColorAppearanceVS.js | 37 + .../PolylineMaterialAppearanceVS.js | 39 + .../TexturedMaterialAppearanceFS.js | 30 + .../TexturedMaterialAppearanceVS.js | 25 + Source/Shaders/BillboardCollectionFS.js | 63 ++ Source/Shaders/BillboardCollectionVS.js | 300 +++++++ Source/Shaders/BrdfLutGeneratorFS.js | 88 ++ .../Builtin/Constants/degreesPerRadian.js | 21 + .../Shaders/Builtin/Constants/depthRange.js | 19 + Source/Shaders/Builtin/Constants/epsilon1.js | 12 + Source/Shaders/Builtin/Constants/epsilon2.js | 12 + Source/Shaders/Builtin/Constants/epsilon3.js | 12 + Source/Shaders/Builtin/Constants/epsilon4.js | 12 + Source/Shaders/Builtin/Constants/epsilon5.js | 12 + Source/Shaders/Builtin/Constants/epsilon6.js | 12 + Source/Shaders/Builtin/Constants/epsilon7.js | 12 + Source/Shaders/Builtin/Constants/infinity.js | 12 + Source/Shaders/Builtin/Constants/oneOverPi.js | 21 + .../Shaders/Builtin/Constants/oneOverTwoPi.js | 21 + .../Builtin/Constants/passCesium3DTile.js | 14 + .../passCesium3DTileClassification.js | 14 + ...assCesium3DTileClassificationIgnoreShow.js | 14 + .../Builtin/Constants/passClassification.js | 14 + .../Shaders/Builtin/Constants/passCompute.js | 14 + .../Builtin/Constants/passEnvironment.js | 14 + Source/Shaders/Builtin/Constants/passGlobe.js | 14 + .../Shaders/Builtin/Constants/passOpaque.js | 14 + .../Shaders/Builtin/Constants/passOverlay.js | 14 + .../Constants/passTerrainClassification.js | 14 + .../Builtin/Constants/passTranslucent.js | 14 + Source/Shaders/Builtin/Constants/pi.js | 21 + .../Shaders/Builtin/Constants/piOverFour.js | 21 + Source/Shaders/Builtin/Constants/piOverSix.js | 21 + .../Shaders/Builtin/Constants/piOverThree.js | 21 + Source/Shaders/Builtin/Constants/piOverTwo.js | 21 + .../Builtin/Constants/radiansPerDegree.js | 21 + .../Shaders/Builtin/Constants/sceneMode2D.js | 16 + .../Shaders/Builtin/Constants/sceneMode3D.js | 16 + .../Constants/sceneModeColumbusView.js | 16 + .../Builtin/Constants/sceneModeMorphing.js | 16 + .../Shaders/Builtin/Constants/solarRadius.js | 18 + .../Shaders/Builtin/Constants/threePiOver2.js | 21 + Source/Shaders/Builtin/Constants/twoPi.js | 21 + .../Constants/webMercatorMaxLatitude.js | 21 + Source/Shaders/Builtin/CzmBuiltins.js | 321 +++++++ Source/Shaders/Builtin/Functions/HSBToRGB.js | 29 + Source/Shaders/Builtin/Functions/HSLToRGB.js | 36 + Source/Shaders/Builtin/Functions/RGBToHSB.js | 32 + Source/Shaders/Builtin/Functions/RGBToHSL.js | 39 + Source/Shaders/Builtin/Functions/RGBToXYZ.js | 35 + Source/Shaders/Builtin/Functions/XYZToRGB.js | 35 + .../Shaders/Builtin/Functions/alphaWeight.js | 37 + Source/Shaders/Builtin/Functions/antialias.js | 44 + .../Shaders/Builtin/Functions/cascadeColor.js | 13 + .../Builtin/Functions/cascadeDistance.js | 12 + .../Builtin/Functions/cascadeMatrix.js | 15 + .../Builtin/Functions/cascadeWeights.js | 15 + .../Builtin/Functions/columbusViewMorph.js | 17 + .../Builtin/Functions/computePosition.js | 27 + .../Builtin/Functions/cosineAndSine.js | 216 +++++ .../Functions/decompressTextureCoordinates.js | 22 + .../Builtin/Functions/depthClampFarPlane.js | 32 + .../Functions/eastNorthUpToEyeCoordinates.js | 38 + .../Functions/ellipsoidContainsPoint.js | 17 + .../Shaders/Builtin/Functions/ellipsoidNew.js | 19 + .../ellipsoidWgs84TextureCoordinates.js | 15 + .../Builtin/Functions/equalsEpsilon.js | 41 + Source/Shaders/Builtin/Functions/eyeOffset.js | 25 + .../Functions/eyeToWindowCoordinates.js | 37 + Source/Shaders/Builtin/Functions/fog.js | 24 + .../Functions/geodeticSurfaceNormal.js | 21 + .../Builtin/Functions/getDefaultMaterial.js | 32 + .../Builtin/Functions/getLambertDiffuse.js | 27 + .../Shaders/Builtin/Functions/getSpecular.js | 34 + .../Builtin/Functions/getWaterNoise.js | 42 + .../Builtin/Functions/getWgs84EllipsoidEC.js | 26 + Source/Shaders/Builtin/Functions/hue.js | 35 + Source/Shaders/Builtin/Functions/isEmpty.js | 24 + Source/Shaders/Builtin/Functions/isFull.js | 24 + .../latitudeToWebMercatorFraction.js | 26 + Source/Shaders/Builtin/Functions/luminance.js | 25 + .../Builtin/Functions/metersPerPixel.js | 46 + .../Functions/modelToWindowCoordinates.js | 42 + .../Functions/multiplyWithColorBalance.js | 23 + .../Builtin/Functions/nearFarScalar.js | 31 + Source/Shaders/Builtin/Functions/octDecode.js | 88 ++ Source/Shaders/Builtin/Functions/packDepth.js | 23 + Source/Shaders/Builtin/Functions/phong.js | 68 ++ .../Builtin/Functions/pointAlongRay.js | 24 + .../rayEllipsoidIntersectionInterval.js | 88 ++ .../Builtin/Functions/reverseLogDepth.js | 15 + .../Shaders/Builtin/Functions/saturation.js | 27 + .../Builtin/Functions/shadowDepthCompare.js | 29 + .../Builtin/Functions/shadowVisibility.js | 71 ++ .../Shaders/Builtin/Functions/signNotZero.js | 34 + .../Functions/tangentToEyeSpaceMatrix.js | 30 + .../Builtin/Functions/transformPlane.js | 13 + .../Functions/translateRelativeToEye.js | 45 + .../Builtin/Functions/translucentPhong.js | 34 + Source/Shaders/Builtin/Functions/transpose.js | 50 ++ .../Shaders/Builtin/Functions/unpackDepth.js | 21 + .../Shaders/Builtin/Functions/unpackFloat.js | 35 + .../Builtin/Functions/vertexLogDepth.js | 54 ++ .../Functions/windowToEyeCoordinates.js | 60 ++ .../Functions/writeDepthClampedToFarPlane.js | 30 + .../Builtin/Functions/writeLogDepth.js | 49 + .../Builtin/Structs/depthRangeStruct.js | 14 + Source/Shaders/Builtin/Structs/ellipsoid.js | 17 + Source/Shaders/Builtin/Structs/material.js | 27 + .../Shaders/Builtin/Structs/materialInput.js | 31 + Source/Shaders/Builtin/Structs/ray.js | 16 + Source/Shaders/Builtin/Structs/raySegment.js | 32 + .../Builtin/Structs/shadowParameters.js | 20 + Source/Shaders/CompositeOITFS.js | 36 + Source/Shaders/DepthPlaneFS.js | 27 + Source/Shaders/DepthPlaneVS.js | 16 + Source/Shaders/EllipsoidFS.js | 116 +++ Source/Shaders/EllipsoidVS.js | 31 + Source/Shaders/GlobeFS.js | 348 ++++++++ Source/Shaders/GlobeVS.js | 188 ++++ Source/Shaders/GroundAtmosphere.js | 134 +++ Source/Shaders/Materials/BumpMapMaterial.js | 34 + .../Shaders/Materials/CheckerboardMaterial.js | 33 + Source/Shaders/Materials/DotMaterial.js | 22 + .../Materials/ElevationContourMaterial.js | 32 + .../Materials/ElevationRampMaterial.js | 18 + Source/Shaders/Materials/FadeMaterial.js | 41 + Source/Shaders/Materials/GridMaterial.js | 62 ++ Source/Shaders/Materials/NormalMapMaterial.js | 24 + .../Materials/PolylineArrowMaterial.js | 72 ++ .../Shaders/Materials/PolylineDashMaterial.js | 42 + .../Shaders/Materials/PolylineGlowMaterial.js | 22 + .../Materials/PolylineOutlineMaterial.js | 33 + .../Shaders/Materials/RimLightingMaterial.js | 23 + Source/Shaders/Materials/SlopeRampMaterial.js | 15 + Source/Shaders/Materials/StripeMaterial.js | 28 + Source/Shaders/Materials/Water.js | 61 ++ Source/Shaders/PointPrimitiveCollectionFS.js | 56 ++ Source/Shaders/PointPrimitiveCollectionVS.js | 197 ++++ Source/Shaders/PolylineCommon.js | 121 +++ Source/Shaders/PolylineFS.js | 27 + Source/Shaders/PolylineVS.js | 108 +++ .../PostProcessFilters/AdditiveBlend.js | 22 + .../Shaders/PostProcessFilters/BrightPass.js | 35 + Source/Shaders/PostProcessFilters/FXAA.js | 26 + .../PostProcessFilters/GaussianBlur1D.js | 42 + .../Shaders/PostProcessFilters/PassThrough.js | 13 + .../PointCloudEyeDomeLighting.js | 57 ++ Source/Shaders/ReprojectWebMercatorFS.js | 13 + Source/Shaders/ReprojectWebMercatorVS.js | 17 + Source/Shaders/ShadowVolumeFS.js | 24 + Source/Shaders/ShadowVolumeVS.js | 46 + Source/Shaders/SkyAtmosphereFS.js | 122 +++ Source/Shaders/SkyAtmosphereVS.js | 166 ++++ Source/Shaders/SkyBoxFS.js | 14 + Source/Shaders/SkyBoxVS.js | 15 + Source/Shaders/SunFS.js | 13 + Source/Shaders/SunTextureFS.js | 61 ++ Source/Shaders/SunVS.js | 33 + Source/Shaders/Vector3DTilePolylinesVS.js | 31 + Source/Shaders/ViewportQuadFS.js | 21 + Source/Shaders/ViewportQuadVS.js | 15 + Source/ThirdParty/Shaders/FXAA3_11.js | 681 ++++++++++++++ 175 files changed, 8443 insertions(+) create mode 100644 Source/Cesium.js create mode 100644 Source/Shaders/AdjustTranslucentFS.js create mode 100644 Source/Shaders/Appearances/AllMaterialAppearanceFS.js create mode 100644 Source/Shaders/Appearances/AllMaterialAppearanceVS.js create mode 100644 Source/Shaders/Appearances/BasicMaterialAppearanceFS.js create mode 100644 Source/Shaders/Appearances/BasicMaterialAppearanceVS.js create mode 100644 Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js create mode 100644 Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js create mode 100644 Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js create mode 100644 Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js create mode 100644 Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js create mode 100644 Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js create mode 100644 Source/Shaders/Appearances/PolylineColorAppearanceVS.js create mode 100644 Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js create mode 100644 Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js create mode 100644 Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js create mode 100644 Source/Shaders/BillboardCollectionFS.js create mode 100644 Source/Shaders/BillboardCollectionVS.js create mode 100644 Source/Shaders/BrdfLutGeneratorFS.js create mode 100644 Source/Shaders/Builtin/Constants/degreesPerRadian.js create mode 100644 Source/Shaders/Builtin/Constants/depthRange.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon1.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon2.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon3.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon4.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon5.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon6.js create mode 100644 Source/Shaders/Builtin/Constants/epsilon7.js create mode 100644 Source/Shaders/Builtin/Constants/infinity.js create mode 100644 Source/Shaders/Builtin/Constants/oneOverPi.js create mode 100644 Source/Shaders/Builtin/Constants/oneOverTwoPi.js create mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTile.js create mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js create mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js create mode 100644 Source/Shaders/Builtin/Constants/passClassification.js create mode 100644 Source/Shaders/Builtin/Constants/passCompute.js create mode 100644 Source/Shaders/Builtin/Constants/passEnvironment.js create mode 100644 Source/Shaders/Builtin/Constants/passGlobe.js create mode 100644 Source/Shaders/Builtin/Constants/passOpaque.js create mode 100644 Source/Shaders/Builtin/Constants/passOverlay.js create mode 100644 Source/Shaders/Builtin/Constants/passTerrainClassification.js create mode 100644 Source/Shaders/Builtin/Constants/passTranslucent.js create mode 100644 Source/Shaders/Builtin/Constants/pi.js create mode 100644 Source/Shaders/Builtin/Constants/piOverFour.js create mode 100644 Source/Shaders/Builtin/Constants/piOverSix.js create mode 100644 Source/Shaders/Builtin/Constants/piOverThree.js create mode 100644 Source/Shaders/Builtin/Constants/piOverTwo.js create mode 100644 Source/Shaders/Builtin/Constants/radiansPerDegree.js create mode 100644 Source/Shaders/Builtin/Constants/sceneMode2D.js create mode 100644 Source/Shaders/Builtin/Constants/sceneMode3D.js create mode 100644 Source/Shaders/Builtin/Constants/sceneModeColumbusView.js create mode 100644 Source/Shaders/Builtin/Constants/sceneModeMorphing.js create mode 100644 Source/Shaders/Builtin/Constants/solarRadius.js create mode 100644 Source/Shaders/Builtin/Constants/threePiOver2.js create mode 100644 Source/Shaders/Builtin/Constants/twoPi.js create mode 100644 Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js create mode 100644 Source/Shaders/Builtin/CzmBuiltins.js create mode 100644 Source/Shaders/Builtin/Functions/HSBToRGB.js create mode 100644 Source/Shaders/Builtin/Functions/HSLToRGB.js create mode 100644 Source/Shaders/Builtin/Functions/RGBToHSB.js create mode 100644 Source/Shaders/Builtin/Functions/RGBToHSL.js create mode 100644 Source/Shaders/Builtin/Functions/RGBToXYZ.js create mode 100644 Source/Shaders/Builtin/Functions/XYZToRGB.js create mode 100644 Source/Shaders/Builtin/Functions/alphaWeight.js create mode 100644 Source/Shaders/Builtin/Functions/antialias.js create mode 100644 Source/Shaders/Builtin/Functions/cascadeColor.js create mode 100644 Source/Shaders/Builtin/Functions/cascadeDistance.js create mode 100644 Source/Shaders/Builtin/Functions/cascadeMatrix.js create mode 100644 Source/Shaders/Builtin/Functions/cascadeWeights.js create mode 100644 Source/Shaders/Builtin/Functions/columbusViewMorph.js create mode 100644 Source/Shaders/Builtin/Functions/computePosition.js create mode 100644 Source/Shaders/Builtin/Functions/cosineAndSine.js create mode 100644 Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/depthClampFarPlane.js create mode 100644 Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js create mode 100644 Source/Shaders/Builtin/Functions/ellipsoidNew.js create mode 100644 Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/equalsEpsilon.js create mode 100644 Source/Shaders/Builtin/Functions/eyeOffset.js create mode 100644 Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/fog.js create mode 100644 Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js create mode 100644 Source/Shaders/Builtin/Functions/getDefaultMaterial.js create mode 100644 Source/Shaders/Builtin/Functions/getLambertDiffuse.js create mode 100644 Source/Shaders/Builtin/Functions/getSpecular.js create mode 100644 Source/Shaders/Builtin/Functions/getWaterNoise.js create mode 100644 Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js create mode 100644 Source/Shaders/Builtin/Functions/hue.js create mode 100644 Source/Shaders/Builtin/Functions/isEmpty.js create mode 100644 Source/Shaders/Builtin/Functions/isFull.js create mode 100644 Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js create mode 100644 Source/Shaders/Builtin/Functions/luminance.js create mode 100644 Source/Shaders/Builtin/Functions/metersPerPixel.js create mode 100644 Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js create mode 100644 Source/Shaders/Builtin/Functions/nearFarScalar.js create mode 100644 Source/Shaders/Builtin/Functions/octDecode.js create mode 100644 Source/Shaders/Builtin/Functions/packDepth.js create mode 100644 Source/Shaders/Builtin/Functions/phong.js create mode 100644 Source/Shaders/Builtin/Functions/pointAlongRay.js create mode 100644 Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js create mode 100644 Source/Shaders/Builtin/Functions/reverseLogDepth.js create mode 100644 Source/Shaders/Builtin/Functions/saturation.js create mode 100644 Source/Shaders/Builtin/Functions/shadowDepthCompare.js create mode 100644 Source/Shaders/Builtin/Functions/shadowVisibility.js create mode 100644 Source/Shaders/Builtin/Functions/signNotZero.js create mode 100644 Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js create mode 100644 Source/Shaders/Builtin/Functions/transformPlane.js create mode 100644 Source/Shaders/Builtin/Functions/translateRelativeToEye.js create mode 100644 Source/Shaders/Builtin/Functions/translucentPhong.js create mode 100644 Source/Shaders/Builtin/Functions/transpose.js create mode 100644 Source/Shaders/Builtin/Functions/unpackDepth.js create mode 100644 Source/Shaders/Builtin/Functions/unpackFloat.js create mode 100644 Source/Shaders/Builtin/Functions/vertexLogDepth.js create mode 100644 Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js create mode 100644 Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js create mode 100644 Source/Shaders/Builtin/Functions/writeLogDepth.js create mode 100644 Source/Shaders/Builtin/Structs/depthRangeStruct.js create mode 100644 Source/Shaders/Builtin/Structs/ellipsoid.js create mode 100644 Source/Shaders/Builtin/Structs/material.js create mode 100644 Source/Shaders/Builtin/Structs/materialInput.js create mode 100644 Source/Shaders/Builtin/Structs/ray.js create mode 100644 Source/Shaders/Builtin/Structs/raySegment.js create mode 100644 Source/Shaders/Builtin/Structs/shadowParameters.js create mode 100644 Source/Shaders/CompositeOITFS.js create mode 100644 Source/Shaders/DepthPlaneFS.js create mode 100644 Source/Shaders/DepthPlaneVS.js create mode 100644 Source/Shaders/EllipsoidFS.js create mode 100644 Source/Shaders/EllipsoidVS.js create mode 100644 Source/Shaders/GlobeFS.js create mode 100644 Source/Shaders/GlobeVS.js create mode 100644 Source/Shaders/GroundAtmosphere.js create mode 100644 Source/Shaders/Materials/BumpMapMaterial.js create mode 100644 Source/Shaders/Materials/CheckerboardMaterial.js create mode 100644 Source/Shaders/Materials/DotMaterial.js create mode 100644 Source/Shaders/Materials/ElevationContourMaterial.js create mode 100644 Source/Shaders/Materials/ElevationRampMaterial.js create mode 100644 Source/Shaders/Materials/FadeMaterial.js create mode 100644 Source/Shaders/Materials/GridMaterial.js create mode 100644 Source/Shaders/Materials/NormalMapMaterial.js create mode 100644 Source/Shaders/Materials/PolylineArrowMaterial.js create mode 100644 Source/Shaders/Materials/PolylineDashMaterial.js create mode 100644 Source/Shaders/Materials/PolylineGlowMaterial.js create mode 100644 Source/Shaders/Materials/PolylineOutlineMaterial.js create mode 100644 Source/Shaders/Materials/RimLightingMaterial.js create mode 100644 Source/Shaders/Materials/SlopeRampMaterial.js create mode 100644 Source/Shaders/Materials/StripeMaterial.js create mode 100644 Source/Shaders/Materials/Water.js create mode 100644 Source/Shaders/PointPrimitiveCollectionFS.js create mode 100644 Source/Shaders/PointPrimitiveCollectionVS.js create mode 100644 Source/Shaders/PolylineCommon.js create mode 100644 Source/Shaders/PolylineFS.js create mode 100644 Source/Shaders/PolylineVS.js create mode 100644 Source/Shaders/PostProcessFilters/AdditiveBlend.js create mode 100644 Source/Shaders/PostProcessFilters/BrightPass.js create mode 100644 Source/Shaders/PostProcessFilters/FXAA.js create mode 100644 Source/Shaders/PostProcessFilters/GaussianBlur1D.js create mode 100644 Source/Shaders/PostProcessFilters/PassThrough.js create mode 100644 Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js create mode 100644 Source/Shaders/ReprojectWebMercatorFS.js create mode 100644 Source/Shaders/ReprojectWebMercatorVS.js create mode 100644 Source/Shaders/ShadowVolumeFS.js create mode 100644 Source/Shaders/ShadowVolumeVS.js create mode 100644 Source/Shaders/SkyAtmosphereFS.js create mode 100644 Source/Shaders/SkyAtmosphereVS.js create mode 100644 Source/Shaders/SkyBoxFS.js create mode 100644 Source/Shaders/SkyBoxVS.js create mode 100644 Source/Shaders/SunFS.js create mode 100644 Source/Shaders/SunTextureFS.js create mode 100644 Source/Shaders/SunVS.js create mode 100644 Source/Shaders/Vector3DTilePolylinesVS.js create mode 100644 Source/Shaders/ViewportQuadFS.js create mode 100644 Source/Shaders/ViewportQuadVS.js create mode 100644 Source/ThirdParty/Shaders/FXAA3_11.js diff --git a/Source/Cesium.js b/Source/Cesium.js new file mode 100644 index 000000000000..c34e798fcf77 --- /dev/null +++ b/Source/Cesium.js @@ -0,0 +1,839 @@ +define(['./Core/appendForwardSlash', './Core/arrayFill', './Core/arrayRemoveDuplicates', './Core/arraySlice', './Core/AssociativeArray', './Core/AttributeCompression', './Core/AxisAlignedBoundingBox', './Core/barycentricCoordinates', './Core/binarySearch', './Core/BingMapsApi', './Core/BingMapsGeocoderService', './Core/BoundingRectangle', './Core/BoundingSphere', './Core/BoxGeometry', './Core/BoxOutlineGeometry', './Core/buildModuleUrl', './Core/cancelAnimationFrame', './Core/Cartesian2', './Core/Cartesian3', './Core/Cartesian4', './Core/Cartographic', './Core/CartographicGeocoderService', './Core/CatmullRomSpline', './Core/CesiumTerrainProvider', './Core/Check', './Core/CircleGeometry', './Core/CircleOutlineGeometry', './Core/Clock', './Core/ClockRange', './Core/ClockStep', './Core/clone', './Core/Color', './Core/ColorGeometryInstanceAttribute', './Core/combine', './Core/ComponentDatatype', './Core/CompressedTextureBuffer', './Core/CornerType', './Core/CorridorGeometry', './Core/CorridorGeometryLibrary', './Core/CorridorOutlineGeometry', './Core/createGuid', './Core/createWorldTerrain', './Core/Credit', './Core/CubicRealPolynomial', './Core/CullingVolume', './Core/CylinderGeometry', './Core/CylinderGeometryLibrary', './Core/CylinderOutlineGeometry', './Core/decodeGoogleEarthEnterpriseData', './Core/DefaultProxy', './Core/defaultValue', './Core/defined', './Core/defineProperties', './Core/deprecationWarning', './Core/destroyObject', './Core/DeveloperError', './Core/DistanceDisplayCondition', './Core/DistanceDisplayConditionGeometryInstanceAttribute', './Core/DoublyLinkedList', './Core/EarthOrientationParameters', './Core/EarthOrientationParametersSample', './Core/EasingFunction', './Core/EllipseGeometry', './Core/EllipseGeometryLibrary', './Core/EllipseOutlineGeometry', './Core/Ellipsoid', './Core/EllipsoidalOccluder', './Core/EllipsoidGeodesic', './Core/EllipsoidGeometry', './Core/EllipsoidOutlineGeometry', './Core/EllipsoidTangentPlane', './Core/EllipsoidTerrainProvider', './Core/EncodedCartesian3', './Core/Event', './Core/EventHelper', './Core/ExtrapolationType', './Core/FeatureDetection', './Core/formatError', './Core/freezeObject', './Core/FrustumGeometry', './Core/FrustumOutlineGeometry', './Core/Fullscreen', './Core/GeocoderService', './Core/GeographicProjection', './Core/GeographicTilingScheme', './Core/Geometry', './Core/GeometryAttribute', './Core/GeometryAttributes', './Core/GeometryInstance', './Core/GeometryInstanceAttribute', './Core/GeometryPipeline', './Core/GeometryType', './Core/getAbsoluteUri', './Core/getBaseUri', './Core/getExtensionFromUri', './Core/getFilenameFromUri', './Core/getImagePixels', './Core/getMagic', './Core/getStringFromTypedArray', './Core/getTimestamp', './Core/GoogleEarthEnterpriseMetadata', './Core/GoogleEarthEnterpriseTerrainData', './Core/GoogleEarthEnterpriseTerrainProvider', './Core/GoogleEarthEnterpriseTileInformation', './Core/GregorianDate', './Core/HeadingPitchRange', './Core/HeadingPitchRoll', './Core/Heap', './Core/HeightmapTerrainData', './Core/HeightmapTessellator', './Core/HermitePolynomialApproximation', './Core/HermiteSpline', './Core/Iau2000Orientation', './Core/Iau2006XysData', './Core/Iau2006XysSample', './Core/IauOrientationAxes', './Core/IauOrientationParameters', './Core/IndexDatatype', './Core/InterpolationAlgorithm', './Core/Intersect', './Core/Intersections2D', './Core/IntersectionTests', './Core/Interval', './Core/Ion', './Core/IonResource', './Core/isArray', './Core/isBitSet', './Core/isBlobUri', './Core/isCrossOriginUrl', './Core/isDataUri', './Core/isLeapYear', './Core/Iso8601', './Core/JulianDate', './Core/KeyboardEventModifier', './Core/LagrangePolynomialApproximation', './Core/LeapSecond', './Core/LinearApproximation', './Core/LinearSpline', './Core/loadCRN', './Core/loadImageFromTypedArray', './Core/loadKTX', './Core/ManagedArray', './Core/MapboxApi', './Core/MapProjection', './Core/Math', './Core/Matrix2', './Core/Matrix3', './Core/Matrix4', './Core/mergeSort', './Core/NearFarScalar', './Core/objectToQuery', './Core/Occluder', './Core/oneTimeWarning', './Core/OrientedBoundingBox', './Core/OrthographicFrustum', './Core/OrthographicOffCenterFrustum', './Core/Packable', './Core/PackableForInterpolation', './Core/parseResponseHeaders', './Core/PerspectiveFrustum', './Core/PerspectiveOffCenterFrustum', './Core/PinBuilder', './Core/PixelFormat', './Core/Plane', './Core/PlaneGeometry', './Core/PlaneOutlineGeometry', './Core/pointInsideTriangle', './Core/PolygonGeometry', './Core/PolygonGeometryLibrary', './Core/PolygonHierarchy', './Core/PolygonOutlineGeometry', './Core/PolygonPipeline', './Core/PolylineGeometry', './Core/PolylinePipeline', './Core/PolylineVolumeGeometry', './Core/PolylineVolumeGeometryLibrary', './Core/PolylineVolumeOutlineGeometry', './Core/PrimitiveType', './Core/QuadraticRealPolynomial', './Core/QuantizedMeshTerrainData', './Core/QuarticRealPolynomial', './Core/Quaternion', './Core/QuaternionSpline', './Core/queryToObject', './Core/Queue', './Core/Ray', './Core/Rectangle', './Core/RectangleGeometry', './Core/RectangleGeometryLibrary', './Core/RectangleOutlineGeometry', './Core/ReferenceFrame', './Core/Request', './Core/requestAnimationFrame', './Core/RequestErrorEvent', './Core/RequestScheduler', './Core/RequestState', './Core/RequestType', './Core/Resource', './Core/RuntimeError', './Core/sampleTerrain', './Core/sampleTerrainMostDetailed', './Core/scaleToGeodeticSurface', './Core/ScreenSpaceEventHandler', './Core/ScreenSpaceEventType', './Core/ShowGeometryInstanceAttribute', './Core/Simon1994PlanetaryPositions', './Core/SimplePolylineGeometry', './Core/SphereGeometry', './Core/SphereOutlineGeometry', './Core/Spherical', './Core/Spline', './Core/subdivideArray', './Core/TaskProcessor', './Core/TerrainData', './Core/TerrainEncoding', './Core/TerrainMesh', './Core/TerrainProvider', './Core/TerrainQuantization', './Core/TileAvailability', './Core/TileProviderError', './Core/TilingScheme', './Core/TimeConstants', './Core/TimeInterval', './Core/TimeIntervalCollection', './Core/TimeStandard', './Core/Tipsify', './Core/Transforms', './Core/TranslationRotationScale', './Core/TridiagonalSystemSolver', './Core/TrustedServers', './Core/VertexFormat', './Core/VideoSynchronizer', './Core/Visibility', './Core/VRTheWorldTerrainProvider', './Core/WallGeometry', './Core/WallGeometryLibrary', './Core/WallOutlineGeometry', './Core/WebGLConstants', './Core/WebMercatorProjection', './Core/WebMercatorTilingScheme', './Core/WeightSpline', './Core/WindingOrder', './Core/wrapFunction', './Core/writeTextToCanvas', './DataSources/BillboardGraphics', './DataSources/BillboardVisualizer', './DataSources/BoundingSphereState', './DataSources/BoxGeometryUpdater', './DataSources/BoxGraphics', './DataSources/CallbackProperty', './DataSources/CheckerboardMaterialProperty', './DataSources/ColorMaterialProperty', './DataSources/CompositeEntityCollection', './DataSources/CompositeMaterialProperty', './DataSources/CompositePositionProperty', './DataSources/CompositeProperty', './DataSources/ConstantPositionProperty', './DataSources/ConstantProperty', './DataSources/CorridorGeometryUpdater', './DataSources/CorridorGraphics', './DataSources/createMaterialPropertyDescriptor', './DataSources/createPropertyDescriptor', './DataSources/createRawPropertyDescriptor', './DataSources/CustomDataSource', './DataSources/CylinderGeometryUpdater', './DataSources/CylinderGraphics', './DataSources/CzmlDataSource', './DataSources/DataSource', './DataSources/DataSourceClock', './DataSources/DataSourceCollection', './DataSources/DataSourceDisplay', './DataSources/DynamicGeometryBatch', './DataSources/DynamicGeometryUpdater', './DataSources/EllipseGeometryUpdater', './DataSources/EllipseGraphics', './DataSources/EllipsoidGeometryUpdater', './DataSources/EllipsoidGraphics', './DataSources/Entity', './DataSources/EntityCluster', './DataSources/EntityCollection', './DataSources/EntityView', './DataSources/GeoJsonDataSource', './DataSources/GeometryUpdater', './DataSources/GeometryVisualizer', './DataSources/GridMaterialProperty', './DataSources/ImageMaterialProperty', './DataSources/KmlCamera', './DataSources/KmlDataSource', './DataSources/KmlLookAt', './DataSources/KmlTour', './DataSources/KmlTourFlyTo', './DataSources/KmlTourWait', './DataSources/LabelGraphics', './DataSources/LabelVisualizer', './DataSources/MaterialProperty', './DataSources/ModelGraphics', './DataSources/ModelVisualizer', './DataSources/NodeTransformationProperty', './DataSources/PathGraphics', './DataSources/PathVisualizer', './DataSources/PlaneGeometryUpdater', './DataSources/PlaneGraphics', './DataSources/PointGraphics', './DataSources/PointVisualizer', './DataSources/PolygonGeometryUpdater', './DataSources/PolygonGraphics', './DataSources/PolylineArrowMaterialProperty', './DataSources/PolylineDashMaterialProperty', './DataSources/PolylineGeometryUpdater', './DataSources/PolylineGlowMaterialProperty', './DataSources/PolylineGraphics', './DataSources/PolylineOutlineMaterialProperty', './DataSources/PolylineVisualizer', './DataSources/PolylineVolumeGeometryUpdater', './DataSources/PolylineVolumeGraphics', './DataSources/PositionProperty', './DataSources/PositionPropertyArray', './DataSources/Property', './DataSources/PropertyArray', './DataSources/PropertyBag', './DataSources/RectangleGeometryUpdater', './DataSources/RectangleGraphics', './DataSources/ReferenceProperty', './DataSources/Rotation', './DataSources/SampledPositionProperty', './DataSources/SampledProperty', './DataSources/ScaledPositionProperty', './DataSources/StaticGeometryColorBatch', './DataSources/StaticGeometryPerMaterialBatch', './DataSources/StaticGroundGeometryColorBatch', './DataSources/StaticOutlineGeometryBatch', './DataSources/StripeMaterialProperty', './DataSources/StripeOrientation', './DataSources/TimeIntervalCollectionPositionProperty', './DataSources/TimeIntervalCollectionProperty', './DataSources/VelocityOrientationProperty', './DataSources/VelocityVectorProperty', './DataSources/Visualizer', './DataSources/WallGeometryUpdater', './DataSources/WallGraphics', './Renderer/AutomaticUniforms', './Renderer/Buffer', './Renderer/BufferUsage', './Renderer/ClearCommand', './Renderer/ComputeCommand', './Renderer/ComputeEngine', './Renderer/Context', './Renderer/ContextLimits', './Renderer/createUniform', './Renderer/createUniformArray', './Renderer/CubeMap', './Renderer/CubeMapFace', './Renderer/DrawCommand', './Renderer/Framebuffer', './Renderer/freezeRenderState', './Renderer/loadCubeMap', './Renderer/MipmapHint', './Renderer/modernizeShader', './Renderer/Pass', './Renderer/PassState', './Renderer/PickFramebuffer', './Renderer/PixelDatatype', './Renderer/Renderbuffer', './Renderer/RenderbufferFormat', './Renderer/RenderState', './Renderer/Sampler', './Renderer/ShaderCache', './Renderer/ShaderProgram', './Renderer/ShaderSource', './Renderer/Texture', './Renderer/TextureMagnificationFilter', './Renderer/TextureMinificationFilter', './Renderer/TextureWrap', './Renderer/UniformState', './Renderer/VertexArray', './Renderer/VertexArrayFacade', './Scene/Appearance', './Scene/ArcGisMapServerImageryProvider', './Scene/AttributeType', './Scene/Axis', './Scene/Batched3DModel3DTileContent', './Scene/BatchTable', './Scene/Billboard', './Scene/BillboardCollection', './Scene/BingMapsImageryProvider', './Scene/BingMapsStyle', './Scene/BlendEquation', './Scene/BlendFunction', './Scene/BlendingState', './Scene/BlendOption', './Scene/BoxEmitter', './Scene/BrdfLutGenerator', './Scene/Camera', './Scene/CameraEventAggregator', './Scene/CameraEventType', './Scene/CameraFlightPath', './Scene/Cesium3DTile', './Scene/Cesium3DTileBatchTable', './Scene/Cesium3DTileChildrenVisibility', './Scene/Cesium3DTileColorBlendMode', './Scene/Cesium3DTileContent', './Scene/Cesium3DTileContentFactory', './Scene/Cesium3DTileContentState', './Scene/Cesium3DTileFeature', './Scene/Cesium3DTileFeatureTable', './Scene/Cesium3DTileOptimizationHint', './Scene/Cesium3DTileOptimizations', './Scene/Cesium3DTilePointFeature', './Scene/Cesium3DTileRefine', './Scene/Cesium3DTileset', './Scene/Cesium3DTilesetStatistics', './Scene/Cesium3DTilesetTraversal', './Scene/Cesium3DTileStyle', './Scene/Cesium3DTileStyleEngine', './Scene/CircleEmitter', './Scene/ClassificationModel', './Scene/ClassificationPrimitive', './Scene/ClassificationType', './Scene/ClippingPlane', './Scene/ClippingPlaneCollection', './Scene/ColorBlendMode', './Scene/Composite3DTileContent', './Scene/ConditionsExpression', './Scene/ConeEmitter', './Scene/createBillboardPointCallback', './Scene/createOpenStreetMapImageryProvider', './Scene/createTangentSpaceDebugPrimitive', './Scene/createTileMapServiceImageryProvider', './Scene/CreditDisplay', './Scene/CullFace', './Scene/DebugAppearance', './Scene/DebugCameraPrimitive', './Scene/DebugModelMatrixPrimitive', './Scene/DepthFunction', './Scene/DepthPlane', './Scene/DerivedCommand', './Scene/DeviceOrientationCameraController', './Scene/DiscardMissingTileImagePolicy', './Scene/DracoLoader', './Scene/EllipsoidPrimitive', './Scene/EllipsoidSurfaceAppearance', './Scene/Empty3DTileContent', './Scene/Expression', './Scene/ExpressionNodeType', './Scene/Fog', './Scene/FrameRateMonitor', './Scene/FrameState', './Scene/FrustumCommands', './Scene/FXAA', './Scene/Geometry3DTileContent', './Scene/getBinaryAccessor', './Scene/getClipAndStyleCode', './Scene/getClippingFunction', './Scene/GetFeatureInfoFormat', './Scene/Globe', './Scene/GlobeDepth', './Scene/GlobeSurfaceShaderSet', './Scene/GlobeSurfaceTile', './Scene/GlobeSurfaceTileProvider', './Scene/GoogleEarthEnterpriseImageryProvider', './Scene/GoogleEarthEnterpriseMapsProvider', './Scene/GridImageryProvider', './Scene/GroundPrimitive', './Scene/HeightReference', './Scene/HorizontalOrigin', './Scene/Imagery', './Scene/ImageryLayer', './Scene/ImageryLayerCollection', './Scene/ImageryLayerFeatureInfo', './Scene/ImageryProvider', './Scene/ImagerySplitDirection', './Scene/ImageryState', './Scene/Instanced3DModel3DTileContent', './Scene/InvertClassification', './Scene/IonImageryProvider', './Scene/JobScheduler', './Scene/JobType', './Scene/Label', './Scene/LabelCollection', './Scene/LabelStyle', './Scene/MapboxImageryProvider', './Scene/MapMode2D', './Scene/Material', './Scene/MaterialAppearance', './Scene/Model', './Scene/ModelAnimation', './Scene/ModelAnimationCache', './Scene/ModelAnimationCollection', './Scene/ModelAnimationLoop', './Scene/ModelAnimationState', './Scene/ModelInstance', './Scene/ModelInstanceCollection', './Scene/ModelLoadResources', './Scene/ModelMaterial', './Scene/ModelMesh', './Scene/ModelNode', './Scene/ModelUtility', './Scene/Moon', './Scene/NeverTileDiscardPolicy', './Scene/OIT', './Scene/Particle', './Scene/ParticleBurst', './Scene/ParticleEmitter', './Scene/ParticleSystem', './Scene/PerformanceDisplay', './Scene/PerInstanceColorAppearance', './Scene/PickDepth', './Scene/PointCloud3DTileContent', './Scene/PointCloudEyeDomeLighting', './Scene/PointCloudShading', './Scene/PointPrimitive', './Scene/PointPrimitiveCollection', './Scene/Polyline', './Scene/PolylineCollection', './Scene/PolylineColorAppearance', './Scene/PolylineMaterialAppearance', './Scene/Primitive', './Scene/PrimitiveCollection', './Scene/PrimitivePipeline', './Scene/PrimitiveState', './Scene/QuadtreeOccluders', './Scene/QuadtreePrimitive', './Scene/QuadtreeTile', './Scene/QuadtreeTileLoadState', './Scene/QuadtreeTileProvider', './Scene/Scene', './Scene/SceneMode', './Scene/SceneTransforms', './Scene/SceneTransitioner', './Scene/ScreenSpaceCameraController', './Scene/ShadowMap', './Scene/ShadowMapShader', './Scene/ShadowMode', './Scene/SingleTileImageryProvider', './Scene/SkyAtmosphere', './Scene/SkyBox', './Scene/SphereEmitter', './Scene/StencilFunction', './Scene/StencilOperation', './Scene/StyleExpression', './Scene/Sun', './Scene/SunPostProcess', './Scene/TerrainState', './Scene/TextureAtlas', './Scene/TileBoundingRegion', './Scene/TileBoundingSphere', './Scene/TileBoundingVolume', './Scene/TileCoordinatesImageryProvider', './Scene/TileDiscardPolicy', './Scene/TileImagery', './Scene/TileOrientedBoundingBox', './Scene/TileReplacementQueue', './Scene/Tileset3DTileContent', './Scene/TileState', './Scene/TileTerrain', './Scene/TimeDynamicImagery', './Scene/TweenCollection', './Scene/UrlTemplateImageryProvider', './Scene/Vector3DTileBatch', './Scene/Vector3DTileContent', './Scene/Vector3DTileGeometry', './Scene/Vector3DTilePoints', './Scene/Vector3DTilePolygons', './Scene/Vector3DTilePolylines', './Scene/Vector3DTilePrimitive', './Scene/VerticalOrigin', './Scene/ViewportQuad', './Scene/WebMapServiceImageryProvider', './Scene/WebMapTileServiceImageryProvider', './Shaders/AdjustTranslucentFS', './Shaders/Appearances/AllMaterialAppearanceFS', './Shaders/Appearances/AllMaterialAppearanceVS', './Shaders/Appearances/BasicMaterialAppearanceFS', './Shaders/Appearances/BasicMaterialAppearanceVS', './Shaders/Appearances/EllipsoidSurfaceAppearanceFS', './Shaders/Appearances/EllipsoidSurfaceAppearanceVS', './Shaders/Appearances/PerInstanceColorAppearanceFS', './Shaders/Appearances/PerInstanceColorAppearanceVS', './Shaders/Appearances/PerInstanceFlatColorAppearanceFS', './Shaders/Appearances/PerInstanceFlatColorAppearanceVS', './Shaders/Appearances/PolylineColorAppearanceVS', './Shaders/Appearances/PolylineMaterialAppearanceVS', './Shaders/Appearances/TexturedMaterialAppearanceFS', './Shaders/Appearances/TexturedMaterialAppearanceVS', './Shaders/BillboardCollectionFS', './Shaders/BillboardCollectionVS', './Shaders/BrdfLutGeneratorFS', './Shaders/Builtin/Constants/degreesPerRadian', './Shaders/Builtin/Constants/depthRange', './Shaders/Builtin/Constants/epsilon1', './Shaders/Builtin/Constants/epsilon2', './Shaders/Builtin/Constants/epsilon3', './Shaders/Builtin/Constants/epsilon4', './Shaders/Builtin/Constants/epsilon5', './Shaders/Builtin/Constants/epsilon6', './Shaders/Builtin/Constants/epsilon7', './Shaders/Builtin/Constants/infinity', './Shaders/Builtin/Constants/oneOverPi', './Shaders/Builtin/Constants/oneOverTwoPi', './Shaders/Builtin/Constants/passCesium3DTile', './Shaders/Builtin/Constants/passCesium3DTileClassification', './Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow', './Shaders/Builtin/Constants/passClassification', './Shaders/Builtin/Constants/passCompute', './Shaders/Builtin/Constants/passEnvironment', './Shaders/Builtin/Constants/passGlobe', './Shaders/Builtin/Constants/passOpaque', './Shaders/Builtin/Constants/passOverlay', './Shaders/Builtin/Constants/passTerrainClassification', './Shaders/Builtin/Constants/passTranslucent', './Shaders/Builtin/Constants/pi', './Shaders/Builtin/Constants/piOverFour', './Shaders/Builtin/Constants/piOverSix', './Shaders/Builtin/Constants/piOverThree', './Shaders/Builtin/Constants/piOverTwo', './Shaders/Builtin/Constants/radiansPerDegree', './Shaders/Builtin/Constants/sceneMode2D', './Shaders/Builtin/Constants/sceneMode3D', './Shaders/Builtin/Constants/sceneModeColumbusView', './Shaders/Builtin/Constants/sceneModeMorphing', './Shaders/Builtin/Constants/solarRadius', './Shaders/Builtin/Constants/threePiOver2', './Shaders/Builtin/Constants/twoPi', './Shaders/Builtin/Constants/webMercatorMaxLatitude', './Shaders/Builtin/CzmBuiltins', './Shaders/Builtin/Functions/alphaWeight', './Shaders/Builtin/Functions/antialias', './Shaders/Builtin/Functions/cascadeColor', './Shaders/Builtin/Functions/cascadeDistance', './Shaders/Builtin/Functions/cascadeMatrix', './Shaders/Builtin/Functions/cascadeWeights', './Shaders/Builtin/Functions/columbusViewMorph', './Shaders/Builtin/Functions/computePosition', './Shaders/Builtin/Functions/cosineAndSine', './Shaders/Builtin/Functions/decompressTextureCoordinates', './Shaders/Builtin/Functions/depthClampFarPlane', './Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates', './Shaders/Builtin/Functions/ellipsoidContainsPoint', './Shaders/Builtin/Functions/ellipsoidNew', './Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates', './Shaders/Builtin/Functions/equalsEpsilon', './Shaders/Builtin/Functions/eyeOffset', './Shaders/Builtin/Functions/eyeToWindowCoordinates', './Shaders/Builtin/Functions/fog', './Shaders/Builtin/Functions/geodeticSurfaceNormal', './Shaders/Builtin/Functions/getDefaultMaterial', './Shaders/Builtin/Functions/getLambertDiffuse', './Shaders/Builtin/Functions/getSpecular', './Shaders/Builtin/Functions/getWaterNoise', './Shaders/Builtin/Functions/getWgs84EllipsoidEC', './Shaders/Builtin/Functions/HSBToRGB', './Shaders/Builtin/Functions/HSLToRGB', './Shaders/Builtin/Functions/hue', './Shaders/Builtin/Functions/isEmpty', './Shaders/Builtin/Functions/isFull', './Shaders/Builtin/Functions/latitudeToWebMercatorFraction', './Shaders/Builtin/Functions/luminance', './Shaders/Builtin/Functions/metersPerPixel', './Shaders/Builtin/Functions/modelToWindowCoordinates', './Shaders/Builtin/Functions/multiplyWithColorBalance', './Shaders/Builtin/Functions/nearFarScalar', './Shaders/Builtin/Functions/octDecode', './Shaders/Builtin/Functions/packDepth', './Shaders/Builtin/Functions/phong', './Shaders/Builtin/Functions/pointAlongRay', './Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval', './Shaders/Builtin/Functions/reverseLogDepth', './Shaders/Builtin/Functions/RGBToHSB', './Shaders/Builtin/Functions/RGBToHSL', './Shaders/Builtin/Functions/RGBToXYZ', './Shaders/Builtin/Functions/saturation', './Shaders/Builtin/Functions/shadowDepthCompare', './Shaders/Builtin/Functions/shadowVisibility', './Shaders/Builtin/Functions/signNotZero', './Shaders/Builtin/Functions/tangentToEyeSpaceMatrix', './Shaders/Builtin/Functions/transformPlane', './Shaders/Builtin/Functions/translateRelativeToEye', './Shaders/Builtin/Functions/translucentPhong', './Shaders/Builtin/Functions/transpose', './Shaders/Builtin/Functions/unpackDepth', './Shaders/Builtin/Functions/unpackFloat', './Shaders/Builtin/Functions/vertexLogDepth', './Shaders/Builtin/Functions/windowToEyeCoordinates', './Shaders/Builtin/Functions/writeDepthClampedToFarPlane', './Shaders/Builtin/Functions/writeLogDepth', './Shaders/Builtin/Functions/XYZToRGB', './Shaders/Builtin/Structs/depthRangeStruct', './Shaders/Builtin/Structs/ellipsoid', './Shaders/Builtin/Structs/material', './Shaders/Builtin/Structs/materialInput', './Shaders/Builtin/Structs/ray', './Shaders/Builtin/Structs/raySegment', './Shaders/Builtin/Structs/shadowParameters', './Shaders/CompositeOITFS', './Shaders/DepthPlaneFS', './Shaders/DepthPlaneVS', './Shaders/EllipsoidFS', './Shaders/EllipsoidVS', './Shaders/GlobeFS', './Shaders/GlobeVS', './Shaders/GroundAtmosphere', './Shaders/Materials/BumpMapMaterial', './Shaders/Materials/CheckerboardMaterial', './Shaders/Materials/DotMaterial', './Shaders/Materials/ElevationContourMaterial', './Shaders/Materials/ElevationRampMaterial', './Shaders/Materials/FadeMaterial', './Shaders/Materials/GridMaterial', './Shaders/Materials/NormalMapMaterial', './Shaders/Materials/PolylineArrowMaterial', './Shaders/Materials/PolylineDashMaterial', './Shaders/Materials/PolylineGlowMaterial', './Shaders/Materials/PolylineOutlineMaterial', './Shaders/Materials/RimLightingMaterial', './Shaders/Materials/SlopeRampMaterial', './Shaders/Materials/StripeMaterial', './Shaders/Materials/Water', './Shaders/PointPrimitiveCollectionFS', './Shaders/PointPrimitiveCollectionVS', './Shaders/PolylineCommon', './Shaders/PolylineFS', './Shaders/PolylineVS', './Shaders/PostProcessFilters/AdditiveBlend', './Shaders/PostProcessFilters/BrightPass', './Shaders/PostProcessFilters/FXAA', './Shaders/PostProcessFilters/GaussianBlur1D', './Shaders/PostProcessFilters/PassThrough', './Shaders/PostProcessFilters/PointCloudEyeDomeLighting', './Shaders/ReprojectWebMercatorFS', './Shaders/ReprojectWebMercatorVS', './Shaders/ShadowVolumeFS', './Shaders/ShadowVolumeVS', './Shaders/SkyAtmosphereFS', './Shaders/SkyAtmosphereVS', './Shaders/SkyBoxFS', './Shaders/SkyBoxVS', './Shaders/SunFS', './Shaders/SunTextureFS', './Shaders/SunVS', './Shaders/Vector3DTilePolylinesVS', './Shaders/ViewportQuadFS', './Shaders/ViewportQuadVS', './ThirdParty/Autolinker', './ThirdParty/earcut-2.1.1', './ThirdParty/GltfPipeline/addDefaults', './ThirdParty/GltfPipeline/addExtensionsRequired', './ThirdParty/GltfPipeline/addExtensionsUsed', './ThirdParty/GltfPipeline/addPipelineExtras', './ThirdParty/GltfPipeline/addToArray', './ThirdParty/GltfPipeline/byteLengthForComponentType', './ThirdParty/GltfPipeline/findAccessorMinMax', './ThirdParty/GltfPipeline/ForEach', './ThirdParty/GltfPipeline/getAccessorByteStride', './ThirdParty/GltfPipeline/getJointCountForMaterials', './ThirdParty/GltfPipeline/glslTypeToWebGLConstant', './ThirdParty/GltfPipeline/numberOfComponentsForType', './ThirdParty/GltfPipeline/parseBinaryGltf', './ThirdParty/GltfPipeline/processModelMaterialsCommon', './ThirdParty/GltfPipeline/processPbrMetallicRoughness', './ThirdParty/GltfPipeline/removeExtensionsRequired', './ThirdParty/GltfPipeline/removeExtensionsUsed', './ThirdParty/GltfPipeline/removePipelineExtras', './ThirdParty/GltfPipeline/techniqueParameterForSemantic', './ThirdParty/GltfPipeline/updateVersion', './ThirdParty/GltfPipeline/webGLConstantToGlslType', './ThirdParty/google-earth-dbroot-parser', './ThirdParty/jsep', './ThirdParty/kdbush', './ThirdParty/knockout-3.4.2', './ThirdParty/knockout-es5', './ThirdParty/knockout', './ThirdParty/measureText', './ThirdParty/mersenne-twister', './ThirdParty/NoSleep', './ThirdParty/protobuf-minimal', './ThirdParty/Shaders/FXAA3_11', './ThirdParty/sprintf', './ThirdParty/topojson', './ThirdParty/Tween', './ThirdParty/Uri', './ThirdParty/when', './ThirdParty/xss', './ThirdParty/zip', './Widgets/Animation/Animation', './Widgets/Animation/AnimationViewModel', './Widgets/BaseLayerPicker/BaseLayerPicker', './Widgets/BaseLayerPicker/BaseLayerPickerViewModel', './Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels', './Widgets/BaseLayerPicker/createDefaultTerrainProviderViewModels', './Widgets/BaseLayerPicker/ProviderViewModel', './Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector', './Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel', './Widgets/CesiumInspector/CesiumInspector', './Widgets/CesiumInspector/CesiumInspectorViewModel', './Widgets/CesiumWidget/CesiumWidget', './Widgets/ClockViewModel', './Widgets/Command', './Widgets/createCommand', './Widgets/FullscreenButton/FullscreenButton', './Widgets/FullscreenButton/FullscreenButtonViewModel', './Widgets/Geocoder/Geocoder', './Widgets/Geocoder/GeocoderViewModel', './Widgets/getElement', './Widgets/HomeButton/HomeButton', './Widgets/HomeButton/HomeButtonViewModel', './Widgets/InfoBox/InfoBox', './Widgets/InfoBox/InfoBoxViewModel', './Widgets/NavigationHelpButton/NavigationHelpButton', './Widgets/NavigationHelpButton/NavigationHelpButtonViewModel', './Widgets/PerformanceWatchdog/PerformanceWatchdog', './Widgets/PerformanceWatchdog/PerformanceWatchdogViewModel', './Widgets/ProjectionPicker/ProjectionPicker', './Widgets/ProjectionPicker/ProjectionPickerViewModel', './Widgets/SceneModePicker/SceneModePicker', './Widgets/SceneModePicker/SceneModePickerViewModel', './Widgets/SelectionIndicator/SelectionIndicator', './Widgets/SelectionIndicator/SelectionIndicatorViewModel', './Widgets/subscribeAndEvaluate', './Widgets/SvgPathBindingHandler', './Widgets/Timeline/Timeline', './Widgets/Timeline/TimelineHighlightRange', './Widgets/Timeline/TimelineTrack', './Widgets/ToggleButtonViewModel', './Widgets/Viewer/Viewer', './Widgets/Viewer/viewerCesium3DTilesInspectorMixin', './Widgets/Viewer/viewerCesiumInspectorMixin', './Widgets/Viewer/viewerDragDropMixin', './Widgets/Viewer/viewerPerformanceWatchdogMixin', './Widgets/VRButton/VRButton', './Widgets/VRButton/VRButtonViewModel', './Workers/createTaskProcessorWorker'], function(Core_appendForwardSlash, Core_arrayFill, Core_arrayRemoveDuplicates, Core_arraySlice, Core_AssociativeArray, Core_AttributeCompression, Core_AxisAlignedBoundingBox, Core_barycentricCoordinates, Core_binarySearch, Core_BingMapsApi, Core_BingMapsGeocoderService, Core_BoundingRectangle, Core_BoundingSphere, Core_BoxGeometry, Core_BoxOutlineGeometry, Core_buildModuleUrl, Core_cancelAnimationFrame, Core_Cartesian2, Core_Cartesian3, Core_Cartesian4, Core_Cartographic, Core_CartographicGeocoderService, Core_CatmullRomSpline, Core_CesiumTerrainProvider, Core_Check, Core_CircleGeometry, Core_CircleOutlineGeometry, Core_Clock, Core_ClockRange, Core_ClockStep, Core_clone, Core_Color, Core_ColorGeometryInstanceAttribute, Core_combine, Core_ComponentDatatype, Core_CompressedTextureBuffer, Core_CornerType, Core_CorridorGeometry, Core_CorridorGeometryLibrary, Core_CorridorOutlineGeometry, Core_createGuid, Core_createWorldTerrain, Core_Credit, Core_CubicRealPolynomial, Core_CullingVolume, Core_CylinderGeometry, Core_CylinderGeometryLibrary, Core_CylinderOutlineGeometry, Core_decodeGoogleEarthEnterpriseData, Core_DefaultProxy, Core_defaultValue, Core_defined, Core_defineProperties, Core_deprecationWarning, Core_destroyObject, Core_DeveloperError, Core_DistanceDisplayCondition, Core_DistanceDisplayConditionGeometryInstanceAttribute, Core_DoublyLinkedList, Core_EarthOrientationParameters, Core_EarthOrientationParametersSample, Core_EasingFunction, Core_EllipseGeometry, Core_EllipseGeometryLibrary, Core_EllipseOutlineGeometry, Core_Ellipsoid, Core_EllipsoidalOccluder, Core_EllipsoidGeodesic, Core_EllipsoidGeometry, Core_EllipsoidOutlineGeometry, Core_EllipsoidTangentPlane, Core_EllipsoidTerrainProvider, Core_EncodedCartesian3, Core_Event, Core_EventHelper, Core_ExtrapolationType, Core_FeatureDetection, Core_formatError, Core_freezeObject, Core_FrustumGeometry, Core_FrustumOutlineGeometry, Core_Fullscreen, Core_GeocoderService, Core_GeographicProjection, Core_GeographicTilingScheme, Core_Geometry, Core_GeometryAttribute, Core_GeometryAttributes, Core_GeometryInstance, Core_GeometryInstanceAttribute, Core_GeometryPipeline, Core_GeometryType, Core_getAbsoluteUri, Core_getBaseUri, Core_getExtensionFromUri, Core_getFilenameFromUri, Core_getImagePixels, Core_getMagic, Core_getStringFromTypedArray, Core_getTimestamp, Core_GoogleEarthEnterpriseMetadata, Core_GoogleEarthEnterpriseTerrainData, Core_GoogleEarthEnterpriseTerrainProvider, Core_GoogleEarthEnterpriseTileInformation, Core_GregorianDate, Core_HeadingPitchRange, Core_HeadingPitchRoll, Core_Heap, Core_HeightmapTerrainData, Core_HeightmapTessellator, Core_HermitePolynomialApproximation, Core_HermiteSpline, Core_Iau2000Orientation, Core_Iau2006XysData, Core_Iau2006XysSample, Core_IauOrientationAxes, Core_IauOrientationParameters, Core_IndexDatatype, Core_InterpolationAlgorithm, Core_Intersect, Core_Intersections2D, Core_IntersectionTests, Core_Interval, Core_Ion, Core_IonResource, Core_isArray, Core_isBitSet, Core_isBlobUri, Core_isCrossOriginUrl, Core_isDataUri, Core_isLeapYear, Core_Iso8601, Core_JulianDate, Core_KeyboardEventModifier, Core_LagrangePolynomialApproximation, Core_LeapSecond, Core_LinearApproximation, Core_LinearSpline, Core_loadCRN, Core_loadImageFromTypedArray, Core_loadKTX, Core_ManagedArray, Core_MapboxApi, Core_MapProjection, Core_Math, Core_Matrix2, Core_Matrix3, Core_Matrix4, Core_mergeSort, Core_NearFarScalar, Core_objectToQuery, Core_Occluder, Core_oneTimeWarning, Core_OrientedBoundingBox, Core_OrthographicFrustum, Core_OrthographicOffCenterFrustum, Core_Packable, Core_PackableForInterpolation, Core_parseResponseHeaders, Core_PerspectiveFrustum, Core_PerspectiveOffCenterFrustum, Core_PinBuilder, Core_PixelFormat, Core_Plane, Core_PlaneGeometry, Core_PlaneOutlineGeometry, Core_pointInsideTriangle, Core_PolygonGeometry, Core_PolygonGeometryLibrary, Core_PolygonHierarchy, Core_PolygonOutlineGeometry, Core_PolygonPipeline, Core_PolylineGeometry, Core_PolylinePipeline, Core_PolylineVolumeGeometry, Core_PolylineVolumeGeometryLibrary, Core_PolylineVolumeOutlineGeometry, Core_PrimitiveType, Core_QuadraticRealPolynomial, Core_QuantizedMeshTerrainData, Core_QuarticRealPolynomial, Core_Quaternion, Core_QuaternionSpline, Core_queryToObject, Core_Queue, Core_Ray, Core_Rectangle, Core_RectangleGeometry, Core_RectangleGeometryLibrary, Core_RectangleOutlineGeometry, Core_ReferenceFrame, Core_Request, Core_requestAnimationFrame, Core_RequestErrorEvent, Core_RequestScheduler, Core_RequestState, Core_RequestType, Core_Resource, Core_RuntimeError, Core_sampleTerrain, Core_sampleTerrainMostDetailed, Core_scaleToGeodeticSurface, Core_ScreenSpaceEventHandler, Core_ScreenSpaceEventType, Core_ShowGeometryInstanceAttribute, Core_Simon1994PlanetaryPositions, Core_SimplePolylineGeometry, Core_SphereGeometry, Core_SphereOutlineGeometry, Core_Spherical, Core_Spline, Core_subdivideArray, Core_TaskProcessor, Core_TerrainData, Core_TerrainEncoding, Core_TerrainMesh, Core_TerrainProvider, Core_TerrainQuantization, Core_TileAvailability, Core_TileProviderError, Core_TilingScheme, Core_TimeConstants, Core_TimeInterval, Core_TimeIntervalCollection, Core_TimeStandard, Core_Tipsify, Core_Transforms, Core_TranslationRotationScale, Core_TridiagonalSystemSolver, Core_TrustedServers, Core_VertexFormat, Core_VideoSynchronizer, Core_Visibility, Core_VRTheWorldTerrainProvider, Core_WallGeometry, Core_WallGeometryLibrary, Core_WallOutlineGeometry, Core_WebGLConstants, Core_WebMercatorProjection, Core_WebMercatorTilingScheme, Core_WeightSpline, Core_WindingOrder, Core_wrapFunction, Core_writeTextToCanvas, DataSources_BillboardGraphics, DataSources_BillboardVisualizer, DataSources_BoundingSphereState, DataSources_BoxGeometryUpdater, DataSources_BoxGraphics, DataSources_CallbackProperty, DataSources_CheckerboardMaterialProperty, DataSources_ColorMaterialProperty, DataSources_CompositeEntityCollection, DataSources_CompositeMaterialProperty, DataSources_CompositePositionProperty, DataSources_CompositeProperty, DataSources_ConstantPositionProperty, DataSources_ConstantProperty, DataSources_CorridorGeometryUpdater, DataSources_CorridorGraphics, DataSources_createMaterialPropertyDescriptor, DataSources_createPropertyDescriptor, DataSources_createRawPropertyDescriptor, DataSources_CustomDataSource, DataSources_CylinderGeometryUpdater, DataSources_CylinderGraphics, DataSources_CzmlDataSource, DataSources_DataSource, DataSources_DataSourceClock, DataSources_DataSourceCollection, DataSources_DataSourceDisplay, DataSources_DynamicGeometryBatch, DataSources_DynamicGeometryUpdater, DataSources_EllipseGeometryUpdater, DataSources_EllipseGraphics, DataSources_EllipsoidGeometryUpdater, DataSources_EllipsoidGraphics, DataSources_Entity, DataSources_EntityCluster, DataSources_EntityCollection, DataSources_EntityView, DataSources_GeoJsonDataSource, DataSources_GeometryUpdater, DataSources_GeometryVisualizer, DataSources_GridMaterialProperty, DataSources_ImageMaterialProperty, DataSources_KmlCamera, DataSources_KmlDataSource, DataSources_KmlLookAt, DataSources_KmlTour, DataSources_KmlTourFlyTo, DataSources_KmlTourWait, DataSources_LabelGraphics, DataSources_LabelVisualizer, DataSources_MaterialProperty, DataSources_ModelGraphics, DataSources_ModelVisualizer, DataSources_NodeTransformationProperty, DataSources_PathGraphics, DataSources_PathVisualizer, DataSources_PlaneGeometryUpdater, DataSources_PlaneGraphics, DataSources_PointGraphics, DataSources_PointVisualizer, DataSources_PolygonGeometryUpdater, DataSources_PolygonGraphics, DataSources_PolylineArrowMaterialProperty, DataSources_PolylineDashMaterialProperty, DataSources_PolylineGeometryUpdater, DataSources_PolylineGlowMaterialProperty, DataSources_PolylineGraphics, DataSources_PolylineOutlineMaterialProperty, DataSources_PolylineVisualizer, DataSources_PolylineVolumeGeometryUpdater, DataSources_PolylineVolumeGraphics, DataSources_PositionProperty, DataSources_PositionPropertyArray, DataSources_Property, DataSources_PropertyArray, DataSources_PropertyBag, DataSources_RectangleGeometryUpdater, DataSources_RectangleGraphics, DataSources_ReferenceProperty, DataSources_Rotation, DataSources_SampledPositionProperty, DataSources_SampledProperty, DataSources_ScaledPositionProperty, DataSources_StaticGeometryColorBatch, DataSources_StaticGeometryPerMaterialBatch, DataSources_StaticGroundGeometryColorBatch, DataSources_StaticOutlineGeometryBatch, DataSources_StripeMaterialProperty, DataSources_StripeOrientation, DataSources_TimeIntervalCollectionPositionProperty, DataSources_TimeIntervalCollectionProperty, DataSources_VelocityOrientationProperty, DataSources_VelocityVectorProperty, DataSources_Visualizer, DataSources_WallGeometryUpdater, DataSources_WallGraphics, Renderer_AutomaticUniforms, Renderer_Buffer, Renderer_BufferUsage, Renderer_ClearCommand, Renderer_ComputeCommand, Renderer_ComputeEngine, Renderer_Context, Renderer_ContextLimits, Renderer_createUniform, Renderer_createUniformArray, Renderer_CubeMap, Renderer_CubeMapFace, Renderer_DrawCommand, Renderer_Framebuffer, Renderer_freezeRenderState, Renderer_loadCubeMap, Renderer_MipmapHint, Renderer_modernizeShader, Renderer_Pass, Renderer_PassState, Renderer_PickFramebuffer, Renderer_PixelDatatype, Renderer_Renderbuffer, Renderer_RenderbufferFormat, Renderer_RenderState, Renderer_Sampler, Renderer_ShaderCache, Renderer_ShaderProgram, Renderer_ShaderSource, Renderer_Texture, Renderer_TextureMagnificationFilter, Renderer_TextureMinificationFilter, Renderer_TextureWrap, Renderer_UniformState, Renderer_VertexArray, Renderer_VertexArrayFacade, Scene_Appearance, Scene_ArcGisMapServerImageryProvider, Scene_AttributeType, Scene_Axis, Scene_Batched3DModel3DTileContent, Scene_BatchTable, Scene_Billboard, Scene_BillboardCollection, Scene_BingMapsImageryProvider, Scene_BingMapsStyle, Scene_BlendEquation, Scene_BlendFunction, Scene_BlendingState, Scene_BlendOption, Scene_BoxEmitter, Scene_BrdfLutGenerator, Scene_Camera, Scene_CameraEventAggregator, Scene_CameraEventType, Scene_CameraFlightPath, Scene_Cesium3DTile, Scene_Cesium3DTileBatchTable, Scene_Cesium3DTileChildrenVisibility, Scene_Cesium3DTileColorBlendMode, Scene_Cesium3DTileContent, Scene_Cesium3DTileContentFactory, Scene_Cesium3DTileContentState, Scene_Cesium3DTileFeature, Scene_Cesium3DTileFeatureTable, Scene_Cesium3DTileOptimizationHint, Scene_Cesium3DTileOptimizations, Scene_Cesium3DTilePointFeature, Scene_Cesium3DTileRefine, Scene_Cesium3DTileset, Scene_Cesium3DTilesetStatistics, Scene_Cesium3DTilesetTraversal, Scene_Cesium3DTileStyle, Scene_Cesium3DTileStyleEngine, Scene_CircleEmitter, Scene_ClassificationModel, Scene_ClassificationPrimitive, Scene_ClassificationType, Scene_ClippingPlane, Scene_ClippingPlaneCollection, Scene_ColorBlendMode, Scene_Composite3DTileContent, Scene_ConditionsExpression, Scene_ConeEmitter, Scene_createBillboardPointCallback, Scene_createOpenStreetMapImageryProvider, Scene_createTangentSpaceDebugPrimitive, Scene_createTileMapServiceImageryProvider, Scene_CreditDisplay, Scene_CullFace, Scene_DebugAppearance, Scene_DebugCameraPrimitive, Scene_DebugModelMatrixPrimitive, Scene_DepthFunction, Scene_DepthPlane, Scene_DerivedCommand, Scene_DeviceOrientationCameraController, Scene_DiscardMissingTileImagePolicy, Scene_DracoLoader, Scene_EllipsoidPrimitive, Scene_EllipsoidSurfaceAppearance, Scene_Empty3DTileContent, Scene_Expression, Scene_ExpressionNodeType, Scene_Fog, Scene_FrameRateMonitor, Scene_FrameState, Scene_FrustumCommands, Scene_FXAA, Scene_Geometry3DTileContent, Scene_getBinaryAccessor, Scene_getClipAndStyleCode, Scene_getClippingFunction, Scene_GetFeatureInfoFormat, Scene_Globe, Scene_GlobeDepth, Scene_GlobeSurfaceShaderSet, Scene_GlobeSurfaceTile, Scene_GlobeSurfaceTileProvider, Scene_GoogleEarthEnterpriseImageryProvider, Scene_GoogleEarthEnterpriseMapsProvider, Scene_GridImageryProvider, Scene_GroundPrimitive, Scene_HeightReference, Scene_HorizontalOrigin, Scene_Imagery, Scene_ImageryLayer, Scene_ImageryLayerCollection, Scene_ImageryLayerFeatureInfo, Scene_ImageryProvider, Scene_ImagerySplitDirection, Scene_ImageryState, Scene_Instanced3DModel3DTileContent, Scene_InvertClassification, Scene_IonImageryProvider, Scene_JobScheduler, Scene_JobType, Scene_Label, Scene_LabelCollection, Scene_LabelStyle, Scene_MapboxImageryProvider, Scene_MapMode2D, Scene_Material, Scene_MaterialAppearance, Scene_Model, Scene_ModelAnimation, Scene_ModelAnimationCache, Scene_ModelAnimationCollection, Scene_ModelAnimationLoop, Scene_ModelAnimationState, Scene_ModelInstance, Scene_ModelInstanceCollection, Scene_ModelLoadResources, Scene_ModelMaterial, Scene_ModelMesh, Scene_ModelNode, Scene_ModelUtility, Scene_Moon, Scene_NeverTileDiscardPolicy, Scene_OIT, Scene_Particle, Scene_ParticleBurst, Scene_ParticleEmitter, Scene_ParticleSystem, Scene_PerformanceDisplay, Scene_PerInstanceColorAppearance, Scene_PickDepth, Scene_PointCloud3DTileContent, Scene_PointCloudEyeDomeLighting, Scene_PointCloudShading, Scene_PointPrimitive, Scene_PointPrimitiveCollection, Scene_Polyline, Scene_PolylineCollection, Scene_PolylineColorAppearance, Scene_PolylineMaterialAppearance, Scene_Primitive, Scene_PrimitiveCollection, Scene_PrimitivePipeline, Scene_PrimitiveState, Scene_QuadtreeOccluders, Scene_QuadtreePrimitive, Scene_QuadtreeTile, Scene_QuadtreeTileLoadState, Scene_QuadtreeTileProvider, Scene_Scene, Scene_SceneMode, Scene_SceneTransforms, Scene_SceneTransitioner, Scene_ScreenSpaceCameraController, Scene_ShadowMap, Scene_ShadowMapShader, Scene_ShadowMode, Scene_SingleTileImageryProvider, Scene_SkyAtmosphere, Scene_SkyBox, Scene_SphereEmitter, Scene_StencilFunction, Scene_StencilOperation, Scene_StyleExpression, Scene_Sun, Scene_SunPostProcess, Scene_TerrainState, Scene_TextureAtlas, Scene_TileBoundingRegion, Scene_TileBoundingSphere, Scene_TileBoundingVolume, Scene_TileCoordinatesImageryProvider, Scene_TileDiscardPolicy, Scene_TileImagery, Scene_TileOrientedBoundingBox, Scene_TileReplacementQueue, Scene_Tileset3DTileContent, Scene_TileState, Scene_TileTerrain, Scene_TimeDynamicImagery, Scene_TweenCollection, Scene_UrlTemplateImageryProvider, Scene_Vector3DTileBatch, Scene_Vector3DTileContent, Scene_Vector3DTileGeometry, Scene_Vector3DTilePoints, Scene_Vector3DTilePolygons, Scene_Vector3DTilePolylines, Scene_Vector3DTilePrimitive, Scene_VerticalOrigin, Scene_ViewportQuad, Scene_WebMapServiceImageryProvider, Scene_WebMapTileServiceImageryProvider, Shaders_AdjustTranslucentFS, Shaders_Appearances_AllMaterialAppearanceFS, Shaders_Appearances_AllMaterialAppearanceVS, Shaders_Appearances_BasicMaterialAppearanceFS, Shaders_Appearances_BasicMaterialAppearanceVS, Shaders_Appearances_EllipsoidSurfaceAppearanceFS, Shaders_Appearances_EllipsoidSurfaceAppearanceVS, Shaders_Appearances_PerInstanceColorAppearanceFS, Shaders_Appearances_PerInstanceColorAppearanceVS, Shaders_Appearances_PerInstanceFlatColorAppearanceFS, Shaders_Appearances_PerInstanceFlatColorAppearanceVS, Shaders_Appearances_PolylineColorAppearanceVS, Shaders_Appearances_PolylineMaterialAppearanceVS, Shaders_Appearances_TexturedMaterialAppearanceFS, Shaders_Appearances_TexturedMaterialAppearanceVS, Shaders_BillboardCollectionFS, Shaders_BillboardCollectionVS, Shaders_BrdfLutGeneratorFS, Shaders_Builtin_Constants_degreesPerRadian, Shaders_Builtin_Constants_depthRange, Shaders_Builtin_Constants_epsilon1, Shaders_Builtin_Constants_epsilon2, Shaders_Builtin_Constants_epsilon3, Shaders_Builtin_Constants_epsilon4, Shaders_Builtin_Constants_epsilon5, Shaders_Builtin_Constants_epsilon6, Shaders_Builtin_Constants_epsilon7, Shaders_Builtin_Constants_infinity, Shaders_Builtin_Constants_oneOverPi, Shaders_Builtin_Constants_oneOverTwoPi, Shaders_Builtin_Constants_passCesium3DTile, Shaders_Builtin_Constants_passCesium3DTileClassification, Shaders_Builtin_Constants_passCesium3DTileClassificationIgnoreShow, Shaders_Builtin_Constants_passClassification, Shaders_Builtin_Constants_passCompute, Shaders_Builtin_Constants_passEnvironment, Shaders_Builtin_Constants_passGlobe, Shaders_Builtin_Constants_passOpaque, Shaders_Builtin_Constants_passOverlay, Shaders_Builtin_Constants_passTerrainClassification, Shaders_Builtin_Constants_passTranslucent, Shaders_Builtin_Constants_pi, Shaders_Builtin_Constants_piOverFour, Shaders_Builtin_Constants_piOverSix, Shaders_Builtin_Constants_piOverThree, Shaders_Builtin_Constants_piOverTwo, Shaders_Builtin_Constants_radiansPerDegree, Shaders_Builtin_Constants_sceneMode2D, Shaders_Builtin_Constants_sceneMode3D, Shaders_Builtin_Constants_sceneModeColumbusView, Shaders_Builtin_Constants_sceneModeMorphing, Shaders_Builtin_Constants_solarRadius, Shaders_Builtin_Constants_threePiOver2, Shaders_Builtin_Constants_twoPi, Shaders_Builtin_Constants_webMercatorMaxLatitude, Shaders_Builtin_CzmBuiltins, Shaders_Builtin_Functions_alphaWeight, Shaders_Builtin_Functions_antialias, Shaders_Builtin_Functions_cascadeColor, Shaders_Builtin_Functions_cascadeDistance, Shaders_Builtin_Functions_cascadeMatrix, Shaders_Builtin_Functions_cascadeWeights, Shaders_Builtin_Functions_columbusViewMorph, Shaders_Builtin_Functions_computePosition, Shaders_Builtin_Functions_cosineAndSine, Shaders_Builtin_Functions_decompressTextureCoordinates, Shaders_Builtin_Functions_depthClampFarPlane, Shaders_Builtin_Functions_eastNorthUpToEyeCoordinates, Shaders_Builtin_Functions_ellipsoidContainsPoint, Shaders_Builtin_Functions_ellipsoidNew, Shaders_Builtin_Functions_ellipsoidWgs84TextureCoordinates, Shaders_Builtin_Functions_equalsEpsilon, Shaders_Builtin_Functions_eyeOffset, Shaders_Builtin_Functions_eyeToWindowCoordinates, Shaders_Builtin_Functions_fog, Shaders_Builtin_Functions_geodeticSurfaceNormal, Shaders_Builtin_Functions_getDefaultMaterial, Shaders_Builtin_Functions_getLambertDiffuse, Shaders_Builtin_Functions_getSpecular, Shaders_Builtin_Functions_getWaterNoise, Shaders_Builtin_Functions_getWgs84EllipsoidEC, Shaders_Builtin_Functions_HSBToRGB, Shaders_Builtin_Functions_HSLToRGB, Shaders_Builtin_Functions_hue, Shaders_Builtin_Functions_isEmpty, Shaders_Builtin_Functions_isFull, Shaders_Builtin_Functions_latitudeToWebMercatorFraction, Shaders_Builtin_Functions_luminance, Shaders_Builtin_Functions_metersPerPixel, Shaders_Builtin_Functions_modelToWindowCoordinates, Shaders_Builtin_Functions_multiplyWithColorBalance, Shaders_Builtin_Functions_nearFarScalar, Shaders_Builtin_Functions_octDecode, Shaders_Builtin_Functions_packDepth, Shaders_Builtin_Functions_phong, Shaders_Builtin_Functions_pointAlongRay, Shaders_Builtin_Functions_rayEllipsoidIntersectionInterval, Shaders_Builtin_Functions_reverseLogDepth, Shaders_Builtin_Functions_RGBToHSB, Shaders_Builtin_Functions_RGBToHSL, Shaders_Builtin_Functions_RGBToXYZ, Shaders_Builtin_Functions_saturation, Shaders_Builtin_Functions_shadowDepthCompare, Shaders_Builtin_Functions_shadowVisibility, Shaders_Builtin_Functions_signNotZero, Shaders_Builtin_Functions_tangentToEyeSpaceMatrix, Shaders_Builtin_Functions_transformPlane, Shaders_Builtin_Functions_translateRelativeToEye, Shaders_Builtin_Functions_translucentPhong, Shaders_Builtin_Functions_transpose, Shaders_Builtin_Functions_unpackDepth, Shaders_Builtin_Functions_unpackFloat, Shaders_Builtin_Functions_vertexLogDepth, Shaders_Builtin_Functions_windowToEyeCoordinates, Shaders_Builtin_Functions_writeDepthClampedToFarPlane, Shaders_Builtin_Functions_writeLogDepth, Shaders_Builtin_Functions_XYZToRGB, Shaders_Builtin_Structs_depthRangeStruct, Shaders_Builtin_Structs_ellipsoid, Shaders_Builtin_Structs_material, Shaders_Builtin_Structs_materialInput, Shaders_Builtin_Structs_ray, Shaders_Builtin_Structs_raySegment, Shaders_Builtin_Structs_shadowParameters, Shaders_CompositeOITFS, Shaders_DepthPlaneFS, Shaders_DepthPlaneVS, Shaders_EllipsoidFS, Shaders_EllipsoidVS, Shaders_GlobeFS, Shaders_GlobeVS, Shaders_GroundAtmosphere, Shaders_Materials_BumpMapMaterial, Shaders_Materials_CheckerboardMaterial, Shaders_Materials_DotMaterial, Shaders_Materials_ElevationContourMaterial, Shaders_Materials_ElevationRampMaterial, Shaders_Materials_FadeMaterial, Shaders_Materials_GridMaterial, Shaders_Materials_NormalMapMaterial, Shaders_Materials_PolylineArrowMaterial, Shaders_Materials_PolylineDashMaterial, Shaders_Materials_PolylineGlowMaterial, Shaders_Materials_PolylineOutlineMaterial, Shaders_Materials_RimLightingMaterial, Shaders_Materials_SlopeRampMaterial, Shaders_Materials_StripeMaterial, Shaders_Materials_Water, Shaders_PointPrimitiveCollectionFS, Shaders_PointPrimitiveCollectionVS, Shaders_PolylineCommon, Shaders_PolylineFS, Shaders_PolylineVS, Shaders_PostProcessFilters_AdditiveBlend, Shaders_PostProcessFilters_BrightPass, Shaders_PostProcessFilters_FXAA, Shaders_PostProcessFilters_GaussianBlur1D, Shaders_PostProcessFilters_PassThrough, Shaders_PostProcessFilters_PointCloudEyeDomeLighting, Shaders_ReprojectWebMercatorFS, Shaders_ReprojectWebMercatorVS, Shaders_ShadowVolumeFS, Shaders_ShadowVolumeVS, Shaders_SkyAtmosphereFS, Shaders_SkyAtmosphereVS, Shaders_SkyBoxFS, Shaders_SkyBoxVS, Shaders_SunFS, Shaders_SunTextureFS, Shaders_SunVS, Shaders_Vector3DTilePolylinesVS, Shaders_ViewportQuadFS, Shaders_ViewportQuadVS, ThirdParty_Autolinker, ThirdParty_earcut_2_1_1, ThirdParty_GltfPipeline_addDefaults, ThirdParty_GltfPipeline_addExtensionsRequired, ThirdParty_GltfPipeline_addExtensionsUsed, ThirdParty_GltfPipeline_addPipelineExtras, ThirdParty_GltfPipeline_addToArray, ThirdParty_GltfPipeline_byteLengthForComponentType, ThirdParty_GltfPipeline_findAccessorMinMax, ThirdParty_GltfPipeline_ForEach, ThirdParty_GltfPipeline_getAccessorByteStride, ThirdParty_GltfPipeline_getJointCountForMaterials, ThirdParty_GltfPipeline_glslTypeToWebGLConstant, ThirdParty_GltfPipeline_numberOfComponentsForType, ThirdParty_GltfPipeline_parseBinaryGltf, ThirdParty_GltfPipeline_processModelMaterialsCommon, ThirdParty_GltfPipeline_processPbrMetallicRoughness, ThirdParty_GltfPipeline_removeExtensionsRequired, ThirdParty_GltfPipeline_removeExtensionsUsed, ThirdParty_GltfPipeline_removePipelineExtras, ThirdParty_GltfPipeline_techniqueParameterForSemantic, ThirdParty_GltfPipeline_updateVersion, ThirdParty_GltfPipeline_webGLConstantToGlslType, ThirdParty_google_earth_dbroot_parser, ThirdParty_jsep, ThirdParty_kdbush, ThirdParty_knockout_3_4_2, ThirdParty_knockout_es5, ThirdParty_knockout, ThirdParty_measureText, ThirdParty_mersenne_twister, ThirdParty_NoSleep, ThirdParty_protobuf_minimal, ThirdParty_Shaders_FXAA3_11, ThirdParty_sprintf, ThirdParty_topojson, ThirdParty_Tween, ThirdParty_Uri, ThirdParty_when, ThirdParty_xss, ThirdParty_zip, Widgets_Animation_Animation, Widgets_Animation_AnimationViewModel, Widgets_BaseLayerPicker_BaseLayerPicker, Widgets_BaseLayerPicker_BaseLayerPickerViewModel, Widgets_BaseLayerPicker_createDefaultImageryProviderViewModels, Widgets_BaseLayerPicker_createDefaultTerrainProviderViewModels, Widgets_BaseLayerPicker_ProviderViewModel, Widgets_Cesium3DTilesInspector_Cesium3DTilesInspector, Widgets_Cesium3DTilesInspector_Cesium3DTilesInspectorViewModel, Widgets_CesiumInspector_CesiumInspector, Widgets_CesiumInspector_CesiumInspectorViewModel, Widgets_CesiumWidget_CesiumWidget, Widgets_ClockViewModel, Widgets_Command, Widgets_createCommand, Widgets_FullscreenButton_FullscreenButton, Widgets_FullscreenButton_FullscreenButtonViewModel, Widgets_Geocoder_Geocoder, Widgets_Geocoder_GeocoderViewModel, Widgets_getElement, Widgets_HomeButton_HomeButton, Widgets_HomeButton_HomeButtonViewModel, Widgets_InfoBox_InfoBox, Widgets_InfoBox_InfoBoxViewModel, Widgets_NavigationHelpButton_NavigationHelpButton, Widgets_NavigationHelpButton_NavigationHelpButtonViewModel, Widgets_PerformanceWatchdog_PerformanceWatchdog, Widgets_PerformanceWatchdog_PerformanceWatchdogViewModel, Widgets_ProjectionPicker_ProjectionPicker, Widgets_ProjectionPicker_ProjectionPickerViewModel, Widgets_SceneModePicker_SceneModePicker, Widgets_SceneModePicker_SceneModePickerViewModel, Widgets_SelectionIndicator_SelectionIndicator, Widgets_SelectionIndicator_SelectionIndicatorViewModel, Widgets_subscribeAndEvaluate, Widgets_SvgPathBindingHandler, Widgets_Timeline_Timeline, Widgets_Timeline_TimelineHighlightRange, Widgets_Timeline_TimelineTrack, Widgets_ToggleButtonViewModel, Widgets_Viewer_Viewer, Widgets_Viewer_viewerCesium3DTilesInspectorMixin, Widgets_Viewer_viewerCesiumInspectorMixin, Widgets_Viewer_viewerDragDropMixin, Widgets_Viewer_viewerPerformanceWatchdogMixin, Widgets_VRButton_VRButton, Widgets_VRButton_VRButtonViewModel, Workers_createTaskProcessorWorker) { + 'use strict'; + var Cesium = { + VERSION : '1.44', + _shaders : {} + }; + Cesium['appendForwardSlash'] = Core_appendForwardSlash; + Cesium['arrayFill'] = Core_arrayFill; + Cesium['arrayRemoveDuplicates'] = Core_arrayRemoveDuplicates; + Cesium['arraySlice'] = Core_arraySlice; + Cesium['AssociativeArray'] = Core_AssociativeArray; + Cesium['AttributeCompression'] = Core_AttributeCompression; + Cesium['AxisAlignedBoundingBox'] = Core_AxisAlignedBoundingBox; + Cesium['barycentricCoordinates'] = Core_barycentricCoordinates; + Cesium['binarySearch'] = Core_binarySearch; + Cesium['BingMapsApi'] = Core_BingMapsApi; + Cesium['BingMapsGeocoderService'] = Core_BingMapsGeocoderService; + Cesium['BoundingRectangle'] = Core_BoundingRectangle; + Cesium['BoundingSphere'] = Core_BoundingSphere; + Cesium['BoxGeometry'] = Core_BoxGeometry; + Cesium['BoxOutlineGeometry'] = Core_BoxOutlineGeometry; + Cesium['buildModuleUrl'] = Core_buildModuleUrl; + Cesium['cancelAnimationFrame'] = Core_cancelAnimationFrame; + Cesium['Cartesian2'] = Core_Cartesian2; + Cesium['Cartesian3'] = Core_Cartesian3; + Cesium['Cartesian4'] = Core_Cartesian4; + Cesium['Cartographic'] = Core_Cartographic; + Cesium['CartographicGeocoderService'] = Core_CartographicGeocoderService; + Cesium['CatmullRomSpline'] = Core_CatmullRomSpline; + Cesium['CesiumTerrainProvider'] = Core_CesiumTerrainProvider; + Cesium['Check'] = Core_Check; + Cesium['CircleGeometry'] = Core_CircleGeometry; + Cesium['CircleOutlineGeometry'] = Core_CircleOutlineGeometry; + Cesium['Clock'] = Core_Clock; + Cesium['ClockRange'] = Core_ClockRange; + Cesium['ClockStep'] = Core_ClockStep; + Cesium['clone'] = Core_clone; + Cesium['Color'] = Core_Color; + Cesium['ColorGeometryInstanceAttribute'] = Core_ColorGeometryInstanceAttribute; + Cesium['combine'] = Core_combine; + Cesium['ComponentDatatype'] = Core_ComponentDatatype; + Cesium['CompressedTextureBuffer'] = Core_CompressedTextureBuffer; + Cesium['CornerType'] = Core_CornerType; + Cesium['CorridorGeometry'] = Core_CorridorGeometry; + Cesium['CorridorGeometryLibrary'] = Core_CorridorGeometryLibrary; + Cesium['CorridorOutlineGeometry'] = Core_CorridorOutlineGeometry; + Cesium['createGuid'] = Core_createGuid; + Cesium['createWorldTerrain'] = Core_createWorldTerrain; + Cesium['Credit'] = Core_Credit; + Cesium['CubicRealPolynomial'] = Core_CubicRealPolynomial; + Cesium['CullingVolume'] = Core_CullingVolume; + Cesium['CylinderGeometry'] = Core_CylinderGeometry; + Cesium['CylinderGeometryLibrary'] = Core_CylinderGeometryLibrary; + Cesium['CylinderOutlineGeometry'] = Core_CylinderOutlineGeometry; + Cesium['decodeGoogleEarthEnterpriseData'] = Core_decodeGoogleEarthEnterpriseData; + Cesium['DefaultProxy'] = Core_DefaultProxy; + Cesium['defaultValue'] = Core_defaultValue; + Cesium['defined'] = Core_defined; + Cesium['defineProperties'] = Core_defineProperties; + Cesium['deprecationWarning'] = Core_deprecationWarning; + Cesium['destroyObject'] = Core_destroyObject; + Cesium['DeveloperError'] = Core_DeveloperError; + Cesium['DistanceDisplayCondition'] = Core_DistanceDisplayCondition; + Cesium['DistanceDisplayConditionGeometryInstanceAttribute'] = Core_DistanceDisplayConditionGeometryInstanceAttribute; + Cesium['DoublyLinkedList'] = Core_DoublyLinkedList; + Cesium['EarthOrientationParameters'] = Core_EarthOrientationParameters; + Cesium['EarthOrientationParametersSample'] = Core_EarthOrientationParametersSample; + Cesium['EasingFunction'] = Core_EasingFunction; + Cesium['EllipseGeometry'] = Core_EllipseGeometry; + Cesium['EllipseGeometryLibrary'] = Core_EllipseGeometryLibrary; + Cesium['EllipseOutlineGeometry'] = Core_EllipseOutlineGeometry; + Cesium['Ellipsoid'] = Core_Ellipsoid; + Cesium['EllipsoidalOccluder'] = Core_EllipsoidalOccluder; + Cesium['EllipsoidGeodesic'] = Core_EllipsoidGeodesic; + Cesium['EllipsoidGeometry'] = Core_EllipsoidGeometry; + Cesium['EllipsoidOutlineGeometry'] = Core_EllipsoidOutlineGeometry; + Cesium['EllipsoidTangentPlane'] = Core_EllipsoidTangentPlane; + Cesium['EllipsoidTerrainProvider'] = Core_EllipsoidTerrainProvider; + Cesium['EncodedCartesian3'] = Core_EncodedCartesian3; + Cesium['Event'] = Core_Event; + Cesium['EventHelper'] = Core_EventHelper; + Cesium['ExtrapolationType'] = Core_ExtrapolationType; + Cesium['FeatureDetection'] = Core_FeatureDetection; + Cesium['formatError'] = Core_formatError; + Cesium['freezeObject'] = Core_freezeObject; + Cesium['FrustumGeometry'] = Core_FrustumGeometry; + Cesium['FrustumOutlineGeometry'] = Core_FrustumOutlineGeometry; + Cesium['Fullscreen'] = Core_Fullscreen; + Cesium['GeocoderService'] = Core_GeocoderService; + Cesium['GeographicProjection'] = Core_GeographicProjection; + Cesium['GeographicTilingScheme'] = Core_GeographicTilingScheme; + Cesium['Geometry'] = Core_Geometry; + Cesium['GeometryAttribute'] = Core_GeometryAttribute; + Cesium['GeometryAttributes'] = Core_GeometryAttributes; + Cesium['GeometryInstance'] = Core_GeometryInstance; + Cesium['GeometryInstanceAttribute'] = Core_GeometryInstanceAttribute; + Cesium['GeometryPipeline'] = Core_GeometryPipeline; + Cesium['GeometryType'] = Core_GeometryType; + Cesium['getAbsoluteUri'] = Core_getAbsoluteUri; + Cesium['getBaseUri'] = Core_getBaseUri; + Cesium['getExtensionFromUri'] = Core_getExtensionFromUri; + Cesium['getFilenameFromUri'] = Core_getFilenameFromUri; + Cesium['getImagePixels'] = Core_getImagePixels; + Cesium['getMagic'] = Core_getMagic; + Cesium['getStringFromTypedArray'] = Core_getStringFromTypedArray; + Cesium['getTimestamp'] = Core_getTimestamp; + Cesium['GoogleEarthEnterpriseMetadata'] = Core_GoogleEarthEnterpriseMetadata; + Cesium['GoogleEarthEnterpriseTerrainData'] = Core_GoogleEarthEnterpriseTerrainData; + Cesium['GoogleEarthEnterpriseTerrainProvider'] = Core_GoogleEarthEnterpriseTerrainProvider; + Cesium['GoogleEarthEnterpriseTileInformation'] = Core_GoogleEarthEnterpriseTileInformation; + Cesium['GregorianDate'] = Core_GregorianDate; + Cesium['HeadingPitchRange'] = Core_HeadingPitchRange; + Cesium['HeadingPitchRoll'] = Core_HeadingPitchRoll; + Cesium['Heap'] = Core_Heap; + Cesium['HeightmapTerrainData'] = Core_HeightmapTerrainData; + Cesium['HeightmapTessellator'] = Core_HeightmapTessellator; + Cesium['HermitePolynomialApproximation'] = Core_HermitePolynomialApproximation; + Cesium['HermiteSpline'] = Core_HermiteSpline; + Cesium['Iau2000Orientation'] = Core_Iau2000Orientation; + Cesium['Iau2006XysData'] = Core_Iau2006XysData; + Cesium['Iau2006XysSample'] = Core_Iau2006XysSample; + Cesium['IauOrientationAxes'] = Core_IauOrientationAxes; + Cesium['IauOrientationParameters'] = Core_IauOrientationParameters; + Cesium['IndexDatatype'] = Core_IndexDatatype; + Cesium['InterpolationAlgorithm'] = Core_InterpolationAlgorithm; + Cesium['Intersect'] = Core_Intersect; + Cesium['Intersections2D'] = Core_Intersections2D; + Cesium['IntersectionTests'] = Core_IntersectionTests; + Cesium['Interval'] = Core_Interval; + Cesium['Ion'] = Core_Ion; + Cesium['IonResource'] = Core_IonResource; + Cesium['isArray'] = Core_isArray; + Cesium['isBitSet'] = Core_isBitSet; + Cesium['isBlobUri'] = Core_isBlobUri; + Cesium['isCrossOriginUrl'] = Core_isCrossOriginUrl; + Cesium['isDataUri'] = Core_isDataUri; + Cesium['isLeapYear'] = Core_isLeapYear; + Cesium['Iso8601'] = Core_Iso8601; + Cesium['JulianDate'] = Core_JulianDate; + Cesium['KeyboardEventModifier'] = Core_KeyboardEventModifier; + Cesium['LagrangePolynomialApproximation'] = Core_LagrangePolynomialApproximation; + Cesium['LeapSecond'] = Core_LeapSecond; + Cesium['LinearApproximation'] = Core_LinearApproximation; + Cesium['LinearSpline'] = Core_LinearSpline; + Cesium['loadCRN'] = Core_loadCRN; + Cesium['loadImageFromTypedArray'] = Core_loadImageFromTypedArray; + Cesium['loadKTX'] = Core_loadKTX; + Cesium['ManagedArray'] = Core_ManagedArray; + Cesium['MapboxApi'] = Core_MapboxApi; + Cesium['MapProjection'] = Core_MapProjection; + Cesium['Math'] = Core_Math; + Cesium['Matrix2'] = Core_Matrix2; + Cesium['Matrix3'] = Core_Matrix3; + Cesium['Matrix4'] = Core_Matrix4; + Cesium['mergeSort'] = Core_mergeSort; + Cesium['NearFarScalar'] = Core_NearFarScalar; + Cesium['objectToQuery'] = Core_objectToQuery; + Cesium['Occluder'] = Core_Occluder; + Cesium['oneTimeWarning'] = Core_oneTimeWarning; + Cesium['OrientedBoundingBox'] = Core_OrientedBoundingBox; + Cesium['OrthographicFrustum'] = Core_OrthographicFrustum; + Cesium['OrthographicOffCenterFrustum'] = Core_OrthographicOffCenterFrustum; + Cesium['Packable'] = Core_Packable; + Cesium['PackableForInterpolation'] = Core_PackableForInterpolation; + Cesium['parseResponseHeaders'] = Core_parseResponseHeaders; + Cesium['PerspectiveFrustum'] = Core_PerspectiveFrustum; + Cesium['PerspectiveOffCenterFrustum'] = Core_PerspectiveOffCenterFrustum; + Cesium['PinBuilder'] = Core_PinBuilder; + Cesium['PixelFormat'] = Core_PixelFormat; + Cesium['Plane'] = Core_Plane; + Cesium['PlaneGeometry'] = Core_PlaneGeometry; + Cesium['PlaneOutlineGeometry'] = Core_PlaneOutlineGeometry; + Cesium['pointInsideTriangle'] = Core_pointInsideTriangle; + Cesium['PolygonGeometry'] = Core_PolygonGeometry; + Cesium['PolygonGeometryLibrary'] = Core_PolygonGeometryLibrary; + Cesium['PolygonHierarchy'] = Core_PolygonHierarchy; + Cesium['PolygonOutlineGeometry'] = Core_PolygonOutlineGeometry; + Cesium['PolygonPipeline'] = Core_PolygonPipeline; + Cesium['PolylineGeometry'] = Core_PolylineGeometry; + Cesium['PolylinePipeline'] = Core_PolylinePipeline; + Cesium['PolylineVolumeGeometry'] = Core_PolylineVolumeGeometry; + Cesium['PolylineVolumeGeometryLibrary'] = Core_PolylineVolumeGeometryLibrary; + Cesium['PolylineVolumeOutlineGeometry'] = Core_PolylineVolumeOutlineGeometry; + Cesium['PrimitiveType'] = Core_PrimitiveType; + Cesium['QuadraticRealPolynomial'] = Core_QuadraticRealPolynomial; + Cesium['QuantizedMeshTerrainData'] = Core_QuantizedMeshTerrainData; + Cesium['QuarticRealPolynomial'] = Core_QuarticRealPolynomial; + Cesium['Quaternion'] = Core_Quaternion; + Cesium['QuaternionSpline'] = Core_QuaternionSpline; + Cesium['queryToObject'] = Core_queryToObject; + Cesium['Queue'] = Core_Queue; + Cesium['Ray'] = Core_Ray; + Cesium['Rectangle'] = Core_Rectangle; + Cesium['RectangleGeometry'] = Core_RectangleGeometry; + Cesium['RectangleGeometryLibrary'] = Core_RectangleGeometryLibrary; + Cesium['RectangleOutlineGeometry'] = Core_RectangleOutlineGeometry; + Cesium['ReferenceFrame'] = Core_ReferenceFrame; + Cesium['Request'] = Core_Request; + Cesium['requestAnimationFrame'] = Core_requestAnimationFrame; + Cesium['RequestErrorEvent'] = Core_RequestErrorEvent; + Cesium['RequestScheduler'] = Core_RequestScheduler; + Cesium['RequestState'] = Core_RequestState; + Cesium['RequestType'] = Core_RequestType; + Cesium['Resource'] = Core_Resource; + Cesium['RuntimeError'] = Core_RuntimeError; + Cesium['sampleTerrain'] = Core_sampleTerrain; + Cesium['sampleTerrainMostDetailed'] = Core_sampleTerrainMostDetailed; + Cesium['scaleToGeodeticSurface'] = Core_scaleToGeodeticSurface; + Cesium['ScreenSpaceEventHandler'] = Core_ScreenSpaceEventHandler; + Cesium['ScreenSpaceEventType'] = Core_ScreenSpaceEventType; + Cesium['ShowGeometryInstanceAttribute'] = Core_ShowGeometryInstanceAttribute; + Cesium['Simon1994PlanetaryPositions'] = Core_Simon1994PlanetaryPositions; + Cesium['SimplePolylineGeometry'] = Core_SimplePolylineGeometry; + Cesium['SphereGeometry'] = Core_SphereGeometry; + Cesium['SphereOutlineGeometry'] = Core_SphereOutlineGeometry; + Cesium['Spherical'] = Core_Spherical; + Cesium['Spline'] = Core_Spline; + Cesium['subdivideArray'] = Core_subdivideArray; + Cesium['TaskProcessor'] = Core_TaskProcessor; + Cesium['TerrainData'] = Core_TerrainData; + Cesium['TerrainEncoding'] = Core_TerrainEncoding; + Cesium['TerrainMesh'] = Core_TerrainMesh; + Cesium['TerrainProvider'] = Core_TerrainProvider; + Cesium['TerrainQuantization'] = Core_TerrainQuantization; + Cesium['TileAvailability'] = Core_TileAvailability; + Cesium['TileProviderError'] = Core_TileProviderError; + Cesium['TilingScheme'] = Core_TilingScheme; + Cesium['TimeConstants'] = Core_TimeConstants; + Cesium['TimeInterval'] = Core_TimeInterval; + Cesium['TimeIntervalCollection'] = Core_TimeIntervalCollection; + Cesium['TimeStandard'] = Core_TimeStandard; + Cesium['Tipsify'] = Core_Tipsify; + Cesium['Transforms'] = Core_Transforms; + Cesium['TranslationRotationScale'] = Core_TranslationRotationScale; + Cesium['TridiagonalSystemSolver'] = Core_TridiagonalSystemSolver; + Cesium['TrustedServers'] = Core_TrustedServers; + Cesium['VertexFormat'] = Core_VertexFormat; + Cesium['VideoSynchronizer'] = Core_VideoSynchronizer; + Cesium['Visibility'] = Core_Visibility; + Cesium['VRTheWorldTerrainProvider'] = Core_VRTheWorldTerrainProvider; + Cesium['WallGeometry'] = Core_WallGeometry; + Cesium['WallGeometryLibrary'] = Core_WallGeometryLibrary; + Cesium['WallOutlineGeometry'] = Core_WallOutlineGeometry; + Cesium['WebGLConstants'] = Core_WebGLConstants; + Cesium['WebMercatorProjection'] = Core_WebMercatorProjection; + Cesium['WebMercatorTilingScheme'] = Core_WebMercatorTilingScheme; + Cesium['WeightSpline'] = Core_WeightSpline; + Cesium['WindingOrder'] = Core_WindingOrder; + Cesium['wrapFunction'] = Core_wrapFunction; + Cesium['writeTextToCanvas'] = Core_writeTextToCanvas; + Cesium['BillboardGraphics'] = DataSources_BillboardGraphics; + Cesium['BillboardVisualizer'] = DataSources_BillboardVisualizer; + Cesium['BoundingSphereState'] = DataSources_BoundingSphereState; + Cesium['BoxGeometryUpdater'] = DataSources_BoxGeometryUpdater; + Cesium['BoxGraphics'] = DataSources_BoxGraphics; + Cesium['CallbackProperty'] = DataSources_CallbackProperty; + Cesium['CheckerboardMaterialProperty'] = DataSources_CheckerboardMaterialProperty; + Cesium['ColorMaterialProperty'] = DataSources_ColorMaterialProperty; + Cesium['CompositeEntityCollection'] = DataSources_CompositeEntityCollection; + Cesium['CompositeMaterialProperty'] = DataSources_CompositeMaterialProperty; + Cesium['CompositePositionProperty'] = DataSources_CompositePositionProperty; + Cesium['CompositeProperty'] = DataSources_CompositeProperty; + Cesium['ConstantPositionProperty'] = DataSources_ConstantPositionProperty; + Cesium['ConstantProperty'] = DataSources_ConstantProperty; + Cesium['CorridorGeometryUpdater'] = DataSources_CorridorGeometryUpdater; + Cesium['CorridorGraphics'] = DataSources_CorridorGraphics; + Cesium['createMaterialPropertyDescriptor'] = DataSources_createMaterialPropertyDescriptor; + Cesium['createPropertyDescriptor'] = DataSources_createPropertyDescriptor; + Cesium['createRawPropertyDescriptor'] = DataSources_createRawPropertyDescriptor; + Cesium['CustomDataSource'] = DataSources_CustomDataSource; + Cesium['CylinderGeometryUpdater'] = DataSources_CylinderGeometryUpdater; + Cesium['CylinderGraphics'] = DataSources_CylinderGraphics; + Cesium['CzmlDataSource'] = DataSources_CzmlDataSource; + Cesium['DataSource'] = DataSources_DataSource; + Cesium['DataSourceClock'] = DataSources_DataSourceClock; + Cesium['DataSourceCollection'] = DataSources_DataSourceCollection; + Cesium['DataSourceDisplay'] = DataSources_DataSourceDisplay; + Cesium['DynamicGeometryBatch'] = DataSources_DynamicGeometryBatch; + Cesium['DynamicGeometryUpdater'] = DataSources_DynamicGeometryUpdater; + Cesium['EllipseGeometryUpdater'] = DataSources_EllipseGeometryUpdater; + Cesium['EllipseGraphics'] = DataSources_EllipseGraphics; + Cesium['EllipsoidGeometryUpdater'] = DataSources_EllipsoidGeometryUpdater; + Cesium['EllipsoidGraphics'] = DataSources_EllipsoidGraphics; + Cesium['Entity'] = DataSources_Entity; + Cesium['EntityCluster'] = DataSources_EntityCluster; + Cesium['EntityCollection'] = DataSources_EntityCollection; + Cesium['EntityView'] = DataSources_EntityView; + Cesium['GeoJsonDataSource'] = DataSources_GeoJsonDataSource; + Cesium['GeometryUpdater'] = DataSources_GeometryUpdater; + Cesium['GeometryVisualizer'] = DataSources_GeometryVisualizer; + Cesium['GridMaterialProperty'] = DataSources_GridMaterialProperty; + Cesium['ImageMaterialProperty'] = DataSources_ImageMaterialProperty; + Cesium['KmlCamera'] = DataSources_KmlCamera; + Cesium['KmlDataSource'] = DataSources_KmlDataSource; + Cesium['KmlLookAt'] = DataSources_KmlLookAt; + Cesium['KmlTour'] = DataSources_KmlTour; + Cesium['KmlTourFlyTo'] = DataSources_KmlTourFlyTo; + Cesium['KmlTourWait'] = DataSources_KmlTourWait; + Cesium['LabelGraphics'] = DataSources_LabelGraphics; + Cesium['LabelVisualizer'] = DataSources_LabelVisualizer; + Cesium['MaterialProperty'] = DataSources_MaterialProperty; + Cesium['ModelGraphics'] = DataSources_ModelGraphics; + Cesium['ModelVisualizer'] = DataSources_ModelVisualizer; + Cesium['NodeTransformationProperty'] = DataSources_NodeTransformationProperty; + Cesium['PathGraphics'] = DataSources_PathGraphics; + Cesium['PathVisualizer'] = DataSources_PathVisualizer; + Cesium['PlaneGeometryUpdater'] = DataSources_PlaneGeometryUpdater; + Cesium['PlaneGraphics'] = DataSources_PlaneGraphics; + Cesium['PointGraphics'] = DataSources_PointGraphics; + Cesium['PointVisualizer'] = DataSources_PointVisualizer; + Cesium['PolygonGeometryUpdater'] = DataSources_PolygonGeometryUpdater; + Cesium['PolygonGraphics'] = DataSources_PolygonGraphics; + Cesium['PolylineArrowMaterialProperty'] = DataSources_PolylineArrowMaterialProperty; + Cesium['PolylineDashMaterialProperty'] = DataSources_PolylineDashMaterialProperty; + Cesium['PolylineGeometryUpdater'] = DataSources_PolylineGeometryUpdater; + Cesium['PolylineGlowMaterialProperty'] = DataSources_PolylineGlowMaterialProperty; + Cesium['PolylineGraphics'] = DataSources_PolylineGraphics; + Cesium['PolylineOutlineMaterialProperty'] = DataSources_PolylineOutlineMaterialProperty; + Cesium['PolylineVisualizer'] = DataSources_PolylineVisualizer; + Cesium['PolylineVolumeGeometryUpdater'] = DataSources_PolylineVolumeGeometryUpdater; + Cesium['PolylineVolumeGraphics'] = DataSources_PolylineVolumeGraphics; + Cesium['PositionProperty'] = DataSources_PositionProperty; + Cesium['PositionPropertyArray'] = DataSources_PositionPropertyArray; + Cesium['Property'] = DataSources_Property; + Cesium['PropertyArray'] = DataSources_PropertyArray; + Cesium['PropertyBag'] = DataSources_PropertyBag; + Cesium['RectangleGeometryUpdater'] = DataSources_RectangleGeometryUpdater; + Cesium['RectangleGraphics'] = DataSources_RectangleGraphics; + Cesium['ReferenceProperty'] = DataSources_ReferenceProperty; + Cesium['Rotation'] = DataSources_Rotation; + Cesium['SampledPositionProperty'] = DataSources_SampledPositionProperty; + Cesium['SampledProperty'] = DataSources_SampledProperty; + Cesium['ScaledPositionProperty'] = DataSources_ScaledPositionProperty; + Cesium['StaticGeometryColorBatch'] = DataSources_StaticGeometryColorBatch; + Cesium['StaticGeometryPerMaterialBatch'] = DataSources_StaticGeometryPerMaterialBatch; + Cesium['StaticGroundGeometryColorBatch'] = DataSources_StaticGroundGeometryColorBatch; + Cesium['StaticOutlineGeometryBatch'] = DataSources_StaticOutlineGeometryBatch; + Cesium['StripeMaterialProperty'] = DataSources_StripeMaterialProperty; + Cesium['StripeOrientation'] = DataSources_StripeOrientation; + Cesium['TimeIntervalCollectionPositionProperty'] = DataSources_TimeIntervalCollectionPositionProperty; + Cesium['TimeIntervalCollectionProperty'] = DataSources_TimeIntervalCollectionProperty; + Cesium['VelocityOrientationProperty'] = DataSources_VelocityOrientationProperty; + Cesium['VelocityVectorProperty'] = DataSources_VelocityVectorProperty; + Cesium['Visualizer'] = DataSources_Visualizer; + Cesium['WallGeometryUpdater'] = DataSources_WallGeometryUpdater; + Cesium['WallGraphics'] = DataSources_WallGraphics; + Cesium['AutomaticUniforms'] = Renderer_AutomaticUniforms; + Cesium['Buffer'] = Renderer_Buffer; + Cesium['BufferUsage'] = Renderer_BufferUsage; + Cesium['ClearCommand'] = Renderer_ClearCommand; + Cesium['ComputeCommand'] = Renderer_ComputeCommand; + Cesium['ComputeEngine'] = Renderer_ComputeEngine; + Cesium['Context'] = Renderer_Context; + Cesium['ContextLimits'] = Renderer_ContextLimits; + Cesium['createUniform'] = Renderer_createUniform; + Cesium['createUniformArray'] = Renderer_createUniformArray; + Cesium['CubeMap'] = Renderer_CubeMap; + Cesium['CubeMapFace'] = Renderer_CubeMapFace; + Cesium['DrawCommand'] = Renderer_DrawCommand; + Cesium['Framebuffer'] = Renderer_Framebuffer; + Cesium['freezeRenderState'] = Renderer_freezeRenderState; + Cesium['loadCubeMap'] = Renderer_loadCubeMap; + Cesium['MipmapHint'] = Renderer_MipmapHint; + Cesium['modernizeShader'] = Renderer_modernizeShader; + Cesium['Pass'] = Renderer_Pass; + Cesium['PassState'] = Renderer_PassState; + Cesium['PickFramebuffer'] = Renderer_PickFramebuffer; + Cesium['PixelDatatype'] = Renderer_PixelDatatype; + Cesium['Renderbuffer'] = Renderer_Renderbuffer; + Cesium['RenderbufferFormat'] = Renderer_RenderbufferFormat; + Cesium['RenderState'] = Renderer_RenderState; + Cesium['Sampler'] = Renderer_Sampler; + Cesium['ShaderCache'] = Renderer_ShaderCache; + Cesium['ShaderProgram'] = Renderer_ShaderProgram; + Cesium['ShaderSource'] = Renderer_ShaderSource; + Cesium['Texture'] = Renderer_Texture; + Cesium['TextureMagnificationFilter'] = Renderer_TextureMagnificationFilter; + Cesium['TextureMinificationFilter'] = Renderer_TextureMinificationFilter; + Cesium['TextureWrap'] = Renderer_TextureWrap; + Cesium['UniformState'] = Renderer_UniformState; + Cesium['VertexArray'] = Renderer_VertexArray; + Cesium['VertexArrayFacade'] = Renderer_VertexArrayFacade; + Cesium['Appearance'] = Scene_Appearance; + Cesium['ArcGisMapServerImageryProvider'] = Scene_ArcGisMapServerImageryProvider; + Cesium['AttributeType'] = Scene_AttributeType; + Cesium['Axis'] = Scene_Axis; + Cesium['Batched3DModel3DTileContent'] = Scene_Batched3DModel3DTileContent; + Cesium['BatchTable'] = Scene_BatchTable; + Cesium['Billboard'] = Scene_Billboard; + Cesium['BillboardCollection'] = Scene_BillboardCollection; + Cesium['BingMapsImageryProvider'] = Scene_BingMapsImageryProvider; + Cesium['BingMapsStyle'] = Scene_BingMapsStyle; + Cesium['BlendEquation'] = Scene_BlendEquation; + Cesium['BlendFunction'] = Scene_BlendFunction; + Cesium['BlendingState'] = Scene_BlendingState; + Cesium['BlendOption'] = Scene_BlendOption; + Cesium['BoxEmitter'] = Scene_BoxEmitter; + Cesium['BrdfLutGenerator'] = Scene_BrdfLutGenerator; + Cesium['Camera'] = Scene_Camera; + Cesium['CameraEventAggregator'] = Scene_CameraEventAggregator; + Cesium['CameraEventType'] = Scene_CameraEventType; + Cesium['CameraFlightPath'] = Scene_CameraFlightPath; + Cesium['Cesium3DTile'] = Scene_Cesium3DTile; + Cesium['Cesium3DTileBatchTable'] = Scene_Cesium3DTileBatchTable; + Cesium['Cesium3DTileChildrenVisibility'] = Scene_Cesium3DTileChildrenVisibility; + Cesium['Cesium3DTileColorBlendMode'] = Scene_Cesium3DTileColorBlendMode; + Cesium['Cesium3DTileContent'] = Scene_Cesium3DTileContent; + Cesium['Cesium3DTileContentFactory'] = Scene_Cesium3DTileContentFactory; + Cesium['Cesium3DTileContentState'] = Scene_Cesium3DTileContentState; + Cesium['Cesium3DTileFeature'] = Scene_Cesium3DTileFeature; + Cesium['Cesium3DTileFeatureTable'] = Scene_Cesium3DTileFeatureTable; + Cesium['Cesium3DTileOptimizationHint'] = Scene_Cesium3DTileOptimizationHint; + Cesium['Cesium3DTileOptimizations'] = Scene_Cesium3DTileOptimizations; + Cesium['Cesium3DTilePointFeature'] = Scene_Cesium3DTilePointFeature; + Cesium['Cesium3DTileRefine'] = Scene_Cesium3DTileRefine; + Cesium['Cesium3DTileset'] = Scene_Cesium3DTileset; + Cesium['Cesium3DTilesetStatistics'] = Scene_Cesium3DTilesetStatistics; + Cesium['Cesium3DTilesetTraversal'] = Scene_Cesium3DTilesetTraversal; + Cesium['Cesium3DTileStyle'] = Scene_Cesium3DTileStyle; + Cesium['Cesium3DTileStyleEngine'] = Scene_Cesium3DTileStyleEngine; + Cesium['CircleEmitter'] = Scene_CircleEmitter; + Cesium['ClassificationModel'] = Scene_ClassificationModel; + Cesium['ClassificationPrimitive'] = Scene_ClassificationPrimitive; + Cesium['ClassificationType'] = Scene_ClassificationType; + Cesium['ClippingPlane'] = Scene_ClippingPlane; + Cesium['ClippingPlaneCollection'] = Scene_ClippingPlaneCollection; + Cesium['ColorBlendMode'] = Scene_ColorBlendMode; + Cesium['Composite3DTileContent'] = Scene_Composite3DTileContent; + Cesium['ConditionsExpression'] = Scene_ConditionsExpression; + Cesium['ConeEmitter'] = Scene_ConeEmitter; + Cesium['createBillboardPointCallback'] = Scene_createBillboardPointCallback; + Cesium['createOpenStreetMapImageryProvider'] = Scene_createOpenStreetMapImageryProvider; + Cesium['createTangentSpaceDebugPrimitive'] = Scene_createTangentSpaceDebugPrimitive; + Cesium['createTileMapServiceImageryProvider'] = Scene_createTileMapServiceImageryProvider; + Cesium['CreditDisplay'] = Scene_CreditDisplay; + Cesium['CullFace'] = Scene_CullFace; + Cesium['DebugAppearance'] = Scene_DebugAppearance; + Cesium['DebugCameraPrimitive'] = Scene_DebugCameraPrimitive; + Cesium['DebugModelMatrixPrimitive'] = Scene_DebugModelMatrixPrimitive; + Cesium['DepthFunction'] = Scene_DepthFunction; + Cesium['DepthPlane'] = Scene_DepthPlane; + Cesium['DerivedCommand'] = Scene_DerivedCommand; + Cesium['DeviceOrientationCameraController'] = Scene_DeviceOrientationCameraController; + Cesium['DiscardMissingTileImagePolicy'] = Scene_DiscardMissingTileImagePolicy; + Cesium['DracoLoader'] = Scene_DracoLoader; + Cesium['EllipsoidPrimitive'] = Scene_EllipsoidPrimitive; + Cesium['EllipsoidSurfaceAppearance'] = Scene_EllipsoidSurfaceAppearance; + Cesium['Empty3DTileContent'] = Scene_Empty3DTileContent; + Cesium['Expression'] = Scene_Expression; + Cesium['ExpressionNodeType'] = Scene_ExpressionNodeType; + Cesium['Fog'] = Scene_Fog; + Cesium['FrameRateMonitor'] = Scene_FrameRateMonitor; + Cesium['FrameState'] = Scene_FrameState; + Cesium['FrustumCommands'] = Scene_FrustumCommands; + Cesium['FXAA'] = Scene_FXAA; + Cesium['Geometry3DTileContent'] = Scene_Geometry3DTileContent; + Cesium['getBinaryAccessor'] = Scene_getBinaryAccessor; + Cesium['getClipAndStyleCode'] = Scene_getClipAndStyleCode; + Cesium['getClippingFunction'] = Scene_getClippingFunction; + Cesium['GetFeatureInfoFormat'] = Scene_GetFeatureInfoFormat; + Cesium['Globe'] = Scene_Globe; + Cesium['GlobeDepth'] = Scene_GlobeDepth; + Cesium['GlobeSurfaceShaderSet'] = Scene_GlobeSurfaceShaderSet; + Cesium['GlobeSurfaceTile'] = Scene_GlobeSurfaceTile; + Cesium['GlobeSurfaceTileProvider'] = Scene_GlobeSurfaceTileProvider; + Cesium['GoogleEarthEnterpriseImageryProvider'] = Scene_GoogleEarthEnterpriseImageryProvider; + Cesium['GoogleEarthEnterpriseMapsProvider'] = Scene_GoogleEarthEnterpriseMapsProvider; + Cesium['GridImageryProvider'] = Scene_GridImageryProvider; + Cesium['GroundPrimitive'] = Scene_GroundPrimitive; + Cesium['HeightReference'] = Scene_HeightReference; + Cesium['HorizontalOrigin'] = Scene_HorizontalOrigin; + Cesium['Imagery'] = Scene_Imagery; + Cesium['ImageryLayer'] = Scene_ImageryLayer; + Cesium['ImageryLayerCollection'] = Scene_ImageryLayerCollection; + Cesium['ImageryLayerFeatureInfo'] = Scene_ImageryLayerFeatureInfo; + Cesium['ImageryProvider'] = Scene_ImageryProvider; + Cesium['ImagerySplitDirection'] = Scene_ImagerySplitDirection; + Cesium['ImageryState'] = Scene_ImageryState; + Cesium['Instanced3DModel3DTileContent'] = Scene_Instanced3DModel3DTileContent; + Cesium['InvertClassification'] = Scene_InvertClassification; + Cesium['IonImageryProvider'] = Scene_IonImageryProvider; + Cesium['JobScheduler'] = Scene_JobScheduler; + Cesium['JobType'] = Scene_JobType; + Cesium['Label'] = Scene_Label; + Cesium['LabelCollection'] = Scene_LabelCollection; + Cesium['LabelStyle'] = Scene_LabelStyle; + Cesium['MapboxImageryProvider'] = Scene_MapboxImageryProvider; + Cesium['MapMode2D'] = Scene_MapMode2D; + Cesium['Material'] = Scene_Material; + Cesium['MaterialAppearance'] = Scene_MaterialAppearance; + Cesium['Model'] = Scene_Model; + Cesium['ModelAnimation'] = Scene_ModelAnimation; + Cesium['ModelAnimationCache'] = Scene_ModelAnimationCache; + Cesium['ModelAnimationCollection'] = Scene_ModelAnimationCollection; + Cesium['ModelAnimationLoop'] = Scene_ModelAnimationLoop; + Cesium['ModelAnimationState'] = Scene_ModelAnimationState; + Cesium['ModelInstance'] = Scene_ModelInstance; + Cesium['ModelInstanceCollection'] = Scene_ModelInstanceCollection; + Cesium['ModelLoadResources'] = Scene_ModelLoadResources; + Cesium['ModelMaterial'] = Scene_ModelMaterial; + Cesium['ModelMesh'] = Scene_ModelMesh; + Cesium['ModelNode'] = Scene_ModelNode; + Cesium['ModelUtility'] = Scene_ModelUtility; + Cesium['Moon'] = Scene_Moon; + Cesium['NeverTileDiscardPolicy'] = Scene_NeverTileDiscardPolicy; + Cesium['OIT'] = Scene_OIT; + Cesium['Particle'] = Scene_Particle; + Cesium['ParticleBurst'] = Scene_ParticleBurst; + Cesium['ParticleEmitter'] = Scene_ParticleEmitter; + Cesium['ParticleSystem'] = Scene_ParticleSystem; + Cesium['PerformanceDisplay'] = Scene_PerformanceDisplay; + Cesium['PerInstanceColorAppearance'] = Scene_PerInstanceColorAppearance; + Cesium['PickDepth'] = Scene_PickDepth; + Cesium['PointCloud3DTileContent'] = Scene_PointCloud3DTileContent; + Cesium['PointCloudEyeDomeLighting'] = Scene_PointCloudEyeDomeLighting; + Cesium['PointCloudShading'] = Scene_PointCloudShading; + Cesium['PointPrimitive'] = Scene_PointPrimitive; + Cesium['PointPrimitiveCollection'] = Scene_PointPrimitiveCollection; + Cesium['Polyline'] = Scene_Polyline; + Cesium['PolylineCollection'] = Scene_PolylineCollection; + Cesium['PolylineColorAppearance'] = Scene_PolylineColorAppearance; + Cesium['PolylineMaterialAppearance'] = Scene_PolylineMaterialAppearance; + Cesium['Primitive'] = Scene_Primitive; + Cesium['PrimitiveCollection'] = Scene_PrimitiveCollection; + Cesium['PrimitivePipeline'] = Scene_PrimitivePipeline; + Cesium['PrimitiveState'] = Scene_PrimitiveState; + Cesium['QuadtreeOccluders'] = Scene_QuadtreeOccluders; + Cesium['QuadtreePrimitive'] = Scene_QuadtreePrimitive; + Cesium['QuadtreeTile'] = Scene_QuadtreeTile; + Cesium['QuadtreeTileLoadState'] = Scene_QuadtreeTileLoadState; + Cesium['QuadtreeTileProvider'] = Scene_QuadtreeTileProvider; + Cesium['Scene'] = Scene_Scene; + Cesium['SceneMode'] = Scene_SceneMode; + Cesium['SceneTransforms'] = Scene_SceneTransforms; + Cesium['SceneTransitioner'] = Scene_SceneTransitioner; + Cesium['ScreenSpaceCameraController'] = Scene_ScreenSpaceCameraController; + Cesium['ShadowMap'] = Scene_ShadowMap; + Cesium['ShadowMapShader'] = Scene_ShadowMapShader; + Cesium['ShadowMode'] = Scene_ShadowMode; + Cesium['SingleTileImageryProvider'] = Scene_SingleTileImageryProvider; + Cesium['SkyAtmosphere'] = Scene_SkyAtmosphere; + Cesium['SkyBox'] = Scene_SkyBox; + Cesium['SphereEmitter'] = Scene_SphereEmitter; + Cesium['StencilFunction'] = Scene_StencilFunction; + Cesium['StencilOperation'] = Scene_StencilOperation; + Cesium['StyleExpression'] = Scene_StyleExpression; + Cesium['Sun'] = Scene_Sun; + Cesium['SunPostProcess'] = Scene_SunPostProcess; + Cesium['TerrainState'] = Scene_TerrainState; + Cesium['TextureAtlas'] = Scene_TextureAtlas; + Cesium['TileBoundingRegion'] = Scene_TileBoundingRegion; + Cesium['TileBoundingSphere'] = Scene_TileBoundingSphere; + Cesium['TileBoundingVolume'] = Scene_TileBoundingVolume; + Cesium['TileCoordinatesImageryProvider'] = Scene_TileCoordinatesImageryProvider; + Cesium['TileDiscardPolicy'] = Scene_TileDiscardPolicy; + Cesium['TileImagery'] = Scene_TileImagery; + Cesium['TileOrientedBoundingBox'] = Scene_TileOrientedBoundingBox; + Cesium['TileReplacementQueue'] = Scene_TileReplacementQueue; + Cesium['Tileset3DTileContent'] = Scene_Tileset3DTileContent; + Cesium['TileState'] = Scene_TileState; + Cesium['TileTerrain'] = Scene_TileTerrain; + Cesium['TimeDynamicImagery'] = Scene_TimeDynamicImagery; + Cesium['TweenCollection'] = Scene_TweenCollection; + Cesium['UrlTemplateImageryProvider'] = Scene_UrlTemplateImageryProvider; + Cesium['Vector3DTileBatch'] = Scene_Vector3DTileBatch; + Cesium['Vector3DTileContent'] = Scene_Vector3DTileContent; + Cesium['Vector3DTileGeometry'] = Scene_Vector3DTileGeometry; + Cesium['Vector3DTilePoints'] = Scene_Vector3DTilePoints; + Cesium['Vector3DTilePolygons'] = Scene_Vector3DTilePolygons; + Cesium['Vector3DTilePolylines'] = Scene_Vector3DTilePolylines; + Cesium['Vector3DTilePrimitive'] = Scene_Vector3DTilePrimitive; + Cesium['VerticalOrigin'] = Scene_VerticalOrigin; + Cesium['ViewportQuad'] = Scene_ViewportQuad; + Cesium['WebMapServiceImageryProvider'] = Scene_WebMapServiceImageryProvider; + Cesium['WebMapTileServiceImageryProvider'] = Scene_WebMapTileServiceImageryProvider; + Cesium._shaders['AdjustTranslucentFS'] = Shaders_AdjustTranslucentFS; + Cesium._shaders['AllMaterialAppearanceFS'] = Shaders_Appearances_AllMaterialAppearanceFS; + Cesium._shaders['AllMaterialAppearanceVS'] = Shaders_Appearances_AllMaterialAppearanceVS; + Cesium._shaders['BasicMaterialAppearanceFS'] = Shaders_Appearances_BasicMaterialAppearanceFS; + Cesium._shaders['BasicMaterialAppearanceVS'] = Shaders_Appearances_BasicMaterialAppearanceVS; + Cesium._shaders['EllipsoidSurfaceAppearanceFS'] = Shaders_Appearances_EllipsoidSurfaceAppearanceFS; + Cesium._shaders['EllipsoidSurfaceAppearanceVS'] = Shaders_Appearances_EllipsoidSurfaceAppearanceVS; + Cesium._shaders['PerInstanceColorAppearanceFS'] = Shaders_Appearances_PerInstanceColorAppearanceFS; + Cesium._shaders['PerInstanceColorAppearanceVS'] = Shaders_Appearances_PerInstanceColorAppearanceVS; + Cesium._shaders['PerInstanceFlatColorAppearanceFS'] = Shaders_Appearances_PerInstanceFlatColorAppearanceFS; + Cesium._shaders['PerInstanceFlatColorAppearanceVS'] = Shaders_Appearances_PerInstanceFlatColorAppearanceVS; + Cesium._shaders['PolylineColorAppearanceVS'] = Shaders_Appearances_PolylineColorAppearanceVS; + Cesium._shaders['PolylineMaterialAppearanceVS'] = Shaders_Appearances_PolylineMaterialAppearanceVS; + Cesium._shaders['TexturedMaterialAppearanceFS'] = Shaders_Appearances_TexturedMaterialAppearanceFS; + Cesium._shaders['TexturedMaterialAppearanceVS'] = Shaders_Appearances_TexturedMaterialAppearanceVS; + Cesium._shaders['BillboardCollectionFS'] = Shaders_BillboardCollectionFS; + Cesium._shaders['BillboardCollectionVS'] = Shaders_BillboardCollectionVS; + Cesium._shaders['BrdfLutGeneratorFS'] = Shaders_BrdfLutGeneratorFS; + Cesium._shaders['degreesPerRadian'] = Shaders_Builtin_Constants_degreesPerRadian; + Cesium._shaders['depthRange'] = Shaders_Builtin_Constants_depthRange; + Cesium._shaders['epsilon1'] = Shaders_Builtin_Constants_epsilon1; + Cesium._shaders['epsilon2'] = Shaders_Builtin_Constants_epsilon2; + Cesium._shaders['epsilon3'] = Shaders_Builtin_Constants_epsilon3; + Cesium._shaders['epsilon4'] = Shaders_Builtin_Constants_epsilon4; + Cesium._shaders['epsilon5'] = Shaders_Builtin_Constants_epsilon5; + Cesium._shaders['epsilon6'] = Shaders_Builtin_Constants_epsilon6; + Cesium._shaders['epsilon7'] = Shaders_Builtin_Constants_epsilon7; + Cesium._shaders['infinity'] = Shaders_Builtin_Constants_infinity; + Cesium._shaders['oneOverPi'] = Shaders_Builtin_Constants_oneOverPi; + Cesium._shaders['oneOverTwoPi'] = Shaders_Builtin_Constants_oneOverTwoPi; + Cesium._shaders['passCesium3DTile'] = Shaders_Builtin_Constants_passCesium3DTile; + Cesium._shaders['passCesium3DTileClassification'] = Shaders_Builtin_Constants_passCesium3DTileClassification; + Cesium._shaders['passCesium3DTileClassificationIgnoreShow'] = Shaders_Builtin_Constants_passCesium3DTileClassificationIgnoreShow; + Cesium._shaders['passClassification'] = Shaders_Builtin_Constants_passClassification; + Cesium._shaders['passCompute'] = Shaders_Builtin_Constants_passCompute; + Cesium._shaders['passEnvironment'] = Shaders_Builtin_Constants_passEnvironment; + Cesium._shaders['passGlobe'] = Shaders_Builtin_Constants_passGlobe; + Cesium._shaders['passOpaque'] = Shaders_Builtin_Constants_passOpaque; + Cesium._shaders['passOverlay'] = Shaders_Builtin_Constants_passOverlay; + Cesium._shaders['passTerrainClassification'] = Shaders_Builtin_Constants_passTerrainClassification; + Cesium._shaders['passTranslucent'] = Shaders_Builtin_Constants_passTranslucent; + Cesium._shaders['pi'] = Shaders_Builtin_Constants_pi; + Cesium._shaders['piOverFour'] = Shaders_Builtin_Constants_piOverFour; + Cesium._shaders['piOverSix'] = Shaders_Builtin_Constants_piOverSix; + Cesium._shaders['piOverThree'] = Shaders_Builtin_Constants_piOverThree; + Cesium._shaders['piOverTwo'] = Shaders_Builtin_Constants_piOverTwo; + Cesium._shaders['radiansPerDegree'] = Shaders_Builtin_Constants_radiansPerDegree; + Cesium._shaders['sceneMode2D'] = Shaders_Builtin_Constants_sceneMode2D; + Cesium._shaders['sceneMode3D'] = Shaders_Builtin_Constants_sceneMode3D; + Cesium._shaders['sceneModeColumbusView'] = Shaders_Builtin_Constants_sceneModeColumbusView; + Cesium._shaders['sceneModeMorphing'] = Shaders_Builtin_Constants_sceneModeMorphing; + Cesium._shaders['solarRadius'] = Shaders_Builtin_Constants_solarRadius; + Cesium._shaders['threePiOver2'] = Shaders_Builtin_Constants_threePiOver2; + Cesium._shaders['twoPi'] = Shaders_Builtin_Constants_twoPi; + Cesium._shaders['webMercatorMaxLatitude'] = Shaders_Builtin_Constants_webMercatorMaxLatitude; + Cesium._shaders['CzmBuiltins'] = Shaders_Builtin_CzmBuiltins; + Cesium._shaders['alphaWeight'] = Shaders_Builtin_Functions_alphaWeight; + Cesium._shaders['antialias'] = Shaders_Builtin_Functions_antialias; + Cesium._shaders['cascadeColor'] = Shaders_Builtin_Functions_cascadeColor; + Cesium._shaders['cascadeDistance'] = Shaders_Builtin_Functions_cascadeDistance; + Cesium._shaders['cascadeMatrix'] = Shaders_Builtin_Functions_cascadeMatrix; + Cesium._shaders['cascadeWeights'] = Shaders_Builtin_Functions_cascadeWeights; + Cesium._shaders['columbusViewMorph'] = Shaders_Builtin_Functions_columbusViewMorph; + Cesium._shaders['computePosition'] = Shaders_Builtin_Functions_computePosition; + Cesium._shaders['cosineAndSine'] = Shaders_Builtin_Functions_cosineAndSine; + Cesium._shaders['decompressTextureCoordinates'] = Shaders_Builtin_Functions_decompressTextureCoordinates; + Cesium._shaders['depthClampFarPlane'] = Shaders_Builtin_Functions_depthClampFarPlane; + Cesium._shaders['eastNorthUpToEyeCoordinates'] = Shaders_Builtin_Functions_eastNorthUpToEyeCoordinates; + Cesium._shaders['ellipsoidContainsPoint'] = Shaders_Builtin_Functions_ellipsoidContainsPoint; + Cesium._shaders['ellipsoidNew'] = Shaders_Builtin_Functions_ellipsoidNew; + Cesium._shaders['ellipsoidWgs84TextureCoordinates'] = Shaders_Builtin_Functions_ellipsoidWgs84TextureCoordinates; + Cesium._shaders['equalsEpsilon'] = Shaders_Builtin_Functions_equalsEpsilon; + Cesium._shaders['eyeOffset'] = Shaders_Builtin_Functions_eyeOffset; + Cesium._shaders['eyeToWindowCoordinates'] = Shaders_Builtin_Functions_eyeToWindowCoordinates; + Cesium._shaders['fog'] = Shaders_Builtin_Functions_fog; + Cesium._shaders['geodeticSurfaceNormal'] = Shaders_Builtin_Functions_geodeticSurfaceNormal; + Cesium._shaders['getDefaultMaterial'] = Shaders_Builtin_Functions_getDefaultMaterial; + Cesium._shaders['getLambertDiffuse'] = Shaders_Builtin_Functions_getLambertDiffuse; + Cesium._shaders['getSpecular'] = Shaders_Builtin_Functions_getSpecular; + Cesium._shaders['getWaterNoise'] = Shaders_Builtin_Functions_getWaterNoise; + Cesium._shaders['getWgs84EllipsoidEC'] = Shaders_Builtin_Functions_getWgs84EllipsoidEC; + Cesium._shaders['HSBToRGB'] = Shaders_Builtin_Functions_HSBToRGB; + Cesium._shaders['HSLToRGB'] = Shaders_Builtin_Functions_HSLToRGB; + Cesium._shaders['hue'] = Shaders_Builtin_Functions_hue; + Cesium._shaders['isEmpty'] = Shaders_Builtin_Functions_isEmpty; + Cesium._shaders['isFull'] = Shaders_Builtin_Functions_isFull; + Cesium._shaders['latitudeToWebMercatorFraction'] = Shaders_Builtin_Functions_latitudeToWebMercatorFraction; + Cesium._shaders['luminance'] = Shaders_Builtin_Functions_luminance; + Cesium._shaders['metersPerPixel'] = Shaders_Builtin_Functions_metersPerPixel; + Cesium._shaders['modelToWindowCoordinates'] = Shaders_Builtin_Functions_modelToWindowCoordinates; + Cesium._shaders['multiplyWithColorBalance'] = Shaders_Builtin_Functions_multiplyWithColorBalance; + Cesium._shaders['nearFarScalar'] = Shaders_Builtin_Functions_nearFarScalar; + Cesium._shaders['octDecode'] = Shaders_Builtin_Functions_octDecode; + Cesium._shaders['packDepth'] = Shaders_Builtin_Functions_packDepth; + Cesium._shaders['phong'] = Shaders_Builtin_Functions_phong; + Cesium._shaders['pointAlongRay'] = Shaders_Builtin_Functions_pointAlongRay; + Cesium._shaders['rayEllipsoidIntersectionInterval'] = Shaders_Builtin_Functions_rayEllipsoidIntersectionInterval; + Cesium._shaders['reverseLogDepth'] = Shaders_Builtin_Functions_reverseLogDepth; + Cesium._shaders['RGBToHSB'] = Shaders_Builtin_Functions_RGBToHSB; + Cesium._shaders['RGBToHSL'] = Shaders_Builtin_Functions_RGBToHSL; + Cesium._shaders['RGBToXYZ'] = Shaders_Builtin_Functions_RGBToXYZ; + Cesium._shaders['saturation'] = Shaders_Builtin_Functions_saturation; + Cesium._shaders['shadowDepthCompare'] = Shaders_Builtin_Functions_shadowDepthCompare; + Cesium._shaders['shadowVisibility'] = Shaders_Builtin_Functions_shadowVisibility; + Cesium._shaders['signNotZero'] = Shaders_Builtin_Functions_signNotZero; + Cesium._shaders['tangentToEyeSpaceMatrix'] = Shaders_Builtin_Functions_tangentToEyeSpaceMatrix; + Cesium._shaders['transformPlane'] = Shaders_Builtin_Functions_transformPlane; + Cesium._shaders['translateRelativeToEye'] = Shaders_Builtin_Functions_translateRelativeToEye; + Cesium._shaders['translucentPhong'] = Shaders_Builtin_Functions_translucentPhong; + Cesium._shaders['transpose'] = Shaders_Builtin_Functions_transpose; + Cesium._shaders['unpackDepth'] = Shaders_Builtin_Functions_unpackDepth; + Cesium._shaders['unpackFloat'] = Shaders_Builtin_Functions_unpackFloat; + Cesium._shaders['vertexLogDepth'] = Shaders_Builtin_Functions_vertexLogDepth; + Cesium._shaders['windowToEyeCoordinates'] = Shaders_Builtin_Functions_windowToEyeCoordinates; + Cesium._shaders['writeDepthClampedToFarPlane'] = Shaders_Builtin_Functions_writeDepthClampedToFarPlane; + Cesium._shaders['writeLogDepth'] = Shaders_Builtin_Functions_writeLogDepth; + Cesium._shaders['XYZToRGB'] = Shaders_Builtin_Functions_XYZToRGB; + Cesium._shaders['depthRangeStruct'] = Shaders_Builtin_Structs_depthRangeStruct; + Cesium._shaders['ellipsoid'] = Shaders_Builtin_Structs_ellipsoid; + Cesium._shaders['material'] = Shaders_Builtin_Structs_material; + Cesium._shaders['materialInput'] = Shaders_Builtin_Structs_materialInput; + Cesium._shaders['ray'] = Shaders_Builtin_Structs_ray; + Cesium._shaders['raySegment'] = Shaders_Builtin_Structs_raySegment; + Cesium._shaders['shadowParameters'] = Shaders_Builtin_Structs_shadowParameters; + Cesium._shaders['CompositeOITFS'] = Shaders_CompositeOITFS; + Cesium._shaders['DepthPlaneFS'] = Shaders_DepthPlaneFS; + Cesium._shaders['DepthPlaneVS'] = Shaders_DepthPlaneVS; + Cesium._shaders['EllipsoidFS'] = Shaders_EllipsoidFS; + Cesium._shaders['EllipsoidVS'] = Shaders_EllipsoidVS; + Cesium._shaders['GlobeFS'] = Shaders_GlobeFS; + Cesium._shaders['GlobeVS'] = Shaders_GlobeVS; + Cesium._shaders['GroundAtmosphere'] = Shaders_GroundAtmosphere; + Cesium._shaders['BumpMapMaterial'] = Shaders_Materials_BumpMapMaterial; + Cesium._shaders['CheckerboardMaterial'] = Shaders_Materials_CheckerboardMaterial; + Cesium._shaders['DotMaterial'] = Shaders_Materials_DotMaterial; + Cesium._shaders['ElevationContourMaterial'] = Shaders_Materials_ElevationContourMaterial; + Cesium._shaders['ElevationRampMaterial'] = Shaders_Materials_ElevationRampMaterial; + Cesium._shaders['FadeMaterial'] = Shaders_Materials_FadeMaterial; + Cesium._shaders['GridMaterial'] = Shaders_Materials_GridMaterial; + Cesium._shaders['NormalMapMaterial'] = Shaders_Materials_NormalMapMaterial; + Cesium._shaders['PolylineArrowMaterial'] = Shaders_Materials_PolylineArrowMaterial; + Cesium._shaders['PolylineDashMaterial'] = Shaders_Materials_PolylineDashMaterial; + Cesium._shaders['PolylineGlowMaterial'] = Shaders_Materials_PolylineGlowMaterial; + Cesium._shaders['PolylineOutlineMaterial'] = Shaders_Materials_PolylineOutlineMaterial; + Cesium._shaders['RimLightingMaterial'] = Shaders_Materials_RimLightingMaterial; + Cesium._shaders['SlopeRampMaterial'] = Shaders_Materials_SlopeRampMaterial; + Cesium._shaders['StripeMaterial'] = Shaders_Materials_StripeMaterial; + Cesium._shaders['Water'] = Shaders_Materials_Water; + Cesium._shaders['PointPrimitiveCollectionFS'] = Shaders_PointPrimitiveCollectionFS; + Cesium._shaders['PointPrimitiveCollectionVS'] = Shaders_PointPrimitiveCollectionVS; + Cesium._shaders['PolylineCommon'] = Shaders_PolylineCommon; + Cesium._shaders['PolylineFS'] = Shaders_PolylineFS; + Cesium._shaders['PolylineVS'] = Shaders_PolylineVS; + Cesium._shaders['AdditiveBlend'] = Shaders_PostProcessFilters_AdditiveBlend; + Cesium._shaders['BrightPass'] = Shaders_PostProcessFilters_BrightPass; + Cesium._shaders['FXAA'] = Shaders_PostProcessFilters_FXAA; + Cesium._shaders['GaussianBlur1D'] = Shaders_PostProcessFilters_GaussianBlur1D; + Cesium._shaders['PassThrough'] = Shaders_PostProcessFilters_PassThrough; + Cesium._shaders['PointCloudEyeDomeLighting'] = Shaders_PostProcessFilters_PointCloudEyeDomeLighting; + Cesium._shaders['ReprojectWebMercatorFS'] = Shaders_ReprojectWebMercatorFS; + Cesium._shaders['ReprojectWebMercatorVS'] = Shaders_ReprojectWebMercatorVS; + Cesium._shaders['ShadowVolumeFS'] = Shaders_ShadowVolumeFS; + Cesium._shaders['ShadowVolumeVS'] = Shaders_ShadowVolumeVS; + Cesium._shaders['SkyAtmosphereFS'] = Shaders_SkyAtmosphereFS; + Cesium._shaders['SkyAtmosphereVS'] = Shaders_SkyAtmosphereVS; + Cesium._shaders['SkyBoxFS'] = Shaders_SkyBoxFS; + Cesium._shaders['SkyBoxVS'] = Shaders_SkyBoxVS; + Cesium._shaders['SunFS'] = Shaders_SunFS; + Cesium._shaders['SunTextureFS'] = Shaders_SunTextureFS; + Cesium._shaders['SunVS'] = Shaders_SunVS; + Cesium._shaders['Vector3DTilePolylinesVS'] = Shaders_Vector3DTilePolylinesVS; + Cesium._shaders['ViewportQuadFS'] = Shaders_ViewportQuadFS; + Cesium._shaders['ViewportQuadVS'] = Shaders_ViewportQuadVS; + Cesium['Autolinker'] = ThirdParty_Autolinker; + Cesium['earcut-2.1.1'] = ThirdParty_earcut_2_1_1; + Cesium['addDefaults'] = ThirdParty_GltfPipeline_addDefaults; + Cesium['addExtensionsRequired'] = ThirdParty_GltfPipeline_addExtensionsRequired; + Cesium['addExtensionsUsed'] = ThirdParty_GltfPipeline_addExtensionsUsed; + Cesium['addPipelineExtras'] = ThirdParty_GltfPipeline_addPipelineExtras; + Cesium['addToArray'] = ThirdParty_GltfPipeline_addToArray; + Cesium['byteLengthForComponentType'] = ThirdParty_GltfPipeline_byteLengthForComponentType; + Cesium['findAccessorMinMax'] = ThirdParty_GltfPipeline_findAccessorMinMax; + Cesium['ForEach'] = ThirdParty_GltfPipeline_ForEach; + Cesium['getAccessorByteStride'] = ThirdParty_GltfPipeline_getAccessorByteStride; + Cesium['getJointCountForMaterials'] = ThirdParty_GltfPipeline_getJointCountForMaterials; + Cesium['glslTypeToWebGLConstant'] = ThirdParty_GltfPipeline_glslTypeToWebGLConstant; + Cesium['numberOfComponentsForType'] = ThirdParty_GltfPipeline_numberOfComponentsForType; + Cesium['parseBinaryGltf'] = ThirdParty_GltfPipeline_parseBinaryGltf; + Cesium['processModelMaterialsCommon'] = ThirdParty_GltfPipeline_processModelMaterialsCommon; + Cesium['processPbrMetallicRoughness'] = ThirdParty_GltfPipeline_processPbrMetallicRoughness; + Cesium['removeExtensionsRequired'] = ThirdParty_GltfPipeline_removeExtensionsRequired; + Cesium['removeExtensionsUsed'] = ThirdParty_GltfPipeline_removeExtensionsUsed; + Cesium['removePipelineExtras'] = ThirdParty_GltfPipeline_removePipelineExtras; + Cesium['techniqueParameterForSemantic'] = ThirdParty_GltfPipeline_techniqueParameterForSemantic; + Cesium['updateVersion'] = ThirdParty_GltfPipeline_updateVersion; + Cesium['webGLConstantToGlslType'] = ThirdParty_GltfPipeline_webGLConstantToGlslType; + Cesium['google-earth-dbroot-parser'] = ThirdParty_google_earth_dbroot_parser; + Cesium['jsep'] = ThirdParty_jsep; + Cesium['kdbush'] = ThirdParty_kdbush; + Cesium['knockout-3.4.2'] = ThirdParty_knockout_3_4_2; + Cesium['knockout-es5'] = ThirdParty_knockout_es5; + Cesium['knockout'] = ThirdParty_knockout; + Cesium['measureText'] = ThirdParty_measureText; + Cesium['mersenne-twister'] = ThirdParty_mersenne_twister; + Cesium['NoSleep'] = ThirdParty_NoSleep; + Cesium['protobuf-minimal'] = ThirdParty_protobuf_minimal; + Cesium['FXAA3_11'] = ThirdParty_Shaders_FXAA3_11; + Cesium['sprintf'] = ThirdParty_sprintf; + Cesium['topojson'] = ThirdParty_topojson; + Cesium['Tween'] = ThirdParty_Tween; + Cesium['Uri'] = ThirdParty_Uri; + Cesium['when'] = ThirdParty_when; + Cesium['xss'] = ThirdParty_xss; + Cesium['zip'] = ThirdParty_zip; + Cesium['Animation'] = Widgets_Animation_Animation; + Cesium['AnimationViewModel'] = Widgets_Animation_AnimationViewModel; + Cesium['BaseLayerPicker'] = Widgets_BaseLayerPicker_BaseLayerPicker; + Cesium['BaseLayerPickerViewModel'] = Widgets_BaseLayerPicker_BaseLayerPickerViewModel; + Cesium['createDefaultImageryProviderViewModels'] = Widgets_BaseLayerPicker_createDefaultImageryProviderViewModels; + Cesium['createDefaultTerrainProviderViewModels'] = Widgets_BaseLayerPicker_createDefaultTerrainProviderViewModels; + Cesium['ProviderViewModel'] = Widgets_BaseLayerPicker_ProviderViewModel; + Cesium['Cesium3DTilesInspector'] = Widgets_Cesium3DTilesInspector_Cesium3DTilesInspector; + Cesium['Cesium3DTilesInspectorViewModel'] = Widgets_Cesium3DTilesInspector_Cesium3DTilesInspectorViewModel; + Cesium['CesiumInspector'] = Widgets_CesiumInspector_CesiumInspector; + Cesium['CesiumInspectorViewModel'] = Widgets_CesiumInspector_CesiumInspectorViewModel; + Cesium['CesiumWidget'] = Widgets_CesiumWidget_CesiumWidget; + Cesium['ClockViewModel'] = Widgets_ClockViewModel; + Cesium['Command'] = Widgets_Command; + Cesium['createCommand'] = Widgets_createCommand; + Cesium['FullscreenButton'] = Widgets_FullscreenButton_FullscreenButton; + Cesium['FullscreenButtonViewModel'] = Widgets_FullscreenButton_FullscreenButtonViewModel; + Cesium['Geocoder'] = Widgets_Geocoder_Geocoder; + Cesium['GeocoderViewModel'] = Widgets_Geocoder_GeocoderViewModel; + Cesium['getElement'] = Widgets_getElement; + Cesium['HomeButton'] = Widgets_HomeButton_HomeButton; + Cesium['HomeButtonViewModel'] = Widgets_HomeButton_HomeButtonViewModel; + Cesium['InfoBox'] = Widgets_InfoBox_InfoBox; + Cesium['InfoBoxViewModel'] = Widgets_InfoBox_InfoBoxViewModel; + Cesium['NavigationHelpButton'] = Widgets_NavigationHelpButton_NavigationHelpButton; + Cesium['NavigationHelpButtonViewModel'] = Widgets_NavigationHelpButton_NavigationHelpButtonViewModel; + Cesium['PerformanceWatchdog'] = Widgets_PerformanceWatchdog_PerformanceWatchdog; + Cesium['PerformanceWatchdogViewModel'] = Widgets_PerformanceWatchdog_PerformanceWatchdogViewModel; + Cesium['ProjectionPicker'] = Widgets_ProjectionPicker_ProjectionPicker; + Cesium['ProjectionPickerViewModel'] = Widgets_ProjectionPicker_ProjectionPickerViewModel; + Cesium['SceneModePicker'] = Widgets_SceneModePicker_SceneModePicker; + Cesium['SceneModePickerViewModel'] = Widgets_SceneModePicker_SceneModePickerViewModel; + Cesium['SelectionIndicator'] = Widgets_SelectionIndicator_SelectionIndicator; + Cesium['SelectionIndicatorViewModel'] = Widgets_SelectionIndicator_SelectionIndicatorViewModel; + Cesium['subscribeAndEvaluate'] = Widgets_subscribeAndEvaluate; + Cesium['SvgPathBindingHandler'] = Widgets_SvgPathBindingHandler; + Cesium['Timeline'] = Widgets_Timeline_Timeline; + Cesium['TimelineHighlightRange'] = Widgets_Timeline_TimelineHighlightRange; + Cesium['TimelineTrack'] = Widgets_Timeline_TimelineTrack; + Cesium['ToggleButtonViewModel'] = Widgets_ToggleButtonViewModel; + Cesium['Viewer'] = Widgets_Viewer_Viewer; + Cesium['viewerCesium3DTilesInspectorMixin'] = Widgets_Viewer_viewerCesium3DTilesInspectorMixin; + Cesium['viewerCesiumInspectorMixin'] = Widgets_Viewer_viewerCesiumInspectorMixin; + Cesium['viewerDragDropMixin'] = Widgets_Viewer_viewerDragDropMixin; + Cesium['viewerPerformanceWatchdogMixin'] = Widgets_Viewer_viewerPerformanceWatchdogMixin; + Cesium['VRButton'] = Widgets_VRButton_VRButton; + Cesium['VRButtonViewModel'] = Widgets_VRButton_VRButtonViewModel; + Cesium['createTaskProcessorWorker'] = Workers_createTaskProcessorWorker; + return Cesium; +}); \ No newline at end of file diff --git a/Source/Shaders/AdjustTranslucentFS.js b/Source/Shaders/AdjustTranslucentFS.js new file mode 100644 index 000000000000..8df54681d4e9 --- /dev/null +++ b/Source/Shaders/AdjustTranslucentFS.js @@ -0,0 +1,29 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef MRT\n\ +#extension GL_EXT_draw_buffers : enable\n\ +#endif\n\ +\n\ +uniform vec4 u_bgColor;\n\ +uniform sampler2D u_depthTexture;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main()\n\ +{\n\ + if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n\ + {\n\ +#ifdef MRT\n\ + gl_FragData[0] = u_bgColor;\n\ + gl_FragData[1] = vec4(u_bgColor.a);\n\ +#else\n\ + gl_FragColor = u_bgColor;\n\ +#endif\n\ + return;\n\ + }\n\ + \n\ + discard;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceFS.js b/Source/Shaders/Appearances/AllMaterialAppearanceFS.js new file mode 100644 index 000000000000..f25f61e1d4d4 --- /dev/null +++ b/Source/Shaders/Appearances/AllMaterialAppearanceFS.js @@ -0,0 +1,34 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying vec3 v_tangentEC;\n\ +varying vec3 v_bitangentEC;\n\ +varying 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\ + gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ +#else\n\ + gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.js b/Source/Shaders/Appearances/AllMaterialAppearanceVS.js new file mode 100644 index 000000000000..4a87d139f0d5 --- /dev/null +++ b/Source/Shaders/Appearances/AllMaterialAppearanceVS.js @@ -0,0 +1,31 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 normal;\n\ +attribute vec3 tangent;\n\ +attribute vec3 bitangent;\n\ +attribute vec2 st;\n\ +attribute float batchId;\n\ +\n\ +varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying vec3 v_tangentEC;\n\ +varying vec3 v_bitangentEC;\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js new file mode 100644 index 000000000000..eb227ec49fe4 --- /dev/null +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js @@ -0,0 +1,28 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec3 v_positionEC;\n\ +varying 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\ + gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ +#else\n\ + gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js new file mode 100644 index 000000000000..522f2b83e70b --- /dev/null +++ b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js @@ -0,0 +1,22 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 normal;\n\ +attribute float batchId;\n\ +\n\ +varying vec3 v_positionEC;\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js new file mode 100644 index 000000000000..409fa84ec8c6 --- /dev/null +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js @@ -0,0 +1,38 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec3 v_positionMC;\n\ +varying vec3 v_positionEC;\n\ +varying 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\ + gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ +#else\n\ + gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js new file mode 100644 index 000000000000..61bb075ec17b --- /dev/null +++ b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec2 st;\n\ +attribute float batchId;\n\ +\n\ +varying vec3 v_positionMC;\n\ +varying vec3 v_positionEC;\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js new file mode 100644 index 000000000000..46e0075b0ab6 --- /dev/null +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying 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\ + czm_materialInput materialInput;\n\ + materialInput.normalEC = normalEC;\n\ + materialInput.positionToEyeEC = positionToEyeEC;\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ + material.diffuse = v_color.rgb;\n\ + material.alpha = v_color.a;\n\ +\n\ + gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js new file mode 100644 index 000000000000..cc9802dcb861 --- /dev/null +++ b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js @@ -0,0 +1,25 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 normal;\n\ +attribute vec4 color;\n\ +attribute float batchId;\n\ +\n\ +varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js new file mode 100644 index 000000000000..79c75df142a2 --- /dev/null +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js @@ -0,0 +1,11 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec4 v_color;\n\ +\n\ +void main()\n\ +{\n\ + gl_FragColor = v_color;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js new file mode 100644 index 000000000000..36c183443ae0 --- /dev/null +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js @@ -0,0 +1,20 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec4 color;\n\ +attribute float batchId;\n\ +\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.js b/Source/Shaders/Appearances/PolylineColorAppearanceVS.js new file mode 100644 index 000000000000..3d0e3e5af872 --- /dev/null +++ b/Source/Shaders/Appearances/PolylineColorAppearanceVS.js @@ -0,0 +1,37 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 prevPosition3DHigh;\n\ +attribute vec3 prevPosition3DLow;\n\ +attribute vec3 nextPosition3DHigh;\n\ +attribute vec3 nextPosition3DLow;\n\ +attribute vec2 expandAndWidth;\n\ +attribute vec4 color;\n\ +attribute float batchId;\n\ +\n\ +varying 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\ + v_color = color;\n\ +\n\ + float angle;\n\ + vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n\ + gl_Position = czm_viewportOrthographic * positionWC;\n\ +\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js new file mode 100644 index 000000000000..9443903035c8 --- /dev/null +++ b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js @@ -0,0 +1,39 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 prevPosition3DHigh;\n\ +attribute vec3 prevPosition3DLow;\n\ +attribute vec3 nextPosition3DHigh;\n\ +attribute vec3 nextPosition3DLow;\n\ +attribute vec2 expandAndWidth;\n\ +attribute vec2 st;\n\ +attribute float batchId;\n\ +\n\ +varying float v_width;\n\ +varying vec2 v_st;\n\ +varying 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\ + v_width = width;\n\ + v_st = st;\n\ +\n\ + vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\n\ + gl_Position = czm_viewportOrthographic * positionWC;\n\ +\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js new file mode 100644 index 000000000000..da58b9b8ea6c --- /dev/null +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js @@ -0,0 +1,30 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying 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\ + gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ +#else\n\ + gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js new file mode 100644 index 000000000000..d4151542ccc2 --- /dev/null +++ b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js @@ -0,0 +1,25 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 normal;\n\ +attribute vec2 st;\n\ +attribute float batchId;\n\ +\n\ +varying vec3 v_positionEC;\n\ +varying vec3 v_normalEC;\n\ +varying 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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/BillboardCollectionFS.js b/Source/Shaders/BillboardCollectionFS.js new file mode 100644 index 000000000000..e5ac6bfd951e --- /dev/null +++ b/Source/Shaders/BillboardCollectionFS.js @@ -0,0 +1,63 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D u_atlas;\n\ +\n\ +#ifdef VECTOR_TILE\n\ +uniform vec4 u_highlightColor;\n\ +#endif\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ +varying vec4 v_pickColor;\n\ +#else\n\ +varying vec4 v_color;\n\ +#endif\n\ +\n\ +void main()\n\ +{\n\ +#ifdef RENDER_FOR_PICK\n\ + vec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);\n\ +#else\n\ + vec4 vertexColor = v_color;\n\ +#endif\n\ +\n\ + vec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;\n\ +\n\ +// Fully transparent parts of the billboard are not pickable.\n\ +#if defined(RENDER_FOR_PICK) || (!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\ +\n\ +#ifdef RENDER_FOR_PICK\n\ + gl_FragColor = v_pickColor;\n\ +#else\n\ + gl_FragColor = color;\n\ +#endif\n\ +\n\ + czm_writeLogDepth();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/BillboardCollectionVS.js b/Source/Shaders/BillboardCollectionVS.js new file mode 100644 index 000000000000..a9a8b7cfb6fe --- /dev/null +++ b/Source/Shaders/BillboardCollectionVS.js @@ -0,0 +1,300 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef INSTANCED\n\ +attribute vec2 direction;\n\ +#endif\n\ +attribute vec4 positionHighAndScale;\n\ +attribute vec4 positionLowAndRotation;\n\ +attribute vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)\n\ +attribute vec4 compressedAttribute1; // aligned axis, translucency by distance, image width\n\ +attribute vec4 compressedAttribute2; // image height, color, pick color, size in meters, valid aligned axis, 13 bits free\n\ +attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)\n\ +attribute vec4 scaleByDistance; // near, nearScale, far, farScale\n\ +attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale\n\ +attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance\n\ +#ifdef VECTOR_TILE\n\ +attribute float a_batchId;\n\ +#endif\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ +varying vec4 v_pickColor;\n\ +#else\n\ +varying vec4 v_color;\n\ +#endif\n\ +\n\ +const float UPPER_BOUND = 32768.0;\n\ +\n\ +const float SHIFT_LEFT16 = 65536.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_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)\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 * czm_resolutionScale * 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_modelViewProjection * 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\ + mat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\ + halfSize = rotationMatrix * halfSize;\n\ + }\n\ +#endif\n\ +\n\ + if (sizeInMeters)\n\ + {\n\ + positionEC.xy += halfSize;\n\ + }\n\ +\n\ + float mpp = czm_metersPerPixel(positionEC);\n\ +\n\ + if (!sizeInMeters)\n\ + {\n\ + originTranslate *= mpp;\n\ + }\n\ +\n\ + positionEC.xy += originTranslate;\n\ + if (!sizeInMeters)\n\ + {\n\ + positionEC.xy += halfSize * mpp;\n\ + }\n\ +\n\ + positionEC.xy += translate * mpp;\n\ + positionEC.xy += (pixelOffset * czm_resolutionScale) * mpp;\n\ +\n\ + return positionEC;\n\ +}\n\ +\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\ +#ifdef INSTANCED\n\ + vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\n\ + vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\n\ + vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n\ +#else\n\ + vec2 direction;\n\ + direction.x = floor(compressed * SHIFT_RIGHT1);\n\ + direction.y = compressed - direction.x * SHIFT_LEFT1;\n\ +\n\ + vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n\ +#endif\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\ +\n\ + translate.y += (temp - floor(temp)) * SHIFT_LEFT8;\n\ + translate.y -= UPPER_BOUND;\n\ +\n\ + temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\ +\n\ + vec2 imageSize = vec2(floor(temp), compressedAttribute2.w);\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 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\ +#ifdef RENDER_FOR_PICK\n\ + temp = compressedAttribute2.y;\n\ +#else\n\ + temp = compressedAttribute2.x;\n\ +#endif\n\ +\n\ + vec4 color;\n\ + temp = temp * SHIFT_RIGHT8;\n\ + color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + temp = floor(temp) * SHIFT_RIGHT8;\n\ + color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + color.r = floor(temp);\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\ +#ifdef RENDER_FOR_PICK\n\ + color.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + vec4 pickColor = color / 255.0;\n\ +#else\n\ + color.a = floor(temp);\n\ + color /= 255.0;\n\ +#endif\n\ +\n\ + ///////////////////////////////////////////////////////////////////////////\n\ +\n\ + vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ + vec4 positionEC = czm_modelViewRelativeToEye * p;\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 = distanceDisplayConditionAndDisableDepth.x;\n\ + float farSq = distanceDisplayConditionAndDisableDepth.y;\n\ + if (lengthSq < nearSq || lengthSq > farSq)\n\ + {\n\ + positionEC.xyz = vec3(0.0);\n\ + }\n\ +#endif\n\ +\n\ + positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters);\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\ + float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\n\ + if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n\ + {\n\ + disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n\ + }\n\ +\n\ + if (disableDepthTestDistance != 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\ + if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n\ + {\n\ + // Position z on the near plane.\n\ + gl_Position.z = -gl_Position.w;\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(vec4(czm_currentFrustum.x));\n\ +#endif\n\ + }\n\ + }\n\ +#endif\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ + v_pickColor = pickColor;\n\ +#else\n\ + v_color = color;\n\ + v_color.a *= translucency;\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/BrdfLutGeneratorFS.js b/Source/Shaders/BrdfLutGeneratorFS.js new file mode 100644 index 000000000000..ffca72ca3b56 --- /dev/null +++ b/Source/Shaders/BrdfLutGeneratorFS.js @@ -0,0 +1,88 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying 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 roughness, vec3 N)\n\ +{\n\ + float a = roughness * roughness;\n\ + float phi = 2.0 * M_PI * xi.x;\n\ + float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 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\ +float G1_Smith(float NdotV, float k)\n\ +{\n\ + return NdotV / (NdotV * (1.0 - k) + k);\n\ +}\n\ +\n\ +float G_Smith(float roughness, float NdotV, float NdotL)\n\ +{\n\ + float k = roughness * roughness / 2.0;\n\ + return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\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\ + for (int i = 0; i < NumSamples; i++)\n\ + {\n\ + vec2 xi = hammersley2D(i, NumSamples);\n\ + vec3 H = importanceSampleGGX(xi, roughness, 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 = G_Smith(roughness, NdotV, NdotL);\n\ + float G_Vis = G * VdotH / (NdotH * NdotV);\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\ + gl_FragColor = vec4(integrateBrdf(1.0 - v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/degreesPerRadian.js b/Source/Shaders/Builtin/Constants/degreesPerRadian.js new file mode 100644 index 000000000000..3a275ee36fb6 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/degreesPerRadian.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/depthRange.js b/Source/Shaders/Builtin/Constants/depthRange.js new file mode 100644 index 000000000000..aca19b64c06d --- /dev/null +++ b/Source/Shaders/Builtin/Constants/depthRange.js @@ -0,0 +1,19 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon1.js b/Source/Shaders/Builtin/Constants/epsilon1.js new file mode 100644 index 000000000000..83514cd690e0 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon1.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.1\n\ + *\n\ + * @name czm_epsilon1\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon1 = 0.1;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon2.js b/Source/Shaders/Builtin/Constants/epsilon2.js new file mode 100644 index 000000000000..1d36f65d4435 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon2.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.01\n\ + *\n\ + * @name czm_epsilon2\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon2 = 0.01;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon3.js b/Source/Shaders/Builtin/Constants/epsilon3.js new file mode 100644 index 000000000000..b66b4fc823d3 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon3.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.001\n\ + *\n\ + * @name czm_epsilon3\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon3 = 0.001;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon4.js b/Source/Shaders/Builtin/Constants/epsilon4.js new file mode 100644 index 000000000000..c9a76b0abc8a --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon4.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.0001\n\ + *\n\ + * @name czm_epsilon4\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon4 = 0.0001;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon5.js b/Source/Shaders/Builtin/Constants/epsilon5.js new file mode 100644 index 000000000000..524949407185 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon5.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.00001\n\ + *\n\ + * @name czm_epsilon5\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon5 = 0.00001;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon6.js b/Source/Shaders/Builtin/Constants/epsilon6.js new file mode 100644 index 000000000000..b7f428922f25 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon6.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.000001\n\ + *\n\ + * @name czm_epsilon6\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon6 = 0.000001;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon7.js b/Source/Shaders/Builtin/Constants/epsilon7.js new file mode 100644 index 000000000000..eafdca498b4e --- /dev/null +++ b/Source/Shaders/Builtin/Constants/epsilon7.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * 0.0000001\n\ + *\n\ + * @name czm_epsilon7\n\ + * @glslConstant\n\ + */\n\ +const float czm_epsilon7 = 0.0000001;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/infinity.js b/Source/Shaders/Builtin/Constants/infinity.js new file mode 100644 index 000000000000..aa9d30ffa6cd --- /dev/null +++ b/Source/Shaders/Builtin/Constants/infinity.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/oneOverPi.js b/Source/Shaders/Builtin/Constants/oneOverPi.js new file mode 100644 index 000000000000..65d851ee5fe0 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/oneOverPi.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for 1/pi.\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/oneOverTwoPi.js b/Source/Shaders/Builtin/Constants/oneOverTwoPi.js new file mode 100644 index 000000000000..0405893e1412 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/oneOverTwoPi.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for 1/2pi.\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTile.js b/Source/Shaders/Builtin/Constants/passCesium3DTile.js new file mode 100644 index 000000000000..715da956a11b --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passCesium3DTile.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 4.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js b/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js new file mode 100644 index 000000000000..41c185f1fe9e --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 5.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js b/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js new file mode 100644 index 000000000000..4df0f96b600d --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 6.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passClassification.js b/Source/Shaders/Builtin/Constants/passClassification.js new file mode 100644 index 000000000000..d1ccc45a672b --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passClassification.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 7.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCompute.js b/Source/Shaders/Builtin/Constants/passCompute.js new file mode 100644 index 000000000000..65177473c262 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passCompute.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passEnvironment.js b/Source/Shaders/Builtin/Constants/passEnvironment.js new file mode 100644 index 000000000000..c13e7994046b --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passEnvironment.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passGlobe.js b/Source/Shaders/Builtin/Constants/passGlobe.js new file mode 100644 index 000000000000..b0c299a4119d --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passGlobe.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passOpaque.js b/Source/Shaders/Builtin/Constants/passOpaque.js new file mode 100644 index 000000000000..3c2c0dfae71b --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passOpaque.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 8.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passOverlay.js b/Source/Shaders/Builtin/Constants/passOverlay.js new file mode 100644 index 000000000000..71a008aa7238 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passOverlay.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\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 = 10.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passTerrainClassification.js b/Source/Shaders/Builtin/Constants/passTerrainClassification.js new file mode 100644 index 000000000000..23c735543deb --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passTerrainClassification.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}\n\ + *\n\ + * @name czm_passTerrainClassification\n\ + * @glslConstant\n\ + *\n\ + * @see czm_pass\n\ + */\n\ +const float czm_passTerrainClassification = 3.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passTranslucent.js b/Source/Shaders/Builtin/Constants/passTranslucent.js new file mode 100644 index 000000000000..0abe9c91f755 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/passTranslucent.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The automatic GLSL constant for {@link Pass#TRANSLUCENT}\n\ + *\n\ + * @name czm_passTranslucent\n\ + * @glslConstant\n\ + *\n\ + * @see czm_pass\n\ + */\n\ +const float czm_passTranslucent = 9.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/pi.js b/Source/Shaders/Builtin/Constants/pi.js new file mode 100644 index 000000000000..0a730beeb9e1 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/pi.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for Math.PI.\n\ + *\n\ + * @alias czm_pi\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.PI\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_pi = ...;\n\ + *\n\ + * // Example\n\ + * float twoPi = 2.0 * czm_pi;\n\ + */\n\ +const float czm_pi = 3.141592653589793;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverFour.js b/Source/Shaders/Builtin/Constants/piOverFour.js new file mode 100644 index 000000000000..db963cc280cd --- /dev/null +++ b/Source/Shaders/Builtin/Constants/piOverFour.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for pi/4.\n\ + *\n\ + * @alias czm_piOverFour\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.PI_OVER_FOUR\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_piOverFour = ...;\n\ + *\n\ + * // Example\n\ + * float pi = 4.0 * czm_piOverFour;\n\ + */\n\ +const float czm_piOverFour = 0.7853981633974483;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverSix.js b/Source/Shaders/Builtin/Constants/piOverSix.js new file mode 100644 index 000000000000..47b02c158640 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/piOverSix.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for pi/6.\n\ + *\n\ + * @alias czm_piOverSix\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.PI_OVER_SIX\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_piOverSix = ...;\n\ + *\n\ + * // Example\n\ + * float pi = 6.0 * czm_piOverSix;\n\ + */\n\ +const float czm_piOverSix = 0.5235987755982988;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverThree.js b/Source/Shaders/Builtin/Constants/piOverThree.js new file mode 100644 index 000000000000..fcaff7407aa9 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/piOverThree.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for pi/3.\n\ + *\n\ + * @alias czm_piOverThree\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.PI_OVER_THREE\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_piOverThree = ...;\n\ + *\n\ + * // Example\n\ + * float pi = 3.0 * czm_piOverThree;\n\ + */\n\ +const float czm_piOverThree = 1.0471975511965976;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverTwo.js b/Source/Shaders/Builtin/Constants/piOverTwo.js new file mode 100644 index 000000000000..f00ade7a2514 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/piOverTwo.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for pi/2.\n\ + *\n\ + * @alias czm_piOverTwo\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.PI_OVER_TWO\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_piOverTwo = ...;\n\ + *\n\ + * // Example\n\ + * float pi = 2.0 * czm_piOverTwo;\n\ + */\n\ +const float czm_piOverTwo = 1.5707963267948966;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/radiansPerDegree.js b/Source/Shaders/Builtin/Constants/radiansPerDegree.js new file mode 100644 index 000000000000..76c1f11dbc29 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/radiansPerDegree.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for converting degrees to radians.\n\ + *\n\ + * @alias czm_radiansPerDegree\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.RADIANS_PER_DEGREE\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_radiansPerDegree = ...;\n\ + *\n\ + * // Example\n\ + * float rad = czm_radiansPerDegree * deg;\n\ + */\n\ +const float czm_radiansPerDegree = 0.017453292519943295;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneMode2D.js b/Source/Shaders/Builtin/Constants/sceneMode2D.js new file mode 100644 index 000000000000..d3354deeabdc --- /dev/null +++ b/Source/Shaders/Builtin/Constants/sceneMode2D.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The constant identifier for the 2D {@link SceneMode}\n\ + *\n\ + * @name czm_sceneMode2D\n\ + * @glslConstant\n\ + * @see czm_sceneMode\n\ + * @see czm_sceneModeColumbusView\n\ + * @see czm_sceneMode3D\n\ + * @see czm_sceneModeMorphing\n\ + */\n\ +const float czm_sceneMode2D = 2.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneMode3D.js b/Source/Shaders/Builtin/Constants/sceneMode3D.js new file mode 100644 index 000000000000..7e6e4c9b56c5 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/sceneMode3D.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The constant identifier for the 3D {@link SceneMode}\n\ + *\n\ + * @name czm_sceneMode3D\n\ + * @glslConstant\n\ + * @see czm_sceneMode\n\ + * @see czm_sceneMode2D\n\ + * @see czm_sceneModeColumbusView\n\ + * @see czm_sceneModeMorphing\n\ + */\n\ +const float czm_sceneMode3D = 3.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js b/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js new file mode 100644 index 000000000000..6f883f698ada --- /dev/null +++ b/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The constant identifier for the Columbus View {@link SceneMode}\n\ + *\n\ + * @name czm_sceneModeColumbusView\n\ + * @glslConstant\n\ + * @see czm_sceneMode\n\ + * @see czm_sceneMode2D\n\ + * @see czm_sceneMode3D\n\ + * @see czm_sceneModeMorphing\n\ + */\n\ +const float czm_sceneModeColumbusView = 1.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneModeMorphing.js b/Source/Shaders/Builtin/Constants/sceneModeMorphing.js new file mode 100644 index 000000000000..36e3b42adcb2 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/sceneModeMorphing.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The constant identifier for the Morphing {@link SceneMode}\n\ + *\n\ + * @name czm_sceneModeMorphing\n\ + * @glslConstant\n\ + * @see czm_sceneMode\n\ + * @see czm_sceneMode2D\n\ + * @see czm_sceneModeColumbusView\n\ + * @see czm_sceneMode3D\n\ + */\n\ +const float czm_sceneModeMorphing = 0.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/solarRadius.js b/Source/Shaders/Builtin/Constants/solarRadius.js new file mode 100644 index 000000000000..0f088e439fbe --- /dev/null +++ b/Source/Shaders/Builtin/Constants/solarRadius.js @@ -0,0 +1,18 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for one solar radius.\n\ + *\n\ + * @alias czm_solarRadius\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.SOLAR_RADIUS\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_solarRadius = ...;\n\ + */\n\ +const float czm_solarRadius = 695500000.0;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/threePiOver2.js b/Source/Shaders/Builtin/Constants/threePiOver2.js new file mode 100644 index 000000000000..b4f3d1a99c70 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/threePiOver2.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for 3pi/2.\n\ + *\n\ + * @alias czm_threePiOver2\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.THREE_PI_OVER_TWO\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_threePiOver2 = ...;\n\ + *\n\ + * // Example\n\ + * float pi = (2.0 / 3.0) * czm_threePiOver2;\n\ + */\n\ +const float czm_threePiOver2 = 4.71238898038469;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/twoPi.js b/Source/Shaders/Builtin/Constants/twoPi.js new file mode 100644 index 000000000000..2df24bbdac9d --- /dev/null +++ b/Source/Shaders/Builtin/Constants/twoPi.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * A built-in GLSL floating-point constant for 2pi.\n\ + *\n\ + * @alias czm_twoPi\n\ + * @glslConstant\n\ + *\n\ + * @see CesiumMath.TWO_PI\n\ + *\n\ + * @example\n\ + * // GLSL declaration\n\ + * const float czm_twoPi = ...;\n\ + *\n\ + * // Example\n\ + * float pi = czm_twoPi / 2.0;\n\ + */\n\ +const float czm_twoPi = 6.283185307179586;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js b/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js new file mode 100644 index 000000000000..696adeb08257 --- /dev/null +++ b/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * The maximum latitude, in radians, both North and South, supported by a Web Mercator\n\ + * (EPSG:3857) projection. Technically, the Mercator projection is defined\n\ + * for any latitude up to (but not including) 90 degrees, but it makes sense\n\ + * to cut it off sooner because it grows exponentially with increasing latitude.\n\ + * The logic behind this particular cutoff value, which is the one used by\n\ + * Google Maps, Bing Maps, and Esri, is that it makes the projection\n\ + * square. That is, the rectangle is equal in the X and Y directions.\n\ + *\n\ + * The constant value is computed as follows:\n\ + * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))\n\ + *\n\ + * @name czm_webMercatorMaxLatitude\n\ + * @glslConstant\n\ + */\n\ +const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/CzmBuiltins.js b/Source/Shaders/Builtin/CzmBuiltins.js new file mode 100644 index 000000000000..98aa0af7f056 --- /dev/null +++ b/Source/Shaders/Builtin/CzmBuiltins.js @@ -0,0 +1,321 @@ +//This file is automatically rebuilt by the Cesium build process. +define([ + './Constants/degreesPerRadian', + './Constants/depthRange', + './Constants/epsilon1', + './Constants/epsilon2', + './Constants/epsilon3', + './Constants/epsilon4', + './Constants/epsilon5', + './Constants/epsilon6', + './Constants/epsilon7', + './Constants/infinity', + './Constants/oneOverPi', + './Constants/oneOverTwoPi', + './Constants/passCesium3DTile', + './Constants/passCesium3DTileClassification', + './Constants/passCesium3DTileClassificationIgnoreShow', + './Constants/passClassification', + './Constants/passCompute', + './Constants/passEnvironment', + './Constants/passGlobe', + './Constants/passOpaque', + './Constants/passOverlay', + './Constants/passTerrainClassification', + './Constants/passTranslucent', + './Constants/pi', + './Constants/piOverFour', + './Constants/piOverSix', + './Constants/piOverThree', + './Constants/piOverTwo', + './Constants/radiansPerDegree', + './Constants/sceneMode2D', + './Constants/sceneMode3D', + './Constants/sceneModeColumbusView', + './Constants/sceneModeMorphing', + './Constants/solarRadius', + './Constants/threePiOver2', + './Constants/twoPi', + './Constants/webMercatorMaxLatitude', + './Structs/depthRangeStruct', + './Structs/ellipsoid', + './Structs/material', + './Structs/materialInput', + './Structs/ray', + './Structs/raySegment', + './Structs/shadowParameters', + './Functions/alphaWeight', + './Functions/antialias', + './Functions/cascadeColor', + './Functions/cascadeDistance', + './Functions/cascadeMatrix', + './Functions/cascadeWeights', + './Functions/columbusViewMorph', + './Functions/computePosition', + './Functions/cosineAndSine', + './Functions/decompressTextureCoordinates', + './Functions/depthClampFarPlane', + './Functions/eastNorthUpToEyeCoordinates', + './Functions/ellipsoidContainsPoint', + './Functions/ellipsoidNew', + './Functions/ellipsoidWgs84TextureCoordinates', + './Functions/equalsEpsilon', + './Functions/eyeOffset', + './Functions/eyeToWindowCoordinates', + './Functions/fog', + './Functions/geodeticSurfaceNormal', + './Functions/getDefaultMaterial', + './Functions/getLambertDiffuse', + './Functions/getSpecular', + './Functions/getWaterNoise', + './Functions/getWgs84EllipsoidEC', + './Functions/HSBToRGB', + './Functions/HSLToRGB', + './Functions/hue', + './Functions/isEmpty', + './Functions/isFull', + './Functions/latitudeToWebMercatorFraction', + './Functions/luminance', + './Functions/metersPerPixel', + './Functions/modelToWindowCoordinates', + './Functions/multiplyWithColorBalance', + './Functions/nearFarScalar', + './Functions/octDecode', + './Functions/packDepth', + './Functions/phong', + './Functions/pointAlongRay', + './Functions/rayEllipsoidIntersectionInterval', + './Functions/reverseLogDepth', + './Functions/RGBToHSB', + './Functions/RGBToHSL', + './Functions/RGBToXYZ', + './Functions/saturation', + './Functions/shadowDepthCompare', + './Functions/shadowVisibility', + './Functions/signNotZero', + './Functions/tangentToEyeSpaceMatrix', + './Functions/transformPlane', + './Functions/translateRelativeToEye', + './Functions/translucentPhong', + './Functions/transpose', + './Functions/unpackDepth', + './Functions/unpackFloat', + './Functions/vertexLogDepth', + './Functions/windowToEyeCoordinates', + './Functions/writeDepthClampedToFarPlane', + './Functions/writeLogDepth', + './Functions/XYZToRGB' + ], function( + czm_degreesPerRadian, + czm_depthRange, + czm_epsilon1, + czm_epsilon2, + czm_epsilon3, + czm_epsilon4, + czm_epsilon5, + czm_epsilon6, + czm_epsilon7, + czm_infinity, + czm_oneOverPi, + czm_oneOverTwoPi, + czm_passCesium3DTile, + czm_passCesium3DTileClassification, + czm_passCesium3DTileClassificationIgnoreShow, + czm_passClassification, + czm_passCompute, + czm_passEnvironment, + czm_passGlobe, + czm_passOpaque, + czm_passOverlay, + czm_passTerrainClassification, + czm_passTranslucent, + czm_pi, + czm_piOverFour, + czm_piOverSix, + czm_piOverThree, + czm_piOverTwo, + czm_radiansPerDegree, + czm_sceneMode2D, + czm_sceneMode3D, + czm_sceneModeColumbusView, + czm_sceneModeMorphing, + czm_solarRadius, + czm_threePiOver2, + czm_twoPi, + czm_webMercatorMaxLatitude, + czm_depthRangeStruct, + czm_ellipsoid, + czm_material, + czm_materialInput, + czm_ray, + czm_raySegment, + czm_shadowParameters, + czm_alphaWeight, + czm_antialias, + czm_cascadeColor, + czm_cascadeDistance, + czm_cascadeMatrix, + czm_cascadeWeights, + czm_columbusViewMorph, + czm_computePosition, + czm_cosineAndSine, + czm_decompressTextureCoordinates, + czm_depthClampFarPlane, + czm_eastNorthUpToEyeCoordinates, + czm_ellipsoidContainsPoint, + czm_ellipsoidNew, + czm_ellipsoidWgs84TextureCoordinates, + czm_equalsEpsilon, + czm_eyeOffset, + czm_eyeToWindowCoordinates, + czm_fog, + czm_geodeticSurfaceNormal, + czm_getDefaultMaterial, + czm_getLambertDiffuse, + czm_getSpecular, + czm_getWaterNoise, + czm_getWgs84EllipsoidEC, + czm_HSBToRGB, + czm_HSLToRGB, + czm_hue, + czm_isEmpty, + czm_isFull, + czm_latitudeToWebMercatorFraction, + czm_luminance, + czm_metersPerPixel, + czm_modelToWindowCoordinates, + czm_multiplyWithColorBalance, + czm_nearFarScalar, + czm_octDecode, + czm_packDepth, + czm_phong, + czm_pointAlongRay, + czm_rayEllipsoidIntersectionInterval, + czm_reverseLogDepth, + czm_RGBToHSB, + czm_RGBToHSL, + czm_RGBToXYZ, + czm_saturation, + czm_shadowDepthCompare, + czm_shadowVisibility, + czm_signNotZero, + czm_tangentToEyeSpaceMatrix, + czm_transformPlane, + czm_translateRelativeToEye, + czm_translucentPhong, + czm_transpose, + czm_unpackDepth, + czm_unpackFloat, + czm_vertexLogDepth, + czm_windowToEyeCoordinates, + czm_writeDepthClampedToFarPlane, + czm_writeLogDepth, + czm_XYZToRGB) { + 'use strict'; + return { + czm_degreesPerRadian : czm_degreesPerRadian, + czm_depthRange : czm_depthRange, + czm_epsilon1 : czm_epsilon1, + czm_epsilon2 : czm_epsilon2, + czm_epsilon3 : czm_epsilon3, + czm_epsilon4 : czm_epsilon4, + czm_epsilon5 : czm_epsilon5, + czm_epsilon6 : czm_epsilon6, + czm_epsilon7 : czm_epsilon7, + czm_infinity : czm_infinity, + czm_oneOverPi : czm_oneOverPi, + czm_oneOverTwoPi : czm_oneOverTwoPi, + czm_passCesium3DTile : czm_passCesium3DTile, + czm_passCesium3DTileClassification : czm_passCesium3DTileClassification, + czm_passCesium3DTileClassificationIgnoreShow : czm_passCesium3DTileClassificationIgnoreShow, + czm_passClassification : czm_passClassification, + czm_passCompute : czm_passCompute, + czm_passEnvironment : czm_passEnvironment, + czm_passGlobe : czm_passGlobe, + czm_passOpaque : czm_passOpaque, + czm_passOverlay : czm_passOverlay, + czm_passTerrainClassification : czm_passTerrainClassification, + czm_passTranslucent : czm_passTranslucent, + czm_pi : czm_pi, + czm_piOverFour : czm_piOverFour, + czm_piOverSix : czm_piOverSix, + czm_piOverThree : czm_piOverThree, + czm_piOverTwo : czm_piOverTwo, + czm_radiansPerDegree : czm_radiansPerDegree, + czm_sceneMode2D : czm_sceneMode2D, + czm_sceneMode3D : czm_sceneMode3D, + czm_sceneModeColumbusView : czm_sceneModeColumbusView, + czm_sceneModeMorphing : czm_sceneModeMorphing, + czm_solarRadius : czm_solarRadius, + czm_threePiOver2 : czm_threePiOver2, + czm_twoPi : czm_twoPi, + czm_webMercatorMaxLatitude : czm_webMercatorMaxLatitude, + czm_depthRangeStruct : czm_depthRangeStruct, + czm_ellipsoid : czm_ellipsoid, + czm_material : czm_material, + czm_materialInput : czm_materialInput, + czm_ray : czm_ray, + czm_raySegment : czm_raySegment, + czm_shadowParameters : czm_shadowParameters, + czm_alphaWeight : czm_alphaWeight, + czm_antialias : czm_antialias, + czm_cascadeColor : czm_cascadeColor, + czm_cascadeDistance : czm_cascadeDistance, + czm_cascadeMatrix : czm_cascadeMatrix, + czm_cascadeWeights : czm_cascadeWeights, + czm_columbusViewMorph : czm_columbusViewMorph, + czm_computePosition : czm_computePosition, + czm_cosineAndSine : czm_cosineAndSine, + czm_decompressTextureCoordinates : czm_decompressTextureCoordinates, + czm_depthClampFarPlane : czm_depthClampFarPlane, + czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates, + czm_ellipsoidContainsPoint : czm_ellipsoidContainsPoint, + czm_ellipsoidNew : czm_ellipsoidNew, + czm_ellipsoidWgs84TextureCoordinates : czm_ellipsoidWgs84TextureCoordinates, + czm_equalsEpsilon : czm_equalsEpsilon, + czm_eyeOffset : czm_eyeOffset, + czm_eyeToWindowCoordinates : czm_eyeToWindowCoordinates, + czm_fog : czm_fog, + czm_geodeticSurfaceNormal : czm_geodeticSurfaceNormal, + czm_getDefaultMaterial : czm_getDefaultMaterial, + czm_getLambertDiffuse : czm_getLambertDiffuse, + czm_getSpecular : czm_getSpecular, + czm_getWaterNoise : czm_getWaterNoise, + czm_getWgs84EllipsoidEC : czm_getWgs84EllipsoidEC, + czm_HSBToRGB : czm_HSBToRGB, + czm_HSLToRGB : czm_HSLToRGB, + czm_hue : czm_hue, + czm_isEmpty : czm_isEmpty, + czm_isFull : czm_isFull, + czm_latitudeToWebMercatorFraction : czm_latitudeToWebMercatorFraction, + czm_luminance : czm_luminance, + czm_metersPerPixel : czm_metersPerPixel, + czm_modelToWindowCoordinates : czm_modelToWindowCoordinates, + czm_multiplyWithColorBalance : czm_multiplyWithColorBalance, + czm_nearFarScalar : czm_nearFarScalar, + czm_octDecode : czm_octDecode, + czm_packDepth : czm_packDepth, + czm_phong : czm_phong, + czm_pointAlongRay : czm_pointAlongRay, + czm_rayEllipsoidIntersectionInterval : czm_rayEllipsoidIntersectionInterval, + czm_reverseLogDepth : czm_reverseLogDepth, + czm_RGBToHSB : czm_RGBToHSB, + czm_RGBToHSL : czm_RGBToHSL, + czm_RGBToXYZ : czm_RGBToXYZ, + czm_saturation : czm_saturation, + czm_shadowDepthCompare : czm_shadowDepthCompare, + czm_shadowVisibility : czm_shadowVisibility, + czm_signNotZero : czm_signNotZero, + czm_tangentToEyeSpaceMatrix : czm_tangentToEyeSpaceMatrix, + czm_transformPlane : czm_transformPlane, + czm_translateRelativeToEye : czm_translateRelativeToEye, + czm_translucentPhong : czm_translucentPhong, + czm_transpose : czm_transpose, + czm_unpackDepth : czm_unpackDepth, + czm_unpackFloat : czm_unpackFloat, + czm_vertexLogDepth : czm_vertexLogDepth, + czm_windowToEyeCoordinates : czm_windowToEyeCoordinates, + czm_writeDepthClampedToFarPlane : czm_writeDepthClampedToFarPlane, + czm_writeLogDepth : czm_writeLogDepth, + czm_XYZToRGB : czm_XYZToRGB}; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/HSBToRGB.js b/Source/Shaders/Builtin/Functions/HSBToRGB.js new file mode 100644 index 000000000000..f6abd4b98f45 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/HSBToRGB.js @@ -0,0 +1,29 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts an HSB color (hue, saturation, brightness) to RGB\n\ + * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n\ + *\n\ + * @name czm_HSBToRGB\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} hsb The color in HSB.\n\ + *\n\ + * @returns {vec3} The color in RGB.\n\ + *\n\ + * @example\n\ + * vec3 hsb = czm_RGBToHSB(rgb);\n\ + * hsb.z *= 0.1;\n\ + * rgb = czm_HSBToRGB(hsb);\n\ + */\n\ +\n\ +const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\ +\n\ +vec3 czm_HSBToRGB(vec3 hsb)\n\ +{\n\ + vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\n\ + return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/HSLToRGB.js b/Source/Shaders/Builtin/Functions/HSLToRGB.js new file mode 100644 index 000000000000..3d4894538ac5 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/HSLToRGB.js @@ -0,0 +1,36 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts an HSL color (hue, saturation, lightness) to RGB\n\ + * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n\ + *\n\ + * @name czm_HSLToRGB\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color in HSL.\n\ + *\n\ + * @returns {vec3} The color in RGB.\n\ + *\n\ + * @example\n\ + * vec3 hsl = czm_RGBToHSL(rgb);\n\ + * hsl.z *= 0.1;\n\ + * rgb = czm_HSLToRGB(hsl);\n\ + */\n\ +\n\ +vec3 hueToRGB(float hue)\n\ +{\n\ + float r = abs(hue * 6.0 - 3.0) - 1.0;\n\ + float g = 2.0 - abs(hue * 6.0 - 2.0);\n\ + float b = 2.0 - abs(hue * 6.0 - 4.0);\n\ + return clamp(vec3(r, g, b), 0.0, 1.0);\n\ +}\n\ +\n\ +vec3 czm_HSLToRGB(vec3 hsl)\n\ +{\n\ + vec3 rgb = hueToRGB(hsl.x);\n\ + float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\n\ + return (rgb - 0.5) * c + hsl.z;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToHSB.js b/Source/Shaders/Builtin/Functions/RGBToHSB.js new file mode 100644 index 000000000000..b7a093ce0fe0 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/RGBToHSB.js @@ -0,0 +1,32 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts an RGB color to HSB (hue, saturation, brightness)\n\ + * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n\ + *\n\ + * @name czm_RGBToHSB\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color in RGB.\n\ + *\n\ + * @returns {vec3} The color in HSB.\n\ + *\n\ + * @example\n\ + * vec3 hsb = czm_RGBToHSB(rgb);\n\ + * hsb.z *= 0.1;\n\ + * rgb = czm_HSBToRGB(hsb);\n\ + */\n\ +\n\ +const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\ +\n\ +vec3 czm_RGBToHSB(vec3 rgb)\n\ +{\n\ + vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\n\ + vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\ +\n\ + float d = q.x - min(q.w, q.y);\n\ + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToHSL.js b/Source/Shaders/Builtin/Functions/RGBToHSL.js new file mode 100644 index 000000000000..f9ed6802de20 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/RGBToHSL.js @@ -0,0 +1,39 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts an RGB color to HSL (hue, saturation, lightness)\n\ + * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n\ + *\n\ + * @name czm_RGBToHSL\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color in RGB.\n\ + *\n\ + * @returns {vec3} The color in HSL.\n\ + *\n\ + * @example\n\ + * vec3 hsl = czm_RGBToHSL(rgb);\n\ + * hsl.z *= 0.1;\n\ + * rgb = czm_HSLToRGB(hsl);\n\ + */\n\ + \n\ +vec3 RGBtoHCV(vec3 rgb)\n\ +{\n\ + // Based on work by Sam Hocevar and Emil Persson\n\ + vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\n\ + vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n\ + float c = q.x - min(q.w, q.y);\n\ + float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\n\ + return vec3(h, c, q.x);\n\ +}\n\ +\n\ +vec3 czm_RGBToHSL(vec3 rgb)\n\ +{\n\ + vec3 hcv = RGBtoHCV(rgb);\n\ + float l = hcv.z - hcv.y * 0.5;\n\ + float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\n\ + return vec3(hcv.x, s, l);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToXYZ.js b/Source/Shaders/Builtin/Functions/RGBToXYZ.js new file mode 100644 index 000000000000..8851d71a53e2 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/RGBToXYZ.js @@ -0,0 +1,35 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts an RGB color to CIE Yxy.\n\ + *

The conversion is described in\n\ + * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n\ + *

\n\ + * \n\ + * @name czm_RGBToXYZ\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color in RGB.\n\ + *\n\ + * @returns {vec3} The color in CIE Yxy.\n\ + *\n\ + * @example\n\ + * vec3 xyz = czm_RGBToXYZ(rgb);\n\ + * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n\ + * rgb = czm_XYZToRGB(xyz);\n\ + */\n\ +vec3 czm_RGBToXYZ(vec3 rgb)\n\ +{\n\ + const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n\ + 0.3576, 0.7152, 0.1192,\n\ + 0.1805, 0.0722, 0.9505);\n\ + vec3 xyz = RGB2XYZ * rgb;\n\ + vec3 Yxy;\n\ + Yxy.r = xyz.g;\n\ + float temp = dot(vec3(1.0), xyz);\n\ + Yxy.gb = xyz.rg / temp;\n\ + return Yxy;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/XYZToRGB.js b/Source/Shaders/Builtin/Functions/XYZToRGB.js new file mode 100644 index 000000000000..c517ee6ae5de --- /dev/null +++ b/Source/Shaders/Builtin/Functions/XYZToRGB.js @@ -0,0 +1,35 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Converts a CIE Yxy color to RGB.\n\ + *

The conversion is described in\n\ + * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n\ + *

\n\ + * \n\ + * @name czm_XYZToRGB\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} Yxy The color in CIE Yxy.\n\ + *\n\ + * @returns {vec3} The color in RGB.\n\ + *\n\ + * @example\n\ + * vec3 xyz = czm_RGBToXYZ(rgb);\n\ + * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n\ + * rgb = czm_XYZToRGB(xyz);\n\ + */\n\ +vec3 czm_XYZToRGB(vec3 Yxy)\n\ +{\n\ + const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n\ + -1.5371, 1.8760, -0.2040,\n\ + -0.4985, 0.0416, 1.0572);\n\ + vec3 xyz;\n\ + xyz.r = Yxy.r * Yxy.g / Yxy.b;\n\ + xyz.g = Yxy.r;\n\ + xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\n\ + \n\ + return XYZ2RGB * xyz;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/alphaWeight.js b/Source/Shaders/Builtin/Functions/alphaWeight.js new file mode 100644 index 000000000000..5fd325ebe239 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/alphaWeight.js @@ -0,0 +1,37 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @private\n\ + */\n\ +float czm_alphaWeight(float a)\n\ +{\n\ + float x = 2.0 * (gl_FragCoord.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\ + float y = 2.0 * (gl_FragCoord.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\ + float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\ + vec4 q = vec4(x, y, z, 0.0);\n\ + q /= gl_FragCoord.w;\n\ +\n\ + if (czm_inverseProjection != mat4(0.0)) {\n\ + q = czm_inverseProjection * q;\n\ + } else {\n\ + float top = czm_frustumPlanes.x;\n\ + float bottom = czm_frustumPlanes.y;\n\ + float left = czm_frustumPlanes.z;\n\ + float right = czm_frustumPlanes.w;\n\ +\n\ + float near = czm_currentFrustum.x;\n\ + float far = czm_currentFrustum.y;\n\ +\n\ + q.x = (q.x * (right - left) + left + right) * 0.5;\n\ + q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n\ + q.z = (q.z * (near - far) - near - far) * 0.5;\n\ + q.w = 1.0;\n\ + }\n\ +\n\ + // See Weighted Blended Order-Independent Transparency for examples of different weighting functions:\n\ + // http://jcgt.org/published/0002/02/09/ \n\ + return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/antialias.js b/Source/Shaders/Builtin/Functions/antialias.js new file mode 100644 index 000000000000..365e35f02ed1 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/antialias.js @@ -0,0 +1,44 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Procedural anti-aliasing by blurring two colors that meet at a sharp edge.\n\ + *\n\ + * @name czm_antialias\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} color1 The color on one side of the edge.\n\ + * @param {vec4} color2 The color on the other side of the edge.\n\ + * @param {vec4} currentcolor The current color, either color1 or color2.\n\ + * @param {float} dist The distance to the edge in texture coordinates.\n\ + * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.\n\ + * @returns {vec4} The anti-aliased color.\n\ + *\n\ + * @example\n\ + * // GLSL declarations\n\ + * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);\n\ + * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);\n\ + *\n\ + * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space\n\ + * float dist = abs(textureCoordinates.t - 0.5);\n\ + * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));\n\ + * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);\n\ + */\n\ +vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n\ +{\n\ + float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\n\ + float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\n\ + val1 = val1 * (1.0 - val2);\n\ + val1 = val1 * val1 * (3.0 - (2.0 * val1));\n\ + val1 = pow(val1, 0.5); //makes the transition nicer\n\ + \n\ + vec4 midColor = (color1 + color2) * 0.5;\n\ + return mix(midColor, currentColor, val1);\n\ +}\n\ +\n\ +vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n\ +{\n\ + return czm_antialias(color1, color2, currentColor, dist, 0.1);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeColor.js b/Source/Shaders/Builtin/Functions/cascadeColor.js new file mode 100644 index 000000000000..4b5b036d1853 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/cascadeColor.js @@ -0,0 +1,13 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +vec4 czm_cascadeColor(vec4 weights)\n\ +{\n\ + return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\n\ + vec4(0.0, 1.0, 0.0, 1.0) * weights.y +\n\ + vec4(0.0, 0.0, 1.0, 1.0) * weights.z +\n\ + vec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeDistance.js b/Source/Shaders/Builtin/Functions/cascadeDistance.js new file mode 100644 index 000000000000..b2c3985281cc --- /dev/null +++ b/Source/Shaders/Builtin/Functions/cascadeDistance.js @@ -0,0 +1,12 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +uniform vec4 shadowMap_cascadeDistances;\n\ +\n\ +float czm_cascadeDistance(vec4 weights)\n\ +{\n\ + return dot(shadowMap_cascadeDistances, weights);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeMatrix.js b/Source/Shaders/Builtin/Functions/cascadeMatrix.js new file mode 100644 index 000000000000..732e88b1b715 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/cascadeMatrix.js @@ -0,0 +1,15 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +uniform mat4 shadowMap_cascadeMatrices[4];\n\ +\n\ +mat4 czm_cascadeMatrix(vec4 weights)\n\ +{\n\ + return shadowMap_cascadeMatrices[0] * weights.x +\n\ + shadowMap_cascadeMatrices[1] * weights.y +\n\ + shadowMap_cascadeMatrices[2] * weights.z +\n\ + shadowMap_cascadeMatrices[3] * weights.w;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeWeights.js b/Source/Shaders/Builtin/Functions/cascadeWeights.js new file mode 100644 index 000000000000..59cebf458434 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/cascadeWeights.js @@ -0,0 +1,15 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +uniform vec4 shadowMap_cascadeSplits[2];\n\ +\n\ +vec4 czm_cascadeWeights(float depthEye)\n\ +{\n\ + // One component is set to 1.0 and all others set to 0.0.\n\ + vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\n\ + vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\n\ + return near * far;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/columbusViewMorph.js b/Source/Shaders/Builtin/Functions/columbusViewMorph.js new file mode 100644 index 000000000000..7fdfde1311ca --- /dev/null +++ b/Source/Shaders/Builtin/Functions/columbusViewMorph.js @@ -0,0 +1,17 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_columbusViewMorph\n\ + * @glslFunction\n\ + */\n\ +vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n\ +{\n\ + // Just linear for now.\n\ + vec3 p = mix(position2D.xyz, position3D.xyz, time);\n\ + return vec4(p, 1.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/computePosition.js b/Source/Shaders/Builtin/Functions/computePosition.js new file mode 100644 index 000000000000..5d28ef26fd83 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/computePosition.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Returns a position in model coordinates relative to eye taking into\n\ + * account the current scene mode: 3D, 2D, or Columbus view.\n\ + *

\n\ + * This uses standard position attributes, position3DHigh, \n\ + * position3DLow, position2DHigh, and position2DLow, \n\ + * and should be used when writing a vertex shader for an {@link Appearance}.\n\ + *

\n\ + *\n\ + * @name czm_computePosition\n\ + * @glslFunction\n\ + *\n\ + * @returns {vec4} The position relative to eye.\n\ + *\n\ + * @example\n\ + * vec4 p = czm_computePosition();\n\ + * v_positionEC = (czm_modelViewRelativeToEye * p).xyz;\n\ + * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\ + *\n\ + * @see czm_translateRelativeToEye\n\ + */\n\ +vec4 czm_computePosition();\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cosineAndSine.js b/Source/Shaders/Builtin/Functions/cosineAndSine.js new file mode 100644 index 000000000000..b7684f4f45dc --- /dev/null +++ b/Source/Shaders/Builtin/Functions/cosineAndSine.js @@ -0,0 +1,216 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @private\n\ + */\n\ +vec2 cordic(float angle)\n\ +{\n\ +// Scale the vector by the appropriate factor for the 24 iterations to follow.\n\ + vec2 vector = vec2(6.0725293500888267e-1, 0.0);\n\ +// Iteration 1\n\ + float sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + // float factor = sense * 1.0; // 2^-0\n\ + mat2 rotation = mat2(1.0, sense, -sense, 1.0);\n\ + vector = rotation * vector;\n\ + angle -= sense * 7.8539816339744828e-1; // atan(2^-0)\n\ +// Iteration 2\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + float factor = sense * 5.0e-1; // 2^-1\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 4.6364760900080609e-1; // atan(2^-1)\n\ +// Iteration 3\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 2.5e-1; // 2^-2\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 2.4497866312686414e-1; // atan(2^-2)\n\ +// Iteration 4\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.25e-1; // 2^-3\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.2435499454676144e-1; // atan(2^-3)\n\ +// Iteration 5\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 6.25e-2; // 2^-4\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 6.2418809995957350e-2; // atan(2^-4)\n\ +// Iteration 6\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 3.125e-2; // 2^-5\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 3.1239833430268277e-2; // atan(2^-5)\n\ +// Iteration 7\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.5625e-2; // 2^-6\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.5623728620476831e-2; // atan(2^-6)\n\ +// Iteration 8\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 7.8125e-3; // 2^-7\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 7.8123410601011111e-3; // atan(2^-7)\n\ +// Iteration 9\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 3.90625e-3; // 2^-8\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 3.9062301319669718e-3; // atan(2^-8)\n\ +// Iteration 10\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.953125e-3; // 2^-9\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.9531225164788188e-3; // atan(2^-9)\n\ +// Iteration 11\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 9.765625e-4; // 2^-10\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 9.7656218955931946e-4; // atan(2^-10)\n\ +// Iteration 12\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 4.8828125e-4; // 2^-11\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 4.8828121119489829e-4; // atan(2^-11)\n\ +// Iteration 13\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 2.44140625e-4; // 2^-12\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 2.4414062014936177e-4; // atan(2^-12)\n\ +// Iteration 14\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.220703125e-4; // 2^-13\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.2207031189367021e-4; // atan(2^-13)\n\ +// Iteration 15\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 6.103515625e-5; // 2^-14\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 6.1035156174208773e-5; // atan(2^-14)\n\ +// Iteration 16\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 3.0517578125e-5; // 2^-15\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 3.0517578115526096e-5; // atan(2^-15)\n\ +// Iteration 17\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.52587890625e-5; // 2^-16\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.5258789061315762e-5; // atan(2^-16)\n\ +// Iteration 18\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 7.62939453125e-6; // 2^-17\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 7.6293945311019700e-6; // atan(2^-17)\n\ +// Iteration 19\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 3.814697265625e-6; // 2^-18\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 3.8146972656064961e-6; // atan(2^-18)\n\ +// Iteration 20\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.9073486328125e-6; // 2^-19\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 1.9073486328101870e-6; // atan(2^-19)\n\ +// Iteration 21\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 9.5367431640625e-7; // 2^-20\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 9.5367431640596084e-7; // atan(2^-20)\n\ +// Iteration 22\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 4.76837158203125e-7; // 2^-21\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 4.7683715820308884e-7; // atan(2^-21)\n\ +// Iteration 23\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 2.384185791015625e-7; // 2^-22\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ + angle -= sense * 2.3841857910155797e-7; // atan(2^-22)\n\ +// Iteration 24\n\ + sense = (angle < 0.0) ? -1.0 : 1.0;\n\ + factor = sense * 1.1920928955078125e-7; // 2^-23\n\ + rotation[0][1] = factor;\n\ + rotation[1][0] = -factor;\n\ + vector = rotation * vector;\n\ +// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)\n\ +\n\ + return vector;\n\ +}\n\ +\n\ +/**\n\ + * Computes the cosine and sine of the provided angle using the CORDIC algorithm.\n\ + *\n\ + * @name czm_cosineAndSine\n\ + * @glslFunction\n\ + *\n\ + * @param {float} angle The angle in radians.\n\ + *\n\ + * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).\n\ + *\n\ + * @example\n\ + * vec2 v = czm_cosineAndSine(czm_piOverSix);\n\ + * float cosine = v.x;\n\ + * float sine = v.y;\n\ + */\n\ +vec2 czm_cosineAndSine(float angle)\n\ +{\n\ + if (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n\ + {\n\ + if (angle < 0.0)\n\ + {\n\ + return -cordic(angle + czm_pi);\n\ + }\n\ + else\n\ + {\n\ + return -cordic(angle - czm_pi);\n\ + }\n\ + }\n\ + else\n\ + {\n\ + return cordic(angle);\n\ + }\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js b/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js new file mode 100644 index 000000000000..68a620b63bff --- /dev/null +++ b/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js @@ -0,0 +1,22 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Decompresses texture coordinates that were packed into a single float.\n\ + *\n\ + * @name czm_decompressTextureCoordinates\n\ + * @glslFunction\n\ + *\n\ + * @param {float} encoded The compressed texture coordinates.\n\ + * @returns {vec2} The decompressed texture coordinates.\n\ + */\n\ + vec2 czm_decompressTextureCoordinates(float encoded)\n\ + {\n\ + float temp = encoded / 4096.0;\n\ + float xZeroTo4095 = floor(temp);\n\ + float stx = xZeroTo4095 / 4095.0;\n\ + float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\n\ + return vec2(stx, sty);\n\ + }\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/depthClampFarPlane.js b/Source/Shaders/Builtin/Functions/depthClampFarPlane.js new file mode 100644 index 000000000000..8ea115c5cd32 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/depthClampFarPlane.js @@ -0,0 +1,32 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "// emulated noperspective\n\ +#ifndef LOG_DEPTH\n\ +varying float v_WindowZ;\n\ +#endif\n\ +\n\ +/**\n\ + * Clamps a vertex to the far plane.\n\ + *\n\ + * @name czm_depthClampFarPlane\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} coords The vertex in clip coordinates.\n\ + * @returns {vec4} The vertex clipped to the far plane.\n\ + *\n\ + * @example\n\ + * gl_Position = czm_depthClampFarPlane(czm_modelViewProjection * vec4(position, 1.0));\n\ + *\n\ + * @see czm_writeDepthClampedToFarPlane\n\ + */\n\ +vec4 czm_depthClampFarPlane(vec4 coords)\n\ +{\n\ +#ifndef LOG_DEPTH\n\ + v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\n\ + coords.z = min(coords.z, coords.w);\n\ +#endif\n\ + return coords;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js b/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js new file mode 100644 index 000000000000..f61fee5929df --- /dev/null +++ b/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js @@ -0,0 +1,38 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system \n\ + * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the \n\ + * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.\n\ + *

\n\ + * The ellipsoid is assumed to be centered at the model coordinate's origin.\n\ + *\n\ + * @name czm_eastNorthUpToEyeCoordinates\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} positionMC The position on the ellipsoid in model coordinates.\n\ + * @param {vec3} normalEC The normalized ellipsoid surface normal, at positionMC, in eye coordinates.\n\ + *\n\ + * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.\n\ + *\n\ + * @example\n\ + * // Transform a vector defined in the east-north-up coordinate \n\ + * // system, (0, 0, 1) which is the surface normal, to eye \n\ + * // coordinates.\n\ + * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n\ + * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);\n\ + */\n\ +mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n\ +{\n\ + vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates\n\ + vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordiantes\n\ + vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates\n\ +\n\ + return mat3(\n\ + tangentEC.x, tangentEC.y, tangentEC.z,\n\ + bitangentEC.x, bitangentEC.y, bitangentEC.z,\n\ + normalEC.x, normalEC.y, normalEC.z);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js b/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js new file mode 100644 index 000000000000..e4695a6bb683 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js @@ -0,0 +1,17 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_ellipsoidContainsPoint\n\ + * @glslFunction\n\ + *\n\ + */\n\ +bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)\n\ +{\n\ + vec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n\ + return (dot(scaled, scaled) <= 1.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidNew.js b/Source/Shaders/Builtin/Functions/ellipsoidNew.js new file mode 100644 index 000000000000..f7e2763ea173 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/ellipsoidNew.js @@ -0,0 +1,19 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_ellipsoidNew\n\ + * @glslFunction\n\ + *\n\ + */\n\ +czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n\ +{\n\ + vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\ + vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\ + czm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\n\ + return temp;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js b/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js new file mode 100644 index 000000000000..2376181535a0 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js @@ -0,0 +1,15 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_ellipsoidWgs84TextureCoordinates\n\ + * @glslFunction\n\ + */\n\ +vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n\ +{\n\ + return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/equalsEpsilon.js b/Source/Shaders/Builtin/Functions/equalsEpsilon.js new file mode 100644 index 000000000000..0054e2bba9b8 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/equalsEpsilon.js @@ -0,0 +1,41 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Compares left and right componentwise. Returns true\n\ + * if they are within epsilon and false otherwise. The inputs\n\ + * left and right can be floats, vec2s,\n\ + * vec3s, or vec4s.\n\ + *\n\ + * @name czm_equalsEpsilon\n\ + * @glslFunction\n\ + *\n\ + * @param {} left The first vector.\n\ + * @param {} right The second vector.\n\ + * @param {float} epsilon The epsilon to use for equality testing.\n\ + * @returns {bool} true if the components are within epsilon and false otherwise.\n\ + *\n\ + * @example\n\ + * // GLSL declarations\n\ + * bool czm_equalsEpsilon(float left, float right, float epsilon);\n\ + * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);\n\ + * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);\n\ + * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);\n\ + */\n\ +bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\n\ + return all(lessThanEqual(abs(left - right), vec4(epsilon)));\n\ +}\n\ +\n\ +bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\n\ + return all(lessThanEqual(abs(left - right), vec3(epsilon)));\n\ +}\n\ +\n\ +bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\n\ + return all(lessThanEqual(abs(left - right), vec2(epsilon)));\n\ +}\n\ +\n\ +bool czm_equalsEpsilon(float left, float right, float epsilon) {\n\ + return (abs(left - right) <= epsilon);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eyeOffset.js b/Source/Shaders/Builtin/Functions/eyeOffset.js new file mode 100644 index 000000000000..659f36a0a14e --- /dev/null +++ b/Source/Shaders/Builtin/Functions/eyeOffset.js @@ -0,0 +1,25 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_eyeOffset\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} positionEC DOC_TBA.\n\ + * @param {vec3} eyeOffset DOC_TBA.\n\ + *\n\ + * @returns {vec4} DOC_TBA.\n\ + */\n\ +vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n\ +{\n\ + // This equation is approximate in x and y.\n\ + vec4 p = positionEC;\n\ + vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n\ + p.xy += eyeOffset.xy + zEyeOffset.xy;\n\ + p.z += zEyeOffset.z;\n\ + return p;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js b/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js new file mode 100644 index 000000000000..25d01be42ad5 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js @@ -0,0 +1,37 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Transforms a position from eye to window coordinates. The transformation\n\ + * from eye to clip coordinates is done using {@link czm_projection}.\n\ + * The transform from normalized device coordinates to window coordinates is\n\ + * done using {@link czm_viewportTransformation}, which assumes a depth range\n\ + * of near = 0 and far = 1.\n\ + *

\n\ + * This transform is useful when there is a need to manipulate window coordinates\n\ + * in a vertex shader as done by {@link BillboardCollection}.\n\ + *\n\ + * @name czm_eyeToWindowCoordinates\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} position The position in eye coordinates to transform.\n\ + *\n\ + * @returns {vec4} The transformed position in window coordinates.\n\ + *\n\ + * @see czm_modelToWindowCoordinates\n\ + * @see czm_projection\n\ + * @see czm_viewportTransformation\n\ + * @see BillboardCollection\n\ + *\n\ + * @example\n\ + * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\ + */\n\ +vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n\ +{\n\ + vec4 q = czm_projection * positionEC; // clip coordinates\n\ + q.xyz /= q.w; // normalized device coordinates\n\ + q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\ + return q;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/fog.js b/Source/Shaders/Builtin/Functions/fog.js new file mode 100644 index 000000000000..8c2d301c42d4 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/fog.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Gets the color with fog at a distance from the camera.\n\ + * \n\ + * @name czm_fog\n\ + * @glslFunction\n\ + * \n\ + * @param {float} distanceToCamera The distance to the camera in meters.\n\ + * @param {vec3} color The original color.\n\ + * @param {vec3} fogColor The color of the fog.\n\ + *\n\ + * @returns {vec3} The color adjusted for fog at the distance from the camera.\n\ + */\n\ +vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n\ +{\n\ + float scalar = distanceToCamera * czm_fogDensity;\n\ + float fog = 1.0 - exp(-(scalar * scalar));\n\ + \n\ + return mix(color, fogColor, fog);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js b/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js new file mode 100644 index 000000000000..c37b8bb2a1f7 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_geodeticSurfaceNormal\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} positionOnEllipsoid DOC_TBA\n\ + * @param {vec3} ellipsoidCenter DOC_TBA\n\ + * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA\n\ + * \n\ + * @returns {vec3} DOC_TBA.\n\ + */\n\ +vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n\ +{\n\ + return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getDefaultMaterial.js b/Source/Shaders/Builtin/Functions/getDefaultMaterial.js new file mode 100644 index 000000000000..37d61baea142 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/getDefaultMaterial.js @@ -0,0 +1,32 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * An czm_material with default values. Every material's czm_getMaterial\n\ + * should use this default material as a base for the material it returns.\n\ + * The default normal value is given by materialInput.normalEC.\n\ + *\n\ + * @name czm_getDefaultMaterial\n\ + * @glslFunction \n\ + *\n\ + * @param {czm_materialInput} input The input used to construct the default material.\n\ + * \n\ + * @returns {czm_material} The default material.\n\ + *\n\ + * @see czm_materialInput\n\ + * @see czm_material\n\ + * @see czm_getMaterial\n\ + */\n\ +czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material;\n\ + material.diffuse = vec3(0.0);\n\ + material.specular = 0.0;\n\ + material.shininess = 1.0;\n\ + material.normal = materialInput.normalEC;\n\ + material.emission = vec3(0.0);\n\ + material.alpha = 1.0;\n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getLambertDiffuse.js b/Source/Shaders/Builtin/Functions/getLambertDiffuse.js new file mode 100644 index 000000000000..177dd415d913 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/getLambertDiffuse.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Calculates the intensity of diffusely reflected light.\n\ + *\n\ + * @name czm_getLambertDiffuse\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\ + * @param {vec3} normalEC The surface normal in eye coordinates.\n\ + *\n\ + * @returns {float} The intensity of the diffuse reflection.\n\ + *\n\ + * @see czm_phong\n\ + *\n\ + * @example\n\ + * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n\ + * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n\ + * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n\ + */\n\ +float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n\ +{\n\ + return max(dot(lightDirectionEC, normalEC), 0.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getSpecular.js b/Source/Shaders/Builtin/Functions/getSpecular.js new file mode 100644 index 000000000000..6a7e200ca81a --- /dev/null +++ b/Source/Shaders/Builtin/Functions/getSpecular.js @@ -0,0 +1,34 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Calculates the specular intensity of reflected light.\n\ + *\n\ + * @name czm_getSpecular\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\ + * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.\n\ + * @param {vec3} normalEC The surface normal in eye coordinates.\n\ + * @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n\ + *\n\ + * @returns {float} The intensity of the specular highlight.\n\ + *\n\ + * @see czm_phong\n\ + *\n\ + * @example\n\ + * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n\ + * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n\ + * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n\ + */\n\ +float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n\ +{\n\ + vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\n\ + float specular = max(dot(toReflectedLight, toEyeEC), 0.0);\n\ +\n\ + // pow has undefined behavior if both parameters <= 0.\n\ + // Prevent this by making sure shininess is at least czm_epsilon2.\n\ + return pow(specular, max(shininess, czm_epsilon2));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getWaterNoise.js b/Source/Shaders/Builtin/Functions/getWaterNoise.js new file mode 100644 index 000000000000..428b4f05cfe1 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/getWaterNoise.js @@ -0,0 +1,42 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @private\n\ + */\n\ +vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n\ +{\n\ + float cosAngle = cos(angleInRadians);\n\ + float sinAngle = sin(angleInRadians);\n\ +\n\ + // time dependent sampling directions\n\ + vec2 s0 = vec2(1.0/17.0, 0.0);\n\ + vec2 s1 = vec2(-1.0/29.0, 0.0);\n\ + vec2 s2 = vec2(1.0/101.0, 1.0/59.0);\n\ + vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\n\ +\n\ + // rotate sampling direction by specified angle\n\ + s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\n\ + s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\n\ + s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\n\ + s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\n\ +\n\ + vec2 uv0 = (uv/103.0) + (time * s0);\n\ + vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\n\ + vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\n\ + vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\n\ +\n\ + uv0 = fract(uv0);\n\ + uv1 = fract(uv1);\n\ + uv2 = fract(uv2);\n\ + uv3 = fract(uv3);\n\ + vec4 noise = (texture2D(normalMap, uv0)) +\n\ + (texture2D(normalMap, uv1)) +\n\ + (texture2D(normalMap, uv2)) +\n\ + (texture2D(normalMap, uv3));\n\ +\n\ + // average and scale to between -1 and 1\n\ + return ((noise / 4.0) - 0.5) * 2.0;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js b/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js new file mode 100644 index 000000000000..7642c130c837 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js @@ -0,0 +1,26 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Returns the WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\ + *\n\ + * @name czm_getWgs84EllipsoidEC\n\ + * @glslFunction\n\ + *\n\ + * @returns {czm_ellipsoid} The WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\ + *\n\ + * @see Ellipsoid.WGS84\n\ + *\n\ + * @example\n\ + * czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n\ + */\n\ +czm_ellipsoid czm_getWgs84EllipsoidEC()\n\ +{\n\ + vec3 radii = vec3(6378137.0, 6378137.0, 6356752.314245);\n\ + vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\ + vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\ + czm_ellipsoid temp = czm_ellipsoid(czm_view[3].xyz, radii, inverseRadii, inverseRadiiSquared);\n\ + return temp;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/hue.js b/Source/Shaders/Builtin/Functions/hue.js new file mode 100644 index 000000000000..7e7205d718f4 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/hue.js @@ -0,0 +1,35 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Adjusts the hue of a color.\n\ + * \n\ + * @name czm_hue\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color.\n\ + * @param {float} adjustment The amount to adjust the hue of the color in radians.\n\ + *\n\ + * @returns {float} The color with the hue adjusted.\n\ + *\n\ + * @example\n\ + * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)\n\ + */\n\ +vec3 czm_hue(vec3 rgb, float adjustment)\n\ +{\n\ + const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n\ + 0.595716, -0.274453, -0.321263,\n\ + 0.211456, -0.522591, 0.311135);\n\ + const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n\ + 1.0, -0.2721, -0.6474,\n\ + 1.0, -1.107, 1.7046);\n\ + \n\ + vec3 yiq = toYIQ * rgb;\n\ + float hue = atan(yiq.z, yiq.y) + adjustment;\n\ + float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n\ + \n\ + vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n\ + return toRGB * color;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/isEmpty.js b/Source/Shaders/Builtin/Functions/isEmpty.js new file mode 100644 index 000000000000..e04f0f3f4e45 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/isEmpty.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Determines if a time interval is empty.\n\ + *\n\ + * @name czm_isEmpty\n\ + * @glslFunction \n\ + * \n\ + * @param {czm_raySegment} interval The interval to test.\n\ + * \n\ + * @returns {bool} true if the time interval is empty; otherwise, false.\n\ + *\n\ + * @example\n\ + * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\ + * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\ + * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\ + */\n\ +bool czm_isEmpty(czm_raySegment interval)\n\ +{\n\ + return (interval.stop < 0.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/isFull.js b/Source/Shaders/Builtin/Functions/isFull.js new file mode 100644 index 000000000000..22f66d76dd12 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/isFull.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Determines if a time interval is empty.\n\ + *\n\ + * @name czm_isFull\n\ + * @glslFunction \n\ + * \n\ + * @param {czm_raySegment} interval The interval to test.\n\ + * \n\ + * @returns {bool} true if the time interval is empty; otherwise, false.\n\ + *\n\ + * @example\n\ + * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\ + * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\ + * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\ + */\n\ +bool czm_isFull(czm_raySegment interval)\n\ +{\n\ + return (interval.start == 0.0 && interval.stop == czm_infinity);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js b/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js new file mode 100644 index 000000000000..6f1726d7274f --- /dev/null +++ b/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js @@ -0,0 +1,26 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.\n\ + *\n\ + * @name czm_latitudeToWebMercatorFraction\n\ + * @glslFunction\n\ + *\n\ + * @param {float} latitude The geodetic latitude, in radians.\n\ + * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.\n\ + * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.\n\ + *\n\ + * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern\n\ + * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return\n\ + * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.\n\ + */ \n\ +float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n\ +{\n\ + float sinLatitude = sin(latitude);\n\ + float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n\ + \n\ + return (mercatorY - southMercatorY) * oneOverMercatorHeight;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/luminance.js b/Source/Shaders/Builtin/Functions/luminance.js new file mode 100644 index 000000000000..ad97f79e06b1 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/luminance.js @@ -0,0 +1,25 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes the luminance of a color. \n\ + *\n\ + * @name czm_luminance\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} rgb The color.\n\ + * \n\ + * @returns {float} The luminance.\n\ + *\n\ + * @example\n\ + * float light = czm_luminance(vec3(0.0)); // 0.0\n\ + * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n\ + */\n\ +float czm_luminance(vec3 rgb)\n\ +{\n\ + // Algorithm from Chapter 10 of Graphics Shaders.\n\ + const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ + return dot(rgb, W);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/metersPerPixel.js b/Source/Shaders/Builtin/Functions/metersPerPixel.js new file mode 100644 index 000000000000..f2b83ab861a7 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/metersPerPixel.js @@ -0,0 +1,46 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes the size of a pixel in meters at a distance from the eye.\n\ +\n\ + * @name czm_metersPerPixel\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n\ + *\n\ + * @returns {float} The meters per pixel at positionEC.\n\ + */\n\ +float czm_metersPerPixel(vec4 positionEC)\n\ +{\n\ + float width = czm_viewport.z;\n\ + float height = czm_viewport.w;\n\ + float pixelWidth;\n\ + float pixelHeight;\n\ +\n\ + float top = czm_frustumPlanes.x;\n\ + float bottom = czm_frustumPlanes.y;\n\ + float left = czm_frustumPlanes.z;\n\ + float right = czm_frustumPlanes.w;\n\ +\n\ + if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n\ + {\n\ + float frustumWidth = right - left;\n\ + float frustumHeight = top - bottom;\n\ + pixelWidth = frustumWidth / width;\n\ + pixelHeight = frustumHeight / height;\n\ + }\n\ + else\n\ + {\n\ + float distanceToPixel = -positionEC.z;\n\ + float inverseNear = 1.0 / czm_currentFrustum.x;\n\ + float tanTheta = top * inverseNear;\n\ + pixelHeight = 2.0 * distanceToPixel * tanTheta / height;\n\ + tanTheta = right * inverseNear;\n\ + pixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n\ + }\n\ +\n\ + return max(pixelWidth, pixelHeight);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js b/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js new file mode 100644 index 000000000000..e144d63aa866 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js @@ -0,0 +1,42 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Transforms a position from model to window coordinates. The transformation\n\ + * from model to clip coordinates is done using {@link czm_modelViewProjection}.\n\ + * The transform from normalized device coordinates to window coordinates is\n\ + * done using {@link czm_viewportTransformation}, which assumes a depth range\n\ + * of near = 0 and far = 1.\n\ + *

\n\ + * This transform is useful when there is a need to manipulate window coordinates\n\ + * in a vertex shader as done by {@link BillboardCollection}.\n\ + *

\n\ + * This function should not be confused with {@link czm_viewportOrthographic},\n\ + * which is an orthographic projection matrix that transforms from window \n\ + * coordinates to clip coordinates.\n\ + *\n\ + * @name czm_modelToWindowCoordinates\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} position The position in model coordinates to transform.\n\ + *\n\ + * @returns {vec4} The transformed position in window coordinates.\n\ + *\n\ + * @see czm_eyeToWindowCoordinates\n\ + * @see czm_modelViewProjection\n\ + * @see czm_viewportTransformation\n\ + * @see czm_viewportOrthographic\n\ + * @see BillboardCollection\n\ + *\n\ + * @example\n\ + * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);\n\ + */\n\ +vec4 czm_modelToWindowCoordinates(vec4 position)\n\ +{\n\ + vec4 q = czm_modelViewProjection * position; // clip coordinates\n\ + q.xyz /= q.w; // normalized device coordinates\n\ + q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\ + return q;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js b/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js new file mode 100644 index 000000000000..3863912bee07 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js @@ -0,0 +1,23 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_multiplyWithColorBalance\n\ + * @glslFunction\n\ + */\n\ +vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n\ +{\n\ + // Algorithm from Chapter 10 of Graphics Shaders.\n\ + const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ + \n\ + vec3 target = left * right;\n\ + float leftLuminance = dot(left, W);\n\ + float rightLuminance = dot(right, W);\n\ + float targetLuminance = dot(target, W);\n\ + \n\ + return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/nearFarScalar.js b/Source/Shaders/Builtin/Functions/nearFarScalar.js new file mode 100644 index 000000000000..e0b760809a4e --- /dev/null +++ b/Source/Shaders/Builtin/Functions/nearFarScalar.js @@ -0,0 +1,31 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes a value that scales with distance. The scaling is clamped at the near and\n\ + * far distances, and does not extrapolate. This function works with the\n\ + * {@link NearFarScalar} JavaScript class.\n\ + *\n\ + * @name czm_nearFarScalar\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).\n\ + * @param {float} cameraDistSq The square of the current distance from the camera.\n\ + *\n\ + * @returns {float} The value at this distance.\n\ + */\n\ +float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n\ +{\n\ + float valueAtMin = nearFarScalar.y;\n\ + float valueAtMax = nearFarScalar.w;\n\ + float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\n\ + float farDistanceSq = nearFarScalar.z * nearFarScalar.z;\n\ +\n\ + float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\n\ +\n\ + t = pow(clamp(t, 0.0, 1.0), 0.2);\n\ +\n\ + return mix(valueAtMin, valueAtMax, t);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/octDecode.js b/Source/Shaders/Builtin/Functions/octDecode.js new file mode 100644 index 000000000000..71d471f642bc --- /dev/null +++ b/Source/Shaders/Builtin/Functions/octDecode.js @@ -0,0 +1,88 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return " /**\n\ + * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n\ + * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ + * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ + *\n\ + * @name czm_octDecode\n\ + * @param {vec2} encoded The oct-encoded, unit-length vector\n\ + * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.\n\ + * @returns {vec3} The decoded and normalized vector\n\ + */\n\ + vec3 czm_octDecode(vec2 encoded, float range)\n\ + {\n\ + if (encoded.x == 0.0 && encoded.y == 0.0) {\n\ + return vec3(0.0, 0.0, 0.0);\n\ + }\n\ +\n\ + encoded = encoded / range * 2.0 - 1.0;\n\ + vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\ + if (v.z < 0.0)\n\ + {\n\ + v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n\ + }\n\ +\n\ + return normalize(v);\n\ + }\n\ +\n\ +/**\n\ + * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n\ + * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ + * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ + *\n\ + * @name czm_octDecode\n\ + * @param {vec2} encoded The oct-encoded, unit-length vector\n\ + * @returns {vec3} The decoded and normalized vector\n\ + */\n\ + vec3 czm_octDecode(vec2 encoded)\n\ + {\n\ + return czm_octDecode(encoded, 255.0);\n\ + }\n\ +\n\ + /**\n\ + * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.\n\ + * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ + * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ + *\n\ + * @name czm_octDecode\n\ + * @param {float} encoded The oct-encoded, unit-length vector\n\ + * @returns {vec3} The decoded and normalized vector\n\ + */\n\ + vec3 czm_octDecode(float encoded)\n\ + {\n\ + float temp = encoded / 256.0;\n\ + float x = floor(temp);\n\ + float y = (temp - x) * 256.0;\n\ + return czm_octDecode(vec2(x, y));\n\ + }\n\ +\n\ +/**\n\ + * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.\n\ + * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ + * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ + *\n\ + * @name czm_octDecode\n\ + * @param {vec2} encoded The packed oct-encoded, unit-length vectors.\n\ + * @param {vec3} vector1 One decoded and normalized vector.\n\ + * @param {vec3} vector2 One decoded and normalized vector.\n\ + * @param {vec3} vector3 One decoded and normalized vector.\n\ + */\n\ + void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n\ + {\n\ + float temp = encoded.x / 65536.0;\n\ + float x = floor(temp);\n\ + float encodedFloat1 = (temp - x) * 65536.0;\n\ +\n\ + temp = encoded.y / 65536.0;\n\ + float y = floor(temp);\n\ + float encodedFloat2 = (temp - y) * 65536.0;\n\ +\n\ + vector1 = czm_octDecode(encodedFloat1);\n\ + vector2 = czm_octDecode(encodedFloat2);\n\ + vector3 = czm_octDecode(vec2(x, y));\n\ + }\n\ +\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/packDepth.js b/Source/Shaders/Builtin/Functions/packDepth.js new file mode 100644 index 000000000000..dbfb067a8a71 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/packDepth.js @@ -0,0 +1,23 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Packs a depth value into a vec3 that can be represented by unsigned bytes.\n\ + *\n\ + * @name czm_packDepth\n\ + * @glslFunction\n\ + *\n\ + * @param {float} depth The floating-point depth.\n\ + * @returns {vec3} The packed depth.\n\ + */\n\ +vec4 czm_packDepth(float depth)\n\ +{\n\ + // See Aras Pranckevičius' post Encoding Floats to RGBA\n\ + // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\ + vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n\ + enc = fract(enc);\n\ + enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\ + return enc;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/phong.js b/Source/Shaders/Builtin/Functions/phong.js new file mode 100644 index 000000000000..aa4792b07d18 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/phong.js @@ -0,0 +1,68 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n\ +{\n\ + return czm_getLambertDiffuse(lightDirectionEC, material.normal);\n\ +}\n\ +\n\ +float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n\ +{\n\ + return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n\ +}\n\ +\n\ +/**\n\ + * Computes a color using the Phong lighting model.\n\ + *\n\ + * @name czm_phong\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.\n\ + * @param {czm_material} material The fragment's material.\n\ + * \n\ + * @returns {vec4} The computed color.\n\ + * \n\ + * @example\n\ + * vec3 positionToEyeEC = // ...\n\ + * czm_material material = // ...\n\ + * gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ + *\n\ + * @see czm_getMaterial\n\ + */\n\ +vec4 czm_phong(vec3 toEye, czm_material material)\n\ +{\n\ + // Diffuse from directional light sources at eye (for top-down)\n\ + float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\n\ + if (czm_sceneMode == czm_sceneMode3D) {\n\ + // (and horizon views in 3D)\n\ + diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n\ + }\n\ +\n\ + // Specular from sun and pseudo-moon\n\ + float specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + czm_private_getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\n\ +\n\ + // Temporary workaround for adding ambient.\n\ + vec3 materialDiffuse = material.diffuse * 0.5;\n\ + \n\ + vec3 ambient = materialDiffuse;\n\ + vec3 color = ambient + material.emission;\n\ + color += materialDiffuse * diffuse;\n\ + color += material.specular * specular;\n\ +\n\ + return vec4(color, material.alpha);\n\ +}\n\ +\n\ +vec4 czm_private_phong(vec3 toEye, czm_material material)\n\ +{\n\ + float diffuse = czm_private_getLambertDiffuseOfMaterial(czm_sunDirectionEC, material);\n\ + float specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material);\n\ +\n\ + vec3 ambient = vec3(0.0);\n\ + vec3 color = ambient + material.emission;\n\ + color += material.diffuse * diffuse;\n\ + color += material.specular * specular;\n\ +\n\ + return vec4(color, material.alpha);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/pointAlongRay.js b/Source/Shaders/Builtin/Functions/pointAlongRay.js new file mode 100644 index 000000000000..66a1f2b4c4b6 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/pointAlongRay.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Computes the point along a ray at the given time. time can be positive, negative, or zero.\n\ + *\n\ + * @name czm_pointAlongRay\n\ + * @glslFunction\n\ + *\n\ + * @param {czm_ray} ray The ray to compute the point along.\n\ + * @param {float} time The time along the ray.\n\ + * \n\ + * @returns {vec3} The point along the ray at the given time.\n\ + * \n\ + * @example\n\ + * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction\n\ + * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)\n\ + */\n\ +vec3 czm_pointAlongRay(czm_ray ray, float time)\n\ +{\n\ + return ray.origin + (time * ray.direction);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js b/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js new file mode 100644 index 000000000000..fc161c529310 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js @@ -0,0 +1,88 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_rayEllipsoidIntersectionInterval\n\ + * @glslFunction\n\ + */\n\ +czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)\n\ +{\n\ + // ray and ellipsoid center in eye coordinates. radii in model coordinates.\n\ + vec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n\ + vec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\ + \n\ + q = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\n\ + \n\ + float q2 = dot(q, q);\n\ + float qw = dot(q, w);\n\ + \n\ + if (q2 > 1.0) // Outside ellipsoid.\n\ + {\n\ + if (qw >= 0.0) // Looking outward or tangent (0 intersections).\n\ + {\n\ + return czm_emptyRaySegment;\n\ + }\n\ + else // qw < 0.0.\n\ + {\n\ + float qw2 = qw * qw;\n\ + float difference = q2 - 1.0; // Positively valued.\n\ + float w2 = dot(w, w);\n\ + float product = w2 * difference;\n\ + \n\ + if (qw2 < product) // Imaginary roots (0 intersections).\n\ + {\n\ + return czm_emptyRaySegment; \n\ + } \n\ + else if (qw2 > product) // Distinct roots (2 intersections).\n\ + {\n\ + float discriminant = qw * qw - product;\n\ + float temp = -qw + sqrt(discriminant); // Avoid cancellation.\n\ + float root0 = temp / w2;\n\ + float root1 = difference / temp;\n\ + if (root0 < root1)\n\ + {\n\ + czm_raySegment i = czm_raySegment(root0, root1);\n\ + return i;\n\ + }\n\ + else\n\ + {\n\ + czm_raySegment i = czm_raySegment(root1, root0);\n\ + return i;\n\ + }\n\ + }\n\ + else // qw2 == product. Repeated roots (2 intersections).\n\ + {\n\ + float root = sqrt(difference / w2);\n\ + czm_raySegment i = czm_raySegment(root, root);\n\ + return i;\n\ + }\n\ + }\n\ + }\n\ + else if (q2 < 1.0) // Inside ellipsoid (2 intersections).\n\ + {\n\ + float difference = q2 - 1.0; // Negatively valued.\n\ + float w2 = dot(w, w);\n\ + float product = w2 * difference; // Negatively valued.\n\ + float discriminant = qw * qw - product;\n\ + float temp = -qw + sqrt(discriminant); // Positively valued.\n\ + czm_raySegment i = czm_raySegment(0.0, temp / w2);\n\ + return i;\n\ + }\n\ + else // q2 == 1.0. On ellipsoid.\n\ + {\n\ + if (qw < 0.0) // Looking inward.\n\ + {\n\ + float w2 = dot(w, w);\n\ + czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n\ + return i;\n\ + }\n\ + else // qw >= 0.0. Looking outward or tangent.\n\ + {\n\ + return czm_emptyRaySegment;\n\ + }\n\ + }\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/reverseLogDepth.js b/Source/Shaders/Builtin/Functions/reverseLogDepth.js new file mode 100644 index 000000000000..de7adc57380c --- /dev/null +++ b/Source/Shaders/Builtin/Functions/reverseLogDepth.js @@ -0,0 +1,15 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "float czm_reverseLogDepth(float logZ)\n\ +{\n\ +#ifdef LOG_DEPTH\n\ + float near = czm_currentFrustum.x;\n\ + float far = czm_currentFrustum.y;\n\ + logZ = pow(2.0, logZ * log2(far + 1.0)) - 1.0;\n\ + logZ = far * (1.0 - near / logZ) / (far - near);\n\ +#endif\n\ + return logZ;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/saturation.js b/Source/Shaders/Builtin/Functions/saturation.js new file mode 100644 index 000000000000..8038914bc860 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/saturation.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Adjusts the saturation of a color.\n\ + * \n\ + * @name czm_saturation\n\ + * @glslFunction\n\ + * \n\ + * @param {vec3} rgb The color.\n\ + * @param {float} adjustment The amount to adjust the saturation of the color.\n\ + *\n\ + * @returns {float} The color with the saturation adjusted.\n\ + *\n\ + * @example\n\ + * vec3 greyScale = czm_saturation(color, 0.0);\n\ + * vec3 doubleSaturation = czm_saturation(color, 2.0);\n\ + */\n\ +vec3 czm_saturation(vec3 rgb, float adjustment)\n\ +{\n\ + // Algorithm from Chapter 16 of OpenGL Shading Language\n\ + const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ + vec3 intensity = vec3(dot(rgb, W));\n\ + return mix(intensity, rgb, adjustment);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/shadowDepthCompare.js b/Source/Shaders/Builtin/Functions/shadowDepthCompare.js new file mode 100644 index 000000000000..74ebb47d707f --- /dev/null +++ b/Source/Shaders/Builtin/Functions/shadowDepthCompare.js @@ -0,0 +1,29 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +float czm_sampleShadowMap(samplerCube shadowMap, vec3 d)\n\ +{\n\ + return czm_unpackDepth(textureCube(shadowMap, d));\n\ +}\n\ +\n\ +float czm_sampleShadowMap(sampler2D shadowMap, vec2 uv)\n\ +{\n\ +#ifdef USE_SHADOW_DEPTH_TEXTURE\n\ + return texture2D(shadowMap, uv).r;\n\ +#else\n\ + return czm_unpackDepth(texture2D(shadowMap, uv));\n\ +#endif\n\ +}\n\ +\n\ +float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n\ +{\n\ + return step(depth, czm_sampleShadowMap(shadowMap, uv));\n\ +}\n\ +\n\ +float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n\ +{\n\ + return step(depth, czm_sampleShadowMap(shadowMap, uv));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/shadowVisibility.js b/Source/Shaders/Builtin/Functions/shadowVisibility.js new file mode 100644 index 000000000000..ffb127de11a5 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/shadowVisibility.js @@ -0,0 +1,71 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "\n\ +float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n\ +{\n\ +#ifdef USE_NORMAL_SHADING\n\ +#ifdef USE_NORMAL_SHADING_SMOOTH\n\ + float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n\ +#else\n\ + float strength = step(0.0, nDotL);\n\ +#endif\n\ + visibility *= strength;\n\ +#endif\n\ +\n\ + visibility = max(visibility, darkness);\n\ + return visibility;\n\ +}\n\ +\n\ +#ifdef USE_CUBE_MAP_SHADOW\n\ +float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n\ +{\n\ + float depthBias = shadowParameters.depthBias;\n\ + float depth = shadowParameters.depth;\n\ + float nDotL = shadowParameters.nDotL;\n\ + float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n\ + float darkness = shadowParameters.darkness;\n\ + vec3 uvw = shadowParameters.texCoords;\n\ +\n\ + depth -= depthBias;\n\ + float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\n\ + return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n\ +}\n\ +#else\n\ +float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n\ +{\n\ + float depthBias = shadowParameters.depthBias;\n\ + float depth = shadowParameters.depth;\n\ + float nDotL = shadowParameters.nDotL;\n\ + float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n\ + float darkness = shadowParameters.darkness;\n\ + vec2 uv = shadowParameters.texCoords;\n\ +\n\ + depth -= depthBias;\n\ +#ifdef USE_SOFT_SHADOWS\n\ + vec2 texelStepSize = shadowParameters.texelStepSize;\n\ + float radius = 1.0;\n\ + float dx0 = -texelStepSize.x * radius;\n\ + float dy0 = -texelStepSize.y * radius;\n\ + float dx1 = texelStepSize.x * radius;\n\ + float dy1 = texelStepSize.y * radius;\n\ + float visibility = (\n\ + czm_shadowDepthCompare(shadowMap, uv, depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\n\ + czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n\ + ) * (1.0 / 9.0);\n\ +#else\n\ + float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n\ +#endif\n\ +\n\ + return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n\ +}\n\ +#endif\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/signNotZero.js b/Source/Shaders/Builtin/Functions/signNotZero.js new file mode 100644 index 000000000000..6cb65a1ff770 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/signNotZero.js @@ -0,0 +1,34 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL\n\ + * built-in function sign except that returns 1.0 instead of 0.0 when the input value is 0.0.\n\ + * \n\ + * @name czm_signNotZero\n\ + * @glslFunction\n\ + *\n\ + * @param {} value The value for which to determine the sign.\n\ + * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.\n\ + */\n\ +float czm_signNotZero(float value)\n\ +{\n\ + return value >= 0.0 ? 1.0 : -1.0;\n\ +}\n\ +\n\ +vec2 czm_signNotZero(vec2 value)\n\ +{\n\ + return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n\ +}\n\ +\n\ +vec3 czm_signNotZero(vec3 value)\n\ +{\n\ + return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n\ +}\n\ +\n\ +vec4 czm_signNotZero(vec4 value)\n\ +{\n\ + return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js b/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js new file mode 100644 index 000000000000..93b822ef1e8b --- /dev/null +++ b/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js @@ -0,0 +1,30 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Creates a matrix that transforms vectors from tangent space to eye space.\n\ + *\n\ + * @name czm_tangentToEyeSpaceMatrix\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} normalEC The normal vector in eye coordinates.\n\ + * @param {vec3} tangentEC The tangent vector in eye coordinates.\n\ + * @param {vec3} bitangentEC The bitangent vector in eye coordinates.\n\ + *\n\ + * @returns {mat3} The matrix that transforms from tangent space to eye space.\n\ + *\n\ + * @example\n\ + * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);\n\ + * vec3 normal = tangentToEye * texture2D(normalMap, st).xyz;\n\ + */\n\ +mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n\ +{\n\ + vec3 normal = normalize(normalEC);\n\ + vec3 tangent = normalize(tangentEC);\n\ + vec3 bitangent = normalize(bitangentEC);\n\ + return mat3(tangent.x , tangent.y , tangent.z,\n\ + bitangent.x, bitangent.y, bitangent.z,\n\ + normal.x , normal.y , normal.z);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/transformPlane.js b/Source/Shaders/Builtin/Functions/transformPlane.js new file mode 100644 index 000000000000..1887002091a2 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/transformPlane.js @@ -0,0 +1,13 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "vec4 czm_transformPlane(vec4 clippingPlane, mat4 transform) {\n\ + vec3 transformedDirection = normalize((transform * vec4(clippingPlane.xyz, 0.0)).xyz);\n\ + vec3 transformedPosition = (transform * vec4(clippingPlane.xyz * -clippingPlane.w, 1.0)).xyz;\n\ + vec4 transformedPlane;\n\ + transformedPlane.xyz = transformedDirection;\n\ + transformedPlane.w = -dot(transformedDirection, transformedPosition);\n\ + return transformedPlane;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/translateRelativeToEye.js b/Source/Shaders/Builtin/Functions/translateRelativeToEye.js new file mode 100644 index 000000000000..035b3fb92df0 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/translateRelativeToEye.js @@ -0,0 +1,45 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Translates a position (or any vec3) that was encoded with {@link EncodedCartesian3},\n\ + * and then provided to the shader as separate high and low bits to\n\ + * be relative to the eye. As shown in the example, the position can then be transformed in eye\n\ + * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},\n\ + * respectively.\n\ + *

\n\ + * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as\n\ + * described in {@link http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/|Precisions, Precisions}.\n\ + *

\n\ + *\n\ + * @name czm_translateRelativeToEye\n\ + * @glslFunction\n\ + *\n\ + * @param {vec3} high The position's high bits.\n\ + * @param {vec3} low The position's low bits.\n\ + * @returns {vec3} The position translated to be relative to the camera's position.\n\ + *\n\ + * @example\n\ + * attribute vec3 positionHigh;\n\ + * attribute vec3 positionLow;\n\ + * \n\ + * void main() \n\ + * {\n\ + * vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ + * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\ + * }\n\ + *\n\ + * @see czm_modelViewRelativeToEye\n\ + * @see czm_modelViewProjectionRelativeToEye\n\ + * @see czm_computePosition\n\ + * @see EncodedCartesian3\n\ + */\n\ +vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n\ +{\n\ + vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n\ + vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\ +\n\ + return vec4(highDifference + lowDifference, 1.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/translucentPhong.js b/Source/Shaders/Builtin/Functions/translucentPhong.js new file mode 100644 index 000000000000..ed4c084d10f7 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/translucentPhong.js @@ -0,0 +1,34 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @private\n\ + */\n\ +vec4 czm_translucentPhong(vec3 toEye, czm_material material)\n\ +{\n\ + // Diffuse from directional light sources at eye (for top-down and horizon views)\n\ + float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\n\ + \n\ + if (czm_sceneMode == czm_sceneMode3D) {\n\ + // (and horizon views in 3D)\n\ + diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n\ + }\n\ + \n\ + diffuse = clamp(diffuse, 0.0, 1.0);\n\ +\n\ + // Specular from sun and pseudo-moon\n\ + float specular = czm_getSpecular(czm_sunDirectionEC, toEye, material.normal, material.shininess);\n\ + specular += czm_getSpecular(czm_moonDirectionEC, toEye, material.normal, material.shininess);\n\ +\n\ + // Temporary workaround for adding ambient.\n\ + vec3 materialDiffuse = material.diffuse * 0.5;\n\ +\n\ + vec3 ambient = materialDiffuse;\n\ + vec3 color = ambient + material.emission;\n\ + color += materialDiffuse * diffuse;\n\ + color += material.specular * specular;\n\ +\n\ + return vec4(color, material.alpha);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/transpose.js b/Source/Shaders/Builtin/Functions/transpose.js new file mode 100644 index 000000000000..87324772c206 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/transpose.js @@ -0,0 +1,50 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Returns the transpose of the matrix. The input matrix can be\n\ + * a mat2, mat3, or mat4.\n\ + *\n\ + * @name czm_transpose\n\ + * @glslFunction\n\ + *\n\ + * @param {} matrix The matrix to transpose.\n\ + *\n\ + * @returns {} The transposed matrix.\n\ + *\n\ + * @example\n\ + * // GLSL declarations\n\ + * mat2 czm_transpose(mat2 matrix);\n\ + * mat3 czm_transpose(mat3 matrix);\n\ + * mat4 czm_transpose(mat4 matrix);\n\ + *\n\ + * // Transpose a 3x3 rotation matrix to find its inverse.\n\ + * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(\n\ + * positionMC, normalEC);\n\ + * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);\n\ + */\n\ +mat2 czm_transpose(mat2 matrix)\n\ +{\n\ + return mat2(\n\ + matrix[0][0], matrix[1][0],\n\ + matrix[0][1], matrix[1][1]);\n\ +}\n\ +\n\ +mat3 czm_transpose(mat3 matrix)\n\ +{\n\ + return mat3(\n\ + matrix[0][0], matrix[1][0], matrix[2][0],\n\ + matrix[0][1], matrix[1][1], matrix[2][1],\n\ + matrix[0][2], matrix[1][2], matrix[2][2]);\n\ +}\n\ +\n\ +mat4 czm_transpose(mat4 matrix)\n\ +{\n\ + return mat4(\n\ + matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n\ + matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n\ + matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n\ + matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/unpackDepth.js b/Source/Shaders/Builtin/Functions/unpackDepth.js new file mode 100644 index 000000000000..de547a800149 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/unpackDepth.js @@ -0,0 +1,21 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Unpacks a vec4 depth value to a float in [0, 1) range.\n\ + *\n\ + * @name czm_unpackDepth\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} packedDepth The packed depth.\n\ + *\n\ + * @returns {float} The floating-point depth in [0, 1) range.\n\ + */\n\ + float czm_unpackDepth(vec4 packedDepth)\n\ + {\n\ + // See Aras Pranckevičius' post Encoding Floats to RGBA\n\ + // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\ + return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n\ + }\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/unpackFloat.js b/Source/Shaders/Builtin/Functions/unpackFloat.js new file mode 100644 index 000000000000..94a5b8bb32dc --- /dev/null +++ b/Source/Shaders/Builtin/Functions/unpackFloat.js @@ -0,0 +1,35 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#define SHIFT_RIGHT_8 0.00390625 //1.0 / 256.0\n\ +#define SHIFT_RIGHT_16 0.00001525878 //1.0 / 65536.0\n\ +#define SHIFT_RIGHT_24 5.960464477539063e-8//1.0 / 16777216.0\n\ +\n\ +#define BIAS 38.0\n\ +\n\ +/**\n\ + * Unpacks a vec4 value containing values expressable as uint8 to an arbitrary float.\n\ + *\n\ + * @name czm_unpackFloat\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} packedFloat The packed float.\n\ + *\n\ + * @returns {float} The floating-point depth in arbitrary range.\n\ + */\n\ + float czm_unpackFloat(vec4 packedFloat)\n\ +{\n\ + packedFloat *= 255.0;\n\ + float temp = packedFloat.w / 2.0;\n\ + float exponent = floor(temp);\n\ + float sign = (temp - exponent) * 2.0;\n\ + exponent = exponent - float(BIAS);\n\ + sign = sign * 2.0 - 1.0;\n\ + sign = -sign;\n\ + float unpacked = sign * packedFloat.x * float(SHIFT_RIGHT_8);\n\ + unpacked += sign * packedFloat.y * float(SHIFT_RIGHT_16);\n\ + unpacked += sign * packedFloat.z * float(SHIFT_RIGHT_24);\n\ + return unpacked * pow(10.0, exponent);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/vertexLogDepth.js b/Source/Shaders/Builtin/Functions/vertexLogDepth.js new file mode 100644 index 000000000000..50d0d669c79b --- /dev/null +++ b/Source/Shaders/Builtin/Functions/vertexLogDepth.js @@ -0,0 +1,54 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef LOG_DEPTH\n\ +varying float v_logZ;\n\ +varying vec3 v_logPositionEC;\n\ +#endif\n\ +\n\ +void czm_updatePositionDepth() {\n\ +#if defined(LOG_DEPTH) && !defined(DISABLE_GL_POSITION_LOG_DEPTH)\n\ + v_logPositionEC = (czm_inverseProjection * gl_Position).xyz;\n\ +\n\ + gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0;\n\ + gl_Position.z *= gl_Position.w;\n\ +#endif\n\ +}\n\ +\n\ +/**\n\ + * Writes the logarithmic depth to gl_Position using the already computed gl_Position.\n\ + *\n\ + * @name czm_vertexLogDepth\n\ + * @glslFunction\n\ + */\n\ +void czm_vertexLogDepth()\n\ +{\n\ +#ifdef LOG_DEPTH\n\ + v_logZ = 1.0 + gl_Position.w;\n\ + czm_updatePositionDepth();\n\ +#endif\n\ +}\n\ +\n\ +/**\n\ + * Writes the logarithmic depth to gl_Position using the provided clip coordinates.\n\ + *

\n\ + * An example use case for this function would be moving the vertex in window coordinates\n\ + * before converting back to clip coordinates. Use the original vertex clip coordinates.\n\ + *

\n\ + * @name czm_vertexLogDepth\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} clipCoords The vertex in clip coordinates.\n\ + *\n\ + * @example\n\ + * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));\n\ + */\n\ +void czm_vertexLogDepth(vec4 clipCoords)\n\ +{\n\ +#ifdef LOG_DEPTH\n\ + v_logZ = 1.0 + clipCoords.w;\n\ + czm_updatePositionDepth();\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js b/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js new file mode 100644 index 000000000000..f26f76b72480 --- /dev/null +++ b/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js @@ -0,0 +1,60 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Transforms a position from window to eye coordinates.\n\ + * The transform from window to normalized device coordinates is done using components\n\ + * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n\ + * the inverse of czm_viewportTransformation. The transformation from\n\ + * normalized device coordinates to clip coordinates is done using positionWC.w,\n\ + * which is expected to be the scalar used in the perspective divide. The transformation\n\ + * from clip to eye coordinates is done using {@link czm_inverseProjection}.\n\ + *\n\ + * @name czm_windowToEyeCoordinates\n\ + * @glslFunction\n\ + *\n\ + * @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n\ + *\n\ + * @returns {vec4} The transformed position in eye coordinates.\n\ + *\n\ + * @see czm_modelToWindowCoordinates\n\ + * @see czm_eyeToWindowCoordinates\n\ + * @see czm_inverseProjection\n\ + * @see czm_viewport\n\ + * @see czm_viewportTransformation\n\ + *\n\ + * @example\n\ + * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n\ + */\n\ +vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\ +{\n\ + float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\ + float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\ + float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\ + vec4 q = vec4(x, y, z, 1.0);\n\ + q /= fragmentCoordinate.w;\n\ +\n\ + if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s\n\ + {\n\ + q = czm_inverseProjection * q;\n\ + }\n\ + else\n\ + {\n\ + float top = czm_frustumPlanes.x;\n\ + float bottom = czm_frustumPlanes.y;\n\ + float left = czm_frustumPlanes.z;\n\ + float right = czm_frustumPlanes.w;\n\ +\n\ + float near = czm_currentFrustum.x;\n\ + float far = czm_currentFrustum.y;\n\ +\n\ + q.x = (q.x * (right - left) + left + right) * 0.5;\n\ + q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n\ + q.z = (q.z * (near - far) - near - far) * 0.5;\n\ + q.w = 1.0;\n\ + }\n\ +\n\ + return q;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js b/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js new file mode 100644 index 000000000000..53550a9bd13c --- /dev/null +++ b/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js @@ -0,0 +1,30 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "// emulated noperspective\n\ +#ifndef LOG_DEPTH\n\ +varying float v_WindowZ;\n\ +#endif\n\ +/**\n\ + * Clamps a vertex to the far plane by writing the fragments depth.\n\ + *

\n\ + * The shader must enable the GL_EXT_frag_depth extension.\n\ + *

\n\ + *\n\ + * @name czm_writeDepthClampedToFarPlane\n\ + * @glslFunction\n\ + *\n\ + * @example\n\ + * gl_FragColor = color;\n\ + * czm_writeDepthClampedToFarPlane();\n\ + *\n\ + * @see czm_depthClampFarPlane\n\ + */\n\ +void czm_writeDepthClampedToFarPlane()\n\ +{\n\ +#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n\ + gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/writeLogDepth.js b/Source/Shaders/Builtin/Functions/writeLogDepth.js new file mode 100644 index 000000000000..3bc03e2957dd --- /dev/null +++ b/Source/Shaders/Builtin/Functions/writeLogDepth.js @@ -0,0 +1,49 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef LOG_DEPTH\n\ +varying float v_logZ;\n\ +#endif\n\ +\n\ +/**\n\ + * Writes the fragment depth to the logarithmic depth buffer.\n\ + *

\n\ + * Use this when the vertex shader does not calls {@link czm_vertexlogDepth}, for example, when\n\ + * ray-casting geometry using a full screen quad.\n\ + *

\n\ + * @name czm_writeLogDepth\n\ + * @glslFunction\n\ + *\n\ + * @param {float} logZ The w coordinate of the vertex in clip coordinates plus 1.0.\n\ + *\n\ + * @example\n\ + * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);\n\ + */\n\ +void czm_writeLogDepth(float logZ)\n\ +{\n\ +#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE)\n\ + float halfLogFarDistance = czm_logFarDistance * 0.5;\n\ + float depth = log2(logZ);\n\ + if (depth < log2(czm_currentFrustum.x)) {\n\ + discard;\n\ + }\n\ + gl_FragDepthEXT = depth * halfLogFarDistance;\n\ +#endif\n\ +}\n\ +\n\ +/**\n\ + * Writes the fragment depth to the logarithmic depth buffer.\n\ + *

\n\ + * Use this when the vertex shader calls {@link czm_vertexlogDepth}.\n\ + *

\n\ + *\n\ + * @name czm_writeLogDepth\n\ + * @glslFunction\n\ + */\n\ +void czm_writeLogDepth() {\n\ +#ifdef LOG_DEPTH\n\ + czm_writeLogDepth(v_logZ);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/depthRangeStruct.js b/Source/Shaders/Builtin/Structs/depthRangeStruct.js new file mode 100644 index 000000000000..2eba4ddf5b30 --- /dev/null +++ b/Source/Shaders/Builtin/Structs/depthRangeStruct.js @@ -0,0 +1,14 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @name czm_depthRangeStruct\n\ + * @glslStruct\n\ + */\n\ +struct czm_depthRangeStruct\n\ +{\n\ + float near;\n\ + float far;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/ellipsoid.js b/Source/Shaders/Builtin/Structs/ellipsoid.js new file mode 100644 index 000000000000..1c5ea91d80be --- /dev/null +++ b/Source/Shaders/Builtin/Structs/ellipsoid.js @@ -0,0 +1,17 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/** DOC_TBA\n\ + *\n\ + * @name czm_ellipsoid\n\ + * @glslStruct\n\ + */\n\ +struct czm_ellipsoid\n\ +{\n\ + vec3 center;\n\ + vec3 radii;\n\ + vec3 inverseRadii;\n\ + vec3 inverseRadiiSquared;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/material.js b/Source/Shaders/Builtin/Structs/material.js new file mode 100644 index 000000000000..bc5c73d9fe22 --- /dev/null +++ b/Source/Shaders/Builtin/Structs/material.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.\n\ + *\n\ + * @name czm_material\n\ + * @glslStruct\n\ + *\n\ + * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n\ + * @property {float} specular Intensity of incoming light reflecting in a single direction.\n\ + * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n\ + * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n\ + * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n\ + * @property {float} alpha Opacity of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n\ + */\n\ +struct czm_material\n\ +{\n\ + vec3 diffuse;\n\ + float specular;\n\ + float shininess;\n\ + vec3 normal;\n\ + vec3 emission;\n\ + float alpha;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/materialInput.js b/Source/Shaders/Builtin/Structs/materialInput.js new file mode 100644 index 000000000000..ffd7a261c18c --- /dev/null +++ b/Source/Shaders/Builtin/Structs/materialInput.js @@ -0,0 +1,31 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Used as input to every material's czm_getMaterial function.\n\ + *\n\ + * @name czm_materialInput\n\ + * @glslStruct\n\ + *\n\ + * @property {float} s 1D texture coordinates.\n\ + * @property {vec2} st 2D texture coordinates.\n\ + * @property {vec3} str 3D texture coordinates.\n\ + * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n\ + * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n\ + * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n\ + * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.\n\ + * @property {float} slope The slope of the terrain normalized from 0 to 1. 0 is completely vertical, 1 is completely flat. Only available for globe materials.\n\ + */\n\ +struct czm_materialInput\n\ +{\n\ + float s;\n\ + vec2 st;\n\ + vec3 str;\n\ + vec3 normalEC;\n\ + mat3 tangentToEyeMatrix;\n\ + vec3 positionToEyeEC;\n\ + float height;\n\ + float slope;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/ray.js b/Source/Shaders/Builtin/Structs/ray.js new file mode 100644 index 000000000000..d729a01c5d5c --- /dev/null +++ b/Source/Shaders/Builtin/Structs/ray.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_ray\n\ + * @glslStruct\n\ + */\n\ +struct czm_ray\n\ +{\n\ + vec3 origin;\n\ + vec3 direction;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/raySegment.js b/Source/Shaders/Builtin/Structs/raySegment.js new file mode 100644 index 000000000000..782b91ba5e3a --- /dev/null +++ b/Source/Shaders/Builtin/Structs/raySegment.js @@ -0,0 +1,32 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_raySegment\n\ + * @glslStruct\n\ + */\n\ +struct czm_raySegment\n\ +{\n\ + float start;\n\ + float stop;\n\ +};\n\ +\n\ +/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_emptyRaySegment\n\ + * @glslConstant \n\ + */\n\ +const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\n\ +\n\ +/**\n\ + * DOC_TBA\n\ + *\n\ + * @name czm_fullRaySegment\n\ + * @glslConstant \n\ + */\n\ +const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/shadowParameters.js b/Source/Shaders/Builtin/Structs/shadowParameters.js new file mode 100644 index 000000000000..2a687793e37c --- /dev/null +++ b/Source/Shaders/Builtin/Structs/shadowParameters.js @@ -0,0 +1,20 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "struct czm_shadowParameters\n\ +{\n\ +#ifdef USE_CUBE_MAP_SHADOW\n\ + vec3 texCoords;\n\ +#else\n\ + vec2 texCoords;\n\ +#endif\n\ +\n\ + float depthBias;\n\ + float depth;\n\ + float nDotL;\n\ + vec2 texelStepSize;\n\ + float normalShadingSmooth;\n\ + float darkness;\n\ +};\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/CompositeOITFS.js b/Source/Shaders/CompositeOITFS.js new file mode 100644 index 000000000000..4081455d8a16 --- /dev/null +++ b/Source/Shaders/CompositeOITFS.js @@ -0,0 +1,36 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * Compositing for Weighted Blended Order-Independent Transparency. See:\n\ + * - http://jcgt.org/published/0002/02/09/\n\ + * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html\n\ + */\n\ +\n\ +uniform sampler2D u_opaque;\n\ +uniform sampler2D u_accumulation;\n\ +uniform sampler2D u_revealage;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main()\n\ +{\n\ + vec4 opaque = texture2D(u_opaque, v_textureCoordinates);\n\ + vec4 accum = texture2D(u_accumulation, v_textureCoordinates);\n\ + float r = texture2D(u_revealage, v_textureCoordinates).r;\n\ +\n\ +#ifdef MRT\n\ + vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n\ +#else\n\ + vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n\ +#endif\n\ +\n\ + gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n\ +\n\ + if (opaque != czm_backgroundColor)\n\ + {\n\ + gl_FragColor.a = 1.0;\n\ + }\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/DepthPlaneFS.js b/Source/Shaders/DepthPlaneFS.js new file mode 100644 index 000000000000..eaea60b5afa4 --- /dev/null +++ b/Source/Shaders/DepthPlaneFS.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec4 positionEC;\n\ +\n\ +void main()\n\ +{\n\ + // TODO: make arbitrary ellipsoid\n\ + czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n\ +\n\ + vec3 direction = normalize(positionEC.xyz);\n\ + czm_ray ray = czm_ray(vec3(0.0), direction);\n\ +\n\ + czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\n\ + if (!czm_isEmpty(intersection))\n\ + {\n\ + gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n\ + }\n\ + else\n\ + {\n\ + discard;\n\ + }\n\ +\n\ + czm_writeLogDepth();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/DepthPlaneVS.js b/Source/Shaders/DepthPlaneVS.js new file mode 100644 index 000000000000..11f21b81bfac --- /dev/null +++ b/Source/Shaders/DepthPlaneVS.js @@ -0,0 +1,16 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec4 position;\n\ +\n\ +varying vec4 positionEC;\n\ +\n\ +void main()\n\ +{\n\ + positionEC = czm_modelView * position;\n\ + gl_Position = czm_projection * positionEC;\n\ +\n\ + czm_vertexLogDepth();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/EllipsoidFS.js b/Source/Shaders/EllipsoidFS.js new file mode 100644 index 000000000000..6aab4f4408fa --- /dev/null +++ b/Source/Shaders/EllipsoidFS.js @@ -0,0 +1,116 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef WRITE_DEPTH\n\ +#ifdef GL_EXT_frag_depth\n\ +#extension GL_EXT_frag_depth : enable\n\ +#endif\n\ +#endif\n\ +\n\ +uniform vec3 u_radii;\n\ +uniform vec3 u_oneOverEllipsoidRadiiSquared;\n\ +\n\ +varying vec3 v_positionEC;\n\ +\n\ +vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n\ +{\n\ + vec3 positionEC = czm_pointAlongRay(ray, intersection);\n\ + vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\n\ + vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\n\ + vec3 sphericalNormal = normalize(positionMC / u_radii);\n\ + vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates\n\ + vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordiantes\n\ +\n\ + vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\n\ + vec3 positionToEyeEC = -positionEC;\n\ +\n\ + czm_materialInput materialInput;\n\ + materialInput.s = st.s;\n\ + materialInput.st = st;\n\ + materialInput.str = (positionMC + u_radii) / u_radii;\n\ + materialInput.normalEC = normalEC;\n\ + materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n\ + materialInput.positionToEyeEC = positionToEyeEC;\n\ + czm_material material = czm_getMaterial(materialInput);\n\ +\n\ +#ifdef ONLY_SUN_LIGHTING\n\ + return czm_private_phong(normalize(positionToEyeEC), material);\n\ +#else\n\ + return czm_phong(normalize(positionToEyeEC), material);\n\ +#endif\n\ +}\n\ +\n\ +void main()\n\ +{\n\ + // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii\n\ + // in the vertex shader. Only when it is larger than some constant, march along the ray.\n\ + // Otherwise perform one intersection test which will be the common case.\n\ +\n\ + // Test if the ray intersects a sphere with the ellipsoid's maximum radius.\n\ + // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test\n\ + // may cause false negatives. This will discard fragments before marching the ray forward.\n\ + float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\n\ + vec3 direction = normalize(v_positionEC);\n\ + vec3 ellipsoidCenter = czm_modelView[3].xyz;\n\ +\n\ + float t1 = -1.0;\n\ + float t2 = -1.0;\n\ +\n\ + float b = -2.0 * dot(direction, ellipsoidCenter);\n\ + float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\n\ +\n\ + float discriminant = b * b - 4.0 * c;\n\ + if (discriminant >= 0.0) {\n\ + t1 = (-b - sqrt(discriminant)) * 0.5;\n\ + t2 = (-b + sqrt(discriminant)) * 0.5;\n\ + }\n\ +\n\ + if (t1 < 0.0 && t2 < 0.0) {\n\ + discard;\n\ + }\n\ +\n\ + float t = min(t1, t2);\n\ + if (t < 0.0) {\n\ + t = 0.0;\n\ + }\n\ +\n\ + // March ray forward to intersection with larger sphere and find\n\ + // actual intersection point with ellipsoid.\n\ + czm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\n\ + czm_ray ray = czm_ray(t * direction, direction);\n\ + czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\n\ +\n\ + if (czm_isEmpty(intersection))\n\ + {\n\ + discard;\n\ + }\n\ +\n\ + // If the viewer is outside, compute outsideFaceColor, with normals facing outward.\n\ + vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\n\ +\n\ + // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.\n\ + vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\n\ +\n\ + gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\n\ + gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n\ +\n\ +#ifdef WRITE_DEPTH\n\ +#ifdef GL_EXT_frag_depth\n\ + t = (intersection.start != 0.0) ? intersection.start : intersection.stop;\n\ + vec3 positionEC = czm_pointAlongRay(ray, t);\n\ + vec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n\ +#ifdef LOG_DEPTH\n\ + czm_writeLogDepth(1.0 + positionCC.w);\n\ +#else\n\ + float z = positionCC.z / positionCC.w;\n\ +\n\ + float n = czm_depthRange.near;\n\ + float f = czm_depthRange.far;\n\ +\n\ + gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n\ +#endif\n\ +#endif\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/EllipsoidVS.js b/Source/Shaders/EllipsoidVS.js new file mode 100644 index 000000000000..ee5f9e8a0d71 --- /dev/null +++ b/Source/Shaders/EllipsoidVS.js @@ -0,0 +1,31 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position;\n\ +\n\ +uniform vec3 u_radii;\n\ +\n\ +varying vec3 v_positionEC;\n\ +\n\ +void main()\n\ +{\n\ + // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.\n\ + // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,\n\ + // but doing it here allows us to change the radii without rewriting the vertex data, and\n\ + // allows all ellipsoids to reuse the same vertex data.\n\ + vec4 p = vec4(u_radii * position, 1.0);\n\ +\n\ + v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates\n\ + gl_Position = czm_modelViewProjection * p; // position in clip coordinates\n\ +\n\ + // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums\n\ + // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the\n\ + // ellipsoid (does not write depth) that was rendered in the farther frustum.\n\ + //\n\ + // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates\n\ + // artifacts since some fragments can be alpha blended twice. This is solved by only rendering\n\ + // the ellipsoid in the closest frustum to the viewer.\n\ + gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/GlobeFS.js b/Source/Shaders/GlobeFS.js new file mode 100644 index 000000000000..cb0a4c313092 --- /dev/null +++ b/Source/Shaders/GlobeFS.js @@ -0,0 +1,348 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "//#define SHOW_TILE_BOUNDARIES\n\ +uniform vec4 u_initialColor;\n\ +\n\ +#if TEXTURE_UNITS > 0\n\ +uniform sampler2D u_dayTextures[TEXTURE_UNITS];\n\ +uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n\ +uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n\ +\n\ +#ifdef APPLY_ALPHA\n\ +uniform float u_dayTextureAlpha[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_SPLIT\n\ +uniform float u_dayTextureSplit[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_BRIGHTNESS\n\ +uniform float u_dayTextureBrightness[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_CONTRAST\n\ +uniform float u_dayTextureContrast[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_HUE\n\ +uniform float u_dayTextureHue[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_SATURATION\n\ +uniform float u_dayTextureSaturation[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef APPLY_GAMMA\n\ +uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n\ +#endif\n\ +\n\ +#ifdef SHOW_REFLECTIVE_OCEAN\n\ +uniform sampler2D u_waterMask;\n\ +uniform vec4 u_waterMaskTranslationAndScale;\n\ +uniform float u_zoomedOutOceanSpecularIntensity;\n\ +#endif\n\ +\n\ +#ifdef SHOW_OCEAN_WAVES\n\ +uniform sampler2D u_oceanNormalMap;\n\ +#endif\n\ +\n\ +#ifdef ENABLE_DAYNIGHT_SHADING\n\ +uniform vec2 u_lightingFadeDistance;\n\ +#endif\n\ +\n\ +#ifdef ENABLE_CLIPPING_PLANES\n\ +uniform sampler2D u_clippingPlanes;\n\ +uniform mat4 u_clippingPlanesMatrix;\n\ +uniform vec4 u_clippingPlanesEdgeStyle;\n\ +#endif\n\ +\n\ +#if defined(FOG) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\n\ +uniform float u_minimumBrightness;\n\ +#endif\n\ +\n\ +varying vec3 v_positionMC;\n\ +varying vec3 v_positionEC;\n\ +varying vec3 v_textureCoordinates;\n\ +varying vec3 v_normalMC;\n\ +varying vec3 v_normalEC;\n\ +\n\ +#ifdef APPLY_MATERIAL\n\ +varying float v_height;\n\ +varying float v_slope;\n\ +#endif\n\ +\n\ +#ifdef FOG\n\ +varying float v_distance;\n\ +varying vec3 v_rayleighColor;\n\ +varying vec3 v_mieColor;\n\ +#endif\n\ +\n\ +vec4 sampleAndBlend(\n\ + vec4 previousColor,\n\ + sampler2D textureToSample,\n\ + vec2 tileTextureCoordinates,\n\ + vec4 textureCoordinateRectangle,\n\ + vec4 textureCoordinateTranslationAndScale,\n\ + float textureAlpha,\n\ + float textureBrightness,\n\ + float textureContrast,\n\ + float textureHue,\n\ + float textureSaturation,\n\ + float textureOneOverGamma,\n\ + float split)\n\ +{\n\ + // This crazy step stuff sets the alpha to 0.0 if this following condition is true:\n\ + // tileTextureCoordinates.s < textureCoordinateRectangle.s ||\n\ + // tileTextureCoordinates.s > textureCoordinateRectangle.p ||\n\ + // tileTextureCoordinates.t < textureCoordinateRectangle.t ||\n\ + // tileTextureCoordinates.t > textureCoordinateRectangle.q\n\ + // In other words, the alpha is zero if the fragment is outside the rectangle\n\ + // covered by this texture. Would an actual 'if' yield better performance?\n\ + vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\n\ + textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\ +\n\ + alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\n\ + textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\ +\n\ + vec2 translation = textureCoordinateTranslationAndScale.xy;\n\ + vec2 scale = textureCoordinateTranslationAndScale.zw;\n\ + vec2 textureCoordinates = tileTextureCoordinates * scale + translation;\n\ + vec4 value = texture2D(textureToSample, textureCoordinates);\n\ + vec3 color = value.rgb;\n\ + float alpha = value.a;\n\ +\n\ +#ifdef APPLY_SPLIT\n\ + float splitPosition = czm_imagerySplitPosition;\n\ + // Split to the left\n\ + if (split < 0.0 && gl_FragCoord.x > splitPosition) {\n\ + alpha = 0.0;\n\ + }\n\ + // Split to the right\n\ + else if (split > 0.0 && gl_FragCoord.x < splitPosition) {\n\ + alpha = 0.0;\n\ + }\n\ +#endif\n\ +\n\ +#ifdef APPLY_BRIGHTNESS\n\ + color = mix(vec3(0.0), color, textureBrightness);\n\ +#endif\n\ +\n\ +#ifdef APPLY_CONTRAST\n\ + color = mix(vec3(0.5), color, textureContrast);\n\ +#endif\n\ +\n\ +#ifdef APPLY_HUE\n\ + color = czm_hue(color, textureHue);\n\ +#endif\n\ +\n\ +#ifdef APPLY_SATURATION\n\ + color = czm_saturation(color, textureSaturation);\n\ +#endif\n\ +\n\ +#ifdef APPLY_GAMMA\n\ + color = pow(color, vec3(textureOneOverGamma));\n\ +#endif\n\ +\n\ + float sourceAlpha = alpha * textureAlpha;\n\ + float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\n\ + vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\n\ + return vec4(outColor, outAlpha);\n\ +}\n\ +\n\ +vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates);\n\ +vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\n\ +\n\ +void main()\n\ +{\n\ +#ifdef ENABLE_CLIPPING_PLANES\n\ + float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n\ +#endif\n\ +\n\ + // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0\n\ + // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the\n\ + // fragments on the edges of tiles even though the vertex shader is outputting\n\ + // coordinates strictly in the 0-1 range.\n\ + vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n\ +\n\ +#ifdef SHOW_TILE_BOUNDARIES\n\ + if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\n\ + v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n\ + {\n\ + color = vec4(1.0, 0.0, 0.0, 1.0);\n\ + }\n\ +#endif\n\ +\n\ +#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\n\ + vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates\n\ + vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes\n\ +#endif\n\ +\n\ +#ifdef SHOW_REFLECTIVE_OCEAN\n\ + vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\n\ + vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\n\ + vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\n\ + waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\n\ +\n\ + float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\n\ +\n\ + if (mask > 0.0)\n\ + {\n\ + mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\n\ +\n\ + vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\n\ + vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\n\ +\n\ + vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\n\ +\n\ + color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n\ + }\n\ +#endif\n\ +\n\ +#ifdef APPLY_MATERIAL\n\ + czm_materialInput materialInput;\n\ + materialInput.st = v_textureCoordinates.st;\n\ + materialInput.normalEC = normalize(v_normalEC);\n\ + materialInput.slope = v_slope;\n\ + materialInput.height = v_height;\n\ + czm_material material = czm_getMaterial(materialInput);\n\ + color.xyz = mix(color.xyz, material.diffuse, material.alpha);\n\ +#endif\n\ +\n\ +#ifdef ENABLE_VERTEX_LIGHTING\n\ + float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\n\ + vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\ +#elif defined(ENABLE_DAYNIGHT_SHADING)\n\ + float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\n\ + float cameraDist = length(czm_view[3]);\n\ + float fadeOutDist = u_lightingFadeDistance.x;\n\ + float fadeInDist = u_lightingFadeDistance.y;\n\ + float t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n\ + diffuseIntensity = mix(1.0, diffuseIntensity, t);\n\ + vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\ +#else\n\ + vec4 finalColor = color;\n\ +#endif\n\ +\n\ +#ifdef ENABLE_CLIPPING_PLANES\n\ + vec4 clippingPlanesEdgeColor = vec4(1.0);\n\ + clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\n\ + float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\n\ +\n\ + if (clipDistance < clippingPlanesEdgeWidth)\n\ + {\n\ + finalColor = clippingPlanesEdgeColor;\n\ + }\n\ +#endif\n\ +\n\ +#ifdef FOG\n\ + const float fExposure = 2.0;\n\ + vec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\n\ + fogColor = vec3(1.0) - exp(-fExposure * fogColor);\n\ +\n\ +#if defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)\n\ + float darken = clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), u_minimumBrightness, 1.0);\n\ + fogColor *= darken;\n\ +#endif\n\ +\n\ + gl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n\ +#else\n\ + gl_FragColor = finalColor;\n\ +#endif\n\ +}\n\ +\n\ +#ifdef SHOW_REFLECTIVE_OCEAN\n\ +\n\ +float waveFade(float edge0, float edge1, float x)\n\ +{\n\ + float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\ + return pow(1.0 - y, 5.0);\n\ +}\n\ +\n\ +float linearFade(float edge0, float edge1, float x)\n\ +{\n\ + return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\ +}\n\ +\n\ +// Based on water rendering by Jonas Wagner:\n\ +// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\ +\n\ +// low altitude wave settings\n\ +const float oceanFrequencyLowAltitude = 825000.0;\n\ +const float oceanAnimationSpeedLowAltitude = 0.004;\n\ +const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\n\ +const float oceanSpecularIntensity = 0.5;\n\ +\n\ +// high altitude wave settings\n\ +const float oceanFrequencyHighAltitude = 125000.0;\n\ +const float oceanAnimationSpeedHighAltitude = 0.008;\n\ +const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\n\ +\n\ +vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n\ +{\n\ + vec3 positionToEyeEC = -positionEyeCoordinates;\n\ + float positionToEyeECLength = length(positionToEyeEC);\n\ +\n\ + // The double normalize below works around a bug in Firefox on Android devices.\n\ + vec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\n\ +\n\ + // Fade out the waves as the camera moves far from the surface.\n\ + float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n\ +\n\ +#ifdef SHOW_OCEAN_WAVES\n\ + // high altitude waves\n\ + float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\n\ + vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\n\ + vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\n\ +\n\ + // low altitude waves\n\ + time = czm_frameNumber * oceanAnimationSpeedLowAltitude;\n\ + noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\n\ + vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\n\ +\n\ + // blend the 2 wave layers based on distance to surface\n\ + float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\n\ + float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\n\ + vec3 normalTangentSpace =\n\ + (highAltitudeFade * normalTangentSpaceHighAltitude) +\n\ + (lowAltitudeFade * normalTangentSpaceLowAltitude);\n\ + normalTangentSpace = normalize(normalTangentSpace);\n\ +\n\ + // fade out the normal perturbation as we move farther from the water surface\n\ + normalTangentSpace.xy *= waveIntensity;\n\ + normalTangentSpace = normalize(normalTangentSpace);\n\ +#else\n\ + vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n\ +#endif\n\ +\n\ + vec3 normalEC = enuToEye * normalTangentSpace;\n\ +\n\ + const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\n\ +\n\ + // Use diffuse light to highlight the waves\n\ + float diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\n\ + vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n\ +\n\ +#ifdef SHOW_OCEAN_WAVES\n\ + // Where diffuse light is low or non-existent, use wave highlights based solely on\n\ + // the wave bumpiness and no particular light direction.\n\ + float tsPerturbationRatio = normalTangentSpace.z;\n\ + vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n\ +#else\n\ + vec3 nonDiffuseHighlight = vec3(0.0);\n\ +#endif\n\ +\n\ + // Add specular highlights in 3D, and in all modes when zoomed in.\n\ + float specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\n\ + float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\n\ + float specular = specularIntensity * surfaceReflectance;\n\ +\n\ + return vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n\ +}\n\ +\n\ +#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/GlobeVS.js b/Source/Shaders/GlobeVS.js new file mode 100644 index 000000000000..4c1a63ec7901 --- /dev/null +++ b/Source/Shaders/GlobeVS.js @@ -0,0 +1,188 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef QUANTIZATION_BITS12\n\ +attribute vec4 compressed0;\n\ +attribute float compressed1;\n\ +#else\n\ +attribute vec4 position3DAndHeight;\n\ +attribute vec4 textureCoordAndEncodedNormals;\n\ +#endif\n\ +\n\ +uniform vec3 u_center3D;\n\ +uniform mat4 u_modifiedModelView;\n\ +uniform mat4 u_modifiedModelViewProjection;\n\ +uniform vec4 u_tileRectangle;\n\ +\n\ +// Uniforms for 2D Mercator projection\n\ +uniform vec2 u_southAndNorthLatitude;\n\ +uniform vec2 u_southMercatorYAndOneOverHeight;\n\ +\n\ +varying vec3 v_positionMC;\n\ +varying vec3 v_positionEC;\n\ +\n\ +varying vec3 v_textureCoordinates;\n\ +varying vec3 v_normalMC;\n\ +varying vec3 v_normalEC;\n\ +\n\ +#ifdef APPLY_MATERIAL\n\ +varying float v_slope;\n\ +varying float v_height;\n\ +#endif\n\ +\n\ +#ifdef FOG\n\ +varying float v_distance;\n\ +varying vec3 v_mieColor;\n\ +varying vec3 v_rayleighColor;\n\ +#endif\n\ +\n\ +// These functions are generated at runtime.\n\ +vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\n\ +float get2DYPositionFraction(vec2 textureCoordinates);\n\ +\n\ +vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n\ +{\n\ + return u_modifiedModelViewProjection * vec4(position, 1.0);\n\ +}\n\ +\n\ +float get2DMercatorYPositionFraction(vec2 textureCoordinates)\n\ +{\n\ + // The width of a tile at level 11, in radians and assuming a single root tile, is\n\ + // 2.0 * czm_pi / pow(2.0, 11.0)\n\ + // We want to just linearly interpolate the 2D position from the texture coordinates\n\ + // when we're at this level or higher. The constant below is the expression\n\ + // above evaluated and then rounded up at the 4th significant digit.\n\ + const float maxTileWidth = 0.003068;\n\ + float positionFraction = textureCoordinates.y;\n\ + float southLatitude = u_southAndNorthLatitude.x;\n\ + float northLatitude = u_southAndNorthLatitude.y;\n\ + if (northLatitude - southLatitude > maxTileWidth)\n\ + {\n\ + float southMercatorY = u_southMercatorYAndOneOverHeight.x;\n\ + float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\n\ +\n\ + float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\n\ + currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\n\ + positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n\ + }\n\ + return positionFraction;\n\ +}\n\ +\n\ +float get2DGeographicYPositionFraction(vec2 textureCoordinates)\n\ +{\n\ + return textureCoordinates.y;\n\ +}\n\ +\n\ +vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n\ +{\n\ + float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\ + vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\ + return u_modifiedModelViewProjection * rtcPosition2D;\n\ +}\n\ +\n\ +vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n\ +{\n\ + return getPositionPlanarEarth(position, 0.0, textureCoordinates);\n\ +}\n\ +\n\ +vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n\ +{\n\ + return getPositionPlanarEarth(position, height, textureCoordinates);\n\ +}\n\ +\n\ +vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n\ +{\n\ + // We do not do RTC while morphing, so there is potential for jitter.\n\ + // This is unlikely to be noticeable, though.\n\ + vec3 position3DWC = position + u_center3D;\n\ + float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\ + vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\ + vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n\ + return czm_modelViewProjection * morphPosition;\n\ +}\n\ +\n\ +#ifdef QUANTIZATION_BITS12\n\ +uniform vec2 u_minMaxHeight;\n\ +uniform mat4 u_scaleAndBias;\n\ +#endif\n\ +\n\ +void main()\n\ +{\n\ +#ifdef QUANTIZATION_BITS12\n\ + vec2 xy = czm_decompressTextureCoordinates(compressed0.x);\n\ + vec2 zh = czm_decompressTextureCoordinates(compressed0.y);\n\ + vec3 position = vec3(xy, zh.x);\n\ + float height = zh.y;\n\ + vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\n\ +\n\ + height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\n\ + position = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n\ +\n\ +#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n\ + float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\ + float encodedNormal = compressed1;\n\ +#elif defined(INCLUDE_WEB_MERCATOR_Y)\n\ + float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\ + float encodedNormal = 0.0;\n\ +#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\n\ + float webMercatorT = textureCoordinates.y;\n\ + float encodedNormal = compressed0.w;\n\ +#else\n\ + float webMercatorT = textureCoordinates.y;\n\ + float encodedNormal = 0.0;\n\ +#endif\n\ +\n\ +#else\n\ + // A single float per element\n\ + vec3 position = position3DAndHeight.xyz;\n\ + float height = position3DAndHeight.w;\n\ + vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n\ +\n\ +#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n\ + float webMercatorT = textureCoordAndEncodedNormals.z;\n\ + float encodedNormal = textureCoordAndEncodedNormals.w;\n\ +#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\ + float webMercatorT = textureCoordinates.y;\n\ + float encodedNormal = textureCoordAndEncodedNormals.z;\n\ +#elif defined(INCLUDE_WEB_MERCATOR_Y)\n\ + float webMercatorT = textureCoordAndEncodedNormals.z;\n\ + float encodedNormal = 0.0;\n\ +#else\n\ + float webMercatorT = textureCoordinates.y;\n\ + float encodedNormal = 0.0;\n\ +#endif\n\ +\n\ +#endif\n\ +\n\ + vec3 position3DWC = position + u_center3D;\n\ + gl_Position = getPosition(position, height, textureCoordinates);\n\ +\n\ + v_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n\ +\n\ +#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\ + v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n\ + v_positionMC = position3DWC; // position in model coordinates\n\ + vec3 normalMC = czm_octDecode(encodedNormal);\n\ + v_normalMC = normalMC;\n\ + v_normalEC = czm_normal3D * v_normalMC;\n\ +#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION)\n\ + v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n\ + v_positionMC = position3DWC; // position in model coordinates\n\ +#endif\n\ +\n\ +#ifdef FOG\n\ + AtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(position3DWC);\n\ + v_mieColor = atmosColor.mie;\n\ + v_rayleighColor = atmosColor.rayleigh;\n\ + v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n\ +#endif\n\ +\n\ +#ifdef APPLY_MATERIAL\n\ + vec3 finalNormal = normalMC;\n\ + vec3 ellipsoidNormal = normalize(position3DWC.xyz);\n\ + v_slope = abs(dot(ellipsoidNormal, finalNormal));\n\ + v_height = height;\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/GroundAtmosphere.js b/Source/Shaders/GroundAtmosphere.js new file mode 100644 index 000000000000..15e476224754 --- /dev/null +++ b/Source/Shaders/GroundAtmosphere.js @@ -0,0 +1,134 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/*!\n\ + * Atmosphere code:\n\ + *\n\ + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ + * All rights reserved.\n\ + * \n\ + * Redistribution and use in source and binary forms, with or without\n\ + * modification, are permitted provided that the following conditions\n\ + * are met:\n\ + * \n\ + * * Redistributions of source code must retain the above copyright notice,\n\ + * this list of conditions and the following disclaimer.\n\ + * * Redistributions in binary form must reproduce the above copyright notice,\n\ + * this list of conditions and the following disclaimer in the documentation\n\ + * and/or other materials provided with the distribution.\n\ + * * Neither the name of the project nor the names of its contributors may be\n\ + * used to endorse or promote products derived from this software without\n\ + * specific prior written permission.\n\ + * \n\ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ + *\n\ + * Modifications made by Analytical Graphics, Inc.\n\ + */\n\ + \n\ + // Atmosphere:\n\ + // Code: http://sponeil.net/\n\ + // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ +\n\ +const float fInnerRadius = 6378137.0;\n\ +const float fOuterRadius = 6378137.0 * 1.025;\n\ +const float fOuterRadius2 = fOuterRadius * fOuterRadius;\n\ +\n\ +const float Kr = 0.0025;\n\ +const float Km = 0.0015;\n\ +const float ESun = 15.0;\n\ +\n\ +const float fKrESun = Kr * ESun;\n\ +const float fKmESun = Km * ESun;\n\ +const float fKr4PI = Kr * 4.0 * czm_pi;\n\ +const float fKm4PI = Km * 4.0 * czm_pi;\n\ +\n\ +const float fScale = 1.0 / (fOuterRadius - fInnerRadius);\n\ +const float fScaleDepth = 0.25;\n\ +const float fScaleOverScaleDepth = fScale / fScaleDepth;\n\ +\n\ +struct AtmosphereColor\n\ +{\n\ + vec3 mie;\n\ + vec3 rayleigh;\n\ +};\n\ +\n\ +const int nSamples = 2;\n\ +const float fSamples = 2.0;\n\ +\n\ +float scale(float fCos)\n\ +{\n\ + float x = 1.0 - fCos;\n\ + return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n\ +}\n\ +\n\ +AtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos)\n\ +{\n\ + vec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\n\ +\n\ + // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\n\ + vec3 v3Ray = v3Pos - czm_viewerPositionWC;\n\ + float fFar = length(v3Ray);\n\ + v3Ray /= fFar;\n\ + \n\ + float fCameraHeight = length(czm_viewerPositionWC);\n\ + float fCameraHeight2 = fCameraHeight * fCameraHeight;\n\ +\n\ + // This next line is an ANGLE workaround. It is equivalent to B = 2.0 * dot(czm_viewerPositionWC, v3Ray), \n\ + // which is what it should be, but there are problems at the poles.\n\ + float B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\n\ + float C = fCameraHeight2 - fOuterRadius2;\n\ + float fDet = max(0.0, B*B - 4.0 * C);\n\ + float fNear = 0.5 * (-B - sqrt(fDet));\n\ +\n\ + // Calculate the ray's starting position, then calculate its scattering offset\n\ + vec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\n\ + fFar -= fNear;\n\ + float fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\n\ + \n\ + // The light angle based on the sun position would be:\n\ + // dot(czm_sunDirectionWC, v3Pos) / length(v3Pos);\n\ + // We want the atmosphere to be uniform over the globe so it is set to 1.0.\n\ + float fLightAngle = 1.0;\n\ + float fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\n\ + float fCameraScale = scale(fCameraAngle);\n\ + float fLightScale = scale(fLightAngle);\n\ + float fCameraOffset = fDepth*fCameraScale;\n\ + float fTemp = (fLightScale + fCameraScale);\n\ +\n\ + // Initialize the scattering loop variables\n\ + float fSampleLength = fFar / fSamples;\n\ + float fScaledLength = fSampleLength * fScale;\n\ + vec3 v3SampleRay = v3Ray * fSampleLength;\n\ + vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\n\ +\n\ + // Now loop through the sample rays\n\ + vec3 v3FrontColor = vec3(0.0);\n\ + vec3 v3Attenuate = vec3(0.0);\n\ + for(int i=0; i 0.5 + halfWidth)\n\ + {\n\ + d1 = abs(st.s - base);\n\ + }\n\ + float d2 = abs(st.t - ptOnUpperLine);\n\ + float d3 = abs(st.t - ptOnLowerLine);\n\ + dist = min(min(d1, d2), d3);\n\ + }\n\ +\n\ + vec4 outsideColor = vec4(0.0);\n\ + vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\n\ + vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\n\ +\n\ + material.diffuse = outColor.rgb;\n\ + material.alpha = outColor.a;\n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineDashMaterial.js b/Source/Shaders/Materials/PolylineDashMaterial.js new file mode 100644 index 000000000000..72be9e63bb80 --- /dev/null +++ b/Source/Shaders/Materials/PolylineDashMaterial.js @@ -0,0 +1,42 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform vec4 color;\n\ +uniform vec4 gapColor;\n\ +uniform float dashLength;\n\ +uniform float dashPattern;\n\ +varying float v_polylineAngle;\n\ +\n\ +const float maskLength = 16.0;\n\ +\n\ +mat2 rotate(float rad) {\n\ + float c = cos(rad);\n\ + float s = sin(rad);\n\ + return mat2(\n\ + c, s,\n\ + -s, c\n\ + );\n\ +}\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ +\n\ + vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\n\ +\n\ + // Get the relative position within the dash from 0 to 1\n\ + float dashPosition = fract(pos.x / dashLength);\n\ + // Figure out the mask index.\n\ + float maskIndex = floor(dashPosition * maskLength);\n\ + // Test the bit mask.\n\ + float maskTest = floor(dashPattern / pow(2.0, maskIndex));\n\ + vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\n\ + if (fragColor.a < 0.005) { // matches 0/255 and 1/255\n\ + discard;\n\ + }\n\ +\n\ + material.emission = fragColor.rgb;\n\ + material.alpha = fragColor.a;\n\ + return material;\n\ +}"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineGlowMaterial.js b/Source/Shaders/Materials/PolylineGlowMaterial.js new file mode 100644 index 000000000000..3f11d3eee03f --- /dev/null +++ b/Source/Shaders/Materials/PolylineGlowMaterial.js @@ -0,0 +1,22 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform vec4 color;\n\ +uniform float glowPower;\n\ +\n\ +varying float v_width;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ +\n\ + vec2 st = materialInput.st;\n\ + float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\n\ +\n\ + material.emission = max(vec3(glow - 1.0 + color.rgb), color.rgb);\n\ + material.alpha = clamp(0.0, 1.0, glow) * color.a;\n\ +\n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineOutlineMaterial.js b/Source/Shaders/Materials/PolylineOutlineMaterial.js new file mode 100644 index 000000000000..af71e2b4f30d --- /dev/null +++ b/Source/Shaders/Materials/PolylineOutlineMaterial.js @@ -0,0 +1,33 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform vec4 color;\n\ +uniform vec4 outlineColor;\n\ +uniform float outlineWidth;\n\ +\n\ +varying float v_width;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ + \n\ + vec2 st = materialInput.st;\n\ + float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\n\ + float b = step(0.5 - halfInteriorWidth, st.t);\n\ + b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\n\ + \n\ + // Find the distance from the closest separator (region between two colors)\n\ + float d1 = abs(st.t - (0.5 - halfInteriorWidth));\n\ + float d2 = abs(st.t - (0.5 + halfInteriorWidth));\n\ + float dist = min(d1, d2);\n\ + \n\ + vec4 currentColor = mix(outlineColor, color, b);\n\ + vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\n\ + \n\ + material.diffuse = outColor.rgb;\n\ + material.alpha = outColor.a;\n\ + \n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/RimLightingMaterial.js b/Source/Shaders/Materials/RimLightingMaterial.js new file mode 100644 index 000000000000..8d1397f9a171 --- /dev/null +++ b/Source/Shaders/Materials/RimLightingMaterial.js @@ -0,0 +1,23 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform vec4 color;\n\ +uniform vec4 rimColor;\n\ +uniform float width;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ +\n\ + // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n\ + float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\n\ + float s = smoothstep(1.0 - width, 1.0, d);\n\ +\n\ + material.diffuse = color.rgb;\n\ + material.emission = rimColor.rgb * s; \n\ + material.alpha = mix(color.a, rimColor.a, s);\n\ +\n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/SlopeRampMaterial.js b/Source/Shaders/Materials/SlopeRampMaterial.js new file mode 100644 index 000000000000..0cfad106b4c8 --- /dev/null +++ b/Source/Shaders/Materials/SlopeRampMaterial.js @@ -0,0 +1,15 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D image;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ + vec4 rampColor = texture2D(image, vec2(materialInput.slope, 0.5));\n\ + material.diffuse = rampColor.rgb;\n\ + material.alpha = rampColor.a;\n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/StripeMaterial.js b/Source/Shaders/Materials/StripeMaterial.js new file mode 100644 index 000000000000..84529a2f7f7f --- /dev/null +++ b/Source/Shaders/Materials/StripeMaterial.js @@ -0,0 +1,28 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform vec4 evenColor;\n\ +uniform vec4 oddColor;\n\ +uniform float offset;\n\ +uniform float repeat;\n\ +uniform bool horizontal;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ +\n\ + // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)\n\ + float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\n\ + float value = fract((coord - offset) * (repeat * 0.5));\n\ + float dist = min(value, min(abs(value - 0.5), 1.0 - value));\n\ + \n\ + vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\n\ + vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\n\ + \n\ + material.diffuse = color.rgb;\n\ + material.alpha = color.a;\n\ + \n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/Materials/Water.js b/Source/Shaders/Materials/Water.js new file mode 100644 index 000000000000..ca6cc92072ba --- /dev/null +++ b/Source/Shaders/Materials/Water.js @@ -0,0 +1,61 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "// Thanks for the contribution Jonas\n\ +// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\ +\n\ +uniform sampler2D specularMap;\n\ +uniform sampler2D normalMap;\n\ +uniform vec4 baseWaterColor;\n\ +uniform vec4 blendColor;\n\ +uniform float frequency;\n\ +uniform float animationSpeed;\n\ +uniform float amplitude;\n\ +uniform float specularIntensity;\n\ +uniform float fadeFactor;\n\ +\n\ +czm_material czm_getMaterial(czm_materialInput materialInput)\n\ +{\n\ + czm_material material = czm_getDefaultMaterial(materialInput);\n\ +\n\ + float time = czm_frameNumber * animationSpeed;\n\ + \n\ + // fade is a function of the distance from the fragment and the frequency of the waves\n\ + float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\n\ + \n\ + float specularMapValue = texture2D(specularMap, materialInput.st).r;\n\ + \n\ + // note: not using directional motion at this time, just set the angle to 0.0;\n\ + vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\n\ + vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\n\ + \n\ + // fade out the normal perturbation as we move further from the water surface\n\ + normalTangentSpace.xy /= fade;\n\ + \n\ + // attempt to fade out the normal perturbation as we approach non water areas (low specular map value)\n\ + normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\n\ + \n\ + normalTangentSpace = normalize(normalTangentSpace);\n\ + \n\ + // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane\n\ + float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\n\ + \n\ + // fade out water effect as specular map value decreases\n\ + material.alpha = specularMapValue;\n\ + \n\ + // base color is a blend of the water and non-water color based on the value from the specular map\n\ + // may need a uniform blend factor to better control this\n\ + material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\n\ + \n\ + // diffuse highlights are based on how perturbed the normal is\n\ + material.diffuse += (0.1 * tsPerturbationRatio);\n\ + \n\ + material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\n\ + \n\ + material.specular = specularIntensity;\n\ + material.shininess = 10.0;\n\ + \n\ + return material;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PointPrimitiveCollectionFS.js b/Source/Shaders/PointPrimitiveCollectionFS.js new file mode 100644 index 000000000000..061fbbe51bf5 --- /dev/null +++ b/Source/Shaders/PointPrimitiveCollectionFS.js @@ -0,0 +1,56 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec4 v_color;\n\ +varying vec4 v_outlineColor;\n\ +varying float v_innerPercent;\n\ +varying float v_pixelDistance;\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ +varying vec4 v_pickColor;\n\ +#endif\n\ +\n\ +void main()\n\ +{\n\ + // The distance in UV space from this fragment to the center of the point, at most 0.5.\n\ + float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n\ + // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n\ + float maxDistance = max(0.0, 0.5 - v_pixelDistance);\n\ + float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\n\ + float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\n\ +\n\ + vec4 color = mix(v_outlineColor, v_color, innerAlpha);\n\ + color.a *= wholeAlpha;\n\ +\n\ +// Fully transparent parts of the billboard are not pickable.\n\ +#if defined(RENDER_FOR_PICK) || (!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 RENDER_FOR_PICK\n\ + gl_FragColor = v_pickColor;\n\ +#else\n\ + gl_FragColor = color;\n\ +#endif\n\ +\n\ + czm_writeLogDepth();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PointPrimitiveCollectionVS.js b/Source/Shaders/PointPrimitiveCollectionVS.js new file mode 100644 index 000000000000..fef2e2aad70e --- /dev/null +++ b/Source/Shaders/PointPrimitiveCollectionVS.js @@ -0,0 +1,197 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform float u_maxTotalPointSize;\n\ +\n\ +attribute vec4 positionHighAndSize;\n\ +attribute vec4 positionLowAndOutline;\n\ +attribute vec4 compressedAttribute0; // color, outlineColor, pick color\n\ +attribute vec4 compressedAttribute1; // show, translucency by distance, some free space\n\ +attribute vec4 scaleByDistance; // near, nearScale, far, farScale\n\ +attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance\n\ +\n\ +varying vec4 v_color;\n\ +varying vec4 v_outlineColor;\n\ +varying float v_innerPercent;\n\ +varying float v_pixelDistance;\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ +varying vec4 v_pickColor;\n\ +#endif\n\ +\n\ +const float SHIFT_LEFT8 = 256.0;\n\ +const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\ +\n\ +void main()\n\ +{\n\ + // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition\n\ +\n\ + // unpack attributes\n\ + vec3 positionHigh = positionHighAndSize.xyz;\n\ + vec3 positionLow = positionLowAndOutline.xyz;\n\ + float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\n\ + float totalSize = positionHighAndSize.w + outlineWidthBothSides;\n\ + float outlinePercent = outlineWidthBothSides / totalSize;\n\ + // Scale in response to browser-zoom.\n\ + totalSize *= czm_resolutionScale;\n\ + // Add padding for anti-aliasing on both sides.\n\ + totalSize += 3.0;\n\ +\n\ + float temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\ + float show = floor(temp);\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\ + ///////////////////////////////////////////////////////////////////////////\n\ +\n\ + vec4 color;\n\ + vec4 outlineColor;\n\ +#ifdef RENDER_FOR_PICK\n\ + // compressedAttribute0.z => pickColor.rgb\n\ +\n\ + color = vec4(0.0);\n\ + outlineColor = vec4(0.0);\n\ + vec4 pickColor;\n\ + temp = compressedAttribute0.z * SHIFT_RIGHT8;\n\ + pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + temp = floor(temp) * SHIFT_RIGHT8;\n\ + pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + pickColor.r = floor(temp);\n\ +#else\n\ + // compressedAttribute0.x => color.rgb\n\ +\n\ + temp = compressedAttribute0.x * SHIFT_RIGHT8;\n\ + color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + temp = floor(temp) * SHIFT_RIGHT8;\n\ + color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + color.r = floor(temp);\n\ +\n\ + // compressedAttribute0.y => outlineColor.rgb\n\ +\n\ + temp = compressedAttribute0.y * SHIFT_RIGHT8;\n\ + outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + temp = floor(temp) * SHIFT_RIGHT8;\n\ + outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + outlineColor.r = floor(temp);\n\ +#endif\n\ +\n\ + // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a\n\ +\n\ + temp = compressedAttribute0.w * SHIFT_RIGHT8;\n\ +#ifdef RENDER_FOR_PICK\n\ + pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + pickColor = pickColor / 255.0;\n\ +#endif\n\ + temp = floor(temp) * SHIFT_RIGHT8;\n\ + outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ + outlineColor /= 255.0;\n\ + color.a = floor(temp);\n\ + color /= 255.0;\n\ +\n\ + ///////////////////////////////////////////////////////////////////////////\n\ +\n\ + vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ + vec4 positionEC = czm_modelViewRelativeToEye * p;\n\ + positionEC.xyz *= show;\n\ +\n\ + ///////////////////////////////////////////////////////////////////////////\n\ +\n\ +#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || 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\ + totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n\ +#endif\n\ + // Clamp to max point size.\n\ + totalSize = min(totalSize, u_maxTotalPointSize);\n\ + // If size is too small, push vertex behind near plane for clipping.\n\ + // Note that context.minimumAliasedPointSize \"will be at most 1.0\".\n\ + if (totalSize < 1.0)\n\ + {\n\ + positionEC.xyz = vec3(0.0);\n\ + totalSize = 1.0;\n\ + }\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.004)\n\ + {\n\ + positionEC.xyz = vec3(0.0);\n\ + }\n\ +#endif\n\ +\n\ +#ifdef DISTANCE_DISPLAY_CONDITION\n\ + float nearSq = distanceDisplayConditionAndDisableDepth.x;\n\ + float farSq = distanceDisplayConditionAndDisableDepth.y;\n\ + if (lengthSq < nearSq || lengthSq > farSq) {\n\ + positionEC.xyz = vec3(0.0);\n\ + }\n\ +#endif\n\ +\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(czm_projection * positionEC);\n\ +#endif\n\ +\n\ + vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\ + gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n\ +\n\ +#ifdef DISABLE_DEPTH_DISTANCE\n\ + float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\n\ + if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n\ + {\n\ + disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n\ + }\n\ +\n\ + if (disableDepthTestDistance != 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\ + if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n\ + {\n\ + // Position z on the near plane.\n\ + gl_Position.z = -gl_Position.w;\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(vec4(czm_currentFrustum.x));\n\ +#endif\n\ + }\n\ + }\n\ +#endif\n\ +\n\ + v_color = color;\n\ + v_color.a *= translucency;\n\ + v_outlineColor = outlineColor;\n\ + v_outlineColor.a *= translucency;\n\ +\n\ + v_innerPercent = 1.0 - outlinePercent;\n\ + v_pixelDistance = 2.0 / totalSize;\n\ + gl_PointSize = totalSize;\n\ +\n\ +#ifdef RENDER_FOR_PICK\n\ + v_pickColor = pickColor;\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PolylineCommon.js b/Source/Shaders/PolylineCommon.js new file mode 100644 index 000000000000..7fbcac6d0736 --- /dev/null +++ b/Source/Shaders/PolylineCommon.js @@ -0,0 +1,121 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "void clipLineSegmentToNearPlane(\n\ + vec3 p0,\n\ + vec3 p1,\n\ + out vec4 positionWC,\n\ + out bool clipped,\n\ + out bool culledByNearPlane)\n\ +{\n\ + culledByNearPlane = false;\n\ + clipped = false;\n\ +\n\ + vec3 p1ToP0 = p1 - p0;\n\ + float magnitude = length(p1ToP0);\n\ + vec3 direction = normalize(p1ToP0);\n\ + float endPoint0Distance = -(czm_currentFrustum.x + p0.z);\n\ + float denominator = -direction.z;\n\ +\n\ + if (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n\ + {\n\ + culledByNearPlane = true;\n\ + }\n\ + else if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n\ + {\n\ + // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)\n\ + float t = (czm_currentFrustum.x + p0.z) / denominator;\n\ + if (t < 0.0 || t > magnitude)\n\ + {\n\ + culledByNearPlane = true;\n\ + }\n\ + else\n\ + {\n\ + p0 = p0 + t * direction;\n\ + clipped = true;\n\ + }\n\ + }\n\ +\n\ + positionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n\ +}\n\ +\n\ +vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n\ +{\n\ + vec4 endPointWC, p0, p1;\n\ + bool culledByNearPlane, clipped;\n\ +\n\ +#ifdef POLYLINE_DASH\n\ + // Compute the window coordinates of the points.\n\ + vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\n\ + vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\n\ + vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\n\ +\n\ + // Determine the relative screen space direction of the line.\n\ + vec2 lineDir;\n\ + if (usePrevious) {\n\ + lineDir = normalize(positionWindow.xy - previousWindow.xy);\n\ + }\n\ + else {\n\ + lineDir = normalize(nextWindow.xy - positionWindow.xy);\n\ + }\n\ + angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)\n\ +\n\ + // Quantize the angle so it doesn't change rapidly between segments.\n\ + angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n\ +#endif\n\ +\n\ + clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\n\ + clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\n\ + clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\n\ +\n\ + if (culledByNearPlane)\n\ + {\n\ + return vec4(0.0, 0.0, 0.0, 1.0);\n\ + }\n\ +\n\ + vec2 prevWC = normalize(p0.xy - endPointWC.xy);\n\ + vec2 nextWC = normalize(p1.xy - endPointWC.xy);\n\ +\n\ + float expandWidth = width * 0.5;\n\ + vec2 direction;\n\ +\n\ + if (czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n\ + {\n\ + direction = vec2(-nextWC.y, nextWC.x);\n\ + }\n\ + else if (czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) || clipped)\n\ + {\n\ + direction = vec2(prevWC.y, -prevWC.x);\n\ + }\n\ + else\n\ + {\n\ + vec2 normal = vec2(-nextWC.y, nextWC.x);\n\ + direction = normalize((nextWC + prevWC) * 0.5);\n\ + if (dot(direction, normal) < 0.0)\n\ + {\n\ + direction = -direction;\n\ + }\n\ +\n\ + // The sine of the angle between the two vectors is given by the formula\n\ + // |a x b| = |a||b|sin(theta)\n\ + // which is\n\ + // float sinAngle = length(cross(vec3(direction, 0.0), vec3(nextWC, 0.0)));\n\ + // Because the z components of both vectors are zero, the x and y coordinate will be zero.\n\ + // Therefore, the sine of the angle is just the z component of the cross product.\n\ + float sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\n\ + expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n\ + }\n\ +\n\ + vec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\n\ + return vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n\ +}\n\ +\n\ +vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n\ +{\n\ + vec4 positionEC = czm_modelViewRelativeToEye * position;\n\ + vec4 prevEC = czm_modelViewRelativeToEye * previous;\n\ + vec4 nextEC = czm_modelViewRelativeToEye * next;\n\ + return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PolylineFS.js b/Source/Shaders/PolylineFS.js new file mode 100644 index 000000000000..5c7fdfab7735 --- /dev/null +++ b/Source/Shaders/PolylineFS.js @@ -0,0 +1,27 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef VECTOR_TILE\n\ +uniform vec4 u_highlightColor;\n\ +#endif\n\ +\n\ +varying vec2 v_st;\n\ +\n\ +void main()\n\ +{\n\ + czm_materialInput materialInput;\n\ +\n\ + materialInput.s = v_st.s;\n\ + materialInput.st = v_st;\n\ + materialInput.str = vec3(v_st, 0.0);\n\ +\n\ + czm_material material = czm_getMaterial(materialInput);\n\ + gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ +#ifdef VECTOR_TILE\n\ + gl_FragColor *= u_highlightColor;\n\ +#endif\n\ +\n\ + czm_writeLogDepth();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PolylineVS.js b/Source/Shaders/PolylineVS.js new file mode 100644 index 000000000000..a91fb42a97fa --- /dev/null +++ b/Source/Shaders/PolylineVS.js @@ -0,0 +1,108 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec3 position2DHigh;\n\ +attribute vec3 position2DLow;\n\ +attribute vec3 prevPosition3DHigh;\n\ +attribute vec3 prevPosition3DLow;\n\ +attribute vec3 prevPosition2DHigh;\n\ +attribute vec3 prevPosition2DLow;\n\ +attribute vec3 nextPosition3DHigh;\n\ +attribute vec3 nextPosition3DLow;\n\ +attribute vec3 nextPosition2DHigh;\n\ +attribute vec3 nextPosition2DLow;\n\ +attribute vec4 texCoordExpandAndBatchIndex;\n\ +\n\ +varying vec2 v_st;\n\ +varying float v_width;\n\ +varying vec4 czm_pickColor;\n\ +varying float v_polylineAngle;\n\ +\n\ +void main()\n\ +{\n\ + float texCoord = texCoordExpandAndBatchIndex.x;\n\ + float expandDir = texCoordExpandAndBatchIndex.y;\n\ + bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\n\ + float batchTableIndex = texCoordExpandAndBatchIndex.w;\n\ +\n\ + vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\n\ + float width = widthAndShow.x + 0.5;\n\ + float show = widthAndShow.y;\n\ +\n\ + if (width < 1.0)\n\ + {\n\ + show = 0.0;\n\ + }\n\ +\n\ + vec4 pickColor = batchTable_getPickColor(batchTableIndex);\n\ +\n\ + vec4 p, prev, next;\n\ + if (czm_morphTime == 1.0)\n\ + {\n\ + p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\n\ + prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\n\ + next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n\ + }\n\ + else if (czm_morphTime == 0.0)\n\ + {\n\ + p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\n\ + prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\n\ + next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n\ + }\n\ + else\n\ + {\n\ + p = czm_columbusViewMorph(\n\ + czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\n\ + czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\n\ + czm_morphTime);\n\ + prev = czm_columbusViewMorph(\n\ + czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\n\ + czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\n\ + czm_morphTime);\n\ + next = czm_columbusViewMorph(\n\ + czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\n\ + czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\n\ + czm_morphTime);\n\ + }\n\ +\n\ + #ifdef DISTANCE_DISPLAY_CONDITION\n\ + vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\n\ + vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\n\ + vec3 centerLow = centerLowAndRadius.xyz;\n\ + float radius = centerLowAndRadius.w;\n\ + vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\n\ +\n\ + float lengthSq;\n\ + if (czm_sceneMode == czm_sceneMode2D)\n\ + {\n\ + lengthSq = czm_eyeHeight2D.y;\n\ + }\n\ + else\n\ + {\n\ + vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\n\ + lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n\ + }\n\ +\n\ + float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\n\ + float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\n\ + if (lengthSq < nearSq || lengthSq > farSq)\n\ + {\n\ + show = 0.0;\n\ + }\n\ + #endif\n\ +\n\ + vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\n\ + gl_Position = czm_viewportOrthographic * positionWC * show;\n\ +\n\ + v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\n\ + v_width = width;\n\ + czm_pickColor = pickColor;\n\ +\n\ +#ifdef LOG_DEPTH\n\ + czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/AdditiveBlend.js b/Source/Shaders/PostProcessFilters/AdditiveBlend.js new file mode 100644 index 000000000000..45e2e384560e --- /dev/null +++ b/Source/Shaders/PostProcessFilters/AdditiveBlend.js @@ -0,0 +1,22 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D u_texture0;\n\ +uniform sampler2D u_texture1;\n\ +\n\ +uniform vec2 u_center;\n\ +uniform float u_radius;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main()\n\ +{\n\ + vec4 color0 = texture2D(u_texture0, v_textureCoordinates);\n\ + vec4 color1 = texture2D(u_texture1, v_textureCoordinates);\n\ + \n\ + float x = length(gl_FragCoord.xy - u_center) / u_radius;\n\ + float t = smoothstep(0.5, 0.8, x);\n\ + gl_FragColor = mix(color0 + color1, color0, t);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/BrightPass.js b/Source/Shaders/PostProcessFilters/BrightPass.js new file mode 100644 index 000000000000..54d1f649dc48 --- /dev/null +++ b/Source/Shaders/PostProcessFilters/BrightPass.js @@ -0,0 +1,35 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D u_texture;\n\ +\n\ +uniform float u_avgLuminance;\n\ +uniform float u_threshold;\n\ +uniform float u_offset;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +float key(float avg)\n\ +{\n\ + float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\n\ + return max(0.0, guess) + 0.1;\n\ +}\n\ +\n\ +// See section 9. \"The bright-pass filter\" of Realtime HDR Rendering\n\ +// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf\n\ +\n\ +void main()\n\ +{\n\ + vec4 color = texture2D(u_texture, v_textureCoordinates);\n\ + vec3 xyz = czm_RGBToXYZ(color.rgb);\n\ + float luminance = xyz.r;\n\ + \n\ + float scaledLum = key(u_avgLuminance) * luminance / u_avgLuminance;\n\ + float brightLum = max(scaledLum - u_threshold, 0.0);\n\ + float brightness = brightLum / (u_offset + brightLum);\n\ + \n\ + xyz.r = brightness;\n\ + gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/FXAA.js b/Source/Shaders/PostProcessFilters/FXAA.js new file mode 100644 index 000000000000..cefbff144e68 --- /dev/null +++ b/Source/Shaders/PostProcessFilters/FXAA.js @@ -0,0 +1,26 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "varying vec2 v_textureCoordinates;\n\ +\n\ +uniform sampler2D u_texture;\n\ +uniform vec2 u_fxaaQualityRcpFrame;\n\ +\n\ +const float fxaaQualitySubpix = 0.5;\n\ +const float fxaaQualityEdgeThreshold = 0.125;\n\ +const float fxaaQualityEdgeThresholdMin = 0.0833;\n\ +\n\ +void main()\n\ +{\n\ + vec4 color = FxaaPixelShader(\n\ + v_textureCoordinates,\n\ + u_texture,\n\ + u_fxaaQualityRcpFrame,\n\ + fxaaQualitySubpix,\n\ + fxaaQualityEdgeThreshold,\n\ + fxaaQualityEdgeThresholdMin);\n\ + float alpha = texture2D(u_texture, v_textureCoordinates).a;\n\ + gl_FragColor = vec4(color.rgb, alpha);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/GaussianBlur1D.js b/Source/Shaders/PostProcessFilters/GaussianBlur1D.js new file mode 100644 index 000000000000..197d9d2cf61d --- /dev/null +++ b/Source/Shaders/PostProcessFilters/GaussianBlur1D.js @@ -0,0 +1,42 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#define SAMPLES 8\n\ +\n\ +uniform float delta;\n\ +uniform float sigma;\n\ +uniform float direction; // 0.0 for x direction, 1.0 for y direction\n\ +\n\ +uniform sampler2D u_texture;\n\ +uniform vec2 u_step;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +// Incremental Computation of the Gaussian:\n\ +// http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html\n\ +\n\ +void main()\n\ +{\n\ + vec2 st = v_textureCoordinates;\n\ + \n\ + vec2 dir = vec2(1.0 - direction, direction);\n\ + \n\ + vec3 g;\n\ + g.x = 1.0 / (sqrt(czm_twoPi) * sigma);\n\ + g.y = exp((-0.5 * delta * delta) / (sigma * sigma));\n\ + g.z = g.y * g.y;\n\ + \n\ + vec4 result = texture2D(u_texture, st) * g.x;\n\ + for (int i = 1; i < SAMPLES; ++i)\n\ + {\n\ + g.xy *= g.yz;\n\ + \n\ + vec2 offset = float(i) * dir * u_step;\n\ + result += texture2D(u_texture, st - offset) * g.x;\n\ + result += texture2D(u_texture, st + offset) * g.x;\n\ + }\n\ + \n\ + gl_FragColor = result;\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/PassThrough.js b/Source/Shaders/PostProcessFilters/PassThrough.js new file mode 100644 index 000000000000..58b2eb36f325 --- /dev/null +++ b/Source/Shaders/PostProcessFilters/PassThrough.js @@ -0,0 +1,13 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D u_texture;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main() \n\ +{\n\ + gl_FragColor = texture2D(u_texture, v_textureCoordinates);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js new file mode 100644 index 000000000000..2aa3b374a108 --- /dev/null +++ b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js @@ -0,0 +1,57 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#extension GL_EXT_frag_depth : enable\n\ +\n\ +uniform sampler2D u_pointCloud_colorTexture;\n\ +uniform sampler2D u_pointCloud_ecAndLogDepthTexture;\n\ +uniform vec3 u_distancesAndEdlStrength;\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +vec2 neighborContribution(float log2Depth, vec2 padding)\n\ +{\n\ + vec2 depthAndLog2Depth = texture2D(u_pointCloud_ecAndLogDepthTexture, v_textureCoordinates + padding).zw;\n\ + if (depthAndLog2Depth.x == 0.0) // 0.0 is the clear value for the gbuffer\n\ + {\n\ + return vec2(0.0); // throw out this sample\n\ + }\n\ + else\n\ + {\n\ + return vec2(max(0.0, log2Depth - depthAndLog2Depth.y), 1.0);\n\ + }\n\ +}\n\ +\n\ +void main()\n\ +{\n\ + vec4 ecAlphaDepth = texture2D(u_pointCloud_ecAndLogDepthTexture, v_textureCoordinates);\n\ + if (length(ecAlphaDepth.xyz) < czm_epsilon7)\n\ + {\n\ + discard;\n\ + }\n\ +\n\ + vec4 color = texture2D(u_pointCloud_colorTexture, v_textureCoordinates);\n\ +\n\ + // sample from neighbors up, down, left, right\n\ + float distX = u_distancesAndEdlStrength.x;\n\ + float distY = u_distancesAndEdlStrength.y;\n\ +\n\ + vec2 responseAndCount = vec2(0.0);\n\ +\n\ + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, distY));\n\ + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(distX, 0));\n\ + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, -distY));\n\ + responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(-distX, 0));\n\ +\n\ + float response = responseAndCount.x / responseAndCount.y;\n\ + float shade = exp(-response * 300.0 * u_distancesAndEdlStrength.z);\n\ + color.rgb *= shade;\n\ + gl_FragColor = vec4(color);\n\ +\n\ +#ifdef LOG_DEPTH\n\ + czm_writeLogDepth(1.0 + (czm_projection * vec4(ecAlphaDepth.xyz, 1.0)).w);\n\ +#else\n\ + gl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(ecAlphaDepth.xyz, 1.0)).z;\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/ReprojectWebMercatorFS.js b/Source/Shaders/ReprojectWebMercatorFS.js new file mode 100644 index 000000000000..90fbe30a768a --- /dev/null +++ b/Source/Shaders/ReprojectWebMercatorFS.js @@ -0,0 +1,13 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "uniform sampler2D u_texture;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main()\n\ +{\n\ + gl_FragColor = texture2D(u_texture, v_textureCoordinates);\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/ReprojectWebMercatorVS.js b/Source/Shaders/ReprojectWebMercatorVS.js new file mode 100644 index 000000000000..8f7108ac5fb0 --- /dev/null +++ b/Source/Shaders/ReprojectWebMercatorVS.js @@ -0,0 +1,17 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "attribute vec4 position;\n\ +attribute float webMercatorT;\n\ +\n\ +uniform vec2 u_textureDimensions;\n\ +\n\ +varying vec2 v_textureCoordinates;\n\ +\n\ +void main()\n\ +{\n\ + v_textureCoordinates = vec2(position.x, webMercatorT);\n\ + gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/ShadowVolumeFS.js b/Source/Shaders/ShadowVolumeFS.js new file mode 100644 index 000000000000..0fb4f9c5ee5a --- /dev/null +++ b/Source/Shaders/ShadowVolumeFS.js @@ -0,0 +1,24 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef GL_EXT_frag_depth\n\ +#extension GL_EXT_frag_depth : enable\n\ +#endif\n\ +\n\ +#ifdef VECTOR_TILE\n\ +uniform vec4 u_highlightColor;\n\ +#else\n\ +varying vec4 v_color;\n\ +#endif\n\ +\n\ +void main(void)\n\ +{\n\ +#ifdef VECTOR_TILE\n\ + gl_FragColor = u_highlightColor;\n\ +#else\n\ + gl_FragColor = v_color;\n\ +#endif\n\ + czm_writeDepthClampedToFarPlane();\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/ShadowVolumeVS.js b/Source/Shaders/ShadowVolumeVS.js new file mode 100644 index 000000000000..a9b6e82a22a1 --- /dev/null +++ b/Source/Shaders/ShadowVolumeVS.js @@ -0,0 +1,46 @@ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "#ifdef VECTOR_TILE\n\ +attribute vec3 position;\n\ +attribute float a_batchId;\n\ +\n\ +uniform mat4 u_modifiedModelViewProjection;\n\ +#else\n\ +attribute vec3 position3DHigh;\n\ +attribute vec3 position3DLow;\n\ +attribute vec4 color;\n\ +attribute float batchId;\n\ +#endif\n\ +\n\ +#ifdef EXTRUDED_GEOMETRY\n\ +attribute vec3 extrudeDirection;\n\ +\n\ +uniform float u_globeMinimumAltitude;\n\ +#endif\n\ +\n\ +#ifndef VECTOR_TILE\n\ +varying vec4 v_color;\n\ +#endif\n\ +\n\ +void main()\n\ +{\n\ +#ifdef VECTOR_TILE\n\ + gl_Position = czm_depthClampFarPlane(u_modifiedModelViewProjection * vec4(position, 1.0));\n\ +#else\n\ + v_color = color;\n\ +\n\ + vec4 position = czm_computePosition();\n\ +\n\ +#ifdef EXTRUDED_GEOMETRY\n\ + float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\n\ + delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\n\ +\n\ + //extrudeDirection is zero for the top layer\n\ + position = position + vec4(extrudeDirection * delta, 0.0);\n\ +#endif\n\ + gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n\ +#endif\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/SkyAtmosphereFS.js b/Source/Shaders/SkyAtmosphereFS.js new file mode 100644 index 000000000000..7f784aaeafac --- /dev/null +++ b/Source/Shaders/SkyAtmosphereFS.js @@ -0,0 +1,122 @@ +/** + * @license + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the project nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Modifications made by Analytical Graphics, Inc. + */ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @license\n\ + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ + * All rights reserved.\n\ + *\n\ + * Redistribution and use in source and binary forms, with or without\n\ + * modification, are permitted provided that the following conditions\n\ + * are met:\n\ + *\n\ + * * Redistributions of source code must retain the above copyright notice,\n\ + * this list of conditions and the following disclaimer.\n\ + * * Redistributions in binary form must reproduce the above copyright notice,\n\ + * this list of conditions and the following disclaimer in the documentation\n\ + * and/or other materials provided with the distribution.\n\ + * * Neither the name of the project nor the names of its contributors may be\n\ + * used to endorse or promote products derived from this software without\n\ + * specific prior written permission.\n\ + *\n\ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ + *\n\ + * Modifications made by Analytical Graphics, Inc.\n\ + */\n\ +\n\ + // Code: http://sponeil.net/\n\ + // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ +\n\ +#ifdef COLOR_CORRECT\n\ +uniform vec3 u_hsbShift; // Hue, saturation, brightness\n\ +#endif\n\ +\n\ +uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag\n\ +\n\ +const float g = -0.95;\n\ +const float g2 = g * g;\n\ +\n\ +varying vec3 v_rayleighColor;\n\ +varying vec3 v_mieColor;\n\ +varying vec3 v_toCamera;\n\ +varying vec3 v_positionEC;\n\ +\n\ +void main (void)\n\ +{\n\ + // Extra normalize added for Android\n\ + float cosAngle = dot(czm_sunDirectionWC, normalize(v_toCamera)) / length(v_toCamera);\n\ + float rayleighPhase = 0.75 * (1.0 + cosAngle * cosAngle);\n\ + float miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cosAngle * cosAngle) / pow(1.0 + g2 - 2.0 * g * cosAngle, 1.5);\n\ +\n\ + const float exposure = 2.0;\n\ +\n\ + vec3 rgb = rayleighPhase * v_rayleighColor + miePhase * v_mieColor;\n\ + rgb = vec3(1.0) - exp(-exposure * rgb);\n\ + // Compute luminance before color correction to avoid strangely gray night skies\n\ + float l = czm_luminance(rgb);\n\ +\n\ +#ifdef COLOR_CORRECT\n\ + // Convert rgb color to hsb\n\ + vec3 hsb = czm_RGBToHSB(rgb);\n\ + // Perform hsb shift\n\ + hsb.x += u_hsbShift.x; // hue\n\ + hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation\n\ + hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness\n\ + // Convert shifted hsb back to rgb\n\ + rgb = czm_HSBToRGB(hsb);\n\ +\n\ + // Check if correction decreased the luminance to 0\n\ + l = min(l, czm_luminance(rgb));\n\ +#endif\n\ +\n\ + // Alter alpha based on how close the viewer is to the ground (1.0 = on ground, 0.0 = at edge of atmosphere)\n\ + float atmosphereAlpha = clamp((u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.x) / (u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.z), 0.0, 1.0);\n\ +\n\ + // Alter alpha based on time of day (0.0 = night , 1.0 = day)\n\ + float nightAlpha = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), 0.0, 1.0) : 1.0;\n\ + atmosphereAlpha *= pow(nightAlpha, 0.5);\n\ +\n\ + gl_FragColor = vec4(rgb, mix(rgb.b, 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime));\n\ +}\n\ +"; +}); \ No newline at end of file diff --git a/Source/Shaders/SkyAtmosphereVS.js b/Source/Shaders/SkyAtmosphereVS.js new file mode 100644 index 000000000000..769037e0f7dc --- /dev/null +++ b/Source/Shaders/SkyAtmosphereVS.js @@ -0,0 +1,166 @@ +/** + * @license + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the project nor the names of its contributors may be + * used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Modifications made by Analytical Graphics, Inc. + */ +//This file is automatically rebuilt by the Cesium build process. +define(function() { + 'use strict'; + return "/**\n\ + * @license\n\ + * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ + * All rights reserved.\n\ + *\n\ + * Redistribution and use in source and binary forms, with or without\n\ + * modification, are permitted provided that the following conditions\n\ + * are met:\n\ + *\n\ + * * Redistributions of source code must retain the above copyright notice,\n\ + * this list of conditions and the following disclaimer.\n\ + * * Redistributions in binary form must reproduce the above copyright notice,\n\ + * this list of conditions and the following disclaimer in the documentation\n\ + * and/or other materials provided with the distribution.\n\ + * * Neither the name of the project nor the names of its contributors may be\n\ + * used to endorse or promote products derived from this software without\n\ + * specific prior written permission.\n\ + *\n\ + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ + *\n\ + * Modifications made by Analytical Graphics, Inc.\n\ + */\n\ +\n\ + // Code: http://sponeil.net/\n\ + // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ +\n\ +attribute vec4 position;\n\ +\n\ +uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag\n\ +\n\ +const float Kr = 0.0025;\n\ +const float Kr4PI = Kr * 4.0 * czm_pi;\n\ +const float Km = 0.0015;\n\ +const float Km4PI = Km * 4.0 * czm_pi;\n\ +const float ESun = 15.0;\n\ +const float KmESun = Km * ESun;\n\ +const float KrESun = Kr * ESun;\n\ +const vec3 InvWavelength = vec3(\n\ + 5.60204474633241, // Red = 1.0 / Math.pow(0.650, 4.0)\n\ + 9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0)\n\ + 19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0)\n\ +const float rayleighScaleDepth = 0.25;\n\ +\n\ +const int nSamples = 2;\n\ +const float fSamples = 2.0;\n\ +\n\ +varying vec3 v_rayleighColor;\n\ +varying vec3 v_mieColor;\n\ +varying vec3 v_toCamera;\n\ +\n\ +float scale(float cosAngle)\n\ +{\n\ + float x = 1.0 - cosAngle;\n\ + return rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n\ +}\n\ +\n\ +void main(void)\n\ +{\n\ + // Unpack attributes\n\ + float cameraHeight = u_cameraAndRadiiAndDynamicAtmosphereColor.x;\n\ + float outerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.y;\n\ + float innerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.z;\n\ +\n\ + // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\n\ + vec3 positionV3 = position.xyz;\n\ + vec3 ray = positionV3 - czm_viewerPositionWC;\n\ + float far = length(ray);\n\ + ray /= far;\n\ + float atmosphereScale = 1.0 / (outerRadius - innerRadius);\n\ +\n\ +#ifdef SKY_FROM_SPACE\n\ + // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere)\n\ + float B = 2.0 * dot(czm_viewerPositionWC, ray);\n\ + float C = cameraHeight * cameraHeight - outerRadius * outerRadius;\n\ + float det = max(0.0, B*B - 4.0 * C);\n\ + float near = 0.5 * (-B - sqrt(det));\n\ +\n\ + // Calculate the ray's starting position, then calculate its scattering offset\n\ + vec3 start = czm_viewerPositionWC + ray * near;\n\ + far -= near;\n\ + float startAngle = dot(ray, start) / outerRadius;\n\ + float startDepth = exp(-1.0 / rayleighScaleDepth );\n\ + float startOffset = startDepth*scale(startAngle);\n\ +#else // SKY_FROM_ATMOSPHERE\n\ + // Calculate the ray's starting position, then calculate its scattering offset\n\ + vec3 start = czm_viewerPositionWC;\n\ + float height = length(start);\n\ + float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));\n\ + float startAngle = dot(ray, start) / height;\n\ + float startOffset = depth*scale(startAngle);\n\ +#endif\n\ +\n\ + // Initialize the scattering loop variables\n\ + float sampleLength = far / fSamples;\n\ + float scaledLength = sampleLength * atmosphereScale;\n\ + vec3 sampleRay = ray * sampleLength;\n\ + vec3 samplePoint = start + sampleRay * 0.5;\n\ +\n\ + // Now loop through the sample rays\n\ + vec3 frontColor = vec3(0.0, 0.0, 0.0);\n\ + vec3 lightDir = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? czm_sunPositionWC - czm_viewerPositionWC : czm_viewerPositionWC;\n\ + lightDir = normalize(lightDir);\n\ +\n\ + for(int i=0; i= edgeVert;\n\ + FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n\ +/*--------------------------------------------------------------------------*/\n\ + if(!horzSpan) lumaN = lumaW;\n\ + if(!horzSpan) lumaS = lumaE;\n\ + if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n\ + FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaFloat gradientN = lumaN - lumaM;\n\ + FxaaFloat gradientS = lumaS - lumaM;\n\ + FxaaFloat lumaNN = lumaN + lumaM;\n\ + FxaaFloat lumaSS = lumaS + lumaM;\n\ + FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n\ + FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n\ + if(pairN) lengthSign = -lengthSign;\n\ + FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaFloat2 posB;\n\ + posB.x = posM.x;\n\ + posB.y = posM.y;\n\ + FxaaFloat2 offNP;\n\ + offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\ + offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\ + if(!horzSpan) posB.x += lengthSign * 0.5;\n\ + if( horzSpan) posB.y += lengthSign * 0.5;\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaFloat2 posN;\n\ + posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n\ + posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n\ + FxaaFloat2 posP;\n\ + posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n\ + posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n\ + FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n\ + FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n\ + FxaaFloat subpixE = subpixC * subpixC;\n\ + FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n\ +/*--------------------------------------------------------------------------*/\n\ + if(!pairN) lumaNN = lumaSS;\n\ + FxaaFloat gradientScaled = gradient * 1.0/4.0;\n\ + FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n\ + FxaaFloat subpixF = subpixD * subpixE;\n\ + FxaaBool lumaMLTZero = lumaMM < 0.0;\n\ +/*--------------------------------------------------------------------------*/\n\ + lumaEndN -= lumaNN * 0.5;\n\ + lumaEndP -= lumaNN * 0.5;\n\ + FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n\ + FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n\ + FxaaBool doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n\ +/*--------------------------------------------------------------------------*/\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 3)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 4)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 5)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 6)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 7)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 8)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 9)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 10)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 11)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n\ +/*--------------------------------------------------------------------------*/\n\ + #if (FXAA_QUALITY_PS > 12)\n\ + if(doneNP) {\n\ + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ + doneN = abs(lumaEndN) >= gradientScaled;\n\ + doneP = abs(lumaEndP) >= gradientScaled;\n\ + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n\ + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n\ + doneNP = (!doneN) || (!doneP);\n\ + if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n\ + if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ + #endif\n\ +/*--------------------------------------------------------------------------*/\n\ + }\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaFloat dstN = posM.x - posN.x;\n\ + FxaaFloat dstP = posP.x - posM.x;\n\ + if(!horzSpan) dstN = posM.y - posN.y;\n\ + if(!horzSpan) dstP = posP.y - posM.y;\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n\ + FxaaFloat spanLength = (dstP + dstN);\n\ + FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n\ + FxaaFloat spanLengthRcp = 1.0/spanLength;\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaBool directionN = dstN < dstP;\n\ + FxaaFloat dst = min(dstN, dstP);\n\ + FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n\ + FxaaFloat subpixG = subpixF * subpixF;\n\ + FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n\ + FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n\ +/*--------------------------------------------------------------------------*/\n\ + FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n\ + FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n\ + if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n\ + if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n\ + return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n\ +}\n\ +"; +}); \ No newline at end of file From 0c74ff8bc2a9f7cb458ffaa1af2b9cf257174261 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Mon, 16 Apr 2018 21:08:19 -0400 Subject: [PATCH 078/104] Add support for the Pelias geocoder [Pelias](https://pelias.io/) is an open source geocoder originally built by Mapzen. This adds `PeliasGeocoderService` for use with the Geocoder widget. Because Pelias (and some other geocoders) differentiate between an `autocomplete` request and a `search` request, I added an optional parameter to `GeocoderService.geocode` to provide that information. The widget will us auto-complete as you are typing and `search` once you hit enter or select a value from the dropdown. --- CHANGES.md | 2 + Source/Core/GeocodeType.js | 32 ++++++ Source/Core/GeocoderService.js | 2 + Source/Core/PeliasGeocoderService.js | 103 +++++++++++++++++++ Source/Widgets/Geocoder/GeocoderViewModel.js | 17 +-- Specs/Core/PeliasGeocoderServiceSpec.js | 93 +++++++++++++++++ 6 files changed, 242 insertions(+), 7 deletions(-) create mode 100644 Source/Core/GeocodeType.js create mode 100644 Source/Core/PeliasGeocoderService.js create mode 100644 Specs/Core/PeliasGeocoderServiceSpec.js diff --git a/CHANGES.md b/CHANGES.md index 34607c3ed702..8f4a15a772c5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,8 @@ Change Log * Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) * When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. * Added `Math.log2` to compute the base 2 logarithm of a number. +* Added 'PeliasGeocoderService', which provides geocoding via a [Pelias](https://pelias.io) server. +* Added `GeocodeType` enum and use it as an optional parameter to all `GeocoderService` instances to differentiate between autocomplete and search requests. ##### Fixes :wrench: * Fixed bugs in `TimeIntervalCollection.removeInterval`. [#6418](https://github.com/AnalyticalGraphicsInc/cesium/pull/6418). diff --git a/Source/Core/GeocodeType.js b/Source/Core/GeocodeType.js new file mode 100644 index 000000000000..2f27fb3e0780 --- /dev/null +++ b/Source/Core/GeocodeType.js @@ -0,0 +1,32 @@ +define([ + '../Core/freezeObject' +], function( + freezeObject) { + 'use strict'; + + /** + * The type of geocoding to be performed by a {@link GeocoderService}. + * @exports GeocodeType + * @see Geocoder + */ + var GeocodeType = { + /** + * Perform a search where the input is considered complete. + * + * @type {Number} + * @constant + */ + SEARCH: 0, + + /** + * Perform an auto-complete using partial input, typically + * reserved for providing possible results as a user is typing. + * + * @type {Number} + * @constant + */ + AUTOCOMPLETE: 1 + }; + + return freezeObject(GeocodeType); +}); diff --git a/Source/Core/GeocoderService.js b/Source/Core/GeocoderService.js index e2ac837c36a3..60d41eb597cc 100644 --- a/Source/Core/GeocoderService.js +++ b/Source/Core/GeocoderService.js @@ -17,6 +17,7 @@ define([ * @constructor * * @see BingMapsGeocoderService + * @see PeliasGeocoderService */ function GeocoderService() { } @@ -25,6 +26,7 @@ define([ * @function * * @param {String} query The query to be sent to the geocoder service + * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. * @returns {Promise} */ GeocoderService.prototype.geocode = DeveloperError.throwInstantiationError; diff --git a/Source/Core/PeliasGeocoderService.js b/Source/Core/PeliasGeocoderService.js new file mode 100644 index 000000000000..b357db862c8f --- /dev/null +++ b/Source/Core/PeliasGeocoderService.js @@ -0,0 +1,103 @@ +define([ + './Check', + './defined', + './defineProperties', + './GeocodeType', + './Rectangle', + './Resource' +], function ( + Check, + defined, + defineProperties, + GeocodeType, + Rectangle, + Resource) { + 'use strict'; + + /** + * Provides geocoding via a {@link https://pelias.io/|Pelias} server. + * @alias PeliasGeocoderService + * @constructor + * + * @param {Resource|String} url The endpoint to the Pelias server. + * + * @example + * // Configure a Viewer to use the Pelias server hosted by https://geocode.earth/ + * var viewer = new Cesium.Viewer('cesiumContainer', { + * geocoder: new Cesium.PeliasGeocoderService(new Cesium.Resource({ + * url: 'https://api.geocode.earth/v1/', + * queryParameters: { + * api_key: '' + * } + * })) + * }); + */ + function PeliasGeocoderService(url) { + //>>includeStart('debug', pragmas.debug); + Check.defined('url', url); + //>>includeEnd('debug'); + + this._url = Resource.createIfNeeded(url); + } + + defineProperties(PeliasGeocoderService.prototype, { + /** + * The Resource used to access the Pelias endpoint. + * @type {Resource} + * @memberof {PeliasGeocoderService.prototype} + * @readonly + */ + url: { + get: function () { + return this._url; + } + } + }); + + /** + * @function + * + * @param {String} query The query to be sent to the geocoder service + * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. + * @returns {Promise} + */ + PeliasGeocoderService.prototype.geocode = function(query, type) { + //>>includeStart('debug', pragmas.debug); + Check.typeOf.string('query', query); + //>>includeEnd('debug'); + + var resource = this._url.getDerivedResource({ + url: type === GeocodeType.AUTOCOMPLETE ? 'autocomplete' : 'search', + queryParameters: { + text: query + } + }); + + return resource.fetchJson() + .then(function (results) { + return results.features.map(function (resultObject) { + var bboxDegrees = resultObject.bbox; + + // Pelias does not always provide bounding information + // so just expand the location slightly. + if (!defined(bboxDegrees)) { + var lon = resultObject.geometry.coordinates[0]; + var lat = resultObject.geometry.coordinates[1]; + bboxDegrees = [ + lon - 0.001, + lat - 0.001, + lon + 0.001, + lat + 0.001 + ]; + } + + return { + displayName: resultObject.properties.label, + destination: Rectangle.fromDegrees(bboxDegrees[0], bboxDegrees[1], bboxDegrees[2], bboxDegrees[3]) + }; + }); + }); + }; + + return PeliasGeocoderService; +}); diff --git a/Source/Widgets/Geocoder/GeocoderViewModel.js b/Source/Widgets/Geocoder/GeocoderViewModel.js index f81fd709f213..a2c8c975be54 100644 --- a/Source/Widgets/Geocoder/GeocoderViewModel.js +++ b/Source/Widgets/Geocoder/GeocoderViewModel.js @@ -6,6 +6,7 @@ define([ '../../Core/defineProperties', '../../Core/DeveloperError', '../../Core/Event', + '../../Core/GeocodeType', '../../Core/Matrix4', '../../ThirdParty/knockout', '../../ThirdParty/when', @@ -19,6 +20,7 @@ define([ defineProperties, DeveloperError, Event, + GeocodeType, Matrix4, knockout, when, @@ -79,7 +81,8 @@ define([ return suggestionsNotEmpty && showSuggestions; }); - this._searchCommand = createCommand(function() { + this._searchCommand = createCommand(function(geocodeType) { + geocodeType = defaultValue(geocodeType, GeocodeType.SEARCH); that._focusTextbox = false; if (defined(that._selectedSuggestion)) { that.activateSuggestion(that._selectedSuggestion); @@ -89,7 +92,7 @@ define([ if (that.isSearchInProgress) { cancelGeocode(that); } else { - geocode(that, that._geocoderServices); + geocode(that, that._geocoderServices, geocodeType); } }); @@ -338,13 +341,13 @@ define([ }); } - function chainPromise(promise, geocoderService, query) { + function chainPromise(promise, geocoderService, query, geocodeType) { return promise .then(function(result) { if (defined(result) && result.state === 'fulfilled' && result.value.length > 0){ return result; } - var nextPromise = geocoderService.geocode(query) + var nextPromise = geocoderService.geocode(query, geocodeType) .then(function (result) { return {state: 'fulfilled', value: result}; }) @@ -356,7 +359,7 @@ define([ }); } - function geocode(viewModel, geocoderServices) { + function geocode(viewModel, geocoderServices, geocodeType) { var query = viewModel._searchText; if (hasOnlyWhitespace(query)) { @@ -368,7 +371,7 @@ define([ var promise = when.resolve(); for (var i = 0; i < geocoderServices.length; i++) { - promise = chainPromise(promise, geocoderServices[i], query); + promise = chainPromise(promise, geocoderServices[i], query, geocodeType); } viewModel._geocodePromise = promise; @@ -442,7 +445,7 @@ define([ if (results.length >= 5) { return results; } - return service.geocode(query) + return service.geocode(query, GeocodeType.AUTOCOMPLETE) .then(function(newResults) { results = results.concat(newResults); return results; diff --git a/Specs/Core/PeliasGeocoderServiceSpec.js b/Specs/Core/PeliasGeocoderServiceSpec.js new file mode 100644 index 000000000000..a96993c03466 --- /dev/null +++ b/Specs/Core/PeliasGeocoderServiceSpec.js @@ -0,0 +1,93 @@ +defineSuite([ + 'Core/PeliasGeocoderService', + 'Core/GeocodeType', + 'Core/Rectangle', + 'Core/Resource', + 'ThirdParty/when' + ], function( + PeliasGeocoderService, + GeocodeType, + Rectangle, + Resource, + when) { + 'use strict'; + + it('constructor throws without url', function() { + expect(function() { + return new PeliasGeocoderService(undefined); + }).toThrowDeveloperError(); + }); + + it('returns geocoder results', function () { + var service = new PeliasGeocoderService('http://test.invalid/v1/'); + + var query = 'some query'; + var data = { + features: [{ + type: "Feature", + geometry: { + type: "Point", + coordinates: [-75.172489, 39.927828] + }, + properties: { + label: "1826 S 16th St, Philadelphia, PA, USA" + } + }] + }; + spyOn(Resource.prototype, 'fetchJson').and.returnValue(when.resolve(data)); + + return service.geocode(query) + .then(function(results) { + expect(results.length).toEqual(1); + expect(results[0].displayName).toEqual(data.features[0].properties.label); + expect(results[0].destination).toBeInstanceOf(Rectangle); + }); + }); + + it('returns no geocoder results if Pelias has no results', function() { + var service = new PeliasGeocoderService('http://test.invalid/v1/'); + + var query = 'some query'; + var data = { features: [] }; + spyOn(Resource.prototype, 'fetchJson').and.returnValue(when.resolve(data)); + + return service.geocode(query) + .then(function(results) { + expect(results.length).toEqual(0); + }); + }); + + it('calls search endpoint if specified', function () { + var service = new PeliasGeocoderService('http://test.invalid/v1/'); + + var query = 'some query'; + var data = { features: [] }; + spyOn(Resource.prototype, 'fetchJson').and.returnValue(when.resolve(data)); + var getDerivedResource = spyOn(service._url, 'getDerivedResource').and.callThrough(); + + service.geocode(query, GeocodeType.SEARCH); + expect(getDerivedResource).toHaveBeenCalledWith({ + url: 'search', + queryParameters: { + text: query + } + }); + }); + + it('calls autocomplete endpoint if specified', function () { + var service = new PeliasGeocoderService('http://test.invalid/v1/'); + + var query = 'some query'; + var data = { features: [] }; + spyOn(Resource.prototype, 'fetchJson').and.returnValue(when.resolve(data)); + var getDerivedResource = spyOn(service._url, 'getDerivedResource').and.callThrough(); + + service.geocode(query, GeocodeType.AUTOCOMPLETE); + expect(getDerivedResource).toHaveBeenCalledWith({ + url: 'autocomplete', + queryParameters: { + text: query + } + }); + }); +}); From 6046a06fc62e2c82e4d102139e56be2cb0394837 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 18:26:22 -0700 Subject: [PATCH 079/104] Handle responseType text --- Source/Core/Resource.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index 2185ad5c99ca..1275dcdfc8b9 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1774,7 +1774,7 @@ define([ }; function loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType) { - // Note: only the 'json' responseType transforms the loaded buffer + // Note: only the 'json' and 'text' responseTypes transforms the loaded buffer var URL = require('url').parse(url); var http_s = URL.protocol === 'https:' ? require('https') : require('http'); var zlib = require('zlib'); @@ -1806,12 +1806,16 @@ define([ deferred.reject(new RuntimeError('Error decompressing response.')); } else if (responseType === 'json') { deferred.resolve(JSON.parse(result.toString('utf8'))); + } else if (responseType === 'text') { + deferred.resolve(result.toString('utf8')); } else { deferred.resolve(new Uint8Array(result).buffer); // Convert Buffer to ArrayBuffer } }); + } else if (responseType === 'text') { + deferred.resolve(response.toString('utf8')); } else { - deferred.resolve(responseType === 'json' ? JSON.parse(response.toString('utf8')) : response); + deferred.resolve(responseType === 'json' ? JSON.parse(response.toString('utf8')) : new Uint8Array(response).buffer); } }); }); From a43aec98b677ea480df5e9c4cde344e4a8146ee8 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 18:48:02 -0700 Subject: [PATCH 080/104] Deal with document in node --- Source/Core/getAbsoluteUri.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Source/Core/getAbsoluteUri.js b/Source/Core/getAbsoluteUri.js index 89aa26ffd266..ac425130da06 100644 --- a/Source/Core/getAbsoluteUri.js +++ b/Source/Core/getAbsoluteUri.js @@ -1,3 +1,4 @@ +/*globals process, require*/ define([ '../ThirdParty/Uri', './defaultValue', @@ -22,9 +23,14 @@ define([ * //absolute Uri will be "https://test.com/awesome.png"; * var absoluteUri = Cesium.getAbsoluteUri('awesome.png', 'https://test.com'); */ - function getAbsoluteUri(relative, base) { - return getAbsoluteUri._implementation(relative, base, document); - } + function getAbsoluteUri(relative, base) { + if (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]') { + // Running node + return getAbsoluteUri._implementation(relative, base, {baseURI: 'http://localhost/', location: {href: ''}}) + } else { + return getAbsoluteUri._implementation(relative, base, document); + } + } getAbsoluteUri._implementation = function(relative, base, documentObject) { //>>includeStart('debug', pragmas.debug); From cd244dfd628a538c9bc037757a80979c128855c6 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 18:54:43 -0700 Subject: [PATCH 081/104] Fix eslint --- Source/Core/getAbsoluteUri.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Source/Core/getAbsoluteUri.js b/Source/Core/getAbsoluteUri.js index ac425130da06..11710b65a9d5 100644 --- a/Source/Core/getAbsoluteUri.js +++ b/Source/Core/getAbsoluteUri.js @@ -25,11 +25,10 @@ define([ */ function getAbsoluteUri(relative, base) { if (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]') { - // Running node - return getAbsoluteUri._implementation(relative, base, {baseURI: 'http://localhost/', location: {href: ''}}) - } else { - return getAbsoluteUri._implementation(relative, base, document); + // Running node + return getAbsoluteUri._implementation(relative, base, {baseURI: 'http://localhost/', location: {href: ''}}); } + return getAbsoluteUri._implementation(relative, base, document); } getAbsoluteUri._implementation = function(relative, base, documentObject) { From ab717f2904e662ba52e84e1d5b36a5ae33255155 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 19:23:45 -0700 Subject: [PATCH 082/104] Update CHANGES --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 34607c3ed702..160633f2149f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ Change Log * Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) +* Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling ### 1.44 - 2018-04-02 From 306e2ceefc8183596c790b2937b03e857a816d4e Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 20:46:56 -0700 Subject: [PATCH 083/104] Remove stuff carried from build --- Source/Cesium.js | 839 ------------------ Source/Shaders/AdjustTranslucentFS.js | 29 - .../Appearances/AllMaterialAppearanceFS.js | 34 - .../Appearances/AllMaterialAppearanceVS.js | 31 - .../Appearances/BasicMaterialAppearanceFS.js | 28 - .../Appearances/BasicMaterialAppearanceVS.js | 22 - .../EllipsoidSurfaceAppearanceFS.js | 38 - .../EllipsoidSurfaceAppearanceVS.js | 24 - .../PerInstanceColorAppearanceFS.js | 27 - .../PerInstanceColorAppearanceVS.js | 25 - .../PerInstanceFlatColorAppearanceFS.js | 11 - .../PerInstanceFlatColorAppearanceVS.js | 20 - .../Appearances/PolylineColorAppearanceVS.js | 37 - .../PolylineMaterialAppearanceVS.js | 39 - .../TexturedMaterialAppearanceFS.js | 30 - .../TexturedMaterialAppearanceVS.js | 25 - Source/Shaders/BillboardCollectionFS.js | 63 -- Source/Shaders/BillboardCollectionVS.js | 300 ------- Source/Shaders/BrdfLutGeneratorFS.js | 88 -- .../Builtin/Constants/degreesPerRadian.js | 21 - .../Shaders/Builtin/Constants/depthRange.js | 19 - Source/Shaders/Builtin/Constants/epsilon1.js | 12 - Source/Shaders/Builtin/Constants/epsilon2.js | 12 - Source/Shaders/Builtin/Constants/epsilon3.js | 12 - Source/Shaders/Builtin/Constants/epsilon4.js | 12 - Source/Shaders/Builtin/Constants/epsilon5.js | 12 - Source/Shaders/Builtin/Constants/epsilon6.js | 12 - Source/Shaders/Builtin/Constants/epsilon7.js | 12 - Source/Shaders/Builtin/Constants/infinity.js | 12 - Source/Shaders/Builtin/Constants/oneOverPi.js | 21 - .../Shaders/Builtin/Constants/oneOverTwoPi.js | 21 - .../Builtin/Constants/passCesium3DTile.js | 14 - .../passCesium3DTileClassification.js | 14 - ...assCesium3DTileClassificationIgnoreShow.js | 14 - .../Builtin/Constants/passClassification.js | 14 - .../Shaders/Builtin/Constants/passCompute.js | 14 - .../Builtin/Constants/passEnvironment.js | 14 - Source/Shaders/Builtin/Constants/passGlobe.js | 14 - .../Shaders/Builtin/Constants/passOpaque.js | 14 - .../Shaders/Builtin/Constants/passOverlay.js | 14 - .../Constants/passTerrainClassification.js | 14 - .../Builtin/Constants/passTranslucent.js | 14 - Source/Shaders/Builtin/Constants/pi.js | 21 - .../Shaders/Builtin/Constants/piOverFour.js | 21 - Source/Shaders/Builtin/Constants/piOverSix.js | 21 - .../Shaders/Builtin/Constants/piOverThree.js | 21 - Source/Shaders/Builtin/Constants/piOverTwo.js | 21 - .../Builtin/Constants/radiansPerDegree.js | 21 - .../Shaders/Builtin/Constants/sceneMode2D.js | 16 - .../Shaders/Builtin/Constants/sceneMode3D.js | 16 - .../Constants/sceneModeColumbusView.js | 16 - .../Builtin/Constants/sceneModeMorphing.js | 16 - .../Shaders/Builtin/Constants/solarRadius.js | 18 - .../Shaders/Builtin/Constants/threePiOver2.js | 21 - Source/Shaders/Builtin/Constants/twoPi.js | 21 - .../Constants/webMercatorMaxLatitude.js | 21 - Source/Shaders/Builtin/CzmBuiltins.js | 321 ------- Source/Shaders/Builtin/Functions/HSBToRGB.js | 29 - Source/Shaders/Builtin/Functions/HSLToRGB.js | 36 - Source/Shaders/Builtin/Functions/RGBToHSB.js | 32 - Source/Shaders/Builtin/Functions/RGBToHSL.js | 39 - Source/Shaders/Builtin/Functions/RGBToXYZ.js | 35 - Source/Shaders/Builtin/Functions/XYZToRGB.js | 35 - .../Shaders/Builtin/Functions/alphaWeight.js | 37 - Source/Shaders/Builtin/Functions/antialias.js | 44 - .../Shaders/Builtin/Functions/cascadeColor.js | 13 - .../Builtin/Functions/cascadeDistance.js | 12 - .../Builtin/Functions/cascadeMatrix.js | 15 - .../Builtin/Functions/cascadeWeights.js | 15 - .../Builtin/Functions/columbusViewMorph.js | 17 - .../Builtin/Functions/computePosition.js | 27 - .../Builtin/Functions/cosineAndSine.js | 216 ----- .../Functions/decompressTextureCoordinates.js | 22 - .../Builtin/Functions/depthClampFarPlane.js | 32 - .../Functions/eastNorthUpToEyeCoordinates.js | 38 - .../Functions/ellipsoidContainsPoint.js | 17 - .../Shaders/Builtin/Functions/ellipsoidNew.js | 19 - .../ellipsoidWgs84TextureCoordinates.js | 15 - .../Builtin/Functions/equalsEpsilon.js | 41 - Source/Shaders/Builtin/Functions/eyeOffset.js | 25 - .../Functions/eyeToWindowCoordinates.js | 37 - Source/Shaders/Builtin/Functions/fog.js | 24 - .../Functions/geodeticSurfaceNormal.js | 21 - .../Builtin/Functions/getDefaultMaterial.js | 32 - .../Builtin/Functions/getLambertDiffuse.js | 27 - .../Shaders/Builtin/Functions/getSpecular.js | 34 - .../Builtin/Functions/getWaterNoise.js | 42 - .../Builtin/Functions/getWgs84EllipsoidEC.js | 26 - Source/Shaders/Builtin/Functions/hue.js | 35 - Source/Shaders/Builtin/Functions/isEmpty.js | 24 - Source/Shaders/Builtin/Functions/isFull.js | 24 - .../latitudeToWebMercatorFraction.js | 26 - Source/Shaders/Builtin/Functions/luminance.js | 25 - .../Builtin/Functions/metersPerPixel.js | 46 - .../Functions/modelToWindowCoordinates.js | 42 - .../Functions/multiplyWithColorBalance.js | 23 - .../Builtin/Functions/nearFarScalar.js | 31 - Source/Shaders/Builtin/Functions/octDecode.js | 88 -- Source/Shaders/Builtin/Functions/packDepth.js | 23 - Source/Shaders/Builtin/Functions/phong.js | 68 -- .../Builtin/Functions/pointAlongRay.js | 24 - .../rayEllipsoidIntersectionInterval.js | 88 -- .../Builtin/Functions/reverseLogDepth.js | 15 - .../Shaders/Builtin/Functions/saturation.js | 27 - .../Builtin/Functions/shadowDepthCompare.js | 29 - .../Builtin/Functions/shadowVisibility.js | 71 -- .../Shaders/Builtin/Functions/signNotZero.js | 34 - .../Functions/tangentToEyeSpaceMatrix.js | 30 - .../Builtin/Functions/transformPlane.js | 13 - .../Functions/translateRelativeToEye.js | 45 - .../Builtin/Functions/translucentPhong.js | 34 - Source/Shaders/Builtin/Functions/transpose.js | 50 -- .../Shaders/Builtin/Functions/unpackDepth.js | 21 - .../Shaders/Builtin/Functions/unpackFloat.js | 35 - .../Builtin/Functions/vertexLogDepth.js | 54 -- .../Functions/windowToEyeCoordinates.js | 60 -- .../Functions/writeDepthClampedToFarPlane.js | 30 - .../Builtin/Functions/writeLogDepth.js | 49 - .../Builtin/Structs/depthRangeStruct.js | 14 - Source/Shaders/Builtin/Structs/ellipsoid.js | 17 - Source/Shaders/Builtin/Structs/material.js | 27 - .../Shaders/Builtin/Structs/materialInput.js | 31 - Source/Shaders/Builtin/Structs/ray.js | 16 - Source/Shaders/Builtin/Structs/raySegment.js | 32 - .../Builtin/Structs/shadowParameters.js | 20 - Source/Shaders/CompositeOITFS.js | 36 - Source/Shaders/DepthPlaneFS.js | 27 - Source/Shaders/DepthPlaneVS.js | 16 - Source/Shaders/EllipsoidFS.js | 116 --- Source/Shaders/EllipsoidVS.js | 31 - Source/Shaders/GlobeFS.js | 348 -------- Source/Shaders/GlobeVS.js | 188 ---- Source/Shaders/GroundAtmosphere.js | 134 --- Source/Shaders/Materials/BumpMapMaterial.js | 34 - .../Shaders/Materials/CheckerboardMaterial.js | 33 - Source/Shaders/Materials/DotMaterial.js | 22 - .../Materials/ElevationContourMaterial.js | 32 - .../Materials/ElevationRampMaterial.js | 18 - Source/Shaders/Materials/FadeMaterial.js | 41 - Source/Shaders/Materials/GridMaterial.js | 62 -- Source/Shaders/Materials/NormalMapMaterial.js | 24 - .../Materials/PolylineArrowMaterial.js | 72 -- .../Shaders/Materials/PolylineDashMaterial.js | 42 - .../Shaders/Materials/PolylineGlowMaterial.js | 22 - .../Materials/PolylineOutlineMaterial.js | 33 - .../Shaders/Materials/RimLightingMaterial.js | 23 - Source/Shaders/Materials/SlopeRampMaterial.js | 15 - Source/Shaders/Materials/StripeMaterial.js | 28 - Source/Shaders/Materials/Water.js | 61 -- Source/Shaders/PointPrimitiveCollectionFS.js | 56 -- Source/Shaders/PointPrimitiveCollectionVS.js | 197 ---- Source/Shaders/PolylineCommon.js | 121 --- Source/Shaders/PolylineFS.js | 27 - Source/Shaders/PolylineVS.js | 108 --- .../PostProcessFilters/AdditiveBlend.js | 22 - .../Shaders/PostProcessFilters/BrightPass.js | 35 - Source/Shaders/PostProcessFilters/FXAA.js | 26 - .../PostProcessFilters/GaussianBlur1D.js | 42 - .../Shaders/PostProcessFilters/PassThrough.js | 13 - .../PointCloudEyeDomeLighting.js | 57 -- Source/Shaders/ReprojectWebMercatorFS.js | 13 - Source/Shaders/ReprojectWebMercatorVS.js | 17 - Source/Shaders/ShadowVolumeFS.js | 24 - Source/Shaders/ShadowVolumeVS.js | 46 - Source/Shaders/SkyAtmosphereFS.js | 122 --- Source/Shaders/SkyAtmosphereVS.js | 166 ---- Source/Shaders/SkyBoxFS.js | 14 - Source/Shaders/SkyBoxVS.js | 15 - Source/Shaders/SunFS.js | 13 - Source/Shaders/SunTextureFS.js | 61 -- Source/Shaders/SunVS.js | 33 - Source/Shaders/Vector3DTilePolylinesVS.js | 31 - Source/Shaders/ViewportQuadFS.js | 21 - Source/Shaders/ViewportQuadVS.js | 15 - Source/ThirdParty/Shaders/FXAA3_11.js | 681 -------------- 175 files changed, 8443 deletions(-) delete mode 100644 Source/Cesium.js delete mode 100644 Source/Shaders/AdjustTranslucentFS.js delete mode 100644 Source/Shaders/Appearances/AllMaterialAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/AllMaterialAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/BasicMaterialAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/BasicMaterialAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/PolylineColorAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js delete mode 100644 Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js delete mode 100644 Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js delete mode 100644 Source/Shaders/BillboardCollectionFS.js delete mode 100644 Source/Shaders/BillboardCollectionVS.js delete mode 100644 Source/Shaders/BrdfLutGeneratorFS.js delete mode 100644 Source/Shaders/Builtin/Constants/degreesPerRadian.js delete mode 100644 Source/Shaders/Builtin/Constants/depthRange.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon1.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon2.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon3.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon4.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon5.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon6.js delete mode 100644 Source/Shaders/Builtin/Constants/epsilon7.js delete mode 100644 Source/Shaders/Builtin/Constants/infinity.js delete mode 100644 Source/Shaders/Builtin/Constants/oneOverPi.js delete mode 100644 Source/Shaders/Builtin/Constants/oneOverTwoPi.js delete mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTile.js delete mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js delete mode 100644 Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js delete mode 100644 Source/Shaders/Builtin/Constants/passClassification.js delete mode 100644 Source/Shaders/Builtin/Constants/passCompute.js delete mode 100644 Source/Shaders/Builtin/Constants/passEnvironment.js delete mode 100644 Source/Shaders/Builtin/Constants/passGlobe.js delete mode 100644 Source/Shaders/Builtin/Constants/passOpaque.js delete mode 100644 Source/Shaders/Builtin/Constants/passOverlay.js delete mode 100644 Source/Shaders/Builtin/Constants/passTerrainClassification.js delete mode 100644 Source/Shaders/Builtin/Constants/passTranslucent.js delete mode 100644 Source/Shaders/Builtin/Constants/pi.js delete mode 100644 Source/Shaders/Builtin/Constants/piOverFour.js delete mode 100644 Source/Shaders/Builtin/Constants/piOverSix.js delete mode 100644 Source/Shaders/Builtin/Constants/piOverThree.js delete mode 100644 Source/Shaders/Builtin/Constants/piOverTwo.js delete mode 100644 Source/Shaders/Builtin/Constants/radiansPerDegree.js delete mode 100644 Source/Shaders/Builtin/Constants/sceneMode2D.js delete mode 100644 Source/Shaders/Builtin/Constants/sceneMode3D.js delete mode 100644 Source/Shaders/Builtin/Constants/sceneModeColumbusView.js delete mode 100644 Source/Shaders/Builtin/Constants/sceneModeMorphing.js delete mode 100644 Source/Shaders/Builtin/Constants/solarRadius.js delete mode 100644 Source/Shaders/Builtin/Constants/threePiOver2.js delete mode 100644 Source/Shaders/Builtin/Constants/twoPi.js delete mode 100644 Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js delete mode 100644 Source/Shaders/Builtin/CzmBuiltins.js delete mode 100644 Source/Shaders/Builtin/Functions/HSBToRGB.js delete mode 100644 Source/Shaders/Builtin/Functions/HSLToRGB.js delete mode 100644 Source/Shaders/Builtin/Functions/RGBToHSB.js delete mode 100644 Source/Shaders/Builtin/Functions/RGBToHSL.js delete mode 100644 Source/Shaders/Builtin/Functions/RGBToXYZ.js delete mode 100644 Source/Shaders/Builtin/Functions/XYZToRGB.js delete mode 100644 Source/Shaders/Builtin/Functions/alphaWeight.js delete mode 100644 Source/Shaders/Builtin/Functions/antialias.js delete mode 100644 Source/Shaders/Builtin/Functions/cascadeColor.js delete mode 100644 Source/Shaders/Builtin/Functions/cascadeDistance.js delete mode 100644 Source/Shaders/Builtin/Functions/cascadeMatrix.js delete mode 100644 Source/Shaders/Builtin/Functions/cascadeWeights.js delete mode 100644 Source/Shaders/Builtin/Functions/columbusViewMorph.js delete mode 100644 Source/Shaders/Builtin/Functions/computePosition.js delete mode 100644 Source/Shaders/Builtin/Functions/cosineAndSine.js delete mode 100644 Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/depthClampFarPlane.js delete mode 100644 Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js delete mode 100644 Source/Shaders/Builtin/Functions/ellipsoidNew.js delete mode 100644 Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/equalsEpsilon.js delete mode 100644 Source/Shaders/Builtin/Functions/eyeOffset.js delete mode 100644 Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/fog.js delete mode 100644 Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js delete mode 100644 Source/Shaders/Builtin/Functions/getDefaultMaterial.js delete mode 100644 Source/Shaders/Builtin/Functions/getLambertDiffuse.js delete mode 100644 Source/Shaders/Builtin/Functions/getSpecular.js delete mode 100644 Source/Shaders/Builtin/Functions/getWaterNoise.js delete mode 100644 Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js delete mode 100644 Source/Shaders/Builtin/Functions/hue.js delete mode 100644 Source/Shaders/Builtin/Functions/isEmpty.js delete mode 100644 Source/Shaders/Builtin/Functions/isFull.js delete mode 100644 Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js delete mode 100644 Source/Shaders/Builtin/Functions/luminance.js delete mode 100644 Source/Shaders/Builtin/Functions/metersPerPixel.js delete mode 100644 Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js delete mode 100644 Source/Shaders/Builtin/Functions/nearFarScalar.js delete mode 100644 Source/Shaders/Builtin/Functions/octDecode.js delete mode 100644 Source/Shaders/Builtin/Functions/packDepth.js delete mode 100644 Source/Shaders/Builtin/Functions/phong.js delete mode 100644 Source/Shaders/Builtin/Functions/pointAlongRay.js delete mode 100644 Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js delete mode 100644 Source/Shaders/Builtin/Functions/reverseLogDepth.js delete mode 100644 Source/Shaders/Builtin/Functions/saturation.js delete mode 100644 Source/Shaders/Builtin/Functions/shadowDepthCompare.js delete mode 100644 Source/Shaders/Builtin/Functions/shadowVisibility.js delete mode 100644 Source/Shaders/Builtin/Functions/signNotZero.js delete mode 100644 Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js delete mode 100644 Source/Shaders/Builtin/Functions/transformPlane.js delete mode 100644 Source/Shaders/Builtin/Functions/translateRelativeToEye.js delete mode 100644 Source/Shaders/Builtin/Functions/translucentPhong.js delete mode 100644 Source/Shaders/Builtin/Functions/transpose.js delete mode 100644 Source/Shaders/Builtin/Functions/unpackDepth.js delete mode 100644 Source/Shaders/Builtin/Functions/unpackFloat.js delete mode 100644 Source/Shaders/Builtin/Functions/vertexLogDepth.js delete mode 100644 Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js delete mode 100644 Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js delete mode 100644 Source/Shaders/Builtin/Functions/writeLogDepth.js delete mode 100644 Source/Shaders/Builtin/Structs/depthRangeStruct.js delete mode 100644 Source/Shaders/Builtin/Structs/ellipsoid.js delete mode 100644 Source/Shaders/Builtin/Structs/material.js delete mode 100644 Source/Shaders/Builtin/Structs/materialInput.js delete mode 100644 Source/Shaders/Builtin/Structs/ray.js delete mode 100644 Source/Shaders/Builtin/Structs/raySegment.js delete mode 100644 Source/Shaders/Builtin/Structs/shadowParameters.js delete mode 100644 Source/Shaders/CompositeOITFS.js delete mode 100644 Source/Shaders/DepthPlaneFS.js delete mode 100644 Source/Shaders/DepthPlaneVS.js delete mode 100644 Source/Shaders/EllipsoidFS.js delete mode 100644 Source/Shaders/EllipsoidVS.js delete mode 100644 Source/Shaders/GlobeFS.js delete mode 100644 Source/Shaders/GlobeVS.js delete mode 100644 Source/Shaders/GroundAtmosphere.js delete mode 100644 Source/Shaders/Materials/BumpMapMaterial.js delete mode 100644 Source/Shaders/Materials/CheckerboardMaterial.js delete mode 100644 Source/Shaders/Materials/DotMaterial.js delete mode 100644 Source/Shaders/Materials/ElevationContourMaterial.js delete mode 100644 Source/Shaders/Materials/ElevationRampMaterial.js delete mode 100644 Source/Shaders/Materials/FadeMaterial.js delete mode 100644 Source/Shaders/Materials/GridMaterial.js delete mode 100644 Source/Shaders/Materials/NormalMapMaterial.js delete mode 100644 Source/Shaders/Materials/PolylineArrowMaterial.js delete mode 100644 Source/Shaders/Materials/PolylineDashMaterial.js delete mode 100644 Source/Shaders/Materials/PolylineGlowMaterial.js delete mode 100644 Source/Shaders/Materials/PolylineOutlineMaterial.js delete mode 100644 Source/Shaders/Materials/RimLightingMaterial.js delete mode 100644 Source/Shaders/Materials/SlopeRampMaterial.js delete mode 100644 Source/Shaders/Materials/StripeMaterial.js delete mode 100644 Source/Shaders/Materials/Water.js delete mode 100644 Source/Shaders/PointPrimitiveCollectionFS.js delete mode 100644 Source/Shaders/PointPrimitiveCollectionVS.js delete mode 100644 Source/Shaders/PolylineCommon.js delete mode 100644 Source/Shaders/PolylineFS.js delete mode 100644 Source/Shaders/PolylineVS.js delete mode 100644 Source/Shaders/PostProcessFilters/AdditiveBlend.js delete mode 100644 Source/Shaders/PostProcessFilters/BrightPass.js delete mode 100644 Source/Shaders/PostProcessFilters/FXAA.js delete mode 100644 Source/Shaders/PostProcessFilters/GaussianBlur1D.js delete mode 100644 Source/Shaders/PostProcessFilters/PassThrough.js delete mode 100644 Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js delete mode 100644 Source/Shaders/ReprojectWebMercatorFS.js delete mode 100644 Source/Shaders/ReprojectWebMercatorVS.js delete mode 100644 Source/Shaders/ShadowVolumeFS.js delete mode 100644 Source/Shaders/ShadowVolumeVS.js delete mode 100644 Source/Shaders/SkyAtmosphereFS.js delete mode 100644 Source/Shaders/SkyAtmosphereVS.js delete mode 100644 Source/Shaders/SkyBoxFS.js delete mode 100644 Source/Shaders/SkyBoxVS.js delete mode 100644 Source/Shaders/SunFS.js delete mode 100644 Source/Shaders/SunTextureFS.js delete mode 100644 Source/Shaders/SunVS.js delete mode 100644 Source/Shaders/Vector3DTilePolylinesVS.js delete mode 100644 Source/Shaders/ViewportQuadFS.js delete mode 100644 Source/Shaders/ViewportQuadVS.js delete mode 100644 Source/ThirdParty/Shaders/FXAA3_11.js diff --git a/Source/Cesium.js b/Source/Cesium.js deleted file mode 100644 index c34e798fcf77..000000000000 --- a/Source/Cesium.js +++ /dev/null @@ -1,839 +0,0 @@ -define(['./Core/appendForwardSlash', './Core/arrayFill', './Core/arrayRemoveDuplicates', './Core/arraySlice', './Core/AssociativeArray', './Core/AttributeCompression', './Core/AxisAlignedBoundingBox', './Core/barycentricCoordinates', './Core/binarySearch', './Core/BingMapsApi', './Core/BingMapsGeocoderService', './Core/BoundingRectangle', './Core/BoundingSphere', './Core/BoxGeometry', './Core/BoxOutlineGeometry', './Core/buildModuleUrl', './Core/cancelAnimationFrame', './Core/Cartesian2', './Core/Cartesian3', './Core/Cartesian4', './Core/Cartographic', './Core/CartographicGeocoderService', './Core/CatmullRomSpline', './Core/CesiumTerrainProvider', './Core/Check', './Core/CircleGeometry', './Core/CircleOutlineGeometry', './Core/Clock', './Core/ClockRange', './Core/ClockStep', './Core/clone', './Core/Color', './Core/ColorGeometryInstanceAttribute', './Core/combine', './Core/ComponentDatatype', './Core/CompressedTextureBuffer', './Core/CornerType', './Core/CorridorGeometry', './Core/CorridorGeometryLibrary', './Core/CorridorOutlineGeometry', './Core/createGuid', './Core/createWorldTerrain', './Core/Credit', './Core/CubicRealPolynomial', './Core/CullingVolume', './Core/CylinderGeometry', './Core/CylinderGeometryLibrary', './Core/CylinderOutlineGeometry', './Core/decodeGoogleEarthEnterpriseData', './Core/DefaultProxy', './Core/defaultValue', './Core/defined', './Core/defineProperties', './Core/deprecationWarning', './Core/destroyObject', './Core/DeveloperError', './Core/DistanceDisplayCondition', './Core/DistanceDisplayConditionGeometryInstanceAttribute', './Core/DoublyLinkedList', './Core/EarthOrientationParameters', './Core/EarthOrientationParametersSample', './Core/EasingFunction', './Core/EllipseGeometry', './Core/EllipseGeometryLibrary', './Core/EllipseOutlineGeometry', './Core/Ellipsoid', './Core/EllipsoidalOccluder', './Core/EllipsoidGeodesic', './Core/EllipsoidGeometry', './Core/EllipsoidOutlineGeometry', './Core/EllipsoidTangentPlane', './Core/EllipsoidTerrainProvider', './Core/EncodedCartesian3', './Core/Event', './Core/EventHelper', './Core/ExtrapolationType', './Core/FeatureDetection', './Core/formatError', './Core/freezeObject', './Core/FrustumGeometry', './Core/FrustumOutlineGeometry', './Core/Fullscreen', './Core/GeocoderService', './Core/GeographicProjection', './Core/GeographicTilingScheme', './Core/Geometry', './Core/GeometryAttribute', './Core/GeometryAttributes', './Core/GeometryInstance', './Core/GeometryInstanceAttribute', './Core/GeometryPipeline', './Core/GeometryType', './Core/getAbsoluteUri', './Core/getBaseUri', './Core/getExtensionFromUri', './Core/getFilenameFromUri', './Core/getImagePixels', './Core/getMagic', './Core/getStringFromTypedArray', './Core/getTimestamp', './Core/GoogleEarthEnterpriseMetadata', './Core/GoogleEarthEnterpriseTerrainData', './Core/GoogleEarthEnterpriseTerrainProvider', './Core/GoogleEarthEnterpriseTileInformation', './Core/GregorianDate', './Core/HeadingPitchRange', './Core/HeadingPitchRoll', './Core/Heap', './Core/HeightmapTerrainData', './Core/HeightmapTessellator', './Core/HermitePolynomialApproximation', './Core/HermiteSpline', './Core/Iau2000Orientation', './Core/Iau2006XysData', './Core/Iau2006XysSample', './Core/IauOrientationAxes', './Core/IauOrientationParameters', './Core/IndexDatatype', './Core/InterpolationAlgorithm', './Core/Intersect', './Core/Intersections2D', './Core/IntersectionTests', './Core/Interval', './Core/Ion', './Core/IonResource', './Core/isArray', './Core/isBitSet', './Core/isBlobUri', './Core/isCrossOriginUrl', './Core/isDataUri', './Core/isLeapYear', './Core/Iso8601', './Core/JulianDate', './Core/KeyboardEventModifier', './Core/LagrangePolynomialApproximation', './Core/LeapSecond', './Core/LinearApproximation', './Core/LinearSpline', './Core/loadCRN', './Core/loadImageFromTypedArray', './Core/loadKTX', './Core/ManagedArray', './Core/MapboxApi', './Core/MapProjection', './Core/Math', './Core/Matrix2', './Core/Matrix3', './Core/Matrix4', './Core/mergeSort', './Core/NearFarScalar', './Core/objectToQuery', './Core/Occluder', './Core/oneTimeWarning', './Core/OrientedBoundingBox', './Core/OrthographicFrustum', './Core/OrthographicOffCenterFrustum', './Core/Packable', './Core/PackableForInterpolation', './Core/parseResponseHeaders', './Core/PerspectiveFrustum', './Core/PerspectiveOffCenterFrustum', './Core/PinBuilder', './Core/PixelFormat', './Core/Plane', './Core/PlaneGeometry', './Core/PlaneOutlineGeometry', './Core/pointInsideTriangle', './Core/PolygonGeometry', './Core/PolygonGeometryLibrary', './Core/PolygonHierarchy', './Core/PolygonOutlineGeometry', './Core/PolygonPipeline', './Core/PolylineGeometry', './Core/PolylinePipeline', './Core/PolylineVolumeGeometry', './Core/PolylineVolumeGeometryLibrary', './Core/PolylineVolumeOutlineGeometry', './Core/PrimitiveType', './Core/QuadraticRealPolynomial', './Core/QuantizedMeshTerrainData', './Core/QuarticRealPolynomial', './Core/Quaternion', './Core/QuaternionSpline', './Core/queryToObject', './Core/Queue', './Core/Ray', './Core/Rectangle', './Core/RectangleGeometry', './Core/RectangleGeometryLibrary', './Core/RectangleOutlineGeometry', './Core/ReferenceFrame', './Core/Request', './Core/requestAnimationFrame', './Core/RequestErrorEvent', './Core/RequestScheduler', './Core/RequestState', './Core/RequestType', './Core/Resource', './Core/RuntimeError', './Core/sampleTerrain', './Core/sampleTerrainMostDetailed', './Core/scaleToGeodeticSurface', './Core/ScreenSpaceEventHandler', './Core/ScreenSpaceEventType', './Core/ShowGeometryInstanceAttribute', './Core/Simon1994PlanetaryPositions', './Core/SimplePolylineGeometry', './Core/SphereGeometry', './Core/SphereOutlineGeometry', './Core/Spherical', './Core/Spline', './Core/subdivideArray', './Core/TaskProcessor', './Core/TerrainData', './Core/TerrainEncoding', './Core/TerrainMesh', './Core/TerrainProvider', './Core/TerrainQuantization', './Core/TileAvailability', './Core/TileProviderError', './Core/TilingScheme', './Core/TimeConstants', './Core/TimeInterval', './Core/TimeIntervalCollection', './Core/TimeStandard', './Core/Tipsify', './Core/Transforms', './Core/TranslationRotationScale', './Core/TridiagonalSystemSolver', './Core/TrustedServers', './Core/VertexFormat', './Core/VideoSynchronizer', './Core/Visibility', './Core/VRTheWorldTerrainProvider', './Core/WallGeometry', './Core/WallGeometryLibrary', './Core/WallOutlineGeometry', './Core/WebGLConstants', './Core/WebMercatorProjection', './Core/WebMercatorTilingScheme', './Core/WeightSpline', './Core/WindingOrder', './Core/wrapFunction', './Core/writeTextToCanvas', './DataSources/BillboardGraphics', './DataSources/BillboardVisualizer', './DataSources/BoundingSphereState', './DataSources/BoxGeometryUpdater', './DataSources/BoxGraphics', './DataSources/CallbackProperty', './DataSources/CheckerboardMaterialProperty', './DataSources/ColorMaterialProperty', './DataSources/CompositeEntityCollection', './DataSources/CompositeMaterialProperty', './DataSources/CompositePositionProperty', './DataSources/CompositeProperty', './DataSources/ConstantPositionProperty', './DataSources/ConstantProperty', './DataSources/CorridorGeometryUpdater', './DataSources/CorridorGraphics', './DataSources/createMaterialPropertyDescriptor', './DataSources/createPropertyDescriptor', './DataSources/createRawPropertyDescriptor', './DataSources/CustomDataSource', './DataSources/CylinderGeometryUpdater', './DataSources/CylinderGraphics', './DataSources/CzmlDataSource', './DataSources/DataSource', './DataSources/DataSourceClock', './DataSources/DataSourceCollection', './DataSources/DataSourceDisplay', './DataSources/DynamicGeometryBatch', './DataSources/DynamicGeometryUpdater', './DataSources/EllipseGeometryUpdater', './DataSources/EllipseGraphics', './DataSources/EllipsoidGeometryUpdater', './DataSources/EllipsoidGraphics', './DataSources/Entity', './DataSources/EntityCluster', './DataSources/EntityCollection', './DataSources/EntityView', './DataSources/GeoJsonDataSource', './DataSources/GeometryUpdater', './DataSources/GeometryVisualizer', './DataSources/GridMaterialProperty', './DataSources/ImageMaterialProperty', './DataSources/KmlCamera', './DataSources/KmlDataSource', './DataSources/KmlLookAt', './DataSources/KmlTour', './DataSources/KmlTourFlyTo', './DataSources/KmlTourWait', './DataSources/LabelGraphics', './DataSources/LabelVisualizer', './DataSources/MaterialProperty', './DataSources/ModelGraphics', './DataSources/ModelVisualizer', './DataSources/NodeTransformationProperty', './DataSources/PathGraphics', './DataSources/PathVisualizer', './DataSources/PlaneGeometryUpdater', './DataSources/PlaneGraphics', './DataSources/PointGraphics', './DataSources/PointVisualizer', './DataSources/PolygonGeometryUpdater', './DataSources/PolygonGraphics', './DataSources/PolylineArrowMaterialProperty', './DataSources/PolylineDashMaterialProperty', './DataSources/PolylineGeometryUpdater', './DataSources/PolylineGlowMaterialProperty', './DataSources/PolylineGraphics', './DataSources/PolylineOutlineMaterialProperty', './DataSources/PolylineVisualizer', './DataSources/PolylineVolumeGeometryUpdater', './DataSources/PolylineVolumeGraphics', './DataSources/PositionProperty', './DataSources/PositionPropertyArray', './DataSources/Property', './DataSources/PropertyArray', './DataSources/PropertyBag', './DataSources/RectangleGeometryUpdater', './DataSources/RectangleGraphics', './DataSources/ReferenceProperty', './DataSources/Rotation', './DataSources/SampledPositionProperty', './DataSources/SampledProperty', './DataSources/ScaledPositionProperty', './DataSources/StaticGeometryColorBatch', './DataSources/StaticGeometryPerMaterialBatch', './DataSources/StaticGroundGeometryColorBatch', './DataSources/StaticOutlineGeometryBatch', './DataSources/StripeMaterialProperty', './DataSources/StripeOrientation', './DataSources/TimeIntervalCollectionPositionProperty', './DataSources/TimeIntervalCollectionProperty', './DataSources/VelocityOrientationProperty', './DataSources/VelocityVectorProperty', './DataSources/Visualizer', './DataSources/WallGeometryUpdater', './DataSources/WallGraphics', './Renderer/AutomaticUniforms', './Renderer/Buffer', './Renderer/BufferUsage', './Renderer/ClearCommand', './Renderer/ComputeCommand', './Renderer/ComputeEngine', './Renderer/Context', './Renderer/ContextLimits', './Renderer/createUniform', './Renderer/createUniformArray', './Renderer/CubeMap', './Renderer/CubeMapFace', './Renderer/DrawCommand', './Renderer/Framebuffer', './Renderer/freezeRenderState', './Renderer/loadCubeMap', './Renderer/MipmapHint', './Renderer/modernizeShader', './Renderer/Pass', './Renderer/PassState', './Renderer/PickFramebuffer', './Renderer/PixelDatatype', './Renderer/Renderbuffer', './Renderer/RenderbufferFormat', './Renderer/RenderState', './Renderer/Sampler', './Renderer/ShaderCache', './Renderer/ShaderProgram', './Renderer/ShaderSource', './Renderer/Texture', './Renderer/TextureMagnificationFilter', './Renderer/TextureMinificationFilter', './Renderer/TextureWrap', './Renderer/UniformState', './Renderer/VertexArray', './Renderer/VertexArrayFacade', './Scene/Appearance', './Scene/ArcGisMapServerImageryProvider', './Scene/AttributeType', './Scene/Axis', './Scene/Batched3DModel3DTileContent', './Scene/BatchTable', './Scene/Billboard', './Scene/BillboardCollection', './Scene/BingMapsImageryProvider', './Scene/BingMapsStyle', './Scene/BlendEquation', './Scene/BlendFunction', './Scene/BlendingState', './Scene/BlendOption', './Scene/BoxEmitter', './Scene/BrdfLutGenerator', './Scene/Camera', './Scene/CameraEventAggregator', './Scene/CameraEventType', './Scene/CameraFlightPath', './Scene/Cesium3DTile', './Scene/Cesium3DTileBatchTable', './Scene/Cesium3DTileChildrenVisibility', './Scene/Cesium3DTileColorBlendMode', './Scene/Cesium3DTileContent', './Scene/Cesium3DTileContentFactory', './Scene/Cesium3DTileContentState', './Scene/Cesium3DTileFeature', './Scene/Cesium3DTileFeatureTable', './Scene/Cesium3DTileOptimizationHint', './Scene/Cesium3DTileOptimizations', './Scene/Cesium3DTilePointFeature', './Scene/Cesium3DTileRefine', './Scene/Cesium3DTileset', './Scene/Cesium3DTilesetStatistics', './Scene/Cesium3DTilesetTraversal', './Scene/Cesium3DTileStyle', './Scene/Cesium3DTileStyleEngine', './Scene/CircleEmitter', './Scene/ClassificationModel', './Scene/ClassificationPrimitive', './Scene/ClassificationType', './Scene/ClippingPlane', './Scene/ClippingPlaneCollection', './Scene/ColorBlendMode', './Scene/Composite3DTileContent', './Scene/ConditionsExpression', './Scene/ConeEmitter', './Scene/createBillboardPointCallback', './Scene/createOpenStreetMapImageryProvider', './Scene/createTangentSpaceDebugPrimitive', './Scene/createTileMapServiceImageryProvider', './Scene/CreditDisplay', './Scene/CullFace', './Scene/DebugAppearance', './Scene/DebugCameraPrimitive', './Scene/DebugModelMatrixPrimitive', './Scene/DepthFunction', './Scene/DepthPlane', './Scene/DerivedCommand', './Scene/DeviceOrientationCameraController', './Scene/DiscardMissingTileImagePolicy', './Scene/DracoLoader', './Scene/EllipsoidPrimitive', './Scene/EllipsoidSurfaceAppearance', './Scene/Empty3DTileContent', './Scene/Expression', './Scene/ExpressionNodeType', './Scene/Fog', './Scene/FrameRateMonitor', './Scene/FrameState', './Scene/FrustumCommands', './Scene/FXAA', './Scene/Geometry3DTileContent', './Scene/getBinaryAccessor', './Scene/getClipAndStyleCode', './Scene/getClippingFunction', './Scene/GetFeatureInfoFormat', './Scene/Globe', './Scene/GlobeDepth', './Scene/GlobeSurfaceShaderSet', './Scene/GlobeSurfaceTile', './Scene/GlobeSurfaceTileProvider', './Scene/GoogleEarthEnterpriseImageryProvider', './Scene/GoogleEarthEnterpriseMapsProvider', './Scene/GridImageryProvider', './Scene/GroundPrimitive', './Scene/HeightReference', './Scene/HorizontalOrigin', './Scene/Imagery', './Scene/ImageryLayer', './Scene/ImageryLayerCollection', './Scene/ImageryLayerFeatureInfo', './Scene/ImageryProvider', './Scene/ImagerySplitDirection', './Scene/ImageryState', './Scene/Instanced3DModel3DTileContent', './Scene/InvertClassification', './Scene/IonImageryProvider', './Scene/JobScheduler', './Scene/JobType', './Scene/Label', './Scene/LabelCollection', './Scene/LabelStyle', './Scene/MapboxImageryProvider', './Scene/MapMode2D', './Scene/Material', './Scene/MaterialAppearance', './Scene/Model', './Scene/ModelAnimation', './Scene/ModelAnimationCache', './Scene/ModelAnimationCollection', './Scene/ModelAnimationLoop', './Scene/ModelAnimationState', './Scene/ModelInstance', './Scene/ModelInstanceCollection', './Scene/ModelLoadResources', './Scene/ModelMaterial', './Scene/ModelMesh', './Scene/ModelNode', './Scene/ModelUtility', './Scene/Moon', './Scene/NeverTileDiscardPolicy', './Scene/OIT', './Scene/Particle', './Scene/ParticleBurst', './Scene/ParticleEmitter', './Scene/ParticleSystem', './Scene/PerformanceDisplay', './Scene/PerInstanceColorAppearance', './Scene/PickDepth', './Scene/PointCloud3DTileContent', './Scene/PointCloudEyeDomeLighting', './Scene/PointCloudShading', './Scene/PointPrimitive', './Scene/PointPrimitiveCollection', './Scene/Polyline', './Scene/PolylineCollection', './Scene/PolylineColorAppearance', './Scene/PolylineMaterialAppearance', './Scene/Primitive', './Scene/PrimitiveCollection', './Scene/PrimitivePipeline', './Scene/PrimitiveState', './Scene/QuadtreeOccluders', './Scene/QuadtreePrimitive', './Scene/QuadtreeTile', './Scene/QuadtreeTileLoadState', './Scene/QuadtreeTileProvider', './Scene/Scene', './Scene/SceneMode', './Scene/SceneTransforms', './Scene/SceneTransitioner', './Scene/ScreenSpaceCameraController', './Scene/ShadowMap', './Scene/ShadowMapShader', './Scene/ShadowMode', './Scene/SingleTileImageryProvider', './Scene/SkyAtmosphere', './Scene/SkyBox', './Scene/SphereEmitter', './Scene/StencilFunction', './Scene/StencilOperation', './Scene/StyleExpression', './Scene/Sun', './Scene/SunPostProcess', './Scene/TerrainState', './Scene/TextureAtlas', './Scene/TileBoundingRegion', './Scene/TileBoundingSphere', './Scene/TileBoundingVolume', './Scene/TileCoordinatesImageryProvider', './Scene/TileDiscardPolicy', './Scene/TileImagery', './Scene/TileOrientedBoundingBox', './Scene/TileReplacementQueue', './Scene/Tileset3DTileContent', './Scene/TileState', './Scene/TileTerrain', './Scene/TimeDynamicImagery', './Scene/TweenCollection', './Scene/UrlTemplateImageryProvider', './Scene/Vector3DTileBatch', './Scene/Vector3DTileContent', './Scene/Vector3DTileGeometry', './Scene/Vector3DTilePoints', './Scene/Vector3DTilePolygons', './Scene/Vector3DTilePolylines', './Scene/Vector3DTilePrimitive', './Scene/VerticalOrigin', './Scene/ViewportQuad', './Scene/WebMapServiceImageryProvider', './Scene/WebMapTileServiceImageryProvider', './Shaders/AdjustTranslucentFS', './Shaders/Appearances/AllMaterialAppearanceFS', './Shaders/Appearances/AllMaterialAppearanceVS', './Shaders/Appearances/BasicMaterialAppearanceFS', './Shaders/Appearances/BasicMaterialAppearanceVS', './Shaders/Appearances/EllipsoidSurfaceAppearanceFS', './Shaders/Appearances/EllipsoidSurfaceAppearanceVS', './Shaders/Appearances/PerInstanceColorAppearanceFS', './Shaders/Appearances/PerInstanceColorAppearanceVS', './Shaders/Appearances/PerInstanceFlatColorAppearanceFS', './Shaders/Appearances/PerInstanceFlatColorAppearanceVS', './Shaders/Appearances/PolylineColorAppearanceVS', './Shaders/Appearances/PolylineMaterialAppearanceVS', './Shaders/Appearances/TexturedMaterialAppearanceFS', './Shaders/Appearances/TexturedMaterialAppearanceVS', './Shaders/BillboardCollectionFS', './Shaders/BillboardCollectionVS', './Shaders/BrdfLutGeneratorFS', './Shaders/Builtin/Constants/degreesPerRadian', './Shaders/Builtin/Constants/depthRange', './Shaders/Builtin/Constants/epsilon1', './Shaders/Builtin/Constants/epsilon2', './Shaders/Builtin/Constants/epsilon3', './Shaders/Builtin/Constants/epsilon4', './Shaders/Builtin/Constants/epsilon5', './Shaders/Builtin/Constants/epsilon6', './Shaders/Builtin/Constants/epsilon7', './Shaders/Builtin/Constants/infinity', './Shaders/Builtin/Constants/oneOverPi', './Shaders/Builtin/Constants/oneOverTwoPi', './Shaders/Builtin/Constants/passCesium3DTile', './Shaders/Builtin/Constants/passCesium3DTileClassification', './Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow', './Shaders/Builtin/Constants/passClassification', './Shaders/Builtin/Constants/passCompute', './Shaders/Builtin/Constants/passEnvironment', './Shaders/Builtin/Constants/passGlobe', './Shaders/Builtin/Constants/passOpaque', './Shaders/Builtin/Constants/passOverlay', './Shaders/Builtin/Constants/passTerrainClassification', './Shaders/Builtin/Constants/passTranslucent', './Shaders/Builtin/Constants/pi', './Shaders/Builtin/Constants/piOverFour', './Shaders/Builtin/Constants/piOverSix', './Shaders/Builtin/Constants/piOverThree', './Shaders/Builtin/Constants/piOverTwo', './Shaders/Builtin/Constants/radiansPerDegree', './Shaders/Builtin/Constants/sceneMode2D', './Shaders/Builtin/Constants/sceneMode3D', './Shaders/Builtin/Constants/sceneModeColumbusView', './Shaders/Builtin/Constants/sceneModeMorphing', './Shaders/Builtin/Constants/solarRadius', './Shaders/Builtin/Constants/threePiOver2', './Shaders/Builtin/Constants/twoPi', './Shaders/Builtin/Constants/webMercatorMaxLatitude', './Shaders/Builtin/CzmBuiltins', './Shaders/Builtin/Functions/alphaWeight', './Shaders/Builtin/Functions/antialias', './Shaders/Builtin/Functions/cascadeColor', './Shaders/Builtin/Functions/cascadeDistance', './Shaders/Builtin/Functions/cascadeMatrix', './Shaders/Builtin/Functions/cascadeWeights', './Shaders/Builtin/Functions/columbusViewMorph', './Shaders/Builtin/Functions/computePosition', './Shaders/Builtin/Functions/cosineAndSine', './Shaders/Builtin/Functions/decompressTextureCoordinates', './Shaders/Builtin/Functions/depthClampFarPlane', './Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates', './Shaders/Builtin/Functions/ellipsoidContainsPoint', './Shaders/Builtin/Functions/ellipsoidNew', './Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates', './Shaders/Builtin/Functions/equalsEpsilon', './Shaders/Builtin/Functions/eyeOffset', './Shaders/Builtin/Functions/eyeToWindowCoordinates', './Shaders/Builtin/Functions/fog', './Shaders/Builtin/Functions/geodeticSurfaceNormal', './Shaders/Builtin/Functions/getDefaultMaterial', './Shaders/Builtin/Functions/getLambertDiffuse', './Shaders/Builtin/Functions/getSpecular', './Shaders/Builtin/Functions/getWaterNoise', './Shaders/Builtin/Functions/getWgs84EllipsoidEC', './Shaders/Builtin/Functions/HSBToRGB', './Shaders/Builtin/Functions/HSLToRGB', './Shaders/Builtin/Functions/hue', './Shaders/Builtin/Functions/isEmpty', './Shaders/Builtin/Functions/isFull', './Shaders/Builtin/Functions/latitudeToWebMercatorFraction', './Shaders/Builtin/Functions/luminance', './Shaders/Builtin/Functions/metersPerPixel', './Shaders/Builtin/Functions/modelToWindowCoordinates', './Shaders/Builtin/Functions/multiplyWithColorBalance', './Shaders/Builtin/Functions/nearFarScalar', './Shaders/Builtin/Functions/octDecode', './Shaders/Builtin/Functions/packDepth', './Shaders/Builtin/Functions/phong', './Shaders/Builtin/Functions/pointAlongRay', './Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval', './Shaders/Builtin/Functions/reverseLogDepth', './Shaders/Builtin/Functions/RGBToHSB', './Shaders/Builtin/Functions/RGBToHSL', './Shaders/Builtin/Functions/RGBToXYZ', './Shaders/Builtin/Functions/saturation', './Shaders/Builtin/Functions/shadowDepthCompare', './Shaders/Builtin/Functions/shadowVisibility', './Shaders/Builtin/Functions/signNotZero', './Shaders/Builtin/Functions/tangentToEyeSpaceMatrix', './Shaders/Builtin/Functions/transformPlane', './Shaders/Builtin/Functions/translateRelativeToEye', './Shaders/Builtin/Functions/translucentPhong', './Shaders/Builtin/Functions/transpose', './Shaders/Builtin/Functions/unpackDepth', './Shaders/Builtin/Functions/unpackFloat', './Shaders/Builtin/Functions/vertexLogDepth', './Shaders/Builtin/Functions/windowToEyeCoordinates', './Shaders/Builtin/Functions/writeDepthClampedToFarPlane', './Shaders/Builtin/Functions/writeLogDepth', './Shaders/Builtin/Functions/XYZToRGB', './Shaders/Builtin/Structs/depthRangeStruct', './Shaders/Builtin/Structs/ellipsoid', './Shaders/Builtin/Structs/material', './Shaders/Builtin/Structs/materialInput', './Shaders/Builtin/Structs/ray', './Shaders/Builtin/Structs/raySegment', './Shaders/Builtin/Structs/shadowParameters', './Shaders/CompositeOITFS', './Shaders/DepthPlaneFS', './Shaders/DepthPlaneVS', './Shaders/EllipsoidFS', './Shaders/EllipsoidVS', './Shaders/GlobeFS', './Shaders/GlobeVS', './Shaders/GroundAtmosphere', './Shaders/Materials/BumpMapMaterial', './Shaders/Materials/CheckerboardMaterial', './Shaders/Materials/DotMaterial', './Shaders/Materials/ElevationContourMaterial', './Shaders/Materials/ElevationRampMaterial', './Shaders/Materials/FadeMaterial', './Shaders/Materials/GridMaterial', './Shaders/Materials/NormalMapMaterial', './Shaders/Materials/PolylineArrowMaterial', './Shaders/Materials/PolylineDashMaterial', './Shaders/Materials/PolylineGlowMaterial', './Shaders/Materials/PolylineOutlineMaterial', './Shaders/Materials/RimLightingMaterial', './Shaders/Materials/SlopeRampMaterial', './Shaders/Materials/StripeMaterial', './Shaders/Materials/Water', './Shaders/PointPrimitiveCollectionFS', './Shaders/PointPrimitiveCollectionVS', './Shaders/PolylineCommon', './Shaders/PolylineFS', './Shaders/PolylineVS', './Shaders/PostProcessFilters/AdditiveBlend', './Shaders/PostProcessFilters/BrightPass', './Shaders/PostProcessFilters/FXAA', './Shaders/PostProcessFilters/GaussianBlur1D', './Shaders/PostProcessFilters/PassThrough', './Shaders/PostProcessFilters/PointCloudEyeDomeLighting', './Shaders/ReprojectWebMercatorFS', './Shaders/ReprojectWebMercatorVS', './Shaders/ShadowVolumeFS', './Shaders/ShadowVolumeVS', './Shaders/SkyAtmosphereFS', './Shaders/SkyAtmosphereVS', './Shaders/SkyBoxFS', './Shaders/SkyBoxVS', './Shaders/SunFS', './Shaders/SunTextureFS', './Shaders/SunVS', './Shaders/Vector3DTilePolylinesVS', './Shaders/ViewportQuadFS', './Shaders/ViewportQuadVS', './ThirdParty/Autolinker', './ThirdParty/earcut-2.1.1', './ThirdParty/GltfPipeline/addDefaults', './ThirdParty/GltfPipeline/addExtensionsRequired', './ThirdParty/GltfPipeline/addExtensionsUsed', './ThirdParty/GltfPipeline/addPipelineExtras', './ThirdParty/GltfPipeline/addToArray', './ThirdParty/GltfPipeline/byteLengthForComponentType', './ThirdParty/GltfPipeline/findAccessorMinMax', './ThirdParty/GltfPipeline/ForEach', './ThirdParty/GltfPipeline/getAccessorByteStride', './ThirdParty/GltfPipeline/getJointCountForMaterials', './ThirdParty/GltfPipeline/glslTypeToWebGLConstant', './ThirdParty/GltfPipeline/numberOfComponentsForType', './ThirdParty/GltfPipeline/parseBinaryGltf', './ThirdParty/GltfPipeline/processModelMaterialsCommon', './ThirdParty/GltfPipeline/processPbrMetallicRoughness', './ThirdParty/GltfPipeline/removeExtensionsRequired', './ThirdParty/GltfPipeline/removeExtensionsUsed', './ThirdParty/GltfPipeline/removePipelineExtras', './ThirdParty/GltfPipeline/techniqueParameterForSemantic', './ThirdParty/GltfPipeline/updateVersion', './ThirdParty/GltfPipeline/webGLConstantToGlslType', './ThirdParty/google-earth-dbroot-parser', './ThirdParty/jsep', './ThirdParty/kdbush', './ThirdParty/knockout-3.4.2', './ThirdParty/knockout-es5', './ThirdParty/knockout', './ThirdParty/measureText', './ThirdParty/mersenne-twister', './ThirdParty/NoSleep', './ThirdParty/protobuf-minimal', './ThirdParty/Shaders/FXAA3_11', './ThirdParty/sprintf', './ThirdParty/topojson', './ThirdParty/Tween', './ThirdParty/Uri', './ThirdParty/when', './ThirdParty/xss', './ThirdParty/zip', './Widgets/Animation/Animation', './Widgets/Animation/AnimationViewModel', './Widgets/BaseLayerPicker/BaseLayerPicker', './Widgets/BaseLayerPicker/BaseLayerPickerViewModel', './Widgets/BaseLayerPicker/createDefaultImageryProviderViewModels', './Widgets/BaseLayerPicker/createDefaultTerrainProviderViewModels', './Widgets/BaseLayerPicker/ProviderViewModel', './Widgets/Cesium3DTilesInspector/Cesium3DTilesInspector', './Widgets/Cesium3DTilesInspector/Cesium3DTilesInspectorViewModel', './Widgets/CesiumInspector/CesiumInspector', './Widgets/CesiumInspector/CesiumInspectorViewModel', './Widgets/CesiumWidget/CesiumWidget', './Widgets/ClockViewModel', './Widgets/Command', './Widgets/createCommand', './Widgets/FullscreenButton/FullscreenButton', './Widgets/FullscreenButton/FullscreenButtonViewModel', './Widgets/Geocoder/Geocoder', './Widgets/Geocoder/GeocoderViewModel', './Widgets/getElement', './Widgets/HomeButton/HomeButton', './Widgets/HomeButton/HomeButtonViewModel', './Widgets/InfoBox/InfoBox', './Widgets/InfoBox/InfoBoxViewModel', './Widgets/NavigationHelpButton/NavigationHelpButton', './Widgets/NavigationHelpButton/NavigationHelpButtonViewModel', './Widgets/PerformanceWatchdog/PerformanceWatchdog', './Widgets/PerformanceWatchdog/PerformanceWatchdogViewModel', './Widgets/ProjectionPicker/ProjectionPicker', './Widgets/ProjectionPicker/ProjectionPickerViewModel', './Widgets/SceneModePicker/SceneModePicker', './Widgets/SceneModePicker/SceneModePickerViewModel', './Widgets/SelectionIndicator/SelectionIndicator', './Widgets/SelectionIndicator/SelectionIndicatorViewModel', './Widgets/subscribeAndEvaluate', './Widgets/SvgPathBindingHandler', './Widgets/Timeline/Timeline', './Widgets/Timeline/TimelineHighlightRange', './Widgets/Timeline/TimelineTrack', './Widgets/ToggleButtonViewModel', './Widgets/Viewer/Viewer', './Widgets/Viewer/viewerCesium3DTilesInspectorMixin', './Widgets/Viewer/viewerCesiumInspectorMixin', './Widgets/Viewer/viewerDragDropMixin', './Widgets/Viewer/viewerPerformanceWatchdogMixin', './Widgets/VRButton/VRButton', './Widgets/VRButton/VRButtonViewModel', './Workers/createTaskProcessorWorker'], function(Core_appendForwardSlash, Core_arrayFill, Core_arrayRemoveDuplicates, Core_arraySlice, Core_AssociativeArray, Core_AttributeCompression, Core_AxisAlignedBoundingBox, Core_barycentricCoordinates, Core_binarySearch, Core_BingMapsApi, Core_BingMapsGeocoderService, Core_BoundingRectangle, Core_BoundingSphere, Core_BoxGeometry, Core_BoxOutlineGeometry, Core_buildModuleUrl, Core_cancelAnimationFrame, Core_Cartesian2, Core_Cartesian3, Core_Cartesian4, Core_Cartographic, Core_CartographicGeocoderService, Core_CatmullRomSpline, Core_CesiumTerrainProvider, Core_Check, Core_CircleGeometry, Core_CircleOutlineGeometry, Core_Clock, Core_ClockRange, Core_ClockStep, Core_clone, Core_Color, Core_ColorGeometryInstanceAttribute, Core_combine, Core_ComponentDatatype, Core_CompressedTextureBuffer, Core_CornerType, Core_CorridorGeometry, Core_CorridorGeometryLibrary, Core_CorridorOutlineGeometry, Core_createGuid, Core_createWorldTerrain, Core_Credit, Core_CubicRealPolynomial, Core_CullingVolume, Core_CylinderGeometry, Core_CylinderGeometryLibrary, Core_CylinderOutlineGeometry, Core_decodeGoogleEarthEnterpriseData, Core_DefaultProxy, Core_defaultValue, Core_defined, Core_defineProperties, Core_deprecationWarning, Core_destroyObject, Core_DeveloperError, Core_DistanceDisplayCondition, Core_DistanceDisplayConditionGeometryInstanceAttribute, Core_DoublyLinkedList, Core_EarthOrientationParameters, Core_EarthOrientationParametersSample, Core_EasingFunction, Core_EllipseGeometry, Core_EllipseGeometryLibrary, Core_EllipseOutlineGeometry, Core_Ellipsoid, Core_EllipsoidalOccluder, Core_EllipsoidGeodesic, Core_EllipsoidGeometry, Core_EllipsoidOutlineGeometry, Core_EllipsoidTangentPlane, Core_EllipsoidTerrainProvider, Core_EncodedCartesian3, Core_Event, Core_EventHelper, Core_ExtrapolationType, Core_FeatureDetection, Core_formatError, Core_freezeObject, Core_FrustumGeometry, Core_FrustumOutlineGeometry, Core_Fullscreen, Core_GeocoderService, Core_GeographicProjection, Core_GeographicTilingScheme, Core_Geometry, Core_GeometryAttribute, Core_GeometryAttributes, Core_GeometryInstance, Core_GeometryInstanceAttribute, Core_GeometryPipeline, Core_GeometryType, Core_getAbsoluteUri, Core_getBaseUri, Core_getExtensionFromUri, Core_getFilenameFromUri, Core_getImagePixels, Core_getMagic, Core_getStringFromTypedArray, Core_getTimestamp, Core_GoogleEarthEnterpriseMetadata, Core_GoogleEarthEnterpriseTerrainData, Core_GoogleEarthEnterpriseTerrainProvider, Core_GoogleEarthEnterpriseTileInformation, Core_GregorianDate, Core_HeadingPitchRange, Core_HeadingPitchRoll, Core_Heap, Core_HeightmapTerrainData, Core_HeightmapTessellator, Core_HermitePolynomialApproximation, Core_HermiteSpline, Core_Iau2000Orientation, Core_Iau2006XysData, Core_Iau2006XysSample, Core_IauOrientationAxes, Core_IauOrientationParameters, Core_IndexDatatype, Core_InterpolationAlgorithm, Core_Intersect, Core_Intersections2D, Core_IntersectionTests, Core_Interval, Core_Ion, Core_IonResource, Core_isArray, Core_isBitSet, Core_isBlobUri, Core_isCrossOriginUrl, Core_isDataUri, Core_isLeapYear, Core_Iso8601, Core_JulianDate, Core_KeyboardEventModifier, Core_LagrangePolynomialApproximation, Core_LeapSecond, Core_LinearApproximation, Core_LinearSpline, Core_loadCRN, Core_loadImageFromTypedArray, Core_loadKTX, Core_ManagedArray, Core_MapboxApi, Core_MapProjection, Core_Math, Core_Matrix2, Core_Matrix3, Core_Matrix4, Core_mergeSort, Core_NearFarScalar, Core_objectToQuery, Core_Occluder, Core_oneTimeWarning, Core_OrientedBoundingBox, Core_OrthographicFrustum, Core_OrthographicOffCenterFrustum, Core_Packable, Core_PackableForInterpolation, Core_parseResponseHeaders, Core_PerspectiveFrustum, Core_PerspectiveOffCenterFrustum, Core_PinBuilder, Core_PixelFormat, Core_Plane, Core_PlaneGeometry, Core_PlaneOutlineGeometry, Core_pointInsideTriangle, Core_PolygonGeometry, Core_PolygonGeometryLibrary, Core_PolygonHierarchy, Core_PolygonOutlineGeometry, Core_PolygonPipeline, Core_PolylineGeometry, Core_PolylinePipeline, Core_PolylineVolumeGeometry, Core_PolylineVolumeGeometryLibrary, Core_PolylineVolumeOutlineGeometry, Core_PrimitiveType, Core_QuadraticRealPolynomial, Core_QuantizedMeshTerrainData, Core_QuarticRealPolynomial, Core_Quaternion, Core_QuaternionSpline, Core_queryToObject, Core_Queue, Core_Ray, Core_Rectangle, Core_RectangleGeometry, Core_RectangleGeometryLibrary, Core_RectangleOutlineGeometry, Core_ReferenceFrame, Core_Request, Core_requestAnimationFrame, Core_RequestErrorEvent, Core_RequestScheduler, Core_RequestState, Core_RequestType, Core_Resource, Core_RuntimeError, Core_sampleTerrain, Core_sampleTerrainMostDetailed, Core_scaleToGeodeticSurface, Core_ScreenSpaceEventHandler, Core_ScreenSpaceEventType, Core_ShowGeometryInstanceAttribute, Core_Simon1994PlanetaryPositions, Core_SimplePolylineGeometry, Core_SphereGeometry, Core_SphereOutlineGeometry, Core_Spherical, Core_Spline, Core_subdivideArray, Core_TaskProcessor, Core_TerrainData, Core_TerrainEncoding, Core_TerrainMesh, Core_TerrainProvider, Core_TerrainQuantization, Core_TileAvailability, Core_TileProviderError, Core_TilingScheme, Core_TimeConstants, Core_TimeInterval, Core_TimeIntervalCollection, Core_TimeStandard, Core_Tipsify, Core_Transforms, Core_TranslationRotationScale, Core_TridiagonalSystemSolver, Core_TrustedServers, Core_VertexFormat, Core_VideoSynchronizer, Core_Visibility, Core_VRTheWorldTerrainProvider, Core_WallGeometry, Core_WallGeometryLibrary, Core_WallOutlineGeometry, Core_WebGLConstants, Core_WebMercatorProjection, Core_WebMercatorTilingScheme, Core_WeightSpline, Core_WindingOrder, Core_wrapFunction, Core_writeTextToCanvas, DataSources_BillboardGraphics, DataSources_BillboardVisualizer, DataSources_BoundingSphereState, DataSources_BoxGeometryUpdater, DataSources_BoxGraphics, DataSources_CallbackProperty, DataSources_CheckerboardMaterialProperty, DataSources_ColorMaterialProperty, DataSources_CompositeEntityCollection, DataSources_CompositeMaterialProperty, DataSources_CompositePositionProperty, DataSources_CompositeProperty, DataSources_ConstantPositionProperty, DataSources_ConstantProperty, DataSources_CorridorGeometryUpdater, DataSources_CorridorGraphics, DataSources_createMaterialPropertyDescriptor, DataSources_createPropertyDescriptor, DataSources_createRawPropertyDescriptor, DataSources_CustomDataSource, DataSources_CylinderGeometryUpdater, DataSources_CylinderGraphics, DataSources_CzmlDataSource, DataSources_DataSource, DataSources_DataSourceClock, DataSources_DataSourceCollection, DataSources_DataSourceDisplay, DataSources_DynamicGeometryBatch, DataSources_DynamicGeometryUpdater, DataSources_EllipseGeometryUpdater, DataSources_EllipseGraphics, DataSources_EllipsoidGeometryUpdater, DataSources_EllipsoidGraphics, DataSources_Entity, DataSources_EntityCluster, DataSources_EntityCollection, DataSources_EntityView, DataSources_GeoJsonDataSource, DataSources_GeometryUpdater, DataSources_GeometryVisualizer, DataSources_GridMaterialProperty, DataSources_ImageMaterialProperty, DataSources_KmlCamera, DataSources_KmlDataSource, DataSources_KmlLookAt, DataSources_KmlTour, DataSources_KmlTourFlyTo, DataSources_KmlTourWait, DataSources_LabelGraphics, DataSources_LabelVisualizer, DataSources_MaterialProperty, DataSources_ModelGraphics, DataSources_ModelVisualizer, DataSources_NodeTransformationProperty, DataSources_PathGraphics, DataSources_PathVisualizer, DataSources_PlaneGeometryUpdater, DataSources_PlaneGraphics, DataSources_PointGraphics, DataSources_PointVisualizer, DataSources_PolygonGeometryUpdater, DataSources_PolygonGraphics, DataSources_PolylineArrowMaterialProperty, DataSources_PolylineDashMaterialProperty, DataSources_PolylineGeometryUpdater, DataSources_PolylineGlowMaterialProperty, DataSources_PolylineGraphics, DataSources_PolylineOutlineMaterialProperty, DataSources_PolylineVisualizer, DataSources_PolylineVolumeGeometryUpdater, DataSources_PolylineVolumeGraphics, DataSources_PositionProperty, DataSources_PositionPropertyArray, DataSources_Property, DataSources_PropertyArray, DataSources_PropertyBag, DataSources_RectangleGeometryUpdater, DataSources_RectangleGraphics, DataSources_ReferenceProperty, DataSources_Rotation, DataSources_SampledPositionProperty, DataSources_SampledProperty, DataSources_ScaledPositionProperty, DataSources_StaticGeometryColorBatch, DataSources_StaticGeometryPerMaterialBatch, DataSources_StaticGroundGeometryColorBatch, DataSources_StaticOutlineGeometryBatch, DataSources_StripeMaterialProperty, DataSources_StripeOrientation, DataSources_TimeIntervalCollectionPositionProperty, DataSources_TimeIntervalCollectionProperty, DataSources_VelocityOrientationProperty, DataSources_VelocityVectorProperty, DataSources_Visualizer, DataSources_WallGeometryUpdater, DataSources_WallGraphics, Renderer_AutomaticUniforms, Renderer_Buffer, Renderer_BufferUsage, Renderer_ClearCommand, Renderer_ComputeCommand, Renderer_ComputeEngine, Renderer_Context, Renderer_ContextLimits, Renderer_createUniform, Renderer_createUniformArray, Renderer_CubeMap, Renderer_CubeMapFace, Renderer_DrawCommand, Renderer_Framebuffer, Renderer_freezeRenderState, Renderer_loadCubeMap, Renderer_MipmapHint, Renderer_modernizeShader, Renderer_Pass, Renderer_PassState, Renderer_PickFramebuffer, Renderer_PixelDatatype, Renderer_Renderbuffer, Renderer_RenderbufferFormat, Renderer_RenderState, Renderer_Sampler, Renderer_ShaderCache, Renderer_ShaderProgram, Renderer_ShaderSource, Renderer_Texture, Renderer_TextureMagnificationFilter, Renderer_TextureMinificationFilter, Renderer_TextureWrap, Renderer_UniformState, Renderer_VertexArray, Renderer_VertexArrayFacade, Scene_Appearance, Scene_ArcGisMapServerImageryProvider, Scene_AttributeType, Scene_Axis, Scene_Batched3DModel3DTileContent, Scene_BatchTable, Scene_Billboard, Scene_BillboardCollection, Scene_BingMapsImageryProvider, Scene_BingMapsStyle, Scene_BlendEquation, Scene_BlendFunction, Scene_BlendingState, Scene_BlendOption, Scene_BoxEmitter, Scene_BrdfLutGenerator, Scene_Camera, Scene_CameraEventAggregator, Scene_CameraEventType, Scene_CameraFlightPath, Scene_Cesium3DTile, Scene_Cesium3DTileBatchTable, Scene_Cesium3DTileChildrenVisibility, Scene_Cesium3DTileColorBlendMode, Scene_Cesium3DTileContent, Scene_Cesium3DTileContentFactory, Scene_Cesium3DTileContentState, Scene_Cesium3DTileFeature, Scene_Cesium3DTileFeatureTable, Scene_Cesium3DTileOptimizationHint, Scene_Cesium3DTileOptimizations, Scene_Cesium3DTilePointFeature, Scene_Cesium3DTileRefine, Scene_Cesium3DTileset, Scene_Cesium3DTilesetStatistics, Scene_Cesium3DTilesetTraversal, Scene_Cesium3DTileStyle, Scene_Cesium3DTileStyleEngine, Scene_CircleEmitter, Scene_ClassificationModel, Scene_ClassificationPrimitive, Scene_ClassificationType, Scene_ClippingPlane, Scene_ClippingPlaneCollection, Scene_ColorBlendMode, Scene_Composite3DTileContent, Scene_ConditionsExpression, Scene_ConeEmitter, Scene_createBillboardPointCallback, Scene_createOpenStreetMapImageryProvider, Scene_createTangentSpaceDebugPrimitive, Scene_createTileMapServiceImageryProvider, Scene_CreditDisplay, Scene_CullFace, Scene_DebugAppearance, Scene_DebugCameraPrimitive, Scene_DebugModelMatrixPrimitive, Scene_DepthFunction, Scene_DepthPlane, Scene_DerivedCommand, Scene_DeviceOrientationCameraController, Scene_DiscardMissingTileImagePolicy, Scene_DracoLoader, Scene_EllipsoidPrimitive, Scene_EllipsoidSurfaceAppearance, Scene_Empty3DTileContent, Scene_Expression, Scene_ExpressionNodeType, Scene_Fog, Scene_FrameRateMonitor, Scene_FrameState, Scene_FrustumCommands, Scene_FXAA, Scene_Geometry3DTileContent, Scene_getBinaryAccessor, Scene_getClipAndStyleCode, Scene_getClippingFunction, Scene_GetFeatureInfoFormat, Scene_Globe, Scene_GlobeDepth, Scene_GlobeSurfaceShaderSet, Scene_GlobeSurfaceTile, Scene_GlobeSurfaceTileProvider, Scene_GoogleEarthEnterpriseImageryProvider, Scene_GoogleEarthEnterpriseMapsProvider, Scene_GridImageryProvider, Scene_GroundPrimitive, Scene_HeightReference, Scene_HorizontalOrigin, Scene_Imagery, Scene_ImageryLayer, Scene_ImageryLayerCollection, Scene_ImageryLayerFeatureInfo, Scene_ImageryProvider, Scene_ImagerySplitDirection, Scene_ImageryState, Scene_Instanced3DModel3DTileContent, Scene_InvertClassification, Scene_IonImageryProvider, Scene_JobScheduler, Scene_JobType, Scene_Label, Scene_LabelCollection, Scene_LabelStyle, Scene_MapboxImageryProvider, Scene_MapMode2D, Scene_Material, Scene_MaterialAppearance, Scene_Model, Scene_ModelAnimation, Scene_ModelAnimationCache, Scene_ModelAnimationCollection, Scene_ModelAnimationLoop, Scene_ModelAnimationState, Scene_ModelInstance, Scene_ModelInstanceCollection, Scene_ModelLoadResources, Scene_ModelMaterial, Scene_ModelMesh, Scene_ModelNode, Scene_ModelUtility, Scene_Moon, Scene_NeverTileDiscardPolicy, Scene_OIT, Scene_Particle, Scene_ParticleBurst, Scene_ParticleEmitter, Scene_ParticleSystem, Scene_PerformanceDisplay, Scene_PerInstanceColorAppearance, Scene_PickDepth, Scene_PointCloud3DTileContent, Scene_PointCloudEyeDomeLighting, Scene_PointCloudShading, Scene_PointPrimitive, Scene_PointPrimitiveCollection, Scene_Polyline, Scene_PolylineCollection, Scene_PolylineColorAppearance, Scene_PolylineMaterialAppearance, Scene_Primitive, Scene_PrimitiveCollection, Scene_PrimitivePipeline, Scene_PrimitiveState, Scene_QuadtreeOccluders, Scene_QuadtreePrimitive, Scene_QuadtreeTile, Scene_QuadtreeTileLoadState, Scene_QuadtreeTileProvider, Scene_Scene, Scene_SceneMode, Scene_SceneTransforms, Scene_SceneTransitioner, Scene_ScreenSpaceCameraController, Scene_ShadowMap, Scene_ShadowMapShader, Scene_ShadowMode, Scene_SingleTileImageryProvider, Scene_SkyAtmosphere, Scene_SkyBox, Scene_SphereEmitter, Scene_StencilFunction, Scene_StencilOperation, Scene_StyleExpression, Scene_Sun, Scene_SunPostProcess, Scene_TerrainState, Scene_TextureAtlas, Scene_TileBoundingRegion, Scene_TileBoundingSphere, Scene_TileBoundingVolume, Scene_TileCoordinatesImageryProvider, Scene_TileDiscardPolicy, Scene_TileImagery, Scene_TileOrientedBoundingBox, Scene_TileReplacementQueue, Scene_Tileset3DTileContent, Scene_TileState, Scene_TileTerrain, Scene_TimeDynamicImagery, Scene_TweenCollection, Scene_UrlTemplateImageryProvider, Scene_Vector3DTileBatch, Scene_Vector3DTileContent, Scene_Vector3DTileGeometry, Scene_Vector3DTilePoints, Scene_Vector3DTilePolygons, Scene_Vector3DTilePolylines, Scene_Vector3DTilePrimitive, Scene_VerticalOrigin, Scene_ViewportQuad, Scene_WebMapServiceImageryProvider, Scene_WebMapTileServiceImageryProvider, Shaders_AdjustTranslucentFS, Shaders_Appearances_AllMaterialAppearanceFS, Shaders_Appearances_AllMaterialAppearanceVS, Shaders_Appearances_BasicMaterialAppearanceFS, Shaders_Appearances_BasicMaterialAppearanceVS, Shaders_Appearances_EllipsoidSurfaceAppearanceFS, Shaders_Appearances_EllipsoidSurfaceAppearanceVS, Shaders_Appearances_PerInstanceColorAppearanceFS, Shaders_Appearances_PerInstanceColorAppearanceVS, Shaders_Appearances_PerInstanceFlatColorAppearanceFS, Shaders_Appearances_PerInstanceFlatColorAppearanceVS, Shaders_Appearances_PolylineColorAppearanceVS, Shaders_Appearances_PolylineMaterialAppearanceVS, Shaders_Appearances_TexturedMaterialAppearanceFS, Shaders_Appearances_TexturedMaterialAppearanceVS, Shaders_BillboardCollectionFS, Shaders_BillboardCollectionVS, Shaders_BrdfLutGeneratorFS, Shaders_Builtin_Constants_degreesPerRadian, Shaders_Builtin_Constants_depthRange, Shaders_Builtin_Constants_epsilon1, Shaders_Builtin_Constants_epsilon2, Shaders_Builtin_Constants_epsilon3, Shaders_Builtin_Constants_epsilon4, Shaders_Builtin_Constants_epsilon5, Shaders_Builtin_Constants_epsilon6, Shaders_Builtin_Constants_epsilon7, Shaders_Builtin_Constants_infinity, Shaders_Builtin_Constants_oneOverPi, Shaders_Builtin_Constants_oneOverTwoPi, Shaders_Builtin_Constants_passCesium3DTile, Shaders_Builtin_Constants_passCesium3DTileClassification, Shaders_Builtin_Constants_passCesium3DTileClassificationIgnoreShow, Shaders_Builtin_Constants_passClassification, Shaders_Builtin_Constants_passCompute, Shaders_Builtin_Constants_passEnvironment, Shaders_Builtin_Constants_passGlobe, Shaders_Builtin_Constants_passOpaque, Shaders_Builtin_Constants_passOverlay, Shaders_Builtin_Constants_passTerrainClassification, Shaders_Builtin_Constants_passTranslucent, Shaders_Builtin_Constants_pi, Shaders_Builtin_Constants_piOverFour, Shaders_Builtin_Constants_piOverSix, Shaders_Builtin_Constants_piOverThree, Shaders_Builtin_Constants_piOverTwo, Shaders_Builtin_Constants_radiansPerDegree, Shaders_Builtin_Constants_sceneMode2D, Shaders_Builtin_Constants_sceneMode3D, Shaders_Builtin_Constants_sceneModeColumbusView, Shaders_Builtin_Constants_sceneModeMorphing, Shaders_Builtin_Constants_solarRadius, Shaders_Builtin_Constants_threePiOver2, Shaders_Builtin_Constants_twoPi, Shaders_Builtin_Constants_webMercatorMaxLatitude, Shaders_Builtin_CzmBuiltins, Shaders_Builtin_Functions_alphaWeight, Shaders_Builtin_Functions_antialias, Shaders_Builtin_Functions_cascadeColor, Shaders_Builtin_Functions_cascadeDistance, Shaders_Builtin_Functions_cascadeMatrix, Shaders_Builtin_Functions_cascadeWeights, Shaders_Builtin_Functions_columbusViewMorph, Shaders_Builtin_Functions_computePosition, Shaders_Builtin_Functions_cosineAndSine, Shaders_Builtin_Functions_decompressTextureCoordinates, Shaders_Builtin_Functions_depthClampFarPlane, Shaders_Builtin_Functions_eastNorthUpToEyeCoordinates, Shaders_Builtin_Functions_ellipsoidContainsPoint, Shaders_Builtin_Functions_ellipsoidNew, Shaders_Builtin_Functions_ellipsoidWgs84TextureCoordinates, Shaders_Builtin_Functions_equalsEpsilon, Shaders_Builtin_Functions_eyeOffset, Shaders_Builtin_Functions_eyeToWindowCoordinates, Shaders_Builtin_Functions_fog, Shaders_Builtin_Functions_geodeticSurfaceNormal, Shaders_Builtin_Functions_getDefaultMaterial, Shaders_Builtin_Functions_getLambertDiffuse, Shaders_Builtin_Functions_getSpecular, Shaders_Builtin_Functions_getWaterNoise, Shaders_Builtin_Functions_getWgs84EllipsoidEC, Shaders_Builtin_Functions_HSBToRGB, Shaders_Builtin_Functions_HSLToRGB, Shaders_Builtin_Functions_hue, Shaders_Builtin_Functions_isEmpty, Shaders_Builtin_Functions_isFull, Shaders_Builtin_Functions_latitudeToWebMercatorFraction, Shaders_Builtin_Functions_luminance, Shaders_Builtin_Functions_metersPerPixel, Shaders_Builtin_Functions_modelToWindowCoordinates, Shaders_Builtin_Functions_multiplyWithColorBalance, Shaders_Builtin_Functions_nearFarScalar, Shaders_Builtin_Functions_octDecode, Shaders_Builtin_Functions_packDepth, Shaders_Builtin_Functions_phong, Shaders_Builtin_Functions_pointAlongRay, Shaders_Builtin_Functions_rayEllipsoidIntersectionInterval, Shaders_Builtin_Functions_reverseLogDepth, Shaders_Builtin_Functions_RGBToHSB, Shaders_Builtin_Functions_RGBToHSL, Shaders_Builtin_Functions_RGBToXYZ, Shaders_Builtin_Functions_saturation, Shaders_Builtin_Functions_shadowDepthCompare, Shaders_Builtin_Functions_shadowVisibility, Shaders_Builtin_Functions_signNotZero, Shaders_Builtin_Functions_tangentToEyeSpaceMatrix, Shaders_Builtin_Functions_transformPlane, Shaders_Builtin_Functions_translateRelativeToEye, Shaders_Builtin_Functions_translucentPhong, Shaders_Builtin_Functions_transpose, Shaders_Builtin_Functions_unpackDepth, Shaders_Builtin_Functions_unpackFloat, Shaders_Builtin_Functions_vertexLogDepth, Shaders_Builtin_Functions_windowToEyeCoordinates, Shaders_Builtin_Functions_writeDepthClampedToFarPlane, Shaders_Builtin_Functions_writeLogDepth, Shaders_Builtin_Functions_XYZToRGB, Shaders_Builtin_Structs_depthRangeStruct, Shaders_Builtin_Structs_ellipsoid, Shaders_Builtin_Structs_material, Shaders_Builtin_Structs_materialInput, Shaders_Builtin_Structs_ray, Shaders_Builtin_Structs_raySegment, Shaders_Builtin_Structs_shadowParameters, Shaders_CompositeOITFS, Shaders_DepthPlaneFS, Shaders_DepthPlaneVS, Shaders_EllipsoidFS, Shaders_EllipsoidVS, Shaders_GlobeFS, Shaders_GlobeVS, Shaders_GroundAtmosphere, Shaders_Materials_BumpMapMaterial, Shaders_Materials_CheckerboardMaterial, Shaders_Materials_DotMaterial, Shaders_Materials_ElevationContourMaterial, Shaders_Materials_ElevationRampMaterial, Shaders_Materials_FadeMaterial, Shaders_Materials_GridMaterial, Shaders_Materials_NormalMapMaterial, Shaders_Materials_PolylineArrowMaterial, Shaders_Materials_PolylineDashMaterial, Shaders_Materials_PolylineGlowMaterial, Shaders_Materials_PolylineOutlineMaterial, Shaders_Materials_RimLightingMaterial, Shaders_Materials_SlopeRampMaterial, Shaders_Materials_StripeMaterial, Shaders_Materials_Water, Shaders_PointPrimitiveCollectionFS, Shaders_PointPrimitiveCollectionVS, Shaders_PolylineCommon, Shaders_PolylineFS, Shaders_PolylineVS, Shaders_PostProcessFilters_AdditiveBlend, Shaders_PostProcessFilters_BrightPass, Shaders_PostProcessFilters_FXAA, Shaders_PostProcessFilters_GaussianBlur1D, Shaders_PostProcessFilters_PassThrough, Shaders_PostProcessFilters_PointCloudEyeDomeLighting, Shaders_ReprojectWebMercatorFS, Shaders_ReprojectWebMercatorVS, Shaders_ShadowVolumeFS, Shaders_ShadowVolumeVS, Shaders_SkyAtmosphereFS, Shaders_SkyAtmosphereVS, Shaders_SkyBoxFS, Shaders_SkyBoxVS, Shaders_SunFS, Shaders_SunTextureFS, Shaders_SunVS, Shaders_Vector3DTilePolylinesVS, Shaders_ViewportQuadFS, Shaders_ViewportQuadVS, ThirdParty_Autolinker, ThirdParty_earcut_2_1_1, ThirdParty_GltfPipeline_addDefaults, ThirdParty_GltfPipeline_addExtensionsRequired, ThirdParty_GltfPipeline_addExtensionsUsed, ThirdParty_GltfPipeline_addPipelineExtras, ThirdParty_GltfPipeline_addToArray, ThirdParty_GltfPipeline_byteLengthForComponentType, ThirdParty_GltfPipeline_findAccessorMinMax, ThirdParty_GltfPipeline_ForEach, ThirdParty_GltfPipeline_getAccessorByteStride, ThirdParty_GltfPipeline_getJointCountForMaterials, ThirdParty_GltfPipeline_glslTypeToWebGLConstant, ThirdParty_GltfPipeline_numberOfComponentsForType, ThirdParty_GltfPipeline_parseBinaryGltf, ThirdParty_GltfPipeline_processModelMaterialsCommon, ThirdParty_GltfPipeline_processPbrMetallicRoughness, ThirdParty_GltfPipeline_removeExtensionsRequired, ThirdParty_GltfPipeline_removeExtensionsUsed, ThirdParty_GltfPipeline_removePipelineExtras, ThirdParty_GltfPipeline_techniqueParameterForSemantic, ThirdParty_GltfPipeline_updateVersion, ThirdParty_GltfPipeline_webGLConstantToGlslType, ThirdParty_google_earth_dbroot_parser, ThirdParty_jsep, ThirdParty_kdbush, ThirdParty_knockout_3_4_2, ThirdParty_knockout_es5, ThirdParty_knockout, ThirdParty_measureText, ThirdParty_mersenne_twister, ThirdParty_NoSleep, ThirdParty_protobuf_minimal, ThirdParty_Shaders_FXAA3_11, ThirdParty_sprintf, ThirdParty_topojson, ThirdParty_Tween, ThirdParty_Uri, ThirdParty_when, ThirdParty_xss, ThirdParty_zip, Widgets_Animation_Animation, Widgets_Animation_AnimationViewModel, Widgets_BaseLayerPicker_BaseLayerPicker, Widgets_BaseLayerPicker_BaseLayerPickerViewModel, Widgets_BaseLayerPicker_createDefaultImageryProviderViewModels, Widgets_BaseLayerPicker_createDefaultTerrainProviderViewModels, Widgets_BaseLayerPicker_ProviderViewModel, Widgets_Cesium3DTilesInspector_Cesium3DTilesInspector, Widgets_Cesium3DTilesInspector_Cesium3DTilesInspectorViewModel, Widgets_CesiumInspector_CesiumInspector, Widgets_CesiumInspector_CesiumInspectorViewModel, Widgets_CesiumWidget_CesiumWidget, Widgets_ClockViewModel, Widgets_Command, Widgets_createCommand, Widgets_FullscreenButton_FullscreenButton, Widgets_FullscreenButton_FullscreenButtonViewModel, Widgets_Geocoder_Geocoder, Widgets_Geocoder_GeocoderViewModel, Widgets_getElement, Widgets_HomeButton_HomeButton, Widgets_HomeButton_HomeButtonViewModel, Widgets_InfoBox_InfoBox, Widgets_InfoBox_InfoBoxViewModel, Widgets_NavigationHelpButton_NavigationHelpButton, Widgets_NavigationHelpButton_NavigationHelpButtonViewModel, Widgets_PerformanceWatchdog_PerformanceWatchdog, Widgets_PerformanceWatchdog_PerformanceWatchdogViewModel, Widgets_ProjectionPicker_ProjectionPicker, Widgets_ProjectionPicker_ProjectionPickerViewModel, Widgets_SceneModePicker_SceneModePicker, Widgets_SceneModePicker_SceneModePickerViewModel, Widgets_SelectionIndicator_SelectionIndicator, Widgets_SelectionIndicator_SelectionIndicatorViewModel, Widgets_subscribeAndEvaluate, Widgets_SvgPathBindingHandler, Widgets_Timeline_Timeline, Widgets_Timeline_TimelineHighlightRange, Widgets_Timeline_TimelineTrack, Widgets_ToggleButtonViewModel, Widgets_Viewer_Viewer, Widgets_Viewer_viewerCesium3DTilesInspectorMixin, Widgets_Viewer_viewerCesiumInspectorMixin, Widgets_Viewer_viewerDragDropMixin, Widgets_Viewer_viewerPerformanceWatchdogMixin, Widgets_VRButton_VRButton, Widgets_VRButton_VRButtonViewModel, Workers_createTaskProcessorWorker) { - 'use strict'; - var Cesium = { - VERSION : '1.44', - _shaders : {} - }; - Cesium['appendForwardSlash'] = Core_appendForwardSlash; - Cesium['arrayFill'] = Core_arrayFill; - Cesium['arrayRemoveDuplicates'] = Core_arrayRemoveDuplicates; - Cesium['arraySlice'] = Core_arraySlice; - Cesium['AssociativeArray'] = Core_AssociativeArray; - Cesium['AttributeCompression'] = Core_AttributeCompression; - Cesium['AxisAlignedBoundingBox'] = Core_AxisAlignedBoundingBox; - Cesium['barycentricCoordinates'] = Core_barycentricCoordinates; - Cesium['binarySearch'] = Core_binarySearch; - Cesium['BingMapsApi'] = Core_BingMapsApi; - Cesium['BingMapsGeocoderService'] = Core_BingMapsGeocoderService; - Cesium['BoundingRectangle'] = Core_BoundingRectangle; - Cesium['BoundingSphere'] = Core_BoundingSphere; - Cesium['BoxGeometry'] = Core_BoxGeometry; - Cesium['BoxOutlineGeometry'] = Core_BoxOutlineGeometry; - Cesium['buildModuleUrl'] = Core_buildModuleUrl; - Cesium['cancelAnimationFrame'] = Core_cancelAnimationFrame; - Cesium['Cartesian2'] = Core_Cartesian2; - Cesium['Cartesian3'] = Core_Cartesian3; - Cesium['Cartesian4'] = Core_Cartesian4; - Cesium['Cartographic'] = Core_Cartographic; - Cesium['CartographicGeocoderService'] = Core_CartographicGeocoderService; - Cesium['CatmullRomSpline'] = Core_CatmullRomSpline; - Cesium['CesiumTerrainProvider'] = Core_CesiumTerrainProvider; - Cesium['Check'] = Core_Check; - Cesium['CircleGeometry'] = Core_CircleGeometry; - Cesium['CircleOutlineGeometry'] = Core_CircleOutlineGeometry; - Cesium['Clock'] = Core_Clock; - Cesium['ClockRange'] = Core_ClockRange; - Cesium['ClockStep'] = Core_ClockStep; - Cesium['clone'] = Core_clone; - Cesium['Color'] = Core_Color; - Cesium['ColorGeometryInstanceAttribute'] = Core_ColorGeometryInstanceAttribute; - Cesium['combine'] = Core_combine; - Cesium['ComponentDatatype'] = Core_ComponentDatatype; - Cesium['CompressedTextureBuffer'] = Core_CompressedTextureBuffer; - Cesium['CornerType'] = Core_CornerType; - Cesium['CorridorGeometry'] = Core_CorridorGeometry; - Cesium['CorridorGeometryLibrary'] = Core_CorridorGeometryLibrary; - Cesium['CorridorOutlineGeometry'] = Core_CorridorOutlineGeometry; - Cesium['createGuid'] = Core_createGuid; - Cesium['createWorldTerrain'] = Core_createWorldTerrain; - Cesium['Credit'] = Core_Credit; - Cesium['CubicRealPolynomial'] = Core_CubicRealPolynomial; - Cesium['CullingVolume'] = Core_CullingVolume; - Cesium['CylinderGeometry'] = Core_CylinderGeometry; - Cesium['CylinderGeometryLibrary'] = Core_CylinderGeometryLibrary; - Cesium['CylinderOutlineGeometry'] = Core_CylinderOutlineGeometry; - Cesium['decodeGoogleEarthEnterpriseData'] = Core_decodeGoogleEarthEnterpriseData; - Cesium['DefaultProxy'] = Core_DefaultProxy; - Cesium['defaultValue'] = Core_defaultValue; - Cesium['defined'] = Core_defined; - Cesium['defineProperties'] = Core_defineProperties; - Cesium['deprecationWarning'] = Core_deprecationWarning; - Cesium['destroyObject'] = Core_destroyObject; - Cesium['DeveloperError'] = Core_DeveloperError; - Cesium['DistanceDisplayCondition'] = Core_DistanceDisplayCondition; - Cesium['DistanceDisplayConditionGeometryInstanceAttribute'] = Core_DistanceDisplayConditionGeometryInstanceAttribute; - Cesium['DoublyLinkedList'] = Core_DoublyLinkedList; - Cesium['EarthOrientationParameters'] = Core_EarthOrientationParameters; - Cesium['EarthOrientationParametersSample'] = Core_EarthOrientationParametersSample; - Cesium['EasingFunction'] = Core_EasingFunction; - Cesium['EllipseGeometry'] = Core_EllipseGeometry; - Cesium['EllipseGeometryLibrary'] = Core_EllipseGeometryLibrary; - Cesium['EllipseOutlineGeometry'] = Core_EllipseOutlineGeometry; - Cesium['Ellipsoid'] = Core_Ellipsoid; - Cesium['EllipsoidalOccluder'] = Core_EllipsoidalOccluder; - Cesium['EllipsoidGeodesic'] = Core_EllipsoidGeodesic; - Cesium['EllipsoidGeometry'] = Core_EllipsoidGeometry; - Cesium['EllipsoidOutlineGeometry'] = Core_EllipsoidOutlineGeometry; - Cesium['EllipsoidTangentPlane'] = Core_EllipsoidTangentPlane; - Cesium['EllipsoidTerrainProvider'] = Core_EllipsoidTerrainProvider; - Cesium['EncodedCartesian3'] = Core_EncodedCartesian3; - Cesium['Event'] = Core_Event; - Cesium['EventHelper'] = Core_EventHelper; - Cesium['ExtrapolationType'] = Core_ExtrapolationType; - Cesium['FeatureDetection'] = Core_FeatureDetection; - Cesium['formatError'] = Core_formatError; - Cesium['freezeObject'] = Core_freezeObject; - Cesium['FrustumGeometry'] = Core_FrustumGeometry; - Cesium['FrustumOutlineGeometry'] = Core_FrustumOutlineGeometry; - Cesium['Fullscreen'] = Core_Fullscreen; - Cesium['GeocoderService'] = Core_GeocoderService; - Cesium['GeographicProjection'] = Core_GeographicProjection; - Cesium['GeographicTilingScheme'] = Core_GeographicTilingScheme; - Cesium['Geometry'] = Core_Geometry; - Cesium['GeometryAttribute'] = Core_GeometryAttribute; - Cesium['GeometryAttributes'] = Core_GeometryAttributes; - Cesium['GeometryInstance'] = Core_GeometryInstance; - Cesium['GeometryInstanceAttribute'] = Core_GeometryInstanceAttribute; - Cesium['GeometryPipeline'] = Core_GeometryPipeline; - Cesium['GeometryType'] = Core_GeometryType; - Cesium['getAbsoluteUri'] = Core_getAbsoluteUri; - Cesium['getBaseUri'] = Core_getBaseUri; - Cesium['getExtensionFromUri'] = Core_getExtensionFromUri; - Cesium['getFilenameFromUri'] = Core_getFilenameFromUri; - Cesium['getImagePixels'] = Core_getImagePixels; - Cesium['getMagic'] = Core_getMagic; - Cesium['getStringFromTypedArray'] = Core_getStringFromTypedArray; - Cesium['getTimestamp'] = Core_getTimestamp; - Cesium['GoogleEarthEnterpriseMetadata'] = Core_GoogleEarthEnterpriseMetadata; - Cesium['GoogleEarthEnterpriseTerrainData'] = Core_GoogleEarthEnterpriseTerrainData; - Cesium['GoogleEarthEnterpriseTerrainProvider'] = Core_GoogleEarthEnterpriseTerrainProvider; - Cesium['GoogleEarthEnterpriseTileInformation'] = Core_GoogleEarthEnterpriseTileInformation; - Cesium['GregorianDate'] = Core_GregorianDate; - Cesium['HeadingPitchRange'] = Core_HeadingPitchRange; - Cesium['HeadingPitchRoll'] = Core_HeadingPitchRoll; - Cesium['Heap'] = Core_Heap; - Cesium['HeightmapTerrainData'] = Core_HeightmapTerrainData; - Cesium['HeightmapTessellator'] = Core_HeightmapTessellator; - Cesium['HermitePolynomialApproximation'] = Core_HermitePolynomialApproximation; - Cesium['HermiteSpline'] = Core_HermiteSpline; - Cesium['Iau2000Orientation'] = Core_Iau2000Orientation; - Cesium['Iau2006XysData'] = Core_Iau2006XysData; - Cesium['Iau2006XysSample'] = Core_Iau2006XysSample; - Cesium['IauOrientationAxes'] = Core_IauOrientationAxes; - Cesium['IauOrientationParameters'] = Core_IauOrientationParameters; - Cesium['IndexDatatype'] = Core_IndexDatatype; - Cesium['InterpolationAlgorithm'] = Core_InterpolationAlgorithm; - Cesium['Intersect'] = Core_Intersect; - Cesium['Intersections2D'] = Core_Intersections2D; - Cesium['IntersectionTests'] = Core_IntersectionTests; - Cesium['Interval'] = Core_Interval; - Cesium['Ion'] = Core_Ion; - Cesium['IonResource'] = Core_IonResource; - Cesium['isArray'] = Core_isArray; - Cesium['isBitSet'] = Core_isBitSet; - Cesium['isBlobUri'] = Core_isBlobUri; - Cesium['isCrossOriginUrl'] = Core_isCrossOriginUrl; - Cesium['isDataUri'] = Core_isDataUri; - Cesium['isLeapYear'] = Core_isLeapYear; - Cesium['Iso8601'] = Core_Iso8601; - Cesium['JulianDate'] = Core_JulianDate; - Cesium['KeyboardEventModifier'] = Core_KeyboardEventModifier; - Cesium['LagrangePolynomialApproximation'] = Core_LagrangePolynomialApproximation; - Cesium['LeapSecond'] = Core_LeapSecond; - Cesium['LinearApproximation'] = Core_LinearApproximation; - Cesium['LinearSpline'] = Core_LinearSpline; - Cesium['loadCRN'] = Core_loadCRN; - Cesium['loadImageFromTypedArray'] = Core_loadImageFromTypedArray; - Cesium['loadKTX'] = Core_loadKTX; - Cesium['ManagedArray'] = Core_ManagedArray; - Cesium['MapboxApi'] = Core_MapboxApi; - Cesium['MapProjection'] = Core_MapProjection; - Cesium['Math'] = Core_Math; - Cesium['Matrix2'] = Core_Matrix2; - Cesium['Matrix3'] = Core_Matrix3; - Cesium['Matrix4'] = Core_Matrix4; - Cesium['mergeSort'] = Core_mergeSort; - Cesium['NearFarScalar'] = Core_NearFarScalar; - Cesium['objectToQuery'] = Core_objectToQuery; - Cesium['Occluder'] = Core_Occluder; - Cesium['oneTimeWarning'] = Core_oneTimeWarning; - Cesium['OrientedBoundingBox'] = Core_OrientedBoundingBox; - Cesium['OrthographicFrustum'] = Core_OrthographicFrustum; - Cesium['OrthographicOffCenterFrustum'] = Core_OrthographicOffCenterFrustum; - Cesium['Packable'] = Core_Packable; - Cesium['PackableForInterpolation'] = Core_PackableForInterpolation; - Cesium['parseResponseHeaders'] = Core_parseResponseHeaders; - Cesium['PerspectiveFrustum'] = Core_PerspectiveFrustum; - Cesium['PerspectiveOffCenterFrustum'] = Core_PerspectiveOffCenterFrustum; - Cesium['PinBuilder'] = Core_PinBuilder; - Cesium['PixelFormat'] = Core_PixelFormat; - Cesium['Plane'] = Core_Plane; - Cesium['PlaneGeometry'] = Core_PlaneGeometry; - Cesium['PlaneOutlineGeometry'] = Core_PlaneOutlineGeometry; - Cesium['pointInsideTriangle'] = Core_pointInsideTriangle; - Cesium['PolygonGeometry'] = Core_PolygonGeometry; - Cesium['PolygonGeometryLibrary'] = Core_PolygonGeometryLibrary; - Cesium['PolygonHierarchy'] = Core_PolygonHierarchy; - Cesium['PolygonOutlineGeometry'] = Core_PolygonOutlineGeometry; - Cesium['PolygonPipeline'] = Core_PolygonPipeline; - Cesium['PolylineGeometry'] = Core_PolylineGeometry; - Cesium['PolylinePipeline'] = Core_PolylinePipeline; - Cesium['PolylineVolumeGeometry'] = Core_PolylineVolumeGeometry; - Cesium['PolylineVolumeGeometryLibrary'] = Core_PolylineVolumeGeometryLibrary; - Cesium['PolylineVolumeOutlineGeometry'] = Core_PolylineVolumeOutlineGeometry; - Cesium['PrimitiveType'] = Core_PrimitiveType; - Cesium['QuadraticRealPolynomial'] = Core_QuadraticRealPolynomial; - Cesium['QuantizedMeshTerrainData'] = Core_QuantizedMeshTerrainData; - Cesium['QuarticRealPolynomial'] = Core_QuarticRealPolynomial; - Cesium['Quaternion'] = Core_Quaternion; - Cesium['QuaternionSpline'] = Core_QuaternionSpline; - Cesium['queryToObject'] = Core_queryToObject; - Cesium['Queue'] = Core_Queue; - Cesium['Ray'] = Core_Ray; - Cesium['Rectangle'] = Core_Rectangle; - Cesium['RectangleGeometry'] = Core_RectangleGeometry; - Cesium['RectangleGeometryLibrary'] = Core_RectangleGeometryLibrary; - Cesium['RectangleOutlineGeometry'] = Core_RectangleOutlineGeometry; - Cesium['ReferenceFrame'] = Core_ReferenceFrame; - Cesium['Request'] = Core_Request; - Cesium['requestAnimationFrame'] = Core_requestAnimationFrame; - Cesium['RequestErrorEvent'] = Core_RequestErrorEvent; - Cesium['RequestScheduler'] = Core_RequestScheduler; - Cesium['RequestState'] = Core_RequestState; - Cesium['RequestType'] = Core_RequestType; - Cesium['Resource'] = Core_Resource; - Cesium['RuntimeError'] = Core_RuntimeError; - Cesium['sampleTerrain'] = Core_sampleTerrain; - Cesium['sampleTerrainMostDetailed'] = Core_sampleTerrainMostDetailed; - Cesium['scaleToGeodeticSurface'] = Core_scaleToGeodeticSurface; - Cesium['ScreenSpaceEventHandler'] = Core_ScreenSpaceEventHandler; - Cesium['ScreenSpaceEventType'] = Core_ScreenSpaceEventType; - Cesium['ShowGeometryInstanceAttribute'] = Core_ShowGeometryInstanceAttribute; - Cesium['Simon1994PlanetaryPositions'] = Core_Simon1994PlanetaryPositions; - Cesium['SimplePolylineGeometry'] = Core_SimplePolylineGeometry; - Cesium['SphereGeometry'] = Core_SphereGeometry; - Cesium['SphereOutlineGeometry'] = Core_SphereOutlineGeometry; - Cesium['Spherical'] = Core_Spherical; - Cesium['Spline'] = Core_Spline; - Cesium['subdivideArray'] = Core_subdivideArray; - Cesium['TaskProcessor'] = Core_TaskProcessor; - Cesium['TerrainData'] = Core_TerrainData; - Cesium['TerrainEncoding'] = Core_TerrainEncoding; - Cesium['TerrainMesh'] = Core_TerrainMesh; - Cesium['TerrainProvider'] = Core_TerrainProvider; - Cesium['TerrainQuantization'] = Core_TerrainQuantization; - Cesium['TileAvailability'] = Core_TileAvailability; - Cesium['TileProviderError'] = Core_TileProviderError; - Cesium['TilingScheme'] = Core_TilingScheme; - Cesium['TimeConstants'] = Core_TimeConstants; - Cesium['TimeInterval'] = Core_TimeInterval; - Cesium['TimeIntervalCollection'] = Core_TimeIntervalCollection; - Cesium['TimeStandard'] = Core_TimeStandard; - Cesium['Tipsify'] = Core_Tipsify; - Cesium['Transforms'] = Core_Transforms; - Cesium['TranslationRotationScale'] = Core_TranslationRotationScale; - Cesium['TridiagonalSystemSolver'] = Core_TridiagonalSystemSolver; - Cesium['TrustedServers'] = Core_TrustedServers; - Cesium['VertexFormat'] = Core_VertexFormat; - Cesium['VideoSynchronizer'] = Core_VideoSynchronizer; - Cesium['Visibility'] = Core_Visibility; - Cesium['VRTheWorldTerrainProvider'] = Core_VRTheWorldTerrainProvider; - Cesium['WallGeometry'] = Core_WallGeometry; - Cesium['WallGeometryLibrary'] = Core_WallGeometryLibrary; - Cesium['WallOutlineGeometry'] = Core_WallOutlineGeometry; - Cesium['WebGLConstants'] = Core_WebGLConstants; - Cesium['WebMercatorProjection'] = Core_WebMercatorProjection; - Cesium['WebMercatorTilingScheme'] = Core_WebMercatorTilingScheme; - Cesium['WeightSpline'] = Core_WeightSpline; - Cesium['WindingOrder'] = Core_WindingOrder; - Cesium['wrapFunction'] = Core_wrapFunction; - Cesium['writeTextToCanvas'] = Core_writeTextToCanvas; - Cesium['BillboardGraphics'] = DataSources_BillboardGraphics; - Cesium['BillboardVisualizer'] = DataSources_BillboardVisualizer; - Cesium['BoundingSphereState'] = DataSources_BoundingSphereState; - Cesium['BoxGeometryUpdater'] = DataSources_BoxGeometryUpdater; - Cesium['BoxGraphics'] = DataSources_BoxGraphics; - Cesium['CallbackProperty'] = DataSources_CallbackProperty; - Cesium['CheckerboardMaterialProperty'] = DataSources_CheckerboardMaterialProperty; - Cesium['ColorMaterialProperty'] = DataSources_ColorMaterialProperty; - Cesium['CompositeEntityCollection'] = DataSources_CompositeEntityCollection; - Cesium['CompositeMaterialProperty'] = DataSources_CompositeMaterialProperty; - Cesium['CompositePositionProperty'] = DataSources_CompositePositionProperty; - Cesium['CompositeProperty'] = DataSources_CompositeProperty; - Cesium['ConstantPositionProperty'] = DataSources_ConstantPositionProperty; - Cesium['ConstantProperty'] = DataSources_ConstantProperty; - Cesium['CorridorGeometryUpdater'] = DataSources_CorridorGeometryUpdater; - Cesium['CorridorGraphics'] = DataSources_CorridorGraphics; - Cesium['createMaterialPropertyDescriptor'] = DataSources_createMaterialPropertyDescriptor; - Cesium['createPropertyDescriptor'] = DataSources_createPropertyDescriptor; - Cesium['createRawPropertyDescriptor'] = DataSources_createRawPropertyDescriptor; - Cesium['CustomDataSource'] = DataSources_CustomDataSource; - Cesium['CylinderGeometryUpdater'] = DataSources_CylinderGeometryUpdater; - Cesium['CylinderGraphics'] = DataSources_CylinderGraphics; - Cesium['CzmlDataSource'] = DataSources_CzmlDataSource; - Cesium['DataSource'] = DataSources_DataSource; - Cesium['DataSourceClock'] = DataSources_DataSourceClock; - Cesium['DataSourceCollection'] = DataSources_DataSourceCollection; - Cesium['DataSourceDisplay'] = DataSources_DataSourceDisplay; - Cesium['DynamicGeometryBatch'] = DataSources_DynamicGeometryBatch; - Cesium['DynamicGeometryUpdater'] = DataSources_DynamicGeometryUpdater; - Cesium['EllipseGeometryUpdater'] = DataSources_EllipseGeometryUpdater; - Cesium['EllipseGraphics'] = DataSources_EllipseGraphics; - Cesium['EllipsoidGeometryUpdater'] = DataSources_EllipsoidGeometryUpdater; - Cesium['EllipsoidGraphics'] = DataSources_EllipsoidGraphics; - Cesium['Entity'] = DataSources_Entity; - Cesium['EntityCluster'] = DataSources_EntityCluster; - Cesium['EntityCollection'] = DataSources_EntityCollection; - Cesium['EntityView'] = DataSources_EntityView; - Cesium['GeoJsonDataSource'] = DataSources_GeoJsonDataSource; - Cesium['GeometryUpdater'] = DataSources_GeometryUpdater; - Cesium['GeometryVisualizer'] = DataSources_GeometryVisualizer; - Cesium['GridMaterialProperty'] = DataSources_GridMaterialProperty; - Cesium['ImageMaterialProperty'] = DataSources_ImageMaterialProperty; - Cesium['KmlCamera'] = DataSources_KmlCamera; - Cesium['KmlDataSource'] = DataSources_KmlDataSource; - Cesium['KmlLookAt'] = DataSources_KmlLookAt; - Cesium['KmlTour'] = DataSources_KmlTour; - Cesium['KmlTourFlyTo'] = DataSources_KmlTourFlyTo; - Cesium['KmlTourWait'] = DataSources_KmlTourWait; - Cesium['LabelGraphics'] = DataSources_LabelGraphics; - Cesium['LabelVisualizer'] = DataSources_LabelVisualizer; - Cesium['MaterialProperty'] = DataSources_MaterialProperty; - Cesium['ModelGraphics'] = DataSources_ModelGraphics; - Cesium['ModelVisualizer'] = DataSources_ModelVisualizer; - Cesium['NodeTransformationProperty'] = DataSources_NodeTransformationProperty; - Cesium['PathGraphics'] = DataSources_PathGraphics; - Cesium['PathVisualizer'] = DataSources_PathVisualizer; - Cesium['PlaneGeometryUpdater'] = DataSources_PlaneGeometryUpdater; - Cesium['PlaneGraphics'] = DataSources_PlaneGraphics; - Cesium['PointGraphics'] = DataSources_PointGraphics; - Cesium['PointVisualizer'] = DataSources_PointVisualizer; - Cesium['PolygonGeometryUpdater'] = DataSources_PolygonGeometryUpdater; - Cesium['PolygonGraphics'] = DataSources_PolygonGraphics; - Cesium['PolylineArrowMaterialProperty'] = DataSources_PolylineArrowMaterialProperty; - Cesium['PolylineDashMaterialProperty'] = DataSources_PolylineDashMaterialProperty; - Cesium['PolylineGeometryUpdater'] = DataSources_PolylineGeometryUpdater; - Cesium['PolylineGlowMaterialProperty'] = DataSources_PolylineGlowMaterialProperty; - Cesium['PolylineGraphics'] = DataSources_PolylineGraphics; - Cesium['PolylineOutlineMaterialProperty'] = DataSources_PolylineOutlineMaterialProperty; - Cesium['PolylineVisualizer'] = DataSources_PolylineVisualizer; - Cesium['PolylineVolumeGeometryUpdater'] = DataSources_PolylineVolumeGeometryUpdater; - Cesium['PolylineVolumeGraphics'] = DataSources_PolylineVolumeGraphics; - Cesium['PositionProperty'] = DataSources_PositionProperty; - Cesium['PositionPropertyArray'] = DataSources_PositionPropertyArray; - Cesium['Property'] = DataSources_Property; - Cesium['PropertyArray'] = DataSources_PropertyArray; - Cesium['PropertyBag'] = DataSources_PropertyBag; - Cesium['RectangleGeometryUpdater'] = DataSources_RectangleGeometryUpdater; - Cesium['RectangleGraphics'] = DataSources_RectangleGraphics; - Cesium['ReferenceProperty'] = DataSources_ReferenceProperty; - Cesium['Rotation'] = DataSources_Rotation; - Cesium['SampledPositionProperty'] = DataSources_SampledPositionProperty; - Cesium['SampledProperty'] = DataSources_SampledProperty; - Cesium['ScaledPositionProperty'] = DataSources_ScaledPositionProperty; - Cesium['StaticGeometryColorBatch'] = DataSources_StaticGeometryColorBatch; - Cesium['StaticGeometryPerMaterialBatch'] = DataSources_StaticGeometryPerMaterialBatch; - Cesium['StaticGroundGeometryColorBatch'] = DataSources_StaticGroundGeometryColorBatch; - Cesium['StaticOutlineGeometryBatch'] = DataSources_StaticOutlineGeometryBatch; - Cesium['StripeMaterialProperty'] = DataSources_StripeMaterialProperty; - Cesium['StripeOrientation'] = DataSources_StripeOrientation; - Cesium['TimeIntervalCollectionPositionProperty'] = DataSources_TimeIntervalCollectionPositionProperty; - Cesium['TimeIntervalCollectionProperty'] = DataSources_TimeIntervalCollectionProperty; - Cesium['VelocityOrientationProperty'] = DataSources_VelocityOrientationProperty; - Cesium['VelocityVectorProperty'] = DataSources_VelocityVectorProperty; - Cesium['Visualizer'] = DataSources_Visualizer; - Cesium['WallGeometryUpdater'] = DataSources_WallGeometryUpdater; - Cesium['WallGraphics'] = DataSources_WallGraphics; - Cesium['AutomaticUniforms'] = Renderer_AutomaticUniforms; - Cesium['Buffer'] = Renderer_Buffer; - Cesium['BufferUsage'] = Renderer_BufferUsage; - Cesium['ClearCommand'] = Renderer_ClearCommand; - Cesium['ComputeCommand'] = Renderer_ComputeCommand; - Cesium['ComputeEngine'] = Renderer_ComputeEngine; - Cesium['Context'] = Renderer_Context; - Cesium['ContextLimits'] = Renderer_ContextLimits; - Cesium['createUniform'] = Renderer_createUniform; - Cesium['createUniformArray'] = Renderer_createUniformArray; - Cesium['CubeMap'] = Renderer_CubeMap; - Cesium['CubeMapFace'] = Renderer_CubeMapFace; - Cesium['DrawCommand'] = Renderer_DrawCommand; - Cesium['Framebuffer'] = Renderer_Framebuffer; - Cesium['freezeRenderState'] = Renderer_freezeRenderState; - Cesium['loadCubeMap'] = Renderer_loadCubeMap; - Cesium['MipmapHint'] = Renderer_MipmapHint; - Cesium['modernizeShader'] = Renderer_modernizeShader; - Cesium['Pass'] = Renderer_Pass; - Cesium['PassState'] = Renderer_PassState; - Cesium['PickFramebuffer'] = Renderer_PickFramebuffer; - Cesium['PixelDatatype'] = Renderer_PixelDatatype; - Cesium['Renderbuffer'] = Renderer_Renderbuffer; - Cesium['RenderbufferFormat'] = Renderer_RenderbufferFormat; - Cesium['RenderState'] = Renderer_RenderState; - Cesium['Sampler'] = Renderer_Sampler; - Cesium['ShaderCache'] = Renderer_ShaderCache; - Cesium['ShaderProgram'] = Renderer_ShaderProgram; - Cesium['ShaderSource'] = Renderer_ShaderSource; - Cesium['Texture'] = Renderer_Texture; - Cesium['TextureMagnificationFilter'] = Renderer_TextureMagnificationFilter; - Cesium['TextureMinificationFilter'] = Renderer_TextureMinificationFilter; - Cesium['TextureWrap'] = Renderer_TextureWrap; - Cesium['UniformState'] = Renderer_UniformState; - Cesium['VertexArray'] = Renderer_VertexArray; - Cesium['VertexArrayFacade'] = Renderer_VertexArrayFacade; - Cesium['Appearance'] = Scene_Appearance; - Cesium['ArcGisMapServerImageryProvider'] = Scene_ArcGisMapServerImageryProvider; - Cesium['AttributeType'] = Scene_AttributeType; - Cesium['Axis'] = Scene_Axis; - Cesium['Batched3DModel3DTileContent'] = Scene_Batched3DModel3DTileContent; - Cesium['BatchTable'] = Scene_BatchTable; - Cesium['Billboard'] = Scene_Billboard; - Cesium['BillboardCollection'] = Scene_BillboardCollection; - Cesium['BingMapsImageryProvider'] = Scene_BingMapsImageryProvider; - Cesium['BingMapsStyle'] = Scene_BingMapsStyle; - Cesium['BlendEquation'] = Scene_BlendEquation; - Cesium['BlendFunction'] = Scene_BlendFunction; - Cesium['BlendingState'] = Scene_BlendingState; - Cesium['BlendOption'] = Scene_BlendOption; - Cesium['BoxEmitter'] = Scene_BoxEmitter; - Cesium['BrdfLutGenerator'] = Scene_BrdfLutGenerator; - Cesium['Camera'] = Scene_Camera; - Cesium['CameraEventAggregator'] = Scene_CameraEventAggregator; - Cesium['CameraEventType'] = Scene_CameraEventType; - Cesium['CameraFlightPath'] = Scene_CameraFlightPath; - Cesium['Cesium3DTile'] = Scene_Cesium3DTile; - Cesium['Cesium3DTileBatchTable'] = Scene_Cesium3DTileBatchTable; - Cesium['Cesium3DTileChildrenVisibility'] = Scene_Cesium3DTileChildrenVisibility; - Cesium['Cesium3DTileColorBlendMode'] = Scene_Cesium3DTileColorBlendMode; - Cesium['Cesium3DTileContent'] = Scene_Cesium3DTileContent; - Cesium['Cesium3DTileContentFactory'] = Scene_Cesium3DTileContentFactory; - Cesium['Cesium3DTileContentState'] = Scene_Cesium3DTileContentState; - Cesium['Cesium3DTileFeature'] = Scene_Cesium3DTileFeature; - Cesium['Cesium3DTileFeatureTable'] = Scene_Cesium3DTileFeatureTable; - Cesium['Cesium3DTileOptimizationHint'] = Scene_Cesium3DTileOptimizationHint; - Cesium['Cesium3DTileOptimizations'] = Scene_Cesium3DTileOptimizations; - Cesium['Cesium3DTilePointFeature'] = Scene_Cesium3DTilePointFeature; - Cesium['Cesium3DTileRefine'] = Scene_Cesium3DTileRefine; - Cesium['Cesium3DTileset'] = Scene_Cesium3DTileset; - Cesium['Cesium3DTilesetStatistics'] = Scene_Cesium3DTilesetStatistics; - Cesium['Cesium3DTilesetTraversal'] = Scene_Cesium3DTilesetTraversal; - Cesium['Cesium3DTileStyle'] = Scene_Cesium3DTileStyle; - Cesium['Cesium3DTileStyleEngine'] = Scene_Cesium3DTileStyleEngine; - Cesium['CircleEmitter'] = Scene_CircleEmitter; - Cesium['ClassificationModel'] = Scene_ClassificationModel; - Cesium['ClassificationPrimitive'] = Scene_ClassificationPrimitive; - Cesium['ClassificationType'] = Scene_ClassificationType; - Cesium['ClippingPlane'] = Scene_ClippingPlane; - Cesium['ClippingPlaneCollection'] = Scene_ClippingPlaneCollection; - Cesium['ColorBlendMode'] = Scene_ColorBlendMode; - Cesium['Composite3DTileContent'] = Scene_Composite3DTileContent; - Cesium['ConditionsExpression'] = Scene_ConditionsExpression; - Cesium['ConeEmitter'] = Scene_ConeEmitter; - Cesium['createBillboardPointCallback'] = Scene_createBillboardPointCallback; - Cesium['createOpenStreetMapImageryProvider'] = Scene_createOpenStreetMapImageryProvider; - Cesium['createTangentSpaceDebugPrimitive'] = Scene_createTangentSpaceDebugPrimitive; - Cesium['createTileMapServiceImageryProvider'] = Scene_createTileMapServiceImageryProvider; - Cesium['CreditDisplay'] = Scene_CreditDisplay; - Cesium['CullFace'] = Scene_CullFace; - Cesium['DebugAppearance'] = Scene_DebugAppearance; - Cesium['DebugCameraPrimitive'] = Scene_DebugCameraPrimitive; - Cesium['DebugModelMatrixPrimitive'] = Scene_DebugModelMatrixPrimitive; - Cesium['DepthFunction'] = Scene_DepthFunction; - Cesium['DepthPlane'] = Scene_DepthPlane; - Cesium['DerivedCommand'] = Scene_DerivedCommand; - Cesium['DeviceOrientationCameraController'] = Scene_DeviceOrientationCameraController; - Cesium['DiscardMissingTileImagePolicy'] = Scene_DiscardMissingTileImagePolicy; - Cesium['DracoLoader'] = Scene_DracoLoader; - Cesium['EllipsoidPrimitive'] = Scene_EllipsoidPrimitive; - Cesium['EllipsoidSurfaceAppearance'] = Scene_EllipsoidSurfaceAppearance; - Cesium['Empty3DTileContent'] = Scene_Empty3DTileContent; - Cesium['Expression'] = Scene_Expression; - Cesium['ExpressionNodeType'] = Scene_ExpressionNodeType; - Cesium['Fog'] = Scene_Fog; - Cesium['FrameRateMonitor'] = Scene_FrameRateMonitor; - Cesium['FrameState'] = Scene_FrameState; - Cesium['FrustumCommands'] = Scene_FrustumCommands; - Cesium['FXAA'] = Scene_FXAA; - Cesium['Geometry3DTileContent'] = Scene_Geometry3DTileContent; - Cesium['getBinaryAccessor'] = Scene_getBinaryAccessor; - Cesium['getClipAndStyleCode'] = Scene_getClipAndStyleCode; - Cesium['getClippingFunction'] = Scene_getClippingFunction; - Cesium['GetFeatureInfoFormat'] = Scene_GetFeatureInfoFormat; - Cesium['Globe'] = Scene_Globe; - Cesium['GlobeDepth'] = Scene_GlobeDepth; - Cesium['GlobeSurfaceShaderSet'] = Scene_GlobeSurfaceShaderSet; - Cesium['GlobeSurfaceTile'] = Scene_GlobeSurfaceTile; - Cesium['GlobeSurfaceTileProvider'] = Scene_GlobeSurfaceTileProvider; - Cesium['GoogleEarthEnterpriseImageryProvider'] = Scene_GoogleEarthEnterpriseImageryProvider; - Cesium['GoogleEarthEnterpriseMapsProvider'] = Scene_GoogleEarthEnterpriseMapsProvider; - Cesium['GridImageryProvider'] = Scene_GridImageryProvider; - Cesium['GroundPrimitive'] = Scene_GroundPrimitive; - Cesium['HeightReference'] = Scene_HeightReference; - Cesium['HorizontalOrigin'] = Scene_HorizontalOrigin; - Cesium['Imagery'] = Scene_Imagery; - Cesium['ImageryLayer'] = Scene_ImageryLayer; - Cesium['ImageryLayerCollection'] = Scene_ImageryLayerCollection; - Cesium['ImageryLayerFeatureInfo'] = Scene_ImageryLayerFeatureInfo; - Cesium['ImageryProvider'] = Scene_ImageryProvider; - Cesium['ImagerySplitDirection'] = Scene_ImagerySplitDirection; - Cesium['ImageryState'] = Scene_ImageryState; - Cesium['Instanced3DModel3DTileContent'] = Scene_Instanced3DModel3DTileContent; - Cesium['InvertClassification'] = Scene_InvertClassification; - Cesium['IonImageryProvider'] = Scene_IonImageryProvider; - Cesium['JobScheduler'] = Scene_JobScheduler; - Cesium['JobType'] = Scene_JobType; - Cesium['Label'] = Scene_Label; - Cesium['LabelCollection'] = Scene_LabelCollection; - Cesium['LabelStyle'] = Scene_LabelStyle; - Cesium['MapboxImageryProvider'] = Scene_MapboxImageryProvider; - Cesium['MapMode2D'] = Scene_MapMode2D; - Cesium['Material'] = Scene_Material; - Cesium['MaterialAppearance'] = Scene_MaterialAppearance; - Cesium['Model'] = Scene_Model; - Cesium['ModelAnimation'] = Scene_ModelAnimation; - Cesium['ModelAnimationCache'] = Scene_ModelAnimationCache; - Cesium['ModelAnimationCollection'] = Scene_ModelAnimationCollection; - Cesium['ModelAnimationLoop'] = Scene_ModelAnimationLoop; - Cesium['ModelAnimationState'] = Scene_ModelAnimationState; - Cesium['ModelInstance'] = Scene_ModelInstance; - Cesium['ModelInstanceCollection'] = Scene_ModelInstanceCollection; - Cesium['ModelLoadResources'] = Scene_ModelLoadResources; - Cesium['ModelMaterial'] = Scene_ModelMaterial; - Cesium['ModelMesh'] = Scene_ModelMesh; - Cesium['ModelNode'] = Scene_ModelNode; - Cesium['ModelUtility'] = Scene_ModelUtility; - Cesium['Moon'] = Scene_Moon; - Cesium['NeverTileDiscardPolicy'] = Scene_NeverTileDiscardPolicy; - Cesium['OIT'] = Scene_OIT; - Cesium['Particle'] = Scene_Particle; - Cesium['ParticleBurst'] = Scene_ParticleBurst; - Cesium['ParticleEmitter'] = Scene_ParticleEmitter; - Cesium['ParticleSystem'] = Scene_ParticleSystem; - Cesium['PerformanceDisplay'] = Scene_PerformanceDisplay; - Cesium['PerInstanceColorAppearance'] = Scene_PerInstanceColorAppearance; - Cesium['PickDepth'] = Scene_PickDepth; - Cesium['PointCloud3DTileContent'] = Scene_PointCloud3DTileContent; - Cesium['PointCloudEyeDomeLighting'] = Scene_PointCloudEyeDomeLighting; - Cesium['PointCloudShading'] = Scene_PointCloudShading; - Cesium['PointPrimitive'] = Scene_PointPrimitive; - Cesium['PointPrimitiveCollection'] = Scene_PointPrimitiveCollection; - Cesium['Polyline'] = Scene_Polyline; - Cesium['PolylineCollection'] = Scene_PolylineCollection; - Cesium['PolylineColorAppearance'] = Scene_PolylineColorAppearance; - Cesium['PolylineMaterialAppearance'] = Scene_PolylineMaterialAppearance; - Cesium['Primitive'] = Scene_Primitive; - Cesium['PrimitiveCollection'] = Scene_PrimitiveCollection; - Cesium['PrimitivePipeline'] = Scene_PrimitivePipeline; - Cesium['PrimitiveState'] = Scene_PrimitiveState; - Cesium['QuadtreeOccluders'] = Scene_QuadtreeOccluders; - Cesium['QuadtreePrimitive'] = Scene_QuadtreePrimitive; - Cesium['QuadtreeTile'] = Scene_QuadtreeTile; - Cesium['QuadtreeTileLoadState'] = Scene_QuadtreeTileLoadState; - Cesium['QuadtreeTileProvider'] = Scene_QuadtreeTileProvider; - Cesium['Scene'] = Scene_Scene; - Cesium['SceneMode'] = Scene_SceneMode; - Cesium['SceneTransforms'] = Scene_SceneTransforms; - Cesium['SceneTransitioner'] = Scene_SceneTransitioner; - Cesium['ScreenSpaceCameraController'] = Scene_ScreenSpaceCameraController; - Cesium['ShadowMap'] = Scene_ShadowMap; - Cesium['ShadowMapShader'] = Scene_ShadowMapShader; - Cesium['ShadowMode'] = Scene_ShadowMode; - Cesium['SingleTileImageryProvider'] = Scene_SingleTileImageryProvider; - Cesium['SkyAtmosphere'] = Scene_SkyAtmosphere; - Cesium['SkyBox'] = Scene_SkyBox; - Cesium['SphereEmitter'] = Scene_SphereEmitter; - Cesium['StencilFunction'] = Scene_StencilFunction; - Cesium['StencilOperation'] = Scene_StencilOperation; - Cesium['StyleExpression'] = Scene_StyleExpression; - Cesium['Sun'] = Scene_Sun; - Cesium['SunPostProcess'] = Scene_SunPostProcess; - Cesium['TerrainState'] = Scene_TerrainState; - Cesium['TextureAtlas'] = Scene_TextureAtlas; - Cesium['TileBoundingRegion'] = Scene_TileBoundingRegion; - Cesium['TileBoundingSphere'] = Scene_TileBoundingSphere; - Cesium['TileBoundingVolume'] = Scene_TileBoundingVolume; - Cesium['TileCoordinatesImageryProvider'] = Scene_TileCoordinatesImageryProvider; - Cesium['TileDiscardPolicy'] = Scene_TileDiscardPolicy; - Cesium['TileImagery'] = Scene_TileImagery; - Cesium['TileOrientedBoundingBox'] = Scene_TileOrientedBoundingBox; - Cesium['TileReplacementQueue'] = Scene_TileReplacementQueue; - Cesium['Tileset3DTileContent'] = Scene_Tileset3DTileContent; - Cesium['TileState'] = Scene_TileState; - Cesium['TileTerrain'] = Scene_TileTerrain; - Cesium['TimeDynamicImagery'] = Scene_TimeDynamicImagery; - Cesium['TweenCollection'] = Scene_TweenCollection; - Cesium['UrlTemplateImageryProvider'] = Scene_UrlTemplateImageryProvider; - Cesium['Vector3DTileBatch'] = Scene_Vector3DTileBatch; - Cesium['Vector3DTileContent'] = Scene_Vector3DTileContent; - Cesium['Vector3DTileGeometry'] = Scene_Vector3DTileGeometry; - Cesium['Vector3DTilePoints'] = Scene_Vector3DTilePoints; - Cesium['Vector3DTilePolygons'] = Scene_Vector3DTilePolygons; - Cesium['Vector3DTilePolylines'] = Scene_Vector3DTilePolylines; - Cesium['Vector3DTilePrimitive'] = Scene_Vector3DTilePrimitive; - Cesium['VerticalOrigin'] = Scene_VerticalOrigin; - Cesium['ViewportQuad'] = Scene_ViewportQuad; - Cesium['WebMapServiceImageryProvider'] = Scene_WebMapServiceImageryProvider; - Cesium['WebMapTileServiceImageryProvider'] = Scene_WebMapTileServiceImageryProvider; - Cesium._shaders['AdjustTranslucentFS'] = Shaders_AdjustTranslucentFS; - Cesium._shaders['AllMaterialAppearanceFS'] = Shaders_Appearances_AllMaterialAppearanceFS; - Cesium._shaders['AllMaterialAppearanceVS'] = Shaders_Appearances_AllMaterialAppearanceVS; - Cesium._shaders['BasicMaterialAppearanceFS'] = Shaders_Appearances_BasicMaterialAppearanceFS; - Cesium._shaders['BasicMaterialAppearanceVS'] = Shaders_Appearances_BasicMaterialAppearanceVS; - Cesium._shaders['EllipsoidSurfaceAppearanceFS'] = Shaders_Appearances_EllipsoidSurfaceAppearanceFS; - Cesium._shaders['EllipsoidSurfaceAppearanceVS'] = Shaders_Appearances_EllipsoidSurfaceAppearanceVS; - Cesium._shaders['PerInstanceColorAppearanceFS'] = Shaders_Appearances_PerInstanceColorAppearanceFS; - Cesium._shaders['PerInstanceColorAppearanceVS'] = Shaders_Appearances_PerInstanceColorAppearanceVS; - Cesium._shaders['PerInstanceFlatColorAppearanceFS'] = Shaders_Appearances_PerInstanceFlatColorAppearanceFS; - Cesium._shaders['PerInstanceFlatColorAppearanceVS'] = Shaders_Appearances_PerInstanceFlatColorAppearanceVS; - Cesium._shaders['PolylineColorAppearanceVS'] = Shaders_Appearances_PolylineColorAppearanceVS; - Cesium._shaders['PolylineMaterialAppearanceVS'] = Shaders_Appearances_PolylineMaterialAppearanceVS; - Cesium._shaders['TexturedMaterialAppearanceFS'] = Shaders_Appearances_TexturedMaterialAppearanceFS; - Cesium._shaders['TexturedMaterialAppearanceVS'] = Shaders_Appearances_TexturedMaterialAppearanceVS; - Cesium._shaders['BillboardCollectionFS'] = Shaders_BillboardCollectionFS; - Cesium._shaders['BillboardCollectionVS'] = Shaders_BillboardCollectionVS; - Cesium._shaders['BrdfLutGeneratorFS'] = Shaders_BrdfLutGeneratorFS; - Cesium._shaders['degreesPerRadian'] = Shaders_Builtin_Constants_degreesPerRadian; - Cesium._shaders['depthRange'] = Shaders_Builtin_Constants_depthRange; - Cesium._shaders['epsilon1'] = Shaders_Builtin_Constants_epsilon1; - Cesium._shaders['epsilon2'] = Shaders_Builtin_Constants_epsilon2; - Cesium._shaders['epsilon3'] = Shaders_Builtin_Constants_epsilon3; - Cesium._shaders['epsilon4'] = Shaders_Builtin_Constants_epsilon4; - Cesium._shaders['epsilon5'] = Shaders_Builtin_Constants_epsilon5; - Cesium._shaders['epsilon6'] = Shaders_Builtin_Constants_epsilon6; - Cesium._shaders['epsilon7'] = Shaders_Builtin_Constants_epsilon7; - Cesium._shaders['infinity'] = Shaders_Builtin_Constants_infinity; - Cesium._shaders['oneOverPi'] = Shaders_Builtin_Constants_oneOverPi; - Cesium._shaders['oneOverTwoPi'] = Shaders_Builtin_Constants_oneOverTwoPi; - Cesium._shaders['passCesium3DTile'] = Shaders_Builtin_Constants_passCesium3DTile; - Cesium._shaders['passCesium3DTileClassification'] = Shaders_Builtin_Constants_passCesium3DTileClassification; - Cesium._shaders['passCesium3DTileClassificationIgnoreShow'] = Shaders_Builtin_Constants_passCesium3DTileClassificationIgnoreShow; - Cesium._shaders['passClassification'] = Shaders_Builtin_Constants_passClassification; - Cesium._shaders['passCompute'] = Shaders_Builtin_Constants_passCompute; - Cesium._shaders['passEnvironment'] = Shaders_Builtin_Constants_passEnvironment; - Cesium._shaders['passGlobe'] = Shaders_Builtin_Constants_passGlobe; - Cesium._shaders['passOpaque'] = Shaders_Builtin_Constants_passOpaque; - Cesium._shaders['passOverlay'] = Shaders_Builtin_Constants_passOverlay; - Cesium._shaders['passTerrainClassification'] = Shaders_Builtin_Constants_passTerrainClassification; - Cesium._shaders['passTranslucent'] = Shaders_Builtin_Constants_passTranslucent; - Cesium._shaders['pi'] = Shaders_Builtin_Constants_pi; - Cesium._shaders['piOverFour'] = Shaders_Builtin_Constants_piOverFour; - Cesium._shaders['piOverSix'] = Shaders_Builtin_Constants_piOverSix; - Cesium._shaders['piOverThree'] = Shaders_Builtin_Constants_piOverThree; - Cesium._shaders['piOverTwo'] = Shaders_Builtin_Constants_piOverTwo; - Cesium._shaders['radiansPerDegree'] = Shaders_Builtin_Constants_radiansPerDegree; - Cesium._shaders['sceneMode2D'] = Shaders_Builtin_Constants_sceneMode2D; - Cesium._shaders['sceneMode3D'] = Shaders_Builtin_Constants_sceneMode3D; - Cesium._shaders['sceneModeColumbusView'] = Shaders_Builtin_Constants_sceneModeColumbusView; - Cesium._shaders['sceneModeMorphing'] = Shaders_Builtin_Constants_sceneModeMorphing; - Cesium._shaders['solarRadius'] = Shaders_Builtin_Constants_solarRadius; - Cesium._shaders['threePiOver2'] = Shaders_Builtin_Constants_threePiOver2; - Cesium._shaders['twoPi'] = Shaders_Builtin_Constants_twoPi; - Cesium._shaders['webMercatorMaxLatitude'] = Shaders_Builtin_Constants_webMercatorMaxLatitude; - Cesium._shaders['CzmBuiltins'] = Shaders_Builtin_CzmBuiltins; - Cesium._shaders['alphaWeight'] = Shaders_Builtin_Functions_alphaWeight; - Cesium._shaders['antialias'] = Shaders_Builtin_Functions_antialias; - Cesium._shaders['cascadeColor'] = Shaders_Builtin_Functions_cascadeColor; - Cesium._shaders['cascadeDistance'] = Shaders_Builtin_Functions_cascadeDistance; - Cesium._shaders['cascadeMatrix'] = Shaders_Builtin_Functions_cascadeMatrix; - Cesium._shaders['cascadeWeights'] = Shaders_Builtin_Functions_cascadeWeights; - Cesium._shaders['columbusViewMorph'] = Shaders_Builtin_Functions_columbusViewMorph; - Cesium._shaders['computePosition'] = Shaders_Builtin_Functions_computePosition; - Cesium._shaders['cosineAndSine'] = Shaders_Builtin_Functions_cosineAndSine; - Cesium._shaders['decompressTextureCoordinates'] = Shaders_Builtin_Functions_decompressTextureCoordinates; - Cesium._shaders['depthClampFarPlane'] = Shaders_Builtin_Functions_depthClampFarPlane; - Cesium._shaders['eastNorthUpToEyeCoordinates'] = Shaders_Builtin_Functions_eastNorthUpToEyeCoordinates; - Cesium._shaders['ellipsoidContainsPoint'] = Shaders_Builtin_Functions_ellipsoidContainsPoint; - Cesium._shaders['ellipsoidNew'] = Shaders_Builtin_Functions_ellipsoidNew; - Cesium._shaders['ellipsoidWgs84TextureCoordinates'] = Shaders_Builtin_Functions_ellipsoidWgs84TextureCoordinates; - Cesium._shaders['equalsEpsilon'] = Shaders_Builtin_Functions_equalsEpsilon; - Cesium._shaders['eyeOffset'] = Shaders_Builtin_Functions_eyeOffset; - Cesium._shaders['eyeToWindowCoordinates'] = Shaders_Builtin_Functions_eyeToWindowCoordinates; - Cesium._shaders['fog'] = Shaders_Builtin_Functions_fog; - Cesium._shaders['geodeticSurfaceNormal'] = Shaders_Builtin_Functions_geodeticSurfaceNormal; - Cesium._shaders['getDefaultMaterial'] = Shaders_Builtin_Functions_getDefaultMaterial; - Cesium._shaders['getLambertDiffuse'] = Shaders_Builtin_Functions_getLambertDiffuse; - Cesium._shaders['getSpecular'] = Shaders_Builtin_Functions_getSpecular; - Cesium._shaders['getWaterNoise'] = Shaders_Builtin_Functions_getWaterNoise; - Cesium._shaders['getWgs84EllipsoidEC'] = Shaders_Builtin_Functions_getWgs84EllipsoidEC; - Cesium._shaders['HSBToRGB'] = Shaders_Builtin_Functions_HSBToRGB; - Cesium._shaders['HSLToRGB'] = Shaders_Builtin_Functions_HSLToRGB; - Cesium._shaders['hue'] = Shaders_Builtin_Functions_hue; - Cesium._shaders['isEmpty'] = Shaders_Builtin_Functions_isEmpty; - Cesium._shaders['isFull'] = Shaders_Builtin_Functions_isFull; - Cesium._shaders['latitudeToWebMercatorFraction'] = Shaders_Builtin_Functions_latitudeToWebMercatorFraction; - Cesium._shaders['luminance'] = Shaders_Builtin_Functions_luminance; - Cesium._shaders['metersPerPixel'] = Shaders_Builtin_Functions_metersPerPixel; - Cesium._shaders['modelToWindowCoordinates'] = Shaders_Builtin_Functions_modelToWindowCoordinates; - Cesium._shaders['multiplyWithColorBalance'] = Shaders_Builtin_Functions_multiplyWithColorBalance; - Cesium._shaders['nearFarScalar'] = Shaders_Builtin_Functions_nearFarScalar; - Cesium._shaders['octDecode'] = Shaders_Builtin_Functions_octDecode; - Cesium._shaders['packDepth'] = Shaders_Builtin_Functions_packDepth; - Cesium._shaders['phong'] = Shaders_Builtin_Functions_phong; - Cesium._shaders['pointAlongRay'] = Shaders_Builtin_Functions_pointAlongRay; - Cesium._shaders['rayEllipsoidIntersectionInterval'] = Shaders_Builtin_Functions_rayEllipsoidIntersectionInterval; - Cesium._shaders['reverseLogDepth'] = Shaders_Builtin_Functions_reverseLogDepth; - Cesium._shaders['RGBToHSB'] = Shaders_Builtin_Functions_RGBToHSB; - Cesium._shaders['RGBToHSL'] = Shaders_Builtin_Functions_RGBToHSL; - Cesium._shaders['RGBToXYZ'] = Shaders_Builtin_Functions_RGBToXYZ; - Cesium._shaders['saturation'] = Shaders_Builtin_Functions_saturation; - Cesium._shaders['shadowDepthCompare'] = Shaders_Builtin_Functions_shadowDepthCompare; - Cesium._shaders['shadowVisibility'] = Shaders_Builtin_Functions_shadowVisibility; - Cesium._shaders['signNotZero'] = Shaders_Builtin_Functions_signNotZero; - Cesium._shaders['tangentToEyeSpaceMatrix'] = Shaders_Builtin_Functions_tangentToEyeSpaceMatrix; - Cesium._shaders['transformPlane'] = Shaders_Builtin_Functions_transformPlane; - Cesium._shaders['translateRelativeToEye'] = Shaders_Builtin_Functions_translateRelativeToEye; - Cesium._shaders['translucentPhong'] = Shaders_Builtin_Functions_translucentPhong; - Cesium._shaders['transpose'] = Shaders_Builtin_Functions_transpose; - Cesium._shaders['unpackDepth'] = Shaders_Builtin_Functions_unpackDepth; - Cesium._shaders['unpackFloat'] = Shaders_Builtin_Functions_unpackFloat; - Cesium._shaders['vertexLogDepth'] = Shaders_Builtin_Functions_vertexLogDepth; - Cesium._shaders['windowToEyeCoordinates'] = Shaders_Builtin_Functions_windowToEyeCoordinates; - Cesium._shaders['writeDepthClampedToFarPlane'] = Shaders_Builtin_Functions_writeDepthClampedToFarPlane; - Cesium._shaders['writeLogDepth'] = Shaders_Builtin_Functions_writeLogDepth; - Cesium._shaders['XYZToRGB'] = Shaders_Builtin_Functions_XYZToRGB; - Cesium._shaders['depthRangeStruct'] = Shaders_Builtin_Structs_depthRangeStruct; - Cesium._shaders['ellipsoid'] = Shaders_Builtin_Structs_ellipsoid; - Cesium._shaders['material'] = Shaders_Builtin_Structs_material; - Cesium._shaders['materialInput'] = Shaders_Builtin_Structs_materialInput; - Cesium._shaders['ray'] = Shaders_Builtin_Structs_ray; - Cesium._shaders['raySegment'] = Shaders_Builtin_Structs_raySegment; - Cesium._shaders['shadowParameters'] = Shaders_Builtin_Structs_shadowParameters; - Cesium._shaders['CompositeOITFS'] = Shaders_CompositeOITFS; - Cesium._shaders['DepthPlaneFS'] = Shaders_DepthPlaneFS; - Cesium._shaders['DepthPlaneVS'] = Shaders_DepthPlaneVS; - Cesium._shaders['EllipsoidFS'] = Shaders_EllipsoidFS; - Cesium._shaders['EllipsoidVS'] = Shaders_EllipsoidVS; - Cesium._shaders['GlobeFS'] = Shaders_GlobeFS; - Cesium._shaders['GlobeVS'] = Shaders_GlobeVS; - Cesium._shaders['GroundAtmosphere'] = Shaders_GroundAtmosphere; - Cesium._shaders['BumpMapMaterial'] = Shaders_Materials_BumpMapMaterial; - Cesium._shaders['CheckerboardMaterial'] = Shaders_Materials_CheckerboardMaterial; - Cesium._shaders['DotMaterial'] = Shaders_Materials_DotMaterial; - Cesium._shaders['ElevationContourMaterial'] = Shaders_Materials_ElevationContourMaterial; - Cesium._shaders['ElevationRampMaterial'] = Shaders_Materials_ElevationRampMaterial; - Cesium._shaders['FadeMaterial'] = Shaders_Materials_FadeMaterial; - Cesium._shaders['GridMaterial'] = Shaders_Materials_GridMaterial; - Cesium._shaders['NormalMapMaterial'] = Shaders_Materials_NormalMapMaterial; - Cesium._shaders['PolylineArrowMaterial'] = Shaders_Materials_PolylineArrowMaterial; - Cesium._shaders['PolylineDashMaterial'] = Shaders_Materials_PolylineDashMaterial; - Cesium._shaders['PolylineGlowMaterial'] = Shaders_Materials_PolylineGlowMaterial; - Cesium._shaders['PolylineOutlineMaterial'] = Shaders_Materials_PolylineOutlineMaterial; - Cesium._shaders['RimLightingMaterial'] = Shaders_Materials_RimLightingMaterial; - Cesium._shaders['SlopeRampMaterial'] = Shaders_Materials_SlopeRampMaterial; - Cesium._shaders['StripeMaterial'] = Shaders_Materials_StripeMaterial; - Cesium._shaders['Water'] = Shaders_Materials_Water; - Cesium._shaders['PointPrimitiveCollectionFS'] = Shaders_PointPrimitiveCollectionFS; - Cesium._shaders['PointPrimitiveCollectionVS'] = Shaders_PointPrimitiveCollectionVS; - Cesium._shaders['PolylineCommon'] = Shaders_PolylineCommon; - Cesium._shaders['PolylineFS'] = Shaders_PolylineFS; - Cesium._shaders['PolylineVS'] = Shaders_PolylineVS; - Cesium._shaders['AdditiveBlend'] = Shaders_PostProcessFilters_AdditiveBlend; - Cesium._shaders['BrightPass'] = Shaders_PostProcessFilters_BrightPass; - Cesium._shaders['FXAA'] = Shaders_PostProcessFilters_FXAA; - Cesium._shaders['GaussianBlur1D'] = Shaders_PostProcessFilters_GaussianBlur1D; - Cesium._shaders['PassThrough'] = Shaders_PostProcessFilters_PassThrough; - Cesium._shaders['PointCloudEyeDomeLighting'] = Shaders_PostProcessFilters_PointCloudEyeDomeLighting; - Cesium._shaders['ReprojectWebMercatorFS'] = Shaders_ReprojectWebMercatorFS; - Cesium._shaders['ReprojectWebMercatorVS'] = Shaders_ReprojectWebMercatorVS; - Cesium._shaders['ShadowVolumeFS'] = Shaders_ShadowVolumeFS; - Cesium._shaders['ShadowVolumeVS'] = Shaders_ShadowVolumeVS; - Cesium._shaders['SkyAtmosphereFS'] = Shaders_SkyAtmosphereFS; - Cesium._shaders['SkyAtmosphereVS'] = Shaders_SkyAtmosphereVS; - Cesium._shaders['SkyBoxFS'] = Shaders_SkyBoxFS; - Cesium._shaders['SkyBoxVS'] = Shaders_SkyBoxVS; - Cesium._shaders['SunFS'] = Shaders_SunFS; - Cesium._shaders['SunTextureFS'] = Shaders_SunTextureFS; - Cesium._shaders['SunVS'] = Shaders_SunVS; - Cesium._shaders['Vector3DTilePolylinesVS'] = Shaders_Vector3DTilePolylinesVS; - Cesium._shaders['ViewportQuadFS'] = Shaders_ViewportQuadFS; - Cesium._shaders['ViewportQuadVS'] = Shaders_ViewportQuadVS; - Cesium['Autolinker'] = ThirdParty_Autolinker; - Cesium['earcut-2.1.1'] = ThirdParty_earcut_2_1_1; - Cesium['addDefaults'] = ThirdParty_GltfPipeline_addDefaults; - Cesium['addExtensionsRequired'] = ThirdParty_GltfPipeline_addExtensionsRequired; - Cesium['addExtensionsUsed'] = ThirdParty_GltfPipeline_addExtensionsUsed; - Cesium['addPipelineExtras'] = ThirdParty_GltfPipeline_addPipelineExtras; - Cesium['addToArray'] = ThirdParty_GltfPipeline_addToArray; - Cesium['byteLengthForComponentType'] = ThirdParty_GltfPipeline_byteLengthForComponentType; - Cesium['findAccessorMinMax'] = ThirdParty_GltfPipeline_findAccessorMinMax; - Cesium['ForEach'] = ThirdParty_GltfPipeline_ForEach; - Cesium['getAccessorByteStride'] = ThirdParty_GltfPipeline_getAccessorByteStride; - Cesium['getJointCountForMaterials'] = ThirdParty_GltfPipeline_getJointCountForMaterials; - Cesium['glslTypeToWebGLConstant'] = ThirdParty_GltfPipeline_glslTypeToWebGLConstant; - Cesium['numberOfComponentsForType'] = ThirdParty_GltfPipeline_numberOfComponentsForType; - Cesium['parseBinaryGltf'] = ThirdParty_GltfPipeline_parseBinaryGltf; - Cesium['processModelMaterialsCommon'] = ThirdParty_GltfPipeline_processModelMaterialsCommon; - Cesium['processPbrMetallicRoughness'] = ThirdParty_GltfPipeline_processPbrMetallicRoughness; - Cesium['removeExtensionsRequired'] = ThirdParty_GltfPipeline_removeExtensionsRequired; - Cesium['removeExtensionsUsed'] = ThirdParty_GltfPipeline_removeExtensionsUsed; - Cesium['removePipelineExtras'] = ThirdParty_GltfPipeline_removePipelineExtras; - Cesium['techniqueParameterForSemantic'] = ThirdParty_GltfPipeline_techniqueParameterForSemantic; - Cesium['updateVersion'] = ThirdParty_GltfPipeline_updateVersion; - Cesium['webGLConstantToGlslType'] = ThirdParty_GltfPipeline_webGLConstantToGlslType; - Cesium['google-earth-dbroot-parser'] = ThirdParty_google_earth_dbroot_parser; - Cesium['jsep'] = ThirdParty_jsep; - Cesium['kdbush'] = ThirdParty_kdbush; - Cesium['knockout-3.4.2'] = ThirdParty_knockout_3_4_2; - Cesium['knockout-es5'] = ThirdParty_knockout_es5; - Cesium['knockout'] = ThirdParty_knockout; - Cesium['measureText'] = ThirdParty_measureText; - Cesium['mersenne-twister'] = ThirdParty_mersenne_twister; - Cesium['NoSleep'] = ThirdParty_NoSleep; - Cesium['protobuf-minimal'] = ThirdParty_protobuf_minimal; - Cesium['FXAA3_11'] = ThirdParty_Shaders_FXAA3_11; - Cesium['sprintf'] = ThirdParty_sprintf; - Cesium['topojson'] = ThirdParty_topojson; - Cesium['Tween'] = ThirdParty_Tween; - Cesium['Uri'] = ThirdParty_Uri; - Cesium['when'] = ThirdParty_when; - Cesium['xss'] = ThirdParty_xss; - Cesium['zip'] = ThirdParty_zip; - Cesium['Animation'] = Widgets_Animation_Animation; - Cesium['AnimationViewModel'] = Widgets_Animation_AnimationViewModel; - Cesium['BaseLayerPicker'] = Widgets_BaseLayerPicker_BaseLayerPicker; - Cesium['BaseLayerPickerViewModel'] = Widgets_BaseLayerPicker_BaseLayerPickerViewModel; - Cesium['createDefaultImageryProviderViewModels'] = Widgets_BaseLayerPicker_createDefaultImageryProviderViewModels; - Cesium['createDefaultTerrainProviderViewModels'] = Widgets_BaseLayerPicker_createDefaultTerrainProviderViewModels; - Cesium['ProviderViewModel'] = Widgets_BaseLayerPicker_ProviderViewModel; - Cesium['Cesium3DTilesInspector'] = Widgets_Cesium3DTilesInspector_Cesium3DTilesInspector; - Cesium['Cesium3DTilesInspectorViewModel'] = Widgets_Cesium3DTilesInspector_Cesium3DTilesInspectorViewModel; - Cesium['CesiumInspector'] = Widgets_CesiumInspector_CesiumInspector; - Cesium['CesiumInspectorViewModel'] = Widgets_CesiumInspector_CesiumInspectorViewModel; - Cesium['CesiumWidget'] = Widgets_CesiumWidget_CesiumWidget; - Cesium['ClockViewModel'] = Widgets_ClockViewModel; - Cesium['Command'] = Widgets_Command; - Cesium['createCommand'] = Widgets_createCommand; - Cesium['FullscreenButton'] = Widgets_FullscreenButton_FullscreenButton; - Cesium['FullscreenButtonViewModel'] = Widgets_FullscreenButton_FullscreenButtonViewModel; - Cesium['Geocoder'] = Widgets_Geocoder_Geocoder; - Cesium['GeocoderViewModel'] = Widgets_Geocoder_GeocoderViewModel; - Cesium['getElement'] = Widgets_getElement; - Cesium['HomeButton'] = Widgets_HomeButton_HomeButton; - Cesium['HomeButtonViewModel'] = Widgets_HomeButton_HomeButtonViewModel; - Cesium['InfoBox'] = Widgets_InfoBox_InfoBox; - Cesium['InfoBoxViewModel'] = Widgets_InfoBox_InfoBoxViewModel; - Cesium['NavigationHelpButton'] = Widgets_NavigationHelpButton_NavigationHelpButton; - Cesium['NavigationHelpButtonViewModel'] = Widgets_NavigationHelpButton_NavigationHelpButtonViewModel; - Cesium['PerformanceWatchdog'] = Widgets_PerformanceWatchdog_PerformanceWatchdog; - Cesium['PerformanceWatchdogViewModel'] = Widgets_PerformanceWatchdog_PerformanceWatchdogViewModel; - Cesium['ProjectionPicker'] = Widgets_ProjectionPicker_ProjectionPicker; - Cesium['ProjectionPickerViewModel'] = Widgets_ProjectionPicker_ProjectionPickerViewModel; - Cesium['SceneModePicker'] = Widgets_SceneModePicker_SceneModePicker; - Cesium['SceneModePickerViewModel'] = Widgets_SceneModePicker_SceneModePickerViewModel; - Cesium['SelectionIndicator'] = Widgets_SelectionIndicator_SelectionIndicator; - Cesium['SelectionIndicatorViewModel'] = Widgets_SelectionIndicator_SelectionIndicatorViewModel; - Cesium['subscribeAndEvaluate'] = Widgets_subscribeAndEvaluate; - Cesium['SvgPathBindingHandler'] = Widgets_SvgPathBindingHandler; - Cesium['Timeline'] = Widgets_Timeline_Timeline; - Cesium['TimelineHighlightRange'] = Widgets_Timeline_TimelineHighlightRange; - Cesium['TimelineTrack'] = Widgets_Timeline_TimelineTrack; - Cesium['ToggleButtonViewModel'] = Widgets_ToggleButtonViewModel; - Cesium['Viewer'] = Widgets_Viewer_Viewer; - Cesium['viewerCesium3DTilesInspectorMixin'] = Widgets_Viewer_viewerCesium3DTilesInspectorMixin; - Cesium['viewerCesiumInspectorMixin'] = Widgets_Viewer_viewerCesiumInspectorMixin; - Cesium['viewerDragDropMixin'] = Widgets_Viewer_viewerDragDropMixin; - Cesium['viewerPerformanceWatchdogMixin'] = Widgets_Viewer_viewerPerformanceWatchdogMixin; - Cesium['VRButton'] = Widgets_VRButton_VRButton; - Cesium['VRButtonViewModel'] = Widgets_VRButton_VRButtonViewModel; - Cesium['createTaskProcessorWorker'] = Workers_createTaskProcessorWorker; - return Cesium; -}); \ No newline at end of file diff --git a/Source/Shaders/AdjustTranslucentFS.js b/Source/Shaders/AdjustTranslucentFS.js deleted file mode 100644 index 8df54681d4e9..000000000000 --- a/Source/Shaders/AdjustTranslucentFS.js +++ /dev/null @@ -1,29 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef MRT\n\ -#extension GL_EXT_draw_buffers : enable\n\ -#endif\n\ -\n\ -uniform vec4 u_bgColor;\n\ -uniform sampler2D u_depthTexture;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main()\n\ -{\n\ - if (texture2D(u_depthTexture, v_textureCoordinates).r < 1.0)\n\ - {\n\ -#ifdef MRT\n\ - gl_FragData[0] = u_bgColor;\n\ - gl_FragData[1] = vec4(u_bgColor.a);\n\ -#else\n\ - gl_FragColor = u_bgColor;\n\ -#endif\n\ - return;\n\ - }\n\ - \n\ - discard;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceFS.js b/Source/Shaders/Appearances/AllMaterialAppearanceFS.js deleted file mode 100644 index f25f61e1d4d4..000000000000 --- a/Source/Shaders/Appearances/AllMaterialAppearanceFS.js +++ /dev/null @@ -1,34 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying vec3 v_tangentEC;\n\ -varying vec3 v_bitangentEC;\n\ -varying 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\ - gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ -#else\n\ - gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/AllMaterialAppearanceVS.js b/Source/Shaders/Appearances/AllMaterialAppearanceVS.js deleted file mode 100644 index 4a87d139f0d5..000000000000 --- a/Source/Shaders/Appearances/AllMaterialAppearanceVS.js +++ /dev/null @@ -1,31 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 normal;\n\ -attribute vec3 tangent;\n\ -attribute vec3 bitangent;\n\ -attribute vec2 st;\n\ -attribute float batchId;\n\ -\n\ -varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying vec3 v_tangentEC;\n\ -varying vec3 v_bitangentEC;\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js b/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js deleted file mode 100644 index eb227ec49fe4..000000000000 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceFS.js +++ /dev/null @@ -1,28 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec3 v_positionEC;\n\ -varying 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\ - gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ -#else\n\ - gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js b/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js deleted file mode 100644 index 522f2b83e70b..000000000000 --- a/Source/Shaders/Appearances/BasicMaterialAppearanceVS.js +++ /dev/null @@ -1,22 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 normal;\n\ -attribute float batchId;\n\ -\n\ -varying vec3 v_positionEC;\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js deleted file mode 100644 index 409fa84ec8c6..000000000000 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceFS.js +++ /dev/null @@ -1,38 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec3 v_positionMC;\n\ -varying vec3 v_positionEC;\n\ -varying 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\ - gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ -#else\n\ - gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js b/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js deleted file mode 100644 index 61bb075ec17b..000000000000 --- a/Source/Shaders/Appearances/EllipsoidSurfaceAppearanceVS.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec2 st;\n\ -attribute float batchId;\n\ -\n\ -varying vec3 v_positionMC;\n\ -varying vec3 v_positionEC;\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js b/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js deleted file mode 100644 index 46e0075b0ab6..000000000000 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceFS.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying 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\ - czm_materialInput materialInput;\n\ - materialInput.normalEC = normalEC;\n\ - materialInput.positionToEyeEC = positionToEyeEC;\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ - material.diffuse = v_color.rgb;\n\ - material.alpha = v_color.a;\n\ -\n\ - gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js b/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js deleted file mode 100644 index cc9802dcb861..000000000000 --- a/Source/Shaders/Appearances/PerInstanceColorAppearanceVS.js +++ /dev/null @@ -1,25 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 normal;\n\ -attribute vec4 color;\n\ -attribute float batchId;\n\ -\n\ -varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js deleted file mode 100644 index 79c75df142a2..000000000000 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.js +++ /dev/null @@ -1,11 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec4 v_color;\n\ -\n\ -void main()\n\ -{\n\ - gl_FragColor = v_color;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js deleted file mode 100644 index 36c183443ae0..000000000000 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceVS.js +++ /dev/null @@ -1,20 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec4 color;\n\ -attribute float batchId;\n\ -\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PolylineColorAppearanceVS.js b/Source/Shaders/Appearances/PolylineColorAppearanceVS.js deleted file mode 100644 index 3d0e3e5af872..000000000000 --- a/Source/Shaders/Appearances/PolylineColorAppearanceVS.js +++ /dev/null @@ -1,37 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 prevPosition3DHigh;\n\ -attribute vec3 prevPosition3DLow;\n\ -attribute vec3 nextPosition3DHigh;\n\ -attribute vec3 nextPosition3DLow;\n\ -attribute vec2 expandAndWidth;\n\ -attribute vec4 color;\n\ -attribute float batchId;\n\ -\n\ -varying 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\ - v_color = color;\n\ -\n\ - float angle;\n\ - vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, angle);\n\ - gl_Position = czm_viewportOrthographic * positionWC;\n\ -\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js b/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js deleted file mode 100644 index 9443903035c8..000000000000 --- a/Source/Shaders/Appearances/PolylineMaterialAppearanceVS.js +++ /dev/null @@ -1,39 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 prevPosition3DHigh;\n\ -attribute vec3 prevPosition3DLow;\n\ -attribute vec3 nextPosition3DHigh;\n\ -attribute vec3 nextPosition3DLow;\n\ -attribute vec2 expandAndWidth;\n\ -attribute vec2 st;\n\ -attribute float batchId;\n\ -\n\ -varying float v_width;\n\ -varying vec2 v_st;\n\ -varying 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\ - v_width = width;\n\ - v_st = st;\n\ -\n\ - vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\n\ - gl_Position = czm_viewportOrthographic * positionWC;\n\ -\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js b/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js deleted file mode 100644 index da58b9b8ea6c..000000000000 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceFS.js +++ /dev/null @@ -1,30 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying 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\ - gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ -#else\n\ - gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js b/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js deleted file mode 100644 index d4151542ccc2..000000000000 --- a/Source/Shaders/Appearances/TexturedMaterialAppearanceVS.js +++ /dev/null @@ -1,25 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 normal;\n\ -attribute vec2 st;\n\ -attribute float batchId;\n\ -\n\ -varying vec3 v_positionEC;\n\ -varying vec3 v_normalEC;\n\ -varying 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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/BillboardCollectionFS.js b/Source/Shaders/BillboardCollectionFS.js deleted file mode 100644 index e5ac6bfd951e..000000000000 --- a/Source/Shaders/BillboardCollectionFS.js +++ /dev/null @@ -1,63 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D u_atlas;\n\ -\n\ -#ifdef VECTOR_TILE\n\ -uniform vec4 u_highlightColor;\n\ -#endif\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ -varying vec4 v_pickColor;\n\ -#else\n\ -varying vec4 v_color;\n\ -#endif\n\ -\n\ -void main()\n\ -{\n\ -#ifdef RENDER_FOR_PICK\n\ - vec4 vertexColor = vec4(1.0, 1.0, 1.0, 1.0);\n\ -#else\n\ - vec4 vertexColor = v_color;\n\ -#endif\n\ -\n\ - vec4 color = texture2D(u_atlas, v_textureCoordinates) * vertexColor;\n\ -\n\ -// Fully transparent parts of the billboard are not pickable.\n\ -#if defined(RENDER_FOR_PICK) || (!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\ -\n\ -#ifdef RENDER_FOR_PICK\n\ - gl_FragColor = v_pickColor;\n\ -#else\n\ - gl_FragColor = color;\n\ -#endif\n\ -\n\ - czm_writeLogDepth();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/BillboardCollectionVS.js b/Source/Shaders/BillboardCollectionVS.js deleted file mode 100644 index a9a8b7cfb6fe..000000000000 --- a/Source/Shaders/BillboardCollectionVS.js +++ /dev/null @@ -1,300 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef INSTANCED\n\ -attribute vec2 direction;\n\ -#endif\n\ -attribute vec4 positionHighAndScale;\n\ -attribute vec4 positionLowAndRotation;\n\ -attribute vec4 compressedAttribute0; // pixel offset, translate, horizontal origin, vertical origin, show, direction, texture coordinates (texture offset)\n\ -attribute vec4 compressedAttribute1; // aligned axis, translucency by distance, image width\n\ -attribute vec4 compressedAttribute2; // image height, color, pick color, size in meters, valid aligned axis, 13 bits free\n\ -attribute vec4 eyeOffset; // eye offset in meters, 4 bytes free (texture range)\n\ -attribute vec4 scaleByDistance; // near, nearScale, far, farScale\n\ -attribute vec4 pixelOffsetScaleByDistance; // near, nearScale, far, farScale\n\ -attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance\n\ -#ifdef VECTOR_TILE\n\ -attribute float a_batchId;\n\ -#endif\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ -varying vec4 v_pickColor;\n\ -#else\n\ -varying vec4 v_color;\n\ -#endif\n\ -\n\ -const float UPPER_BOUND = 32768.0;\n\ -\n\ -const float SHIFT_LEFT16 = 65536.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_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)\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 * czm_resolutionScale * 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_modelViewProjection * 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\ - mat2 rotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);\n\ - halfSize = rotationMatrix * halfSize;\n\ - }\n\ -#endif\n\ -\n\ - if (sizeInMeters)\n\ - {\n\ - positionEC.xy += halfSize;\n\ - }\n\ -\n\ - float mpp = czm_metersPerPixel(positionEC);\n\ -\n\ - if (!sizeInMeters)\n\ - {\n\ - originTranslate *= mpp;\n\ - }\n\ -\n\ - positionEC.xy += originTranslate;\n\ - if (!sizeInMeters)\n\ - {\n\ - positionEC.xy += halfSize * mpp;\n\ - }\n\ -\n\ - positionEC.xy += translate * mpp;\n\ - positionEC.xy += (pixelOffset * czm_resolutionScale) * mpp;\n\ -\n\ - return positionEC;\n\ -}\n\ -\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\ -#ifdef INSTANCED\n\ - vec2 textureCoordinatesBottomLeft = czm_decompressTextureCoordinates(compressedAttribute0.w);\n\ - vec2 textureCoordinatesRange = czm_decompressTextureCoordinates(eyeOffset.w);\n\ - vec2 textureCoordinates = textureCoordinatesBottomLeft + direction * textureCoordinatesRange;\n\ -#else\n\ - vec2 direction;\n\ - direction.x = floor(compressed * SHIFT_RIGHT1);\n\ - direction.y = compressed - direction.x * SHIFT_LEFT1;\n\ -\n\ - vec2 textureCoordinates = czm_decompressTextureCoordinates(compressedAttribute0.w);\n\ -#endif\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\ -\n\ - translate.y += (temp - floor(temp)) * SHIFT_LEFT8;\n\ - translate.y -= UPPER_BOUND;\n\ -\n\ - temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\ -\n\ - vec2 imageSize = vec2(floor(temp), compressedAttribute2.w);\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 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\ -#ifdef RENDER_FOR_PICK\n\ - temp = compressedAttribute2.y;\n\ -#else\n\ - temp = compressedAttribute2.x;\n\ -#endif\n\ -\n\ - vec4 color;\n\ - temp = temp * SHIFT_RIGHT8;\n\ - color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - temp = floor(temp) * SHIFT_RIGHT8;\n\ - color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - color.r = floor(temp);\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\ -#ifdef RENDER_FOR_PICK\n\ - color.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - vec4 pickColor = color / 255.0;\n\ -#else\n\ - color.a = floor(temp);\n\ - color /= 255.0;\n\ -#endif\n\ -\n\ - ///////////////////////////////////////////////////////////////////////////\n\ -\n\ - vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ - vec4 positionEC = czm_modelViewRelativeToEye * p;\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 = distanceDisplayConditionAndDisableDepth.x;\n\ - float farSq = distanceDisplayConditionAndDisableDepth.y;\n\ - if (lengthSq < nearSq || lengthSq > farSq)\n\ - {\n\ - positionEC.xyz = vec3(0.0);\n\ - }\n\ -#endif\n\ -\n\ - positionEC = addScreenSpaceOffset(positionEC, imageSize, scale, direction, origin, translate, pixelOffset, alignedAxis, validAlignedAxis, rotation, sizeInMeters);\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\ - float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\n\ - if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n\ - {\n\ - disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n\ - }\n\ -\n\ - if (disableDepthTestDistance != 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\ - if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n\ - {\n\ - // Position z on the near plane.\n\ - gl_Position.z = -gl_Position.w;\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(vec4(czm_currentFrustum.x));\n\ -#endif\n\ - }\n\ - }\n\ -#endif\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ - v_pickColor = pickColor;\n\ -#else\n\ - v_color = color;\n\ - v_color.a *= translucency;\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/BrdfLutGeneratorFS.js b/Source/Shaders/BrdfLutGeneratorFS.js deleted file mode 100644 index ffca72ca3b56..000000000000 --- a/Source/Shaders/BrdfLutGeneratorFS.js +++ /dev/null @@ -1,88 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying 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 roughness, vec3 N)\n\ -{\n\ - float a = roughness * roughness;\n\ - float phi = 2.0 * M_PI * xi.x;\n\ - float cosTheta = sqrt((1.0 - xi.y) / (1.0 + (a * a - 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\ -float G1_Smith(float NdotV, float k)\n\ -{\n\ - return NdotV / (NdotV * (1.0 - k) + k);\n\ -}\n\ -\n\ -float G_Smith(float roughness, float NdotV, float NdotL)\n\ -{\n\ - float k = roughness * roughness / 2.0;\n\ - return G1_Smith(NdotV, k) * G1_Smith(NdotL, k);\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\ - for (int i = 0; i < NumSamples; i++)\n\ - {\n\ - vec2 xi = hammersley2D(i, NumSamples);\n\ - vec3 H = importanceSampleGGX(xi, roughness, 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 = G_Smith(roughness, NdotV, NdotL);\n\ - float G_Vis = G * VdotH / (NdotH * NdotV);\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\ - gl_FragColor = vec4(integrateBrdf(1.0 - v_textureCoordinates.y, v_textureCoordinates.x), 0.0, 1.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/degreesPerRadian.js b/Source/Shaders/Builtin/Constants/degreesPerRadian.js deleted file mode 100644 index 3a275ee36fb6..000000000000 --- a/Source/Shaders/Builtin/Constants/degreesPerRadian.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/depthRange.js b/Source/Shaders/Builtin/Constants/depthRange.js deleted file mode 100644 index aca19b64c06d..000000000000 --- a/Source/Shaders/Builtin/Constants/depthRange.js +++ /dev/null @@ -1,19 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon1.js b/Source/Shaders/Builtin/Constants/epsilon1.js deleted file mode 100644 index 83514cd690e0..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon1.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.1\n\ - *\n\ - * @name czm_epsilon1\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon1 = 0.1;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon2.js b/Source/Shaders/Builtin/Constants/epsilon2.js deleted file mode 100644 index 1d36f65d4435..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon2.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.01\n\ - *\n\ - * @name czm_epsilon2\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon2 = 0.01;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon3.js b/Source/Shaders/Builtin/Constants/epsilon3.js deleted file mode 100644 index b66b4fc823d3..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon3.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.001\n\ - *\n\ - * @name czm_epsilon3\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon3 = 0.001;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon4.js b/Source/Shaders/Builtin/Constants/epsilon4.js deleted file mode 100644 index c9a76b0abc8a..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon4.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.0001\n\ - *\n\ - * @name czm_epsilon4\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon4 = 0.0001;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon5.js b/Source/Shaders/Builtin/Constants/epsilon5.js deleted file mode 100644 index 524949407185..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon5.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.00001\n\ - *\n\ - * @name czm_epsilon5\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon5 = 0.00001;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon6.js b/Source/Shaders/Builtin/Constants/epsilon6.js deleted file mode 100644 index b7f428922f25..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon6.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.000001\n\ - *\n\ - * @name czm_epsilon6\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon6 = 0.000001;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/epsilon7.js b/Source/Shaders/Builtin/Constants/epsilon7.js deleted file mode 100644 index eafdca498b4e..000000000000 --- a/Source/Shaders/Builtin/Constants/epsilon7.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * 0.0000001\n\ - *\n\ - * @name czm_epsilon7\n\ - * @glslConstant\n\ - */\n\ -const float czm_epsilon7 = 0.0000001;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/infinity.js b/Source/Shaders/Builtin/Constants/infinity.js deleted file mode 100644 index aa9d30ffa6cd..000000000000 --- a/Source/Shaders/Builtin/Constants/infinity.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/oneOverPi.js b/Source/Shaders/Builtin/Constants/oneOverPi.js deleted file mode 100644 index 65d851ee5fe0..000000000000 --- a/Source/Shaders/Builtin/Constants/oneOverPi.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for 1/pi.\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/oneOverTwoPi.js b/Source/Shaders/Builtin/Constants/oneOverTwoPi.js deleted file mode 100644 index 0405893e1412..000000000000 --- a/Source/Shaders/Builtin/Constants/oneOverTwoPi.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for 1/2pi.\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTile.js b/Source/Shaders/Builtin/Constants/passCesium3DTile.js deleted file mode 100644 index 715da956a11b..000000000000 --- a/Source/Shaders/Builtin/Constants/passCesium3DTile.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 4.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js b/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js deleted file mode 100644 index 41c185f1fe9e..000000000000 --- a/Source/Shaders/Builtin/Constants/passCesium3DTileClassification.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 5.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js b/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js deleted file mode 100644 index 4df0f96b600d..000000000000 --- a/Source/Shaders/Builtin/Constants/passCesium3DTileClassificationIgnoreShow.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 6.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passClassification.js b/Source/Shaders/Builtin/Constants/passClassification.js deleted file mode 100644 index d1ccc45a672b..000000000000 --- a/Source/Shaders/Builtin/Constants/passClassification.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 7.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passCompute.js b/Source/Shaders/Builtin/Constants/passCompute.js deleted file mode 100644 index 65177473c262..000000000000 --- a/Source/Shaders/Builtin/Constants/passCompute.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passEnvironment.js b/Source/Shaders/Builtin/Constants/passEnvironment.js deleted file mode 100644 index c13e7994046b..000000000000 --- a/Source/Shaders/Builtin/Constants/passEnvironment.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passGlobe.js b/Source/Shaders/Builtin/Constants/passGlobe.js deleted file mode 100644 index b0c299a4119d..000000000000 --- a/Source/Shaders/Builtin/Constants/passGlobe.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passOpaque.js b/Source/Shaders/Builtin/Constants/passOpaque.js deleted file mode 100644 index 3c2c0dfae71b..000000000000 --- a/Source/Shaders/Builtin/Constants/passOpaque.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 8.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passOverlay.js b/Source/Shaders/Builtin/Constants/passOverlay.js deleted file mode 100644 index 71a008aa7238..000000000000 --- a/Source/Shaders/Builtin/Constants/passOverlay.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\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 = 10.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passTerrainClassification.js b/Source/Shaders/Builtin/Constants/passTerrainClassification.js deleted file mode 100644 index 23c735543deb..000000000000 --- a/Source/Shaders/Builtin/Constants/passTerrainClassification.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The automatic GLSL constant for {@link Pass#TERRAIN_CLASSIFICATION}\n\ - *\n\ - * @name czm_passTerrainClassification\n\ - * @glslConstant\n\ - *\n\ - * @see czm_pass\n\ - */\n\ -const float czm_passTerrainClassification = 3.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/passTranslucent.js b/Source/Shaders/Builtin/Constants/passTranslucent.js deleted file mode 100644 index 0abe9c91f755..000000000000 --- a/Source/Shaders/Builtin/Constants/passTranslucent.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The automatic GLSL constant for {@link Pass#TRANSLUCENT}\n\ - *\n\ - * @name czm_passTranslucent\n\ - * @glslConstant\n\ - *\n\ - * @see czm_pass\n\ - */\n\ -const float czm_passTranslucent = 9.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/pi.js b/Source/Shaders/Builtin/Constants/pi.js deleted file mode 100644 index 0a730beeb9e1..000000000000 --- a/Source/Shaders/Builtin/Constants/pi.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for Math.PI.\n\ - *\n\ - * @alias czm_pi\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.PI\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_pi = ...;\n\ - *\n\ - * // Example\n\ - * float twoPi = 2.0 * czm_pi;\n\ - */\n\ -const float czm_pi = 3.141592653589793;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverFour.js b/Source/Shaders/Builtin/Constants/piOverFour.js deleted file mode 100644 index db963cc280cd..000000000000 --- a/Source/Shaders/Builtin/Constants/piOverFour.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for pi/4.\n\ - *\n\ - * @alias czm_piOverFour\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.PI_OVER_FOUR\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_piOverFour = ...;\n\ - *\n\ - * // Example\n\ - * float pi = 4.0 * czm_piOverFour;\n\ - */\n\ -const float czm_piOverFour = 0.7853981633974483;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverSix.js b/Source/Shaders/Builtin/Constants/piOverSix.js deleted file mode 100644 index 47b02c158640..000000000000 --- a/Source/Shaders/Builtin/Constants/piOverSix.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for pi/6.\n\ - *\n\ - * @alias czm_piOverSix\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.PI_OVER_SIX\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_piOverSix = ...;\n\ - *\n\ - * // Example\n\ - * float pi = 6.0 * czm_piOverSix;\n\ - */\n\ -const float czm_piOverSix = 0.5235987755982988;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverThree.js b/Source/Shaders/Builtin/Constants/piOverThree.js deleted file mode 100644 index fcaff7407aa9..000000000000 --- a/Source/Shaders/Builtin/Constants/piOverThree.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for pi/3.\n\ - *\n\ - * @alias czm_piOverThree\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.PI_OVER_THREE\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_piOverThree = ...;\n\ - *\n\ - * // Example\n\ - * float pi = 3.0 * czm_piOverThree;\n\ - */\n\ -const float czm_piOverThree = 1.0471975511965976;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/piOverTwo.js b/Source/Shaders/Builtin/Constants/piOverTwo.js deleted file mode 100644 index f00ade7a2514..000000000000 --- a/Source/Shaders/Builtin/Constants/piOverTwo.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for pi/2.\n\ - *\n\ - * @alias czm_piOverTwo\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.PI_OVER_TWO\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_piOverTwo = ...;\n\ - *\n\ - * // Example\n\ - * float pi = 2.0 * czm_piOverTwo;\n\ - */\n\ -const float czm_piOverTwo = 1.5707963267948966;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/radiansPerDegree.js b/Source/Shaders/Builtin/Constants/radiansPerDegree.js deleted file mode 100644 index 76c1f11dbc29..000000000000 --- a/Source/Shaders/Builtin/Constants/radiansPerDegree.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for converting degrees to radians.\n\ - *\n\ - * @alias czm_radiansPerDegree\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.RADIANS_PER_DEGREE\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_radiansPerDegree = ...;\n\ - *\n\ - * // Example\n\ - * float rad = czm_radiansPerDegree * deg;\n\ - */\n\ -const float czm_radiansPerDegree = 0.017453292519943295;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneMode2D.js b/Source/Shaders/Builtin/Constants/sceneMode2D.js deleted file mode 100644 index d3354deeabdc..000000000000 --- a/Source/Shaders/Builtin/Constants/sceneMode2D.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The constant identifier for the 2D {@link SceneMode}\n\ - *\n\ - * @name czm_sceneMode2D\n\ - * @glslConstant\n\ - * @see czm_sceneMode\n\ - * @see czm_sceneModeColumbusView\n\ - * @see czm_sceneMode3D\n\ - * @see czm_sceneModeMorphing\n\ - */\n\ -const float czm_sceneMode2D = 2.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneMode3D.js b/Source/Shaders/Builtin/Constants/sceneMode3D.js deleted file mode 100644 index 7e6e4c9b56c5..000000000000 --- a/Source/Shaders/Builtin/Constants/sceneMode3D.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The constant identifier for the 3D {@link SceneMode}\n\ - *\n\ - * @name czm_sceneMode3D\n\ - * @glslConstant\n\ - * @see czm_sceneMode\n\ - * @see czm_sceneMode2D\n\ - * @see czm_sceneModeColumbusView\n\ - * @see czm_sceneModeMorphing\n\ - */\n\ -const float czm_sceneMode3D = 3.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js b/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js deleted file mode 100644 index 6f883f698ada..000000000000 --- a/Source/Shaders/Builtin/Constants/sceneModeColumbusView.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The constant identifier for the Columbus View {@link SceneMode}\n\ - *\n\ - * @name czm_sceneModeColumbusView\n\ - * @glslConstant\n\ - * @see czm_sceneMode\n\ - * @see czm_sceneMode2D\n\ - * @see czm_sceneMode3D\n\ - * @see czm_sceneModeMorphing\n\ - */\n\ -const float czm_sceneModeColumbusView = 1.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/sceneModeMorphing.js b/Source/Shaders/Builtin/Constants/sceneModeMorphing.js deleted file mode 100644 index 36e3b42adcb2..000000000000 --- a/Source/Shaders/Builtin/Constants/sceneModeMorphing.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The constant identifier for the Morphing {@link SceneMode}\n\ - *\n\ - * @name czm_sceneModeMorphing\n\ - * @glslConstant\n\ - * @see czm_sceneMode\n\ - * @see czm_sceneMode2D\n\ - * @see czm_sceneModeColumbusView\n\ - * @see czm_sceneMode3D\n\ - */\n\ -const float czm_sceneModeMorphing = 0.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/solarRadius.js b/Source/Shaders/Builtin/Constants/solarRadius.js deleted file mode 100644 index 0f088e439fbe..000000000000 --- a/Source/Shaders/Builtin/Constants/solarRadius.js +++ /dev/null @@ -1,18 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for one solar radius.\n\ - *\n\ - * @alias czm_solarRadius\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.SOLAR_RADIUS\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_solarRadius = ...;\n\ - */\n\ -const float czm_solarRadius = 695500000.0;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/threePiOver2.js b/Source/Shaders/Builtin/Constants/threePiOver2.js deleted file mode 100644 index b4f3d1a99c70..000000000000 --- a/Source/Shaders/Builtin/Constants/threePiOver2.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for 3pi/2.\n\ - *\n\ - * @alias czm_threePiOver2\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.THREE_PI_OVER_TWO\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_threePiOver2 = ...;\n\ - *\n\ - * // Example\n\ - * float pi = (2.0 / 3.0) * czm_threePiOver2;\n\ - */\n\ -const float czm_threePiOver2 = 4.71238898038469;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/twoPi.js b/Source/Shaders/Builtin/Constants/twoPi.js deleted file mode 100644 index 2df24bbdac9d..000000000000 --- a/Source/Shaders/Builtin/Constants/twoPi.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * A built-in GLSL floating-point constant for 2pi.\n\ - *\n\ - * @alias czm_twoPi\n\ - * @glslConstant\n\ - *\n\ - * @see CesiumMath.TWO_PI\n\ - *\n\ - * @example\n\ - * // GLSL declaration\n\ - * const float czm_twoPi = ...;\n\ - *\n\ - * // Example\n\ - * float pi = czm_twoPi / 2.0;\n\ - */\n\ -const float czm_twoPi = 6.283185307179586;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js b/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js deleted file mode 100644 index 696adeb08257..000000000000 --- a/Source/Shaders/Builtin/Constants/webMercatorMaxLatitude.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * The maximum latitude, in radians, both North and South, supported by a Web Mercator\n\ - * (EPSG:3857) projection. Technically, the Mercator projection is defined\n\ - * for any latitude up to (but not including) 90 degrees, but it makes sense\n\ - * to cut it off sooner because it grows exponentially with increasing latitude.\n\ - * The logic behind this particular cutoff value, which is the one used by\n\ - * Google Maps, Bing Maps, and Esri, is that it makes the projection\n\ - * square. That is, the rectangle is equal in the X and Y directions.\n\ - *\n\ - * The constant value is computed as follows:\n\ - * czm_pi * 0.5 - (2.0 * atan(exp(-czm_pi)))\n\ - *\n\ - * @name czm_webMercatorMaxLatitude\n\ - * @glslConstant\n\ - */\n\ -const float czm_webMercatorMaxLatitude = 1.4844222297453324;\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/CzmBuiltins.js b/Source/Shaders/Builtin/CzmBuiltins.js deleted file mode 100644 index 98aa0af7f056..000000000000 --- a/Source/Shaders/Builtin/CzmBuiltins.js +++ /dev/null @@ -1,321 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define([ - './Constants/degreesPerRadian', - './Constants/depthRange', - './Constants/epsilon1', - './Constants/epsilon2', - './Constants/epsilon3', - './Constants/epsilon4', - './Constants/epsilon5', - './Constants/epsilon6', - './Constants/epsilon7', - './Constants/infinity', - './Constants/oneOverPi', - './Constants/oneOverTwoPi', - './Constants/passCesium3DTile', - './Constants/passCesium3DTileClassification', - './Constants/passCesium3DTileClassificationIgnoreShow', - './Constants/passClassification', - './Constants/passCompute', - './Constants/passEnvironment', - './Constants/passGlobe', - './Constants/passOpaque', - './Constants/passOverlay', - './Constants/passTerrainClassification', - './Constants/passTranslucent', - './Constants/pi', - './Constants/piOverFour', - './Constants/piOverSix', - './Constants/piOverThree', - './Constants/piOverTwo', - './Constants/radiansPerDegree', - './Constants/sceneMode2D', - './Constants/sceneMode3D', - './Constants/sceneModeColumbusView', - './Constants/sceneModeMorphing', - './Constants/solarRadius', - './Constants/threePiOver2', - './Constants/twoPi', - './Constants/webMercatorMaxLatitude', - './Structs/depthRangeStruct', - './Structs/ellipsoid', - './Structs/material', - './Structs/materialInput', - './Structs/ray', - './Structs/raySegment', - './Structs/shadowParameters', - './Functions/alphaWeight', - './Functions/antialias', - './Functions/cascadeColor', - './Functions/cascadeDistance', - './Functions/cascadeMatrix', - './Functions/cascadeWeights', - './Functions/columbusViewMorph', - './Functions/computePosition', - './Functions/cosineAndSine', - './Functions/decompressTextureCoordinates', - './Functions/depthClampFarPlane', - './Functions/eastNorthUpToEyeCoordinates', - './Functions/ellipsoidContainsPoint', - './Functions/ellipsoidNew', - './Functions/ellipsoidWgs84TextureCoordinates', - './Functions/equalsEpsilon', - './Functions/eyeOffset', - './Functions/eyeToWindowCoordinates', - './Functions/fog', - './Functions/geodeticSurfaceNormal', - './Functions/getDefaultMaterial', - './Functions/getLambertDiffuse', - './Functions/getSpecular', - './Functions/getWaterNoise', - './Functions/getWgs84EllipsoidEC', - './Functions/HSBToRGB', - './Functions/HSLToRGB', - './Functions/hue', - './Functions/isEmpty', - './Functions/isFull', - './Functions/latitudeToWebMercatorFraction', - './Functions/luminance', - './Functions/metersPerPixel', - './Functions/modelToWindowCoordinates', - './Functions/multiplyWithColorBalance', - './Functions/nearFarScalar', - './Functions/octDecode', - './Functions/packDepth', - './Functions/phong', - './Functions/pointAlongRay', - './Functions/rayEllipsoidIntersectionInterval', - './Functions/reverseLogDepth', - './Functions/RGBToHSB', - './Functions/RGBToHSL', - './Functions/RGBToXYZ', - './Functions/saturation', - './Functions/shadowDepthCompare', - './Functions/shadowVisibility', - './Functions/signNotZero', - './Functions/tangentToEyeSpaceMatrix', - './Functions/transformPlane', - './Functions/translateRelativeToEye', - './Functions/translucentPhong', - './Functions/transpose', - './Functions/unpackDepth', - './Functions/unpackFloat', - './Functions/vertexLogDepth', - './Functions/windowToEyeCoordinates', - './Functions/writeDepthClampedToFarPlane', - './Functions/writeLogDepth', - './Functions/XYZToRGB' - ], function( - czm_degreesPerRadian, - czm_depthRange, - czm_epsilon1, - czm_epsilon2, - czm_epsilon3, - czm_epsilon4, - czm_epsilon5, - czm_epsilon6, - czm_epsilon7, - czm_infinity, - czm_oneOverPi, - czm_oneOverTwoPi, - czm_passCesium3DTile, - czm_passCesium3DTileClassification, - czm_passCesium3DTileClassificationIgnoreShow, - czm_passClassification, - czm_passCompute, - czm_passEnvironment, - czm_passGlobe, - czm_passOpaque, - czm_passOverlay, - czm_passTerrainClassification, - czm_passTranslucent, - czm_pi, - czm_piOverFour, - czm_piOverSix, - czm_piOverThree, - czm_piOverTwo, - czm_radiansPerDegree, - czm_sceneMode2D, - czm_sceneMode3D, - czm_sceneModeColumbusView, - czm_sceneModeMorphing, - czm_solarRadius, - czm_threePiOver2, - czm_twoPi, - czm_webMercatorMaxLatitude, - czm_depthRangeStruct, - czm_ellipsoid, - czm_material, - czm_materialInput, - czm_ray, - czm_raySegment, - czm_shadowParameters, - czm_alphaWeight, - czm_antialias, - czm_cascadeColor, - czm_cascadeDistance, - czm_cascadeMatrix, - czm_cascadeWeights, - czm_columbusViewMorph, - czm_computePosition, - czm_cosineAndSine, - czm_decompressTextureCoordinates, - czm_depthClampFarPlane, - czm_eastNorthUpToEyeCoordinates, - czm_ellipsoidContainsPoint, - czm_ellipsoidNew, - czm_ellipsoidWgs84TextureCoordinates, - czm_equalsEpsilon, - czm_eyeOffset, - czm_eyeToWindowCoordinates, - czm_fog, - czm_geodeticSurfaceNormal, - czm_getDefaultMaterial, - czm_getLambertDiffuse, - czm_getSpecular, - czm_getWaterNoise, - czm_getWgs84EllipsoidEC, - czm_HSBToRGB, - czm_HSLToRGB, - czm_hue, - czm_isEmpty, - czm_isFull, - czm_latitudeToWebMercatorFraction, - czm_luminance, - czm_metersPerPixel, - czm_modelToWindowCoordinates, - czm_multiplyWithColorBalance, - czm_nearFarScalar, - czm_octDecode, - czm_packDepth, - czm_phong, - czm_pointAlongRay, - czm_rayEllipsoidIntersectionInterval, - czm_reverseLogDepth, - czm_RGBToHSB, - czm_RGBToHSL, - czm_RGBToXYZ, - czm_saturation, - czm_shadowDepthCompare, - czm_shadowVisibility, - czm_signNotZero, - czm_tangentToEyeSpaceMatrix, - czm_transformPlane, - czm_translateRelativeToEye, - czm_translucentPhong, - czm_transpose, - czm_unpackDepth, - czm_unpackFloat, - czm_vertexLogDepth, - czm_windowToEyeCoordinates, - czm_writeDepthClampedToFarPlane, - czm_writeLogDepth, - czm_XYZToRGB) { - 'use strict'; - return { - czm_degreesPerRadian : czm_degreesPerRadian, - czm_depthRange : czm_depthRange, - czm_epsilon1 : czm_epsilon1, - czm_epsilon2 : czm_epsilon2, - czm_epsilon3 : czm_epsilon3, - czm_epsilon4 : czm_epsilon4, - czm_epsilon5 : czm_epsilon5, - czm_epsilon6 : czm_epsilon6, - czm_epsilon7 : czm_epsilon7, - czm_infinity : czm_infinity, - czm_oneOverPi : czm_oneOverPi, - czm_oneOverTwoPi : czm_oneOverTwoPi, - czm_passCesium3DTile : czm_passCesium3DTile, - czm_passCesium3DTileClassification : czm_passCesium3DTileClassification, - czm_passCesium3DTileClassificationIgnoreShow : czm_passCesium3DTileClassificationIgnoreShow, - czm_passClassification : czm_passClassification, - czm_passCompute : czm_passCompute, - czm_passEnvironment : czm_passEnvironment, - czm_passGlobe : czm_passGlobe, - czm_passOpaque : czm_passOpaque, - czm_passOverlay : czm_passOverlay, - czm_passTerrainClassification : czm_passTerrainClassification, - czm_passTranslucent : czm_passTranslucent, - czm_pi : czm_pi, - czm_piOverFour : czm_piOverFour, - czm_piOverSix : czm_piOverSix, - czm_piOverThree : czm_piOverThree, - czm_piOverTwo : czm_piOverTwo, - czm_radiansPerDegree : czm_radiansPerDegree, - czm_sceneMode2D : czm_sceneMode2D, - czm_sceneMode3D : czm_sceneMode3D, - czm_sceneModeColumbusView : czm_sceneModeColumbusView, - czm_sceneModeMorphing : czm_sceneModeMorphing, - czm_solarRadius : czm_solarRadius, - czm_threePiOver2 : czm_threePiOver2, - czm_twoPi : czm_twoPi, - czm_webMercatorMaxLatitude : czm_webMercatorMaxLatitude, - czm_depthRangeStruct : czm_depthRangeStruct, - czm_ellipsoid : czm_ellipsoid, - czm_material : czm_material, - czm_materialInput : czm_materialInput, - czm_ray : czm_ray, - czm_raySegment : czm_raySegment, - czm_shadowParameters : czm_shadowParameters, - czm_alphaWeight : czm_alphaWeight, - czm_antialias : czm_antialias, - czm_cascadeColor : czm_cascadeColor, - czm_cascadeDistance : czm_cascadeDistance, - czm_cascadeMatrix : czm_cascadeMatrix, - czm_cascadeWeights : czm_cascadeWeights, - czm_columbusViewMorph : czm_columbusViewMorph, - czm_computePosition : czm_computePosition, - czm_cosineAndSine : czm_cosineAndSine, - czm_decompressTextureCoordinates : czm_decompressTextureCoordinates, - czm_depthClampFarPlane : czm_depthClampFarPlane, - czm_eastNorthUpToEyeCoordinates : czm_eastNorthUpToEyeCoordinates, - czm_ellipsoidContainsPoint : czm_ellipsoidContainsPoint, - czm_ellipsoidNew : czm_ellipsoidNew, - czm_ellipsoidWgs84TextureCoordinates : czm_ellipsoidWgs84TextureCoordinates, - czm_equalsEpsilon : czm_equalsEpsilon, - czm_eyeOffset : czm_eyeOffset, - czm_eyeToWindowCoordinates : czm_eyeToWindowCoordinates, - czm_fog : czm_fog, - czm_geodeticSurfaceNormal : czm_geodeticSurfaceNormal, - czm_getDefaultMaterial : czm_getDefaultMaterial, - czm_getLambertDiffuse : czm_getLambertDiffuse, - czm_getSpecular : czm_getSpecular, - czm_getWaterNoise : czm_getWaterNoise, - czm_getWgs84EllipsoidEC : czm_getWgs84EllipsoidEC, - czm_HSBToRGB : czm_HSBToRGB, - czm_HSLToRGB : czm_HSLToRGB, - czm_hue : czm_hue, - czm_isEmpty : czm_isEmpty, - czm_isFull : czm_isFull, - czm_latitudeToWebMercatorFraction : czm_latitudeToWebMercatorFraction, - czm_luminance : czm_luminance, - czm_metersPerPixel : czm_metersPerPixel, - czm_modelToWindowCoordinates : czm_modelToWindowCoordinates, - czm_multiplyWithColorBalance : czm_multiplyWithColorBalance, - czm_nearFarScalar : czm_nearFarScalar, - czm_octDecode : czm_octDecode, - czm_packDepth : czm_packDepth, - czm_phong : czm_phong, - czm_pointAlongRay : czm_pointAlongRay, - czm_rayEllipsoidIntersectionInterval : czm_rayEllipsoidIntersectionInterval, - czm_reverseLogDepth : czm_reverseLogDepth, - czm_RGBToHSB : czm_RGBToHSB, - czm_RGBToHSL : czm_RGBToHSL, - czm_RGBToXYZ : czm_RGBToXYZ, - czm_saturation : czm_saturation, - czm_shadowDepthCompare : czm_shadowDepthCompare, - czm_shadowVisibility : czm_shadowVisibility, - czm_signNotZero : czm_signNotZero, - czm_tangentToEyeSpaceMatrix : czm_tangentToEyeSpaceMatrix, - czm_transformPlane : czm_transformPlane, - czm_translateRelativeToEye : czm_translateRelativeToEye, - czm_translucentPhong : czm_translucentPhong, - czm_transpose : czm_transpose, - czm_unpackDepth : czm_unpackDepth, - czm_unpackFloat : czm_unpackFloat, - czm_vertexLogDepth : czm_vertexLogDepth, - czm_windowToEyeCoordinates : czm_windowToEyeCoordinates, - czm_writeDepthClampedToFarPlane : czm_writeDepthClampedToFarPlane, - czm_writeLogDepth : czm_writeLogDepth, - czm_XYZToRGB : czm_XYZToRGB}; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/HSBToRGB.js b/Source/Shaders/Builtin/Functions/HSBToRGB.js deleted file mode 100644 index f6abd4b98f45..000000000000 --- a/Source/Shaders/Builtin/Functions/HSBToRGB.js +++ /dev/null @@ -1,29 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts an HSB color (hue, saturation, brightness) to RGB\n\ - * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n\ - *\n\ - * @name czm_HSBToRGB\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} hsb The color in HSB.\n\ - *\n\ - * @returns {vec3} The color in RGB.\n\ - *\n\ - * @example\n\ - * vec3 hsb = czm_RGBToHSB(rgb);\n\ - * hsb.z *= 0.1;\n\ - * rgb = czm_HSBToRGB(hsb);\n\ - */\n\ -\n\ -const vec4 K_HSB2RGB = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n\ -\n\ -vec3 czm_HSBToRGB(vec3 hsb)\n\ -{\n\ - vec3 p = abs(fract(hsb.xxx + K_HSB2RGB.xyz) * 6.0 - K_HSB2RGB.www);\n\ - return hsb.z * mix(K_HSB2RGB.xxx, clamp(p - K_HSB2RGB.xxx, 0.0, 1.0), hsb.y);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/HSLToRGB.js b/Source/Shaders/Builtin/Functions/HSLToRGB.js deleted file mode 100644 index 3d4894538ac5..000000000000 --- a/Source/Shaders/Builtin/Functions/HSLToRGB.js +++ /dev/null @@ -1,36 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts an HSL color (hue, saturation, lightness) to RGB\n\ - * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n\ - *\n\ - * @name czm_HSLToRGB\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color in HSL.\n\ - *\n\ - * @returns {vec3} The color in RGB.\n\ - *\n\ - * @example\n\ - * vec3 hsl = czm_RGBToHSL(rgb);\n\ - * hsl.z *= 0.1;\n\ - * rgb = czm_HSLToRGB(hsl);\n\ - */\n\ -\n\ -vec3 hueToRGB(float hue)\n\ -{\n\ - float r = abs(hue * 6.0 - 3.0) - 1.0;\n\ - float g = 2.0 - abs(hue * 6.0 - 2.0);\n\ - float b = 2.0 - abs(hue * 6.0 - 4.0);\n\ - return clamp(vec3(r, g, b), 0.0, 1.0);\n\ -}\n\ -\n\ -vec3 czm_HSLToRGB(vec3 hsl)\n\ -{\n\ - vec3 rgb = hueToRGB(hsl.x);\n\ - float c = (1.0 - abs(2.0 * hsl.z - 1.0)) * hsl.y;\n\ - return (rgb - 0.5) * c + hsl.z;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToHSB.js b/Source/Shaders/Builtin/Functions/RGBToHSB.js deleted file mode 100644 index b7a093ce0fe0..000000000000 --- a/Source/Shaders/Builtin/Functions/RGBToHSB.js +++ /dev/null @@ -1,32 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts an RGB color to HSB (hue, saturation, brightness)\n\ - * HSB <-> RGB conversion with minimal branching: {@link http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl}\n\ - *\n\ - * @name czm_RGBToHSB\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color in RGB.\n\ - *\n\ - * @returns {vec3} The color in HSB.\n\ - *\n\ - * @example\n\ - * vec3 hsb = czm_RGBToHSB(rgb);\n\ - * hsb.z *= 0.1;\n\ - * rgb = czm_HSBToRGB(hsb);\n\ - */\n\ -\n\ -const vec4 K_RGB2HSB = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\ -\n\ -vec3 czm_RGBToHSB(vec3 rgb)\n\ -{\n\ - vec4 p = mix(vec4(rgb.bg, K_RGB2HSB.wz), vec4(rgb.gb, K_RGB2HSB.xy), step(rgb.b, rgb.g));\n\ - vec4 q = mix(vec4(p.xyw, rgb.r), vec4(rgb.r, p.yzx), step(p.x, rgb.r));\n\ -\n\ - float d = q.x - min(q.w, q.y);\n\ - return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + czm_epsilon7)), d / (q.x + czm_epsilon7), q.x);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToHSL.js b/Source/Shaders/Builtin/Functions/RGBToHSL.js deleted file mode 100644 index f9ed6802de20..000000000000 --- a/Source/Shaders/Builtin/Functions/RGBToHSL.js +++ /dev/null @@ -1,39 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts an RGB color to HSL (hue, saturation, lightness)\n\ - * HSL <-> RGB conversion: {@link http://www.chilliant.com/rgb2hsv.html}\n\ - *\n\ - * @name czm_RGBToHSL\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color in RGB.\n\ - *\n\ - * @returns {vec3} The color in HSL.\n\ - *\n\ - * @example\n\ - * vec3 hsl = czm_RGBToHSL(rgb);\n\ - * hsl.z *= 0.1;\n\ - * rgb = czm_HSLToRGB(hsl);\n\ - */\n\ - \n\ -vec3 RGBtoHCV(vec3 rgb)\n\ -{\n\ - // Based on work by Sam Hocevar and Emil Persson\n\ - vec4 p = (rgb.g < rgb.b) ? vec4(rgb.bg, -1.0, 2.0 / 3.0) : vec4(rgb.gb, 0.0, -1.0 / 3.0);\n\ - vec4 q = (rgb.r < p.x) ? vec4(p.xyw, rgb.r) : vec4(rgb.r, p.yzx);\n\ - float c = q.x - min(q.w, q.y);\n\ - float h = abs((q.w - q.y) / (6.0 * c + czm_epsilon7) + q.z);\n\ - return vec3(h, c, q.x);\n\ -}\n\ -\n\ -vec3 czm_RGBToHSL(vec3 rgb)\n\ -{\n\ - vec3 hcv = RGBtoHCV(rgb);\n\ - float l = hcv.z - hcv.y * 0.5;\n\ - float s = hcv.y / (1.0 - abs(l * 2.0 - 1.0) + czm_epsilon7);\n\ - return vec3(hcv.x, s, l);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/RGBToXYZ.js b/Source/Shaders/Builtin/Functions/RGBToXYZ.js deleted file mode 100644 index 8851d71a53e2..000000000000 --- a/Source/Shaders/Builtin/Functions/RGBToXYZ.js +++ /dev/null @@ -1,35 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts an RGB color to CIE Yxy.\n\ - *

The conversion is described in\n\ - * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n\ - *

\n\ - * \n\ - * @name czm_RGBToXYZ\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color in RGB.\n\ - *\n\ - * @returns {vec3} The color in CIE Yxy.\n\ - *\n\ - * @example\n\ - * vec3 xyz = czm_RGBToXYZ(rgb);\n\ - * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n\ - * rgb = czm_XYZToRGB(xyz);\n\ - */\n\ -vec3 czm_RGBToXYZ(vec3 rgb)\n\ -{\n\ - const mat3 RGB2XYZ = mat3(0.4124, 0.2126, 0.0193,\n\ - 0.3576, 0.7152, 0.1192,\n\ - 0.1805, 0.0722, 0.9505);\n\ - vec3 xyz = RGB2XYZ * rgb;\n\ - vec3 Yxy;\n\ - Yxy.r = xyz.g;\n\ - float temp = dot(vec3(1.0), xyz);\n\ - Yxy.gb = xyz.rg / temp;\n\ - return Yxy;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/XYZToRGB.js b/Source/Shaders/Builtin/Functions/XYZToRGB.js deleted file mode 100644 index c517ee6ae5de..000000000000 --- a/Source/Shaders/Builtin/Functions/XYZToRGB.js +++ /dev/null @@ -1,35 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Converts a CIE Yxy color to RGB.\n\ - *

The conversion is described in\n\ - * {@link http://content.gpwiki.org/index.php/D3DBook:High-Dynamic_Range_Rendering#Luminance_Transform|Luminance Transform}\n\ - *

\n\ - * \n\ - * @name czm_XYZToRGB\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} Yxy The color in CIE Yxy.\n\ - *\n\ - * @returns {vec3} The color in RGB.\n\ - *\n\ - * @example\n\ - * vec3 xyz = czm_RGBToXYZ(rgb);\n\ - * xyz.x = max(xyz.x - luminanceThreshold, 0.0);\n\ - * rgb = czm_XYZToRGB(xyz);\n\ - */\n\ -vec3 czm_XYZToRGB(vec3 Yxy)\n\ -{\n\ - const mat3 XYZ2RGB = mat3( 3.2405, -0.9693, 0.0556,\n\ - -1.5371, 1.8760, -0.2040,\n\ - -0.4985, 0.0416, 1.0572);\n\ - vec3 xyz;\n\ - xyz.r = Yxy.r * Yxy.g / Yxy.b;\n\ - xyz.g = Yxy.r;\n\ - xyz.b = Yxy.r * (1.0 - Yxy.g - Yxy.b) / Yxy.b;\n\ - \n\ - return XYZ2RGB * xyz;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/alphaWeight.js b/Source/Shaders/Builtin/Functions/alphaWeight.js deleted file mode 100644 index 5fd325ebe239..000000000000 --- a/Source/Shaders/Builtin/Functions/alphaWeight.js +++ /dev/null @@ -1,37 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @private\n\ - */\n\ -float czm_alphaWeight(float a)\n\ -{\n\ - float x = 2.0 * (gl_FragCoord.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\ - float y = 2.0 * (gl_FragCoord.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\ - float z = (gl_FragCoord.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\ - vec4 q = vec4(x, y, z, 0.0);\n\ - q /= gl_FragCoord.w;\n\ -\n\ - if (czm_inverseProjection != mat4(0.0)) {\n\ - q = czm_inverseProjection * q;\n\ - } else {\n\ - float top = czm_frustumPlanes.x;\n\ - float bottom = czm_frustumPlanes.y;\n\ - float left = czm_frustumPlanes.z;\n\ - float right = czm_frustumPlanes.w;\n\ -\n\ - float near = czm_currentFrustum.x;\n\ - float far = czm_currentFrustum.y;\n\ -\n\ - q.x = (q.x * (right - left) + left + right) * 0.5;\n\ - q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n\ - q.z = (q.z * (near - far) - near - far) * 0.5;\n\ - q.w = 1.0;\n\ - }\n\ -\n\ - // See Weighted Blended Order-Independent Transparency for examples of different weighting functions:\n\ - // http://jcgt.org/published/0002/02/09/ \n\ - return pow(a + 0.01, 4.0) + max(1e-2, min(3.0 * 1e3, 0.003 / (1e-5 + pow(abs(z) / 200.0, 4.0))));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/antialias.js b/Source/Shaders/Builtin/Functions/antialias.js deleted file mode 100644 index 365e35f02ed1..000000000000 --- a/Source/Shaders/Builtin/Functions/antialias.js +++ /dev/null @@ -1,44 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Procedural anti-aliasing by blurring two colors that meet at a sharp edge.\n\ - *\n\ - * @name czm_antialias\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} color1 The color on one side of the edge.\n\ - * @param {vec4} color2 The color on the other side of the edge.\n\ - * @param {vec4} currentcolor The current color, either color1 or color2.\n\ - * @param {float} dist The distance to the edge in texture coordinates.\n\ - * @param {float} [fuzzFactor=0.1] Controls the blurriness between the two colors.\n\ - * @returns {vec4} The anti-aliased color.\n\ - *\n\ - * @example\n\ - * // GLSL declarations\n\ - * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor);\n\ - * vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist);\n\ - *\n\ - * // get the color for a material that has a sharp edge at the line y = 0.5 in texture space\n\ - * float dist = abs(textureCoordinates.t - 0.5);\n\ - * vec4 currentColor = mix(bottomColor, topColor, step(0.5, textureCoordinates.t));\n\ - * vec4 color = czm_antialias(bottomColor, topColor, currentColor, dist, 0.1);\n\ - */\n\ -vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist, float fuzzFactor)\n\ -{\n\ - float val1 = clamp(dist / fuzzFactor, 0.0, 1.0);\n\ - float val2 = clamp((dist - 0.5) / fuzzFactor, 0.0, 1.0);\n\ - val1 = val1 * (1.0 - val2);\n\ - val1 = val1 * val1 * (3.0 - (2.0 * val1));\n\ - val1 = pow(val1, 0.5); //makes the transition nicer\n\ - \n\ - vec4 midColor = (color1 + color2) * 0.5;\n\ - return mix(midColor, currentColor, val1);\n\ -}\n\ -\n\ -vec4 czm_antialias(vec4 color1, vec4 color2, vec4 currentColor, float dist)\n\ -{\n\ - return czm_antialias(color1, color2, currentColor, dist, 0.1);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeColor.js b/Source/Shaders/Builtin/Functions/cascadeColor.js deleted file mode 100644 index 4b5b036d1853..000000000000 --- a/Source/Shaders/Builtin/Functions/cascadeColor.js +++ /dev/null @@ -1,13 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -vec4 czm_cascadeColor(vec4 weights)\n\ -{\n\ - return vec4(1.0, 0.0, 0.0, 1.0) * weights.x +\n\ - vec4(0.0, 1.0, 0.0, 1.0) * weights.y +\n\ - vec4(0.0, 0.0, 1.0, 1.0) * weights.z +\n\ - vec4(1.0, 0.0, 1.0, 1.0) * weights.w;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeDistance.js b/Source/Shaders/Builtin/Functions/cascadeDistance.js deleted file mode 100644 index b2c3985281cc..000000000000 --- a/Source/Shaders/Builtin/Functions/cascadeDistance.js +++ /dev/null @@ -1,12 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -uniform vec4 shadowMap_cascadeDistances;\n\ -\n\ -float czm_cascadeDistance(vec4 weights)\n\ -{\n\ - return dot(shadowMap_cascadeDistances, weights);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeMatrix.js b/Source/Shaders/Builtin/Functions/cascadeMatrix.js deleted file mode 100644 index 732e88b1b715..000000000000 --- a/Source/Shaders/Builtin/Functions/cascadeMatrix.js +++ /dev/null @@ -1,15 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -uniform mat4 shadowMap_cascadeMatrices[4];\n\ -\n\ -mat4 czm_cascadeMatrix(vec4 weights)\n\ -{\n\ - return shadowMap_cascadeMatrices[0] * weights.x +\n\ - shadowMap_cascadeMatrices[1] * weights.y +\n\ - shadowMap_cascadeMatrices[2] * weights.z +\n\ - shadowMap_cascadeMatrices[3] * weights.w;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cascadeWeights.js b/Source/Shaders/Builtin/Functions/cascadeWeights.js deleted file mode 100644 index 59cebf458434..000000000000 --- a/Source/Shaders/Builtin/Functions/cascadeWeights.js +++ /dev/null @@ -1,15 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -uniform vec4 shadowMap_cascadeSplits[2];\n\ -\n\ -vec4 czm_cascadeWeights(float depthEye)\n\ -{\n\ - // One component is set to 1.0 and all others set to 0.0.\n\ - vec4 near = step(shadowMap_cascadeSplits[0], vec4(depthEye));\n\ - vec4 far = step(depthEye, shadowMap_cascadeSplits[1]);\n\ - return near * far;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/columbusViewMorph.js b/Source/Shaders/Builtin/Functions/columbusViewMorph.js deleted file mode 100644 index 7fdfde1311ca..000000000000 --- a/Source/Shaders/Builtin/Functions/columbusViewMorph.js +++ /dev/null @@ -1,17 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_columbusViewMorph\n\ - * @glslFunction\n\ - */\n\ -vec4 czm_columbusViewMorph(vec4 position2D, vec4 position3D, float time)\n\ -{\n\ - // Just linear for now.\n\ - vec3 p = mix(position2D.xyz, position3D.xyz, time);\n\ - return vec4(p, 1.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/computePosition.js b/Source/Shaders/Builtin/Functions/computePosition.js deleted file mode 100644 index 5d28ef26fd83..000000000000 --- a/Source/Shaders/Builtin/Functions/computePosition.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Returns a position in model coordinates relative to eye taking into\n\ - * account the current scene mode: 3D, 2D, or Columbus view.\n\ - *

\n\ - * This uses standard position attributes, position3DHigh, \n\ - * position3DLow, position2DHigh, and position2DLow, \n\ - * and should be used when writing a vertex shader for an {@link Appearance}.\n\ - *

\n\ - *\n\ - * @name czm_computePosition\n\ - * @glslFunction\n\ - *\n\ - * @returns {vec4} The position relative to eye.\n\ - *\n\ - * @example\n\ - * vec4 p = czm_computePosition();\n\ - * v_positionEC = (czm_modelViewRelativeToEye * p).xyz;\n\ - * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\ - *\n\ - * @see czm_translateRelativeToEye\n\ - */\n\ -vec4 czm_computePosition();\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/cosineAndSine.js b/Source/Shaders/Builtin/Functions/cosineAndSine.js deleted file mode 100644 index b7684f4f45dc..000000000000 --- a/Source/Shaders/Builtin/Functions/cosineAndSine.js +++ /dev/null @@ -1,216 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @private\n\ - */\n\ -vec2 cordic(float angle)\n\ -{\n\ -// Scale the vector by the appropriate factor for the 24 iterations to follow.\n\ - vec2 vector = vec2(6.0725293500888267e-1, 0.0);\n\ -// Iteration 1\n\ - float sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - // float factor = sense * 1.0; // 2^-0\n\ - mat2 rotation = mat2(1.0, sense, -sense, 1.0);\n\ - vector = rotation * vector;\n\ - angle -= sense * 7.8539816339744828e-1; // atan(2^-0)\n\ -// Iteration 2\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - float factor = sense * 5.0e-1; // 2^-1\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 4.6364760900080609e-1; // atan(2^-1)\n\ -// Iteration 3\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 2.5e-1; // 2^-2\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 2.4497866312686414e-1; // atan(2^-2)\n\ -// Iteration 4\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.25e-1; // 2^-3\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.2435499454676144e-1; // atan(2^-3)\n\ -// Iteration 5\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 6.25e-2; // 2^-4\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 6.2418809995957350e-2; // atan(2^-4)\n\ -// Iteration 6\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 3.125e-2; // 2^-5\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 3.1239833430268277e-2; // atan(2^-5)\n\ -// Iteration 7\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.5625e-2; // 2^-6\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.5623728620476831e-2; // atan(2^-6)\n\ -// Iteration 8\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 7.8125e-3; // 2^-7\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 7.8123410601011111e-3; // atan(2^-7)\n\ -// Iteration 9\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 3.90625e-3; // 2^-8\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 3.9062301319669718e-3; // atan(2^-8)\n\ -// Iteration 10\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.953125e-3; // 2^-9\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.9531225164788188e-3; // atan(2^-9)\n\ -// Iteration 11\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 9.765625e-4; // 2^-10\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 9.7656218955931946e-4; // atan(2^-10)\n\ -// Iteration 12\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 4.8828125e-4; // 2^-11\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 4.8828121119489829e-4; // atan(2^-11)\n\ -// Iteration 13\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 2.44140625e-4; // 2^-12\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 2.4414062014936177e-4; // atan(2^-12)\n\ -// Iteration 14\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.220703125e-4; // 2^-13\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.2207031189367021e-4; // atan(2^-13)\n\ -// Iteration 15\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 6.103515625e-5; // 2^-14\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 6.1035156174208773e-5; // atan(2^-14)\n\ -// Iteration 16\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 3.0517578125e-5; // 2^-15\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 3.0517578115526096e-5; // atan(2^-15)\n\ -// Iteration 17\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.52587890625e-5; // 2^-16\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.5258789061315762e-5; // atan(2^-16)\n\ -// Iteration 18\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 7.62939453125e-6; // 2^-17\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 7.6293945311019700e-6; // atan(2^-17)\n\ -// Iteration 19\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 3.814697265625e-6; // 2^-18\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 3.8146972656064961e-6; // atan(2^-18)\n\ -// Iteration 20\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.9073486328125e-6; // 2^-19\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 1.9073486328101870e-6; // atan(2^-19)\n\ -// Iteration 21\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 9.5367431640625e-7; // 2^-20\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 9.5367431640596084e-7; // atan(2^-20)\n\ -// Iteration 22\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 4.76837158203125e-7; // 2^-21\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 4.7683715820308884e-7; // atan(2^-21)\n\ -// Iteration 23\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 2.384185791015625e-7; // 2^-22\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ - angle -= sense * 2.3841857910155797e-7; // atan(2^-22)\n\ -// Iteration 24\n\ - sense = (angle < 0.0) ? -1.0 : 1.0;\n\ - factor = sense * 1.1920928955078125e-7; // 2^-23\n\ - rotation[0][1] = factor;\n\ - rotation[1][0] = -factor;\n\ - vector = rotation * vector;\n\ -// angle -= sense * 1.1920928955078068e-7; // atan(2^-23)\n\ -\n\ - return vector;\n\ -}\n\ -\n\ -/**\n\ - * Computes the cosine and sine of the provided angle using the CORDIC algorithm.\n\ - *\n\ - * @name czm_cosineAndSine\n\ - * @glslFunction\n\ - *\n\ - * @param {float} angle The angle in radians.\n\ - *\n\ - * @returns {vec2} The resulting cosine of the angle (as the x coordinate) and sine of the angle (as the y coordinate).\n\ - *\n\ - * @example\n\ - * vec2 v = czm_cosineAndSine(czm_piOverSix);\n\ - * float cosine = v.x;\n\ - * float sine = v.y;\n\ - */\n\ -vec2 czm_cosineAndSine(float angle)\n\ -{\n\ - if (angle < -czm_piOverTwo || angle > czm_piOverTwo)\n\ - {\n\ - if (angle < 0.0)\n\ - {\n\ - return -cordic(angle + czm_pi);\n\ - }\n\ - else\n\ - {\n\ - return -cordic(angle - czm_pi);\n\ - }\n\ - }\n\ - else\n\ - {\n\ - return cordic(angle);\n\ - }\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js b/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js deleted file mode 100644 index 68a620b63bff..000000000000 --- a/Source/Shaders/Builtin/Functions/decompressTextureCoordinates.js +++ /dev/null @@ -1,22 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Decompresses texture coordinates that were packed into a single float.\n\ - *\n\ - * @name czm_decompressTextureCoordinates\n\ - * @glslFunction\n\ - *\n\ - * @param {float} encoded The compressed texture coordinates.\n\ - * @returns {vec2} The decompressed texture coordinates.\n\ - */\n\ - vec2 czm_decompressTextureCoordinates(float encoded)\n\ - {\n\ - float temp = encoded / 4096.0;\n\ - float xZeroTo4095 = floor(temp);\n\ - float stx = xZeroTo4095 / 4095.0;\n\ - float sty = (encoded - xZeroTo4095 * 4096.0) / 4095.0;\n\ - return vec2(stx, sty);\n\ - }\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/depthClampFarPlane.js b/Source/Shaders/Builtin/Functions/depthClampFarPlane.js deleted file mode 100644 index 8ea115c5cd32..000000000000 --- a/Source/Shaders/Builtin/Functions/depthClampFarPlane.js +++ /dev/null @@ -1,32 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "// emulated noperspective\n\ -#ifndef LOG_DEPTH\n\ -varying float v_WindowZ;\n\ -#endif\n\ -\n\ -/**\n\ - * Clamps a vertex to the far plane.\n\ - *\n\ - * @name czm_depthClampFarPlane\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} coords The vertex in clip coordinates.\n\ - * @returns {vec4} The vertex clipped to the far plane.\n\ - *\n\ - * @example\n\ - * gl_Position = czm_depthClampFarPlane(czm_modelViewProjection * vec4(position, 1.0));\n\ - *\n\ - * @see czm_writeDepthClampedToFarPlane\n\ - */\n\ -vec4 czm_depthClampFarPlane(vec4 coords)\n\ -{\n\ -#ifndef LOG_DEPTH\n\ - v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;\n\ - coords.z = min(coords.z, coords.w);\n\ -#endif\n\ - return coords;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js b/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js deleted file mode 100644 index f61fee5929df..000000000000 --- a/Source/Shaders/Builtin/Functions/eastNorthUpToEyeCoordinates.js +++ /dev/null @@ -1,38 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes a 3x3 rotation matrix that transforms vectors from an ellipsoid's east-north-up coordinate system \n\ - * to eye coordinates. In east-north-up coordinates, x points east, y points north, and z points along the \n\ - * surface normal. East-north-up can be used as an ellipsoid's tangent space for operations such as bump mapping.\n\ - *

\n\ - * The ellipsoid is assumed to be centered at the model coordinate's origin.\n\ - *\n\ - * @name czm_eastNorthUpToEyeCoordinates\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} positionMC The position on the ellipsoid in model coordinates.\n\ - * @param {vec3} normalEC The normalized ellipsoid surface normal, at positionMC, in eye coordinates.\n\ - *\n\ - * @returns {mat3} A 3x3 rotation matrix that transforms vectors from the east-north-up coordinate system to eye coordinates.\n\ - *\n\ - * @example\n\ - * // Transform a vector defined in the east-north-up coordinate \n\ - * // system, (0, 0, 1) which is the surface normal, to eye \n\ - * // coordinates.\n\ - * mat3 m = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n\ - * vec3 normalEC = m * vec3(0.0, 0.0, 1.0);\n\ - */\n\ -mat3 czm_eastNorthUpToEyeCoordinates(vec3 positionMC, vec3 normalEC)\n\ -{\n\ - vec3 tangentMC = normalize(vec3(-positionMC.y, positionMC.x, 0.0)); // normalized surface tangent in model coordinates\n\ - vec3 tangentEC = normalize(czm_normal3D * tangentMC); // normalized surface tangent in eye coordiantes\n\ - vec3 bitangentEC = normalize(cross(normalEC, tangentEC)); // normalized surface bitangent in eye coordinates\n\ -\n\ - return mat3(\n\ - tangentEC.x, tangentEC.y, tangentEC.z,\n\ - bitangentEC.x, bitangentEC.y, bitangentEC.z,\n\ - normalEC.x, normalEC.y, normalEC.z);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js b/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js deleted file mode 100644 index e4695a6bb683..000000000000 --- a/Source/Shaders/Builtin/Functions/ellipsoidContainsPoint.js +++ /dev/null @@ -1,17 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_ellipsoidContainsPoint\n\ - * @glslFunction\n\ - *\n\ - */\n\ -bool czm_ellipsoidContainsPoint(czm_ellipsoid ellipsoid, vec3 point)\n\ -{\n\ - vec3 scaled = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(point, 1.0)).xyz;\n\ - return (dot(scaled, scaled) <= 1.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidNew.js b/Source/Shaders/Builtin/Functions/ellipsoidNew.js deleted file mode 100644 index f7e2763ea173..000000000000 --- a/Source/Shaders/Builtin/Functions/ellipsoidNew.js +++ /dev/null @@ -1,19 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_ellipsoidNew\n\ - * @glslFunction\n\ - *\n\ - */\n\ -czm_ellipsoid czm_ellipsoidNew(vec3 center, vec3 radii)\n\ -{\n\ - vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\ - vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\ - czm_ellipsoid temp = czm_ellipsoid(center, radii, inverseRadii, inverseRadiiSquared);\n\ - return temp;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js b/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js deleted file mode 100644 index 2376181535a0..000000000000 --- a/Source/Shaders/Builtin/Functions/ellipsoidWgs84TextureCoordinates.js +++ /dev/null @@ -1,15 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_ellipsoidWgs84TextureCoordinates\n\ - * @glslFunction\n\ - */\n\ -vec2 czm_ellipsoidWgs84TextureCoordinates(vec3 normal)\n\ -{\n\ - return vec2(atan(normal.y, normal.x) * czm_oneOverTwoPi + 0.5, asin(normal.z) * czm_oneOverPi + 0.5);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/equalsEpsilon.js b/Source/Shaders/Builtin/Functions/equalsEpsilon.js deleted file mode 100644 index 0054e2bba9b8..000000000000 --- a/Source/Shaders/Builtin/Functions/equalsEpsilon.js +++ /dev/null @@ -1,41 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Compares left and right componentwise. Returns true\n\ - * if they are within epsilon and false otherwise. The inputs\n\ - * left and right can be floats, vec2s,\n\ - * vec3s, or vec4s.\n\ - *\n\ - * @name czm_equalsEpsilon\n\ - * @glslFunction\n\ - *\n\ - * @param {} left The first vector.\n\ - * @param {} right The second vector.\n\ - * @param {float} epsilon The epsilon to use for equality testing.\n\ - * @returns {bool} true if the components are within epsilon and false otherwise.\n\ - *\n\ - * @example\n\ - * // GLSL declarations\n\ - * bool czm_equalsEpsilon(float left, float right, float epsilon);\n\ - * bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon);\n\ - * bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon);\n\ - * bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon);\n\ - */\n\ -bool czm_equalsEpsilon(vec4 left, vec4 right, float epsilon) {\n\ - return all(lessThanEqual(abs(left - right), vec4(epsilon)));\n\ -}\n\ -\n\ -bool czm_equalsEpsilon(vec3 left, vec3 right, float epsilon) {\n\ - return all(lessThanEqual(abs(left - right), vec3(epsilon)));\n\ -}\n\ -\n\ -bool czm_equalsEpsilon(vec2 left, vec2 right, float epsilon) {\n\ - return all(lessThanEqual(abs(left - right), vec2(epsilon)));\n\ -}\n\ -\n\ -bool czm_equalsEpsilon(float left, float right, float epsilon) {\n\ - return (abs(left - right) <= epsilon);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eyeOffset.js b/Source/Shaders/Builtin/Functions/eyeOffset.js deleted file mode 100644 index 659f36a0a14e..000000000000 --- a/Source/Shaders/Builtin/Functions/eyeOffset.js +++ /dev/null @@ -1,25 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_eyeOffset\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} positionEC DOC_TBA.\n\ - * @param {vec3} eyeOffset DOC_TBA.\n\ - *\n\ - * @returns {vec4} DOC_TBA.\n\ - */\n\ -vec4 czm_eyeOffset(vec4 positionEC, vec3 eyeOffset)\n\ -{\n\ - // This equation is approximate in x and y.\n\ - vec4 p = positionEC;\n\ - vec4 zEyeOffset = normalize(p) * eyeOffset.z;\n\ - p.xy += eyeOffset.xy + zEyeOffset.xy;\n\ - p.z += zEyeOffset.z;\n\ - return p;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js b/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js deleted file mode 100644 index 25d01be42ad5..000000000000 --- a/Source/Shaders/Builtin/Functions/eyeToWindowCoordinates.js +++ /dev/null @@ -1,37 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Transforms a position from eye to window coordinates. The transformation\n\ - * from eye to clip coordinates is done using {@link czm_projection}.\n\ - * The transform from normalized device coordinates to window coordinates is\n\ - * done using {@link czm_viewportTransformation}, which assumes a depth range\n\ - * of near = 0 and far = 1.\n\ - *

\n\ - * This transform is useful when there is a need to manipulate window coordinates\n\ - * in a vertex shader as done by {@link BillboardCollection}.\n\ - *\n\ - * @name czm_eyeToWindowCoordinates\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} position The position in eye coordinates to transform.\n\ - *\n\ - * @returns {vec4} The transformed position in window coordinates.\n\ - *\n\ - * @see czm_modelToWindowCoordinates\n\ - * @see czm_projection\n\ - * @see czm_viewportTransformation\n\ - * @see BillboardCollection\n\ - *\n\ - * @example\n\ - * vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\ - */\n\ -vec4 czm_eyeToWindowCoordinates(vec4 positionEC)\n\ -{\n\ - vec4 q = czm_projection * positionEC; // clip coordinates\n\ - q.xyz /= q.w; // normalized device coordinates\n\ - q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\ - return q;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/fog.js b/Source/Shaders/Builtin/Functions/fog.js deleted file mode 100644 index 8c2d301c42d4..000000000000 --- a/Source/Shaders/Builtin/Functions/fog.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Gets the color with fog at a distance from the camera.\n\ - * \n\ - * @name czm_fog\n\ - * @glslFunction\n\ - * \n\ - * @param {float} distanceToCamera The distance to the camera in meters.\n\ - * @param {vec3} color The original color.\n\ - * @param {vec3} fogColor The color of the fog.\n\ - *\n\ - * @returns {vec3} The color adjusted for fog at the distance from the camera.\n\ - */\n\ -vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n\ -{\n\ - float scalar = distanceToCamera * czm_fogDensity;\n\ - float fog = 1.0 - exp(-(scalar * scalar));\n\ - \n\ - return mix(color, fogColor, fog);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js b/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js deleted file mode 100644 index c37b8bb2a1f7..000000000000 --- a/Source/Shaders/Builtin/Functions/geodeticSurfaceNormal.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_geodeticSurfaceNormal\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} positionOnEllipsoid DOC_TBA\n\ - * @param {vec3} ellipsoidCenter DOC_TBA\n\ - * @param {vec3} oneOverEllipsoidRadiiSquared DOC_TBA\n\ - * \n\ - * @returns {vec3} DOC_TBA.\n\ - */\n\ -vec3 czm_geodeticSurfaceNormal(vec3 positionOnEllipsoid, vec3 ellipsoidCenter, vec3 oneOverEllipsoidRadiiSquared)\n\ -{\n\ - return normalize((positionOnEllipsoid - ellipsoidCenter) * oneOverEllipsoidRadiiSquared);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getDefaultMaterial.js b/Source/Shaders/Builtin/Functions/getDefaultMaterial.js deleted file mode 100644 index 37d61baea142..000000000000 --- a/Source/Shaders/Builtin/Functions/getDefaultMaterial.js +++ /dev/null @@ -1,32 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * An czm_material with default values. Every material's czm_getMaterial\n\ - * should use this default material as a base for the material it returns.\n\ - * The default normal value is given by materialInput.normalEC.\n\ - *\n\ - * @name czm_getDefaultMaterial\n\ - * @glslFunction \n\ - *\n\ - * @param {czm_materialInput} input The input used to construct the default material.\n\ - * \n\ - * @returns {czm_material} The default material.\n\ - *\n\ - * @see czm_materialInput\n\ - * @see czm_material\n\ - * @see czm_getMaterial\n\ - */\n\ -czm_material czm_getDefaultMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material;\n\ - material.diffuse = vec3(0.0);\n\ - material.specular = 0.0;\n\ - material.shininess = 1.0;\n\ - material.normal = materialInput.normalEC;\n\ - material.emission = vec3(0.0);\n\ - material.alpha = 1.0;\n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getLambertDiffuse.js b/Source/Shaders/Builtin/Functions/getLambertDiffuse.js deleted file mode 100644 index 177dd415d913..000000000000 --- a/Source/Shaders/Builtin/Functions/getLambertDiffuse.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Calculates the intensity of diffusely reflected light.\n\ - *\n\ - * @name czm_getLambertDiffuse\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\ - * @param {vec3} normalEC The surface normal in eye coordinates.\n\ - *\n\ - * @returns {float} The intensity of the diffuse reflection.\n\ - *\n\ - * @see czm_phong\n\ - *\n\ - * @example\n\ - * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n\ - * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n\ - * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n\ - */\n\ -float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)\n\ -{\n\ - return max(dot(lightDirectionEC, normalEC), 0.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getSpecular.js b/Source/Shaders/Builtin/Functions/getSpecular.js deleted file mode 100644 index 6a7e200ca81a..000000000000 --- a/Source/Shaders/Builtin/Functions/getSpecular.js +++ /dev/null @@ -1,34 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Calculates the specular intensity of reflected light.\n\ - *\n\ - * @name czm_getSpecular\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.\n\ - * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.\n\ - * @param {vec3} normalEC The surface normal in eye coordinates.\n\ - * @param {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n\ - *\n\ - * @returns {float} The intensity of the specular highlight.\n\ - *\n\ - * @see czm_phong\n\ - *\n\ - * @example\n\ - * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);\n\ - * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);\n\ - * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);\n\ - */\n\ -float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)\n\ -{\n\ - vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);\n\ - float specular = max(dot(toReflectedLight, toEyeEC), 0.0);\n\ -\n\ - // pow has undefined behavior if both parameters <= 0.\n\ - // Prevent this by making sure shininess is at least czm_epsilon2.\n\ - return pow(specular, max(shininess, czm_epsilon2));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getWaterNoise.js b/Source/Shaders/Builtin/Functions/getWaterNoise.js deleted file mode 100644 index 428b4f05cfe1..000000000000 --- a/Source/Shaders/Builtin/Functions/getWaterNoise.js +++ /dev/null @@ -1,42 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @private\n\ - */\n\ -vec4 czm_getWaterNoise(sampler2D normalMap, vec2 uv, float time, float angleInRadians)\n\ -{\n\ - float cosAngle = cos(angleInRadians);\n\ - float sinAngle = sin(angleInRadians);\n\ -\n\ - // time dependent sampling directions\n\ - vec2 s0 = vec2(1.0/17.0, 0.0);\n\ - vec2 s1 = vec2(-1.0/29.0, 0.0);\n\ - vec2 s2 = vec2(1.0/101.0, 1.0/59.0);\n\ - vec2 s3 = vec2(-1.0/109.0, -1.0/57.0);\n\ -\n\ - // rotate sampling direction by specified angle\n\ - s0 = vec2((cosAngle * s0.x) - (sinAngle * s0.y), (sinAngle * s0.x) + (cosAngle * s0.y));\n\ - s1 = vec2((cosAngle * s1.x) - (sinAngle * s1.y), (sinAngle * s1.x) + (cosAngle * s1.y));\n\ - s2 = vec2((cosAngle * s2.x) - (sinAngle * s2.y), (sinAngle * s2.x) + (cosAngle * s2.y));\n\ - s3 = vec2((cosAngle * s3.x) - (sinAngle * s3.y), (sinAngle * s3.x) + (cosAngle * s3.y));\n\ -\n\ - vec2 uv0 = (uv/103.0) + (time * s0);\n\ - vec2 uv1 = uv/107.0 + (time * s1) + vec2(0.23);\n\ - vec2 uv2 = uv/vec2(897.0, 983.0) + (time * s2) + vec2(0.51);\n\ - vec2 uv3 = uv/vec2(991.0, 877.0) + (time * s3) + vec2(0.71);\n\ -\n\ - uv0 = fract(uv0);\n\ - uv1 = fract(uv1);\n\ - uv2 = fract(uv2);\n\ - uv3 = fract(uv3);\n\ - vec4 noise = (texture2D(normalMap, uv0)) +\n\ - (texture2D(normalMap, uv1)) +\n\ - (texture2D(normalMap, uv2)) +\n\ - (texture2D(normalMap, uv3));\n\ -\n\ - // average and scale to between -1 and 1\n\ - return ((noise / 4.0) - 0.5) * 2.0;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js b/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js deleted file mode 100644 index 7642c130c837..000000000000 --- a/Source/Shaders/Builtin/Functions/getWgs84EllipsoidEC.js +++ /dev/null @@ -1,26 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Returns the WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\ - *\n\ - * @name czm_getWgs84EllipsoidEC\n\ - * @glslFunction\n\ - *\n\ - * @returns {czm_ellipsoid} The WGS84 ellipsoid, with its center at the origin of world coordinates, in eye coordinates.\n\ - *\n\ - * @see Ellipsoid.WGS84\n\ - *\n\ - * @example\n\ - * czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n\ - */\n\ -czm_ellipsoid czm_getWgs84EllipsoidEC()\n\ -{\n\ - vec3 radii = vec3(6378137.0, 6378137.0, 6356752.314245);\n\ - vec3 inverseRadii = vec3(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z);\n\ - vec3 inverseRadiiSquared = inverseRadii * inverseRadii;\n\ - czm_ellipsoid temp = czm_ellipsoid(czm_view[3].xyz, radii, inverseRadii, inverseRadiiSquared);\n\ - return temp;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/hue.js b/Source/Shaders/Builtin/Functions/hue.js deleted file mode 100644 index 7e7205d718f4..000000000000 --- a/Source/Shaders/Builtin/Functions/hue.js +++ /dev/null @@ -1,35 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Adjusts the hue of a color.\n\ - * \n\ - * @name czm_hue\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color.\n\ - * @param {float} adjustment The amount to adjust the hue of the color in radians.\n\ - *\n\ - * @returns {float} The color with the hue adjusted.\n\ - *\n\ - * @example\n\ - * vec3 adjustHue = czm_hue(color, czm_pi); // The same as czm_hue(color, -czm_pi)\n\ - */\n\ -vec3 czm_hue(vec3 rgb, float adjustment)\n\ -{\n\ - const mat3 toYIQ = mat3(0.299, 0.587, 0.114,\n\ - 0.595716, -0.274453, -0.321263,\n\ - 0.211456, -0.522591, 0.311135);\n\ - const mat3 toRGB = mat3(1.0, 0.9563, 0.6210,\n\ - 1.0, -0.2721, -0.6474,\n\ - 1.0, -1.107, 1.7046);\n\ - \n\ - vec3 yiq = toYIQ * rgb;\n\ - float hue = atan(yiq.z, yiq.y) + adjustment;\n\ - float chroma = sqrt(yiq.z * yiq.z + yiq.y * yiq.y);\n\ - \n\ - vec3 color = vec3(yiq.x, chroma * cos(hue), chroma * sin(hue));\n\ - return toRGB * color;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/isEmpty.js b/Source/Shaders/Builtin/Functions/isEmpty.js deleted file mode 100644 index e04f0f3f4e45..000000000000 --- a/Source/Shaders/Builtin/Functions/isEmpty.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Determines if a time interval is empty.\n\ - *\n\ - * @name czm_isEmpty\n\ - * @glslFunction \n\ - * \n\ - * @param {czm_raySegment} interval The interval to test.\n\ - * \n\ - * @returns {bool} true if the time interval is empty; otherwise, false.\n\ - *\n\ - * @example\n\ - * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\ - * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\ - * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\ - */\n\ -bool czm_isEmpty(czm_raySegment interval)\n\ -{\n\ - return (interval.stop < 0.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/isFull.js b/Source/Shaders/Builtin/Functions/isFull.js deleted file mode 100644 index 22f66d76dd12..000000000000 --- a/Source/Shaders/Builtin/Functions/isFull.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Determines if a time interval is empty.\n\ - *\n\ - * @name czm_isFull\n\ - * @glslFunction \n\ - * \n\ - * @param {czm_raySegment} interval The interval to test.\n\ - * \n\ - * @returns {bool} true if the time interval is empty; otherwise, false.\n\ - *\n\ - * @example\n\ - * bool b0 = czm_isEmpty(czm_emptyRaySegment); // true\n\ - * bool b1 = czm_isEmpty(czm_raySegment(0.0, 1.0)); // false\n\ - * bool b2 = czm_isEmpty(czm_raySegment(1.0, 1.0)); // false, contains 1.0.\n\ - */\n\ -bool czm_isFull(czm_raySegment interval)\n\ -{\n\ - return (interval.start == 0.0 && interval.stop == czm_infinity);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js b/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js deleted file mode 100644 index 6f1726d7274f..000000000000 --- a/Source/Shaders/Builtin/Functions/latitudeToWebMercatorFraction.js +++ /dev/null @@ -1,26 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes the fraction of a Web Wercator rectangle at which a given geodetic latitude is located.\n\ - *\n\ - * @name czm_latitudeToWebMercatorFraction\n\ - * @glslFunction\n\ - *\n\ - * @param {float} latitude The geodetic latitude, in radians.\n\ - * @param {float} southMercatorY The Web Mercator coordinate of the southern boundary of the rectangle.\n\ - * @param {float} oneOverMercatorHeight The total height of the rectangle in Web Mercator coordinates.\n\ - *\n\ - * @returns {float} The fraction of the rectangle at which the latitude occurs. If the latitude is the southern\n\ - * boundary of the rectangle, the return value will be zero. If it is the northern boundary, the return\n\ - * value will be 1.0. Latitudes in between are mapped according to the Web Mercator projection.\n\ - */ \n\ -float czm_latitudeToWebMercatorFraction(float latitude, float southMercatorY, float oneOverMercatorHeight)\n\ -{\n\ - float sinLatitude = sin(latitude);\n\ - float mercatorY = 0.5 * log((1.0 + sinLatitude) / (1.0 - sinLatitude));\n\ - \n\ - return (mercatorY - southMercatorY) * oneOverMercatorHeight;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/luminance.js b/Source/Shaders/Builtin/Functions/luminance.js deleted file mode 100644 index ad97f79e06b1..000000000000 --- a/Source/Shaders/Builtin/Functions/luminance.js +++ /dev/null @@ -1,25 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes the luminance of a color. \n\ - *\n\ - * @name czm_luminance\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} rgb The color.\n\ - * \n\ - * @returns {float} The luminance.\n\ - *\n\ - * @example\n\ - * float light = czm_luminance(vec3(0.0)); // 0.0\n\ - * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n\ - */\n\ -float czm_luminance(vec3 rgb)\n\ -{\n\ - // Algorithm from Chapter 10 of Graphics Shaders.\n\ - const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ - return dot(rgb, W);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/metersPerPixel.js b/Source/Shaders/Builtin/Functions/metersPerPixel.js deleted file mode 100644 index f2b83ab861a7..000000000000 --- a/Source/Shaders/Builtin/Functions/metersPerPixel.js +++ /dev/null @@ -1,46 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes the size of a pixel in meters at a distance from the eye.\n\ -\n\ - * @name czm_metersPerPixel\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} positionEC The position to get the meters per pixel in eye coordinates.\n\ - *\n\ - * @returns {float} The meters per pixel at positionEC.\n\ - */\n\ -float czm_metersPerPixel(vec4 positionEC)\n\ -{\n\ - float width = czm_viewport.z;\n\ - float height = czm_viewport.w;\n\ - float pixelWidth;\n\ - float pixelHeight;\n\ -\n\ - float top = czm_frustumPlanes.x;\n\ - float bottom = czm_frustumPlanes.y;\n\ - float left = czm_frustumPlanes.z;\n\ - float right = czm_frustumPlanes.w;\n\ -\n\ - if (czm_sceneMode == czm_sceneMode2D || czm_orthographicIn3D == 1.0)\n\ - {\n\ - float frustumWidth = right - left;\n\ - float frustumHeight = top - bottom;\n\ - pixelWidth = frustumWidth / width;\n\ - pixelHeight = frustumHeight / height;\n\ - }\n\ - else\n\ - {\n\ - float distanceToPixel = -positionEC.z;\n\ - float inverseNear = 1.0 / czm_currentFrustum.x;\n\ - float tanTheta = top * inverseNear;\n\ - pixelHeight = 2.0 * distanceToPixel * tanTheta / height;\n\ - tanTheta = right * inverseNear;\n\ - pixelWidth = 2.0 * distanceToPixel * tanTheta / width;\n\ - }\n\ -\n\ - return max(pixelWidth, pixelHeight);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js b/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js deleted file mode 100644 index e144d63aa866..000000000000 --- a/Source/Shaders/Builtin/Functions/modelToWindowCoordinates.js +++ /dev/null @@ -1,42 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Transforms a position from model to window coordinates. The transformation\n\ - * from model to clip coordinates is done using {@link czm_modelViewProjection}.\n\ - * The transform from normalized device coordinates to window coordinates is\n\ - * done using {@link czm_viewportTransformation}, which assumes a depth range\n\ - * of near = 0 and far = 1.\n\ - *

\n\ - * This transform is useful when there is a need to manipulate window coordinates\n\ - * in a vertex shader as done by {@link BillboardCollection}.\n\ - *

\n\ - * This function should not be confused with {@link czm_viewportOrthographic},\n\ - * which is an orthographic projection matrix that transforms from window \n\ - * coordinates to clip coordinates.\n\ - *\n\ - * @name czm_modelToWindowCoordinates\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} position The position in model coordinates to transform.\n\ - *\n\ - * @returns {vec4} The transformed position in window coordinates.\n\ - *\n\ - * @see czm_eyeToWindowCoordinates\n\ - * @see czm_modelViewProjection\n\ - * @see czm_viewportTransformation\n\ - * @see czm_viewportOrthographic\n\ - * @see BillboardCollection\n\ - *\n\ - * @example\n\ - * vec4 positionWC = czm_modelToWindowCoordinates(positionMC);\n\ - */\n\ -vec4 czm_modelToWindowCoordinates(vec4 position)\n\ -{\n\ - vec4 q = czm_modelViewProjection * position; // clip coordinates\n\ - q.xyz /= q.w; // normalized device coordinates\n\ - q.xyz = (czm_viewportTransformation * vec4(q.xyz, 1.0)).xyz; // window coordinates\n\ - return q;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js b/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js deleted file mode 100644 index 3863912bee07..000000000000 --- a/Source/Shaders/Builtin/Functions/multiplyWithColorBalance.js +++ /dev/null @@ -1,23 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_multiplyWithColorBalance\n\ - * @glslFunction\n\ - */\n\ -vec3 czm_multiplyWithColorBalance(vec3 left, vec3 right)\n\ -{\n\ - // Algorithm from Chapter 10 of Graphics Shaders.\n\ - const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ - \n\ - vec3 target = left * right;\n\ - float leftLuminance = dot(left, W);\n\ - float rightLuminance = dot(right, W);\n\ - float targetLuminance = dot(target, W);\n\ - \n\ - return ((leftLuminance + rightLuminance) / (2.0 * targetLuminance)) * target;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/nearFarScalar.js b/Source/Shaders/Builtin/Functions/nearFarScalar.js deleted file mode 100644 index e0b760809a4e..000000000000 --- a/Source/Shaders/Builtin/Functions/nearFarScalar.js +++ /dev/null @@ -1,31 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes a value that scales with distance. The scaling is clamped at the near and\n\ - * far distances, and does not extrapolate. This function works with the\n\ - * {@link NearFarScalar} JavaScript class.\n\ - *\n\ - * @name czm_nearFarScalar\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).\n\ - * @param {float} cameraDistSq The square of the current distance from the camera.\n\ - *\n\ - * @returns {float} The value at this distance.\n\ - */\n\ -float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n\ -{\n\ - float valueAtMin = nearFarScalar.y;\n\ - float valueAtMax = nearFarScalar.w;\n\ - float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\n\ - float farDistanceSq = nearFarScalar.z * nearFarScalar.z;\n\ -\n\ - float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\n\ -\n\ - t = pow(clamp(t, 0.0, 1.0), 0.2);\n\ -\n\ - return mix(valueAtMin, valueAtMax, t);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/octDecode.js b/Source/Shaders/Builtin/Functions/octDecode.js deleted file mode 100644 index 71d471f642bc..000000000000 --- a/Source/Shaders/Builtin/Functions/octDecode.js +++ /dev/null @@ -1,88 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return " /**\n\ - * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n\ - * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ - * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ - *\n\ - * @name czm_octDecode\n\ - * @param {vec2} encoded The oct-encoded, unit-length vector\n\ - * @param {float} range The maximum value of the SNORM range. The encoded vector is stored in log2(rangeMax+1) bits.\n\ - * @returns {vec3} The decoded and normalized vector\n\ - */\n\ - vec3 czm_octDecode(vec2 encoded, float range)\n\ - {\n\ - if (encoded.x == 0.0 && encoded.y == 0.0) {\n\ - return vec3(0.0, 0.0, 0.0);\n\ - }\n\ -\n\ - encoded = encoded / range * 2.0 - 1.0;\n\ - vec3 v = vec3(encoded.x, encoded.y, 1.0 - abs(encoded.x) - abs(encoded.y));\n\ - if (v.z < 0.0)\n\ - {\n\ - v.xy = (1.0 - abs(v.yx)) * czm_signNotZero(v.xy);\n\ - }\n\ -\n\ - return normalize(v);\n\ - }\n\ -\n\ -/**\n\ - * Decodes a unit-length vector in 'oct' encoding to a normalized 3-component Cartesian vector.\n\ - * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ - * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ - *\n\ - * @name czm_octDecode\n\ - * @param {vec2} encoded The oct-encoded, unit-length vector\n\ - * @returns {vec3} The decoded and normalized vector\n\ - */\n\ - vec3 czm_octDecode(vec2 encoded)\n\ - {\n\ - return czm_octDecode(encoded, 255.0);\n\ - }\n\ -\n\ - /**\n\ - * Decodes a unit-length vector in 'oct' encoding packed into a floating-point number to a normalized 3-component Cartesian vector.\n\ - * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ - * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ - *\n\ - * @name czm_octDecode\n\ - * @param {float} encoded The oct-encoded, unit-length vector\n\ - * @returns {vec3} The decoded and normalized vector\n\ - */\n\ - vec3 czm_octDecode(float encoded)\n\ - {\n\ - float temp = encoded / 256.0;\n\ - float x = floor(temp);\n\ - float y = (temp - x) * 256.0;\n\ - return czm_octDecode(vec2(x, y));\n\ - }\n\ -\n\ -/**\n\ - * Decodes three unit-length vectors in 'oct' encoding packed into two floating-point numbers to normalized 3-component Cartesian vectors.\n\ - * The 'oct' encoding is described in \"A Survey of Efficient Representations of Independent Unit Vectors\",\n\ - * Cigolle et al 2014: http://jcgt.org/published/0003/02/01/\n\ - *\n\ - * @name czm_octDecode\n\ - * @param {vec2} encoded The packed oct-encoded, unit-length vectors.\n\ - * @param {vec3} vector1 One decoded and normalized vector.\n\ - * @param {vec3} vector2 One decoded and normalized vector.\n\ - * @param {vec3} vector3 One decoded and normalized vector.\n\ - */\n\ - void czm_octDecode(vec2 encoded, out vec3 vector1, out vec3 vector2, out vec3 vector3)\n\ - {\n\ - float temp = encoded.x / 65536.0;\n\ - float x = floor(temp);\n\ - float encodedFloat1 = (temp - x) * 65536.0;\n\ -\n\ - temp = encoded.y / 65536.0;\n\ - float y = floor(temp);\n\ - float encodedFloat2 = (temp - y) * 65536.0;\n\ -\n\ - vector1 = czm_octDecode(encodedFloat1);\n\ - vector2 = czm_octDecode(encodedFloat2);\n\ - vector3 = czm_octDecode(vec2(x, y));\n\ - }\n\ -\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/packDepth.js b/Source/Shaders/Builtin/Functions/packDepth.js deleted file mode 100644 index dbfb067a8a71..000000000000 --- a/Source/Shaders/Builtin/Functions/packDepth.js +++ /dev/null @@ -1,23 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Packs a depth value into a vec3 that can be represented by unsigned bytes.\n\ - *\n\ - * @name czm_packDepth\n\ - * @glslFunction\n\ - *\n\ - * @param {float} depth The floating-point depth.\n\ - * @returns {vec3} The packed depth.\n\ - */\n\ -vec4 czm_packDepth(float depth)\n\ -{\n\ - // See Aras Pranckevičius' post Encoding Floats to RGBA\n\ - // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\ - vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * depth;\n\ - enc = fract(enc);\n\ - enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n\ - return enc;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/phong.js b/Source/Shaders/Builtin/Functions/phong.js deleted file mode 100644 index aa4792b07d18..000000000000 --- a/Source/Shaders/Builtin/Functions/phong.js +++ /dev/null @@ -1,68 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "float czm_private_getLambertDiffuseOfMaterial(vec3 lightDirectionEC, czm_material material)\n\ -{\n\ - return czm_getLambertDiffuse(lightDirectionEC, material.normal);\n\ -}\n\ -\n\ -float czm_private_getSpecularOfMaterial(vec3 lightDirectionEC, vec3 toEyeEC, czm_material material)\n\ -{\n\ - return czm_getSpecular(lightDirectionEC, toEyeEC, material.normal, material.shininess);\n\ -}\n\ -\n\ -/**\n\ - * Computes a color using the Phong lighting model.\n\ - *\n\ - * @name czm_phong\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} toEye A normalized vector from the fragment to the eye in eye coordinates.\n\ - * @param {czm_material} material The fragment's material.\n\ - * \n\ - * @returns {vec4} The computed color.\n\ - * \n\ - * @example\n\ - * vec3 positionToEyeEC = // ...\n\ - * czm_material material = // ...\n\ - * gl_FragColor = czm_phong(normalize(positionToEyeEC), material);\n\ - *\n\ - * @see czm_getMaterial\n\ - */\n\ -vec4 czm_phong(vec3 toEye, czm_material material)\n\ -{\n\ - // Diffuse from directional light sources at eye (for top-down)\n\ - float diffuse = czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 0.0, 1.0), material);\n\ - if (czm_sceneMode == czm_sceneMode3D) {\n\ - // (and horizon views in 3D)\n\ - diffuse += czm_private_getLambertDiffuseOfMaterial(vec3(0.0, 1.0, 0.0), material);\n\ - }\n\ -\n\ - // Specular from sun and pseudo-moon\n\ - float specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material) + czm_private_getSpecularOfMaterial(czm_moonDirectionEC, toEye, material);\n\ -\n\ - // Temporary workaround for adding ambient.\n\ - vec3 materialDiffuse = material.diffuse * 0.5;\n\ - \n\ - vec3 ambient = materialDiffuse;\n\ - vec3 color = ambient + material.emission;\n\ - color += materialDiffuse * diffuse;\n\ - color += material.specular * specular;\n\ -\n\ - return vec4(color, material.alpha);\n\ -}\n\ -\n\ -vec4 czm_private_phong(vec3 toEye, czm_material material)\n\ -{\n\ - float diffuse = czm_private_getLambertDiffuseOfMaterial(czm_sunDirectionEC, material);\n\ - float specular = czm_private_getSpecularOfMaterial(czm_sunDirectionEC, toEye, material);\n\ -\n\ - vec3 ambient = vec3(0.0);\n\ - vec3 color = ambient + material.emission;\n\ - color += material.diffuse * diffuse;\n\ - color += material.specular * specular;\n\ -\n\ - return vec4(color, material.alpha);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/pointAlongRay.js b/Source/Shaders/Builtin/Functions/pointAlongRay.js deleted file mode 100644 index 66a1f2b4c4b6..000000000000 --- a/Source/Shaders/Builtin/Functions/pointAlongRay.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Computes the point along a ray at the given time. time can be positive, negative, or zero.\n\ - *\n\ - * @name czm_pointAlongRay\n\ - * @glslFunction\n\ - *\n\ - * @param {czm_ray} ray The ray to compute the point along.\n\ - * @param {float} time The time along the ray.\n\ - * \n\ - * @returns {vec3} The point along the ray at the given time.\n\ - * \n\ - * @example\n\ - * czm_ray ray = czm_ray(vec3(0.0), vec3(1.0, 0.0, 0.0)); // origin, direction\n\ - * vec3 v = czm_pointAlongRay(ray, 2.0); // (2.0, 0.0, 0.0)\n\ - */\n\ -vec3 czm_pointAlongRay(czm_ray ray, float time)\n\ -{\n\ - return ray.origin + (time * ray.direction);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js b/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js deleted file mode 100644 index fc161c529310..000000000000 --- a/Source/Shaders/Builtin/Functions/rayEllipsoidIntersectionInterval.js +++ /dev/null @@ -1,88 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_rayEllipsoidIntersectionInterval\n\ - * @glslFunction\n\ - */\n\ -czm_raySegment czm_rayEllipsoidIntersectionInterval(czm_ray ray, czm_ellipsoid ellipsoid)\n\ -{\n\ - // ray and ellipsoid center in eye coordinates. radii in model coordinates.\n\ - vec3 q = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.origin, 1.0)).xyz;\n\ - vec3 w = ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ray.direction, 0.0)).xyz;\n\ - \n\ - q = q - ellipsoid.inverseRadii * (czm_inverseModelView * vec4(ellipsoid.center, 1.0)).xyz;\n\ - \n\ - float q2 = dot(q, q);\n\ - float qw = dot(q, w);\n\ - \n\ - if (q2 > 1.0) // Outside ellipsoid.\n\ - {\n\ - if (qw >= 0.0) // Looking outward or tangent (0 intersections).\n\ - {\n\ - return czm_emptyRaySegment;\n\ - }\n\ - else // qw < 0.0.\n\ - {\n\ - float qw2 = qw * qw;\n\ - float difference = q2 - 1.0; // Positively valued.\n\ - float w2 = dot(w, w);\n\ - float product = w2 * difference;\n\ - \n\ - if (qw2 < product) // Imaginary roots (0 intersections).\n\ - {\n\ - return czm_emptyRaySegment; \n\ - } \n\ - else if (qw2 > product) // Distinct roots (2 intersections).\n\ - {\n\ - float discriminant = qw * qw - product;\n\ - float temp = -qw + sqrt(discriminant); // Avoid cancellation.\n\ - float root0 = temp / w2;\n\ - float root1 = difference / temp;\n\ - if (root0 < root1)\n\ - {\n\ - czm_raySegment i = czm_raySegment(root0, root1);\n\ - return i;\n\ - }\n\ - else\n\ - {\n\ - czm_raySegment i = czm_raySegment(root1, root0);\n\ - return i;\n\ - }\n\ - }\n\ - else // qw2 == product. Repeated roots (2 intersections).\n\ - {\n\ - float root = sqrt(difference / w2);\n\ - czm_raySegment i = czm_raySegment(root, root);\n\ - return i;\n\ - }\n\ - }\n\ - }\n\ - else if (q2 < 1.0) // Inside ellipsoid (2 intersections).\n\ - {\n\ - float difference = q2 - 1.0; // Negatively valued.\n\ - float w2 = dot(w, w);\n\ - float product = w2 * difference; // Negatively valued.\n\ - float discriminant = qw * qw - product;\n\ - float temp = -qw + sqrt(discriminant); // Positively valued.\n\ - czm_raySegment i = czm_raySegment(0.0, temp / w2);\n\ - return i;\n\ - }\n\ - else // q2 == 1.0. On ellipsoid.\n\ - {\n\ - if (qw < 0.0) // Looking inward.\n\ - {\n\ - float w2 = dot(w, w);\n\ - czm_raySegment i = czm_raySegment(0.0, -qw / w2);\n\ - return i;\n\ - }\n\ - else // qw >= 0.0. Looking outward or tangent.\n\ - {\n\ - return czm_emptyRaySegment;\n\ - }\n\ - }\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/reverseLogDepth.js b/Source/Shaders/Builtin/Functions/reverseLogDepth.js deleted file mode 100644 index de7adc57380c..000000000000 --- a/Source/Shaders/Builtin/Functions/reverseLogDepth.js +++ /dev/null @@ -1,15 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "float czm_reverseLogDepth(float logZ)\n\ -{\n\ -#ifdef LOG_DEPTH\n\ - float near = czm_currentFrustum.x;\n\ - float far = czm_currentFrustum.y;\n\ - logZ = pow(2.0, logZ * log2(far + 1.0)) - 1.0;\n\ - logZ = far * (1.0 - near / logZ) / (far - near);\n\ -#endif\n\ - return logZ;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/saturation.js b/Source/Shaders/Builtin/Functions/saturation.js deleted file mode 100644 index 8038914bc860..000000000000 --- a/Source/Shaders/Builtin/Functions/saturation.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Adjusts the saturation of a color.\n\ - * \n\ - * @name czm_saturation\n\ - * @glslFunction\n\ - * \n\ - * @param {vec3} rgb The color.\n\ - * @param {float} adjustment The amount to adjust the saturation of the color.\n\ - *\n\ - * @returns {float} The color with the saturation adjusted.\n\ - *\n\ - * @example\n\ - * vec3 greyScale = czm_saturation(color, 0.0);\n\ - * vec3 doubleSaturation = czm_saturation(color, 2.0);\n\ - */\n\ -vec3 czm_saturation(vec3 rgb, float adjustment)\n\ -{\n\ - // Algorithm from Chapter 16 of OpenGL Shading Language\n\ - const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\ - vec3 intensity = vec3(dot(rgb, W));\n\ - return mix(intensity, rgb, adjustment);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/shadowDepthCompare.js b/Source/Shaders/Builtin/Functions/shadowDepthCompare.js deleted file mode 100644 index 74ebb47d707f..000000000000 --- a/Source/Shaders/Builtin/Functions/shadowDepthCompare.js +++ /dev/null @@ -1,29 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -float czm_sampleShadowMap(samplerCube shadowMap, vec3 d)\n\ -{\n\ - return czm_unpackDepth(textureCube(shadowMap, d));\n\ -}\n\ -\n\ -float czm_sampleShadowMap(sampler2D shadowMap, vec2 uv)\n\ -{\n\ -#ifdef USE_SHADOW_DEPTH_TEXTURE\n\ - return texture2D(shadowMap, uv).r;\n\ -#else\n\ - return czm_unpackDepth(texture2D(shadowMap, uv));\n\ -#endif\n\ -}\n\ -\n\ -float czm_shadowDepthCompare(samplerCube shadowMap, vec3 uv, float depth)\n\ -{\n\ - return step(depth, czm_sampleShadowMap(shadowMap, uv));\n\ -}\n\ -\n\ -float czm_shadowDepthCompare(sampler2D shadowMap, vec2 uv, float depth)\n\ -{\n\ - return step(depth, czm_sampleShadowMap(shadowMap, uv));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/shadowVisibility.js b/Source/Shaders/Builtin/Functions/shadowVisibility.js deleted file mode 100644 index ffb127de11a5..000000000000 --- a/Source/Shaders/Builtin/Functions/shadowVisibility.js +++ /dev/null @@ -1,71 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "\n\ -float czm_private_shadowVisibility(float visibility, float nDotL, float normalShadingSmooth, float darkness)\n\ -{\n\ -#ifdef USE_NORMAL_SHADING\n\ -#ifdef USE_NORMAL_SHADING_SMOOTH\n\ - float strength = clamp(nDotL / normalShadingSmooth, 0.0, 1.0);\n\ -#else\n\ - float strength = step(0.0, nDotL);\n\ -#endif\n\ - visibility *= strength;\n\ -#endif\n\ -\n\ - visibility = max(visibility, darkness);\n\ - return visibility;\n\ -}\n\ -\n\ -#ifdef USE_CUBE_MAP_SHADOW\n\ -float czm_shadowVisibility(samplerCube shadowMap, czm_shadowParameters shadowParameters)\n\ -{\n\ - float depthBias = shadowParameters.depthBias;\n\ - float depth = shadowParameters.depth;\n\ - float nDotL = shadowParameters.nDotL;\n\ - float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n\ - float darkness = shadowParameters.darkness;\n\ - vec3 uvw = shadowParameters.texCoords;\n\ -\n\ - depth -= depthBias;\n\ - float visibility = czm_shadowDepthCompare(shadowMap, uvw, depth);\n\ - return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n\ -}\n\ -#else\n\ -float czm_shadowVisibility(sampler2D shadowMap, czm_shadowParameters shadowParameters)\n\ -{\n\ - float depthBias = shadowParameters.depthBias;\n\ - float depth = shadowParameters.depth;\n\ - float nDotL = shadowParameters.nDotL;\n\ - float normalShadingSmooth = shadowParameters.normalShadingSmooth;\n\ - float darkness = shadowParameters.darkness;\n\ - vec2 uv = shadowParameters.texCoords;\n\ -\n\ - depth -= depthBias;\n\ -#ifdef USE_SOFT_SHADOWS\n\ - vec2 texelStepSize = shadowParameters.texelStepSize;\n\ - float radius = 1.0;\n\ - float dx0 = -texelStepSize.x * radius;\n\ - float dy0 = -texelStepSize.y * radius;\n\ - float dx1 = texelStepSize.x * radius;\n\ - float dy1 = texelStepSize.y * radius;\n\ - float visibility = (\n\ - czm_shadowDepthCompare(shadowMap, uv, depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy0), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy0), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy0), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, 0.0), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, 0.0), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx0, dy1), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(0.0, dy1), depth) +\n\ - czm_shadowDepthCompare(shadowMap, uv + vec2(dx1, dy1), depth)\n\ - ) * (1.0 / 9.0);\n\ -#else\n\ - float visibility = czm_shadowDepthCompare(shadowMap, uv, depth);\n\ -#endif\n\ -\n\ - return czm_private_shadowVisibility(visibility, nDotL, normalShadingSmooth, darkness);\n\ -}\n\ -#endif\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/signNotZero.js b/Source/Shaders/Builtin/Functions/signNotZero.js deleted file mode 100644 index 6cb65a1ff770..000000000000 --- a/Source/Shaders/Builtin/Functions/signNotZero.js +++ /dev/null @@ -1,34 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Returns 1.0 if the given value is positive or zero, and -1.0 if it is negative. This is similar to the GLSL\n\ - * built-in function sign except that returns 1.0 instead of 0.0 when the input value is 0.0.\n\ - * \n\ - * @name czm_signNotZero\n\ - * @glslFunction\n\ - *\n\ - * @param {} value The value for which to determine the sign.\n\ - * @returns {} 1.0 if the value is positive or zero, -1.0 if the value is negative.\n\ - */\n\ -float czm_signNotZero(float value)\n\ -{\n\ - return value >= 0.0 ? 1.0 : -1.0;\n\ -}\n\ -\n\ -vec2 czm_signNotZero(vec2 value)\n\ -{\n\ - return vec2(czm_signNotZero(value.x), czm_signNotZero(value.y));\n\ -}\n\ -\n\ -vec3 czm_signNotZero(vec3 value)\n\ -{\n\ - return vec3(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z));\n\ -}\n\ -\n\ -vec4 czm_signNotZero(vec4 value)\n\ -{\n\ - return vec4(czm_signNotZero(value.x), czm_signNotZero(value.y), czm_signNotZero(value.z), czm_signNotZero(value.w));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js b/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js deleted file mode 100644 index 93b822ef1e8b..000000000000 --- a/Source/Shaders/Builtin/Functions/tangentToEyeSpaceMatrix.js +++ /dev/null @@ -1,30 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Creates a matrix that transforms vectors from tangent space to eye space.\n\ - *\n\ - * @name czm_tangentToEyeSpaceMatrix\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} normalEC The normal vector in eye coordinates.\n\ - * @param {vec3} tangentEC The tangent vector in eye coordinates.\n\ - * @param {vec3} bitangentEC The bitangent vector in eye coordinates.\n\ - *\n\ - * @returns {mat3} The matrix that transforms from tangent space to eye space.\n\ - *\n\ - * @example\n\ - * mat3 tangentToEye = czm_tangentToEyeSpaceMatrix(normalEC, tangentEC, bitangentEC);\n\ - * vec3 normal = tangentToEye * texture2D(normalMap, st).xyz;\n\ - */\n\ -mat3 czm_tangentToEyeSpaceMatrix(vec3 normalEC, vec3 tangentEC, vec3 bitangentEC)\n\ -{\n\ - vec3 normal = normalize(normalEC);\n\ - vec3 tangent = normalize(tangentEC);\n\ - vec3 bitangent = normalize(bitangentEC);\n\ - return mat3(tangent.x , tangent.y , tangent.z,\n\ - bitangent.x, bitangent.y, bitangent.z,\n\ - normal.x , normal.y , normal.z);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/transformPlane.js b/Source/Shaders/Builtin/Functions/transformPlane.js deleted file mode 100644 index 1887002091a2..000000000000 --- a/Source/Shaders/Builtin/Functions/transformPlane.js +++ /dev/null @@ -1,13 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "vec4 czm_transformPlane(vec4 clippingPlane, mat4 transform) {\n\ - vec3 transformedDirection = normalize((transform * vec4(clippingPlane.xyz, 0.0)).xyz);\n\ - vec3 transformedPosition = (transform * vec4(clippingPlane.xyz * -clippingPlane.w, 1.0)).xyz;\n\ - vec4 transformedPlane;\n\ - transformedPlane.xyz = transformedDirection;\n\ - transformedPlane.w = -dot(transformedDirection, transformedPosition);\n\ - return transformedPlane;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/translateRelativeToEye.js b/Source/Shaders/Builtin/Functions/translateRelativeToEye.js deleted file mode 100644 index 035b3fb92df0..000000000000 --- a/Source/Shaders/Builtin/Functions/translateRelativeToEye.js +++ /dev/null @@ -1,45 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Translates a position (or any vec3) that was encoded with {@link EncodedCartesian3},\n\ - * and then provided to the shader as separate high and low bits to\n\ - * be relative to the eye. As shown in the example, the position can then be transformed in eye\n\ - * or clip coordinates using {@link czm_modelViewRelativeToEye} or {@link czm_modelViewProjectionRelativeToEye},\n\ - * respectively.\n\ - *

\n\ - * This technique, called GPU RTE, eliminates jittering artifacts when using large coordinates as\n\ - * described in {@link http://blogs.agi.com/insight3d/index.php/2008/09/03/precisions-precisions/|Precisions, Precisions}.\n\ - *

\n\ - *\n\ - * @name czm_translateRelativeToEye\n\ - * @glslFunction\n\ - *\n\ - * @param {vec3} high The position's high bits.\n\ - * @param {vec3} low The position's low bits.\n\ - * @returns {vec3} The position translated to be relative to the camera's position.\n\ - *\n\ - * @example\n\ - * attribute vec3 positionHigh;\n\ - * attribute vec3 positionLow;\n\ - * \n\ - * void main() \n\ - * {\n\ - * vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ - * gl_Position = czm_modelViewProjectionRelativeToEye * p;\n\ - * }\n\ - *\n\ - * @see czm_modelViewRelativeToEye\n\ - * @see czm_modelViewProjectionRelativeToEye\n\ - * @see czm_computePosition\n\ - * @see EncodedCartesian3\n\ - */\n\ -vec4 czm_translateRelativeToEye(vec3 high, vec3 low)\n\ -{\n\ - vec3 highDifference = high - czm_encodedCameraPositionMCHigh;\n\ - vec3 lowDifference = low - czm_encodedCameraPositionMCLow;\n\ -\n\ - return vec4(highDifference + lowDifference, 1.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/translucentPhong.js b/Source/Shaders/Builtin/Functions/translucentPhong.js deleted file mode 100644 index ed4c084d10f7..000000000000 --- a/Source/Shaders/Builtin/Functions/translucentPhong.js +++ /dev/null @@ -1,34 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @private\n\ - */\n\ -vec4 czm_translucentPhong(vec3 toEye, czm_material material)\n\ -{\n\ - // Diffuse from directional light sources at eye (for top-down and horizon views)\n\ - float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\n\ - \n\ - if (czm_sceneMode == czm_sceneMode3D) {\n\ - // (and horizon views in 3D)\n\ - diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n\ - }\n\ - \n\ - diffuse = clamp(diffuse, 0.0, 1.0);\n\ -\n\ - // Specular from sun and pseudo-moon\n\ - float specular = czm_getSpecular(czm_sunDirectionEC, toEye, material.normal, material.shininess);\n\ - specular += czm_getSpecular(czm_moonDirectionEC, toEye, material.normal, material.shininess);\n\ -\n\ - // Temporary workaround for adding ambient.\n\ - vec3 materialDiffuse = material.diffuse * 0.5;\n\ -\n\ - vec3 ambient = materialDiffuse;\n\ - vec3 color = ambient + material.emission;\n\ - color += materialDiffuse * diffuse;\n\ - color += material.specular * specular;\n\ -\n\ - return vec4(color, material.alpha);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/transpose.js b/Source/Shaders/Builtin/Functions/transpose.js deleted file mode 100644 index 87324772c206..000000000000 --- a/Source/Shaders/Builtin/Functions/transpose.js +++ /dev/null @@ -1,50 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Returns the transpose of the matrix. The input matrix can be\n\ - * a mat2, mat3, or mat4.\n\ - *\n\ - * @name czm_transpose\n\ - * @glslFunction\n\ - *\n\ - * @param {} matrix The matrix to transpose.\n\ - *\n\ - * @returns {} The transposed matrix.\n\ - *\n\ - * @example\n\ - * // GLSL declarations\n\ - * mat2 czm_transpose(mat2 matrix);\n\ - * mat3 czm_transpose(mat3 matrix);\n\ - * mat4 czm_transpose(mat4 matrix);\n\ - *\n\ - * // Transpose a 3x3 rotation matrix to find its inverse.\n\ - * mat3 eastNorthUpToEye = czm_eastNorthUpToEyeCoordinates(\n\ - * positionMC, normalEC);\n\ - * mat3 eyeToEastNorthUp = czm_transpose(eastNorthUpToEye);\n\ - */\n\ -mat2 czm_transpose(mat2 matrix)\n\ -{\n\ - return mat2(\n\ - matrix[0][0], matrix[1][0],\n\ - matrix[0][1], matrix[1][1]);\n\ -}\n\ -\n\ -mat3 czm_transpose(mat3 matrix)\n\ -{\n\ - return mat3(\n\ - matrix[0][0], matrix[1][0], matrix[2][0],\n\ - matrix[0][1], matrix[1][1], matrix[2][1],\n\ - matrix[0][2], matrix[1][2], matrix[2][2]);\n\ -}\n\ -\n\ -mat4 czm_transpose(mat4 matrix)\n\ -{\n\ - return mat4(\n\ - matrix[0][0], matrix[1][0], matrix[2][0], matrix[3][0],\n\ - matrix[0][1], matrix[1][1], matrix[2][1], matrix[3][1],\n\ - matrix[0][2], matrix[1][2], matrix[2][2], matrix[3][2],\n\ - matrix[0][3], matrix[1][3], matrix[2][3], matrix[3][3]);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/unpackDepth.js b/Source/Shaders/Builtin/Functions/unpackDepth.js deleted file mode 100644 index de547a800149..000000000000 --- a/Source/Shaders/Builtin/Functions/unpackDepth.js +++ /dev/null @@ -1,21 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Unpacks a vec4 depth value to a float in [0, 1) range.\n\ - *\n\ - * @name czm_unpackDepth\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} packedDepth The packed depth.\n\ - *\n\ - * @returns {float} The floating-point depth in [0, 1) range.\n\ - */\n\ - float czm_unpackDepth(vec4 packedDepth)\n\ - {\n\ - // See Aras Pranckevičius' post Encoding Floats to RGBA\n\ - // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\ - return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n\ - }\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/unpackFloat.js b/Source/Shaders/Builtin/Functions/unpackFloat.js deleted file mode 100644 index 94a5b8bb32dc..000000000000 --- a/Source/Shaders/Builtin/Functions/unpackFloat.js +++ /dev/null @@ -1,35 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#define SHIFT_RIGHT_8 0.00390625 //1.0 / 256.0\n\ -#define SHIFT_RIGHT_16 0.00001525878 //1.0 / 65536.0\n\ -#define SHIFT_RIGHT_24 5.960464477539063e-8//1.0 / 16777216.0\n\ -\n\ -#define BIAS 38.0\n\ -\n\ -/**\n\ - * Unpacks a vec4 value containing values expressable as uint8 to an arbitrary float.\n\ - *\n\ - * @name czm_unpackFloat\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} packedFloat The packed float.\n\ - *\n\ - * @returns {float} The floating-point depth in arbitrary range.\n\ - */\n\ - float czm_unpackFloat(vec4 packedFloat)\n\ -{\n\ - packedFloat *= 255.0;\n\ - float temp = packedFloat.w / 2.0;\n\ - float exponent = floor(temp);\n\ - float sign = (temp - exponent) * 2.0;\n\ - exponent = exponent - float(BIAS);\n\ - sign = sign * 2.0 - 1.0;\n\ - sign = -sign;\n\ - float unpacked = sign * packedFloat.x * float(SHIFT_RIGHT_8);\n\ - unpacked += sign * packedFloat.y * float(SHIFT_RIGHT_16);\n\ - unpacked += sign * packedFloat.z * float(SHIFT_RIGHT_24);\n\ - return unpacked * pow(10.0, exponent);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/vertexLogDepth.js b/Source/Shaders/Builtin/Functions/vertexLogDepth.js deleted file mode 100644 index 50d0d669c79b..000000000000 --- a/Source/Shaders/Builtin/Functions/vertexLogDepth.js +++ /dev/null @@ -1,54 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef LOG_DEPTH\n\ -varying float v_logZ;\n\ -varying vec3 v_logPositionEC;\n\ -#endif\n\ -\n\ -void czm_updatePositionDepth() {\n\ -#if defined(LOG_DEPTH) && !defined(DISABLE_GL_POSITION_LOG_DEPTH)\n\ - v_logPositionEC = (czm_inverseProjection * gl_Position).xyz;\n\ -\n\ - gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * czm_logFarDistance - 1.0;\n\ - gl_Position.z *= gl_Position.w;\n\ -#endif\n\ -}\n\ -\n\ -/**\n\ - * Writes the logarithmic depth to gl_Position using the already computed gl_Position.\n\ - *\n\ - * @name czm_vertexLogDepth\n\ - * @glslFunction\n\ - */\n\ -void czm_vertexLogDepth()\n\ -{\n\ -#ifdef LOG_DEPTH\n\ - v_logZ = 1.0 + gl_Position.w;\n\ - czm_updatePositionDepth();\n\ -#endif\n\ -}\n\ -\n\ -/**\n\ - * Writes the logarithmic depth to gl_Position using the provided clip coordinates.\n\ - *

\n\ - * An example use case for this function would be moving the vertex in window coordinates\n\ - * before converting back to clip coordinates. Use the original vertex clip coordinates.\n\ - *

\n\ - * @name czm_vertexLogDepth\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} clipCoords The vertex in clip coordinates.\n\ - *\n\ - * @example\n\ - * czm_vertexLogDepth(czm_projection * vec4(positionEyeCoordinates, 1.0));\n\ - */\n\ -void czm_vertexLogDepth(vec4 clipCoords)\n\ -{\n\ -#ifdef LOG_DEPTH\n\ - v_logZ = 1.0 + clipCoords.w;\n\ - czm_updatePositionDepth();\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js b/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js deleted file mode 100644 index f26f76b72480..000000000000 --- a/Source/Shaders/Builtin/Functions/windowToEyeCoordinates.js +++ /dev/null @@ -1,60 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Transforms a position from window to eye coordinates.\n\ - * The transform from window to normalized device coordinates is done using components\n\ - * of (@link czm_viewport} and {@link czm_viewportTransformation} instead of calculating\n\ - * the inverse of czm_viewportTransformation. The transformation from\n\ - * normalized device coordinates to clip coordinates is done using positionWC.w,\n\ - * which is expected to be the scalar used in the perspective divide. The transformation\n\ - * from clip to eye coordinates is done using {@link czm_inverseProjection}.\n\ - *\n\ - * @name czm_windowToEyeCoordinates\n\ - * @glslFunction\n\ - *\n\ - * @param {vec4} fragmentCoordinate The position in window coordinates to transform.\n\ - *\n\ - * @returns {vec4} The transformed position in eye coordinates.\n\ - *\n\ - * @see czm_modelToWindowCoordinates\n\ - * @see czm_eyeToWindowCoordinates\n\ - * @see czm_inverseProjection\n\ - * @see czm_viewport\n\ - * @see czm_viewportTransformation\n\ - *\n\ - * @example\n\ - * vec4 positionEC = czm_windowToEyeCoordinates(gl_FragCoord);\n\ - */\n\ -vec4 czm_windowToEyeCoordinates(vec4 fragmentCoordinate)\n\ -{\n\ - float x = 2.0 * (fragmentCoordinate.x - czm_viewport.x) / czm_viewport.z - 1.0;\n\ - float y = 2.0 * (fragmentCoordinate.y - czm_viewport.y) / czm_viewport.w - 1.0;\n\ - float z = (fragmentCoordinate.z - czm_viewportTransformation[3][2]) / czm_viewportTransformation[2][2];\n\ - vec4 q = vec4(x, y, z, 1.0);\n\ - q /= fragmentCoordinate.w;\n\ -\n\ - if (!(czm_inverseProjection == mat4(0.0))) // IE and Edge sometimes do something weird with != between mat4s\n\ - {\n\ - q = czm_inverseProjection * q;\n\ - }\n\ - else\n\ - {\n\ - float top = czm_frustumPlanes.x;\n\ - float bottom = czm_frustumPlanes.y;\n\ - float left = czm_frustumPlanes.z;\n\ - float right = czm_frustumPlanes.w;\n\ -\n\ - float near = czm_currentFrustum.x;\n\ - float far = czm_currentFrustum.y;\n\ -\n\ - q.x = (q.x * (right - left) + left + right) * 0.5;\n\ - q.y = (q.y * (top - bottom) + bottom + top) * 0.5;\n\ - q.z = (q.z * (near - far) - near - far) * 0.5;\n\ - q.w = 1.0;\n\ - }\n\ -\n\ - return q;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js b/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js deleted file mode 100644 index 53550a9bd13c..000000000000 --- a/Source/Shaders/Builtin/Functions/writeDepthClampedToFarPlane.js +++ /dev/null @@ -1,30 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "// emulated noperspective\n\ -#ifndef LOG_DEPTH\n\ -varying float v_WindowZ;\n\ -#endif\n\ -/**\n\ - * Clamps a vertex to the far plane by writing the fragments depth.\n\ - *

\n\ - * The shader must enable the GL_EXT_frag_depth extension.\n\ - *

\n\ - *\n\ - * @name czm_writeDepthClampedToFarPlane\n\ - * @glslFunction\n\ - *\n\ - * @example\n\ - * gl_FragColor = color;\n\ - * czm_writeDepthClampedToFarPlane();\n\ - *\n\ - * @see czm_depthClampFarPlane\n\ - */\n\ -void czm_writeDepthClampedToFarPlane()\n\ -{\n\ -#if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n\ - gl_FragDepthEXT = min(v_WindowZ * gl_FragCoord.w, 1.0);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Functions/writeLogDepth.js b/Source/Shaders/Builtin/Functions/writeLogDepth.js deleted file mode 100644 index 3bc03e2957dd..000000000000 --- a/Source/Shaders/Builtin/Functions/writeLogDepth.js +++ /dev/null @@ -1,49 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef LOG_DEPTH\n\ -varying float v_logZ;\n\ -#endif\n\ -\n\ -/**\n\ - * Writes the fragment depth to the logarithmic depth buffer.\n\ - *

\n\ - * Use this when the vertex shader does not calls {@link czm_vertexlogDepth}, for example, when\n\ - * ray-casting geometry using a full screen quad.\n\ - *

\n\ - * @name czm_writeLogDepth\n\ - * @glslFunction\n\ - *\n\ - * @param {float} logZ The w coordinate of the vertex in clip coordinates plus 1.0.\n\ - *\n\ - * @example\n\ - * czm_writeLogDepth((czm_projection * v_positionEyeCoordinates).w + 1.0);\n\ - */\n\ -void czm_writeLogDepth(float logZ)\n\ -{\n\ -#if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE)\n\ - float halfLogFarDistance = czm_logFarDistance * 0.5;\n\ - float depth = log2(logZ);\n\ - if (depth < log2(czm_currentFrustum.x)) {\n\ - discard;\n\ - }\n\ - gl_FragDepthEXT = depth * halfLogFarDistance;\n\ -#endif\n\ -}\n\ -\n\ -/**\n\ - * Writes the fragment depth to the logarithmic depth buffer.\n\ - *

\n\ - * Use this when the vertex shader calls {@link czm_vertexlogDepth}.\n\ - *

\n\ - *\n\ - * @name czm_writeLogDepth\n\ - * @glslFunction\n\ - */\n\ -void czm_writeLogDepth() {\n\ -#ifdef LOG_DEPTH\n\ - czm_writeLogDepth(v_logZ);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/depthRangeStruct.js b/Source/Shaders/Builtin/Structs/depthRangeStruct.js deleted file mode 100644 index 2eba4ddf5b30..000000000000 --- a/Source/Shaders/Builtin/Structs/depthRangeStruct.js +++ /dev/null @@ -1,14 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @name czm_depthRangeStruct\n\ - * @glslStruct\n\ - */\n\ -struct czm_depthRangeStruct\n\ -{\n\ - float near;\n\ - float far;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/ellipsoid.js b/Source/Shaders/Builtin/Structs/ellipsoid.js deleted file mode 100644 index 1c5ea91d80be..000000000000 --- a/Source/Shaders/Builtin/Structs/ellipsoid.js +++ /dev/null @@ -1,17 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/** DOC_TBA\n\ - *\n\ - * @name czm_ellipsoid\n\ - * @glslStruct\n\ - */\n\ -struct czm_ellipsoid\n\ -{\n\ - vec3 center;\n\ - vec3 radii;\n\ - vec3 inverseRadii;\n\ - vec3 inverseRadiiSquared;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/material.js b/Source/Shaders/Builtin/Structs/material.js deleted file mode 100644 index bc5c73d9fe22..000000000000 --- a/Source/Shaders/Builtin/Structs/material.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Holds material information that can be used for lighting. Returned by all czm_getMaterial functions.\n\ - *\n\ - * @name czm_material\n\ - * @glslStruct\n\ - *\n\ - * @property {vec3} diffuse Incoming light that scatters evenly in all directions.\n\ - * @property {float} specular Intensity of incoming light reflecting in a single direction.\n\ - * @property {float} shininess The sharpness of the specular reflection. Higher values create a smaller, more focused specular highlight.\n\ - * @property {vec3} normal Surface's normal in eye coordinates. It is used for effects such as normal mapping. The default is the surface's unmodified normal.\n\ - * @property {vec3} emission Light emitted by the material equally in all directions. The default is vec3(0.0), which emits no light.\n\ - * @property {float} alpha Opacity of this material. 0.0 is completely transparent; 1.0 is completely opaque.\n\ - */\n\ -struct czm_material\n\ -{\n\ - vec3 diffuse;\n\ - float specular;\n\ - float shininess;\n\ - vec3 normal;\n\ - vec3 emission;\n\ - float alpha;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/materialInput.js b/Source/Shaders/Builtin/Structs/materialInput.js deleted file mode 100644 index ffd7a261c18c..000000000000 --- a/Source/Shaders/Builtin/Structs/materialInput.js +++ /dev/null @@ -1,31 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Used as input to every material's czm_getMaterial function.\n\ - *\n\ - * @name czm_materialInput\n\ - * @glslStruct\n\ - *\n\ - * @property {float} s 1D texture coordinates.\n\ - * @property {vec2} st 2D texture coordinates.\n\ - * @property {vec3} str 3D texture coordinates.\n\ - * @property {vec3} normalEC Unperturbed surface normal in eye coordinates.\n\ - * @property {mat3} tangentToEyeMatrix Matrix for converting a tangent space normal to eye space.\n\ - * @property {vec3} positionToEyeEC Vector from the fragment to the eye in eye coordinates. The magnitude is the distance in meters from the fragment to the eye.\n\ - * @property {float} height The height of the terrain in meters above or below the WGS84 ellipsoid. Only available for globe materials.\n\ - * @property {float} slope The slope of the terrain normalized from 0 to 1. 0 is completely vertical, 1 is completely flat. Only available for globe materials.\n\ - */\n\ -struct czm_materialInput\n\ -{\n\ - float s;\n\ - vec2 st;\n\ - vec3 str;\n\ - vec3 normalEC;\n\ - mat3 tangentToEyeMatrix;\n\ - vec3 positionToEyeEC;\n\ - float height;\n\ - float slope;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/ray.js b/Source/Shaders/Builtin/Structs/ray.js deleted file mode 100644 index d729a01c5d5c..000000000000 --- a/Source/Shaders/Builtin/Structs/ray.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_ray\n\ - * @glslStruct\n\ - */\n\ -struct czm_ray\n\ -{\n\ - vec3 origin;\n\ - vec3 direction;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/raySegment.js b/Source/Shaders/Builtin/Structs/raySegment.js deleted file mode 100644 index 782b91ba5e3a..000000000000 --- a/Source/Shaders/Builtin/Structs/raySegment.js +++ /dev/null @@ -1,32 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_raySegment\n\ - * @glslStruct\n\ - */\n\ -struct czm_raySegment\n\ -{\n\ - float start;\n\ - float stop;\n\ -};\n\ -\n\ -/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_emptyRaySegment\n\ - * @glslConstant \n\ - */\n\ -const czm_raySegment czm_emptyRaySegment = czm_raySegment(-czm_infinity, -czm_infinity);\n\ -\n\ -/**\n\ - * DOC_TBA\n\ - *\n\ - * @name czm_fullRaySegment\n\ - * @glslConstant \n\ - */\n\ -const czm_raySegment czm_fullRaySegment = czm_raySegment(0.0, czm_infinity);\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Builtin/Structs/shadowParameters.js b/Source/Shaders/Builtin/Structs/shadowParameters.js deleted file mode 100644 index 2a687793e37c..000000000000 --- a/Source/Shaders/Builtin/Structs/shadowParameters.js +++ /dev/null @@ -1,20 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "struct czm_shadowParameters\n\ -{\n\ -#ifdef USE_CUBE_MAP_SHADOW\n\ - vec3 texCoords;\n\ -#else\n\ - vec2 texCoords;\n\ -#endif\n\ -\n\ - float depthBias;\n\ - float depth;\n\ - float nDotL;\n\ - vec2 texelStepSize;\n\ - float normalShadingSmooth;\n\ - float darkness;\n\ -};\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/CompositeOITFS.js b/Source/Shaders/CompositeOITFS.js deleted file mode 100644 index 4081455d8a16..000000000000 --- a/Source/Shaders/CompositeOITFS.js +++ /dev/null @@ -1,36 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * Compositing for Weighted Blended Order-Independent Transparency. See:\n\ - * - http://jcgt.org/published/0002/02/09/\n\ - * - http://casual-effects.blogspot.com/2014/03/weighted-blended-order-independent.html\n\ - */\n\ -\n\ -uniform sampler2D u_opaque;\n\ -uniform sampler2D u_accumulation;\n\ -uniform sampler2D u_revealage;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main()\n\ -{\n\ - vec4 opaque = texture2D(u_opaque, v_textureCoordinates);\n\ - vec4 accum = texture2D(u_accumulation, v_textureCoordinates);\n\ - float r = texture2D(u_revealage, v_textureCoordinates).r;\n\ -\n\ -#ifdef MRT\n\ - vec4 transparent = vec4(accum.rgb / clamp(r, 1e-4, 5e4), accum.a);\n\ -#else\n\ - vec4 transparent = vec4(accum.rgb / clamp(accum.a, 1e-4, 5e4), r);\n\ -#endif\n\ -\n\ - gl_FragColor = (1.0 - transparent.a) * transparent + transparent.a * opaque;\n\ -\n\ - if (opaque != czm_backgroundColor)\n\ - {\n\ - gl_FragColor.a = 1.0;\n\ - }\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/DepthPlaneFS.js b/Source/Shaders/DepthPlaneFS.js deleted file mode 100644 index eaea60b5afa4..000000000000 --- a/Source/Shaders/DepthPlaneFS.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec4 positionEC;\n\ -\n\ -void main()\n\ -{\n\ - // TODO: make arbitrary ellipsoid\n\ - czm_ellipsoid ellipsoid = czm_getWgs84EllipsoidEC();\n\ -\n\ - vec3 direction = normalize(positionEC.xyz);\n\ - czm_ray ray = czm_ray(vec3(0.0), direction);\n\ -\n\ - czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\n\ - if (!czm_isEmpty(intersection))\n\ - {\n\ - gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);\n\ - }\n\ - else\n\ - {\n\ - discard;\n\ - }\n\ -\n\ - czm_writeLogDepth();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/DepthPlaneVS.js b/Source/Shaders/DepthPlaneVS.js deleted file mode 100644 index 11f21b81bfac..000000000000 --- a/Source/Shaders/DepthPlaneVS.js +++ /dev/null @@ -1,16 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec4 position;\n\ -\n\ -varying vec4 positionEC;\n\ -\n\ -void main()\n\ -{\n\ - positionEC = czm_modelView * position;\n\ - gl_Position = czm_projection * positionEC;\n\ -\n\ - czm_vertexLogDepth();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/EllipsoidFS.js b/Source/Shaders/EllipsoidFS.js deleted file mode 100644 index 6aab4f4408fa..000000000000 --- a/Source/Shaders/EllipsoidFS.js +++ /dev/null @@ -1,116 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef WRITE_DEPTH\n\ -#ifdef GL_EXT_frag_depth\n\ -#extension GL_EXT_frag_depth : enable\n\ -#endif\n\ -#endif\n\ -\n\ -uniform vec3 u_radii;\n\ -uniform vec3 u_oneOverEllipsoidRadiiSquared;\n\ -\n\ -varying vec3 v_positionEC;\n\ -\n\ -vec4 computeEllipsoidColor(czm_ray ray, float intersection, float side)\n\ -{\n\ - vec3 positionEC = czm_pointAlongRay(ray, intersection);\n\ - vec3 positionMC = (czm_inverseModelView * vec4(positionEC, 1.0)).xyz;\n\ - vec3 geodeticNormal = normalize(czm_geodeticSurfaceNormal(positionMC, vec3(0.0), u_oneOverEllipsoidRadiiSquared));\n\ - vec3 sphericalNormal = normalize(positionMC / u_radii);\n\ - vec3 normalMC = geodeticNormal * side; // normalized surface normal (always facing the viewer) in model coordinates\n\ - vec3 normalEC = normalize(czm_normal * normalMC); // normalized surface normal in eye coordiantes\n\ -\n\ - vec2 st = czm_ellipsoidWgs84TextureCoordinates(sphericalNormal);\n\ - vec3 positionToEyeEC = -positionEC;\n\ -\n\ - czm_materialInput materialInput;\n\ - materialInput.s = st.s;\n\ - materialInput.st = st;\n\ - materialInput.str = (positionMC + u_radii) / u_radii;\n\ - materialInput.normalEC = normalEC;\n\ - materialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(positionMC, normalEC);\n\ - materialInput.positionToEyeEC = positionToEyeEC;\n\ - czm_material material = czm_getMaterial(materialInput);\n\ -\n\ -#ifdef ONLY_SUN_LIGHTING\n\ - return czm_private_phong(normalize(positionToEyeEC), material);\n\ -#else\n\ - return czm_phong(normalize(positionToEyeEC), material);\n\ -#endif\n\ -}\n\ -\n\ -void main()\n\ -{\n\ - // PERFORMANCE_TODO: When dynamic branching is available, compute ratio of maximum and minimum radii\n\ - // in the vertex shader. Only when it is larger than some constant, march along the ray.\n\ - // Otherwise perform one intersection test which will be the common case.\n\ -\n\ - // Test if the ray intersects a sphere with the ellipsoid's maximum radius.\n\ - // For very oblate ellipsoids, using the ellipsoid's radii for an intersection test\n\ - // may cause false negatives. This will discard fragments before marching the ray forward.\n\ - float maxRadius = max(u_radii.x, max(u_radii.y, u_radii.z)) * 1.5;\n\ - vec3 direction = normalize(v_positionEC);\n\ - vec3 ellipsoidCenter = czm_modelView[3].xyz;\n\ -\n\ - float t1 = -1.0;\n\ - float t2 = -1.0;\n\ -\n\ - float b = -2.0 * dot(direction, ellipsoidCenter);\n\ - float c = dot(ellipsoidCenter, ellipsoidCenter) - maxRadius * maxRadius;\n\ -\n\ - float discriminant = b * b - 4.0 * c;\n\ - if (discriminant >= 0.0) {\n\ - t1 = (-b - sqrt(discriminant)) * 0.5;\n\ - t2 = (-b + sqrt(discriminant)) * 0.5;\n\ - }\n\ -\n\ - if (t1 < 0.0 && t2 < 0.0) {\n\ - discard;\n\ - }\n\ -\n\ - float t = min(t1, t2);\n\ - if (t < 0.0) {\n\ - t = 0.0;\n\ - }\n\ -\n\ - // March ray forward to intersection with larger sphere and find\n\ - // actual intersection point with ellipsoid.\n\ - czm_ellipsoid ellipsoid = czm_ellipsoidNew(ellipsoidCenter, u_radii);\n\ - czm_ray ray = czm_ray(t * direction, direction);\n\ - czm_raySegment intersection = czm_rayEllipsoidIntersectionInterval(ray, ellipsoid);\n\ -\n\ - if (czm_isEmpty(intersection))\n\ - {\n\ - discard;\n\ - }\n\ -\n\ - // If the viewer is outside, compute outsideFaceColor, with normals facing outward.\n\ - vec4 outsideFaceColor = (intersection.start != 0.0) ? computeEllipsoidColor(ray, intersection.start, 1.0) : vec4(0.0);\n\ -\n\ - // If the viewer either is inside or can see inside, compute insideFaceColor, with normals facing inward.\n\ - vec4 insideFaceColor = (outsideFaceColor.a < 1.0) ? computeEllipsoidColor(ray, intersection.stop, -1.0) : vec4(0.0);\n\ -\n\ - gl_FragColor = mix(insideFaceColor, outsideFaceColor, outsideFaceColor.a);\n\ - gl_FragColor.a = 1.0 - (1.0 - insideFaceColor.a) * (1.0 - outsideFaceColor.a);\n\ -\n\ -#ifdef WRITE_DEPTH\n\ -#ifdef GL_EXT_frag_depth\n\ - t = (intersection.start != 0.0) ? intersection.start : intersection.stop;\n\ - vec3 positionEC = czm_pointAlongRay(ray, t);\n\ - vec4 positionCC = czm_projection * vec4(positionEC, 1.0);\n\ -#ifdef LOG_DEPTH\n\ - czm_writeLogDepth(1.0 + positionCC.w);\n\ -#else\n\ - float z = positionCC.z / positionCC.w;\n\ -\n\ - float n = czm_depthRange.near;\n\ - float f = czm_depthRange.far;\n\ -\n\ - gl_FragDepthEXT = (z * (f - n) + f + n) * 0.5;\n\ -#endif\n\ -#endif\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/EllipsoidVS.js b/Source/Shaders/EllipsoidVS.js deleted file mode 100644 index ee5f9e8a0d71..000000000000 --- a/Source/Shaders/EllipsoidVS.js +++ /dev/null @@ -1,31 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position;\n\ -\n\ -uniform vec3 u_radii;\n\ -\n\ -varying vec3 v_positionEC;\n\ -\n\ -void main()\n\ -{\n\ - // In the vertex data, the cube goes from (-1.0, -1.0, -1.0) to (1.0, 1.0, 1.0) in model coordinates.\n\ - // Scale to consider the radii. We could also do this once on the CPU when using the BoxGeometry,\n\ - // but doing it here allows us to change the radii without rewriting the vertex data, and\n\ - // allows all ellipsoids to reuse the same vertex data.\n\ - vec4 p = vec4(u_radii * position, 1.0);\n\ -\n\ - v_positionEC = (czm_modelView * p).xyz; // position in eye coordinates\n\ - gl_Position = czm_modelViewProjection * p; // position in clip coordinates\n\ -\n\ - // With multi-frustum, when the ellipsoid primitive is positioned on the intersection of two frustums\n\ - // and close to terrain, the terrain (writes depth) in the closest frustum can overwrite part of the\n\ - // ellipsoid (does not write depth) that was rendered in the farther frustum.\n\ - //\n\ - // Here, we clamp the depth in the vertex shader to avoid being overwritten; however, this creates\n\ - // artifacts since some fragments can be alpha blended twice. This is solved by only rendering\n\ - // the ellipsoid in the closest frustum to the viewer.\n\ - gl_Position.z = clamp(gl_Position.z, czm_depthRange.near, czm_depthRange.far);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/GlobeFS.js b/Source/Shaders/GlobeFS.js deleted file mode 100644 index cb0a4c313092..000000000000 --- a/Source/Shaders/GlobeFS.js +++ /dev/null @@ -1,348 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "//#define SHOW_TILE_BOUNDARIES\n\ -uniform vec4 u_initialColor;\n\ -\n\ -#if TEXTURE_UNITS > 0\n\ -uniform sampler2D u_dayTextures[TEXTURE_UNITS];\n\ -uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n\ -uniform bool u_dayTextureUseWebMercatorT[TEXTURE_UNITS];\n\ -\n\ -#ifdef APPLY_ALPHA\n\ -uniform float u_dayTextureAlpha[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_SPLIT\n\ -uniform float u_dayTextureSplit[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_BRIGHTNESS\n\ -uniform float u_dayTextureBrightness[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_CONTRAST\n\ -uniform float u_dayTextureContrast[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_HUE\n\ -uniform float u_dayTextureHue[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_SATURATION\n\ -uniform float u_dayTextureSaturation[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef APPLY_GAMMA\n\ -uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n\ -#endif\n\ -\n\ -#ifdef SHOW_REFLECTIVE_OCEAN\n\ -uniform sampler2D u_waterMask;\n\ -uniform vec4 u_waterMaskTranslationAndScale;\n\ -uniform float u_zoomedOutOceanSpecularIntensity;\n\ -#endif\n\ -\n\ -#ifdef SHOW_OCEAN_WAVES\n\ -uniform sampler2D u_oceanNormalMap;\n\ -#endif\n\ -\n\ -#ifdef ENABLE_DAYNIGHT_SHADING\n\ -uniform vec2 u_lightingFadeDistance;\n\ -#endif\n\ -\n\ -#ifdef ENABLE_CLIPPING_PLANES\n\ -uniform sampler2D u_clippingPlanes;\n\ -uniform mat4 u_clippingPlanesMatrix;\n\ -uniform vec4 u_clippingPlanesEdgeStyle;\n\ -#endif\n\ -\n\ -#if defined(FOG) && (defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING))\n\ -uniform float u_minimumBrightness;\n\ -#endif\n\ -\n\ -varying vec3 v_positionMC;\n\ -varying vec3 v_positionEC;\n\ -varying vec3 v_textureCoordinates;\n\ -varying vec3 v_normalMC;\n\ -varying vec3 v_normalEC;\n\ -\n\ -#ifdef APPLY_MATERIAL\n\ -varying float v_height;\n\ -varying float v_slope;\n\ -#endif\n\ -\n\ -#ifdef FOG\n\ -varying float v_distance;\n\ -varying vec3 v_rayleighColor;\n\ -varying vec3 v_mieColor;\n\ -#endif\n\ -\n\ -vec4 sampleAndBlend(\n\ - vec4 previousColor,\n\ - sampler2D textureToSample,\n\ - vec2 tileTextureCoordinates,\n\ - vec4 textureCoordinateRectangle,\n\ - vec4 textureCoordinateTranslationAndScale,\n\ - float textureAlpha,\n\ - float textureBrightness,\n\ - float textureContrast,\n\ - float textureHue,\n\ - float textureSaturation,\n\ - float textureOneOverGamma,\n\ - float split)\n\ -{\n\ - // This crazy step stuff sets the alpha to 0.0 if this following condition is true:\n\ - // tileTextureCoordinates.s < textureCoordinateRectangle.s ||\n\ - // tileTextureCoordinates.s > textureCoordinateRectangle.p ||\n\ - // tileTextureCoordinates.t < textureCoordinateRectangle.t ||\n\ - // tileTextureCoordinates.t > textureCoordinateRectangle.q\n\ - // In other words, the alpha is zero if the fragment is outside the rectangle\n\ - // covered by this texture. Would an actual 'if' yield better performance?\n\ - vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates);\n\ - textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\ -\n\ - alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\n\ - textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\ -\n\ - vec2 translation = textureCoordinateTranslationAndScale.xy;\n\ - vec2 scale = textureCoordinateTranslationAndScale.zw;\n\ - vec2 textureCoordinates = tileTextureCoordinates * scale + translation;\n\ - vec4 value = texture2D(textureToSample, textureCoordinates);\n\ - vec3 color = value.rgb;\n\ - float alpha = value.a;\n\ -\n\ -#ifdef APPLY_SPLIT\n\ - float splitPosition = czm_imagerySplitPosition;\n\ - // Split to the left\n\ - if (split < 0.0 && gl_FragCoord.x > splitPosition) {\n\ - alpha = 0.0;\n\ - }\n\ - // Split to the right\n\ - else if (split > 0.0 && gl_FragCoord.x < splitPosition) {\n\ - alpha = 0.0;\n\ - }\n\ -#endif\n\ -\n\ -#ifdef APPLY_BRIGHTNESS\n\ - color = mix(vec3(0.0), color, textureBrightness);\n\ -#endif\n\ -\n\ -#ifdef APPLY_CONTRAST\n\ - color = mix(vec3(0.5), color, textureContrast);\n\ -#endif\n\ -\n\ -#ifdef APPLY_HUE\n\ - color = czm_hue(color, textureHue);\n\ -#endif\n\ -\n\ -#ifdef APPLY_SATURATION\n\ - color = czm_saturation(color, textureSaturation);\n\ -#endif\n\ -\n\ -#ifdef APPLY_GAMMA\n\ - color = pow(color, vec3(textureOneOverGamma));\n\ -#endif\n\ -\n\ - float sourceAlpha = alpha * textureAlpha;\n\ - float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\n\ - vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\n\ - return vec4(outColor, outAlpha);\n\ -}\n\ -\n\ -vec4 computeDayColor(vec4 initialColor, vec3 textureCoordinates);\n\ -vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\n\ -\n\ -void main()\n\ -{\n\ -#ifdef ENABLE_CLIPPING_PLANES\n\ - float clipDistance = clip(gl_FragCoord, u_clippingPlanes, u_clippingPlanesMatrix);\n\ -#endif\n\ -\n\ - // The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0\n\ - // where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the\n\ - // fragments on the edges of tiles even though the vertex shader is outputting\n\ - // coordinates strictly in the 0-1 range.\n\ - vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n\ -\n\ -#ifdef SHOW_TILE_BOUNDARIES\n\ - if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\n\ - v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n\ - {\n\ - color = vec4(1.0, 0.0, 0.0, 1.0);\n\ - }\n\ -#endif\n\ -\n\ -#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\n\ - vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates\n\ - vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes\n\ -#endif\n\ -\n\ -#ifdef SHOW_REFLECTIVE_OCEAN\n\ - vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\n\ - vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\n\ - vec2 waterMaskTextureCoordinates = v_textureCoordinates.xy * waterMaskScale + waterMaskTranslation;\n\ - waterMaskTextureCoordinates.y = 1.0 - waterMaskTextureCoordinates.y;\n\ -\n\ - float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\n\ -\n\ - if (mask > 0.0)\n\ - {\n\ - mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\n\ -\n\ - vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\n\ - vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\n\ -\n\ - vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\n\ -\n\ - color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n\ - }\n\ -#endif\n\ -\n\ -#ifdef APPLY_MATERIAL\n\ - czm_materialInput materialInput;\n\ - materialInput.st = v_textureCoordinates.st;\n\ - materialInput.normalEC = normalize(v_normalEC);\n\ - materialInput.slope = v_slope;\n\ - materialInput.height = v_height;\n\ - czm_material material = czm_getMaterial(materialInput);\n\ - color.xyz = mix(color.xyz, material.diffuse, material.alpha);\n\ -#endif\n\ -\n\ -#ifdef ENABLE_VERTEX_LIGHTING\n\ - float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\n\ - vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\ -#elif defined(ENABLE_DAYNIGHT_SHADING)\n\ - float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\n\ - float cameraDist = length(czm_view[3]);\n\ - float fadeOutDist = u_lightingFadeDistance.x;\n\ - float fadeInDist = u_lightingFadeDistance.y;\n\ - float t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n\ - diffuseIntensity = mix(1.0, diffuseIntensity, t);\n\ - vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\ -#else\n\ - vec4 finalColor = color;\n\ -#endif\n\ -\n\ -#ifdef ENABLE_CLIPPING_PLANES\n\ - vec4 clippingPlanesEdgeColor = vec4(1.0);\n\ - clippingPlanesEdgeColor.rgb = u_clippingPlanesEdgeStyle.rgb;\n\ - float clippingPlanesEdgeWidth = u_clippingPlanesEdgeStyle.a;\n\ -\n\ - if (clipDistance < clippingPlanesEdgeWidth)\n\ - {\n\ - finalColor = clippingPlanesEdgeColor;\n\ - }\n\ -#endif\n\ -\n\ -#ifdef FOG\n\ - const float fExposure = 2.0;\n\ - vec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\n\ - fogColor = vec3(1.0) - exp(-fExposure * fogColor);\n\ -\n\ -#if defined(ENABLE_VERTEX_LIGHTING) || defined(ENABLE_DAYNIGHT_SHADING)\n\ - float darken = clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), u_minimumBrightness, 1.0);\n\ - fogColor *= darken;\n\ -#endif\n\ -\n\ - gl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n\ -#else\n\ - gl_FragColor = finalColor;\n\ -#endif\n\ -}\n\ -\n\ -#ifdef SHOW_REFLECTIVE_OCEAN\n\ -\n\ -float waveFade(float edge0, float edge1, float x)\n\ -{\n\ - float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\ - return pow(1.0 - y, 5.0);\n\ -}\n\ -\n\ -float linearFade(float edge0, float edge1, float x)\n\ -{\n\ - return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\ -}\n\ -\n\ -// Based on water rendering by Jonas Wagner:\n\ -// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\ -\n\ -// low altitude wave settings\n\ -const float oceanFrequencyLowAltitude = 825000.0;\n\ -const float oceanAnimationSpeedLowAltitude = 0.004;\n\ -const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\n\ -const float oceanSpecularIntensity = 0.5;\n\ -\n\ -// high altitude wave settings\n\ -const float oceanFrequencyHighAltitude = 125000.0;\n\ -const float oceanAnimationSpeedHighAltitude = 0.008;\n\ -const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\n\ -\n\ -vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n\ -{\n\ - vec3 positionToEyeEC = -positionEyeCoordinates;\n\ - float positionToEyeECLength = length(positionToEyeEC);\n\ -\n\ - // The double normalize below works around a bug in Firefox on Android devices.\n\ - vec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\n\ -\n\ - // Fade out the waves as the camera moves far from the surface.\n\ - float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n\ -\n\ -#ifdef SHOW_OCEAN_WAVES\n\ - // high altitude waves\n\ - float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\n\ - vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\n\ - vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\n\ -\n\ - // low altitude waves\n\ - time = czm_frameNumber * oceanAnimationSpeedLowAltitude;\n\ - noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\n\ - vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\n\ -\n\ - // blend the 2 wave layers based on distance to surface\n\ - float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\n\ - float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\n\ - vec3 normalTangentSpace =\n\ - (highAltitudeFade * normalTangentSpaceHighAltitude) +\n\ - (lowAltitudeFade * normalTangentSpaceLowAltitude);\n\ - normalTangentSpace = normalize(normalTangentSpace);\n\ -\n\ - // fade out the normal perturbation as we move farther from the water surface\n\ - normalTangentSpace.xy *= waveIntensity;\n\ - normalTangentSpace = normalize(normalTangentSpace);\n\ -#else\n\ - vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n\ -#endif\n\ -\n\ - vec3 normalEC = enuToEye * normalTangentSpace;\n\ -\n\ - const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\n\ -\n\ - // Use diffuse light to highlight the waves\n\ - float diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\n\ - vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n\ -\n\ -#ifdef SHOW_OCEAN_WAVES\n\ - // Where diffuse light is low or non-existent, use wave highlights based solely on\n\ - // the wave bumpiness and no particular light direction.\n\ - float tsPerturbationRatio = normalTangentSpace.z;\n\ - vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n\ -#else\n\ - vec3 nonDiffuseHighlight = vec3(0.0);\n\ -#endif\n\ -\n\ - // Add specular highlights in 3D, and in all modes when zoomed in.\n\ - float specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\n\ - float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\n\ - float specular = specularIntensity * surfaceReflectance;\n\ -\n\ - return vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a);\n\ -}\n\ -\n\ -#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/GlobeVS.js b/Source/Shaders/GlobeVS.js deleted file mode 100644 index 4c1a63ec7901..000000000000 --- a/Source/Shaders/GlobeVS.js +++ /dev/null @@ -1,188 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef QUANTIZATION_BITS12\n\ -attribute vec4 compressed0;\n\ -attribute float compressed1;\n\ -#else\n\ -attribute vec4 position3DAndHeight;\n\ -attribute vec4 textureCoordAndEncodedNormals;\n\ -#endif\n\ -\n\ -uniform vec3 u_center3D;\n\ -uniform mat4 u_modifiedModelView;\n\ -uniform mat4 u_modifiedModelViewProjection;\n\ -uniform vec4 u_tileRectangle;\n\ -\n\ -// Uniforms for 2D Mercator projection\n\ -uniform vec2 u_southAndNorthLatitude;\n\ -uniform vec2 u_southMercatorYAndOneOverHeight;\n\ -\n\ -varying vec3 v_positionMC;\n\ -varying vec3 v_positionEC;\n\ -\n\ -varying vec3 v_textureCoordinates;\n\ -varying vec3 v_normalMC;\n\ -varying vec3 v_normalEC;\n\ -\n\ -#ifdef APPLY_MATERIAL\n\ -varying float v_slope;\n\ -varying float v_height;\n\ -#endif\n\ -\n\ -#ifdef FOG\n\ -varying float v_distance;\n\ -varying vec3 v_mieColor;\n\ -varying vec3 v_rayleighColor;\n\ -#endif\n\ -\n\ -// These functions are generated at runtime.\n\ -vec4 getPosition(vec3 position, float height, vec2 textureCoordinates);\n\ -float get2DYPositionFraction(vec2 textureCoordinates);\n\ -\n\ -vec4 getPosition3DMode(vec3 position, float height, vec2 textureCoordinates)\n\ -{\n\ - return u_modifiedModelViewProjection * vec4(position, 1.0);\n\ -}\n\ -\n\ -float get2DMercatorYPositionFraction(vec2 textureCoordinates)\n\ -{\n\ - // The width of a tile at level 11, in radians and assuming a single root tile, is\n\ - // 2.0 * czm_pi / pow(2.0, 11.0)\n\ - // We want to just linearly interpolate the 2D position from the texture coordinates\n\ - // when we're at this level or higher. The constant below is the expression\n\ - // above evaluated and then rounded up at the 4th significant digit.\n\ - const float maxTileWidth = 0.003068;\n\ - float positionFraction = textureCoordinates.y;\n\ - float southLatitude = u_southAndNorthLatitude.x;\n\ - float northLatitude = u_southAndNorthLatitude.y;\n\ - if (northLatitude - southLatitude > maxTileWidth)\n\ - {\n\ - float southMercatorY = u_southMercatorYAndOneOverHeight.x;\n\ - float oneOverMercatorHeight = u_southMercatorYAndOneOverHeight.y;\n\ -\n\ - float currentLatitude = mix(southLatitude, northLatitude, textureCoordinates.y);\n\ - currentLatitude = clamp(currentLatitude, -czm_webMercatorMaxLatitude, czm_webMercatorMaxLatitude);\n\ - positionFraction = czm_latitudeToWebMercatorFraction(currentLatitude, southMercatorY, oneOverMercatorHeight);\n\ - }\n\ - return positionFraction;\n\ -}\n\ -\n\ -float get2DGeographicYPositionFraction(vec2 textureCoordinates)\n\ -{\n\ - return textureCoordinates.y;\n\ -}\n\ -\n\ -vec4 getPositionPlanarEarth(vec3 position, float height, vec2 textureCoordinates)\n\ -{\n\ - float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\ - vec4 rtcPosition2D = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\ - return u_modifiedModelViewProjection * rtcPosition2D;\n\ -}\n\ -\n\ -vec4 getPosition2DMode(vec3 position, float height, vec2 textureCoordinates)\n\ -{\n\ - return getPositionPlanarEarth(position, 0.0, textureCoordinates);\n\ -}\n\ -\n\ -vec4 getPositionColumbusViewMode(vec3 position, float height, vec2 textureCoordinates)\n\ -{\n\ - return getPositionPlanarEarth(position, height, textureCoordinates);\n\ -}\n\ -\n\ -vec4 getPositionMorphingMode(vec3 position, float height, vec2 textureCoordinates)\n\ -{\n\ - // We do not do RTC while morphing, so there is potential for jitter.\n\ - // This is unlikely to be noticeable, though.\n\ - vec3 position3DWC = position + u_center3D;\n\ - float yPositionFraction = get2DYPositionFraction(textureCoordinates);\n\ - vec4 position2DWC = vec4(height, mix(u_tileRectangle.st, u_tileRectangle.pq, vec2(textureCoordinates.x, yPositionFraction)), 1.0);\n\ - vec4 morphPosition = czm_columbusViewMorph(position2DWC, vec4(position3DWC, 1.0), czm_morphTime);\n\ - return czm_modelViewProjection * morphPosition;\n\ -}\n\ -\n\ -#ifdef QUANTIZATION_BITS12\n\ -uniform vec2 u_minMaxHeight;\n\ -uniform mat4 u_scaleAndBias;\n\ -#endif\n\ -\n\ -void main()\n\ -{\n\ -#ifdef QUANTIZATION_BITS12\n\ - vec2 xy = czm_decompressTextureCoordinates(compressed0.x);\n\ - vec2 zh = czm_decompressTextureCoordinates(compressed0.y);\n\ - vec3 position = vec3(xy, zh.x);\n\ - float height = zh.y;\n\ - vec2 textureCoordinates = czm_decompressTextureCoordinates(compressed0.z);\n\ -\n\ - height = height * (u_minMaxHeight.y - u_minMaxHeight.x) + u_minMaxHeight.x;\n\ - position = (u_scaleAndBias * vec4(position, 1.0)).xyz;\n\ -\n\ -#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n\ - float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\ - float encodedNormal = compressed1;\n\ -#elif defined(INCLUDE_WEB_MERCATOR_Y)\n\ - float webMercatorT = czm_decompressTextureCoordinates(compressed0.w).x;\n\ - float encodedNormal = 0.0;\n\ -#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL)\n\ - float webMercatorT = textureCoordinates.y;\n\ - float encodedNormal = compressed0.w;\n\ -#else\n\ - float webMercatorT = textureCoordinates.y;\n\ - float encodedNormal = 0.0;\n\ -#endif\n\ -\n\ -#else\n\ - // A single float per element\n\ - vec3 position = position3DAndHeight.xyz;\n\ - float height = position3DAndHeight.w;\n\ - vec2 textureCoordinates = textureCoordAndEncodedNormals.xy;\n\ -\n\ -#if (defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)) && defined(INCLUDE_WEB_MERCATOR_Y)\n\ - float webMercatorT = textureCoordAndEncodedNormals.z;\n\ - float encodedNormal = textureCoordAndEncodedNormals.w;\n\ -#elif defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\ - float webMercatorT = textureCoordinates.y;\n\ - float encodedNormal = textureCoordAndEncodedNormals.z;\n\ -#elif defined(INCLUDE_WEB_MERCATOR_Y)\n\ - float webMercatorT = textureCoordAndEncodedNormals.z;\n\ - float encodedNormal = 0.0;\n\ -#else\n\ - float webMercatorT = textureCoordinates.y;\n\ - float encodedNormal = 0.0;\n\ -#endif\n\ -\n\ -#endif\n\ -\n\ - vec3 position3DWC = position + u_center3D;\n\ - gl_Position = getPosition(position, height, textureCoordinates);\n\ -\n\ - v_textureCoordinates = vec3(textureCoordinates, webMercatorT);\n\ -\n\ -#if defined(ENABLE_VERTEX_LIGHTING) || defined(GENERATE_POSITION_AND_NORMAL) || defined(APPLY_MATERIAL)\n\ - v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n\ - v_positionMC = position3DWC; // position in model coordinates\n\ - vec3 normalMC = czm_octDecode(encodedNormal);\n\ - v_normalMC = normalMC;\n\ - v_normalEC = czm_normal3D * v_normalMC;\n\ -#elif defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING) || defined(GENERATE_POSITION)\n\ - v_positionEC = (u_modifiedModelView * vec4(position, 1.0)).xyz;\n\ - v_positionMC = position3DWC; // position in model coordinates\n\ -#endif\n\ -\n\ -#ifdef FOG\n\ - AtmosphereColor atmosColor = computeGroundAtmosphereFromSpace(position3DWC);\n\ - v_mieColor = atmosColor.mie;\n\ - v_rayleighColor = atmosColor.rayleigh;\n\ - v_distance = length((czm_modelView3D * vec4(position3DWC, 1.0)).xyz);\n\ -#endif\n\ -\n\ -#ifdef APPLY_MATERIAL\n\ - vec3 finalNormal = normalMC;\n\ - vec3 ellipsoidNormal = normalize(position3DWC.xyz);\n\ - v_slope = abs(dot(ellipsoidNormal, finalNormal));\n\ - v_height = height;\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/GroundAtmosphere.js b/Source/Shaders/GroundAtmosphere.js deleted file mode 100644 index 15e476224754..000000000000 --- a/Source/Shaders/GroundAtmosphere.js +++ /dev/null @@ -1,134 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/*!\n\ - * Atmosphere code:\n\ - *\n\ - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ - * All rights reserved.\n\ - * \n\ - * Redistribution and use in source and binary forms, with or without\n\ - * modification, are permitted provided that the following conditions\n\ - * are met:\n\ - * \n\ - * * Redistributions of source code must retain the above copyright notice,\n\ - * this list of conditions and the following disclaimer.\n\ - * * Redistributions in binary form must reproduce the above copyright notice,\n\ - * this list of conditions and the following disclaimer in the documentation\n\ - * and/or other materials provided with the distribution.\n\ - * * Neither the name of the project nor the names of its contributors may be\n\ - * used to endorse or promote products derived from this software without\n\ - * specific prior written permission.\n\ - * \n\ - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ - *\n\ - * Modifications made by Analytical Graphics, Inc.\n\ - */\n\ - \n\ - // Atmosphere:\n\ - // Code: http://sponeil.net/\n\ - // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ -\n\ -const float fInnerRadius = 6378137.0;\n\ -const float fOuterRadius = 6378137.0 * 1.025;\n\ -const float fOuterRadius2 = fOuterRadius * fOuterRadius;\n\ -\n\ -const float Kr = 0.0025;\n\ -const float Km = 0.0015;\n\ -const float ESun = 15.0;\n\ -\n\ -const float fKrESun = Kr * ESun;\n\ -const float fKmESun = Km * ESun;\n\ -const float fKr4PI = Kr * 4.0 * czm_pi;\n\ -const float fKm4PI = Km * 4.0 * czm_pi;\n\ -\n\ -const float fScale = 1.0 / (fOuterRadius - fInnerRadius);\n\ -const float fScaleDepth = 0.25;\n\ -const float fScaleOverScaleDepth = fScale / fScaleDepth;\n\ -\n\ -struct AtmosphereColor\n\ -{\n\ - vec3 mie;\n\ - vec3 rayleigh;\n\ -};\n\ -\n\ -const int nSamples = 2;\n\ -const float fSamples = 2.0;\n\ -\n\ -float scale(float fCos)\n\ -{\n\ - float x = 1.0 - fCos;\n\ - return fScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n\ -}\n\ -\n\ -AtmosphereColor computeGroundAtmosphereFromSpace(vec3 v3Pos)\n\ -{\n\ - vec3 v3InvWavelength = vec3(1.0 / pow(0.650, 4.0), 1.0 / pow(0.570, 4.0), 1.0 / pow(0.475, 4.0));\n\ -\n\ - // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\n\ - vec3 v3Ray = v3Pos - czm_viewerPositionWC;\n\ - float fFar = length(v3Ray);\n\ - v3Ray /= fFar;\n\ - \n\ - float fCameraHeight = length(czm_viewerPositionWC);\n\ - float fCameraHeight2 = fCameraHeight * fCameraHeight;\n\ -\n\ - // This next line is an ANGLE workaround. It is equivalent to B = 2.0 * dot(czm_viewerPositionWC, v3Ray), \n\ - // which is what it should be, but there are problems at the poles.\n\ - float B = 2.0 * length(czm_viewerPositionWC) * dot(normalize(czm_viewerPositionWC), v3Ray);\n\ - float C = fCameraHeight2 - fOuterRadius2;\n\ - float fDet = max(0.0, B*B - 4.0 * C);\n\ - float fNear = 0.5 * (-B - sqrt(fDet));\n\ -\n\ - // Calculate the ray's starting position, then calculate its scattering offset\n\ - vec3 v3Start = czm_viewerPositionWC + v3Ray * fNear;\n\ - fFar -= fNear;\n\ - float fDepth = exp((fInnerRadius - fOuterRadius) / fScaleDepth);\n\ - \n\ - // The light angle based on the sun position would be:\n\ - // dot(czm_sunDirectionWC, v3Pos) / length(v3Pos);\n\ - // We want the atmosphere to be uniform over the globe so it is set to 1.0.\n\ - float fLightAngle = 1.0;\n\ - float fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);\n\ - float fCameraScale = scale(fCameraAngle);\n\ - float fLightScale = scale(fLightAngle);\n\ - float fCameraOffset = fDepth*fCameraScale;\n\ - float fTemp = (fLightScale + fCameraScale);\n\ -\n\ - // Initialize the scattering loop variables\n\ - float fSampleLength = fFar / fSamples;\n\ - float fScaledLength = fSampleLength * fScale;\n\ - vec3 v3SampleRay = v3Ray * fSampleLength;\n\ - vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5;\n\ -\n\ - // Now loop through the sample rays\n\ - vec3 v3FrontColor = vec3(0.0);\n\ - vec3 v3Attenuate = vec3(0.0);\n\ - for(int i=0; i 0.5 + halfWidth)\n\ - {\n\ - d1 = abs(st.s - base);\n\ - }\n\ - float d2 = abs(st.t - ptOnUpperLine);\n\ - float d3 = abs(st.t - ptOnLowerLine);\n\ - dist = min(min(d1, d2), d3);\n\ - }\n\ -\n\ - vec4 outsideColor = vec4(0.0);\n\ - vec4 currentColor = mix(outsideColor, color, clamp(s + t, 0.0, 1.0));\n\ - vec4 outColor = czm_antialias(outsideColor, color, currentColor, dist);\n\ -\n\ - material.diffuse = outColor.rgb;\n\ - material.alpha = outColor.a;\n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineDashMaterial.js b/Source/Shaders/Materials/PolylineDashMaterial.js deleted file mode 100644 index 72be9e63bb80..000000000000 --- a/Source/Shaders/Materials/PolylineDashMaterial.js +++ /dev/null @@ -1,42 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform vec4 color;\n\ -uniform vec4 gapColor;\n\ -uniform float dashLength;\n\ -uniform float dashPattern;\n\ -varying float v_polylineAngle;\n\ -\n\ -const float maskLength = 16.0;\n\ -\n\ -mat2 rotate(float rad) {\n\ - float c = cos(rad);\n\ - float s = sin(rad);\n\ - return mat2(\n\ - c, s,\n\ - -s, c\n\ - );\n\ -}\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ -\n\ - vec2 pos = rotate(v_polylineAngle) * gl_FragCoord.xy;\n\ -\n\ - // Get the relative position within the dash from 0 to 1\n\ - float dashPosition = fract(pos.x / dashLength);\n\ - // Figure out the mask index.\n\ - float maskIndex = floor(dashPosition * maskLength);\n\ - // Test the bit mask.\n\ - float maskTest = floor(dashPattern / pow(2.0, maskIndex));\n\ - vec4 fragColor = (mod(maskTest, 2.0) < 1.0) ? gapColor : color;\n\ - if (fragColor.a < 0.005) { // matches 0/255 and 1/255\n\ - discard;\n\ - }\n\ -\n\ - material.emission = fragColor.rgb;\n\ - material.alpha = fragColor.a;\n\ - return material;\n\ -}"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineGlowMaterial.js b/Source/Shaders/Materials/PolylineGlowMaterial.js deleted file mode 100644 index 3f11d3eee03f..000000000000 --- a/Source/Shaders/Materials/PolylineGlowMaterial.js +++ /dev/null @@ -1,22 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform vec4 color;\n\ -uniform float glowPower;\n\ -\n\ -varying float v_width;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ -\n\ - vec2 st = materialInput.st;\n\ - float glow = glowPower / abs(st.t - 0.5) - (glowPower / 0.5);\n\ -\n\ - material.emission = max(vec3(glow - 1.0 + color.rgb), color.rgb);\n\ - material.alpha = clamp(0.0, 1.0, glow) * color.a;\n\ -\n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/PolylineOutlineMaterial.js b/Source/Shaders/Materials/PolylineOutlineMaterial.js deleted file mode 100644 index af71e2b4f30d..000000000000 --- a/Source/Shaders/Materials/PolylineOutlineMaterial.js +++ /dev/null @@ -1,33 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform vec4 color;\n\ -uniform vec4 outlineColor;\n\ -uniform float outlineWidth;\n\ -\n\ -varying float v_width;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ - \n\ - vec2 st = materialInput.st;\n\ - float halfInteriorWidth = 0.5 * (v_width - outlineWidth) / v_width;\n\ - float b = step(0.5 - halfInteriorWidth, st.t);\n\ - b *= 1.0 - step(0.5 + halfInteriorWidth, st.t);\n\ - \n\ - // Find the distance from the closest separator (region between two colors)\n\ - float d1 = abs(st.t - (0.5 - halfInteriorWidth));\n\ - float d2 = abs(st.t - (0.5 + halfInteriorWidth));\n\ - float dist = min(d1, d2);\n\ - \n\ - vec4 currentColor = mix(outlineColor, color, b);\n\ - vec4 outColor = czm_antialias(outlineColor, color, currentColor, dist);\n\ - \n\ - material.diffuse = outColor.rgb;\n\ - material.alpha = outColor.a;\n\ - \n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/RimLightingMaterial.js b/Source/Shaders/Materials/RimLightingMaterial.js deleted file mode 100644 index 8d1397f9a171..000000000000 --- a/Source/Shaders/Materials/RimLightingMaterial.js +++ /dev/null @@ -1,23 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform vec4 color;\n\ -uniform vec4 rimColor;\n\ -uniform float width;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ -\n\ - // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n\ - float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\n\ - float s = smoothstep(1.0 - width, 1.0, d);\n\ -\n\ - material.diffuse = color.rgb;\n\ - material.emission = rimColor.rgb * s; \n\ - material.alpha = mix(color.a, rimColor.a, s);\n\ -\n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/SlopeRampMaterial.js b/Source/Shaders/Materials/SlopeRampMaterial.js deleted file mode 100644 index 0cfad106b4c8..000000000000 --- a/Source/Shaders/Materials/SlopeRampMaterial.js +++ /dev/null @@ -1,15 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D image;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ - vec4 rampColor = texture2D(image, vec2(materialInput.slope, 0.5));\n\ - material.diffuse = rampColor.rgb;\n\ - material.alpha = rampColor.a;\n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/StripeMaterial.js b/Source/Shaders/Materials/StripeMaterial.js deleted file mode 100644 index 84529a2f7f7f..000000000000 --- a/Source/Shaders/Materials/StripeMaterial.js +++ /dev/null @@ -1,28 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform vec4 evenColor;\n\ -uniform vec4 oddColor;\n\ -uniform float offset;\n\ -uniform float repeat;\n\ -uniform bool horizontal;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ -\n\ - // Based on the Stripes Fragment Shader in the Orange Book (11.1.2)\n\ - float coord = mix(materialInput.st.s, materialInput.st.t, float(horizontal));\n\ - float value = fract((coord - offset) * (repeat * 0.5));\n\ - float dist = min(value, min(abs(value - 0.5), 1.0 - value));\n\ - \n\ - vec4 currentColor = mix(evenColor, oddColor, step(0.5, value));\n\ - vec4 color = czm_antialias(evenColor, oddColor, currentColor, dist);\n\ - \n\ - material.diffuse = color.rgb;\n\ - material.alpha = color.a;\n\ - \n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/Materials/Water.js b/Source/Shaders/Materials/Water.js deleted file mode 100644 index ca6cc92072ba..000000000000 --- a/Source/Shaders/Materials/Water.js +++ /dev/null @@ -1,61 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "// Thanks for the contribution Jonas\n\ -// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\ -\n\ -uniform sampler2D specularMap;\n\ -uniform sampler2D normalMap;\n\ -uniform vec4 baseWaterColor;\n\ -uniform vec4 blendColor;\n\ -uniform float frequency;\n\ -uniform float animationSpeed;\n\ -uniform float amplitude;\n\ -uniform float specularIntensity;\n\ -uniform float fadeFactor;\n\ -\n\ -czm_material czm_getMaterial(czm_materialInput materialInput)\n\ -{\n\ - czm_material material = czm_getDefaultMaterial(materialInput);\n\ -\n\ - float time = czm_frameNumber * animationSpeed;\n\ - \n\ - // fade is a function of the distance from the fragment and the frequency of the waves\n\ - float fade = max(1.0, (length(materialInput.positionToEyeEC) / 10000000000.0) * frequency * fadeFactor);\n\ - \n\ - float specularMapValue = texture2D(specularMap, materialInput.st).r;\n\ - \n\ - // note: not using directional motion at this time, just set the angle to 0.0;\n\ - vec4 noise = czm_getWaterNoise(normalMap, materialInput.st * frequency, time, 0.0);\n\ - vec3 normalTangentSpace = noise.xyz * vec3(1.0, 1.0, (1.0 / amplitude));\n\ - \n\ - // fade out the normal perturbation as we move further from the water surface\n\ - normalTangentSpace.xy /= fade;\n\ - \n\ - // attempt to fade out the normal perturbation as we approach non water areas (low specular map value)\n\ - normalTangentSpace = mix(vec3(0.0, 0.0, 50.0), normalTangentSpace, specularMapValue);\n\ - \n\ - normalTangentSpace = normalize(normalTangentSpace);\n\ - \n\ - // get ratios for alignment of the new normal vector with a vector perpendicular to the tangent plane\n\ - float tsPerturbationRatio = clamp(dot(normalTangentSpace, vec3(0.0, 0.0, 1.0)), 0.0, 1.0);\n\ - \n\ - // fade out water effect as specular map value decreases\n\ - material.alpha = specularMapValue;\n\ - \n\ - // base color is a blend of the water and non-water color based on the value from the specular map\n\ - // may need a uniform blend factor to better control this\n\ - material.diffuse = mix(blendColor.rgb, baseWaterColor.rgb, specularMapValue);\n\ - \n\ - // diffuse highlights are based on how perturbed the normal is\n\ - material.diffuse += (0.1 * tsPerturbationRatio);\n\ - \n\ - material.normal = normalize(materialInput.tangentToEyeMatrix * normalTangentSpace);\n\ - \n\ - material.specular = specularIntensity;\n\ - material.shininess = 10.0;\n\ - \n\ - return material;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PointPrimitiveCollectionFS.js b/Source/Shaders/PointPrimitiveCollectionFS.js deleted file mode 100644 index 061fbbe51bf5..000000000000 --- a/Source/Shaders/PointPrimitiveCollectionFS.js +++ /dev/null @@ -1,56 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec4 v_color;\n\ -varying vec4 v_outlineColor;\n\ -varying float v_innerPercent;\n\ -varying float v_pixelDistance;\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ -varying vec4 v_pickColor;\n\ -#endif\n\ -\n\ -void main()\n\ -{\n\ - // The distance in UV space from this fragment to the center of the point, at most 0.5.\n\ - float distanceToCenter = length(gl_PointCoord - vec2(0.5));\n\ - // The max distance stops one pixel shy of the edge to leave space for anti-aliasing.\n\ - float maxDistance = max(0.0, 0.5 - v_pixelDistance);\n\ - float wholeAlpha = 1.0 - smoothstep(maxDistance, 0.5, distanceToCenter);\n\ - float innerAlpha = 1.0 - smoothstep(maxDistance * v_innerPercent, 0.5 * v_innerPercent, distanceToCenter);\n\ -\n\ - vec4 color = mix(v_outlineColor, v_color, innerAlpha);\n\ - color.a *= wholeAlpha;\n\ -\n\ -// Fully transparent parts of the billboard are not pickable.\n\ -#if defined(RENDER_FOR_PICK) || (!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 RENDER_FOR_PICK\n\ - gl_FragColor = v_pickColor;\n\ -#else\n\ - gl_FragColor = color;\n\ -#endif\n\ -\n\ - czm_writeLogDepth();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PointPrimitiveCollectionVS.js b/Source/Shaders/PointPrimitiveCollectionVS.js deleted file mode 100644 index fef2e2aad70e..000000000000 --- a/Source/Shaders/PointPrimitiveCollectionVS.js +++ /dev/null @@ -1,197 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform float u_maxTotalPointSize;\n\ -\n\ -attribute vec4 positionHighAndSize;\n\ -attribute vec4 positionLowAndOutline;\n\ -attribute vec4 compressedAttribute0; // color, outlineColor, pick color\n\ -attribute vec4 compressedAttribute1; // show, translucency by distance, some free space\n\ -attribute vec4 scaleByDistance; // near, nearScale, far, farScale\n\ -attribute vec3 distanceDisplayConditionAndDisableDepth; // near, far, disableDepthTestDistance\n\ -\n\ -varying vec4 v_color;\n\ -varying vec4 v_outlineColor;\n\ -varying float v_innerPercent;\n\ -varying float v_pixelDistance;\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ -varying vec4 v_pickColor;\n\ -#endif\n\ -\n\ -const float SHIFT_LEFT8 = 256.0;\n\ -const float SHIFT_RIGHT8 = 1.0 / 256.0;\n\ -\n\ -void main()\n\ -{\n\ - // Modifying this shader may also require modifications to PointPrimitive._computeScreenSpacePosition\n\ -\n\ - // unpack attributes\n\ - vec3 positionHigh = positionHighAndSize.xyz;\n\ - vec3 positionLow = positionLowAndOutline.xyz;\n\ - float outlineWidthBothSides = 2.0 * positionLowAndOutline.w;\n\ - float totalSize = positionHighAndSize.w + outlineWidthBothSides;\n\ - float outlinePercent = outlineWidthBothSides / totalSize;\n\ - // Scale in response to browser-zoom.\n\ - totalSize *= czm_resolutionScale;\n\ - // Add padding for anti-aliasing on both sides.\n\ - totalSize += 3.0;\n\ -\n\ - float temp = compressedAttribute1.x * SHIFT_RIGHT8;\n\ - float show = floor(temp);\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\ - ///////////////////////////////////////////////////////////////////////////\n\ -\n\ - vec4 color;\n\ - vec4 outlineColor;\n\ -#ifdef RENDER_FOR_PICK\n\ - // compressedAttribute0.z => pickColor.rgb\n\ -\n\ - color = vec4(0.0);\n\ - outlineColor = vec4(0.0);\n\ - vec4 pickColor;\n\ - temp = compressedAttribute0.z * SHIFT_RIGHT8;\n\ - pickColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - temp = floor(temp) * SHIFT_RIGHT8;\n\ - pickColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - pickColor.r = floor(temp);\n\ -#else\n\ - // compressedAttribute0.x => color.rgb\n\ -\n\ - temp = compressedAttribute0.x * SHIFT_RIGHT8;\n\ - color.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - temp = floor(temp) * SHIFT_RIGHT8;\n\ - color.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - color.r = floor(temp);\n\ -\n\ - // compressedAttribute0.y => outlineColor.rgb\n\ -\n\ - temp = compressedAttribute0.y * SHIFT_RIGHT8;\n\ - outlineColor.b = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - temp = floor(temp) * SHIFT_RIGHT8;\n\ - outlineColor.g = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - outlineColor.r = floor(temp);\n\ -#endif\n\ -\n\ - // compressedAttribute0.w => color.a, outlineColor.a, pickColor.a\n\ -\n\ - temp = compressedAttribute0.w * SHIFT_RIGHT8;\n\ -#ifdef RENDER_FOR_PICK\n\ - pickColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - pickColor = pickColor / 255.0;\n\ -#endif\n\ - temp = floor(temp) * SHIFT_RIGHT8;\n\ - outlineColor.a = (temp - floor(temp)) * SHIFT_LEFT8;\n\ - outlineColor /= 255.0;\n\ - color.a = floor(temp);\n\ - color /= 255.0;\n\ -\n\ - ///////////////////////////////////////////////////////////////////////////\n\ -\n\ - vec4 p = czm_translateRelativeToEye(positionHigh, positionLow);\n\ - vec4 positionEC = czm_modelViewRelativeToEye * p;\n\ - positionEC.xyz *= show;\n\ -\n\ - ///////////////////////////////////////////////////////////////////////////\n\ -\n\ -#if defined(EYE_DISTANCE_SCALING) || defined(EYE_DISTANCE_TRANSLUCENCY) || 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\ - totalSize *= czm_nearFarScalar(scaleByDistance, lengthSq);\n\ -#endif\n\ - // Clamp to max point size.\n\ - totalSize = min(totalSize, u_maxTotalPointSize);\n\ - // If size is too small, push vertex behind near plane for clipping.\n\ - // Note that context.minimumAliasedPointSize \"will be at most 1.0\".\n\ - if (totalSize < 1.0)\n\ - {\n\ - positionEC.xyz = vec3(0.0);\n\ - totalSize = 1.0;\n\ - }\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.004)\n\ - {\n\ - positionEC.xyz = vec3(0.0);\n\ - }\n\ -#endif\n\ -\n\ -#ifdef DISTANCE_DISPLAY_CONDITION\n\ - float nearSq = distanceDisplayConditionAndDisableDepth.x;\n\ - float farSq = distanceDisplayConditionAndDisableDepth.y;\n\ - if (lengthSq < nearSq || lengthSq > farSq) {\n\ - positionEC.xyz = vec3(0.0);\n\ - }\n\ -#endif\n\ -\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(czm_projection * positionEC);\n\ -#endif\n\ -\n\ - vec4 positionWC = czm_eyeToWindowCoordinates(positionEC);\n\ - gl_Position = czm_viewportOrthographic * vec4(positionWC.xy, -positionWC.z, 1.0);\n\ -\n\ -#ifdef DISABLE_DEPTH_DISTANCE\n\ - float disableDepthTestDistance = distanceDisplayConditionAndDisableDepth.z;\n\ - if (disableDepthTestDistance == 0.0 && czm_minimumDisableDepthTestDistance != 0.0)\n\ - {\n\ - disableDepthTestDistance = czm_minimumDisableDepthTestDistance;\n\ - }\n\ -\n\ - if (disableDepthTestDistance != 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\ - if (!clipped && (disableDepthTestDistance < 0.0 || (lengthSq > 0.0 && lengthSq < disableDepthTestDistance)))\n\ - {\n\ - // Position z on the near plane.\n\ - gl_Position.z = -gl_Position.w;\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(vec4(czm_currentFrustum.x));\n\ -#endif\n\ - }\n\ - }\n\ -#endif\n\ -\n\ - v_color = color;\n\ - v_color.a *= translucency;\n\ - v_outlineColor = outlineColor;\n\ - v_outlineColor.a *= translucency;\n\ -\n\ - v_innerPercent = 1.0 - outlinePercent;\n\ - v_pixelDistance = 2.0 / totalSize;\n\ - gl_PointSize = totalSize;\n\ -\n\ -#ifdef RENDER_FOR_PICK\n\ - v_pickColor = pickColor;\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PolylineCommon.js b/Source/Shaders/PolylineCommon.js deleted file mode 100644 index 7fbcac6d0736..000000000000 --- a/Source/Shaders/PolylineCommon.js +++ /dev/null @@ -1,121 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "void clipLineSegmentToNearPlane(\n\ - vec3 p0,\n\ - vec3 p1,\n\ - out vec4 positionWC,\n\ - out bool clipped,\n\ - out bool culledByNearPlane)\n\ -{\n\ - culledByNearPlane = false;\n\ - clipped = false;\n\ -\n\ - vec3 p1ToP0 = p1 - p0;\n\ - float magnitude = length(p1ToP0);\n\ - vec3 direction = normalize(p1ToP0);\n\ - float endPoint0Distance = -(czm_currentFrustum.x + p0.z);\n\ - float denominator = -direction.z;\n\ -\n\ - if (endPoint0Distance < 0.0 && abs(denominator) < czm_epsilon7)\n\ - {\n\ - culledByNearPlane = true;\n\ - }\n\ - else if (endPoint0Distance < 0.0 && abs(denominator) > czm_epsilon7)\n\ - {\n\ - // t = (-plane distance - dot(plane normal, ray origin)) / dot(plane normal, ray direction)\n\ - float t = (czm_currentFrustum.x + p0.z) / denominator;\n\ - if (t < 0.0 || t > magnitude)\n\ - {\n\ - culledByNearPlane = true;\n\ - }\n\ - else\n\ - {\n\ - p0 = p0 + t * direction;\n\ - clipped = true;\n\ - }\n\ - }\n\ -\n\ - positionWC = czm_eyeToWindowCoordinates(vec4(p0, 1.0));\n\ -}\n\ -\n\ -vec4 getPolylineWindowCoordinatesEC(vec4 positionEC, vec4 prevEC, vec4 nextEC, float expandDirection, float width, bool usePrevious, out float angle)\n\ -{\n\ - vec4 endPointWC, p0, p1;\n\ - bool culledByNearPlane, clipped;\n\ -\n\ -#ifdef POLYLINE_DASH\n\ - // Compute the window coordinates of the points.\n\ - vec4 positionWindow = czm_eyeToWindowCoordinates(positionEC);\n\ - vec4 previousWindow = czm_eyeToWindowCoordinates(prevEC);\n\ - vec4 nextWindow = czm_eyeToWindowCoordinates(nextEC);\n\ -\n\ - // Determine the relative screen space direction of the line.\n\ - vec2 lineDir;\n\ - if (usePrevious) {\n\ - lineDir = normalize(positionWindow.xy - previousWindow.xy);\n\ - }\n\ - else {\n\ - lineDir = normalize(nextWindow.xy - positionWindow.xy);\n\ - }\n\ - angle = atan(lineDir.x, lineDir.y) - 1.570796327; // precomputed atan(1,0)\n\ -\n\ - // Quantize the angle so it doesn't change rapidly between segments.\n\ - angle = floor(angle / czm_piOverFour + 0.5) * czm_piOverFour;\n\ -#endif\n\ -\n\ - clipLineSegmentToNearPlane(prevEC.xyz, positionEC.xyz, p0, clipped, culledByNearPlane);\n\ - clipLineSegmentToNearPlane(nextEC.xyz, positionEC.xyz, p1, clipped, culledByNearPlane);\n\ - clipLineSegmentToNearPlane(positionEC.xyz, usePrevious ? prevEC.xyz : nextEC.xyz, endPointWC, clipped, culledByNearPlane);\n\ -\n\ - if (culledByNearPlane)\n\ - {\n\ - return vec4(0.0, 0.0, 0.0, 1.0);\n\ - }\n\ -\n\ - vec2 prevWC = normalize(p0.xy - endPointWC.xy);\n\ - vec2 nextWC = normalize(p1.xy - endPointWC.xy);\n\ -\n\ - float expandWidth = width * 0.5;\n\ - vec2 direction;\n\ -\n\ - if (czm_equalsEpsilon(prevEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) || czm_equalsEpsilon(prevWC, -nextWC, czm_epsilon1))\n\ - {\n\ - direction = vec2(-nextWC.y, nextWC.x);\n\ - }\n\ - else if (czm_equalsEpsilon(nextEC.xyz - positionEC.xyz, vec3(0.0), czm_epsilon1) || clipped)\n\ - {\n\ - direction = vec2(prevWC.y, -prevWC.x);\n\ - }\n\ - else\n\ - {\n\ - vec2 normal = vec2(-nextWC.y, nextWC.x);\n\ - direction = normalize((nextWC + prevWC) * 0.5);\n\ - if (dot(direction, normal) < 0.0)\n\ - {\n\ - direction = -direction;\n\ - }\n\ -\n\ - // The sine of the angle between the two vectors is given by the formula\n\ - // |a x b| = |a||b|sin(theta)\n\ - // which is\n\ - // float sinAngle = length(cross(vec3(direction, 0.0), vec3(nextWC, 0.0)));\n\ - // Because the z components of both vectors are zero, the x and y coordinate will be zero.\n\ - // Therefore, the sine of the angle is just the z component of the cross product.\n\ - float sinAngle = abs(direction.x * nextWC.y - direction.y * nextWC.x);\n\ - expandWidth = clamp(expandWidth / sinAngle, 0.0, width * 2.0);\n\ - }\n\ -\n\ - vec2 offset = direction * expandDirection * expandWidth * czm_resolutionScale;\n\ - return vec4(endPointWC.xy + offset, -endPointWC.z, 1.0);\n\ -}\n\ -\n\ -vec4 getPolylineWindowCoordinates(vec4 position, vec4 previous, vec4 next, float expandDirection, float width, bool usePrevious, out float angle)\n\ -{\n\ - vec4 positionEC = czm_modelViewRelativeToEye * position;\n\ - vec4 prevEC = czm_modelViewRelativeToEye * previous;\n\ - vec4 nextEC = czm_modelViewRelativeToEye * next;\n\ - return getPolylineWindowCoordinatesEC(positionEC, prevEC, nextEC, expandDirection, width, usePrevious, angle);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PolylineFS.js b/Source/Shaders/PolylineFS.js deleted file mode 100644 index 5c7fdfab7735..000000000000 --- a/Source/Shaders/PolylineFS.js +++ /dev/null @@ -1,27 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef VECTOR_TILE\n\ -uniform vec4 u_highlightColor;\n\ -#endif\n\ -\n\ -varying vec2 v_st;\n\ -\n\ -void main()\n\ -{\n\ - czm_materialInput materialInput;\n\ -\n\ - materialInput.s = v_st.s;\n\ - materialInput.st = v_st;\n\ - materialInput.str = vec3(v_st, 0.0);\n\ -\n\ - czm_material material = czm_getMaterial(materialInput);\n\ - gl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n\ -#ifdef VECTOR_TILE\n\ - gl_FragColor *= u_highlightColor;\n\ -#endif\n\ -\n\ - czm_writeLogDepth();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PolylineVS.js b/Source/Shaders/PolylineVS.js deleted file mode 100644 index a91fb42a97fa..000000000000 --- a/Source/Shaders/PolylineVS.js +++ /dev/null @@ -1,108 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec3 position2DHigh;\n\ -attribute vec3 position2DLow;\n\ -attribute vec3 prevPosition3DHigh;\n\ -attribute vec3 prevPosition3DLow;\n\ -attribute vec3 prevPosition2DHigh;\n\ -attribute vec3 prevPosition2DLow;\n\ -attribute vec3 nextPosition3DHigh;\n\ -attribute vec3 nextPosition3DLow;\n\ -attribute vec3 nextPosition2DHigh;\n\ -attribute vec3 nextPosition2DLow;\n\ -attribute vec4 texCoordExpandAndBatchIndex;\n\ -\n\ -varying vec2 v_st;\n\ -varying float v_width;\n\ -varying vec4 czm_pickColor;\n\ -varying float v_polylineAngle;\n\ -\n\ -void main()\n\ -{\n\ - float texCoord = texCoordExpandAndBatchIndex.x;\n\ - float expandDir = texCoordExpandAndBatchIndex.y;\n\ - bool usePrev = texCoordExpandAndBatchIndex.z < 0.0;\n\ - float batchTableIndex = texCoordExpandAndBatchIndex.w;\n\ -\n\ - vec2 widthAndShow = batchTable_getWidthAndShow(batchTableIndex);\n\ - float width = widthAndShow.x + 0.5;\n\ - float show = widthAndShow.y;\n\ -\n\ - if (width < 1.0)\n\ - {\n\ - show = 0.0;\n\ - }\n\ -\n\ - vec4 pickColor = batchTable_getPickColor(batchTableIndex);\n\ -\n\ - vec4 p, prev, next;\n\ - if (czm_morphTime == 1.0)\n\ - {\n\ - p = czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz);\n\ - prev = czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz);\n\ - next = czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz);\n\ - }\n\ - else if (czm_morphTime == 0.0)\n\ - {\n\ - p = czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy);\n\ - prev = czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy);\n\ - next = czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy);\n\ - }\n\ - else\n\ - {\n\ - p = czm_columbusViewMorph(\n\ - czm_translateRelativeToEye(position2DHigh.zxy, position2DLow.zxy),\n\ - czm_translateRelativeToEye(position3DHigh.xyz, position3DLow.xyz),\n\ - czm_morphTime);\n\ - prev = czm_columbusViewMorph(\n\ - czm_translateRelativeToEye(prevPosition2DHigh.zxy, prevPosition2DLow.zxy),\n\ - czm_translateRelativeToEye(prevPosition3DHigh.xyz, prevPosition3DLow.xyz),\n\ - czm_morphTime);\n\ - next = czm_columbusViewMorph(\n\ - czm_translateRelativeToEye(nextPosition2DHigh.zxy, nextPosition2DLow.zxy),\n\ - czm_translateRelativeToEye(nextPosition3DHigh.xyz, nextPosition3DLow.xyz),\n\ - czm_morphTime);\n\ - }\n\ -\n\ - #ifdef DISTANCE_DISPLAY_CONDITION\n\ - vec3 centerHigh = batchTable_getCenterHigh(batchTableIndex);\n\ - vec4 centerLowAndRadius = batchTable_getCenterLowAndRadius(batchTableIndex);\n\ - vec3 centerLow = centerLowAndRadius.xyz;\n\ - float radius = centerLowAndRadius.w;\n\ - vec2 distanceDisplayCondition = batchTable_getDistanceDisplayCondition(batchTableIndex);\n\ -\n\ - float lengthSq;\n\ - if (czm_sceneMode == czm_sceneMode2D)\n\ - {\n\ - lengthSq = czm_eyeHeight2D.y;\n\ - }\n\ - else\n\ - {\n\ - vec4 center = czm_translateRelativeToEye(centerHigh.xyz, centerLow.xyz);\n\ - lengthSq = max(0.0, dot(center.xyz, center.xyz) - radius * radius);\n\ - }\n\ -\n\ - float nearSq = distanceDisplayCondition.x * distanceDisplayCondition.x;\n\ - float farSq = distanceDisplayCondition.y * distanceDisplayCondition.y;\n\ - if (lengthSq < nearSq || lengthSq > farSq)\n\ - {\n\ - show = 0.0;\n\ - }\n\ - #endif\n\ -\n\ - vec4 positionWC = getPolylineWindowCoordinates(p, prev, next, expandDir, width, usePrev, v_polylineAngle);\n\ - gl_Position = czm_viewportOrthographic * positionWC * show;\n\ -\n\ - v_st = vec2(texCoord, clamp(expandDir, 0.0, 1.0));\n\ - v_width = width;\n\ - czm_pickColor = pickColor;\n\ -\n\ -#ifdef LOG_DEPTH\n\ - czm_vertexLogDepth(czm_modelViewProjectionRelativeToEye * p);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/AdditiveBlend.js b/Source/Shaders/PostProcessFilters/AdditiveBlend.js deleted file mode 100644 index 45e2e384560e..000000000000 --- a/Source/Shaders/PostProcessFilters/AdditiveBlend.js +++ /dev/null @@ -1,22 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D u_texture0;\n\ -uniform sampler2D u_texture1;\n\ -\n\ -uniform vec2 u_center;\n\ -uniform float u_radius;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main()\n\ -{\n\ - vec4 color0 = texture2D(u_texture0, v_textureCoordinates);\n\ - vec4 color1 = texture2D(u_texture1, v_textureCoordinates);\n\ - \n\ - float x = length(gl_FragCoord.xy - u_center) / u_radius;\n\ - float t = smoothstep(0.5, 0.8, x);\n\ - gl_FragColor = mix(color0 + color1, color0, t);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/BrightPass.js b/Source/Shaders/PostProcessFilters/BrightPass.js deleted file mode 100644 index 54d1f649dc48..000000000000 --- a/Source/Shaders/PostProcessFilters/BrightPass.js +++ /dev/null @@ -1,35 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D u_texture;\n\ -\n\ -uniform float u_avgLuminance;\n\ -uniform float u_threshold;\n\ -uniform float u_offset;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -float key(float avg)\n\ -{\n\ - float guess = 1.5 - (1.5 / (avg * 0.1 + 1.0));\n\ - return max(0.0, guess) + 0.1;\n\ -}\n\ -\n\ -// See section 9. \"The bright-pass filter\" of Realtime HDR Rendering\n\ -// http://www.cg.tuwien.ac.at/research/publications/2007/Luksch_2007_RHR/Luksch_2007_RHR-RealtimeHDR%20.pdf\n\ -\n\ -void main()\n\ -{\n\ - vec4 color = texture2D(u_texture, v_textureCoordinates);\n\ - vec3 xyz = czm_RGBToXYZ(color.rgb);\n\ - float luminance = xyz.r;\n\ - \n\ - float scaledLum = key(u_avgLuminance) * luminance / u_avgLuminance;\n\ - float brightLum = max(scaledLum - u_threshold, 0.0);\n\ - float brightness = brightLum / (u_offset + brightLum);\n\ - \n\ - xyz.r = brightness;\n\ - gl_FragColor = vec4(czm_XYZToRGB(xyz), 1.0);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/FXAA.js b/Source/Shaders/PostProcessFilters/FXAA.js deleted file mode 100644 index cefbff144e68..000000000000 --- a/Source/Shaders/PostProcessFilters/FXAA.js +++ /dev/null @@ -1,26 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "varying vec2 v_textureCoordinates;\n\ -\n\ -uniform sampler2D u_texture;\n\ -uniform vec2 u_fxaaQualityRcpFrame;\n\ -\n\ -const float fxaaQualitySubpix = 0.5;\n\ -const float fxaaQualityEdgeThreshold = 0.125;\n\ -const float fxaaQualityEdgeThresholdMin = 0.0833;\n\ -\n\ -void main()\n\ -{\n\ - vec4 color = FxaaPixelShader(\n\ - v_textureCoordinates,\n\ - u_texture,\n\ - u_fxaaQualityRcpFrame,\n\ - fxaaQualitySubpix,\n\ - fxaaQualityEdgeThreshold,\n\ - fxaaQualityEdgeThresholdMin);\n\ - float alpha = texture2D(u_texture, v_textureCoordinates).a;\n\ - gl_FragColor = vec4(color.rgb, alpha);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/GaussianBlur1D.js b/Source/Shaders/PostProcessFilters/GaussianBlur1D.js deleted file mode 100644 index 197d9d2cf61d..000000000000 --- a/Source/Shaders/PostProcessFilters/GaussianBlur1D.js +++ /dev/null @@ -1,42 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#define SAMPLES 8\n\ -\n\ -uniform float delta;\n\ -uniform float sigma;\n\ -uniform float direction; // 0.0 for x direction, 1.0 for y direction\n\ -\n\ -uniform sampler2D u_texture;\n\ -uniform vec2 u_step;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -// Incremental Computation of the Gaussian:\n\ -// http://http.developer.nvidia.com/GPUGems3/gpugems3_ch40.html\n\ -\n\ -void main()\n\ -{\n\ - vec2 st = v_textureCoordinates;\n\ - \n\ - vec2 dir = vec2(1.0 - direction, direction);\n\ - \n\ - vec3 g;\n\ - g.x = 1.0 / (sqrt(czm_twoPi) * sigma);\n\ - g.y = exp((-0.5 * delta * delta) / (sigma * sigma));\n\ - g.z = g.y * g.y;\n\ - \n\ - vec4 result = texture2D(u_texture, st) * g.x;\n\ - for (int i = 1; i < SAMPLES; ++i)\n\ - {\n\ - g.xy *= g.yz;\n\ - \n\ - vec2 offset = float(i) * dir * u_step;\n\ - result += texture2D(u_texture, st - offset) * g.x;\n\ - result += texture2D(u_texture, st + offset) * g.x;\n\ - }\n\ - \n\ - gl_FragColor = result;\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/PassThrough.js b/Source/Shaders/PostProcessFilters/PassThrough.js deleted file mode 100644 index 58b2eb36f325..000000000000 --- a/Source/Shaders/PostProcessFilters/PassThrough.js +++ /dev/null @@ -1,13 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D u_texture;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main() \n\ -{\n\ - gl_FragColor = texture2D(u_texture, v_textureCoordinates);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js b/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js deleted file mode 100644 index 2aa3b374a108..000000000000 --- a/Source/Shaders/PostProcessFilters/PointCloudEyeDomeLighting.js +++ /dev/null @@ -1,57 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#extension GL_EXT_frag_depth : enable\n\ -\n\ -uniform sampler2D u_pointCloud_colorTexture;\n\ -uniform sampler2D u_pointCloud_ecAndLogDepthTexture;\n\ -uniform vec3 u_distancesAndEdlStrength;\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -vec2 neighborContribution(float log2Depth, vec2 padding)\n\ -{\n\ - vec2 depthAndLog2Depth = texture2D(u_pointCloud_ecAndLogDepthTexture, v_textureCoordinates + padding).zw;\n\ - if (depthAndLog2Depth.x == 0.0) // 0.0 is the clear value for the gbuffer\n\ - {\n\ - return vec2(0.0); // throw out this sample\n\ - }\n\ - else\n\ - {\n\ - return vec2(max(0.0, log2Depth - depthAndLog2Depth.y), 1.0);\n\ - }\n\ -}\n\ -\n\ -void main()\n\ -{\n\ - vec4 ecAlphaDepth = texture2D(u_pointCloud_ecAndLogDepthTexture, v_textureCoordinates);\n\ - if (length(ecAlphaDepth.xyz) < czm_epsilon7)\n\ - {\n\ - discard;\n\ - }\n\ -\n\ - vec4 color = texture2D(u_pointCloud_colorTexture, v_textureCoordinates);\n\ -\n\ - // sample from neighbors up, down, left, right\n\ - float distX = u_distancesAndEdlStrength.x;\n\ - float distY = u_distancesAndEdlStrength.y;\n\ -\n\ - vec2 responseAndCount = vec2(0.0);\n\ -\n\ - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, distY));\n\ - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(distX, 0));\n\ - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(0, -distY));\n\ - responseAndCount += neighborContribution(ecAlphaDepth.a, vec2(-distX, 0));\n\ -\n\ - float response = responseAndCount.x / responseAndCount.y;\n\ - float shade = exp(-response * 300.0 * u_distancesAndEdlStrength.z);\n\ - color.rgb *= shade;\n\ - gl_FragColor = vec4(color);\n\ -\n\ -#ifdef LOG_DEPTH\n\ - czm_writeLogDepth(1.0 + (czm_projection * vec4(ecAlphaDepth.xyz, 1.0)).w);\n\ -#else\n\ - gl_FragDepthEXT = czm_eyeToWindowCoordinates(vec4(ecAlphaDepth.xyz, 1.0)).z;\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/ReprojectWebMercatorFS.js b/Source/Shaders/ReprojectWebMercatorFS.js deleted file mode 100644 index 90fbe30a768a..000000000000 --- a/Source/Shaders/ReprojectWebMercatorFS.js +++ /dev/null @@ -1,13 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "uniform sampler2D u_texture;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main()\n\ -{\n\ - gl_FragColor = texture2D(u_texture, v_textureCoordinates);\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/ReprojectWebMercatorVS.js b/Source/Shaders/ReprojectWebMercatorVS.js deleted file mode 100644 index 8f7108ac5fb0..000000000000 --- a/Source/Shaders/ReprojectWebMercatorVS.js +++ /dev/null @@ -1,17 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "attribute vec4 position;\n\ -attribute float webMercatorT;\n\ -\n\ -uniform vec2 u_textureDimensions;\n\ -\n\ -varying vec2 v_textureCoordinates;\n\ -\n\ -void main()\n\ -{\n\ - v_textureCoordinates = vec2(position.x, webMercatorT);\n\ - gl_Position = czm_viewportOrthographic * (position * vec4(u_textureDimensions, 1.0, 1.0));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/ShadowVolumeFS.js b/Source/Shaders/ShadowVolumeFS.js deleted file mode 100644 index 0fb4f9c5ee5a..000000000000 --- a/Source/Shaders/ShadowVolumeFS.js +++ /dev/null @@ -1,24 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef GL_EXT_frag_depth\n\ -#extension GL_EXT_frag_depth : enable\n\ -#endif\n\ -\n\ -#ifdef VECTOR_TILE\n\ -uniform vec4 u_highlightColor;\n\ -#else\n\ -varying vec4 v_color;\n\ -#endif\n\ -\n\ -void main(void)\n\ -{\n\ -#ifdef VECTOR_TILE\n\ - gl_FragColor = u_highlightColor;\n\ -#else\n\ - gl_FragColor = v_color;\n\ -#endif\n\ - czm_writeDepthClampedToFarPlane();\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/ShadowVolumeVS.js b/Source/Shaders/ShadowVolumeVS.js deleted file mode 100644 index a9b6e82a22a1..000000000000 --- a/Source/Shaders/ShadowVolumeVS.js +++ /dev/null @@ -1,46 +0,0 @@ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "#ifdef VECTOR_TILE\n\ -attribute vec3 position;\n\ -attribute float a_batchId;\n\ -\n\ -uniform mat4 u_modifiedModelViewProjection;\n\ -#else\n\ -attribute vec3 position3DHigh;\n\ -attribute vec3 position3DLow;\n\ -attribute vec4 color;\n\ -attribute float batchId;\n\ -#endif\n\ -\n\ -#ifdef EXTRUDED_GEOMETRY\n\ -attribute vec3 extrudeDirection;\n\ -\n\ -uniform float u_globeMinimumAltitude;\n\ -#endif\n\ -\n\ -#ifndef VECTOR_TILE\n\ -varying vec4 v_color;\n\ -#endif\n\ -\n\ -void main()\n\ -{\n\ -#ifdef VECTOR_TILE\n\ - gl_Position = czm_depthClampFarPlane(u_modifiedModelViewProjection * vec4(position, 1.0));\n\ -#else\n\ - v_color = color;\n\ -\n\ - vec4 position = czm_computePosition();\n\ -\n\ -#ifdef EXTRUDED_GEOMETRY\n\ - float delta = min(u_globeMinimumAltitude, czm_geometricToleranceOverMeter * length(position.xyz));\n\ - delta *= czm_sceneMode == czm_sceneMode3D ? 1.0 : 0.0;\n\ -\n\ - //extrudeDirection is zero for the top layer\n\ - position = position + vec4(extrudeDirection * delta, 0.0);\n\ -#endif\n\ - gl_Position = czm_depthClampFarPlane(czm_modelViewProjectionRelativeToEye * position);\n\ -#endif\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/SkyAtmosphereFS.js b/Source/Shaders/SkyAtmosphereFS.js deleted file mode 100644 index 7f784aaeafac..000000000000 --- a/Source/Shaders/SkyAtmosphereFS.js +++ /dev/null @@ -1,122 +0,0 @@ -/** - * @license - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Modifications made by Analytical Graphics, Inc. - */ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @license\n\ - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ - * All rights reserved.\n\ - *\n\ - * Redistribution and use in source and binary forms, with or without\n\ - * modification, are permitted provided that the following conditions\n\ - * are met:\n\ - *\n\ - * * Redistributions of source code must retain the above copyright notice,\n\ - * this list of conditions and the following disclaimer.\n\ - * * Redistributions in binary form must reproduce the above copyright notice,\n\ - * this list of conditions and the following disclaimer in the documentation\n\ - * and/or other materials provided with the distribution.\n\ - * * Neither the name of the project nor the names of its contributors may be\n\ - * used to endorse or promote products derived from this software without\n\ - * specific prior written permission.\n\ - *\n\ - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ - *\n\ - * Modifications made by Analytical Graphics, Inc.\n\ - */\n\ -\n\ - // Code: http://sponeil.net/\n\ - // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ -\n\ -#ifdef COLOR_CORRECT\n\ -uniform vec3 u_hsbShift; // Hue, saturation, brightness\n\ -#endif\n\ -\n\ -uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag\n\ -\n\ -const float g = -0.95;\n\ -const float g2 = g * g;\n\ -\n\ -varying vec3 v_rayleighColor;\n\ -varying vec3 v_mieColor;\n\ -varying vec3 v_toCamera;\n\ -varying vec3 v_positionEC;\n\ -\n\ -void main (void)\n\ -{\n\ - // Extra normalize added for Android\n\ - float cosAngle = dot(czm_sunDirectionWC, normalize(v_toCamera)) / length(v_toCamera);\n\ - float rayleighPhase = 0.75 * (1.0 + cosAngle * cosAngle);\n\ - float miePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + cosAngle * cosAngle) / pow(1.0 + g2 - 2.0 * g * cosAngle, 1.5);\n\ -\n\ - const float exposure = 2.0;\n\ -\n\ - vec3 rgb = rayleighPhase * v_rayleighColor + miePhase * v_mieColor;\n\ - rgb = vec3(1.0) - exp(-exposure * rgb);\n\ - // Compute luminance before color correction to avoid strangely gray night skies\n\ - float l = czm_luminance(rgb);\n\ -\n\ -#ifdef COLOR_CORRECT\n\ - // Convert rgb color to hsb\n\ - vec3 hsb = czm_RGBToHSB(rgb);\n\ - // Perform hsb shift\n\ - hsb.x += u_hsbShift.x; // hue\n\ - hsb.y = clamp(hsb.y + u_hsbShift.y, 0.0, 1.0); // saturation\n\ - hsb.z = hsb.z > czm_epsilon7 ? hsb.z + u_hsbShift.z : 0.0; // brightness\n\ - // Convert shifted hsb back to rgb\n\ - rgb = czm_HSBToRGB(hsb);\n\ -\n\ - // Check if correction decreased the luminance to 0\n\ - l = min(l, czm_luminance(rgb));\n\ -#endif\n\ -\n\ - // Alter alpha based on how close the viewer is to the ground (1.0 = on ground, 0.0 = at edge of atmosphere)\n\ - float atmosphereAlpha = clamp((u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.x) / (u_cameraAndRadiiAndDynamicAtmosphereColor.y - u_cameraAndRadiiAndDynamicAtmosphereColor.z), 0.0, 1.0);\n\ -\n\ - // Alter alpha based on time of day (0.0 = night , 1.0 = day)\n\ - float nightAlpha = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? clamp(dot(normalize(czm_viewerPositionWC), normalize(czm_sunPositionWC)), 0.0, 1.0) : 1.0;\n\ - atmosphereAlpha *= pow(nightAlpha, 0.5);\n\ -\n\ - gl_FragColor = vec4(rgb, mix(rgb.b, 1.0, atmosphereAlpha) * smoothstep(0.0, 1.0, czm_morphTime));\n\ -}\n\ -"; -}); \ No newline at end of file diff --git a/Source/Shaders/SkyAtmosphereVS.js b/Source/Shaders/SkyAtmosphereVS.js deleted file mode 100644 index 769037e0f7dc..000000000000 --- a/Source/Shaders/SkyAtmosphereVS.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * @license - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the project nor the names of its contributors may be - * used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Modifications made by Analytical Graphics, Inc. - */ -//This file is automatically rebuilt by the Cesium build process. -define(function() { - 'use strict'; - return "/**\n\ - * @license\n\ - * Copyright (c) 2000-2005, Sean O'Neil (s_p_oneil@hotmail.com)\n\ - * All rights reserved.\n\ - *\n\ - * Redistribution and use in source and binary forms, with or without\n\ - * modification, are permitted provided that the following conditions\n\ - * are met:\n\ - *\n\ - * * Redistributions of source code must retain the above copyright notice,\n\ - * this list of conditions and the following disclaimer.\n\ - * * Redistributions in binary form must reproduce the above copyright notice,\n\ - * this list of conditions and the following disclaimer in the documentation\n\ - * and/or other materials provided with the distribution.\n\ - * * Neither the name of the project nor the names of its contributors may be\n\ - * used to endorse or promote products derived from this software without\n\ - * specific prior written permission.\n\ - *\n\ - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n\ - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n\ - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n\ - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE\n\ - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n\ - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n\ - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n\ - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n\ - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n\ - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\ - *\n\ - * Modifications made by Analytical Graphics, Inc.\n\ - */\n\ -\n\ - // Code: http://sponeil.net/\n\ - // GPU Gems 2 Article: http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html\n\ -\n\ -attribute vec4 position;\n\ -\n\ -uniform vec4 u_cameraAndRadiiAndDynamicAtmosphereColor; // Camera height, outer radius, inner radius, dynamic atmosphere color flag\n\ -\n\ -const float Kr = 0.0025;\n\ -const float Kr4PI = Kr * 4.0 * czm_pi;\n\ -const float Km = 0.0015;\n\ -const float Km4PI = Km * 4.0 * czm_pi;\n\ -const float ESun = 15.0;\n\ -const float KmESun = Km * ESun;\n\ -const float KrESun = Kr * ESun;\n\ -const vec3 InvWavelength = vec3(\n\ - 5.60204474633241, // Red = 1.0 / Math.pow(0.650, 4.0)\n\ - 9.473284437923038, // Green = 1.0 / Math.pow(0.570, 4.0)\n\ - 19.643802610477206); // Blue = 1.0 / Math.pow(0.475, 4.0)\n\ -const float rayleighScaleDepth = 0.25;\n\ -\n\ -const int nSamples = 2;\n\ -const float fSamples = 2.0;\n\ -\n\ -varying vec3 v_rayleighColor;\n\ -varying vec3 v_mieColor;\n\ -varying vec3 v_toCamera;\n\ -\n\ -float scale(float cosAngle)\n\ -{\n\ - float x = 1.0 - cosAngle;\n\ - return rayleighScaleDepth * exp(-0.00287 + x*(0.459 + x*(3.83 + x*(-6.80 + x*5.25))));\n\ -}\n\ -\n\ -void main(void)\n\ -{\n\ - // Unpack attributes\n\ - float cameraHeight = u_cameraAndRadiiAndDynamicAtmosphereColor.x;\n\ - float outerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.y;\n\ - float innerRadius = u_cameraAndRadiiAndDynamicAtmosphereColor.z;\n\ -\n\ - // Get the ray from the camera to the vertex and its length (which is the far point of the ray passing through the atmosphere)\n\ - vec3 positionV3 = position.xyz;\n\ - vec3 ray = positionV3 - czm_viewerPositionWC;\n\ - float far = length(ray);\n\ - ray /= far;\n\ - float atmosphereScale = 1.0 / (outerRadius - innerRadius);\n\ -\n\ -#ifdef SKY_FROM_SPACE\n\ - // Calculate the closest intersection of the ray with the outer atmosphere (which is the near point of the ray passing through the atmosphere)\n\ - float B = 2.0 * dot(czm_viewerPositionWC, ray);\n\ - float C = cameraHeight * cameraHeight - outerRadius * outerRadius;\n\ - float det = max(0.0, B*B - 4.0 * C);\n\ - float near = 0.5 * (-B - sqrt(det));\n\ -\n\ - // Calculate the ray's starting position, then calculate its scattering offset\n\ - vec3 start = czm_viewerPositionWC + ray * near;\n\ - far -= near;\n\ - float startAngle = dot(ray, start) / outerRadius;\n\ - float startDepth = exp(-1.0 / rayleighScaleDepth );\n\ - float startOffset = startDepth*scale(startAngle);\n\ -#else // SKY_FROM_ATMOSPHERE\n\ - // Calculate the ray's starting position, then calculate its scattering offset\n\ - vec3 start = czm_viewerPositionWC;\n\ - float height = length(start);\n\ - float depth = exp((atmosphereScale / rayleighScaleDepth ) * (innerRadius - cameraHeight));\n\ - float startAngle = dot(ray, start) / height;\n\ - float startOffset = depth*scale(startAngle);\n\ -#endif\n\ -\n\ - // Initialize the scattering loop variables\n\ - float sampleLength = far / fSamples;\n\ - float scaledLength = sampleLength * atmosphereScale;\n\ - vec3 sampleRay = ray * sampleLength;\n\ - vec3 samplePoint = start + sampleRay * 0.5;\n\ -\n\ - // Now loop through the sample rays\n\ - vec3 frontColor = vec3(0.0, 0.0, 0.0);\n\ - vec3 lightDir = (u_cameraAndRadiiAndDynamicAtmosphereColor.w > 0.0) ? czm_sunPositionWC - czm_viewerPositionWC : czm_viewerPositionWC;\n\ - lightDir = normalize(lightDir);\n\ -\n\ - for(int i=0; i= edgeVert;\n\ - FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n\ -/*--------------------------------------------------------------------------*/\n\ - if(!horzSpan) lumaN = lumaW;\n\ - if(!horzSpan) lumaS = lumaE;\n\ - if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n\ - FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaFloat gradientN = lumaN - lumaM;\n\ - FxaaFloat gradientS = lumaS - lumaM;\n\ - FxaaFloat lumaNN = lumaN + lumaM;\n\ - FxaaFloat lumaSS = lumaS + lumaM;\n\ - FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n\ - FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n\ - if(pairN) lengthSign = -lengthSign;\n\ - FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaFloat2 posB;\n\ - posB.x = posM.x;\n\ - posB.y = posM.y;\n\ - FxaaFloat2 offNP;\n\ - offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n\ - offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n\ - if(!horzSpan) posB.x += lengthSign * 0.5;\n\ - if( horzSpan) posB.y += lengthSign * 0.5;\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaFloat2 posN;\n\ - posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n\ - posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n\ - FxaaFloat2 posP;\n\ - posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n\ - posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n\ - FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n\ - FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n\ - FxaaFloat subpixE = subpixC * subpixC;\n\ - FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n\ -/*--------------------------------------------------------------------------*/\n\ - if(!pairN) lumaNN = lumaSS;\n\ - FxaaFloat gradientScaled = gradient * 1.0/4.0;\n\ - FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n\ - FxaaFloat subpixF = subpixD * subpixE;\n\ - FxaaBool lumaMLTZero = lumaMM < 0.0;\n\ -/*--------------------------------------------------------------------------*/\n\ - lumaEndN -= lumaNN * 0.5;\n\ - lumaEndP -= lumaNN * 0.5;\n\ - FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n\ - FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n\ - FxaaBool doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n\ -/*--------------------------------------------------------------------------*/\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 3)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 4)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 5)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 6)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 7)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 8)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 9)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 10)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 11)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n\ -/*--------------------------------------------------------------------------*/\n\ - #if (FXAA_QUALITY_PS > 12)\n\ - if(doneNP) {\n\ - if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n\ - if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n\ - if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n\ - if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n\ - doneN = abs(lumaEndN) >= gradientScaled;\n\ - doneP = abs(lumaEndP) >= gradientScaled;\n\ - if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n\ - if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n\ - doneNP = (!doneN) || (!doneP);\n\ - if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n\ - if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ - #endif\n\ -/*--------------------------------------------------------------------------*/\n\ - }\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaFloat dstN = posM.x - posN.x;\n\ - FxaaFloat dstP = posP.x - posM.x;\n\ - if(!horzSpan) dstN = posM.y - posN.y;\n\ - if(!horzSpan) dstP = posP.y - posM.y;\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n\ - FxaaFloat spanLength = (dstP + dstN);\n\ - FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n\ - FxaaFloat spanLengthRcp = 1.0/spanLength;\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaBool directionN = dstN < dstP;\n\ - FxaaFloat dst = min(dstN, dstP);\n\ - FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n\ - FxaaFloat subpixG = subpixF * subpixF;\n\ - FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n\ - FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n\ -/*--------------------------------------------------------------------------*/\n\ - FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n\ - FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n\ - if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n\ - if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n\ - return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n\ -}\n\ -"; -}); \ No newline at end of file From 41f5e159f758d3cbfa33be3f549f329f2607c744 Mon Sep 17 00:00:00 2001 From: Ricardo Morin Date: Mon, 16 Apr 2018 21:54:50 -0700 Subject: [PATCH 084/104] Streamline response decoding --- Source/Core/Resource.js | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index 1275dcdfc8b9..0a5acb168b9f 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1773,6 +1773,17 @@ define([ image.src = url; }; + function decodeResponse(loadWithHttpResponse, responseType) { + switch (responseType) { + case 'text': + return loadWithHttpResponse.toString('utf8'); + case 'json': + return JSON.parse(loadWithHttpResponse.toString('utf8')); + default: + return new Uint8Array(loadWithHttpResponse).buffer; + } + } + function loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType) { // Note: only the 'json' and 'text' responseTypes transforms the loaded buffer var URL = require('url').parse(url); @@ -1804,18 +1815,12 @@ define([ zlib.gunzip(response, function(error, result) { if (error) { deferred.reject(new RuntimeError('Error decompressing response.')); - } else if (responseType === 'json') { - deferred.resolve(JSON.parse(result.toString('utf8'))); - } else if (responseType === 'text') { - deferred.resolve(result.toString('utf8')); } else { - deferred.resolve(new Uint8Array(result).buffer); // Convert Buffer to ArrayBuffer + deferred.resolve(decodeResponse(result, responseType)); } }); - } else if (responseType === 'text') { - deferred.resolve(response.toString('utf8')); } else { - deferred.resolve(responseType === 'json' ? JSON.parse(response.toString('utf8')) : new Uint8Array(response).buffer); + deferred.resolve(decodeResponse(response, responseType)); } }); }); From adc7272e97599642cc39e5535372ab2fa2c2cddc Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Tue, 17 Apr 2018 11:37:25 -0400 Subject: [PATCH 085/104] Fix polyline update and removal bookkeeping Fixes #4983. PolylineCollection stores a list of polylines that are waiting to be updated in the next render pass. However, if a polyline is both updated _and_ removed in the same synchronous execution sequence, _and_ the polyline is near the end of the collection's internal `this._polylines` list, it's possible for the PolylineCollection to effectively read off the end of the array, causing an error "Batch Table instanceIndex out of range". This is resolved by ensuring that removing a polyline from the collection also removes it from the list of polylines waiting to be updated. --- Source/Scene/PolylineCollection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index 936744c6ae0b..7d27e2b55403 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -299,6 +299,12 @@ define([ PolylineCollection.prototype.remove = function(polyline) { if (this.contains(polyline)) { this._polylines[polyline._index] = undefined; // Removed later + + var polylineUpdateIndex = this._polylinesToUpdate.indexOf(polyline); + if(this._polylinesToUpdate.length && polylineUpdateIndex >= 0) { + this._polylinesToUpdate.splice(polylineUpdateIndex, 1); + } + this._polylinesRemoved = true; this._createVertexArray = true; this._createBatchTable = true; From fc66336f5947a6c8509eb72f002d56c164f568ed Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Tue, 17 Apr 2018 11:42:15 -0400 Subject: [PATCH 086/104] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 8f4a15a772c5..c74c73670e4f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,7 @@ Change Log * Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) +* Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) ### 1.44 - 2018-04-02 From 6b08f9cc48e96303afa1ef675b217add7e673439 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Tue, 17 Apr 2018 11:58:37 -0400 Subject: [PATCH 087/104] Add a unit test for removing updated polylines --- Specs/Scene/PolylineCollectionSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Specs/Scene/PolylineCollectionSpec.js b/Specs/Scene/PolylineCollectionSpec.js index ffc2a741e6ea..e5e6f7647959 100644 --- a/Specs/Scene/PolylineCollectionSpec.js +++ b/Specs/Scene/PolylineCollectionSpec.js @@ -328,6 +328,21 @@ defineSuite([ polylines.removeAll(); expect(polylines.length).toEqual(0); }); + + it('removes a polyline from the updated list when removed', function() { + var firstPolyline = polylines.add(); + var secondPolyline = polylines.add(); + + firstPolyline.width = 4; + secondPolyline.width = 5; + + expect(polylines._polylinesToUpdate.length).toEqual(2); + + polylines.remove(secondPolyline); + + expect(polylines._polylinesToUpdate.length).toEqual(1); + }); + it('can check if it contains a polyline', function() { var polyline = polylines.add(); From e14b7b55e7190f30f99c1c899062f79c1836b679 Mon Sep 17 00:00:00 2001 From: Jonathan Puckey Date: Tue, 17 Apr 2018 18:14:29 +0200 Subject: [PATCH 088/104] Remove unused import Closes #6456. --- Source/Scene/Globe.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index 456d5a30aecd..29b77bbac8f5 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -24,7 +24,6 @@ define([ './GlobeSurfaceShaderSet', './GlobeSurfaceTileProvider', './ImageryLayerCollection', - './Material', './QuadtreePrimitive', './SceneMode', './ShadowMode' @@ -54,7 +53,6 @@ define([ GlobeSurfaceShaderSet, GlobeSurfaceTileProvider, ImageryLayerCollection, - Material, QuadtreePrimitive, SceneMode, ShadowMode) { From 855f849b8f4e730cc2bc479870cad5ea45d1aefa Mon Sep 17 00:00:00 2001 From: Hannah Date: Tue, 17 Apr 2018 13:17:33 -0400 Subject: [PATCH 089/104] Update CONTRIBUTORS.md --- CONTRIBUTORS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e353d1f610ee..b298aa129217 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -177,3 +177,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Tamar Cohen](https://github.com/tamarmot) * [Stephen Wiseman](https://github.com/srwiseman) * [Gabriel Macario](https://github.com/gabriel-macario) +* [Jonathan Puckey](https://github.com/puckey) From a3d525dd7e4dc9d3b14d73922d4e3228f482d736 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Tue, 17 Apr 2018 14:30:09 -0400 Subject: [PATCH 090/104] Fix lint errors and add myself to CONTRIBUTORS --- CONTRIBUTORS.md | 1 + Source/Scene/PolylineCollection.js | 4 ++-- Specs/Scene/PolylineCollectionSpec.js | 3 +-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e353d1f610ee..93075222c379 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -177,3 +177,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Tamar Cohen](https://github.com/tamarmot) * [Stephen Wiseman](https://github.com/srwiseman) * [Gabriel Macario](https://github.com/gabriel-macario) +* [Mark Erikson](https://github.com/markerikson) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index 7d27e2b55403..ade867e17c13 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -299,12 +299,12 @@ define([ PolylineCollection.prototype.remove = function(polyline) { if (this.contains(polyline)) { this._polylines[polyline._index] = undefined; // Removed later - + var polylineUpdateIndex = this._polylinesToUpdate.indexOf(polyline); if(this._polylinesToUpdate.length && polylineUpdateIndex >= 0) { this._polylinesToUpdate.splice(polylineUpdateIndex, 1); } - + this._polylinesRemoved = true; this._createVertexArray = true; this._createBatchTable = true; diff --git a/Specs/Scene/PolylineCollectionSpec.js b/Specs/Scene/PolylineCollectionSpec.js index e5e6f7647959..dfd311ab0030 100644 --- a/Specs/Scene/PolylineCollectionSpec.js +++ b/Specs/Scene/PolylineCollectionSpec.js @@ -328,7 +328,7 @@ defineSuite([ polylines.removeAll(); expect(polylines.length).toEqual(0); }); - + it('removes a polyline from the updated list when removed', function() { var firstPolyline = polylines.add(); var secondPolyline = polylines.add(); @@ -343,7 +343,6 @@ defineSuite([ expect(polylines._polylinesToUpdate.length).toEqual(1); }); - it('can check if it contains a polyline', function() { var polyline = polylines.add(); From 64a9e62a7e9730a1ed0775c09f63a05edaf8f1b6 Mon Sep 17 00:00:00 2001 From: puckey Date: Wed, 18 Apr 2018 15:17:22 +0200 Subject: [PATCH 091/104] Fix docs --- Source/Scene/BillboardCollection.js | 4 ++-- Source/Scene/LabelCollection.js | 4 ++-- Source/Scene/PointPrimitiveCollection.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Scene/BillboardCollection.js b/Source/Scene/BillboardCollection.js index 5a17cddcf2bb..fa1a9fdeb729 100644 --- a/Source/Scene/BillboardCollection.js +++ b/Source/Scene/BillboardCollection.js @@ -139,7 +139,7 @@ define([ * @param {Scene} [options.scene] Must be passed in for billboards that use the height reference property or will be depth tested against the globe. * @param {BlendOption} [options.blendOption=BlendOption.OPAQUE_AND_TRANSLUCENT] The billboard blending option. The default * is used for rendering both opaque and translucent billboards. However, if either all of the billboards are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve performance by up to 2x. + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x. * * @performance For best performance, prefer a few collections, each with many billboards, to * many collections with only a few billboards each. Organize collections so that billboards @@ -285,7 +285,7 @@ define([ /** * The billboard blending option. The default is used for rendering both opaque and translucent billboards. * However, if either all of the billboards are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve * performance by up to 2x. * @type {BlendOption} * @default BlendOption.OPAQUE_AND_TRANSLUCENT diff --git a/Source/Scene/LabelCollection.js b/Source/Scene/LabelCollection.js index 0d88e4d859cb..003fef9cc685 100644 --- a/Source/Scene/LabelCollection.js +++ b/Source/Scene/LabelCollection.js @@ -450,7 +450,7 @@ define([ * @param {Scene} [options.scene] Must be passed in for labels that use the height reference property or will be depth tested against the globe. * @param {BlendOption} [options.blendOption=BlendOption.OPAQUE_AND_TRANSLUCENT] The label blending option. The default * is used for rendering both opaque and translucent labels. However, if either all of the labels are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve performance by up to 2x. + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x. * * @performance For best performance, prefer a few collections, each with many labels, to * many collections with only a few labels each. Avoid having collections where some @@ -552,7 +552,7 @@ define([ /** * The label blending option. The default is used for rendering both opaque and translucent labels. * However, if either all of the labels are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve * performance by up to 2x. * @type {BlendOption} * @default BlendOption.OPAQUE_AND_TRANSLUCENT diff --git a/Source/Scene/PointPrimitiveCollection.js b/Source/Scene/PointPrimitiveCollection.js index 6ef137937a75..5f27900f6914 100644 --- a/Source/Scene/PointPrimitiveCollection.js +++ b/Source/Scene/PointPrimitiveCollection.js @@ -91,7 +91,7 @@ define([ * @param {Boolean} [options.debugShowBoundingVolume=false] For debugging only. Determines if this primitive's commands' bounding spheres are shown. * @param {BlendOption} [options.blendOption=BlendOption.OPAQUE_AND_TRANSLUCENT] The point blending option. The default * is used for rendering both opaque and translucent points. However, if either all of the points are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve performance by up to 2x. + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve performance by up to 2x. * * @performance For best performance, prefer a few collections, each with many points, to * many collections with only a few points each. Organize collections so that points @@ -211,7 +211,7 @@ define([ /** * The point blending option. The default is used for rendering both opaque and translucent points. * However, if either all of the points are completely opaque or all are completely translucent, - * setting the technique to BillboardRenderTechnique.OPAQUE or BillboardRenderTechnique.TRANSLUCENT can improve + * setting the technique to BlendOption.OPAQUE or BlendOption.TRANSLUCENT can improve * performance by up to 2x. * @type {BlendOption} * @default BlendOption.OPAQUE_AND_TRANSLUCENT From 10f66647db6b5444032970795e2a16adc3df5f54 Mon Sep 17 00:00:00 2001 From: Hannah Date: Wed, 18 Apr 2018 11:25:01 -0400 Subject: [PATCH 092/104] Update CHANGES.md --- CHANGES.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index c74c73670e4f..a616603db3e4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,9 +22,10 @@ Change Log * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) * Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) +* Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) + ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) -* Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) ### 1.44 - 2018-04-02 From 2adcdbd3ab586edd5ef8459538225d9f627b5d59 Mon Sep 17 00:00:00 2001 From: Hannah Date: Wed, 18 Apr 2018 11:26:35 -0400 Subject: [PATCH 093/104] Update PolylineCollection.js --- Source/Scene/PolylineCollection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index ade867e17c13..3404930bb870 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -301,7 +301,7 @@ define([ this._polylines[polyline._index] = undefined; // Removed later var polylineUpdateIndex = this._polylinesToUpdate.indexOf(polyline); - if(this._polylinesToUpdate.length && polylineUpdateIndex >= 0) { + if (polylineUpdateIndex !== -1) { this._polylinesToUpdate.splice(polylineUpdateIndex, 1); } From d057345b3d2dde89876e8a692b6b83fe9636b1f6 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Wed, 18 Apr 2018 11:51:59 -0400 Subject: [PATCH 094/104] Improve Node.js support 1. Add `FeatureDetection.isNodeJs` 2. Improve getAbsoluteUri under node. 3. Some additional clean up for Node-specific Resource path. --- Source/Core/FeatureDetection.js | 9 +++++ Source/Core/Resource.js | 61 +++++++++++++++--------------- Source/Core/getAbsoluteUri.js | 23 +++++++---- Specs/Core/FeatureDetectionSpec.js | 4 ++ 4 files changed, 58 insertions(+), 39 deletions(-) diff --git a/Source/Core/FeatureDetection.js b/Source/Core/FeatureDetection.js index 1d9ee2a17224..ec217f9b3f5a 100644 --- a/Source/Core/FeatureDetection.js +++ b/Source/Core/FeatureDetection.js @@ -163,6 +163,14 @@ define([ return isFirefox() && firefoxVersionResult; } + var isNodeJsResult; + function isNodeJs() { + if (!defined(isNodeJsResult)) { + isNodeJsResult = typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]'; // eslint-disable-line + } + return isNodeJsResult; + } + var hasPointerEvents; function supportsPointerEvents() { if (!defined(hasPointerEvents)) { @@ -230,6 +238,7 @@ define([ isFirefox : isFirefox, firefoxVersion : firefoxVersion, isWindows : isWindows, + isNodeJs: isNodeJs, hardwareConcurrency : defaultValue(theNavigator.hardwareConcurrency, 3), supportsPointerEvents : supportsPointerEvents, supportsImageRenderingPixelated: supportsImageRenderingPixelated, diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index 0a5acb168b9f..f504941b354a 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1,4 +1,3 @@ -/*globals process, require, Buffer*/ define([ '../ThirdParty/Uri', '../ThirdParty/when', @@ -11,6 +10,7 @@ define([ './defineProperties', './deprecationWarning', './DeveloperError', + './FeatureDetection', './freezeObject', './getAbsoluteUri', './getBaseUri', @@ -38,6 +38,7 @@ define([ defineProperties, deprecationWarning, DeveloperError, + FeatureDetection, freezeObject, getAbsoluteUri, getBaseUri, @@ -1787,7 +1788,7 @@ define([ function loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType) { // Note: only the 'json' and 'text' responseTypes transforms the loaded buffer var URL = require('url').parse(url); - var http_s = URL.protocol === 'https:' ? require('https') : require('http'); + var http = URL.protocol === 'https:' ? require('https') : require('http'); var zlib = require('zlib'); var options = { protocol : URL.protocol, @@ -1799,37 +1800,35 @@ define([ headers : headers }; - var req = http_s.request(options, function(res) { - if (res.statusCode < 200 || res.statusCode >= 300) { - deferred.reject(new RequestErrorEvent(res.statusCode, res, res.headers)); - return; - } - - var chunkArray = []; // Array of buffers to receive the response - res.on('data', function(chunk) { - chunkArray.push(chunk); - }); - res.on('end', function() { - var response = Buffer.concat(chunkArray); // Concatenate all buffers - if (res.headers['content-encoding'] === 'gzip') { // Must deal with decompression - zlib.gunzip(response, function(error, result) { - if (error) { - deferred.reject(new RuntimeError('Error decompressing response.')); - } else { - deferred.resolve(decodeResponse(result, responseType)); - } - }); - } else { - deferred.resolve(decodeResponse(response, responseType)); + http.request(options) + .on('response', function(res) { + if (res.statusCode < 200 || res.statusCode >= 300) { + deferred.reject(new RequestErrorEvent(res.statusCode, res, res.headers)); + return; } - }); - }); - req.end(); + var chunkArray = []; + res.on('data', function(chunk) { + chunkArray.push(chunk); + }); - req.on('error', function(e) { - deferred.reject(new RequestErrorEvent()); - }); + res.on('end', function() { + var result = Buffer.concat(chunkArray); // eslint-disable-line + if (res.headers['content-encoding'] === 'gzip') { + zlib.gunzip(result, function(error, resultUnzipped) { + if (error) { + deferred.reject(new RuntimeError('Error decompressing response.')); + } else { + deferred.resolve(decodeResponse(resultUnzipped, responseType)); + } + }); + } else { + deferred.resolve(decodeResponse(result, responseType)); + } + }); + }).on('error', function(e) { + deferred.reject(new RequestErrorEvent()); + }).end(); } Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) { @@ -1839,7 +1838,7 @@ define([ return; } - if (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]') { + if (FeatureDetection.isNodeJs()) { loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType); return; } diff --git a/Source/Core/getAbsoluteUri.js b/Source/Core/getAbsoluteUri.js index 11710b65a9d5..36dab6f1b1d8 100644 --- a/Source/Core/getAbsoluteUri.js +++ b/Source/Core/getAbsoluteUri.js @@ -1,4 +1,3 @@ -/*globals process, require*/ define([ '../ThirdParty/Uri', './defaultValue', @@ -23,13 +22,14 @@ define([ * //absolute Uri will be "https://test.com/awesome.png"; * var absoluteUri = Cesium.getAbsoluteUri('awesome.png', 'https://test.com'); */ - function getAbsoluteUri(relative, base) { - if (typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]') { - // Running node - return getAbsoluteUri._implementation(relative, base, {baseURI: 'http://localhost/', location: {href: ''}}); + function getAbsoluteUri(relative, base) { + var documentObject; + if (typeof document !== 'undefined') { + documentObject = document; } - return getAbsoluteUri._implementation(relative, base, document); - } + + return getAbsoluteUri._implementation(relative, base, documentObject); + } getAbsoluteUri._implementation = function(relative, base, documentObject) { //>>includeStart('debug', pragmas.debug); @@ -37,7 +37,14 @@ define([ throw new DeveloperError('relative uri is required.'); } //>>includeEnd('debug'); - base = defaultValue(base, defaultValue(documentObject.baseURI, documentObject.location.href)); + + if (!defined(base)) { + if (typeof documentObject === 'undefined') { + return relative; + } + base = defaultValue(documentObject.baseURI, documentObject.location.href); + } + var baseUri = new Uri(base); var relativeUri = new Uri(relative); return relativeUri.resolve(baseUri).toString(); diff --git a/Specs/Core/FeatureDetectionSpec.js b/Specs/Core/FeatureDetectionSpec.js index f043252950f8..ab29081a6d64 100644 --- a/Specs/Core/FeatureDetectionSpec.js +++ b/Specs/Core/FeatureDetectionSpec.js @@ -110,4 +110,8 @@ defineSuite([ expect(FeatureDetection.imageRenderingValue()).not.toBeDefined(); } }); + + it('detects Node.js', function() { + expect(FeatureDetection.isNodeJs()).toBe(false); + }); }); From 3dd913037ece54d173b0cb0b6b453afac66cabec Mon Sep 17 00:00:00 2001 From: Kangning Li Date: Wed, 18 Apr 2018 14:59:13 -0400 Subject: [PATCH 095/104] fix ClassificationPrimitive bug with log depth, fix log depth in CHANGES.md --- CHANGES.md | 2 +- Source/Scene/ClassificationPrimitive.js | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8f4a15a772c5..bbb247f6ae54 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,7 +7,7 @@ Change Log * `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. ##### Additions :tada: -* Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) +* Added option `logarithmicDepthBuffer` to `Scene`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) * When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. * Added `Math.log2` to compute the base 2 logarithm of a number. * Added 'PeliasGeocoderService', which provides geocoding via a [Pelias](https://pelias.io) server. diff --git a/Source/Scene/ClassificationPrimitive.js b/Source/Scene/ClassificationPrimitive.js index 5f80e7e0eb40..5252f357f8e8 100644 --- a/Source/Scene/ClassificationPrimitive.js +++ b/Source/Scene/ClassificationPrimitive.js @@ -527,9 +527,13 @@ define([ } var extrudedDefine = classificationPrimitive._extruded ? 'EXTRUDED_GEOMETRY' : ''; + // Tesselation on ClassificationPrimitives tends to be low, + // which causes problems when interpolating log depth from vertices. + // So force computing and writing logarithmic depth in the fragment shader. + var disableGlPositionLogDepth = 'DISABLE_GL_POSITION_LOG_DEPTH'; var vsSource = new ShaderSource({ - defines : [extrudedDefine], + defines : [extrudedDefine, disableGlPositionLogDepth], sources : [vs] }); var fsSource = new ShaderSource({ @@ -551,7 +555,7 @@ define([ vsPick = Primitive._updatePickColorAttribute(vsPick); var pickVS = new ShaderSource({ - defines : [extrudedDefine], + defines : [extrudedDefine, disableGlPositionLogDepth], sources : [vsPick] }); @@ -578,7 +582,7 @@ define([ vs = Primitive._appendShowToShader(primitive, vs); vsSource = new ShaderSource({ - defines : [extrudedDefine], + defines : [extrudedDefine, disableGlPositionLogDepth], sources : [vs] }); From 07369991f225cc6dfcee7518a2477ebc78683541 Mon Sep 17 00:00:00 2001 From: Dan Bagnell Date: Wed, 18 Apr 2018 16:59:10 -0400 Subject: [PATCH 096/104] Revert change to make distance to bounding sphere signed. --- CHANGES.md | 4 +--- Source/Scene/Camera.js | 16 ++++------------ 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 34607c3ed702..b2414c010bab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,9 +3,6 @@ Change Log ### 1.45 - 2018-05-01 -##### Breaking Changes :mega: -* `Camera.distanceToBoundingSphere` now returns the signed distance to the bounding sphere. Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. - ##### Additions :tada: * Added option `logDepthBuffer` to `Viewer`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) * When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. @@ -20,6 +17,7 @@ Change Log * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) * Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) + ##### Additions :tada: * Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) diff --git a/Source/Scene/Camera.js b/Source/Scene/Camera.js index dd98dd2a8c35..50b48178c9d3 100644 --- a/Source/Scene/Camera.js +++ b/Source/Scene/Camera.js @@ -2574,13 +2574,10 @@ define([ var scratchProj = new Cartesian3(); /** - * Return the signed distance from the camera to the front of the bounding sphere. - *

- * Positive values indicate that the bounding sphere is in the positive half-plane of the camera position and view direction while a negative value indicates it is in the negative half-plane. - *

+ * Return the distance from the camera to the front of the bounding sphere. * * @param {BoundingSphere} boundingSphere The bounding sphere in world coordinates. - * @returns {Number} The signed distance to the bounding sphere. + * @returns {Number} The distance to the bounding sphere. */ Camera.prototype.distanceToBoundingSphere = function(boundingSphere) { //>>includeStart('debug', pragmas.debug); @@ -2590,10 +2587,8 @@ define([ //>>includeEnd('debug'); var toCenter = Cartesian3.subtract(this.positionWC, boundingSphere.center, scratchToCenter); - var distance = -Cartesian3.dot(toCenter, this.directionWC); - var proj = Cartesian3.multiplyByScalar(this.directionWC, distance, scratchProj); - var unsignedDistance = Math.abs(Cartesian3.magnitude(proj) - boundingSphere.radius); - return distance < 0.0 ? -unsignedDistance : unsignedDistance; + var proj = Cartesian3.multiplyByScalar(this.directionWC, Cartesian3.dot(toCenter, this.directionWC), scratchProj); + return Math.max(0.0, Cartesian3.magnitude(proj) - boundingSphere.radius); }; var scratchPixelSize = new Cartesian2(); @@ -2620,9 +2615,6 @@ define([ //>>includeEnd('debug'); var distance = this.distanceToBoundingSphere(boundingSphere); - if (distance < 0.0) { - return 0.0; - } var pixelSize = this.frustum.getPixelDimensions(drawingBufferWidth, drawingBufferHeight, distance, scratchPixelSize); return Math.max(pixelSize.x, pixelSize.y); }; From 46512c7008f003f73a2c268b503cbb098db1a616 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Thu, 19 Apr 2018 18:30:39 -0400 Subject: [PATCH 097/104] Allow Resource.delete to send data --- Source/Core/Resource.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index f504941b354a..682824d71745 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1446,7 +1446,8 @@ define([ return resource.delete({ // Make copy of just the needed fields because headers can be passed to both the constructor and to fetch responseType: options.responseType, - overrideMimeType: options.overrideMimeType + overrideMimeType: options.overrideMimeType, + data: options.data }); }; From e3d167e549a249747c6ecfa7d95c3cbf9a77b478 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Fri, 20 Apr 2018 10:05:46 -0400 Subject: [PATCH 098/104] doc --- Source/Core/Resource.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index 682824d71745..5fc104794dd4 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1430,6 +1430,7 @@ define([ * * @param {String|Object} options A url or an object with the following properties * @param {String} options.url The url of the resource. + * @param {Object} [options.data] Data that is posted with the resource. * @param {Object} [options.queryParameters] An object containing query parameters that will be sent when retrieving the resource. * @param {Object} [options.templateValues] Key/Value pairs that are used to replace template values (eg. {x}). * @param {Object} [options.headers={}] Additional HTTP headers that will be sent. @@ -1571,6 +1572,7 @@ define([ * * @param {Object} data Data that is posted with the resource. * @param {Object} [options] Object with the following properties: + * @param {Object} [options.data] Data that is posted with the resource. * @param {String} [options.responseType] The type of response. This controls the type of item returned. * @param {Object} [options.headers] Additional HTTP headers to send with the request, if any. * @param {String} [options.overrideMimeType] Overrides the MIME type returned by the server. From 0b282953d1c679094dc4e7b25a9f9f78bb742452 Mon Sep 17 00:00:00 2001 From: puckey Date: Fri, 20 Apr 2018 16:42:49 +0200 Subject: [PATCH 099/104] remove unused imports --- Source/Core/EllipseGeometry.js | 4 ---- Source/Core/GoogleEarthEnterpriseMetadata.js | 2 -- Source/Core/PlaneOutlineGeometry.js | 2 -- Source/Core/arraySlice.js | 2 -- Source/Core/buildModuleUrl.js | 2 -- Source/Core/getTimestamp.js | 5 +--- Source/Core/sampleTerrain.js | 6 ++--- Source/DataSources/DataSourceDisplay.js | 2 -- Source/DataSources/DynamicGeometryBatch.js | 22 ++--------------- Source/DataSources/GeometryVisualizer.js | 2 -- Source/DataSources/PolylineVisualizer.js | 2 -- Source/Scene/Cesium3DTile.js | 2 -- Source/Scene/Cesium3DTilePointFeature.js | 4 ---- Source/Scene/Cesium3DTileset.js | 8 ------- Source/Scene/ClippingPlaneCollection.js | 4 ---- Source/Scene/DracoLoader.js | 4 ---- Source/Scene/GlobeSurfaceShaderSet.js | 2 -- Source/Scene/GlobeSurfaceTileProvider.js | 2 -- Source/Scene/IonImageryProvider.js | 6 ----- Source/Scene/PointCloudEyeDomeLighting.js | 24 ------------------- Source/Scene/Scene.js | 2 -- Source/Scene/UrlTemplateImageryProvider.js | 2 -- Source/Scene/Vector3DTilePolygons.js | 2 -- Source/Scene/WebMapServiceImageryProvider.js | 8 ------- .../Scene/WebMapTileServiceImageryProvider.js | 6 ----- .../createOpenStreetMapImageryProvider.js | 2 -- Source/Widgets/Viewer/Viewer.js | 2 -- Source/Workers/createVectorTileGeometries.js | 2 -- Source/Workers/createVectorTilePolygons.js | 8 ------- 29 files changed, 5 insertions(+), 136 deletions(-) diff --git a/Source/Core/EllipseGeometry.js b/Source/Core/EllipseGeometry.js index dafb6bfcb6ab..416884bfaf90 100644 --- a/Source/Core/EllipseGeometry.js +++ b/Source/Core/EllipseGeometry.js @@ -19,11 +19,9 @@ define([ './IndexDatatype', './Math', './Matrix3', - './Matrix4', './PrimitiveType', './Quaternion', './Rectangle', - './Transforms', './VertexFormat' ], function( BoundingSphere, @@ -46,11 +44,9 @@ define([ IndexDatatype, CesiumMath, Matrix3, - Matrix4, PrimitiveType, Quaternion, Rectangle, - Transforms, VertexFormat) { 'use strict'; diff --git a/Source/Core/GoogleEarthEnterpriseMetadata.js b/Source/Core/GoogleEarthEnterpriseMetadata.js index 66a43f6f55a1..32fc531a5387 100644 --- a/Source/Core/GoogleEarthEnterpriseMetadata.js +++ b/Source/Core/GoogleEarthEnterpriseMetadata.js @@ -1,7 +1,6 @@ define([ '../ThirdParty/google-earth-dbroot-parser', '../ThirdParty/when', - './appendForwardSlash', './Check', './Credit', './defaultValue', @@ -17,7 +16,6 @@ define([ ], function( dbrootParser, when, - appendForwardSlash, Check, Credit, defaultValue, diff --git a/Source/Core/PlaneOutlineGeometry.js b/Source/Core/PlaneOutlineGeometry.js index 22513cb376f0..aefd3de4b3a9 100644 --- a/Source/Core/PlaneOutlineGeometry.js +++ b/Source/Core/PlaneOutlineGeometry.js @@ -3,7 +3,6 @@ define([ './Cartesian3', './Check', './ComponentDatatype', - './defaultValue', './defined', './Geometry', './GeometryAttribute', @@ -14,7 +13,6 @@ define([ Cartesian3, Check, ComponentDatatype, - defaultValue, defined, Geometry, GeometryAttribute, diff --git a/Source/Core/arraySlice.js b/Source/Core/arraySlice.js index a8f0e03b1b9c..4e8d64438adf 100644 --- a/Source/Core/arraySlice.js +++ b/Source/Core/arraySlice.js @@ -1,11 +1,9 @@ define([ './Check', - './defaultValue', './defined', './FeatureDetection' ], function( Check, - defaultValue, defined, FeatureDetection) { 'use strict'; diff --git a/Source/Core/buildModuleUrl.js b/Source/Core/buildModuleUrl.js index f7a02abe982c..78f468f70f1e 100644 --- a/Source/Core/buildModuleUrl.js +++ b/Source/Core/buildModuleUrl.js @@ -1,11 +1,9 @@ define([ - '../ThirdParty/Uri', './defined', './DeveloperError', './Resource', 'require' ], function( - Uri, defined, DeveloperError, Resource, diff --git a/Source/Core/getTimestamp.js b/Source/Core/getTimestamp.js index 4495559e036d..82b9e92edd0f 100644 --- a/Source/Core/getTimestamp.js +++ b/Source/Core/getTimestamp.js @@ -1,7 +1,4 @@ -define([ - './defined' - ], function( - defined) { +define(function() { 'use strict'; /*global performance*/ diff --git a/Source/Core/sampleTerrain.js b/Source/Core/sampleTerrain.js index fe697888dac5..d28c85469b5a 100644 --- a/Source/Core/sampleTerrain.js +++ b/Source/Core/sampleTerrain.js @@ -1,11 +1,9 @@ define([ '../ThirdParty/when', - './Check', - './defined' + './Check' ], function( when, - Check, - defined) { + Check) { 'use strict'; /** diff --git a/Source/DataSources/DataSourceDisplay.js b/Source/DataSources/DataSourceDisplay.js index ba4d35735f06..0a4a1bc51363 100644 --- a/Source/DataSources/DataSourceDisplay.js +++ b/Source/DataSources/DataSourceDisplay.js @@ -5,7 +5,6 @@ define([ '../Core/defined', '../Core/defineProperties', '../Core/destroyObject', - '../Core/DeveloperError', '../Core/EventHelper', '../Scene/GroundPrimitive', '../Scene/PrimitiveCollection', @@ -25,7 +24,6 @@ define([ defined, defineProperties, destroyObject, - DeveloperError, EventHelper, GroundPrimitive, PrimitiveCollection, diff --git a/Source/DataSources/DynamicGeometryBatch.js b/Source/DataSources/DynamicGeometryBatch.js index efa761c7043b..800577bdd5c5 100644 --- a/Source/DataSources/DynamicGeometryBatch.js +++ b/Source/DataSources/DynamicGeometryBatch.js @@ -1,29 +1,11 @@ define([ '../Core/AssociativeArray', - '../Core/Color', - '../Core/ColorGeometryInstanceAttribute', '../Core/defined', - '../Core/DistanceDisplayCondition', - '../Core/DistanceDisplayConditionGeometryInstanceAttribute', - '../Core/ShowGeometryInstanceAttribute', - '../Scene/Primitive', - './BoundingSphereState', - './ColorMaterialProperty', - './MaterialProperty', - './Property' + './BoundingSphereState' ], function( AssociativeArray, - Color, - ColorGeometryInstanceAttribute, defined, - DistanceDisplayCondition, - DistanceDisplayConditionGeometryInstanceAttribute, - ShowGeometryInstanceAttribute, - Primitive, - BoundingSphereState, - ColorMaterialProperty, - MaterialProperty, - Property) { + BoundingSphereState) { 'use strict'; /** diff --git a/Source/DataSources/GeometryVisualizer.js b/Source/DataSources/GeometryVisualizer.js index 72ed71a89100..0ef53d74fc83 100644 --- a/Source/DataSources/GeometryVisualizer.js +++ b/Source/DataSources/GeometryVisualizer.js @@ -5,7 +5,6 @@ define([ '../Core/defaultValue', '../Core/defined', '../Core/destroyObject', - '../Core/DeveloperError', '../Core/Event', '../Core/EventHelper', '../Scene/ClassificationType', @@ -36,7 +35,6 @@ define([ defaultValue, defined, destroyObject, - DeveloperError, Event, EventHelper, ClassificationType, diff --git a/Source/DataSources/PolylineVisualizer.js b/Source/DataSources/PolylineVisualizer.js index b381d2451d51..f36794bbf58c 100644 --- a/Source/DataSources/PolylineVisualizer.js +++ b/Source/DataSources/PolylineVisualizer.js @@ -4,7 +4,6 @@ define([ '../Core/Check', '../Core/defined', '../Core/destroyObject', - '../Core/DeveloperError', '../Scene/PolylineColorAppearance', '../Scene/PolylineMaterialAppearance', '../Scene/ShadowMode', @@ -20,7 +19,6 @@ define([ Check, defined, destroyObject, - DeveloperError, PolylineColorAppearance, PolylineMaterialAppearance, ShadowMode, diff --git a/Source/Scene/Cesium3DTile.js b/Source/Scene/Cesium3DTile.js index 18101211d979..4db63e773db0 100644 --- a/Source/Scene/Cesium3DTile.js +++ b/Source/Scene/Cesium3DTile.js @@ -13,7 +13,6 @@ define([ '../Core/JulianDate', '../Core/Matrix3', '../Core/Matrix4', - '../Core/Plane', '../Core/Rectangle', '../Core/Request', '../Core/RequestScheduler', @@ -47,7 +46,6 @@ define([ JulianDate, Matrix3, Matrix4, - Plane, Rectangle, Request, RequestScheduler, diff --git a/Source/Scene/Cesium3DTilePointFeature.js b/Source/Scene/Cesium3DTilePointFeature.js index 26037ab17f17..b3103280d26c 100644 --- a/Source/Scene/Cesium3DTilePointFeature.js +++ b/Source/Scene/Cesium3DTilePointFeature.js @@ -1,20 +1,16 @@ define([ - '../Core/Cartesian3', '../Core/Cartographic', '../Core/Color', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', - '../Core/Ellipsoid', './createBillboardPointCallback' ], function( - Cartesian3, Cartographic, Color, defaultValue, defined, defineProperties, - Ellipsoid, createBillboardPointCallback) { 'use strict'; diff --git a/Source/Scene/Cesium3DTileset.js b/Source/Scene/Cesium3DTileset.js index 951a50829721..4135bdc83490 100644 --- a/Source/Scene/Cesium3DTileset.js +++ b/Source/Scene/Cesium3DTileset.js @@ -12,10 +12,7 @@ define([ '../Core/DoublyLinkedList', '../Core/Ellipsoid', '../Core/Event', - '../Core/getBaseUri', - '../Core/getExtensionFromUri', '../Core/getMagic', - '../Core/isDataUri', '../Core/JulianDate', '../Core/ManagedArray', '../Core/Math', @@ -33,7 +30,6 @@ define([ './Cesium3DTilesetStatistics', './Cesium3DTilesetTraversal', './Cesium3DTileStyleEngine', - './ClassificationType', './ClippingPlaneCollection', './LabelCollection', './PointCloudEyeDomeLighting', @@ -57,10 +53,7 @@ define([ DoublyLinkedList, Ellipsoid, Event, - getBaseUri, - getExtensionFromUri, getMagic, - isDataUri, JulianDate, ManagedArray, CesiumMath, @@ -78,7 +71,6 @@ define([ Cesium3DTilesetStatistics, Cesium3DTilesetTraversal, Cesium3DTileStyleEngine, - ClassificationType, ClippingPlaneCollection, LabelCollection, PointCloudEyeDomeLighting, diff --git a/Source/Scene/ClippingPlaneCollection.js b/Source/Scene/ClippingPlaneCollection.js index d49db4ca419a..cec56ad07eea 100644 --- a/Source/Scene/ClippingPlaneCollection.js +++ b/Source/Scene/ClippingPlaneCollection.js @@ -11,9 +11,7 @@ define([ '../Core/deprecationWarning', '../Core/destroyObject', '../Core/DeveloperError', - '../Core/FeatureDetection', '../Core/Intersect', - '../Core/Math', '../Core/Matrix4', '../Core/PixelFormat', '../Core/Plane', @@ -38,9 +36,7 @@ define([ deprecationWarning, destroyObject, DeveloperError, - FeatureDetection, Intersect, - CesiumMath, Matrix4, PixelFormat, Plane, diff --git a/Source/Scene/DracoLoader.js b/Source/Scene/DracoLoader.js index 2951bbcb862c..25a75f56554d 100644 --- a/Source/Scene/DracoLoader.js +++ b/Source/Scene/DracoLoader.js @@ -5,8 +5,6 @@ define([ '../Core/FeatureDetection', '../Core/RuntimeError', '../Core/TaskProcessor', - '../Renderer/Buffer', - '../Renderer/BufferUsage', '../ThirdParty/GltfPipeline/ForEach', '../ThirdParty/when' ], function( @@ -16,8 +14,6 @@ define([ FeatureDetection, RuntimeError, TaskProcessor, - Buffer, - BufferUsage, ForEach, when) { 'use strict'; diff --git a/Source/Scene/GlobeSurfaceShaderSet.js b/Source/Scene/GlobeSurfaceShaderSet.js index 8bf8b1716215..49ed43895ddc 100644 --- a/Source/Scene/GlobeSurfaceShaderSet.js +++ b/Source/Scene/GlobeSurfaceShaderSet.js @@ -3,7 +3,6 @@ define([ '../Core/destroyObject', '../Core/TerrainQuantization', '../Renderer/ShaderProgram', - './ClippingPlaneCollection', './getClippingFunction', './SceneMode' ], function( @@ -11,7 +10,6 @@ define([ destroyObject, TerrainQuantization, ShaderProgram, - ClippingPlaneCollection, getClippingFunction, SceneMode) { 'use strict'; diff --git a/Source/Scene/GlobeSurfaceTileProvider.js b/Source/Scene/GlobeSurfaceTileProvider.js index b613c393c04f..fbb184eb1a72 100644 --- a/Source/Scene/GlobeSurfaceTileProvider.js +++ b/Source/Scene/GlobeSurfaceTileProvider.js @@ -21,7 +21,6 @@ define([ '../Core/Matrix4', '../Core/OrientedBoundingBox', '../Core/OrthographicFrustum', - '../Core/Plane', '../Core/PrimitiveType', '../Core/Rectangle', '../Core/SphereOutlineGeometry', @@ -68,7 +67,6 @@ define([ Matrix4, OrientedBoundingBox, OrthographicFrustum, - Plane, PrimitiveType, Rectangle, SphereOutlineGeometry, diff --git a/Source/Scene/IonImageryProvider.js b/Source/Scene/IonImageryProvider.js index dad80fe8b42a..5f2e6524cf51 100644 --- a/Source/Scene/IonImageryProvider.js +++ b/Source/Scene/IonImageryProvider.js @@ -1,6 +1,5 @@ define([ '../Core/Check', - '../Core/clone', '../Core/Credit', '../Core/defaultValue', '../Core/defined', @@ -8,12 +7,10 @@ define([ '../Core/DeveloperError', '../Core/Event', '../Core/IonResource', - '../Core/Resource', '../Core/RuntimeError', '../ThirdParty/when', './ArcGisMapServerImageryProvider', './BingMapsImageryProvider', - './Cesium3DTileset', './createTileMapServiceImageryProvider', './GoogleEarthEnterpriseMapsProvider', './MapboxImageryProvider', @@ -23,7 +20,6 @@ define([ './WebMapTileServiceImageryProvider' ], function( Check, - clone, Credit, defaultValue, defined, @@ -31,12 +27,10 @@ define([ DeveloperError, Event, IonResource, - Resource, RuntimeError, when, ArcGisMapServerImageryProvider, BingMapsImageryProvider, - Cesium3DTileset, createTileMapServiceImageryProvider, GoogleEarthEnterpriseMapsProvider, MapboxImageryProvider, diff --git a/Source/Scene/PointCloudEyeDomeLighting.js b/Source/Scene/PointCloudEyeDomeLighting.js index bf5809dc9d3a..1c8da4f0cdd9 100644 --- a/Source/Scene/PointCloudEyeDomeLighting.js +++ b/Source/Scene/PointCloudEyeDomeLighting.js @@ -1,17 +1,11 @@ define([ '../Core/Cartesian3', - '../Core/clone', '../Core/Color', - '../Core/combine', - '../Core/ComponentDatatype', '../Core/defined', '../Core/destroyObject', '../Core/FeatureDetection', - '../Core/Geometry', - '../Core/GeometryAttribute', '../Core/PixelFormat', '../Core/PrimitiveType', - '../Renderer/BufferUsage', '../Renderer/ClearCommand', '../Renderer/DrawCommand', '../Renderer/Framebuffer', @@ -19,33 +13,21 @@ define([ '../Renderer/PixelDatatype', '../Renderer/RenderState', '../Renderer/Sampler', - '../Renderer/ShaderProgram', '../Renderer/ShaderSource', '../Renderer/Texture', '../Renderer/TextureMagnificationFilter', '../Renderer/TextureMinificationFilter', '../Renderer/TextureWrap', - '../Renderer/VertexArray', - '../Scene/BlendEquation', - '../Scene/BlendFunction', '../Scene/BlendingState', - '../Scene/StencilFunction', - '../Scene/StencilOperation', '../Shaders/PostProcessFilters/PointCloudEyeDomeLighting' ], function( Cartesian3, - clone, Color, - combine, - ComponentDatatype, defined, destroyObject, FeatureDetection, - Geometry, - GeometryAttribute, PixelFormat, PrimitiveType, - BufferUsage, ClearCommand, DrawCommand, Framebuffer, @@ -53,18 +35,12 @@ define([ PixelDatatype, RenderState, Sampler, - ShaderProgram, ShaderSource, Texture, TextureMagnificationFilter, TextureMinificationFilter, TextureWrap, - VertexArray, - BlendEquation, - BlendFunction, BlendingState, - StencilFunction, - StencilOperation, PointCloudEyeDomeLightingShader) { 'use strict'; diff --git a/Source/Scene/Scene.js b/Source/Scene/Scene.js index da28e35093e9..e9fe841755cc 100644 --- a/Source/Scene/Scene.js +++ b/Source/Scene/Scene.js @@ -46,7 +46,6 @@ define([ '../Renderer/Pass', '../Renderer/PassState', '../Renderer/PixelDatatype', - '../Renderer/RenderState', '../Renderer/ShaderProgram', '../Renderer/ShaderSource', '../Renderer/Texture', @@ -126,7 +125,6 @@ define([ Pass, PassState, PixelDatatype, - RenderState, ShaderProgram, ShaderSource, Texture, diff --git a/Source/Scene/UrlTemplateImageryProvider.js b/Source/Scene/UrlTemplateImageryProvider.js index 6c5929ab33f9..6fccf9d4cd04 100644 --- a/Source/Scene/UrlTemplateImageryProvider.js +++ b/Source/Scene/UrlTemplateImageryProvider.js @@ -2,7 +2,6 @@ define([ '../Core/Cartesian2', '../Core/Cartesian3', '../Core/Cartographic', - '../Core/clone', '../Core/combine', '../Core/Credit', '../Core/defaultValue', @@ -22,7 +21,6 @@ define([ Cartesian2, Cartesian3, Cartographic, - clone, combine, Credit, defaultValue, diff --git a/Source/Scene/Vector3DTilePolygons.js b/Source/Scene/Vector3DTilePolygons.js index a19e411eade6..3fc2387759f5 100644 --- a/Source/Scene/Vector3DTilePolygons.js +++ b/Source/Scene/Vector3DTilePolygons.js @@ -8,7 +8,6 @@ define([ '../Core/destroyObject', '../Core/Ellipsoid', '../Core/IndexDatatype', - '../Core/Matrix4', '../Core/OrientedBoundingBox', '../Core/Rectangle', '../Core/TaskProcessor', @@ -26,7 +25,6 @@ define([ destroyObject, Ellipsoid, IndexDatatype, - Matrix4, OrientedBoundingBox, Rectangle, TaskProcessor, diff --git a/Source/Scene/WebMapServiceImageryProvider.js b/Source/Scene/WebMapServiceImageryProvider.js index e8c410f01da4..5dc05e2f2076 100644 --- a/Source/Scene/WebMapServiceImageryProvider.js +++ b/Source/Scene/WebMapServiceImageryProvider.js @@ -1,31 +1,23 @@ define([ - '../Core/combine', '../Core/defaultValue', '../Core/defined', '../Core/defineProperties', '../Core/DeveloperError', '../Core/freezeObject', '../Core/GeographicTilingScheme', - '../Core/objectToQuery', - '../Core/queryToObject', '../Core/Resource', '../Core/WebMercatorTilingScheme', - '../ThirdParty/Uri', './GetFeatureInfoFormat', './UrlTemplateImageryProvider' ], function( - combine, defaultValue, defined, defineProperties, DeveloperError, freezeObject, GeographicTilingScheme, - objectToQuery, - queryToObject, Resource, WebMercatorTilingScheme, - Uri, GetFeatureInfoFormat, UrlTemplateImageryProvider) { 'use strict'; diff --git a/Source/Scene/WebMapTileServiceImageryProvider.js b/Source/Scene/WebMapTileServiceImageryProvider.js index bc89458c6b0b..5d86d834705a 100644 --- a/Source/Scene/WebMapTileServiceImageryProvider.js +++ b/Source/Scene/WebMapTileServiceImageryProvider.js @@ -8,12 +8,9 @@ define([ '../Core/Event', '../Core/freezeObject', '../Core/isArray', - '../Core/objectToQuery', - '../Core/queryToObject', '../Core/Rectangle', '../Core/Resource', '../Core/WebMercatorTilingScheme', - '../ThirdParty/Uri', '../ThirdParty/when', './ImageryProvider', './TimeDynamicImagery' @@ -27,12 +24,9 @@ define([ Event, freezeObject, isArray, - objectToQuery, - queryToObject, Rectangle, Resource, WebMercatorTilingScheme, - Uri, when, ImageryProvider, TimeDynamicImagery) { diff --git a/Source/Scene/createOpenStreetMapImageryProvider.js b/Source/Scene/createOpenStreetMapImageryProvider.js index 1df01809fd65..c678129a468b 100644 --- a/Source/Scene/createOpenStreetMapImageryProvider.js +++ b/Source/Scene/createOpenStreetMapImageryProvider.js @@ -2,7 +2,6 @@ define([ '../Core/appendForwardSlash', '../Core/Credit', '../Core/defaultValue', - '../Core/defined', '../Core/DeveloperError', '../Core/Rectangle', '../Core/Resource', @@ -12,7 +11,6 @@ define([ appendForwardSlash, Credit, defaultValue, - defined, DeveloperError, Rectangle, Resource, diff --git a/Source/Widgets/Viewer/Viewer.js b/Source/Widgets/Viewer/Viewer.js index dd770a4f92c3..73035cebac93 100644 --- a/Source/Widgets/Viewer/Viewer.js +++ b/Source/Widgets/Viewer/Viewer.js @@ -1,7 +1,6 @@ define([ '../../Core/BoundingSphere', '../../Core/Cartesian3', - '../../Core/Check', '../../Core/Clock', '../../Core/defaultValue', '../../Core/defined', @@ -49,7 +48,6 @@ define([ ], function( BoundingSphere, Cartesian3, - Check, Clock, defaultValue, defined, diff --git a/Source/Workers/createVectorTileGeometries.js b/Source/Workers/createVectorTileGeometries.js index d64684b633b3..03286ddcf0b0 100644 --- a/Source/Workers/createVectorTileGeometries.js +++ b/Source/Workers/createVectorTileGeometries.js @@ -8,7 +8,6 @@ define([ '../Core/EllipsoidGeometry', '../Core/IndexDatatype', '../Core/Matrix4', - '../Core/VertexFormat', '../Scene/Vector3DTileBatch', './createTaskProcessorWorker' ], function( @@ -21,7 +20,6 @@ define([ EllipsoidGeometry, IndexDatatype, Matrix4, - VertexFormat, Vector3DTileBatch, createTaskProcessorWorker) { 'use strict'; diff --git a/Source/Workers/createVectorTilePolygons.js b/Source/Workers/createVectorTilePolygons.js index 1086090f8bdd..50e022a97438 100644 --- a/Source/Workers/createVectorTilePolygons.js +++ b/Source/Workers/createVectorTilePolygons.js @@ -5,14 +5,10 @@ define([ '../Core/Color', '../Core/defined', '../Core/Ellipsoid', - '../Core/EllipsoidTangentPlane', '../Core/IndexDatatype', '../Core/Math', - '../Core/Matrix4', '../Core/OrientedBoundingBox', - '../Core/PolygonPipeline', '../Core/Rectangle', - '../Core/WindingOrder', './createTaskProcessorWorker' ], function( AttributeCompression, @@ -21,14 +17,10 @@ define([ Color, defined, Ellipsoid, - EllipsoidTangentPlane, IndexDatatype, CesiumMath, - Matrix4, OrientedBoundingBox, - PolygonPipeline, Rectangle, - WindingOrder, createTaskProcessorWorker) { 'use strict'; From 3acb8a4afe381a4913d08dc9cf0829d71d15a7e4 Mon Sep 17 00:00:00 2001 From: hanbollar Date: Fri, 20 Apr 2018 11:43:20 -0400 Subject: [PATCH 100/104] fixed --- .../gallery/Imagery Layers Texture Filters.html | 4 ++-- CHANGES.md | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html b/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html index 4b6fe4166cb4..72fca860b7e6 100644 --- a/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html +++ b/Apps/Sandcastle/gallery/Imagery Layers Texture Filters.html @@ -55,11 +55,11 @@ layers.removeAll(); var layerLinear = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({ - url : require.toUrl('Assets/Textures/NaturalEarthII') + url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') })); var layerNearest = layers.addImageryProvider(Cesium.createTileMapServiceImageryProvider({ - url : require.toUrl('Assets/Textures/NaturalEarthII') + url : Cesium.buildModuleUrl('Assets/Textures/NaturalEarthII') })); // Set the texture minification and magnification filters of layerNearest. Default is LINEAR. diff --git a/CHANGES.md b/CHANGES.md index a736fca57985..3202c6648cba 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,8 @@ Change Log * Added `Math.log2` to compute the base 2 logarithm of a number. * Added 'PeliasGeocoderService', which provides geocoding via a [Pelias](https://pelias.io) server. * Added `GeocodeType` enum and use it as an optional parameter to all `GeocoderService` instances to differentiate between autocomplete and search requests. +* Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) +* Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling ##### Fixes :wrench: * Fixed bugs in `TimeIntervalCollection.removeInterval`. [#6418](https://github.com/AnalyticalGraphicsInc/cesium/pull/6418). @@ -18,11 +20,8 @@ Change Log * `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) -* Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) - -##### Additions :tada: -* Improved `MapboxImageryProvider` performance by 300% via `tiles.mapbox.com` subdomain switching. [#6426](https://github.com/AnalyticalGraphicsInc/cesium/issues/6426) -* Added ability to invoke `sampleTerrain` from node.js to enable offline terrain sampling +* Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) +* Fixed Imagery Layers Texture Filters Sandcastle example. [#](). ### 1.44 - 2018-04-02 From 3f019ec756ed768ebee17c86a24adbf13438f4b2 Mon Sep 17 00:00:00 2001 From: hanbollar Date: Fri, 20 Apr 2018 11:45:59 -0400 Subject: [PATCH 101/104] updated changes md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 3202c6648cba..437147741fd1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,7 +21,7 @@ Change Log * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) * Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) -* Fixed Imagery Layers Texture Filters Sandcastle example. [#](). +* Fixed Imagery Layers Texture Filters Sandcastle example. [#6472](https://github.com/AnalyticalGraphicsInc/cesium/pull/6472). ### 1.44 - 2018-04-02 From d0d09dea7cf572214806fbab2ece6a732bfe2274 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Fri, 20 Apr 2018 13:46:17 -0400 Subject: [PATCH 102/104] Added IonGeocoderService Added `IonGeocoderService` and made it the default for the `Geocoder` widget. Also fixed a minor issue in `PeliasGeocoderService` where a url did not have a trailing `/`. --- CHANGES.md | 1 + Source/Core/IonGeocoderService.js | 64 ++++++++++++++++++++ Source/Core/PeliasGeocoderService.js | 1 + Source/Widgets/Geocoder/GeocoderViewModel.js | 6 +- Specs/Core/IonGeocoderServiceSpec.js | 48 +++++++++++++++ 5 files changed, 117 insertions(+), 3 deletions(-) create mode 100644 Source/Core/IonGeocoderService.js create mode 100644 Specs/Core/IonGeocoderServiceSpec.js diff --git a/CHANGES.md b/CHANGES.md index 437147741fd1..d1337b05a4ac 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,7 @@ Change Log ### 1.45 - 2018-05-01 ##### Additions :tada: +* Added `IonGeocoderService` and made it the default geocoding service for the `Geocoder` widget. * Added option `logarithmicDepthBuffer` to `Scene`. With this option there is typically a single frustum using logarithmic depth rendered. This increases performance by issuing less draw calls to the GPU and helps to avoid artifacts on the connection of two frustums. [#5851](https://github.com/AnalyticalGraphicsInc/cesium/pull/5851) * When a log depth buffer is supported, the frustum near and far planes default to `0.1` and `1e10` respectively. * Added `Math.log2` to compute the base 2 logarithm of a number. diff --git a/Source/Core/IonGeocoderService.js b/Source/Core/IonGeocoderService.js new file mode 100644 index 000000000000..574b9f3da804 --- /dev/null +++ b/Source/Core/IonGeocoderService.js @@ -0,0 +1,64 @@ +define([ + './Check', + './defaultValue', + './defined', + './defineProperties', + './Ion', + './PeliasGeocoderService', + './Rectangle', + './Resource' +], function ( + Check, + defaultValue, + defined, + defineProperties, + Ion, + PeliasGeocoderService, + Rectangle, + Resource) { + 'use strict'; + + /** + * Provides geocoding through Cesium ion. + * @alias IonGeocoderService + * @constructor + * + * @param {Object} [options] Object with the following properties: + * @param {String} [options.accessToken=Ion.defaultAccessToken] The access token to use. + * @param {String|Resource} [options.server=Ion.defaultServer] The resource to the Cesium ion API server. + * + * @see Ion + */ + function IonGeocoderService(options) { + options = defaultValue(options, defaultValue.EMPTY_OBJECT); + + var accessToken = defaultValue(options.accessToken, Ion.defaultAccessToken); + var server = Resource.createIfNeeded(defaultValue(options.server, Ion.defaultServer)); + server.appendForwardSlash(); + + var searchEndpoint = server.getDerivedResource({ + url: 'v1/geocode' + }); + + if (defined(accessToken)) { + searchEndpoint.appendQueryParameters({ access_token: accessToken }); + } + + this._accessToken = accessToken; + this._server = server; + this._pelias = new PeliasGeocoderService(searchEndpoint); + } + + /** + * @function + * + * @param {String} query The query to be sent to the geocoder service + * @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. + * @returns {Promise} + */ + IonGeocoderService.prototype.geocode = function (query, geocodeType) { + return this._pelias.geocode(query, geocodeType); + }; + + return IonGeocoderService; +}); diff --git a/Source/Core/PeliasGeocoderService.js b/Source/Core/PeliasGeocoderService.js index b357db862c8f..c8c23ebccfab 100644 --- a/Source/Core/PeliasGeocoderService.js +++ b/Source/Core/PeliasGeocoderService.js @@ -38,6 +38,7 @@ define([ //>>includeEnd('debug'); this._url = Resource.createIfNeeded(url); + this._url.appendForwardSlash(); } defineProperties(PeliasGeocoderService.prototype, { diff --git a/Source/Widgets/Geocoder/GeocoderViewModel.js b/Source/Widgets/Geocoder/GeocoderViewModel.js index a2c8c975be54..84d6c7714054 100644 --- a/Source/Widgets/Geocoder/GeocoderViewModel.js +++ b/Source/Widgets/Geocoder/GeocoderViewModel.js @@ -1,5 +1,5 @@ define([ - '../../Core/BingMapsGeocoderService', + '../../Core/IonGeocoderService', '../../Core/CartographicGeocoderService', '../../Core/defaultValue', '../../Core/defined', @@ -13,7 +13,7 @@ define([ '../createCommand', '../getElement' ], function( - BingMapsGeocoderService, + IonGeocoderService, CartographicGeocoderService, defaultValue, defined, @@ -52,7 +52,7 @@ define([ } else { this._geocoderServices = [ new CartographicGeocoderService(), - new BingMapsGeocoderService({scene: options.scene}) + new IonGeocoderService() ]; } diff --git a/Specs/Core/IonGeocoderServiceSpec.js b/Specs/Core/IonGeocoderServiceSpec.js new file mode 100644 index 000000000000..6ed001df423b --- /dev/null +++ b/Specs/Core/IonGeocoderServiceSpec.js @@ -0,0 +1,48 @@ +defineSuite([ + 'Core/IonGeocoderService', + 'Core/Ion', + 'Core/GeocodeType', + 'Core/Rectangle', + 'Core/Resource', + 'ThirdParty/when' + ], function( + IonGeocoderService, + Ion, + GeocodeType, + Rectangle, + Resource, + when) { + 'use strict'; + + it('Creates with default parameters', function() { + var service = new IonGeocoderService(); + + expect(service._accessToken).toEqual(Ion.defaultAccessToken); + expect(service._server.url).toEqual(Ion.defaultServer.url); + }); + + it('Creates with specified parameters', function() { + var accessToken = '123456'; + var server = 'http://not.ion.invalid/'; + + var service = new IonGeocoderService({ + accessToken: accessToken, + server: server + }); + + expect(service._accessToken).toEqual(accessToken); + expect(service._server.url).toEqual(server); + }); + + it('calls inner geocoder and returns result', function () { + var service = new IonGeocoderService(); + + var expectedResult = when.resolve(); + spyOn(service._pelias, 'geocode').and.returnValue(expectedResult); + + var query = 'some query'; + var result = service.geocode(query, GeocodeType.SEARCH); + expect(result).toBe(expectedResult); + expect(service._pelias.geocode).toHaveBeenCalledWith(query, GeocodeType.SEARCH); + }); +}); From 45ab98a2e2f97b3b6fec4232a43963c603dbcd94 Mon Sep 17 00:00:00 2001 From: Matthew Amato Date: Fri, 20 Apr 2018 14:11:51 -0400 Subject: [PATCH 103/104] Don't use https in specs. --- Source/Scene/IonImageryProvider.js | 3 --- Specs/Core/IonResourceSpec.js | 10 +++++----- Specs/Scene/IonImageryProviderSpec.js | 26 +++++++++++++------------- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/Source/Scene/IonImageryProvider.js b/Source/Scene/IonImageryProvider.js index 5f2e6524cf51..8176a85298b5 100644 --- a/Source/Scene/IonImageryProvider.js +++ b/Source/Scene/IonImageryProvider.js @@ -179,9 +179,6 @@ define([ that._tileCredits = endpoint.attributions.map(Credit.getIonCredit); - return imageryProvider; - }) - .then(function(imageryProvider) { imageryProvider.errorEvent.addEventListener(function(tileProviderError) { //Propagate the errorEvent but set the provider to this instance instead //of the inner instance. diff --git a/Specs/Core/IonResourceSpec.js b/Specs/Core/IonResourceSpec.js index c3238098d33b..0baf9e621260 100644 --- a/Specs/Core/IonResourceSpec.js +++ b/Specs/Core/IonResourceSpec.js @@ -98,7 +98,7 @@ defineSuite([ return testNonImageryExternalResource({ type: '3DTILES', externalType: '3DTILES', - options: { url: 'https://test.invalid/tileset.json' }, + options: { url: 'http://test.invalid/tileset.json' }, attributions: [] }); }); @@ -107,7 +107,7 @@ defineSuite([ return testNonImageryExternalResource({ type: 'TERRAIN', externalType: 'STK_TERRAIN_SERVER', - options: { url: 'https://test.invalid/world' }, + options: { url: 'http://test.invalid/world' }, attributions: [] }); }); @@ -116,7 +116,7 @@ defineSuite([ return testNonImageryExternalResource({ type: 'IMAGERY', externalType: 'URL_TEMPLATE', - url: 'https://test.invalid/world', + url: 'http://test.invalid/world', attributions: [] }) .then(fail) @@ -209,7 +209,7 @@ defineSuite([ var externalEndpoint = { type: '3DTILES', externalType: '3DTILES', - options: { url: 'https://test.invalid/tileset.json' }, + options: { url: 'http://test.invalid/tileset.json' }, attributions: [] }; var options = {}; @@ -233,7 +233,7 @@ defineSuite([ var externalEndpoint = { type: '3DTILES', externalType: '3DTILES', - options: { url: 'https://test.invalid/tileset.json' }, + options: { url: 'http://test.invalid/tileset.json' }, attributions: [] }; diff --git a/Specs/Scene/IonImageryProviderSpec.js b/Specs/Scene/IonImageryProviderSpec.js index e8c05332492f..e6ff84baf2d2 100644 --- a/Specs/Scene/IonImageryProviderSpec.js +++ b/Specs/Scene/IonImageryProviderSpec.js @@ -39,7 +39,7 @@ defineSuite([ function createTestProvider(endpointData) { endpointData = defaultValue(endpointData, { type: 'IMAGERY', - url: 'https://test.invalid/layer', + url: 'http://test.invalid/layer', accessToken: 'not_really_a_refresh_token', attributions: [] }); @@ -74,7 +74,7 @@ defineSuite([ it('readyPromise rejects with non-imagery asset', function(done) { var provider = createTestProvider({ type: '3DTILES', - url: 'https://test.invalid/layer', + url: 'http://test.invalid/layer', accessToken: 'not_really_a_refresh_token', attributions: [] }); @@ -93,7 +93,7 @@ defineSuite([ var provider = createTestProvider({ type: 'IMAGERY', externalType: 'TUBELCANE', - options: { url: 'https://test.invalid/layer' }, + options: { url: 'http://test.invalid/layer' }, attributions: [] }); @@ -181,7 +181,7 @@ defineSuite([ var serverCredit = { text: 'Text', image: 'http://test.invalid/image', url: 'http://test.invalid/', collapsible: false }; var provider = createTestProvider({ type: 'IMAGERY', - url: 'https://test.invalid/layer', + url: 'http://test.invalid/layer', accessToken: 'not_really_a_refresh_token', attributions: [serverCredit] }); @@ -212,14 +212,14 @@ defineSuite([ spyOn(Resource._Implementations, 'loadAndExecuteScript').and.callFake(function(url, name, deffered) { deffered.resolve({ resourceSets: [{ resources: [{ imageUrl: '', imageUrlSubdomains: [], zoomMax: 0 }] }] }); }); - return testExternalImagery('ARCGIS_MAPSERVER', { url: 'https://test.invalid' }, ArcGisMapServerImageryProvider); + return testExternalImagery('ARCGIS_MAPSERVER', { url: 'http://test.invalid' }, ArcGisMapServerImageryProvider); }); it('createImageryProvider works with BING', function() { spyOn(Resource._Implementations, 'loadAndExecuteScript').and.callFake(function(url, name, deffered) { deffered.resolve({ resourceSets: [{ resources: [{ imageUrl: '', imageUrlSubdomains: [], zoomMax: 0 }] }] }); }); - return testExternalImagery('BING', { url: 'https://test.invalid' }, BingMapsImageryProvider); + return testExternalImagery('BING', { url: 'http://test.invalid' }, BingMapsImageryProvider); }); it('createImageryProvider works with GOOGLE_EARTH', function() { @@ -227,11 +227,11 @@ defineSuite([ deferred.resolve(JSON.stringify({ layers: [{ id: 0, version: '' }] })); }); - return testExternalImagery('GOOGLE_EARTH', { url: 'https://test.invalid', channel: 0 }, GoogleEarthEnterpriseMapsProvider); + return testExternalImagery('GOOGLE_EARTH', { url: 'http://test.invalid', channel: 0 }, GoogleEarthEnterpriseMapsProvider); }); it('createImageryProvider works with MAPBOX', function() { - return testExternalImagery('MAPBOX', { url: 'https://test.invalid', mapId: 1 }, MapboxImageryProvider); + return testExternalImagery('MAPBOX', { url: 'http://test.invalid', mapId: 1 }, MapboxImageryProvider); }); it('createImageryProvider works with SINGLE_TILE', function() { @@ -239,22 +239,22 @@ defineSuite([ deferred.resolve({}); }); - return testExternalImagery('SINGLE_TILE', { url: 'https://test.invalid' }, SingleTileImageryProvider); + return testExternalImagery('SINGLE_TILE', { url: 'http://test.invalid' }, SingleTileImageryProvider); }); it('createImageryProvider works with TMS', function() { - return testExternalImagery('TMS', { url: 'https://test.invalid' }, UrlTemplateImageryProvider); + return testExternalImagery('TMS', { url: 'http://test.invalid' }, UrlTemplateImageryProvider); }); it('createImageryProvider works with URL_TEMPLATE', function() { - return testExternalImagery('URL_TEMPLATE', { url: 'https://test.invalid' }, UrlTemplateImageryProvider); + return testExternalImagery('URL_TEMPLATE', { url: 'http://test.invalid' }, UrlTemplateImageryProvider); }); it('createImageryProvider works with WMS', function() { - return testExternalImagery('WMS', { url: 'https://test.invalid', layers: [] }, WebMapServiceImageryProvider); + return testExternalImagery('WMS', { url: 'http://test.invalid', layers: [] }, WebMapServiceImageryProvider); }); it('createImageryProvider works with WMTS', function() { - return testExternalImagery('WMTS', { url: 'https://test.invalid', layer: '', style: '', tileMatrixSetID: 1 }, WebMapTileServiceImageryProvider); + return testExternalImagery('WMTS', { url: 'http://test.invalid', layer: '', style: '', tileMatrixSetID: 1 }, WebMapTileServiceImageryProvider); }); }); From 838511ee108738a65c852422dbbcb05046875fc1 Mon Sep 17 00:00:00 2001 From: Hannah Date: Fri, 20 Apr 2018 15:07:43 -0400 Subject: [PATCH 104/104] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 03ca69b7f62f..7e0255b1131d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -20,7 +20,7 @@ Change Log * `GroundPrimitive`s and `ClassificationPrimitive`s will become ready when `show` is `false`. [#6428](https://github.com/AnalyticalGraphicsInc/cesium/pull/6428) * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) -* Fix flicker when adding, removing, or modifiying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) +* Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) * Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) * Fixed Imagery Layers Texture Filters Sandcastle example. [#6472](https://github.com/AnalyticalGraphicsInc/cesium/pull/6472).