void OnMarsUpdate() { // TODO subscribe to IProvidesSessionControl if (m_Camera == null || m_Paused || m_SessionProvider && !m_ProvidesSessionControl.SessionRunning()) { return; } m_CameraPose = m_Camera.transform.GetWorldPose(); if (!ShouldRecast()) { return; } m_PreviousCameraPose = m_CameraPose; SimulationRaycastHits(); CompleteRayCastHits(); }
void OnMarsUpdate() { // Make sure we have debug data if debugging state changes var extentsDebug = MarsDebugSettings.SimDiscoveryModulePlaneExtentsDebug; if (extentsDebug && !m_PreviousExtentsDebug) { foreach (var kvp in m_ProvidedPlanesById) { UpdateDebugBounds(m_DebugDataById[kvp.Key], kvp.Value); } } var verticesDebug = MarsDebugSettings.SimDiscoveryModulePlaneVerticesDebug; if (verticesDebug && !m_PreviousVerticesDebug) { foreach (var kvp in m_ProvidedPlanesById) { UpdateDebugVertices(m_DebugDataById[kvp.Key], kvp.Value); } } m_PreviousExtentsDebug = extentsDebug; m_PreviousVerticesDebug = verticesDebug; // TODO subscribe to IProvidesSessionControl if (m_Paused || m_SessionProvider && !m_ProvidesSessionControl.SessionRunning()) { return; } var time = MarsTime.Time; if (!m_PointCloudChanged || time - m_LastGrowthTime < m_MinimumRegrowthTime) { return; } m_PointCloudChanged = false; m_LastGrowthTime = time; k_AddedPlanes.Clear(); k_UpdatedPlanes.Clear(); k_RemovedPlanes.Clear(); k_AddedPlaneDebugColors.Clear(); m_UpVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); m_DownVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); m_ForwardVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); m_BackVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); m_RightVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); m_LeftVoxelGrid.FindMRPlanes(k_AddedPlanes, k_UpdatedPlanes, k_RemovedPlanes, k_AddedPlaneDebugColors); for (var i = 0; i < k_AddedPlanes.Count; i++) { var plane = k_AddedPlanes[i]; AddProvidedPlane(plane); m_DebugDataById.Add(plane.id, new DebugVisualsData(k_AddedPlaneDebugColors[i])); } foreach (var plane in k_UpdatedPlanes) { UpdatedProvidedPlane(plane); } foreach (var plane in k_RemovedPlanes) { RemoveProvidedPlane(plane); } if (extentsDebug) { foreach (var plane in k_AddedPlanes) { UpdateDebugBounds(m_DebugDataById[plane.id], plane); } foreach (var plane in k_UpdatedPlanes) { UpdateDebugBounds(m_DebugDataById[plane.id], plane); } } if (verticesDebug) { foreach (var plane in k_AddedPlanes) { UpdateDebugVertices(m_DebugDataById[plane.id], plane); } foreach (var plane in k_UpdatedPlanes) { UpdateDebugVertices(m_DebugDataById[plane.id], plane); } } }