From 59926aeb5f27323fa375a7e747c3ec85ceabdd1e Mon Sep 17 00:00:00 2001 From: Tom Fili Date: Wed, 20 Jun 2018 12:18:04 -0400 Subject: [PATCH 1/2] Fixed issue where we constantly fail to load the same image. --- Source/Scene/Material.js | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Source/Scene/Material.js b/Source/Scene/Material.js index d9852fefbde8..b1085580f377 100644 --- a/Source/Scene/Material.js +++ b/Source/Scene/Material.js @@ -788,9 +788,17 @@ define([ return; } - if (uniformValue !== material._texturePaths[uniformId]) { - if (typeof uniformValue === 'string' || uniformValue instanceof Resource) { - var resource = Resource.createIfNeeded(uniformValue); + // When using the entity layer, the Resource objects get recreated on getValue because + // they are clonable. That's why we check the url property for Resources + // because the instances aren't the same and we keep trying to load the same + // image if it fails to load. + var isResource = (uniformValue instanceof Resource); + if (!defined(material._texturePaths[uniformId]) || + (isResource && uniformValue.url !== material._texturePaths[uniformId].url) || + (!isResource && uniformValue !== material._texturePaths[uniformId])) { + if (typeof uniformValue === 'string' || isResource) { + var resource = isResource ? uniformValue : Resource.createIfNeeded(uniformValue); + var promise; if (ktxRegex.test(uniformValue)) { promise = loadKTX(resource); @@ -801,14 +809,14 @@ define([ } when(promise, function(image) { material._loadedImages.push({ - id : uniformId, - image : image + id: uniformId, + image: image }); }); } else if (uniformValue instanceof HTMLCanvasElement) { material._loadedImages.push({ - id : uniformId, - image : uniformValue + id: uniformId, + image: uniformValue }); } From d4172d0196e8f8088b77916e3119dcfce4e91a5e Mon Sep 17 00:00:00 2001 From: Tom Fili Date: Wed, 20 Jun 2018 12:25:31 -0400 Subject: [PATCH 2/2] Update CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 3fe777b4d644..e341702eabde 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * Fixed a bug causing Point Cloud tiles with unsigned int batch-ids to not load. [#6666](https://github.com/AnalyticalGraphicsInc/cesium/pull/6666) * Fixed a bug with Draco encoded i3dm tiles, and loading two Draco models with the same url. [#6668](https://github.com/AnalyticalGraphicsInc/cesium/issues/6668) * Fixed terrain clipping when the camera was close to flat terrain and was using logarithmic depth. [#6701](https://github.com/AnalyticalGraphicsInc/cesium/pull/6701) +* Fixed KML bug that constantly requested the same image if it failed to load. [#6710](https://github.com/AnalyticalGraphicsInc/cesium/pull/6710) ### 1.46.1 - 2018-06-01