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

Add KHR_draco_mesh_compression support to glTF Exporter #16064

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

alexchuber
Copy link
Contributor

@alexchuber alexchuber commented Jan 14, 2025

This PR adds the ability to export to glTF using Draco encoding. Some notes:

  • Creation of bufferViews and accessors are all done in the same way, through an intermediate class to help track relationships
  • Final binary buffer is no longer built on-the-go, but instead only once requested via generateBinaryAsync
  • A mesh's primitive is either fully compressed or uncompressed. If opting in to use Draco compression, no uncompressed versions of the primitive data will be exported in this initial iteration of KHR_draco_mesh_compression
  • KHR_draco_mesh_compression will be a required extension, if used, for the same reason as above

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 14, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 14, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 15, 2025

Please make sure to label your PR with "bug", "new feature" or "breaking change" label(s).
To prevent this PR from going to the changelog marked it with the "skip changelog" label.

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 15, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 15, 2025

@bjsplat
Copy link
Collaborator

bjsplat commented Jan 15, 2025

@alexchuber alexchuber requested a review from bghgary January 16, 2025 14:46
@alexchuber alexchuber marked this pull request as ready for review January 16, 2025 14:47
packages/dev/core/src/types.ts Outdated Show resolved Hide resolved
packages/dev/serializers/src/glTF/2.0/glTFAnimation.ts Outdated Show resolved Hide resolved
packages/dev/serializers/src/glTF/2.0/glTFExporter.ts Outdated Show resolved Hide resolved
Comment on lines +1098 to 1100
for (let index = 0; index < array.length; index++) {
newArray[index] = array[index];
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be replaced with .set?

Copy link
Contributor Author

@alexchuber alexchuber Jan 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, since we're trying to convert from possibly Float32Array to Uint8/16Array. Using .set() on a lower-byte TypedArray, with a higher-byte TypedArray as the param, hasn't seemed to work for me.

packages/dev/serializers/src/glTF/2.0/glTFSerializer.ts Outdated Show resolved Hide resolved
@bjsplat
Copy link
Collaborator

bjsplat commented Jan 18, 2025

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

Successfully merging this pull request may close these issues.

3 participants