diff --git a/CHANGES.md b/CHANGES.md index b25b2d383d1b..36f1df04d5ed 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,8 +6,14 @@ Change Log ##### Additions :tada: * Added support for the [AGI_articulations](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/AGI_articulations) vendor extension of glTF 2.0 to the Entity API and CZML. [#7907](https://github.com/AnalyticalGraphicsInc/cesium/pull/7907) +##### Fixes :wrench: +* Fixed a bug that caused missing segments for ground polylines with coplanar points over large distances and problems with polylines containing duplicate points. [#7885](https://github.com/AnalyticalGraphicsInc/cesium//pull/7885) +* Fixed a bug where billboards were not pickable when zoomed out completely in 2D View. [#7908](https://github.com/AnalyticalGraphicsInc/cesium/pull/7908) +* Fixed polyline colors when `scene.highDynamicRange` is enabled. [#7924](https://github.com/AnalyticalGraphicsInc/cesium/pull/7924) +* Fixed a bug in the inspector where the min/max height values of a picked tile were undefined. [#7904](https://github.com/AnalyticalGraphicsInc/cesium/pull/7904) + ### 1.58.1 - 2018-06-03 -_This is an npm-only release to fix a publishing issue__ +_This is an npm-only release to fix a publishing issue_ ### 1.58 - 2019-06-03 @@ -22,7 +28,7 @@ _This is an npm-only release to fix a publishing issue__ ##### Fixes :wrench: * Fixed an edge case where Cesium would provide ion access token credentials to non-ion servers if the actual asset entrypoint was being hosted by ion. [#7839](https://github.com/AnalyticalGraphicsInc/cesium/pull/7839) * Fixed a bug that caused Cesium to request non-existent tiles for terrain tilesets lacking tile availability, i.e. a `layer.json` file. -* Fixed memory leak when removing entities that had a `HeightReference` of `CLAMP_TO_GROUND` or `RELATIVE_TO_GROUND`. This includes when removing a `DataSource`. +* Fixed memory leak when removing entities that had a `HeightReference` of `CLAMP_TO_GROUND` or `RELATIVE_TO_GROUND`. This includes when removing a `DataSource`. * Fixed 3D Tiles credits not being shown in the data attribution box. [#7877](https://github.com/AnalyticalGraphicsInc/cesium/pull/7877) ### 1.57 - 2019-05-01 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 99ca86db2caa..8e1df7e7dc27 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -208,3 +208,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Alexander Popiak](https://github.com/apopiak) * [Trubie Turner](https://github.com/flexei) * [Merijn Wijngaard](https://github.com/mwijngaard) +* [Dennis Adams](https://github.com/dennisadams) diff --git a/Source/Core/GroundPolylineGeometry.js b/Source/Core/GroundPolylineGeometry.js index a5d21e7b9ef1..10195ad6259c 100644 --- a/Source/Core/GroundPolylineGeometry.js +++ b/Source/Core/GroundPolylineGeometry.js @@ -353,41 +353,42 @@ define([ return result; } + function tangentDirection(target, origin, up, result) { + result = direction(target, origin, result); + + // orthogonalize + result = Cartesian3.cross(result, up, result); + result = Cartesian3.normalize(result, result); + result = Cartesian3.cross(up, result, result); + return result; + } + var toPreviousScratch = new Cartesian3(); var toNextScratch = new Cartesian3(); var forwardScratch = new Cartesian3(); - var coplanarNormalScratch = new Cartesian3(); - var coplanarPlaneScratch = new Plane(Cartesian3.UNIT_X, 0.0); var vertexUpScratch = new Cartesian3(); var cosine90 = 0.0; + var cosine180 = -1.0; function computeVertexMiterNormal(previousBottom, vertexBottom, vertexTop, nextBottom, result) { var up = direction(vertexTop, vertexBottom, vertexUpScratch); - var toPrevious = direction(previousBottom, vertexBottom, toPreviousScratch); - var toNext = direction(nextBottom, vertexBottom, toNextScratch); - - // Check if points are coplanar in a right-side-pointing plane that contains "up." - // This is roughly equivalent to the points being colinear in cartographic space. - var coplanarNormal = Cartesian3.cross(up, toPrevious, coplanarNormalScratch); - coplanarNormal = Cartesian3.normalize(coplanarNormal, coplanarNormal); - var coplanarPlane = Plane.fromPointNormal(vertexBottom, coplanarNormal, coplanarPlaneScratch); - var nextBottomDistance = Plane.getPointDistance(coplanarPlane, nextBottom); - if (CesiumMath.equalsEpsilon(nextBottomDistance, 0.0, CesiumMath.EPSILON7)) { - // If the points are coplanar, point the normal in the direction of the plane - Cartesian3.clone(coplanarNormal, result); - return result; + + // Compute vectors pointing towards neighboring points but tangent to this point on the ellipsoid + var toPrevious = tangentDirection(previousBottom, vertexBottom, up, toPreviousScratch); + var toNext = tangentDirection(nextBottom, vertexBottom, up, toNextScratch); + + // Check if tangents are almost opposite - if so, no need to miter. + if (CesiumMath.equalsEpsilon(Cartesian3.dot(toPrevious, toNext), cosine180, CesiumMath.EPSILON5)) { + result = Cartesian3.cross(up, toPrevious, result); + result = Cartesian3.normalize(result, result); + return result; } - // Average directions to previous and to next + // Average directions to previous and to next in the plane of Up result = Cartesian3.add(toNext, toPrevious, result); result = Cartesian3.normalize(result, result); - // Rotate this direction to be orthogonal to up - var forward = Cartesian3.cross(up, result, forwardScratch); - Cartesian3.normalize(forward, forward); - Cartesian3.cross(forward, up, result); - Cartesian3.normalize(result, result); - // Flip the normal if it isn't pointing roughly bound right (aka if forward is pointing more "backwards") + var forward = Cartesian3.cross(up, result, forwardScratch); if (Cartesian3.dot(toNext, forward) < cosine90) { result = Cartesian3.negate(result, result); } diff --git a/Source/Scene/Globe.js b/Source/Scene/Globe.js index c43425389d37..03746c279f45 100644 --- a/Source/Scene/Globe.js +++ b/Source/Scene/Globe.js @@ -675,7 +675,11 @@ define([ if (!defined(rayOrigin)) { // intersection point is outside the ellipsoid, try other value // minimum height (-11500.0) for the terrain set, need to get this information from the terrain provider - var magnitude = Math.min(defaultValue(tile.data.minimumHeight, 0.0), -11500.0); + var minimumHeight; + if (defined(tile.data.tileBoundingRegion)) { + minimumHeight = tile.data.tileBoundingRegion.minimumHeight; + } + var magnitude = Math.min(defaultValue(minimumHeight, 0.0), -11500.0); // multiply by the *positive* value of the magnitude var vectorToMinimumPoint = Cartesian3.multiplyByScalar(surfaceNormal, Math.abs(magnitude) + 1, scratchGetHeightIntersection); diff --git a/Source/Scene/GlobeDepth.js b/Source/Scene/GlobeDepth.js index 8ae0e8175bc2..663f127c6533 100644 --- a/Source/Scene/GlobeDepth.js +++ b/Source/Scene/GlobeDepth.js @@ -290,6 +290,8 @@ define([ }); } + globeDepth._copyColorCommand.renderState = globeDepth._rs; + if (!defined(globeDepth._tempCopyDepthCommand)) { globeDepth._tempCopyDepthCommand = context.createViewportQuadCommand(PassThroughDepth, { uniformMap : { diff --git a/Source/Scene/QuadtreePrimitive.js b/Source/Scene/QuadtreePrimitive.js index d923303b3313..a892d8d28126 100644 --- a/Source/Scene/QuadtreePrimitive.js +++ b/Source/Scene/QuadtreePrimitive.js @@ -1131,7 +1131,11 @@ define([ if (!defined(rayOrigin)) { // intersection point is outside the ellipsoid, try other value // minimum height (-11500.0) for the terrain set, need to get this information from the terrain provider - var magnitude = Math.min(defaultValue(tile.data.minimumHeight, 0.0),-11500.0); + var minimumHeight; + if (defined(tile.data.tileBoundingRegion)) { + minimumHeight = tile.data.tileBoundingRegion.minimumHeight; + } + var magnitude = Math.min(defaultValue(minimumHeight, 0.0), -11500.0); // multiply by the *positive* value of the magnitude var vectorToMinimumPoint = Cartesian3.multiplyByScalar(surfaceNormal, Math.abs(magnitude) + 1, scratchPosition); diff --git a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl index 3649a0883f23..0af342a73e28 100644 --- a/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl +++ b/Source/Shaders/Appearances/PerInstanceFlatColorAppearanceFS.glsl @@ -2,5 +2,5 @@ varying vec4 v_color; void main() { - gl_FragColor = v_color; + gl_FragColor = czm_gammaCorrect(v_color); } diff --git a/Source/Shaders/PolylineShadowVolumeFS.glsl b/Source/Shaders/PolylineShadowVolumeFS.glsl index 9bd21c42fa50..d8b65a80fd0e 100644 --- a/Source/Shaders/PolylineShadowVolumeFS.glsl +++ b/Source/Shaders/PolylineShadowVolumeFS.glsl @@ -65,7 +65,7 @@ void main(void) distanceFromEnd = czm_planeDistance(alignedPlaneNormal, -dot(alignedPlaneNormal, v_endEcAndStartEcX.xyz), eyeCoordinate.xyz); #ifdef PER_INSTANCE_COLOR - gl_FragColor = v_color; + gl_FragColor = czm_gammaCorrect(v_color); #else // PER_INSTANCE_COLOR // Clamp - distance to aligned planes may be negative due to mitering, // so fragment texture coordinate might be out-of-bounds. diff --git a/Source/Shaders/PolylineShadowVolumeMorphFS.glsl b/Source/Shaders/PolylineShadowVolumeMorphFS.glsl index a5995bea035b..ec3568f98937 100644 --- a/Source/Shaders/PolylineShadowVolumeMorphFS.glsl +++ b/Source/Shaders/PolylineShadowVolumeMorphFS.glsl @@ -20,7 +20,7 @@ void main(void) eyeCoordinate /= eyeCoordinate.w; #ifdef PER_INSTANCE_COLOR - gl_FragColor = v_color; + gl_FragColor = czm_gammaCorrect(v_color); #else // PER_INSTANCE_COLOR // Use distances for planes aligned with segment to prevent skew in dashing float distanceFromStart = rayPlaneDistanceUnsafe(eyeCoordinate.xyz, -v_forwardDirectionEC, v_forwardDirectionEC.xyz, v_alignedPlaneDistances.x); diff --git a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js index 61b4cf816392..236f3efee529 100644 --- a/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js +++ b/Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js @@ -883,8 +883,8 @@ define([ this.tileText += '
SW corner: ' + newTile.rectangle.west + ', ' + newTile.rectangle.south; this.tileText += '
NE corner: ' + newTile.rectangle.east + ', ' + newTile.rectangle.north; var data = newTile.data; - if (defined(data)) { - this.tileText += '
Min: ' + data.minimumHeight + ' Max: ' + data.maximumHeight; + if (defined(data) && defined(data.tileBoundingRegion)) { + this.tileText += '
Min: ' + data.tileBoundingRegion.minimumHeight + ' Max: ' + data.tileBoundingRegion.maximumHeight; } else { this.tileText += '
(Tile is not loaded)'; } diff --git a/Specs/Core/GroundPolylineGeometrySpec.js b/Specs/Core/GroundPolylineGeometrySpec.js index 2cb6b7d3e514..ba322b1bd872 100644 --- a/Specs/Core/GroundPolylineGeometrySpec.js +++ b/Specs/Core/GroundPolylineGeometrySpec.js @@ -287,7 +287,7 @@ defineSuite([ positions : Cartesian3.fromDegreesArray([ 0.01, 0.0, 0.02, 0.0, - 0.01, 0.0 + 0.01, CesiumMath.EPSILON7 ]), granularity : 0.0 }); @@ -299,11 +299,10 @@ defineSuite([ var miteredStartNormal = Cartesian3.unpack(startNormalAndForwardOffsetZvalues, 32); var miteredEndNormal = Cartesian3.unpack(endNormalAndTextureCoordinateNormalizationXvalues, 0); - var reverseMiteredEndNormal = Cartesian3.multiplyByScalar(miteredEndNormal, -1.0, new Cartesian3()); - expect(Cartesian3.equalsEpsilon(miteredStartNormal, reverseMiteredEndNormal, CesiumMath.EPSILON7)).toBe(true); + expect(Cartesian3.equalsEpsilon(miteredStartNormal, miteredEndNormal, CesiumMath.EPSILON7)).toBe(true); - var approximateExpectedMiterNormal = new Cartesian3(0.0, 1.0, 0.0); + var approximateExpectedMiterNormal = new Cartesian3(0.0, -1.0, 0.0); Cartesian3.normalize(approximateExpectedMiterNormal, approximateExpectedMiterNormal); expect(Cartesian3.equalsEpsilon(approximateExpectedMiterNormal, miteredStartNormal, CesiumMath.EPSILON2)).toBe(true);