public void UpdateModels() { var meshCount = Meshes != null ? Meshes.Count : 0; for (var i = 0; i < meshCount; i++) { var mesh = Meshes[i]; var model = GetOrAddModel(i); model.SetMesh(mesh); model.SetMaterial(Material); } // Remove any excess if (Models != null) { for (var i = Models.Count - 1; i >= meshCount; i--) { SgtJovianModel.Pool(Models[i]); Models.RemoveAt(i); } } }
private void UpdateModels() { models.RemoveAll(m => m == null); if (Meshes.Count != models.Count) { SgtHelper.ResizeArrayTo(ref models, Meshes.Count, i => SgtJovianModel.Create(this), m => SgtJovianModel.Pool(m)); } for (var i = Meshes.Count - 1; i >= 0; i--) { models[i].ManualUpdate(Meshes[i], material); } }