void OnPreCull() { if (Enabled && (!MapView.MapIsEnabled || EnabledMap)) { if (!_active) { _headingMarker.SetActive(true); _edgeMarkers.SetHeadingActive(true); _active = true; } Matrix4x4 worldToCamMat = _mainCam.transform.worldToLocalMatrix; _hudCam.fieldOfView = _mainCam.fieldOfView; Vector3 screenEdge = _hudCam.ScreenPointToRay(Vector3.zero).direction; UpdateHeadingMarkers(worldToCamMat, screenEdge); if (LinesEnabled) { if (!_linesActive) { _zenithLines.SetActive(true); _azimuthLines.SetActive(true); _linesActive = true; } UpdateLines(worldToCamMat); } else { if (_linesActive) { _zenithLines.SetActive(false); _azimuthLines.SetActive(false); _linesActive = false; } } if (MarkersEnabled) { if (!_markersActive) { _markers.SetDirectionsActive(true); _edgeMarkers.SetDirectionsActive(true); _markersActive = true; } UpdateMarkers(worldToCamMat, screenEdge); if (FlightGlobals.fetch.VesselTarget != null) { if (!_targetActive) { _markers.SetTargetActive(true); _edgeMarkers.SetTargetActive(true); _targetActive = true; } UpdateTargetMarkers(worldToCamMat, screenEdge); if (FlightGlobals.fetch.VesselTarget.GetTargetingMode() == VesselTargetModes.DirectionVelocityAndOrientation) { if (!_alignActive) { _targetAlignmentMarker.SetActive(true); _edgeMarkers.SetAlignmentActive(true); _alignActive = true; } UpdateAlignMarkers(worldToCamMat, screenEdge); } else { if (_alignActive) { _targetAlignmentMarker.SetActive(false); _edgeMarkers.SetAlignmentActive(false); _alignActive = false; } } } else { if (_targetActive) { _markers.SetTargetActive(false); _edgeMarkers.SetTargetActive(false); _targetActive = false; } if (_alignActive) { _targetAlignmentMarker.SetActive(false); _edgeMarkers.SetAlignmentActive(false); _alignActive = false; } } if (FlightGlobals.ActiveVessel.patchedConicSolver != null && FlightGlobals.ActiveVessel.patchedConicSolver.maneuverNodes.Count > 0) { if (!_maneuverActive) { _markers.SetManeuverActive(true); _edgeMarkers.SetManeuverActive(true); _maneuverActive = true; } UpdateManeuverMarker(worldToCamMat, screenEdge); } else { if (_maneuverActive) { _markers.SetManeuverActive(false); _edgeMarkers.SetManeuverActive(false); _maneuverActive = false; } } /* // Broken 1.1.3 waypoint code * if (FinePrint.WaypointManager.navIsActive() && _waypointEnabled) * { * if (!_waypointActive) * { * _waypointMarker.SetActive(true); * _edgeMarkers.SetWaypointActive(true); * _waypointActive = true; * _waypointMarker.LoadTexture(); * _edgeMarkers.LoadWaypointColor(); * if (FlightGlobals.ActiveVessel.mainBody.pqsController != null) * { * NavWaypoint navWp = FinePrint.WaypointManager.navWaypoint; * Vector3d pqsRadialVector = QuaternionD.AngleAxis(navWp.longitude, Vector3d.down) * QuaternionD.AngleAxis(navWp.latitude, Vector3d.forward) * Vector3d.right; * _waypointSurfHeight = FlightGlobals.ActiveVessel.mainBody.pqsController.GetSurfaceHeight(pqsRadialVector) * - FlightGlobals.ActiveVessel.mainBody.pqsController.radius; * if (_waypointSurfHeight < 0) * { * _waypointSurfHeight = 0; * } * } * } * UpdateWaypointMarker(worldToCamMat, screenEdge); * } else { * if (_waypointActive) * { * _waypointMarker.SetActive(false); * _edgeMarkers.SetWaypointActive(false); * _waypointActive = false; * } * }*/ } else { if (_markersActive) { _markers.SetDirectionsActive(false); _edgeMarkers.SetDirectionsActive(false); _markersActive = false; if (_targetActive) { _markers.SetTargetActive(false); _edgeMarkers.SetTargetActive(false); _targetActive = false; } if (_alignActive) { _targetAlignmentMarker.SetActive(false); _edgeMarkers.SetTargetActive(false); _alignActive = false; } if (_maneuverActive) { _markers.SetManeuverActive(false); _edgeMarkers.SetManeuverActive(false); _maneuverActive = false; } /* // Broken 1.1.3 waypoint code * if (_waypointActive) * { * _waypointMarker.SetActive(false); * _edgeMarkers.SetWaypointActive(false); * _waypointActive = false; * }*/ } } } else { if (_active) { _headingMarker.SetActive(false); _edgeMarkers.SetHeadingActive(false); _active = false; if (_linesActive) { _zenithLines.SetActive(false); _azimuthLines.SetActive(false); _linesActive = false; } if (_markersActive) { _markers.SetDirectionsActive(false); _edgeMarkers.SetDirectionsActive(false); _markersActive = false; } if (_targetActive) { _markers.SetTargetActive(false); _edgeMarkers.SetTargetActive(false); _targetActive = false; } if (_alignActive) { _targetAlignmentMarker.SetActive(false); _edgeMarkers.SetAlignmentActive(false); _alignActive = false; } if (_maneuverActive) { _markers.SetManeuverActive(false); _edgeMarkers.SetManeuverActive(false); _maneuverActive = false; } /* // Broken 1.1.3 waypoint code * if (_waypointActive) * { * _waypointMarker.SetActive(false); * _edgeMarkers.SetWaypointActive(false); * _waypointActive = false; * }*/ } } }