glTF-SDK
glTF-SDK copied to clipboard
Support for base64 encoded buffers
Hello,
Currently, the buffers are referenced by URI (path to bin file) I propose adding a function to set the URI as a base64 encoded string. The encoding itself could be done outside of the library.
As a work-around a base64 buffer can be set by using the URI variable with the appropriate length.
Update on GLTFSDK/Source/BufferBuilder.cpp to add setCurrentBufferURI function
280: + bool BufferBuilder::setCurrentBufferURI ( const std::string &data )
281: + {
282: + assert ( m_buffers.size() > 0 );
283: + size_t index = m_buffers.size() - 1;
284: + m_buffers [ index ].uri = data;
285: + m_buffers [ index ].length = data.length();
286: + return true;
287: + }
288: +
Please let me know if I should create a pull request.
Thank you !
Please let me know if I should create a pull request.
Yes, please do. It will be easier to comment then pasting code in an issue :-)
Thank you for the reply. I updated the code but when i try to create a new branch and create a new pull request, i get permission denied. Are the permissions on my account enough for these actions ? Or is there a different procedure ? Best regards, Christian
Typically you want to create a fork and then create a PR from the fork. Try this.
Thanks a lot for the help. I just created a fork and pushed the code here: https://github.com/tulvanchristian/glTF-SDK
The commit includes fixes for:
- Support for base64 encoded buffers #59
- Set child name (rootProperty) #60
- Direct access to buffers and accessors #61
Please let me know if this is ok and if you need more information, do not hesitate to contact me.
Best regards, Christian
Please create a pull request from the branch in your fork. Thanks!