diff --git a/src/Parser/B3dmParser.js b/src/Parser/B3dmParser.js index f1fb3900c3..00fc173f0f 100644 --- a/src/Parser/B3dmParser.js +++ b/src/Parser/B3dmParser.js @@ -46,7 +46,7 @@ function filterUnsupportedSemantics(obj) { * @param {THREE.Object3D} gltfScene - the parsed glTF scene * @param {String} gltfUpAxis - the gltfUpAxis parameter */ -function manageGltfRotation(gltfScene, gltfUpAxis) { +function applyDeprecatedGltfUpAxis(gltfScene, gltfUpAxis) { if (gltfUpAxis === 'Z') { // If gltf up was already z-up, apply the inverse transform matrix that was applied in the glTFParser gltfScene.applyMatrix4(matrixChangeUpVectorYtoZInv); @@ -178,7 +178,7 @@ export default { scene.traverse(filterUnsupportedSemantics); } - manageGltfRotation(gltf.scene, options.gltfUpAxis); + applyDeprecatedGltfUpAxis(gltf.scene, options.gltfUpAxis); const shouldBePatchedForLogDepthSupport = Capabilities.isLogDepthBufferSupported() && !options.doNotPatchMaterial; if (options.frustumCulling === false || options.overrideMaterials || shouldBePatchedForLogDepthSupport || options.layer) { diff --git a/src/Provider/3dTilesProvider.js b/src/Provider/3dTilesProvider.js index c54a7bbaab..adf011a66b 100644 --- a/src/Provider/3dTilesProvider.js +++ b/src/Provider/3dTilesProvider.js @@ -26,7 +26,7 @@ function b3dmToMesh(data, layer, url) { } function gltfToMesh(data, layer, url) { - const urlBase = THREE.LoaderUtils.extractUrlBase(url); // TODO verify that ? We already have it in layer.source.baseUrl? + const urlBase = THREE.LoaderUtils.extractUrlBase(url); return GLTFParser.parse(data, urlBase).then(result => ({ object3d: result.scene })); } @@ -112,6 +112,8 @@ function executeCommand(command) { if (magic[0] === '{') { result = JSON.parse(utf8Decoder.decode(new Uint8Array(result))); let newPrefix = ''; + // Another specifics of 3D tiles from Google: tilesets in tilesets are required from the root base + // url and not from their parent base url if (layer.source.isC3DTilesGoogleSource) { newPrefix = layer.source.baseUrl; } else { diff --git a/src/Source/C3DTilesGoogleSource.js b/src/Source/C3DTilesGoogleSource.js index 63fbec2c9c..8e37a068b1 100644 --- a/src/Source/C3DTilesGoogleSource.js +++ b/src/Source/C3DTilesGoogleSource.js @@ -64,11 +64,14 @@ class C3DTilesGoogleSource extends C3DTilesSource { }); } - // TODO make it static? + /** + * Adds the key and session to the tile url (non-standard behaviour, that is specific to Google 3D tiles), + * see https://github.com/CesiumGS/3d-tiles/issues/746 + * @param {String} url the tile url + * @returns {String} the tile url with Google map tiles api key and session parameters added at the end of the url + */ getTileUrl(url) { const extraParameters = `key=${this.key}&session=${this.sessionId}`; - // special case to handle non-standard 3dTilesGoogle behavior - // see also https://github.com/CesiumGS/3d-tiles/issues/746 return /\?/.test(url) ? `${url}&${extraParameters}` : `${url}?${extraParameters}`; } }