I don’t know if it’s relevant for Babylon, but I have a use case where I need to update the vertex/fragment shaders without recreating a
ShaderMaterial object from scratch.
There’s no method for this on the
I currently do this:
(mat as any)._shaderPath.vertex = newVertexCode; (mat as any)._shaderPath.fragment = newFragmentCode;
_shaderPath do the job because it is used as a parameter in the
engine.createEffect(...) call, and so it will return a new effect if something has changed in
_shaderPath since the last time it was called.
_shaderPath is not visible from the outside I need to cast my
any to access it: would it make sense to have a getter for it, as we have for
Then, I could do:
mat.shaderPath.vertex = newVertexCode; mat.shaderPath.fragment = newFragmentCode;