/// <summary>
        /// Deserializes a D3DTX Object from a byte array.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="bytePointerPosition"></param>
        public D3DTX_V7(BinaryReader reader, bool showConsole = false)
        {
            mVersion = reader.ReadInt32();                      //mVersion [4 bytes]
            mSamplerState_BlockSize = reader.ReadInt32();       //mSamplerState Block Size [4 bytes]
            mSamplerState           = new T3SamplerStateBlock() //mSamplerState [4 bytes]
            {
                mData = reader.ReadUInt32()
            };
            mPlatform_BlockSize = reader.ReadInt32();                                   //mPlatform Block Size [4 bytes]
            mPlatform           = EnumPlatformType.GetPlatformType(reader.ReadInt32()); //mPlatform [4 bytes]
            mName_BlockSize     = reader.ReadInt32();                                   //mName Block Size [4 bytes] //mName block size (size + string len)
            mName = ByteFunctions.ReadString(reader);                                   //mName [x bytes]
            mImportName_BlockSize = reader.ReadInt32();                                 //mImportName Block Size [4 bytes] //mImportName block size (size + string len)
            mImportName           = ByteFunctions.ReadString(reader);                   //mImportName [x bytes] (this is always 0)
            mImportScale          = reader.ReadSingle();                                //mImportScale [4 bytes]
            mToolProps            = new ToolProps()                                     //mToolProps [1 byte]
            {
                mbHasProps = reader.ReadBoolean()
            };
            mNumMipLevels = reader.ReadUInt32();                                                     //mNumMipLevels [4 bytes]
            mWidth        = reader.ReadUInt32();                                                     //mWidth [4 bytes]
            mHeight       = reader.ReadUInt32();                                                     //mHeight [4 bytes]

            mSurfaceFormat      = T3TextureBase_Functions.GetSurfaceFormat(reader.ReadInt32());      //mSurfaceFormat [4 bytes]
            mTextureLayout      = T3TextureBase_Functions.GetTextureLayout(reader.ReadInt32());      //mTextureLayout [4 bytes]
            mSurfaceGamma       = T3TextureBase_Functions.GetSurfaceGamma(reader.ReadInt32());       //mSurfaceGamma [4 bytes]
            mSurfaceMultisample = T3TextureBase_Functions.GetSurfaceMultisample(reader.ReadInt32()); //mSurfaceMultisample [4 bytes]
            mResourceUsage      = T3TextureBase_Functions.GetResourceUsage(reader.ReadInt32());      //mResourceUsage [4 bytes]
            mType        = T3Texture_Functions.GetTextureType(reader.ReadInt32());                   //mType [4 bytes]
            mSwizzleSize = reader.ReadInt32();                                                       //mSwizzleSize [4 bytes]
            mSwizzle     = new RenderSwizzleParams()                                                 //mSwizzle [4 bytes]
            {
                mSwizzle1 = (char)reader.ReadByte(),
                mSwizzle2 = (char)reader.ReadByte(),
                mSwizzle3 = (char)reader.ReadByte(),
                mSwizzle4 = (char)reader.ReadByte()
            };
            mNormalMapFormat    = reader.ReadInt32();                                   //mNormalMapFormat [4 bytes]
            mHDRLightmapScale   = reader.ReadSingle();                                  //mHDRLightmapScale [4 bytes]
            mToonGradientCutoff = reader.ReadSingle();                                  //mToonGradientCutoff [4 bytes]
            mAlphaMode          = T3Texture_Functions.GetAlphaMode(reader.ReadInt32()); //mAlphaMode [4 bytes]
            mColorMode          = T3Texture_Functions.GetColorMode(reader.ReadInt32()); //mColorMode [4 bytes]
            mUVOffset           = new Vector2()                                         //mUVOffset [8 bytes]
            {
                x = reader.ReadSingle(),                                                //[4 bytes]
                y = reader.ReadSingle()                                                 //[4 bytes]
            };
            mUVScale = new Vector2()                                                    //mUVScale [8 bytes]
            {
                x = reader.ReadSingle(),                                                //[4 bytes]
                y = reader.ReadSingle()                                                 //[4 bytes]
            };

            //--------------------------mArrayFrameNames--------------------------
            mArrayFrameNames_ArrayCapacity = reader.ReadUInt32(); //mArrayFrameNames DCArray Capacity [4 bytes]
            mArrayFrameNames_ArrayLength   = reader.ReadInt32();  //mArrayFrameNames DCArray Length [4 bytes] //ADD 1 BECAUSE COUNTING STARTS AT 0
            mArrayFrameNames = new List <Symbol>();
            for (int i = 0; i < mArrayFrameNames_ArrayLength; i++)
            {
                Symbol newSymbol = new Symbol()
                {
                    mCrc64 = reader.ReadUInt64()
                };

                mArrayFrameNames.Add(newSymbol);
            }

            //--------------------------mToonRegions--------------------------
            mToonRegions_ArrayCapacity = reader.ReadUInt32(); //mToonRegions DCArray Capacity [4 bytes]
            mToonRegions_ArrayLength   = reader.ReadInt32();  //mToonRegions DCArray Length [4 bytes]
            mToonRegions = new T3ToonGradientRegion[mToonRegions_ArrayLength];

            for (int i = 0; i < mToonRegions_ArrayLength; i++)
            {
                mToonRegions[i] = new T3ToonGradientRegion()
                {
                    mColor = new Color()
                    {
                        r = reader.ReadSingle(), //[4 bytes]
                        g = reader.ReadSingle(), //[4 bytes]
                        b = reader.ReadSingle(), //[4 bytes]
                        a = reader.ReadSingle()  //[4 bytes]
                    },

                    mSize = reader.ReadSingle() //[4 bytes]
                };
            }

            //--------------------------StreamHeader--------------------------
            mStreamHeader = new StreamHeader()
            {
                mRegionCount   = reader.ReadInt32(), //[4 bytes]
                mAuxDataCount  = reader.ReadInt32(), //[4 bytes]
                mTotalDataSize = reader.ReadInt32()  //[4 bytes]
            };

            //--------------------------mRegionHeaders--------------------------
            mRegionHeaders = new RegionStreamHeader[mStreamHeader.mRegionCount];
            for (int i = 0; i < mStreamHeader.mRegionCount; i++)
            {
                mRegionHeaders[i] = new RegionStreamHeader()
                {
                    mFaceIndex  = reader.ReadInt32(),  //[4 bytes]
                    mMipIndex   = reader.ReadInt32(),  //[4 bytes]
                    mMipCount   = reader.ReadInt32(),  //[4 bytes]
                    mDataSize   = reader.ReadUInt32(), //[4 bytes]
                    mPitch      = reader.ReadInt32(),  //[4 bytes]
                    mSlicePitch = reader.ReadInt32()   //[4 bytes]
                };
            }
            //-----------------------------------------D3DTX HEADER END-----------------------------------------
            //--------------------------STORING D3DTX IMAGE DATA--------------------------
            mPixelData = new List <byte[]>();

            for (int i = 0; i < mStreamHeader.mRegionCount; i++)
            {
                int    dataSize  = (int)mRegionHeaders[i].mDataSize;
                byte[] imageData = reader.ReadBytes(dataSize);

                mPixelData.Add(imageData);
            }

            if (showConsole)
            {
                PrintConsole();
            }
        }
        /// <summary>
        /// Deserializes a D3DTX Object from a byte array.
        /// </summary>
        /// <param name="data"></param>
        /// <param name="bytePointerPosition"></param>
        public D3DTX_V5(BinaryReader reader, bool showConsole = false)
        {
            mVersion = reader.ReadInt32();                      //mVersion [4 bytes]
            mSamplerState_BlockSize = reader.ReadInt32();       //mSamplerState Block Size [4 bytes]
            mSamplerState           = new T3SamplerStateBlock() //mSamplerState [4 bytes]
            {
                mData = reader.ReadUInt32()
            };
            mPlatform_BlockSize = reader.ReadInt32();                                   //mPlatform Block Size [4 bytes]
            mPlatform           = EnumPlatformType.GetPlatformType(reader.ReadInt32()); //mPlatform [4 bytes]
            mName_BlockSize     = reader.ReadInt32();                                   //mName Block Size [4 bytes] //mName block size (size + string len)
            mName = ByteFunctions.ReadString(reader);                                   //mName [x bytes]
            mImportName_BlockSize = reader.ReadInt32();                                 //mImportName Block Size [4 bytes] //mImportName block size (size + string len)
            mImportName           = ByteFunctions.ReadString(reader);                   //mImportName [x bytes] (this is always 0)
            mImportScale          = reader.ReadSingle();                                //mImportScale [4 bytes]
            Unknown0   = reader.ReadInt32();                                            //Unknown 0 [4 bytes] always zero (tool props byte structure size?)
            mToolProps = new ToolProps()                                                //mToolProps [1 byte]
            {
                mbHasProps = reader.ReadBoolean()
            };
            mNumMipLevels          = reader.ReadUInt32();                                          //mNumMipLevels [4 bytes]
            mWidth                 = reader.ReadUInt32();                                          //mWidth [4 bytes]
            mHeight                = reader.ReadUInt32();                                          //mHeight [4 bytes]
            mSurfaceFormat         = T3TextureBase_Functions.GetSurfaceFormat(reader.ReadInt32()); //mSurfaceFormat [4 bytes]
            mResourceUsage         = T3TextureBase_Functions.GetResourceUsage(reader.ReadInt32()); //mResourceUsage [4 bytes]
            Unknown1               = reader.ReadInt32();                                           //Unknown 1 [4 bytes]
            Unknown2               = reader.ReadInt32();                                           //Unknown 2 [4 bytes]
            Unknown3               = reader.ReadInt32();                                           //Unknown 3 [4 bytes]
            Unknown4               = reader.ReadInt32();                                           //Unknown 4 [4 bytes]
            mSpecularGlossExponent = reader.ReadSingle();                                          //mSpecularGlossExponent [4 bytes]
            mHDRLightmapScale      = reader.ReadSingle();                                          //mHDRLightmapScale [4 bytes]
            mToonGradientCutoff    = reader.ReadSingle();                                          //mToonGradientCutoff [4 bytes]
            mAlphaMode             = T3Texture_Functions.GetAlphaMode(reader.ReadInt32());         //mAlphaMode [4 bytes]
            mColorMode             = T3Texture_Functions.GetColorMode(reader.ReadInt32());         //mColorMode [4 bytes]
            mUVOffset              = new Vector2()                                                 //mUVOffset [8 bytes]
            {
                x = reader.ReadSingle(),                                                           //[4 bytes]
                y = reader.ReadSingle()                                                            //[4 bytes]
            };
            mUVScale = new Vector2()                                                               //mUVScale [8 bytes]
            {
                x = reader.ReadSingle(),                                                           //[4 bytes]
                y = reader.ReadSingle()                                                            //[4 bytes]
            };

            //--------------------------mToonRegions--------------------------
            mToonRegions_ArrayCapacity = reader.ReadUInt32(); //mToonRegions DCArray Capacity [4 bytes]
            mToonRegions_ArrayLength   = reader.ReadInt32();  //mToonRegions DCArray Length [4 bytes]
            mToonRegions = new T3ToonGradientRegion[mToonRegions_ArrayLength];

            for (int i = 0; i < mToonRegions_ArrayLength; i++)
            {
                mToonRegions[i] = new T3ToonGradientRegion()
                {
                    mColor = new Color()
                    {
                        r = reader.ReadSingle(), //[4 bytes]
                        g = reader.ReadSingle(), //[4 bytes]
                        b = reader.ReadSingle(), //[4 bytes]
                        a = reader.ReadSingle()  //[4 bytes]
                    },

                    mSize = reader.ReadSingle() //[4 bytes]
                };
            }

            //--------------------------StreamHeader--------------------------
            mStreamHeader = new StreamHeader()
            {
                mRegionCount   = reader.ReadInt32(), //[4 bytes]
                mAuxDataCount  = reader.ReadInt32(), //[4 bytes]
                mTotalDataSize = reader.ReadInt32()  //[4 bytes]
            };

            //--------------------------mRegionHeaders--------------------------
            mRegionHeaders = new RegionStreamHeader[mStreamHeader.mRegionCount];
            for (int i = 0; i < mStreamHeader.mRegionCount; i++)
            {
                mRegionHeaders[i] = new RegionStreamHeader()
                {
                    mFaceIndex = reader.ReadInt32(),  //[4 bytes]
                    mMipIndex  = reader.ReadInt32(),  //[4 bytes]
                    mMipCount  = reader.ReadInt32(),  //[4 bytes]
                    mDataSize  = reader.ReadUInt32(), //[4 bytes]
                    mPitch     = reader.ReadInt32(),  //[4 bytes]
                };
            }
            //-----------------------------------------D3DTX HEADER END-----------------------------------------
            //--------------------------STORING D3DTX IMAGE DATA--------------------------
            mPixelData = new List <byte[]>();

            for (int i = 0; i < mStreamHeader.mRegionCount; i++)
            {
                int    dataSize  = (int)mRegionHeaders[i].mDataSize;
                byte[] imageData = reader.ReadBytes(dataSize);

                mPixelData.Add(imageData);
            }

            if (showConsole)
            {
                PrintConsole();
            }
        }