Esempio n. 1
0
        public static void MirrorY(CopyState state, BlockDefinition[] defs)
        {
            int midY = (state.Height + 1) / 2, maxY = state.Height - 1;

            state.OriginY  = state.OppositeOriginY;
            state.Offset.Y = -state.Offset.Y;
            BlockID[] transform = Transform(defs, mirrorY, null);

            for (int y = 0; y < midY; y++)
            {
                int endY = maxY - y;
                int beg  = 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++)
                    {
                        BlockID blockA = transform[state.Get(beg)];
                        BlockID blockB = transform[state.Get(end)];
                        state.Set(blockB, beg); state.Set(blockA, end);
                        beg++; end++;
                    }
                }
            }
        }
Esempio n. 2
0
        public static void MirrorZ(CopyState state, BlockDefinition[] defs)
        {
            int midZ = (state.Length + 1) / 2, maxZ = state.Length - 1;

            state.OriginZ  = state.OppositeOriginZ;
            state.Offset.Z = -state.Offset.Z;
            BlockID[] transform = Transform(defs, mirrorZ, null);

            for (int y = 0; y < state.Height; y++)
            {
                for (int z = 0; z < midZ; z++)
                {
                    int endZ = maxZ - z;
                    int beg  = state.GetIndex(0, y, z);
                    int end  = state.GetIndex(0, y, endZ);

                    for (int x = 0; x < state.Width; x++)
                    {
                        BlockID blockA = transform[state.Get(beg)];
                        BlockID blockB = transform[state.Get(end)];
                        state.Set(blockB, beg); state.Set(blockA, end);
                        beg++; end++;
                    }
                }
            }
        }
Esempio n. 3
0
        public static void MirrorZ(CopyState state, BlockDefinition[] defs)
        {
            int midX = (state.Width + 1) / 2, maxX = state.Width - 1;

            state.OriginX  = state.OppositeOriginX;
            state.Offset.X = -state.Offset.X;
            BlockID[] transform = Transform(defs, mirrorZ, null);

            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);

                        BlockID blockA = transform[state.Get(start)];
                        BlockID blockB = transform[state.Get(end)];
                        state.Set(blockB, start); state.Set(blockA, end);
                    }
                }
            }
        }
Esempio n. 4
0
        public static void MirrorX(CopyState state, BlockDefinition[] defs)
        {
            // ceiling division by 2, because for odd length, we still want to
            // mirror the middle row to rotate directional blocks
            int midX = (state.Width + 1) / 2, maxX = state.Width - 1;

            state.OriginX  = state.OppositeOriginX;
            state.Offset.X = -state.Offset.X;
            BlockID[] transform = Transform(defs, mirrorX, null);

            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 beg  = state.GetIndex(x, y, z);
                        int end  = state.GetIndex(endX, y, z);

                        BlockID blockA = transform[state.Get(beg)];
                        BlockID blockB = transform[state.Get(end)];
                        state.Set(blockB, beg); state.Set(blockA, end);
                    }
                }
            }
        }
Esempio n. 5
0
        public static void MirrorX(CopyState state, BlockDefinition[] defs)
        {
            // ceiling division by 2, because for odd length, we still want to
            // mirror the middle row to rotate directional blocks
            int midZ = (state.Length + 1) / 2, maxZ = state.Length - 1;

            state.OriginZ  = state.OppositeOriginZ;
            state.Offset.Z = -state.Offset.Z;
            BlockID[] transform = Transform(defs, mirrorX, null);

            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++)
                    {
                        BlockID blockA = transform[state.Get(start)];
                        BlockID blockB = transform[state.Get(end)];
                        state.Set(blockB, start); state.Set(blockA, end);
                        start++; end++;
                    }
                }
            }
        }
Esempio n. 6
0
        public static void MirrorZ(CopyState state)
        {
            int midX = state.Width / 2, maxX = state.Width - 1;

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

            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);
                    }
                }
            }
        }
Esempio n. 7
0
        public static void MirrorY(CopyState state)
        {
            int midY = state.Height / 2, maxY = state.Height - 1;

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

            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++;
                    }
                }
            }
        }
Esempio n. 8
0
        public static void MirrorX(CopyState state)
        {
            int midZ = state.Length / 2, maxZ = state.Length - 1;

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

            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++;
                    }
                }
            }
        }
Esempio n. 9
0
		void FlipZ(CopyState state) {
			int midZ = state.Width / 2, maxZ = state.Length - 1;
			byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
			
			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++;
					}
				}
			}
		}
Esempio n. 10
0
		void FlipY(CopyState state) {
			int midY = state.Height / 2, maxY = state.Height - 1;
			byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
			
			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++;
					}
				}
			}
		}
Esempio n. 11
0
		void FlipX(CopyState state) {
			int midX = state.Width / 2, maxX = state.Width - 1;
			byte[] blocks = state.Blocks, extBlocks = state.ExtBlocks;
			
			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);
					}
				}
			}
		}