Input needed: functions wishlist

Just noticed that GLSL has most of the same limitations as PB for arrays:

We can also use Arrays. Of course they have to be typed and there are twists:

  • they have a fixed size
  • you can’t push(), pop(), splice() etc. and there is no length property
  • you can’t initialize them immediately with values
  • you have to set the values individually

this won’t work:

int values[3] = [0,0,0];

but this will:

int values[3];
values[0] = 0;
values[1] = 0;
values[2] = 0;

Actually the more I read that appendix 4 (which is GLSL from a JS perspective), the more I think adding vectors/etc is the right way to extend PB’s language, as we’re seeing how useful the shaders are for making good stuff in PB.

it’s lines like this

note : in a shader, color values (R , G , B & A ) are normalised, they range from 0 to 1 and not from 0 to 0xFF,

that tell me PB is a natural fit for GLSL. It won’t be 100%, but then PB isn’t a 100% fit for JS either… but if more GLSL-flavored stuff (like vectors) are added, we might hit the point where porting bits is trivial (which as @zranger’s been doing so, it isn’t quite trivial yet)

1 Like