private void RecalculatePositions() { ClearPositionsAndMaxContent(); int sizeInVoxels = MyVoxelConstants.VOXEL_DATA_CELL_SIZE_IN_VOXELS * MyVoxelConstants.VOXEL_MAP_ORE_DEPOSIT_CELL_IN_DATA_CELLS; MyMwcVector3Int voxelStartCoord = new MyMwcVector3Int(sizeInVoxels * m_coord.X, sizeInVoxels * m_coord.Y, sizeInVoxels * m_coord.Z); MyMwcVector3Int voxelEndCoord = new MyMwcVector3Int(voxelStartCoord.X + sizeInVoxels - 1, voxelStartCoord.Y + sizeInVoxels - 1, voxelStartCoord.Z + sizeInVoxels - 1); MyMwcVector3Int voxelCoord; for (voxelCoord.X = voxelStartCoord.X; voxelCoord.X <= voxelEndCoord.X; voxelCoord.X++) { for (voxelCoord.Y = voxelStartCoord.Y; voxelCoord.Y <= voxelEndCoord.Y; voxelCoord.Y++) { for (voxelCoord.Z = voxelStartCoord.Z; voxelCoord.Z <= voxelEndCoord.Z; voxelCoord.Z++) { byte content = m_voxelMap.GetVoxelContent(ref voxelCoord); if (content >= MyVoxelConstants.VOXEL_ISO_LEVEL) { MyMwcVoxelMaterialsEnum material = m_voxelMap.GetVoxelMaterial(ref voxelCoord); byte maxContent; m_helpersMaxContentForMaterial.TryGetValue((int)material, out maxContent); if (!m_allMaterialsPositions.ContainsKey((int)material) || content > maxContent) { if (!m_allMaterialsPositions.ContainsKey((int)material)) { m_allMaterialsPositions.Add((int)material, m_voxelMap.GetVoxelCenterPositionAbsolute(ref voxelCoord)); } else { m_allMaterialsPositions[(int)material] = m_voxelMap.GetVoxelCenterPositionAbsolute(ref voxelCoord); } if (!m_helpersMaxContentForMaterial.ContainsKey((int)material)) { m_helpersMaxContentForMaterial.Add((int)material, content); } else { m_helpersMaxContentForMaterial[(int)material] = content; } } } } } } //if (m_oreWithContent.Count > 0) //{ // SortByContent(); // m_position = m_allMaterialsPositions[(int)m_oreWithContent[0]].Value; //} //else //{ // m_position = WorldAABB.GetCenter(); //} }