Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into entity-articulations
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGES.md
  • Loading branch information
emackey committed Jun 11, 2019
2 parents 05874e7 + 0c0307a commit d01da70
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 35 deletions.
10 changes: 8 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
45 changes: 23 additions & 22 deletions Source/Core/GroundPolylineGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
6 changes: 5 additions & 1 deletion Source/Scene/Globe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions Source/Scene/GlobeDepth.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,8 @@ define([
});
}

globeDepth._copyColorCommand.renderState = globeDepth._rs;

if (!defined(globeDepth._tempCopyDepthCommand)) {
globeDepth._tempCopyDepthCommand = context.createViewportQuadCommand(PassThroughDepth, {
uniformMap : {
Expand Down
6 changes: 5 additions & 1 deletion Source/Scene/QuadtreePrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ varying vec4 v_color;

void main()
{
gl_FragColor = v_color;
gl_FragColor = czm_gammaCorrect(v_color);
}
2 changes: 1 addition & 1 deletion Source/Shaders/PolylineShadowVolumeFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion Source/Shaders/PolylineShadowVolumeMorphFS.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Source/Widgets/CesiumInspector/CesiumInspectorViewModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ define([
this.tileText += '<br>SW corner: ' + newTile.rectangle.west + ', ' + newTile.rectangle.south;
this.tileText += '<br>NE corner: ' + newTile.rectangle.east + ', ' + newTile.rectangle.north;
var data = newTile.data;
if (defined(data)) {
this.tileText += '<br>Min: ' + data.minimumHeight + ' Max: ' + data.maximumHeight;
if (defined(data) && defined(data.tileBoundingRegion)) {
this.tileText += '<br>Min: ' + data.tileBoundingRegion.minimumHeight + ' Max: ' + data.tileBoundingRegion.maximumHeight;
} else {
this.tileText += '<br>(Tile is not loaded)';
}
Expand Down
7 changes: 3 additions & 4 deletions Specs/Core/GroundPolylineGeometrySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
Expand All @@ -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);
Expand Down

0 comments on commit d01da70

Please sign in to comment.