private static void ExportVertex(TextWriter sw, Mesh m, Vertex v)
        {
            var boneIndex = m.VertexHasBlendInfo ? v.BlendIndices[0] : 0;
            var normal = m.VertexHasNormal ? v.Normal : new Vector3();
            var uv = m.VertexHasTexture ? v.TextureCoordinates[0] : new Vector2();
            var position = v.Position;

            sw.WriteLine("{0}   {1} {2} {3}   {4} {5} {6}   {7} {8}   1 0   1.000000", boneIndex,
                         F(position.X), F(position.Y), F(position.Z),
                         F(normal.X), F(normal.Y), F(normal.Z),
                         F(uv.X), F(uv.Y));
        }
Exemple #2
0
        public Vertex[] DecodeVertexData()
        {
            byte[] vertexData = VertexData;
            Vertex[] vertices = new Vertex[VertexCount];

            using(MemoryStream ms = new MemoryStream(vertexData))
            {
                BinaryReader br = new BinaryReader(ms);
                for (int i = 0; i < VertexCount; i++)
                {
                    ms.Seek(i*VertexStride, SeekOrigin.Begin);
                    vertices[i] = new Vertex(br, this);
                }
            }

            return vertices;
        }