For a while now I’ve been working on a scenegraph (yes, why on earth would I want to do that) that is unique in that it separates the state management from the scene management (two trees, optimized and updated separately). IMO I find this very understandable and easy to use since you would describe how the content looks (state tree) and then where the content happens to be (spatial tree).
However, one area that is a little tricky are when states have spatial components (namely fog and lights). From a structural point of view, does it make more sense:
- to add lights and fog to the spatial tree and have any children be lit
or … - to make lights and fog part of the state tree since they affect how content looks
Pros and cons of 1: geometry is lit/fogged based on spatial location, which makes sense. Harder to integrate lit and non-lit geometries in the same spatial tree. Harder to work well with the state tree (given my current implementation).
Pros and cons of 2: content description of how something looks is consistent for any type of state, however the programmer has to manage when geometries are lit.
Opinions are appreciated, thanks!