July 2017
Beginner to intermediate
390 pages
10h 53m
English
In the event handler in the renderer, we also called a method called Prune on the list. This is the method that looks at all the meshes we have in our list and removes all the ones the surface observer does not see anymore. There is no point in keeping those meshes around if we are no longer going to draw them. So, we go through the list of surfaces, and if we have surfaces identified by IDs that are no longer available, we remove them. Of course, we first call ReleaseDeviceDependentResources so all non-garbage-collected items will be cleaned up:
public void Prune(List<Guid> allIds) { var removableIds = new List<Guid>(); var tempList = new Dictionary<Guid, SurfaceMesh>(_internalList); foreach (var id in tempList.Keys) if ...Read now
Unlock full access