// Set up the user interface for importing layers.
var selectFilesInput = document.getElementById('selectFilesInput');
selectFilesInput.addEventListener('change', function() {
if (this.files && this.files.length > 0) {
for (var i = 0; i < this.files.length; i++) {
importLayer(this.files[i]);
}
}
this.value = null;
});
var selectFilesButton = document.getElementById('selectFilesButton');
selectFilesButton.addEventListener('click', function() {
selectFilesInput.click();
});
// Convert an image file into a canvas.
function fileToCanvas(file, done) {
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var img = document.createElement('img');
img.onload = function() {
canvas.width = img.naturalWidth;
canvas.height = img.naturalHeight;
ctx.drawImage(img, 0, 0);
done(null, canvas);
};
img.onerror = function(err) {
done(err);
};
img.src = URL.createObjectURL(file);
}
Let me explain with an example: Bot scenes are from a room. First room dark, second room bright. If I move from the window to the table (is just an example) when I jump to the first image I want to see the table (that was my last pitch and yaw position)