Significant refactoring; first part of allowing renderer-specific texture setups.