Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
jailln committed Feb 1, 2024
1 parent cd5d240 commit 4028887
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Parser/B3dmParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion src/Provider/3dTilesProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
}

Expand Down Expand Up @@ -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 {
Expand Down
9 changes: 6 additions & 3 deletions src/Source/C3DTilesGoogleSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
}
}
Expand Down

0 comments on commit 4028887

Please sign in to comment.