示例#1
0
文件: Mesh.cs 项目: xorza/NetGL
        public void ToStream(BinaryWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(Vertices != null);
            if (Vertices != null)
            {
                Vertices.ToStream(writer.BaseStream);
            }

            writer.Write(Tangents != null);
            if (Tangents != null)
            {
                Tangents.ToStream(writer.BaseStream);
            }

            writer.Write(Colors != null);
            if (Colors != null)
            {
                Colors.ToStream(writer.BaseStream);
            }

            writer.Write(Normals != null);
            if (Normals != null)
            {
                Normals.ToStream(writer.BaseStream);
            }

            writer.Write(TexCoords != null);
            if (TexCoords != null)
            {
                TexCoords.ToStream(writer.BaseStream);
            }

            writer.Write(Indices != null);
            if (Indices != null)
            {
                Indices.ToStream(writer.BaseStream);
            }

            writer.Write((uint)Type);
            writer.Write((uint)DrawStyle);
            writer.Write((uint)FrontFace);
            writer.WriteNullableString(Name);

            var bounds = Bounds;

            writer.Write(bounds.Center);
            writer.Write(bounds.Size);
            writer.Write(bounds.Radius);
        }