Skip to content

Commit

Permalink
[3d-tiles] Handle GLTF w/ CESIUM_RTC extension (#645)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pessimistress committed Feb 11, 2020
1 parent 8671935 commit 588ff8c
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/3d-tiles/src/lib/parsers/parse-3d-tile-batched-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import {parse3DTileGLTFViewSync, extractGLTF, GLTF_FORMAT} from './helpers/parse
export async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
await extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context);

const {extensions} = tile.gltf || {};
if (extensions && extensions.CESIUM_RTC) {
tile.rtcCenter = extensions.CESIUM_RTC.center;
}

return byteOffset;
}

export function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {
function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {
byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset, options);

byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset, options);
Expand All @@ -26,7 +32,5 @@ export function parseBatchedModel(tile, arrayBuffer, byteOffset, options, contex
const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);

extractGLTF(tile, GLTF_FORMAT.EMBEDDED, options, context);

return byteOffset;
}

0 comments on commit 588ff8c

Please sign in to comment.