public void UpdateModels() { updateModelsCalled = true; var meshCount = Meshes != null ? Meshes.Count : 0; var scale = SgtHelper.Divide(Radius, MeshRadius); for (var i = 0; i < meshCount; i++) { var mesh = Meshes[i]; var model = GetOrAddModel(i); model.SetMesh(mesh); model.SetMaterial(Material); model.SetScale(scale); } // Remove any excess if (Models != null) { for (var i = Models.Count - 1; i >= meshCount; i--) { SgtCloudsphereModel.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 => SgtCloudsphereModel.Create(this), m => SgtCloudsphereModel.Pool(m)); } var scale = SgtHelper.Divide(Radius, MeshRadius); for (var i = Meshes.Count - 1; i >= 0; i--) { models[i].ManualUpdate(Meshes[i], material, scale); } }