CesiumGS / gltf-pipeline

Content pipeline tools for optimizing glTF assets. :globe_with_meridians:
Apache License 2.0
1.87k stars 241 forks source link

Basic CESIUM_primitive_outline support #631

Closed javagl closed 1 year ago

javagl commented 1 year ago

The removeUnusedElements family of functions considered the accessors that are used by CESIUM_primitive_outline to be "unused", and removed them.

This PR is a small fix that causes these accessors to be preserved, and the CESIUM_primitive_outline.indices to be updated (no, not the accessor contents, only that accessor index).

This is implemented in a somewhat copy-and-paste-ish style: It uses the same approach that was used for other extensions. But one could consider to generalize the approach there: Having to support each extension manually like this does not scale indefinitely....

This might fix https://github.com/CesiumGS/gltf-pipeline/issues/630

javagl commented 1 year ago

Attached here is a ZIP that contains some stuff that may be useful for testing:

cesiumPrimitiveOutline-2023-04-15.zip

EDIT: If all this looks OK, I'd add a basic test, analogous to https://github.com/javagl/gltf-pipeline/blob/3a5a71d5d2803831a477d35fa87b91f0fc6a8807/specs/lib/removeUnusedElementsSpec.js#L910

javagl commented 1 year ago

A random note: The README at https://github.com/CesiumGS/gltf-pipeline/blob/dc213115d2ca12bd5afae00770e48c019ac7d2d5/README.md#command-line-flags says

--draco.quantizePositionBits... No, default 14

but the actual default seems to be 11, as of https://github.com/CesiumGS/gltf-pipeline/blob/dc213115d2ca12bd5afae00770e48c019ac7d2d5/lib/compressDracoMeshes.js#L493

(I can fix that in this PR, if desired)

javagl commented 1 year ago
lilleyse commented 1 year ago

Thank @javagl. The doc updates look good too.