Add missing setXXX methods in ShaderMaterial

I need to pass an array of matrices to my shader, but it’s not currently possible because there is no setMatrices() on ShaderMaterial.

There is a setMatrices() on Effect, but mymat.getEffect().setMatrices(...) did not work because mymat.getEffect() returned null. So, I tried to call mymat.isReady() to make the internal _effect variable created, it still did not work, I think because the call must be done at the right time in the pipeline.

So, what about adding setMatrices() to ShaderMaterial? There are a number of others setXXX() methods that exist on Effect but not on ShaderMaterial (setIntArray/2/3/4, setFloatArray/2/3/4, setBool, etc).

Will add it as well!

I saw you added the setMatrices(), thanks for that!

However, would it be possible this method take a Matrice[] | Float32Array? I already have a Float32Array, so having to convert it to Matrice[] and having setMatrices() convert it back to Float32Array would make me sad :wink:

Thanks in advance for what you can do.

Fancy doing a PR?

Will try also to do this one!

1 Like

Feel free to start a PR and we will use it to discuss :slight_smile: Do not be worried about making mistakes

PR created:

1 Like

Was there a problem with this PR? I can see the changes are not part of the current preview release.

I will publish the nightly and it will be on preview :slight_smile:

Thanks.

In fact, I confused merging and publishing: I saw you merged several days ago, so though I should see the changes in in the releases afterward.

1 Like