Skip to content

Commit

Permalink
Fix a bug that made fill tiles flicker out after partial load.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Aug 8, 2018
1 parent aa4b806 commit 237f8de
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Scene/GlobeSurfaceShaderSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ define([
var quantization = 0;
var quantizationDefine = '';

var mesh = surfaceTile.mesh || surfaceTile.fillMesh;
var mesh = surfaceTile.vertexArray !== undefined ? surfaceTile.mesh : surfaceTile.fillMesh;
var terrainEncoding = mesh.encoding;
var quantizationMode = terrainEncoding.quantization;
if (quantizationMode === TerrainQuantization.BITS12) {
Expand Down
5 changes: 5 additions & 0 deletions Source/Scene/GlobeSurfaceTileProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,9 @@ define([
u_initialColor : function() {
return this.properties.initialColor;
},
u_isFill : function() {
return this.properties.isFill;
},
u_zoomedOutOceanSpecularIntensity : function() {
return this.properties.zoomedOutOceanSpecularIntensity;
},
Expand Down Expand Up @@ -1218,6 +1221,7 @@ define([
// derived commands that combine another uniform map with this one.
properties : {
initialColor : new Cartesian4(0.0, 0.0, 0.5, 1.0),
isFill : false,
zoomedOutOceanSpecularIntensity : 0.5,
oceanNormalMap : undefined,
lightingFadeDistance : new Cartesian2(6500000.0, 9000000.0),
Expand Down Expand Up @@ -1997,6 +2001,7 @@ define([

var uniformMapProperties = uniformMap.properties;
Cartesian4.clone(initialColor, uniformMapProperties.initialColor);
uniformMapProperties.isFill = surfaceTile.vertexArray === undefined;
uniformMapProperties.oceanNormalMap = oceanNormalMap;
uniformMapProperties.lightingFadeDistance.x = tileProvider.lightingFadeOutDistance;
uniformMapProperties.lightingFadeDistance.y = tileProvider.lightingFadeInDistance;
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/QuadtreePrimitive.js
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@ define([

tile._lastSelectionResult = TileSelectionResult.RENDERED;

// EXCEPT if we're waiting heaps of descendants, the above will take too long. So in that case,
// EXCEPT if we're waiting on heaps of descendants, the above will take too long. So in that case,
// load this tile INSTEAD of loading any of the descendants, and tell the up-level we're only waiting
// on this tile.
var wasRenderedLastFrame = tile._frameRendered === primitive._lastSelectionFrameNumber;
Expand Down
6 changes: 6 additions & 0 deletions Source/Shaders/GlobeFS.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//#define SHOW_TILE_BOUNDARIES
uniform vec4 u_initialColor;
uniform bool u_isFill;

#if TEXTURE_UNITS > 0
uniform sampler2D u_dayTextures[TEXTURE_UNITS];
Expand Down Expand Up @@ -249,6 +250,11 @@ void main()
}
#endif

if (u_isFill)
{
finalColor = vec4(mix(vec3(1.0, 0.0, 0.0), finalColor.rgb, 0.25), finalColor.a);
}

#ifdef FOG
const float fExposure = 2.0;
vec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;
Expand Down

0 comments on commit 237f8de

Please sign in to comment.