Exemple #1
0
        /// <summary>
        /// Gets the total size of all mipmaps and faces.
        /// </summary>
        public ulong GetTotalSize()
        {
            ulong totalSize = 0;

            for (int mipLevel = 0; mipLevel < Header.NumberOfMipmapLevels; mipLevel++)
            {
                for (int face = 0; face < Header.NumberOfFaces; face++)
                {
                    KtxMipFace ktxface = MipMaps[mipLevel].Faces[face];
                    totalSize += ktxface.SizeInBytes;
                }
            }

            return(totalSize);
        }
Exemple #2
0
        /// <summary>
        /// Gets all texture data of the file in MipMap-major order (face0_mip0 ... face1_mip0 ... face0_mip1 ...)
        /// </summary>
        public byte[] GetAllTextureDataMipMajor()
        {
            byte[] result = new byte[GetTotalSize()];
            uint   start  = 0;

            for (int mipLevel = 0; mipLevel < Header.NumberOfMipmapLevels; mipLevel++)
            {
                for (int face = 0; face < Header.NumberOfFaces; face++)
                {
                    KtxMipFace ktxMipFace = MipMaps[mipLevel].Faces[face];
                    ktxMipFace.Data.CopyTo(result, (int)start);
                    start += ktxMipFace.SizeInBytes;
                }
            }

            return(result);
        }