/// <summary> /// copy constructor /// </summary> /// <param name="instance">copy instance</param> public CSGPolygon(CSGPolygon instance) { Vertices = new List<CSGVertex>(instance.Vertices.Count); foreach (var vertex in instance.Vertices) { Vertices.Add(new CSGVertex(vertex)); } Plane = new CSGPlane(instance.Plane); Id = instance.Id; }
/// <summary> /// copy constructor /// </summary> /// <param name="instance">copy instance</param> public CSGPolygon(CSGPolygon instance) { Vertices = new List <CSGVertex>(instance.Vertices.Count); foreach (var vertex in instance.Vertices) { Vertices.Add(new CSGVertex(vertex)); } Plane = new CSGPlane(instance.Plane); Id = instance.Id; }
/// <summary> /// build new bsp tree from polygons /// </summary> /// <param name="polygons">input polygons</param> public void Build(List <CSGPolygon> polygons) { if (polygons.Count == 0) { return; } if (Plane == null) { Plane = new CSGPlane(polygons[0].Plane); } var frontList = new List <CSGPolygon>(); var backList = new List <CSGPolygon>(); foreach (var polygon in polygons) { Plane.Split(polygon, Polygons, Polygons, frontList, backList); } if (frontList.Count > 0) { if (FrontChild == null) { FrontChild = new CSGNode(); } FrontChild.Build(frontList); } if (backList.Count > 0) { if (BackChild == null) { BackChild = new CSGNode(); } BackChild.Build(backList); } }
/// <summary> /// copy constructor /// </summary> public CSGNode(CSGNode instance) { if (Plane != null) { Plane = new CSGPlane(instance.Plane); } if (instance.FrontChild != null) { FrontChild = new CSGNode(instance.FrontChild); } if (instance.BackChild != null) { BackChild = new CSGNode(instance.BackChild); } Polygons = new List<CSGPolygon>(instance.Polygons.Count); foreach (var polygon in instance.Polygons) { Polygons.Add(new CSGPolygon(polygon)); } }
/// <summary> /// copy constructor /// </summary> public CSGNode(CSGNode instance) { if (Plane != null) { Plane = new CSGPlane(instance.Plane); } if (instance.FrontChild != null) { FrontChild = new CSGNode(instance.FrontChild); } if (instance.BackChild != null) { BackChild = new CSGNode(instance.BackChild); } Polygons = new List <CSGPolygon>(instance.Polygons.Count); foreach (var polygon in instance.Polygons) { Polygons.Add(new CSGPolygon(polygon)); } }
/// <summary> /// build new bsp tree from polygons /// </summary> /// <param name="polygons">input polygons</param> public void Build(List<CSGPolygon> polygons) { if (polygons.Count == 0) { return; } if (Plane == null) { Plane = new CSGPlane(polygons[0].Plane); } var frontList = new List<CSGPolygon>(); var backList = new List<CSGPolygon>(); foreach (var polygon in polygons) { Plane.Split(polygon, Polygons, Polygons, frontList, backList); } if (frontList.Count > 0) { if (FrontChild == null) { FrontChild = new CSGNode(); } FrontChild.Build(frontList); } if (backList.Count > 0) { if (BackChild == null) { BackChild = new CSGNode(); } BackChild.Build(backList); } }
/// <summary> /// constructor with parameters /// </summary> /// <param name="id">id of the polygon</param> /// <param name="vertices"></param> public CSGPolygon(int id, params CSGVertex[] vertices) { Vertices = new List <CSGVertex>(vertices); Plane = new CSGPlane(vertices[0].P, vertices[1].P, vertices[2].P); Id = id; }
/// <summary> /// constructor with points, normals and uvs for 3 vertices /// </summary> public CSGPolygon(int id, List <CSGVertex> vertices) { Vertices = vertices; Plane = new CSGPlane(vertices[0].P, vertices[1].P, vertices[2].P); Id = id; }
/// <summary> /// copy constructor /// </summary> public CSGPlane(CSGPlane instance) { Normal = instance.Normal; Distance = instance.Distance; }
/// <summary> /// constructor with parameters /// </summary> /// <param name="id">id of the polygon</param> /// <param name="vertices"></param> public CSGPolygon(int id, params CSGVertex[] vertices) { Vertices = new List<CSGVertex>(vertices); Plane = new CSGPlane(vertices[0].P, vertices[1].P, vertices[2].P); Id = id; }
/// <summary> /// constructor with points, normals and uvs for 3 vertices /// </summary> public CSGPolygon(int id, List<CSGVertex> vertices) { Vertices = vertices; Plane = new CSGPlane(vertices[0].P, vertices[1].P, vertices[2].P); Id = id; }
// Token: 0x06004182 RID: 16770 RVA: 0x0014AE05 File Offset: 0x00149205 public CSGPlane(CSGPlane instance) { this.Normal = instance.Normal; this.Distance = instance.Distance; }