Exemplo n.º 1
0
        public static XxDocument Parse(Stream stream)
        {
            var rt = new XxDocument();

            // leave open
            var br       = new BinaryReader(stream);
            var vertices = br.ReadUInt32();

            for (uint i = 0; i < vertices; i++)
            {
                rt.Vertices.Add(XxVertex.Parse(br));
            }

            var lines = br.ReadUInt32();

            for (uint i = 0; i < lines; i++)
            {
                rt.Lines.Add(XxLine.Parse(br));
            }

            var materials = br.ReadUInt32();

            for (uint i = 0; i < materials; i++)
            {
                rt.Materials.Add(XxMaterial.Parse(br));
            }

            return(rt);
        }
Exemplo n.º 2
0
 public void Write(BinaryWriter bw)
 {
     this.Diffuse.ForEach(bw.Write);
     bw.Write(this.Power);
     this.Specular.ForEach(bw.Write);
     this.Ambient.ForEach(bw.Write);
     bw.Write(this.LineCount);
     XxDocument.WriteXxString(bw, this.Texture, 256, string.IsNullOrEmpty(this.Texture) ? (byte)0 : (byte)0xFD);
 }
Exemplo n.º 3
0
 public static XxMaterial Parse(BinaryReader br)
 {
     return(new XxMaterial
     {
         Diffuse = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
         Power = br.ReadSingle(),
         Specular = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
         Ambient = new[] { br.ReadSingle(), br.ReadSingle(), br.ReadSingle() },
         LineCount = br.ReadUInt32(),
         Texture = XxDocument.ReadXxString(br, 256),
     });
 }
Exemplo n.º 4
0
        public static XxDocument Parse(Stream stream)
        {
            var rt = new XxDocument();

            // leave open
            var br = new BinaryReader(stream);
            var vertices = br.ReadUInt32();

            for (uint i = 0; i < vertices; i++)
                rt.Vertices.Add(XxVertex.Parse(br));

            var lines = br.ReadUInt32();

            for (uint i = 0; i < lines; i++)
                rt.Lines.Add(XxLine.Parse(br));

            var materials = br.ReadUInt32();

            for (uint i = 0; i < materials; i++)
                rt.Materials.Add(XxMaterial.Parse(br));

            return rt;
        }