Exemplo n.º 1
0
        public static Vertex3d FromStream(BinaryReader br)
        {
            var result = new Vertex3d();

            result.Position = Vector3Ex.FromStream(br);
            result.Normal   = Vector3Ex.FromStream(br);

            result.TexCoord = new Vector2(br.ReadSingle(), br.ReadSingle());
            result.Color    = new Vector4(br.ReadSingle(), br.ReadSingle(), br.ReadSingle(), br.ReadSingle());

            result.AutodotsTexCoord = Vector3Ex.FromStream(br);
            result.OriginalPosition = Vector3Ex.FromStream(br);

            return(result);
        }
Exemplo n.º 2
0
        public static RenderMeshPart FromStream(BinaryReader br)
        {
            var result = new RenderMeshPart();

            result.Guid = new Guid(br.ReadString());
            result.Name = br.ReadString();

            var cnt = br.ReadInt32();

            result.CountIndices = cnt;
            for (var i = 0; i < cnt; i++)
            {
                result.Indices.Add(br.ReadUInt32());
            }

            cnt = br.ReadInt32();
            if (cnt != 0)
            {
                result.Vertices = new Vertex3d[cnt];
                for (var i = 0; i < cnt; i++)
                {
                    result.Vertices[i] = Vertex3d.FromStream(br);
                }
            }

            cnt = br.ReadInt32();
            for (var i = 0; i < cnt; i++)
            {
                result.Points.Add(Point3d.FromStream(br));
            }

            result.TextureName            = br.ReadString();
            result.TransparentTextureName = br.ReadString();

            result.Color         = Vector4Ex.FromStream(br);
            result.Type          = (HeadMeshType)br.ReadInt32();
            result.IsBaseTexture = br.ReadBoolean();

            result.Destroy();
            GL.GenBuffers(1, out result.VertexBuffer);
            GL.GenBuffers(1, out result.IndexBuffer);

            return(result);
        }