Is there any way that I can pass a specified length of array to vertex-shader.
like this:
uniforms = {
data: {value: [1,2,3,4,5,6, ...]} // length = 100
}
in vertex-shader :
uniform float data[100]
Is there any way that I can pass a specified length of array to vertex-shader.
like this:
uniforms = {
data: {value: [1,2,3,4,5,6, ...]} // length = 100
}
in vertex-shader :
uniform float data[100]
You can pass such values as defines. Similar to uniforms, you specify defines for a shader material like mentioned in the documentation.
If I define a array like this:
defines: {
data: [0.0, 1.0, 1.0]
}
then how do I use it in glsl? data[0] ? @Mugen87
Oh , I see… you mean I can pass the length as defines @Mugen87
Have you solved it? There is a similar problem encountered me.And I have no idea how to define the array and use it in shader.
defines: {
FOO: 15,
BAR: true
}
# then in glsl:
uniform float data[FOO]