Optimize shadows for things that don't move.
This continues from #25 (closed) .
To reduce the performance cost of drawing shadows, make a distinction between static and dynamic items in the scene. The static items, which generally do not move, and are not created or destroyed frequently, likely represent the majority of the geometry in the scene, and can have shadows updated only when necessary. Then, a separate depth texture for only the dynamic objects (likely a much smaller portion of the total geometry) has to be rendered repeatedly. The lighting system can simply use a 'min(static,dynamic)' function on the two depth textures to determine the appropriate depth for deciding whether the fragment is in shadow.
This optimization is not helpful for lights that move, and it may be worth allowing the feature to be disabled on a per-light basis, so for that light the static depth texture is filled with the max value and the dynamic depth texture has all scene geometry rendered, static and dynamic.