Refactoring renderer to dynamically render batches of objects based on their material