pythreejs, passing array of vectors into a shader

57 Views Asked by At

I need to pass an array of vectors as a uniform to a shader. As far as I understood code should be as follows:

fragment_shader = """

    uniform int myVectorSize;
    uniform vec4 myVector[50];

    void main() {
      gl_FragColor = ... // using myVector    
    }
"""

But I did not find a way to pass this vector to the shader:

material = ShaderMaterial(
    uniforms=dict(
        myVectorSize=(dict(value=10),
        myVector=???,
        **UniformsLib['common']
    ),
    fragmentShader=fragment_shader,
)

Is there a way to do this?

0

There are 0 best solutions below