Added some texture atlas features.

Fixed to previous incomplete commit.