Hi everybody,
I've been lurking for a while reading the (usually great) answers on the site and thought I'd finally post.
I'm a professional C++/Python programmer working in finance and I thought I'd try my hand at something more interesting/challenging... 3d graphics! Inspired by Frontier and the Elite Dangerous Kickstarter, I thought I'd have a hand at writing my own procedural universe thing as a hobby project.
I worked on it for a few weeks last year but I've decided to get back in to it and eventually open source it, ideally (I know it's ambitious) with procedurally generated vegetation, cities, etc etc. But first things first...
I'm in the process of upgrading the atmosphere model from O'Neil to Bruneton. I'm trying to go for code neatness and modularity, but I am having a hell of a time "cleaning up" the sample Bruneton code (found here: http://evasion.inrialpes.fr/~Eric.Bruneton/PrecomputedAtmosphericScattering2.zip) - right now, despite the algorithm being great, the code is (imho) a bit of a nightmare. What's more, it seems to defy refactoring - also possibly due to my relative ignorance in how to neatly structure GLSL shaders.
My question is: given the lack of #include in GLSL, in a situation with multiple complex shaders (as in Bruneton) where there is a lot of overlap between functions, #defined constants, uniforms, is there any good generic advice on how to structure things? Part of me wants to stick all of the uniforms/#defined constants in a big uniform block and include that. But I could use some advice from the pros.
Cheers
David