Exemplo n.º 1
0
        public static PortalPoly Read(DatReader datReader)
        {
            PortalPoly obj = new PortalPoly();

            obj.PortalIndex = datReader.ReadInt16();
            obj.PolygonId   = datReader.ReadInt16();
            return(obj);
        }
Exemplo n.º 2
0
        public static Polygon Read(DatReader datReader)
        {
            Polygon obj = new Polygon();

            obj.NumPts     = datReader.ReadByte();
            obj.Stippling  = datReader.ReadByte();
            obj.SidesType  = datReader.ReadInt32();
            obj.PosSurface = datReader.ReadInt16();
            obj.NegSurface = datReader.ReadInt16();

            for (short i = 0; i < obj.NumPts; i++)
            {
                obj.VertexIds.Add(datReader.ReadInt16());
            }

            if ((obj.Stippling & 4) == 0)
            {
                for (short i = 0; i < obj.NumPts; i++)
                {
                    obj.PosUVIndices.Add(datReader.ReadByte());
                }
            }

            if (obj.SidesType == 2 && ((obj.Stippling & 8) == 0))
            {
                for (short i = 0; i < obj.NumPts; i++)
                {
                    obj.NegUVIndices.Add(datReader.ReadByte());
                }
            }

            if (obj.SidesType == 1)
            {
                obj.NegSurface   = obj.PosSurface;
                obj.NegUVIndices = obj.PosUVIndices;
            }

            return(obj);
        }
Exemplo n.º 3
0
        public static CVertexArray Read(DatReader datReader)
        {
            CVertexArray obj = new CVertexArray();

            obj.VertexType = datReader.ReadInt32();

            uint num_vertices = datReader.ReadUInt32();

            if (obj.VertexType == 1)
            {
                for (uint i = 0; i < num_vertices; i++)
                {
                    short vert_id = datReader.ReadInt16();
                    obj.Vertices.Add(vert_id, SWVertex.Read(datReader));
                }
            }

            return(obj);
        }
Exemplo n.º 4
0
        public static SWVertex Read(DatReader datReader)
        {
            SWVertex obj = new SWVertex();

            short num_uvs = datReader.ReadInt16();

            obj.X       = datReader.ReadSingle();
            obj.Y       = datReader.ReadSingle();
            obj.Z       = datReader.ReadSingle();
            obj.NormalX = datReader.ReadSingle();
            obj.NormalY = datReader.ReadSingle();
            obj.NormalZ = datReader.ReadSingle();

            for (short i = 0; i < num_uvs; i++)
            {
                obj.UVs.Add(Vec2Duv.Read(datReader));
            }

            return(obj);
        }