Is there a way to pass an array of floats / structs to a shader from the postprocess and or material ?
scope.resolve("lights[0]").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.
will
2
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[8];
And then, in your script. you’d do something like:
var values = new Float32Array([0, 1, 2, 3, 4, 5, 6, 7]);
scope.resolve(‘uValues[0]’).setValue(values);
I haven’t tried passing structs so I’m not sure what’s supported there with WebGL.