How to pass a uniform that is an array of vec2 or vec4 using Cesium.Material fabric?

I'm creating a custom polyline shader that needs to be able to display arbitrary segments in different colors.

I'm able to get it working with a single segment, but I'd like to be able to pass an array of vec2's for start/end position and an array of vec4's for colors for each segment.

Here's a working Sandcastle with a single line segment:

If I try to change the uniforms to arrays, I now get an error that the uniform has an invalid type. How do I specify the uniform type correctly for arrays?

That looks really cool! Thanks for sharing a Sandcastle.

I think an array of vec2’s just isn’t implemented as a uniform type in the material system. You might need to modify Material.js to add this type:

Here’s where it gets called:

We’d be happy to review a pull request if you make this change. I wonder if it would be better to allow a way to letting the user explicitly state the uniform type for these situations as opposed to guessing it.

Thanks, when I get a chance I will look into modifying Material.js and possibly putting up a PR.

That would be awesome! Feel free to ping me here or on GitHub if you have any questions.