Skip to content
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

Padding #225

Closed
pjcozzi opened this issue May 22, 2017 · 2 comments
Closed

Padding #225

pjcozzi opened this issue May 22, 2017 · 2 comments
Assignees

Comments

@pjcozzi
Copy link
Contributor

pjcozzi commented May 22, 2017

From #222 (comment)

I definitely see the benefit of making padding rules part of the spec, not just an implementation note. I'll open a separate PR for that.

via @lilleyse

@lilleyse
Copy link
Contributor

lilleyse commented Apr 26, 2018

I believe these are all the padding requirements:

  1. A tile's byteLength must be aligned to an 8-byte boundary.
  2. The Feature Table binary (if present) must start and end on an 8-byte alignment
  3. The Batch Table binary (if present) must start and end on an 8-byte alignment
  4. The binary glTF (b3dm and i3dm only) (if present) must start and end on an 8-byte alignment
  5. The byteOffset of Feature Table Binary property must be a multiple of the size of the property's componentType.
  6. The byteOffset of a Batch Table binary property must be a multiple of the size of the property's componentType.
  7. The Feature Table JSON must be padded with trailing Space chars (0x20) to satisfy alignment requirements of the Feature Table binary (if present)
  8. The Batch Table JSON must be padded with trailing Space chars (0x20) to satisfy alignment requirements of the Batch Table binary (if present)
  9. For i3dm if the gltfFormat is 0 (indicating the i3dm references an external gltf), the url must be padded to an 8-byte boundary in order to satisfy (1). This requires adding Space chars (0x20) to the end of the url, which must be removed at runtime.

Other notes/rationale:

  • Number 1 is required so that tiles packed in a Composite tile have correct alignment
  • Number 4 essentially reiterates 1/2/3. Tileset writers may need to edit length and the last chunkData accordingly in glb
  • Number 2 and 3 are required since batch tables may include DOUBLE binary properties. The feature table doesn't yet have any DOUBLE properties, but it may in the future.
  • Number 2 and 3 are following similar convention to glTF. Originally I had thought of padding each binary property to 8-byte alignment but it's probably overkill.
  • Every tile format (excluding cmpt) requires a Feature Table JSON, and therefore we can always add whitespace padding to JSON and guarantee that the binary/gltf sections will always start on an 8-byte alignment. This also means it's OK that tile headers are not 8-byte aligned (b3dm for example is 28-bytes) because there will always be padded JSON following the header.
  • Number 9: see https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Scene/Instanced3DModel3DTileContent.js#L320-L328
  • Number 9 is a bit confusing... what about storing the url in the feature table instead? Unfortunately this would be a breaking change to i3dm.

@ggetz
Copy link
Contributor

ggetz commented May 11, 2018

Resolved in #301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants