public static HwVertexArray FromData(BinaryReader reader, GameType gameType)
        {
            var x = new HwVertexArray();

            x.VertexCount = reader.ReadUInt32();
            uint streamCount = reader.ReadUInt32();

            x.IsStreaming = reader.ReadBooleanStrict();

            x.Streams = new List <VertexStream>((int)streamCount);

            for (uint i = 0; i < streamCount; i++)
            {
                uint flags            = reader.ReadUInt32();
                uint byteStride       = reader.ReadUInt32();
                uint elementDescCount = reader.ReadUInt32();

                var stream = new VertexStream();
                stream.Flags       = flags;
                stream.ElementInfo = new List <VertexElementDesc>((int)elementDescCount);

                for (uint j = 0; j < elementDescCount; j++)
                {
                    stream.ElementInfo.Add(new VertexElementDesc()
                    {
                        ByteOffset     = reader.ReadByte(),
                        StorageType    = (BaseVertexElementStorageType)reader.ReadByte(),
                        ComponentCount = reader.ReadByte(),
                        ElementType    = (BaseVertexElement)reader.ReadByte(),
                    });
                }

                stream.GUID   = new BaseGGUUID().FromData(reader);
                stream.Buffer = HwBuffer.FromVertexData(reader, gameType, x.IsStreaming, byteStride, x.VertexCount);

                x.Streams.Add(stream);
            }

            return(x);
        }
        public static HwVertexArray FromData(BinaryReader reader, GameType gameType)
        {
            var array = new HwVertexArray();

            array.VertexCount = reader.ReadUInt32();
            uint streamCount = reader.ReadUInt32();

            array.StreamingMode = (BaseRenderDataStreamingMode)reader.ReadByte();

            array.Streams = new List <VertexStream>((int)streamCount);

            for (uint i = 0; i < streamCount; i++)
            {
                uint flags            = reader.ReadUInt32();
                uint byteStride       = reader.ReadUInt32();
                uint elementDescCount = reader.ReadUInt32();

                var stream = new VertexStream();
                stream.Flags       = flags;
                stream.ElementInfo = new List <VertexElementDesc>((int)elementDescCount);

                for (uint j = 0; j < elementDescCount; j++)
                {
                    stream.ElementInfo.Add(new VertexElementDesc()
                    {
                        ByteOffset     = reader.ReadByte(),
                        StorageType    = (BaseVertexElementStorageType)reader.ReadByte(),
                        ComponentCount = reader.ReadByte(),
                        ElementType    = (BaseVertexElement)reader.ReadByte(),
                    });
                }

                stream.ResourceDataHash = BaseGGUUID.FromData(reader);
                stream.Buffer           = HwBuffer.FromVertexData(reader, gameType, array.StreamingMode, byteStride, array.VertexCount);

                array.Streams.Add(stream);
            }

            return(array);
        }