public static Vertex Read(byte[] buffer, VertexFormat format, int[] offsets)
        {
            Vertex vertex = new Vertex();

            foreach (var element in format.Elements) {
                int elementOffset = offsets[element.SourcePart];

                ReadElement(buffer, element, elementOffset, ref vertex);
            }

            return vertex;
        }
Пример #2
0
        public static Vertex Read(byte[] buffer, VertexFormat format, int[] offsets)
        {
            Vertex vertex = new Vertex();

            foreach (var element in format.Elements)
            {
                int elementOffset = offsets[element.SourcePart];

                ReadElement(buffer, element, elementOffset, ref vertex);
            }

            return(vertex);
        }
Пример #3
0
        private void ReadVertices(byte[] buffer)
        {
            MeshHeader   header = Header;
            VertexFormat format = VertexFormat;

            int[] offsets = new int[header.VertexBufferCount];
            for (int oi = 0; oi < offsets.Length; ++oi)
            {
                offsets[oi] = header.VertexOffsets[oi];
            }

            Vertices = new Vertex[Header.VertexCount];
            for (int i = 0; i < header.VertexCount; ++i)
            {
                Vertices[i] = VertexReader.Read(buffer, format, offsets);

                for (int oi = 0; oi < offsets.Length; ++oi)
                {
                    offsets[oi] += header.BytesPerVertexPerBuffer[oi];
                }
            }
        }