public void DisplayUpdaterWorks() { DisplayUpdater du = new DisplayUpdater(); Assert.True(du.IsEmpty()); du.Add(new UnupdatedDisplay(), 0); Assert.False(du.IsEmpty()); du.Clear(); Assert.True(du.IsEmpty()); du.Add(new UnupdatedDisplay(), 0); du.UpdateNextDisplay(); Assert.True(du.IsEmpty()); }
public void UpdateLOD() { displayUpdater.Clear(); Plane[] planes = GeometryUtility.CalculateFrustumPlanes(Camera.main); int newLod = Mathf.Max(levelOfDetail - currentZoomValue, 0); foreach (MapDisplay display in displays) { Bounds renderBounds = display.meshRenderer.bounds; renderBounds.Expand(3.0F); Vector3 center = renderBounds.center; float distanceToCamera = Vector2.Distance(new Vector2(mapViewerPosition.x, mapViewerPosition.y - 0.35F), new Vector2(center.x, center.z)); int distanceBasedLod = newLod + (int)distanceToCamera * 2; if (GeometryUtility.TestPlanesAABB(planes, renderBounds)) { displayUpdater.Add(new UnupdatedDisplay(distanceBasedLod, display), distanceBasedLod); if (display.GetStatus() == MapDisplayStatus.HIDDEN) { display.SetStatus(MapDisplayStatus.LOW_LOD); display.DrawMap(); } } else { display.SetStatus(MapDisplayStatus.HIDDEN); display.DrawMap(); } } }