public csgjs_plane clone() { csgjs_plane c = new csgjs_plane(); c.normal = normal.clone(); c.w = w; return c; }
public csgjs_csgnode() { front = null; back = null; plane = new csgjs_plane(); polygons = new List <csgjs_polygon>(); }
public csgjs_csgnode() { front = null; back = null; plane = new csgjs_plane(); polygons = new List<csgjs_polygon>(); }
public csgjs_plane clone() { csgjs_plane c = new csgjs_plane(); c.normal = normal.clone(); c.w = w; return(c); }
// Build a BSP tree out of `polygons`. When called on an existing tree, the // new polygons are filtered down to the bottom of the tree and become new // nodes there. Each set of polygons is partitioned using the first polygon // (no heuristic is used to pick a good split). void build(List <csgjs_polygon> list) { if (list.Count == 0) { return; } if (!plane.ok()) { plane = list[0].plane; } List <csgjs_polygon> list_front = new List <csgjs_polygon>(); List <csgjs_polygon> list_back = new List <csgjs_polygon>(); for (int i = 0; i < list.Count; i++) { plane.splitPolygon(list[i], polygons, polygons, ref list_front, ref list_back); } if (list_front.Count > 0) { if (front == null) { front = new csgjs_csgnode(); } front.build(list_front); } if (list_back.Count > 0) { if (back == null) { back = new csgjs_csgnode(); } back.build(list_back); } }
public csgjs_polygon( List<csgjs_vertex>list) { vertices = new List<csgjs_vertex>(list); plane = new csgjs_plane(vertices[0].pos, vertices[1].pos, vertices[2].pos); }
public csgjs_polygon() { vertices = new List<csgjs_vertex>(); plane = new csgjs_plane(); }
// Build a BSP tree out of `polygons`. When called on an existing tree, the // new polygons are filtered down to the bottom of the tree and become new // nodes there. Each set of polygons is partitioned using the first polygon // (no heuristic is used to pick a good split). void build( List<csgjs_polygon> list) { if (list.Count == 0) return; if (!plane.ok()) plane = list[0].plane; List<csgjs_polygon> list_front = new List<csgjs_polygon>(); List<csgjs_polygon> list_back = new List<csgjs_polygon>(); for (int i = 0; i < list.Count; i++) { plane.splitPolygon(list[i], polygons, polygons,ref list_front,ref list_back); } if (list_front.Count > 0) { if (front == null) front = new csgjs_csgnode(); front.build(list_front); } if (list_back.Count > 0) { if (back == null) back = new csgjs_csgnode(); back.build(list_back); } }
public csgjs_polygon(List <csgjs_vertex> list) { vertices = new List <csgjs_vertex>(list); plane = new csgjs_plane(vertices[0].pos, vertices[1].pos, vertices[2].pos); }
public csgjs_polygon() { vertices = new List <csgjs_vertex>(); plane = new csgjs_plane(); }