Hi.
I’m trying to figure out how to set int array or ivec array to shader.
I’m using ShaderMaterial to set up my shader. There are setArray methods on ShaderMaterial but they seems to me to work only with floats: https://playground.babylonjs.com/#4LDXG1#8
Am i doing something wrong?
There are setIntArray methods thet are look like do the stuff i need in Effect and Engine classes, but i can’t figure out can i use them and how.
The IntArrayXXX methods from the Effect are not available directly through the ShaderMaterial class, but you can bind the data yourself on the onBindObservable event:
Evgeni, thank you very much for your reply.
At the same time, it became clear how to use the getEffect method in the ShaderMaterial)
Regarding the pool request, I would love to, but I don’t yet understand how exactly the methods for setting variables in ShaderMaterial work. The only thing that happens in the setXXX methods is call of _checkUniform and setting the value passed to the method into a private variable of the class. Or I don’t have to understand what’s going on under the hood and just add methods that will set values of the correct type like Int32Array to _vectorsX Arrays?
Yes, you should do the same thing in new methods like setIntArray2, setIntArray3, etc and then update the ShaderMaterial.bind method accordingly: that’s where the values are really passed to the engine by calling the corresponding effect.setXXX methods.