Exemple #1
0
        public override byte NextBlock(DrawOp op)
        {
            // Figure out local coords for this block
            int x = (op.Coords.X - op.Min.X) % state.Width;

            if (x < 0)
            {
                x += state.Width;
            }
            int y = (op.Coords.Y - op.Min.Y) % state.Height;

            if (y < 0)
            {
                y += state.Height;
            }
            int z = (op.Coords.Z - op.Min.Z) % state.Length;

            if (z < 0)
            {
                z += state.Length;
            }

            index = state.GetIndex(x, y, z);
            return(state.Blocks[index]);
        }
Exemple #2
0
        void FlipZ(CopyState state)
        {
            int midX = state.Width / 2, maxX = state.Width - 1;

            byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
            state.OriginX = state.OppositeOriginX;

            for (int y = 0; y < state.Height; y++)
            {
                for (int z = 0; z < state.Length; z++)
                {
                    for (int x = 0; x < midX; x++)
                    {
                        int endX  = maxX - x;
                        int start = state.GetIndex(x, y, z);
                        int end   = state.GetIndex(endX, y, z);
                        Swap(blocks, extBlocks, start, end);
                    }
                }
            }
        }
Exemple #3
0
        void FlipY(CopyState state)
        {
            int midY = state.Height / 2, maxY = state.Height - 1;

            byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
            state.OriginY = state.OppositeOriginY;

            for (int y = 0; y < midY; y++)
            {
                int endY  = maxY - y;
                int start = state.GetIndex(0, y, 0);
                int end   = state.GetIndex(0, endY, 0);
                for (int z = 0; z < state.Length; z++)
                {
                    for (int x = 0; x < state.Width; x++)
                    {
                        Swap(blocks, extBlocks, start, end);
                        start++; end++;
                    }
                }
            }
        }
Exemple #4
0
        void FlipX(CopyState state)
        {
            int midZ = state.Length / 2, maxZ = state.Length - 1;

            byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
            state.OriginZ = state.OppositeOriginZ;

            for (int y = 0; y < state.Height; y++)
            {
                for (int z = 0; z < midZ; z++)
                {
                    int endZ  = maxZ - z;
                    int start = state.GetIndex(0, y, z);
                    int end   = state.GetIndex(0, y, endZ);
                    for (int x = 0; x < state.Width; x++)
                    {
                        Swap(blocks, extBlocks, start, end);
                        start++; end++;
                    }
                }
            }
        }
Exemple #5
0
        public override byte NextBlock(DrawOp op)
        {
            Vec3U16 p = LocalCoords(op);

            return(state.Blocks[state.GetIndex(p.X, p.Y, p.Z)]);
        }