Exemple #1
0
        public static byte[] DecodeDetexLinear(byte[] inp, int width, int height, bool isFloat, DetexTextureFormat inputFormat,
                                               DetexPixelFormat outputPixelFormat, int blockSizeX = 4, int blockSizeY = 4)
        {
            var dst = new byte[width * height * (isFloat ? 16 : 4)];

            DecodeDetexLinear(inp, dst, width, height, inputFormat, outputPixelFormat, blockSizeX, blockSizeY);
            return(dst);
        }
Exemple #2
0
 public static bool DecodeDetexLinear(byte[] inp, byte[] dst, int width, int height, DetexTextureFormat inputFormat, DetexPixelFormat outputPixelFormat, int blockSizeX = 4, int blockSizeY = 4)
 {
     unsafe
     {
         detexTexture tex;
         tex.format           = (uint)inputFormat;
         tex.data             = (byte *)Unsafe.AsPointer(ref inp[0]);
         tex.width            = width;
         tex.height           = height;
         tex.width_in_blocks  = width / 4;
         tex.height_in_blocks = height / 4;
         return(detexDecompressTextureLinear(&tex, (byte *)Unsafe.AsPointer(ref dst[0]),
                                             (uint)outputPixelFormat));
     }
 }
Exemple #3
0
        public static bool DecodeDetexLinear(byte[] inp, byte[] dst, int width, int height, DetexTextureFormat inputFormat, DetexPixelFormat outputPixelFormat)
        {
            unsafe
            {
                fixed(byte *inpPtr = inp, dstPtr = dst)
                {
                    detexTexture tex;

                    tex.format           = (uint)inputFormat;
                    tex.data             = inpPtr;
                    tex.width            = width;
                    tex.height           = height;
                    tex.width_in_blocks  = width / 4;
                    tex.height_in_blocks = height / 4;
                    return(detexDecompressTextureLinear(&tex, dstPtr,
                                                        (uint)outputPixelFormat));
                }
            }
        }