API Utility Updates

(Shaderbytes) #1

Hey there

Just posting about various updates to the utility.

So when working with textures , even with the caching system i built in, I was never using the update option of the api. Now I worked it into the system , you wont have to do anything different, it is just an internal optimization ( cahing will still avoid any call to upload a texture , except if you want to overwrite a cached value , it is here where it will decide to use update instead )

Recently when wanting to work with the tint color of the clearcoat channel , I realized my setColor function did not have a means to stipulate the property name of the color to set. It was hard coded to “color”. Since clearcoat tint is named “tint” this was a problem, so i changed the function to now include an argument for the property name. It is an optional argument , meaning if it is null the function will just set it to the old default “color”

This also required some upgrades to the resetting of properties, anyway all is working well now you can see it in action here :


the two lines of code setting the diffuse and clearcoat tint look like this :

 sketchfabAPIUtilityInstance.setColor("body", sketchfabAPIUtilityInstance.AlbedoPBR, "color", colours[index].diffuse);
 sketchfabAPIUtilityInstance.setColor("body", sketchfabAPIUtilityInstance.ClearCoat, "tint", colours[index].clearcoatTint);

The documentation has also been adjusted to reflect this change.