private void UpdateMesh(BidirectionalEdge <ISatellite> edge) { var camera = PlanetariumCamera.Camera; var start = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.A.Position)); var end = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.B.Position)); var segment = new Vector3(end.y - start.y, start.x - end.x, 0).normalized *(LineWidth / 2); if (!MapView.Draw3DLines) { var dist = Screen.height / 2 + 0.01f; start.z = start.z >= 0.15f ? dist : -dist; end.z = end.z >= 0.15f ? dist : -dist; } mPoints2D[0] = (start - segment); mPoints2D[1] = (start + segment); mPoints2D[2] = (end - segment); mPoints2D[3] = (end + segment); mPoints3D[0] = camera.ScreenToWorldPoint(mPoints2D[0]); mPoints3D[1] = camera.ScreenToWorldPoint(mPoints2D[1]); mPoints3D[2] = camera.ScreenToWorldPoint(mPoints2D[2]); mPoints3D[3] = camera.ScreenToWorldPoint(mPoints2D[3]); mMeshFilter.mesh.vertices = MapView.Draw3DLines ? mPoints3D : mPoints2D; mMeshFilter.mesh.RecalculateBounds(); mMeshFilter.mesh.MarkDynamic(); }
private void UpdateMesh(BidirectionalEdge<ISatellite> edge) { var camera = MapView.MapCamera.camera; var start = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.A.Position)); var end = camera.WorldToScreenPoint(ScaledSpace.LocalToScaledSpace(edge.B.Position)); var segment = new Vector3(end.y - start.y, start.x - end.x, 0).normalized * (LineWidth / 2); if (!MapView.Draw3DLines) { var dist = Screen.height / 2 + 0.01f; start.z = start.z >= 0.15f ? dist : -dist; end.z = end.z >= 0.15f ? dist : -dist; } mPoints2D[0] = (start - segment); mPoints2D[1] = (start + segment); mPoints2D[2] = (end - segment); mPoints2D[3] = (end + segment); mPoints3D[0] = camera.ScreenToWorldPoint(mPoints2D[0]); mPoints3D[1] = camera.ScreenToWorldPoint(mPoints2D[1]); mPoints3D[2] = camera.ScreenToWorldPoint(mPoints2D[2]); mPoints3D[3] = camera.ScreenToWorldPoint(mPoints2D[3]); mMeshFilter.mesh.vertices = MapView.Draw3DLines ? mPoints3D : mPoints2D; mMeshFilter.mesh.RecalculateBounds(); mMeshFilter.mesh.MarkDynamic(); }
private bool CheckVisibility(BidirectionalEdge<ISatellite> edge) { var vessel = PlanetariumCamera.fetch.target.vessel; var satellite = RTCore.Instance.Satellites[vessel]; if (satellite != null && ShowPath) { var connections = RTCore.Instance.Network[satellite]; if (connections.Any() && connections[0].Contains(edge)) return true; } if (edge.Type == LinkType.Omni && !ShowOmni) return false; if (edge.Type == LinkType.Dish && !ShowDish) return false; if (!edge.A.Visible || !edge.B.Visible) return false; return true; }
private Color CheckColor(BidirectionalEdge<ISatellite> edge) { var vessel = PlanetariumCamera.fetch.target.vessel; var satellite = RTCore.Instance.Satellites[vessel]; if (satellite != null && ShowPath) { var connections = RTCore.Instance.Network[satellite]; if (connections.Any() && connections[0].Contains(edge)) return XKCDColors.ElectricLime; } if (edge.Type == LinkType.Omni) return XKCDColors.BrownGrey; if (edge.Type == LinkType.Dish) return XKCDColors.Amber; return XKCDColors.Grey; }