public void LoadVertices(CVertexArray vertexArray) { Vertices = new List <SWVertex>(); foreach (var id in VertexIds) { Vertices.Add(vertexArray.Vertices[(ushort)id]); } }
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); }
public static CellStruct Read(DatReader datReader) { CellStruct obj = new CellStruct(); uint numPolygons = datReader.ReadUInt32(); uint numPhysicsPolygons = datReader.ReadUInt32(); uint numPortals = datReader.ReadUInt32(); obj.VertexArray = CVertexArray.Read(datReader); for (uint i = 0; i < numPolygons; i++) { ushort poly_id = datReader.ReadUInt16(); obj.Polygons.Add(poly_id, Polygon.Read(datReader)); } for (uint i = 0; i < numPortals; i++) { obj.Portals.Add(datReader.ReadUInt16()); } datReader.AlignBoundary(); obj.CellBSP = BSPTree.Read(datReader, BSPType.Cell); for (uint i = 0; i < numPhysicsPolygons; i++) { ushort poly_id = datReader.ReadUInt16(); obj.PhysicsPolygons.Add(poly_id, Polygon.Read(datReader)); } obj.PhysicsBSP = BSPTree.Read(datReader, BSPType.Physics); uint hasDrawingBSP = datReader.ReadUInt32(); if (hasDrawingBSP != 0) { obj.DrawingBSP = BSPTree.Read(datReader, BSPType.Drawing); } datReader.AlignBoundary(); return(obj); }