Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue where we constantly fail to load the same image. #6710

Merged
merged 3 commits into from
Jun 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
* Fixed an issue where KMLs containing a `colorMode` of `random` could return the exact same color on successive calls to `Color.fromRandom()`.

### 1.46.1 - 2018-06-01
Expand Down
22 changes: 15 additions & 7 deletions Source/Scene/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
});
}

Expand Down