예제 #1
0
        public static byte[] UnSwizzle(NewTexture texture)
        {
            int destinationOffset = 0;

            int height = texture.Height;
            // Incorperate the bpp into the width
            int width = (texture.Width * texture.BitsPerPixel) >> 3;

            byte[] destination = new byte[width * height];

            int rowblocks = (width / 16);

            int magicNumber = 8;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    int blockX = x / 16;
                    int blockY = y / magicNumber;

                    int blockIndex   = blockX + ((blockY) * rowblocks);
                    int blockAddress = blockIndex * 16 * magicNumber;
                    int offset       = blockAddress + (x - blockX * 16) + ((y - blockY * magicNumber) * 16);
                    destination[destinationOffset] = texture.Binary[offset];
                    destinationOffset++;
                }
            }

            return(destination);
        }
예제 #2
0
        private void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            var newTex = new NewTexture();

            if (newTex.ShowDialog().HasValue&& newTex.textureView != null)
            {
                UpdateData(newTex.textureView);
                SetTexture(newTex.textureView);
            }
        }
예제 #3
0
        private byte[] UnSwizzle(Texture texture)
        {
            NewTexture swizzledTexture = new NewTexture {
                Width        = texture.Width,
                Height       = texture.Height,
                BitsPerPixel = texture.BitsPerPixel,
                Binary       = texture.Binary
            };

            return(SwizzleService.UnSwizzle(swizzledTexture));
        }