private void DrawOreMarkers(MyHudOreMarkers oreMarkers) { ProfilerShort.Begin("MyGuiScreenHud.DrawOreMarkers"); if (m_nearestOreDeposits == null || m_nearestOreDeposits.Length < MyDefinitionManager.Static.VoxelMaterialCount) { m_nearestOreDeposits = new OreDepositMarker[MyDefinitionManager.Static.VoxelMaterialCount]; m_nearestDistanceSquared = new float[m_nearestOreDeposits.Length]; } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { m_nearestOreDeposits[i] = default(OreDepositMarker); m_nearestDistanceSquared[i] = float.MaxValue; } foreach (var oreMarker in oreMarkers) { bool debugBoxDrawn = false; foreach (var depositData in oreMarker.Materials) { var oreMaterial = depositData.Material; Vector3D oreWorldPosition; depositData.ComputeWorldPosition(oreMarker.VoxelMap, out oreWorldPosition); var distanceSquared = Vector3.DistanceSquared((Vector3)oreWorldPosition, (Vector3)((MyEntity)MySession.ControlledEntity).WorldMatrix.Translation); float nearestDistanceSquared = m_nearestDistanceSquared[oreMaterial.Index]; if (distanceSquared < nearestDistanceSquared) { m_nearestOreDeposits[oreMaterial.Index] = MyTuple.Create(oreWorldPosition, oreMarker); m_nearestDistanceSquared[oreMaterial.Index] = distanceSquared; } if (false && !debugBoxDrawn) { const int shift = MyOreDetectorComponent.CELL_SIZE_IN_VOXELS_BITS + MyOreDetectorComponent.QUERY_LOD; var worldPosition = oreWorldPosition; Vector3I cellCoord; MyVoxelCoordSystems.WorldPositionToVoxelCoord(oreMarker.VoxelMap.PositionLeftBottomCorner, ref worldPosition, out cellCoord); cellCoord >>= shift; worldPosition = cellCoord * MyOreDetectorComponent.CELL_SIZE_IN_METERS + MyVoxelConstants.VOXEL_SIZE_IN_METRES_HALF; worldPosition += oreMarker.VoxelMap.PositionLeftBottomCorner; var bbox = new BoundingBoxD(worldPosition, worldPosition + MyOreDetectorComponent.CELL_SIZE_IN_METERS); VRageRender.MyRenderProxy.DebugDrawAABB(bbox, Vector3.One, 1f, 1f, false); debugBoxDrawn = true; } } } for (int i = 0; i < m_nearestOreDeposits.Length; i++) { var nearestOreDeposit = m_nearestOreDeposits[i]; if (nearestOreDeposit.Item2 == null || nearestOreDeposit.Item2.VoxelMap == null || nearestOreDeposit.Item2.VoxelMap.Closed) { continue; } MyVoxelMaterialDefinition voxelMaterial = MyDefinitionManager.Static.GetVoxelMaterialDefinition((byte)i); string oreSubtype = voxelMaterial.MinedOre; var hudParams = new MyHudEntityParams() { FlagsEnum = MyHudIndicatorFlagsEnum.SHOW_ALL, Text = new StringBuilder(oreSubtype), OffsetText = true, Icon = MyHudTexturesEnum.HudOre, IconSize = new Vector2(0.02f, 0.02f) }; m_markerRender.DrawLocationMarker( m_oreHudMarkerStyle, nearestOreDeposit.Item1, hudParams, 0, 0); } DrawTexts(); ProfilerShort.End(); }