-
Notifications
You must be signed in to change notification settings - Fork 136
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
Flexible extension support #125
Comments
Looks solid to me! Here are a few thoughts; How will the extension setup callback know what it is setting up?
Is it enough to know the object type during setup or is the hierarchy / "path" also required in some situations? Write! When setting up the callback functions in Extension "user data". Is there a case for extension setup or write implementations to need user data? Would probably suggest leaving it for later until a need pops up. |
Maybe instead of map just an extension list per object-type, similar to how Vulkan has pNext and sType. We also have a bunch of unofficial extensions here, and I agree a separate file to manage those could be nice. However several json utilities for loader/saver would need to be exposed I think. There is also pointer fixup and validation etc. That said so far just hacking cgltf itself was simple enough ;) and one gets the easye to use structs in return... |
We've got two different mechanisms for extensions as of now:
cgltf_extension
array in most objects.As the number of official extensions is growing and more vendor extensions pop up, we should consider implementing a more flexible and modular approach.
I'm open for ideas on how we could change this.
This is currently my best idea here:
void*
that can be casted to a struct that holds the respective extension's data.cgltf_options
. These callbacks are then called when cgltf is parsing glTF data in order to allocate and fill the structs that are stored in the nodes.At the bottom line, that would mean for all nodes that an extension can extend, it needs to support three functions: one to allocate/initialize the struct holding the extension data, one to retrieve it from the extension map in the node, one to free/destroy it.
The extension map could be, for now at least, just an array mapping a hash of the extension name to the data. Considering we probably won't have more than a handful of extensions on each node, this should be sufficient.
What do you think? Did a miss something? Do you have a better idea?
The text was updated successfully, but these errors were encountered: