Is there a way to pass an array of floats / structs to a shader from the postprocess and or material ?
scope.resolve("lights").setValue( light );
Would really be useful to be able to do something like that, since mixing shader code with a .js gets rly messy and hard to work in.
I think the only place the PlayCanvas engine passes an array of something to a shader is here:
So, to pass an array of floats, say, in your shader, you’d have:
uniform float uValues;
And then, in your script. you’d do something like:
var values = new Float32Array([0, 1, 2, 3, 4, 5, 6, 7]);
I haven’t tried passing structs so I’m not sure what’s supported there with WebGL.