johanhelsing / bevy_smud

Sdf 2d shape renderer for Bevy
Other
143 stars 10 forks source link

Allow supplying a dynamic number of positions #17

Open porky11 opened 2 years ago

porky11 commented 2 years ago

It seems like currently only one dynamic position is supplied to the sdf function. I would prefer if the user could define how many dynamic positions you supply to each shader. At least up to 4 positions would be necessary for common bezier curves. Having dynamic curves is pretty important for my use cases.

johanhelsing commented 2 years ago

Hi, this is similar to #3. #5 is what I use for a similar use case, but it only sends a vec4, in which you could pack two vec2's so you have 4 positions total.

It's not the most scalable or pretty solution, though. So if you have suggestions of how to add an ergonomic API for adding a dynamic number of arguments, I'm very interested.

EDIT: sorry, I think I made a booboo, you probably need more 2 positions more, so #5 won't work for you :/