Skip to content

Commit

Permalink
Merge branch 'master' into fixClippingPlaneCrash
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse authored May 11, 2018
2 parents e207da8 + 97eb855 commit 51bc9c3
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 34 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Change Log

##### Fixes :wrench:
* Fixed a bug causing custom TilingScheme classes to not be able to use a GeographicProjection. [#6524](https://github.com/AnalyticalGraphicsInc/cesium/pull/6524)
* Fixed incorrect 3D Tiles statistics when a tile fails during processing. [#6558](https://github.com/AnalyticalGraphicsInc/cesium/pull/6558)
* Fixed race condition causing intermittent crash when changing geometry show value [#3061](https://github.com/AnalyticalGraphicsInc/cesium/issues/3061)
* `ProviderViewModel`s with no category are displayed in an untitled group in `BaseLayerPicker` instead of being labeled as `'Other'` [#6574](https://github.com/AnalyticalGraphicsInc/cesium/pull/6574)
* Fixed a bug causing intermittent crashes with clipping planes due to uninitialized textures. [#6576](https://github.com/AnalyticalGraphicsInc/cesium/pull/6576)
* Added a workaround for clipping planes causing a picking shader compilation failure for gltf models and 3D Tilesets in Internet Explorer [#6575](https://github.com/AnalyticalGraphicsInc/cesium/issues/6575)

### 1.45 - 2018-05-01

Expand Down
50 changes: 26 additions & 24 deletions Source/Scene/Cesium3DTileset.js
Original file line number Diff line number Diff line change
Expand Up @@ -1435,25 +1435,8 @@ define([

++statistics.numberOfPendingRequests;

var removeFunction = removeFromProcessingQueue(tileset, tile);
tile.contentReadyToProcessPromise.then(addToProcessingQueue(tileset, tile));
tile.contentReadyPromise.then(function() {
removeFunction();
tileset.tileLoad.raiseEvent(tile);
}).otherwise(function(error) {
removeFunction();
var url = tile._contentResource.url;
var message = defined(error.message) ? error.message : error.toString();
if (tileset.tileFailed.numberOfListeners > 0) {
tileset.tileFailed.raiseEvent({
url : url,
message : message
});
} else {
console.log('A 3D tile failed to load: ' + url);
console.log('Error: ' + message);
}
});
tile.contentReadyPromise.then(handleTileSuccess(tileset, tile)).otherwise(handleTileFailure(tileset, tile));
}

function requestTiles(tileset, outOfCore) {
Expand All @@ -1476,15 +1459,32 @@ define([
};
}

function removeFromProcessingQueue(tileset, tile) {
return function() {
if (tile._contentState === Cesium3DTileContentState.FAILED) {
// Not in processing queue
// For example, when a url request fails and the ready promise is rejected
function handleTileFailure(tileset, tile) {
return function(error) {
if (tileset._processingQueue.indexOf(tile) >= 0) {
// Failed during processing
--tileset._statistics.numberOfTilesProcessing;
} else {
// Failed when making request
--tileset._statistics.numberOfPendingRequests;
return;
}

var url = tile._contentResource.url;
var message = defined(error.message) ? error.message : error.toString();
if (tileset.tileFailed.numberOfListeners > 0) {
tileset.tileFailed.raiseEvent({
url : url,
message : message
});
} else {
console.log('A 3D tile failed to load: ' + url);
console.log('Error: ' + message);
}
};
}

function handleTileSuccess(tileset, tile) {
return function() {
--tileset._statistics.numberOfTilesProcessing;

if (tile.hasRenderableContent) {
Expand All @@ -1498,6 +1498,8 @@ define([
tile.replacementNode = tileset._replacementList.add(tile);
}
}

tileset.tileLoad.raiseEvent(tile);
};
}

Expand Down
33 changes: 23 additions & 10 deletions Source/Scene/Model.js
Original file line number Diff line number Diff line change
Expand Up @@ -1995,10 +1995,16 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(fs, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
// Internet Explorer seems to have problems with discard (for clipping planes) after too many levels of indirection:
// https://github.com/AnalyticalGraphicsInc/cesium/issues/6575.
// For IE log depth code is defined out anyway due to unsupported WebGL extensions, so the wrappers can be omitted.
if (!FeatureDetection.isInternetExplorer()) {
drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2008,8 +2014,10 @@ define([
pickFS = ShaderSource.createPickFragmentShaderSource(fs, 'uniform');
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down Expand Up @@ -2041,10 +2049,13 @@ define([
var drawVS = modifyShader(vs, id, model._vertexShaderLoaded);
var drawFS = modifyShader(finalFS, id, model._fragmentShaderLoaded);

drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
if (!FeatureDetection.isInternetExplorer()) {
drawVS = ModelUtility.modifyVertexShaderForLogDepth(drawVS, toClipCoordinatesGLSL);
drawFS = ModelUtility.modifyFragmentShaderForLogDepth(drawFS);
}

var pickFS, pickVS;
var pickFS;
var pickVS;
if (model.allowPicking) {
// PERFORMANCE_IDEA: Can optimize this shader with a glTF hint. https://github.com/KhronosGroup/glTF/issues/181
pickVS = modifyShader(vs, id, model._pickVertexShaderLoaded);
Expand All @@ -2058,8 +2069,10 @@ define([
pickFS = modifyShaderForClippingPlanes(pickFS, clippingPlaneCollection, context);
}

pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
if (!FeatureDetection.isInternetExplorer()) {
pickVS = ModelUtility.modifyVertexShaderForLogDepth(pickVS, toClipCoordinatesGLSL);
pickFS = ModelUtility.modifyFragmentShaderForLogDepth(pickFS);
}
}
createAttributesAndProgram(id, drawFS, drawVS, pickFS, pickVS, model, context);
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Scene/PointCloudShading.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ define([
* @param {Boolean} [options.eyeDomeLighting=true] When true, use eye dome lighting when drawing with point attenuation.
* @param {Number} [options.eyeDomeLightingStrength=1.0] Increasing this value increases contrast on slopes and edges.
* @param {Number} [options.eyeDomeLightingRadius=1.0] Increase the thickness of contours from eye dome lighting.
*
* @alias PointCloudShading
* @constructor
*/
function PointCloudShading(options) {
Expand Down
32 changes: 32 additions & 0 deletions Specs/Scene/Cesium3DTilesetSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,38 @@ defineSuite([
fail('should not resolve');
}).otherwise(function(error) {
expect(root._contentState).toEqual(Cesium3DTileContentState.FAILED);
var statistics = tileset.statistics;
expect(statistics.numberOfAttemptedRequests).toBe(0);
expect(statistics.numberOfPendingRequests).toBe(0);
expect(statistics.numberOfTilesProcessing).toBe(0);
expect(statistics.numberOfTilesWithContentReady).toBe(0);
});
});
});

it('handles failed tile processing', function() {
viewRootOnly();
var tileset = scene.primitives.add(new Cesium3DTileset({
url : tilesetUrl
}));
return tileset.readyPromise.then(function(tileset) {
// Start spying after the tileset json has been loaded
spyOn(Resource._Implementations, 'loadWithXhr').and.callFake(function(url, responseType, method, data, headers, deferred, overrideMimeType) {
deferred.resolve(Cesium3DTilesTester.generateBatchedTileBuffer({
version : 0 // Invalid version
}));
});
scene.renderForSpecs(); // Request root
var root = tileset._root;
return root.contentReadyPromise.then(function() {
fail('should not resolve');
}).otherwise(function(error) {
expect(root._contentState).toEqual(Cesium3DTileContentState.FAILED);
var statistics = tileset.statistics;
expect(statistics.numberOfAttemptedRequests).toBe(0);
expect(statistics.numberOfPendingRequests).toBe(0);
expect(statistics.numberOfTilesProcessing).toBe(0);
expect(statistics.numberOfTilesWithContentReady).toBe(0);
});
});
});
Expand Down

0 comments on commit 51bc9c3

Please sign in to comment.