Skip to content

Commit

Permalink
Fix billboard and label clamping
Browse files Browse the repository at this point in the history
Turns out that billboard and label clamping were fundamentally broken
because the `QuadtreePrimitive` was processing the tile queue in the wrong
order.  It was always pulling new tiles from the back of the array rather
than the front, which meant that data would get processed in the wrong
order causing old tiles to take precedence over newer tiles.

Addtiionally, there was a bad if block in `Label.js` which caused the
initial position of the individual label billboards to not be properly set
when clamping was on, instead we should always set the positions before
calling `_updateClamping` (if needed).

Fixes #4396 and #4062
  • Loading branch information
mramato committed Oct 21, 2016
1 parent b75c311 commit 3af7d9b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
16 changes: 8 additions & 8 deletions Source/Scene/Label.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,15 @@ define([
if (!Cartesian3.equals(position, value)) {
Cartesian3.clone(value, position);

if (this._heightReference === HeightReference.NONE) {
var glyphs = this._glyphs;
for (var i = 0, len = glyphs.length; i < len; i++) {
var billboard = glyphs[i].billboard;
if (defined(billboard)) {
billboard.position = value;
}
var glyphs = this._glyphs;
for (var i = 0, len = glyphs.length; i < len; i++) {
var billboard = glyphs[i].billboard;
if (defined(billboard)) {
billboard.position = value;
}
} else {
}

if (this._heightReference !== HeightReference.NONE) {
this._updateClamping();
}
}
Expand Down
10 changes: 3 additions & 7 deletions Source/Scene/QuadtreePrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,7 @@ define([
var ellipsoid = projection.ellipsoid;

while (tilesToUpdateHeights.length > 0) {
var tile = tilesToUpdateHeights[tilesToUpdateHeights.length - 1];
if (tile !== primitive._lastTileUpdated) {
primitive._lastTileIndex = 0;
}

var tile = tilesToUpdateHeights[0];
var customData = tile.customData;
var customDataLength = customData.length;

Expand Down Expand Up @@ -682,11 +678,11 @@ define([
}

if (timeSliceMax) {
primitive._lastTileUpdated = tile;
primitive._lastTileIndex = i;
break;
} else {
tilesToUpdateHeights.pop();
primitive._lastTileIndex = 0;
tilesToUpdateHeights.shift();
}
}
}
Expand Down

0 comments on commit 3af7d9b

Please sign in to comment.