ebruneton/precomputed_atmospheric_scattering

Suggested refactor for model.h/cc

matthew-reid opened this issue · 1 comments

I'm working on integrating this into my engine, which uses OpenSceneGraph rather than raw openGL functions. Because of this, I can't use the parts of model.h/cc that deal with opengl resources, but I would like to use the glsl header factory part. I'd like to suggest splitting model.h/cc into two classes, one class to generate the glsl header from the atmosphere params, and a different class (in different files) to setup the GL resources (textures etc). That way people can more easily use one without the other.

After spending more time looking at the code, I decided to use uniforms at render-time instead of generating constants with the header factory. The main reason being uniforms give more flexibility and it looks like I can fold most of the constants into uniforms anyway. I guess the main purpose of the header factory is to speed up the precomputation step with constant folding, with less benifit at render-time. So I'm not actually sure how useful my suggestion is after all.