Port JS binding updates from Phasmatic
Will it help to bracket these includes and any other write-related code in ktx_wrapper with#if KTX_FEATURE_WRITE?
For some reason I cannot reply on this comment, so replying here: what do you mean by that?
@abasilak, @ViNeek please review this PR. Please pay particular attention to the following:
- Will there be any difficulties using these bindings for the glTF-Compressor?
- I have changed the name of the factory function for creating the ktx module from
LIBKTXtocreateKtxModule(andcreateKtxReadModule). ~~I am not planning to provide the old name as an alias because it is a simple change for users to make.~~ I have provided an alias. What is your opinion? - ~~In the test sample I am now setting
window.ktx = <module returned from createKtxModule>so now I have code likevar texture = new ktx.ktxTexturewhich is feels daft. I'd like to remove the ktx prefix from all the times that currently have it. What do you think? Note that the all the c++ code for the binding is in aktxnamespace. The extra prefixes really are superfluous in my opinion. I would, if I can figure out how, provide the old names as aliases.~~ I have removed thektxprefixes from the only existing class that had it,ktxTexture, and from the new classes and have provided an alias fromktxTexturetotexture. - Point out any errors or places for improvement in the code.
- Comment on the naming style of the classes, enums and values in the JS API.
I would like the glTF-Compressor to be updated to use this binding. Is there any room in your existing Khronos contract for that work? Better reply to me privately on this question.
Here is a screenshot of the test for the new features.
Hi @MarkCallow thank you for the great work.
Regarding you comments:
- I can' t see any difficulties in integrating these changes to the gltf Compressor.
- This looks nice.
- Removing the prefix seems like a good, clean choice.
- The code seems very well structured and documented.
- I really like the ktx.SYMBOL style.
Test page also looks very good.
@ViNeek thank you for your review and comments. I have made one final (fingers crossed) change. I have changed the enumerator names to be the same as the libktx names minus the ktx{,_} prefixes and _e suffixes for consistency and to make it easier for people to recall what the JS name will be. Please take a look at 6966f6c.