Beispiel #1
0
 void Update()
 {
     if (bStartRead)
     {
         bStartRead = false;
         int index   = _data.IsHollow ? 0 : B45ChunkData.OneIndexNoPrefix(xnpre, ynpre, znpre);
         int indexVT = index * B45Block.Block45Size;
         vol = _data.DataVT[indexVT];
     }
     if (bApplyWrite)
     {
         bApplyWrite = false;
         int index   = _data.IsHollow ? 0 : B45ChunkData.OneIndexNoPrefix(xnpre, ynpre, znpre);
         int indexVT = index * B45Block.Block45Size;
         _data.WriteVoxelAtIdx(xnpre - VoxelTerrainConstants._numVoxelsPrefix,
                               ynpre - VoxelTerrainConstants._numVoxelsPrefix,
                               znpre - VoxelTerrainConstants._numVoxelsPrefix,
                               new B45Block(vol, _data.DataVT[indexVT + 1]));
     }
 }
Beispiel #2
0
    public static string OccupiedVecsStr(byte[] byteData)
    {
        string str = "";

        for (int z = 0; z < Block45Constants.VOXEL_ARRAY_AXIS_SIZE; z++)
        {
            for (int y = 0; y < Block45Constants.VOXEL_ARRAY_AXIS_SIZE; y++)
            {
                for (int x = 0; x < Block45Constants.VOXEL_ARRAY_AXIS_SIZE; x++)
                {
                    B45Block blk;

                    blk.blockType = byteData[B45ChunkData.OneIndexNoPrefix(x, y, z) * B45Block.Block45Size];
                    //blk.materialType = _chunkData[OneIndexNoPrefix(x,y,z) * B45Block.Block45Size + 1];
                    if (blk.blockType != 0)
                    {
                        str += "(" + (x - 1) + "," + (y - 1) + "," + (z - 1) + "); ";
                    }
                }
            }
        }
        return(str);
    }