Hello community,
I am currently setting up a dev environment for Babylon.JS using Parcel.js hot module replacement capabilities a bit in the fashion of thlorenz:
Basically, everytime you change the code and hit save, the renderCanvas is diposed and a new canvas is initialized, thereby updating the scene without having to refresh the browser.
This is quite neat but in practice it means that all of the game objects and the camera go back to their initial states. It also means that Parcel has to recompile everything which takes more time than needed, especially when using the ES6 import syntax with the alpha v4 of Babylon as I am.
My question is:
Is there a way to update the shaderMaterial applied on a mesh?
There is a way of being specific about the changes Parcel.js has to do during HMR using:
if (module.hot) {
module.hot.accept(function accept() {
// update shaders here
})
}
Coming from three.js this could be achieved using the function:
material.needsUpdate = true;
I have looked into the documentation about the Effect and ShaderMaterial classes but could not find a way to make it work. Does somebody has an idea of how this could be achieved?