Skip to content

Commit

Permalink
do not copy arraybuffer if glb is not 4byte aligned.
Browse files Browse the repository at this point in the history
  • Loading branch information
jbo023 committed Mar 5, 2018
1 parent f67bc11 commit db15643
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
9 changes: 3 additions & 6 deletions Source/Scene/Batched3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,13 +364,10 @@ define([
throw new RuntimeError('glTF byte length must be greater than 0.');
}

var gltfView;
if (byteOffset % 4 === 0) {
gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
} else {
// Create a copy of the glb so that it is 4-byte aligned
var gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
if (byteOffset % 4 !== 0) {
// If glb is not 4-byte aligned print deprecation warning
Batched3DModel3DTileContent._deprecationWarning('b3dm-glb-unaligned', 'The embedded glb is not aligned to a 4-byte boundary.');
gltfView = new Uint8Array(uint8Array.subarray(byteOffset, byteOffset + gltfByteLength));
}

var pickObject = {
Expand Down
9 changes: 3 additions & 6 deletions Source/Scene/Instanced3DModel3DTileContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,10 @@ define([
throw new RuntimeError('glTF byte length is zero, i3dm must have a glTF to instance.');
}

var gltfView;
if (byteOffset % 4 === 0) {
gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
} else {
// Create a copy of the glb so that it is 4-byte aligned
var gltfView = new Uint8Array(arrayBuffer, byteOffset, gltfByteLength);
if (byteOffset % 4 !== 0) {
// If glb is not 4-byte aligned print deprecation warning
Instanced3DModel3DTileContent._deprecationWarning('i3dm-glb-unaligned', 'The embedded glb is not aligned to a 4-byte boundary.');
gltfView = new Uint8Array(uint8Array.subarray(byteOffset, byteOffset + gltfByteLength));
}

// Create model instance collection
Expand Down

0 comments on commit db15643

Please sign in to comment.