Fixed occasional error reported from model loading. Storing materials on meshes, and setting index buffers based on materials, so we can have multiple materials on an entity. Entities still have base material that can be applied to meshes.
Actually using multiple materials on one entity (took some fixing. Introduced a bunch of memory leaks.