Ejemplo n.º 1
0
    private void ColorCubeMap()
    {
        var a = 0;

        for (var x = 0; x < CUBE_SIZE; x++)
        {
            for (var y = 0; y < CUBE_SIZE; y++)
            {
                for (var z = 0; z < CUBE_SIZE; z++)
                {
                    if (CubeUtils.IsInternalQb(x, y, z, CUBE_SIZE))
                    {
                        continue;
                    }

                    var faceData = GetFaceData(_qubies[x][y][z], x, y, z);
                    a += faceData.Count;
                    faceData.ForEach((f) =>
                    {
                        ColorCubeMapFace(f.faceName, f.faceX, f.faceY, f.pixelColor);
                    });
                }
            }
        }
        print(a);
    }
Ejemplo n.º 2
0
 public static void AddVoxelToMesh(float x, float y, float z, float blockSize, MeshData meshData)
 {
     CubeUtils.FaceDataUp(x, y, z, blockSize, meshData);
     CubeUtils.FaceDataDown(x, y, z, blockSize, meshData);
     CubeUtils.FaceDataNorth(x, y, z, blockSize, meshData);
     CubeUtils.FaceDataSouth(x, y, z, blockSize, meshData);
     CubeUtils.FaceDataEast(x, y, z, blockSize, meshData);
     CubeUtils.FaceDataWest(x, y, z, blockSize, meshData);
 }
Ejemplo n.º 3
0
 public List<BMapCell> GetSheme(BMapCell startPoint, int[] sheme, int goesTo, bool includeStartPoint)
 {
     var res = new List<BMapCell>();
     var cubes = CubeUtils.GetSheme(startPoint.Cube, sheme, goesTo, includeStartPoint);
     // Определим какие части схемы попали на карту.
     for (int cellsCounter = 0; cellsCounter < _notNullCells.Length; cellsCounter++)
         for (int cubesCounter = 0; cubesCounter < cubes.Count; cubesCounter++)
             if (_notNullCells[cellsCounter].Cube == cubes[cubesCounter])
                 res.Add(_notNullCells[cellsCounter]);
     cubes = null;
     return res;
 }
Ejemplo n.º 4
0
 public List<BMapCell> GetCellsOnLine(Cube start, Cube end, bool incStart = true, bool incEnd = true)
 {
     lock (this)
     {
         var result = new List<BMapCell>();
         var cubes = CubeUtils.GetCubesOnLine(start, end.Add(1e-6f, 2e-6f, -3e-6f), incStart, incEnd);
         for (int i = 0; i < cubes.Count; i++)
         {
             var axial = cubes[i].ToAxial();
             var cell = Cells[axial.Q, axial.R];
             result.Add(cell);
         }
         cubes = null;
         return result;
     }
 }
Ejemplo n.º 5
0
    private void InplaceRotate(Cubie[][] mat, int slice)
    {
        var n = mat.Length;

        for (var x = 0; x < n / 2; x++)
        {
            for (var y = x; y < n - x - 1; y++)
            {
                if (CubeUtils.IsInternalQb(x, y, slice, (uint)n))
                {
                    continue;
                }
                var temp = mat[x][y];
                mat[x][y]                 = mat[y][n - 1 - x];
                mat[y][n - 1 - x]         = mat[n - 1 - x][n - 1 - y];
                mat[n - 1 - x][n - 1 - y] = mat[n - 1 - y][x];
                mat[n - 1 - y][x]         = temp;
            }
        }
    }