|
@@ -2424,15 +2424,24 @@ function loadScene(sceneId, targetPitch, targetYaw, targetHfov, fadeDone) { |
|
|
if (config.sceneFadeDuration && !fadeDone) { |
|
|
if (config.sceneFadeDuration && !fadeDone) { |
|
|
var data = renderer.render(config.pitch * Math.PI / 180, config.yaw * Math.PI / 180, config.hfov * Math.PI / 180, {returnImage: true}); |
|
|
var data = renderer.render(config.pitch * Math.PI / 180, config.yaw * Math.PI / 180, config.hfov * Math.PI / 180, {returnImage: true}); |
|
|
if (data !== undefined) { |
|
|
if (data !== undefined) { |
|
|
fadeImg = new Image(); |
|
|
|
|
|
|
|
|
if (data instanceof HTMLCanvasElement) |
|
|
|
|
|
fadeImg = data; |
|
|
|
|
|
else |
|
|
|
|
|
fadeImg = new Image(); |
|
|
|
|
|
|
|
|
fadeImg.className = 'pnlm-fade-img'; |
|
|
fadeImg.className = 'pnlm-fade-img'; |
|
|
fadeImg.style.transition = 'opacity ' + (config.sceneFadeDuration / 1000) + 's'; |
|
|
fadeImg.style.transition = 'opacity ' + (config.sceneFadeDuration / 1000) + 's'; |
|
|
fadeImg.style.width = '100%'; |
|
|
fadeImg.style.width = '100%'; |
|
|
fadeImg.style.height = '100%'; |
|
|
fadeImg.style.height = '100%'; |
|
|
fadeImg.onload = function() { |
|
|
|
|
|
setTimeout(() => loadScene(sceneId, targetPitch, targetYaw, targetHfov, true), 100); // prevents black flickering before fading |
|
|
|
|
|
}; |
|
|
|
|
|
fadeImg.src = data; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data instanceof HTMLCanvasElement) |
|
|
|
|
|
setTimeout(() => loadScene(sceneId, targetPitch, targetYaw, targetHfov, true), 100); |
|
|
|
|
|
else { |
|
|
|
|
|
fadeImg.onload = function () { |
|
|
|
|
|
setTimeout(() => loadScene(sceneId, targetPitch, targetYaw, targetHfov, true), 100); // prevents black flickering before fading |
|
|
|
|
|
}; |
|
|
|
|
|
fadeImg.src = data; |
|
|
|
|
|
} |
|
|
renderContainer.appendChild(fadeImg); |
|
|
renderContainer.appendChild(fadeImg); |
|
|
renderer.fadeImg = fadeImg; |
|
|
renderer.fadeImg = fadeImg; |
|
|
return; |
|
|
return; |
|
|