-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds 3DTILES_binary_buffers extension #415
Conversation
…rectly handle STRING
|**byteOffset**|`integer`|The offset relative to the start of the buffer in bytes.|☑️ Yes| | ||
|**byteLength**|`integer`|The length of the bufferView in bytes.| ☑️ Yes| | ||
|**elementCount**|`integer`|The number of elements in the buffer view.| ☑️ Yes| | ||
|**elementByteOffsetsBufferView**|`integer`|The index of the bufferView containing byte offsets for each element. Must be defined for the STRING type.|No| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can elementByteOffsetBufferView
be used for properties containing arbitrary sized chunks of binary data? What would be the elementType
in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, duplicate comment to #415 (comment). I thought github lost this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a NONUNIFORM
element type will be introduced in next draft to meet the requirements for EXT_3dtiles_feature_metadata
.
| DOUBLE | 64 | | ||
|
||
|
||
*Note: The buffer views for the `BIT` component type must be padded with trailing `0`s to meet the nearest byte boundary.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The padding requirements should be defined for the other component types. In general properties must start on a byte offset that's a multiple of the size of the component type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason behind this? As long as the byte boundary is respected, the data can be read using byte offsets and byte lengths. What is gained by having the offset be a multiple of the size of the component type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Talked offline about this, but it's for performance reasons. In JavaScript typed arrays need to be aligned to their component type within the underlying array buffer which means unaligned data needs to be cloned into a new typed array. Proper alignment also provides performance benefits in systems level languages.
Early on glTF had the same rationale: KhronosGroup/glTF#167
https://github.com/CesiumGS/cesium/blob/2a9ca28dcbb38eee7013505987516446a8eacb4f/Source/Scene/Batched3DModel3DTileContent.js#L370-L382 - this is where CesiumJS clones the typed array if it isn't aligned. 3D Tiles didn't always have byte alignment requirements which lead to slow paths like this.
@sanjeetsuhag @lilleyse excited to see this. Just a reminder to please bump to me when ready for review. 😄 |
… of arbitrary size binary data
This extension may need a way to indicate whether a string property is stringified JSON |
A lot of the data alignment rules in this spec are now OBE since we're moving to Apache Arrow. I'll open a PR with the new, simplified version of the spec. |
This extension enables storage of binary buffers. Specification is available here.