static void ReadElement(byte[] buffer, VertexFormatElement element, int offset, ref Vertex vertex) { var data = ReadData(buffer, element.DataType, offset + element.Offset); switch (element.Attribute) { case VertexAttribute.BlendIndices: vertex.BlendIndices = (uint)data; break; case VertexAttribute.BlendWeights: vertex.BlendWeights = (Vector4)data; break; case VertexAttribute.Color: vertex.Color = (Vector4)data; break; case VertexAttribute.Normal: vertex.Normal = ForceToVector3(data); break; case VertexAttribute.Position: vertex.Position = ForceToVector4(data); break; case VertexAttribute.Tangent2: vertex.Tangent2 = (Vector4)data; break; case VertexAttribute.Tangent1: vertex.Tangent1 = (Vector4)data; break; case VertexAttribute.UV: vertex.UV = ForceToVector4(data); break; default: throw new NotSupportedException(); } }