oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.77k stars 213 forks source link

Support arbitrarily nested uniforms #137

Closed ValentinWalter closed 1 year ago

ValentinWalter commented 2 years ago

Adds support for arbitrarily nested uniform values, e.g. a struct containing an array of some other struct.

The way Program was set up made this change trivial to implement, while simplifying code and removing assumptions.

gordonnl commented 2 years ago

Thanks for this, it looks clean! Although it seems uniform arrays break, eg:

uniforms = {
    uColors: {
        value: [color1, color2, color3, color4, color5],
    },
};
ValentinWalter commented 2 years ago

Should be working as expected now. (I'm not entirely sure whether I've tested every edge case.)

gordonnl commented 1 year ago

Thanks a lot for this. Sorry about the embarrassingly long delay, I finally got around to testing it