Fixed texture groups

Now texture group are stored in an index that is used to change texture
during render.

Cleaned up some dead code that used to have the material groupings.