Sfoglia il codice sorgente

Fix bug in multires tile loading, which primarily affects Safari (#1012).

Bug was introduced in 5eab5366f6. It caused tile
loader objects of non-web-worker-based tile loading method to sometimes be
lost during scene changes.
pull/1024/head
Matthew Petroff 3 anni fa
parent
commit
2ea5f4b992
1 ha cambiato i file con 16 aggiunte e 9 eliminazioni
  1. +16
    -9
      src/js/libpannellum.js

+ 16
- 9
src/js/libpannellum.js Vedi File

@@ -97,6 +97,11 @@ function Renderer(container) {
if (program.nodeCache)
for (var i = 0; i < program.nodeCache.length; i++)
gl.deleteTexture(program.nodeCache[i].texture);
if (program.textureLoads) {
pendingTextureRequests = [];
while (program.textureLoads.length > 0)
program.textureLoads.shift()(false);
}
gl.deleteProgram(program);
program = undefined;
}
@@ -929,7 +934,7 @@ function Renderer(container) {
// This is synchronized to rendering to avoid dropping frames due
// to texture loading happening at an inopportune time.
if (program.textureLoads.length > 0)
program.textureLoads.shift()();
program.textureLoads.shift()(true);

// Draw tiles
multiresDraw(!isPreview);
@@ -1357,12 +1362,14 @@ function Renderer(container) {
this.image = new Image();
this.image.crossOrigin = crossOrigin ? crossOrigin : 'anonymous';
var loadFn = function() {
program.textureLoads.push(function() {
if (self.image.width > 0 && self.image.height > 0) { // Ignore missing tile to support partial image
processLoadedTexture(self.image, self.texture);
self.callback(self.texture, true);
} else {
self.callback(self.texture, false);
program.textureLoads.push(function(execute) {
if (execute) {
if (self.image.width > 0 && self.image.height > 0) { // Ignore missing tile to support partial image
processLoadedTexture(self.image, self.texture);
self.callback(self.texture, true);
} else {
self.callback(self.texture, false);
}
}
releaseTextureImageLoader(self);
});
@@ -1446,10 +1453,10 @@ function Renderer(container) {
var path = e.data[0],
success = e.data[1],
bitmap = e.data[2];
program.textureLoads.push(function() {
program.textureLoads.push(function(execute) {
var texture,
loaded = false;
if (success) { // Ignore missing tile to support partial image
if (success && execute) { // Ignore missing tile to support partial image
texture = gl.createTexture();
processLoadedTexture(bitmap, texture);
loaded = true;


Caricamento…
Annulla
Salva