SEToolbox.Interop.Asteroids.MyVoxelMap.SumVoxelCells C# (CSharp) Method

SumVoxelCells() public method

public SumVoxelCells ( ) : long
return long
        public long SumVoxelCells()
        {
            long sum = 0;

            if (!IsValid)
                return sum;

            for (var x = 0; x < _voxelContentCells.Length; x++)
            {
                for (var y = 0; y < _voxelContentCells[x].Length; y++)
                {
                    for (var z = 0; z < _voxelContentCells[x][y].Length; z++)
                    {
                        if (_voxelContentCells[x][y][z] != null)
                        {
                            sum += _voxelContentCells[x][y][z].VoxelSum;
                        }
                        else
                        {
                            sum += MyVoxelConstants.VOXEL_CELL_CONTENT_SUM_TOTAL;
                        }
                    }
                }
            }

            return sum;
        }

Usage Example

Ejemplo n.º 1
0
 public static void GetPreview(string filename, out Vector3I size, out BoundingBoxD contentBounds, out long voxCells, out bool isValid)
 {
     try
     {
         var map = new MyVoxelMap();
         map.Load(filename, SpaceEngineersCore.Resources.GetDefaultMaterialName(), false);
         size = map.Size;
         contentBounds = map.BoundingContent;
         voxCells = map.SumVoxelCells();
         isValid = map.IsValid;
     }
     catch (Exception ex)
     {
         size = Vector3I.Zero;
         contentBounds = new BoundingBoxD();
         voxCells = 0;
         isValid = false;
         DiagnosticsLogging.LogWarning(string.Format(Res.ExceptionState_CorruptAsteroidFile, filename), ex);
     }
 }
All Usage Examples Of SEToolbox.Interop.Asteroids.MyVoxelMap::SumVoxelCells