Пример #1
0
        public static ComplexVertex ReadComplexVertex(this BinaryReader reader)
        {
            var vertex = new ComplexVertex {
                position = reader.ReadFloat3(),
                normal   = reader.ReadFloat3(),
                uv       = reader.ReadFloat2()
            };

            var numExtraBytes = 0;

            if (HasExtra(reader, 8))
            {
                numExtraBytes = 12;
            }
            else if (HasExtra(reader, 4))
            {
                numExtraBytes = 8;
            }
            else if (HasExtra(reader, 0))
            {
                numExtraBytes = 4;
            }

            var extraData = reader.ReadBytes(numExtraBytes);

            return(vertex);
        }
Пример #2
0
 public static void WriteComplexVertex(this StreamWriter writer, ComplexVertex vertex)
 {
     writer.WriteLine("v " + vertex.position.x + " " + vertex.position.y + " " + vertex.position.z);
     writer.WriteLine("vn " + vertex.normal.x + " " + vertex.normal.y + " " + vertex.normal.z);
     writer.WriteLine("vt " + vertex.uv.x + " " + vertex.uv.y);
 }