diff --git a/dist/adapters/cubemap-tiles.js b/dist/adapters/cubemap-tiles.js index da08167fa..3b555aa83 100644 --- a/dist/adapters/cubemap-tiles.js +++ b/dist/adapters/cubemap-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -575,9 +575,7 @@ var _this3 = this; // eslint-disable-line no-unused-vars - var panorama = this.psv.config.panorama; - - if (!panorama) { + if (!this.prop.geom) { return; } @@ -585,6 +583,7 @@ camera.updateMatrixWorld(); projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); + var panorama = this.psv.config.panorama; var verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); var tilesToLoad = []; diff --git a/dist/adapters/cubemap-tiles.js.map b/dist/adapters/cubemap-tiles.js.map index d96c12a62..29c72b41a 100644 --- a/dist/adapters/cubemap-tiles.js.map +++ b/dist/adapters/cubemap-tiles.js.map @@ -1 +1 @@ -{"version":3,"file":"cubemap-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/cubemap-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { CUBE_HASHMAP, CubemapAdapter } from '../cubemap';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\nif (!CubemapAdapter) {\n throw new PSVError('CubemapAdapter is missing, please load cubemap.js before cubemap-tiles.js');\n}\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.CubemapTilesAdapter\n * @param {'left'|'front'|'right'|'back'|'top'|'bottom'} face\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Panorama\n * @summary Configuration of a tiled cubemap\n * @property {PSV.adapters.CubemapAdapter.Cubemap} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} faceSize - size of a face\n * @property {int} nbTiles - number of tiles on a side of a face\n * @property {PSV.adapters.CubemapTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Tile\n * @private\n * @property {int} face\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n\nconst CUBE_SEGMENTS = 16;\nconst NB_VERTICES_BY_FACE = 6;\nconst NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS;\nconst NB_VERTICES = 6 * NB_VERTICES_BY_PLANE;\nconst NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS;\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.face}:${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n/**\n * @summary Adapter for tiled cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapTilesAdapter extends CubemapAdapter {\n\n static id = 'cubemap-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapTilesAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} tileSize - size in pixels of a tile\n * @property {int} facesByTile - number of mesh faces by tile\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.BoxGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n tileSize : 0,\n facesByTile : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.CubemapTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.faceSize || !panorama.nbTiles || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.nbTiles > CUBE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama nbTiles must not be greater than ${CUBE_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.nbTiles)) {\n return Promise.reject(new PSVError('Panorama nbTiles must be power of 2.'));\n }\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n }));\n }\n else {\n return Promise.resolve({ panorama });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS)\n .scale(1, 1, -1)\n .toNonIndexed();\n\n geometry.clearGroups();\n for (let i = 0, k = 0; i < NB_VERTICES; i += NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, NB_VERTICES_BY_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.tileSize = panorama.faceSize / panorama.nbTiles;\n this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n for (let i = 0; i < 6; i++) {\n let material;\n if (texture) {\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture[i].center = new THREE.Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n material = new THREE.MeshBasicMaterial({ map: texture[i] });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let j = 0; j < NB_GROUPS_BY_FACE; j++) {\n mesh.material.push(material);\n }\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i * NB_GROUPS_BY_FACE].opacity = opacity;\n mesh.material[i * NB_GROUPS_BY_FACE].transparent = opacity < 1;\n }\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n const panorama = this.psv.config.panorama;\n\n if (!panorama) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let face = 0; face < 6; face++) {\n for (let col = 0; col < panorama.nbTiles; col++) {\n for (let row = 0; row < panorama.nbTiles; row++) {\n // for each tile, find the vertices corresponding to the four corners\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n const verticesIndex = [];\n\n // top-left\n const v0 = face * NB_VERTICES_BY_PLANE\n + row * this.prop.facesByTile * CUBE_SEGMENTS * NB_VERTICES_BY_FACE\n + col * this.prop.facesByTile * NB_VERTICES_BY_FACE;\n\n // bottom-left\n const v1 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile - 1) + 1;\n\n // bottom-right\n const v2 = v1 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // top-right\n const v3 = v0 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByTile >= CUBE_SEGMENTS / 2) {\n // top-center\n const v4 = v0 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 1;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 3;\n\n // left-center\n const v6 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile / 2 - 1) + 1;\n\n // right-center\n const v7 = v6 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // center-center\n const v8 = v6 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5, v6, v7, v8);\n }\n\n // if (init && face === 5 && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n const angle = vertexPosition.angleTo(this.psv.prop.direction);\n tilesToLoad.push({ face, col, row, angle });\n }\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.CubemapTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.CubemapTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n\n let { col, row } = tile;\n if (this.config.flipTopBottom && (tile.face === 2 || tile.face === 3)) {\n col = panorama.nbTiles - col - 1;\n row = panorama.nbTiles - row - 1;\n }\n const url = panorama.tileUrl(CUBE_HASHMAP[tile.face], col, row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.face, tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.tileSize, this.prop.tileSize);\n }\n this.__swapMaterial(tile.face, tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} face\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(face, col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByTile; c++) {\n for (let r = 0; r < this.prop.facesByTile; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByTile + c;\n const faceRow = row * this.prop.facesByTile + r;\n\n // first vertex for this face (6 vertices in total)\n const firstVertex = NB_VERTICES_BY_PLANE * face + 6 * (CUBE_SEGMENTS * faceRow + faceCol);\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n let top = 1 - r / this.prop.facesByTile;\n let bottom = 1 - (r + 1) / this.prop.facesByTile;\n let left = c / this.prop.facesByTile;\n let right = (c + 1) / this.prop.facesByTile;\n\n if (this.config.flipTopBottom && (face === 2 || face === 3)) {\n top = 1 - top;\n bottom = 1 - bottom;\n left = 1 - left;\n right = 1 - right;\n }\n\n uvs.setXY(firstVertex, left, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, top);\n uvs.setXY(firstVertex + 3, left, bottom);\n uvs.setXY(firstVertex + 4, right, bottom);\n uvs.setXY(firstVertex + 5, right, top);\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @override\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width should equals the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","CubemapAdapter","PSVError","CUBE_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_PLANE","NB_VERTICES","NB_GROUPS_BY_FACE","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","face","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","CubemapTilesAdapter","psv","options","config","flipTopBottom","showErrorTile","baseBlur","queue","prop","tileSize","facesByTile","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","faceSize","nbTiles","tileUrl","Promise","reject","isPowerOfTwo","textureData","resolve","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","center","Vector2","rotation","PI","opacity","transparent","j","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v3","v4","v5","v6","v7","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","CUBE_HASHMAP","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","firstVertex","matIndex","groups","find","g","materialIndex","top","b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;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/cubemap-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { CUBE_HASHMAP, CubemapAdapter } from '../cubemap';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\nif (!CubemapAdapter) {\n throw new PSVError('CubemapAdapter is missing, please load cubemap.js before cubemap-tiles.js');\n}\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.CubemapTilesAdapter\n * @param {'left'|'front'|'right'|'back'|'top'|'bottom'} face\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Panorama\n * @summary Configuration of a tiled cubemap\n * @property {PSV.adapters.CubemapAdapter.Cubemap} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} faceSize - size of a face\n * @property {int} nbTiles - number of tiles on a side of a face\n * @property {PSV.adapters.CubemapTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Tile\n * @private\n * @property {int} face\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n\nconst CUBE_SEGMENTS = 16;\nconst NB_VERTICES_BY_FACE = 6;\nconst NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS;\nconst NB_VERTICES = 6 * NB_VERTICES_BY_PLANE;\nconst NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS;\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.face}:${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n/**\n * @summary Adapter for tiled cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapTilesAdapter extends CubemapAdapter {\n\n static id = 'cubemap-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapTilesAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} tileSize - size in pixels of a tile\n * @property {int} facesByTile - number of mesh faces by tile\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.BoxGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n tileSize : 0,\n facesByTile : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.CubemapTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.faceSize || !panorama.nbTiles || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.nbTiles > CUBE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama nbTiles must not be greater than ${CUBE_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.nbTiles)) {\n return Promise.reject(new PSVError('Panorama nbTiles must be power of 2.'));\n }\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n }));\n }\n else {\n return Promise.resolve({ panorama });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS)\n .scale(1, 1, -1)\n .toNonIndexed();\n\n geometry.clearGroups();\n for (let i = 0, k = 0; i < NB_VERTICES; i += NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, NB_VERTICES_BY_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.tileSize = panorama.faceSize / panorama.nbTiles;\n this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n for (let i = 0; i < 6; i++) {\n let material;\n if (texture) {\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture[i].center = new THREE.Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n material = new THREE.MeshBasicMaterial({ map: texture[i] });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let j = 0; j < NB_GROUPS_BY_FACE; j++) {\n mesh.material.push(material);\n }\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i * NB_GROUPS_BY_FACE].opacity = opacity;\n mesh.material[i * NB_GROUPS_BY_FACE].transparent = opacity < 1;\n }\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let face = 0; face < 6; face++) {\n for (let col = 0; col < panorama.nbTiles; col++) {\n for (let row = 0; row < panorama.nbTiles; row++) {\n // for each tile, find the vertices corresponding to the four corners\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n const verticesIndex = [];\n\n // top-left\n const v0 = face * NB_VERTICES_BY_PLANE\n + row * this.prop.facesByTile * CUBE_SEGMENTS * NB_VERTICES_BY_FACE\n + col * this.prop.facesByTile * NB_VERTICES_BY_FACE;\n\n // bottom-left\n const v1 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile - 1) + 1;\n\n // bottom-right\n const v2 = v1 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // top-right\n const v3 = v0 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByTile >= CUBE_SEGMENTS / 2) {\n // top-center\n const v4 = v0 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 1;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 3;\n\n // left-center\n const v6 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile / 2 - 1) + 1;\n\n // right-center\n const v7 = v6 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // center-center\n const v8 = v6 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5, v6, v7, v8);\n }\n\n // if (init && face === 5 && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n const angle = vertexPosition.angleTo(this.psv.prop.direction);\n tilesToLoad.push({ face, col, row, angle });\n }\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.CubemapTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.CubemapTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n\n let { col, row } = tile;\n if (this.config.flipTopBottom && (tile.face === 2 || tile.face === 3)) {\n col = panorama.nbTiles - col - 1;\n row = panorama.nbTiles - row - 1;\n }\n const url = panorama.tileUrl(CUBE_HASHMAP[tile.face], col, row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.face, tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.tileSize, this.prop.tileSize);\n }\n this.__swapMaterial(tile.face, tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} face\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(face, col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByTile; c++) {\n for (let r = 0; r < this.prop.facesByTile; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByTile + c;\n const faceRow = row * this.prop.facesByTile + r;\n\n // first vertex for this face (6 vertices in total)\n const firstVertex = NB_VERTICES_BY_PLANE * face + 6 * (CUBE_SEGMENTS * faceRow + faceCol);\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n let top = 1 - r / this.prop.facesByTile;\n let bottom = 1 - (r + 1) / this.prop.facesByTile;\n let left = c / this.prop.facesByTile;\n let right = (c + 1) / this.prop.facesByTile;\n\n if (this.config.flipTopBottom && (face === 2 || face === 3)) {\n top = 1 - top;\n bottom = 1 - bottom;\n left = 1 - left;\n right = 1 - right;\n }\n\n uvs.setXY(firstVertex, left, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, top);\n uvs.setXY(firstVertex + 3, left, bottom);\n uvs.setXY(firstVertex + 4, right, bottom);\n uvs.setXY(firstVertex + 5, right, top);\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @override\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width should equals the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","CubemapAdapter","PSVError","CUBE_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_PLANE","NB_VERTICES","NB_GROUPS_BY_FACE","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","face","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","CubemapTilesAdapter","psv","options","config","flipTopBottom","showErrorTile","baseBlur","queue","prop","tileSize","facesByTile","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","faceSize","nbTiles","tileUrl","Promise","reject","isPowerOfTwo","textureData","resolve","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","center","Vector2","rotation","PI","opacity","transparent","j","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v3","v4","v5","v6","v7","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","CUBE_HASHMAP","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createCubemapTexture","logWarn","w","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EArBH;;EAAA,SAuBEC,KAvBF,GAuBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,MAAA,KAAI,CAACL,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYK,IAA1B;EACD,KAHI,EAGF,YAAM;EACP,MAAA,KAAI,CAACN,MAAL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H,CAAC,EAA5C,EAAgD;EAAA,cAAvCA,CAAuC;EA+B/C;EACF;;EAEDF,IAAAA,GAAG,CAACF,WAAJ,GAAkB,IAAlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EACA;EA/bA;;EAAA,SAgcEkB,sBAhcF,GAgcE,gCAAuB3K,GAAvB,EAA4B;EAC1B,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAtB,EAA8B;EAC5B6B,MAAAA,uBAAK,CAACiK,OAAN,CAAc,wDAAd;EACD;;EAED,WAAO7K,iBAAiB,CAACC,GAAD,EAAM,KAAKqC,MAAL,CAAYG,QAAlB,EAA4B,UAAAqI,CAAC;EAAA,aAAIA,CAAJ;EAAA,KAA7B,CAAxB;EACD,GAtcH;;EAAA;EAAA,EAAyChK,sBAAzC;EAAaqB,oBAEJ1F,KAAK;EAFD0F,oBAGJ4I,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/cubemap.js b/dist/adapters/cubemap.js index 11fb5dec6..fe1b84c3a 100644 --- a/dist/adapters/cubemap.js +++ b/dist/adapters/cubemap.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/adapters/equirectangular-tiles.js b/dist/adapters/equirectangular-tiles.js index ec53164c1..280dfac67 100644 --- a/dist/adapters/equirectangular-tiles.js +++ b/dist/adapters/equirectangular-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -633,9 +633,7 @@ var _this3 = this; // eslint-disable-line no-unused-vars - var panorama = this.psv.config.panorama; - - if (!panorama) { + if (!this.prop.geom) { return; } @@ -643,6 +641,7 @@ camera.updateMatrixWorld(); projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); + var panorama = this.psv.config.panorama; var verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); var tilesToLoad = []; diff --git a/dist/adapters/equirectangular-tiles.js.map b/dist/adapters/equirectangular-tiles.js.map index 998ad47cb..27f1af435 100644 --- a/dist/adapters/equirectangular-tiles.js.map +++ b/dist/adapters/equirectangular-tiles.js.map @@ -1 +1 @@ -{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n this.NB_VERTICES_BY_FACE = 6;\n this.NB_VERTICES_BY_SMALL_FACE = 3;\n this.NB_VERTICES = 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS;\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > this.SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${this.SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > this.SPHERE_HORIZONTAL_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${this.SPHERE_HORIZONTAL_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.cols) || !utils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.width / 2 / panorama.rows;\n this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n let material;\n if (texture) {\n material = new THREE.MeshBasicMaterial({ map: texture });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n const panorama = this.psv.config.panorama;\n\n if (!panorama) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.colSize, this.prop.rowSize);\n }\n this.__swapMaterial(tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === (this.SPHERE_HORIZONTAL_SEGMENTS - 1);\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else if (isLastRow) {\n firstVertex = this.NB_VERTICES\n - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else {\n firstVertex = this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (faceRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + faceCol * this.NB_VERTICES_BY_FACE;\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @private\n */\n __createBaseTexture(img) {\n if (img.width !== img.height * 2) {\n utils.logWarn('Invalid base image, the width should be twice the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w / 2);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","useXmpData","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EArBH;;EAAA,SAuBEC,KAvBF,GAuBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,MAAA,KAAI,C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iCF,GAAjC;EACAb,UAAAA,GAAG,CAACiB,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BS,KAA3B,EAAkCF,MAAlC;EACAd,UAAAA,GAAG,CAACiB,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BQ,IAA3B,EAAiCF,GAAjC;EACAb,UAAAA,GAAG,CAACiB,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BQ,IAA3B,EAAiCD,MAAjC;EACAd,UAAAA,GAAG,CAACiB,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BS,KAA3B,EAAkCF,MAAlC;EACD;EAnD0C;;EAC7C,WAAK,IAAIZ,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKtH,IAAL,CAAUI,UAA9B,EAA0CkH,CAAC,EAA3C,EAA+C;EAAA,cAAtCA,CAAsC;EAmD9C;EACF;;EAEDF,IAAAA,GAAG,CAACF,WAAJ,GAAkB,IAAlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EAnkBA;;EAAA,SAokBEoB,mBApkBF,GAokBE,6BAAoBjL,GAApB,EAAyB;EACvB,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAJ,GAAa,CAA/B,EAAkC;EAChC6B,MAAAA,uBAAK,CAACuK,OAAN,CAAc,0DAAd;EACD;;EAED,WAAOnL,iBAAiB,CAACC,GAAD,EAAM,KAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAkJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GA1kBH;;EAAA;EAAA,EAAiDC,wCAAjD;EAAa1J,4BAEJlF,KAAK;EAFDkF,4BAGJ2J,mBAAmB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n this.NB_VERTICES_BY_FACE = 6;\n this.NB_VERTICES_BY_SMALL_FACE = 3;\n this.NB_VERTICES = 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS;\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > this.SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${this.SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > this.SPHERE_HORIZONTAL_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${this.SPHERE_HORIZONTAL_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.cols) || !utils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.width / 2 / panorama.rows;\n this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n let material;\n if (texture) {\n material = new THREE.MeshBasicMaterial({ map: texture });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.colSize, this.prop.rowSize);\n }\n this.__swapMaterial(tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === (this.SPHERE_HORIZONTAL_SEGMENTS - 1);\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else if (isLastRow) {\n firstVertex = this.NB_VERTICES\n - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else {\n firstVertex = this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (faceRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + faceCol * this.NB_VERTICES_BY_FACE;\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @private\n */\n __createBaseTexture(img) {\n if (img.width !== img.height * 2) {\n utils.logWarn('Invalid base image, the width should be twice the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w / 2);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","useXmpData","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EArBH;;EAAA,SAuBEC,KAvBF,GAuBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,MAAA,KAAI,CAACL,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYK,IAA1B;EACD,KAHI,EAGF,YAAM;EACP,MAAA,KAAI,CAACN,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYM,KAA1B;EACD,KALI,CAAP;EAMD,GA/BH;;EAAA,SAiCEC,MAjCF,GAiCE,kBAAS;EACP,SAAKR,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYQ,SAA1B;EACD,GAnCH;;EAAA,SAqCEC,WArCF,GAqCE,uBAAc;EACZ,WAAO,KAAKV,MAAL,KAAgBJ,IAAI,CAACK,MAAL,CAAYQ,SAAnC;EACD,GAvCH;;EAAA;EAAA;EAAab,KAEJK,SAAS;EACdU,EAAAA,QAAQ,EAAG,CAAC,CADE;EAEdT,E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,KAAKtH,IAAL,CAAUI,UAA9B,EAA0CkH,CAAC,EAA3C,EAA+C;EAAA,cAAtCA,CAAsC;EAmD9C;EACF;;EAEDF,IAAAA,GAAG,CAACF,WAAJ,GAAkB,IAAlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EAlkBA;;EAAA,SAmkBEoB,mBAnkBF,GAmkBE,6BAAoBjL,GAApB,EAAyB;EACvB,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAJ,GAAa,CAA/B,EAAkC;EAChC6B,MAAAA,uBAAK,CAACuK,OAAN,CAAc,0DAAd;EACD;;EAED,WAAOnL,iBAAiB,CAACC,GAAD,EAAM,KAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAkJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GAzkBH;;EAAA;EAAA,EAAiDC,wCAAjD;EAAa1J,4BAEJlF,KAAK;EAFDkF,4BAGJ2J,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index 51db54161..f5a7851d9 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.2 + * Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index a94c382f2..0d006b456 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/autorotate-keypoints.js b/dist/plugins/autorotate-keypoints.js index 4931d11da..6a0772f3d 100644 --- a/dist/plugins/autorotate-keypoints.js +++ b/dist/plugins/autorotate-keypoints.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/compass.css b/dist/plugins/compass.css index eee19c76b..b3fa021ab 100644 --- a/dist/plugins/compass.css +++ b/dist/plugins/compass.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.2 + * Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/compass.js b/dist/plugins/compass.js index 247723d9e..2cc8e242c 100644 --- a/dist/plugins/compass.js +++ b/dist/plugins/compass.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/gyroscope.js b/dist/plugins/gyroscope.js index 9fa3757d5..ca951296e 100644 --- a/dist/plugins/gyroscope.js +++ b/dist/plugins/gyroscope.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/markers.css b/dist/plugins/markers.css index a079569f4..39f007b4d 100644 --- a/dist/plugins/markers.css +++ b/dist/plugins/markers.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.2 + * Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/markers.js b/dist/plugins/markers.js index 2e145051c..ab7e21fac 100644 --- a/dist/plugins/markers.js +++ b/dist/plugins/markers.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/resolution.js b/dist/plugins/resolution.js index fa1d9264b..b263f1ff9 100644 --- a/dist/plugins/resolution.js +++ b/dist/plugins/resolution.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.css b/dist/plugins/settings.css index ba8c42d01..53f78a372 100644 --- a/dist/plugins/settings.css +++ b/dist/plugins/settings.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.2 + * Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index e74d661e0..3200b7bd0 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/stereo.js b/dist/plugins/stereo.js index 23dd5a3b2..54d145944 100644 --- a/dist/plugins/stereo.js +++ b/dist/plugins/stereo.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/virtual-tour.css b/dist/plugins/virtual-tour.css index a84e489da..4dc94b81c 100644 --- a/dist/plugins/virtual-tour.css +++ b/dist/plugins/virtual-tour.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.2 + * Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/virtual-tour.js b/dist/plugins/virtual-tour.js index a8e7d9321..2b91e41ca 100644 --- a/dist/plugins/virtual-tour.js +++ b/dist/plugins/virtual-tour.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/visible-range.js b/dist/plugins/visible-range.js index b696f0033..5fb04b004 100644 --- a/dist/plugins/visible-range.js +++ b/dist/plugins/visible-range.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.2 +* Photo Sphere Viewer 4.5.3 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/package.json b/package.json index f85177846..65644395b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photo-sphere-viewer", - "version": "4.5.2", + "version": "4.5.3", "description": "A JavaScript library to display Photo Sphere panoramas", "homepage": "https://photo-sphere-viewer.js.org", "main": "dist/photo-sphere-viewer.js", diff --git a/src/adapters/cubemap-tiles/index.js b/src/adapters/cubemap-tiles/index.js index 37a78472e..4eb512d83 100644 --- a/src/adapters/cubemap-tiles/index.js +++ b/src/adapters/cubemap-tiles/index.js @@ -308,9 +308,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { * @private */ __refresh(init = false) { // eslint-disable-line no-unused-vars - const panorama = this.psv.config.panorama; - - if (!panorama) { + if (!this.prop.geom) { return; } @@ -319,6 +317,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); + const panorama = this.psv.config.panorama; const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); const tilesToLoad = []; diff --git a/src/adapters/equirectangular-tiles/index.js b/src/adapters/equirectangular-tiles/index.js index bb169d42b..c2bcd741f 100644 --- a/src/adapters/equirectangular-tiles/index.js +++ b/src/adapters/equirectangular-tiles/index.js @@ -363,9 +363,7 @@ export class EquirectangularTilesAdapter extends EquirectangularAdapter { * @private */ __refresh(init = false) { // eslint-disable-line no-unused-vars - const panorama = this.psv.config.panorama; - - if (!panorama) { + if (!this.prop.geom) { return; } @@ -374,6 +372,7 @@ export class EquirectangularTilesAdapter extends EquirectangularAdapter { projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); + const panorama = this.psv.config.panorama; const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); const tilesToLoad = [];