Huge refactor of the texture map stuff.