public static CVertexArray CreateMutable(DatLoader.Entity.CVertexArray _vertexArray) { var vertexArray = new CVertexArray(); vertexArray.VertexType = _vertexArray.VertexType; vertexArray.Vertices = new Dictionary <ushort, SWVertex>(); foreach (var kvp in _vertexArray.Vertices) { vertexArray.Vertices.Add(kvp.Key, CreateMutable(kvp.Value)); } return(vertexArray); }
public Polygon(DatLoader.Entity.Polygon polygon, DatLoader.Entity.CVertexArray vertexArray) { NegSurface = polygon.NegSurface; NegUVIndices = polygon.NegUVIndices; NumPoints = polygon.NumPts; PosSurface = polygon.PosSurface; PosUVIndices = polygon.PosUVIndices; SidesType = (CullMode)polygon.SidesType; Stippling = polygon.Stippling; VertexIDs = polygon.VertexIds; Vertices = new List <Vertex>(); foreach (var vertexIdx in VertexIDs) { Vertices.Add(new Vertex(vertexArray.Vertices[(ushort)vertexIdx])); } make_plane(); }
/// <summary> /// Constructs a polygon from the DAT file /// </summary> public Polygon(DatLoader.Entity.Polygon polygon, DatLoader.Entity.CVertexArray vertexArray) { NegSurface = polygon.NegSurface; //NegUVIndices = polygon.NegUVIndices; PosSurface = polygon.PosSurface; //PosUVIndices = polygon.PosUVIndices; SidesType = polygon.SidesType; Stippling = polygon.Stippling; VertexIDs = polygon.VertexIds; Vertices = new List <Vertex>(); foreach (var vertexIdx in VertexIDs) { Vertices.Add(VertexCache.Get(vertexArray.Vertices[(ushort)vertexIdx])); } make_plane(); }
public BSPNode(DatLoader.Entity.BSPNode node, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { if (node.Sphere != null) { Sphere = new Sphere(node.Sphere); } if (node.SplittingPlane != null) { SplittingPlane = node.SplittingPlane.ToNumerics(); } Typename = node.Type; //Typename if (node.InPolys != null) { NumPolys = node.InPolys.Count; PolyIDs = node.InPolys; Polygons = new List <Polygon>(node.InPolys.Count); foreach (var poly in node.InPolys) { Polygons.Add(PolygonCache.Get(polys[poly], vertexArray)); } } if (node.PosNode != null) { if (!(node.PosNode is DatLoader.Entity.BSPLeaf)) { PosNode = new BSPNode(node.PosNode, polys, vertexArray); } else // portal? { PosNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.PosNode, polys, vertexArray); } } if (node.NegNode != null) { if (!(node.NegNode is DatLoader.Entity.BSPLeaf)) { NegNode = new BSPNode(node.NegNode, polys, vertexArray); } else // portal? { NegNode = new BSPLeaf((DatLoader.Entity.BSPLeaf)node.NegNode, polys, vertexArray); } } }
public BSPLeaf(DatLoader.Entity.BSPLeaf node, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) : base(node, polys, vertexArray) { LeafIdx = node.LeafIndex; Solid = node.Solid == 1; }
public BSPTree(DatLoader.Entity.BSPTree bsp, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { RootNode = new BSPNode(bsp.RootNode, polys, vertexArray); }
public static BSPTree Get(DatLoader.Entity.BSPTree _bspTree, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { var bspTree = new BSPTree(_bspTree, polys, vertexArray); if (!Enabled) { return(bspTree); } return(Get(bspTree)); }
public static BSPTree Get(DatLoader.Entity.BSPTree bspTree, Dictionary <ushort, DatLoader.Entity.Polygon> polys, DatLoader.Entity.CVertexArray vertexArray) { return(Get(new BSPTree(bspTree, polys, vertexArray))); }