private SgtJovianModel GetOrAddModel(int index) { var model = default(SgtJovianModel); if (Models == null) { Models = new List <SgtJovianModel>(); } if (index < Models.Count) { model = Models[index]; if (model == null) { model = SgtJovianModel.Create(this); Models[index] = model; } } else { model = SgtJovianModel.Create(this); Models.Add(model); } return(model); }
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); } }