コード例 #1
0
 public csgjs_plane clone() 
 {
     csgjs_plane c = new csgjs_plane();
     c.normal = normal.clone();
     c.w = w;
     return c;
 }
コード例 #2
0
 public csgjs_csgnode()
 {
     front    = null;
     back     = null;
     plane    = new csgjs_plane();
     polygons = new List <csgjs_polygon>();
 }
コード例 #3
0
 public csgjs_csgnode()
 {
     front = null;
     back = null;
     plane = new csgjs_plane();
     polygons = new List<csgjs_polygon>();
 }
コード例 #4
0
        public csgjs_plane clone()
        {
            csgjs_plane c = new csgjs_plane();

            c.normal = normal.clone();
            c.w      = w;
            return(c);
        }
コード例 #5
0
        // 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);
            }
        }
コード例 #6
0
 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);
 }
コード例 #7
0
 public csgjs_polygon()
 {
     vertices = new List<csgjs_vertex>();
     plane = new csgjs_plane();
 }
コード例 #8
0
        // 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);
	        }
        }
コード例 #9
0
 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);
 }
コード例 #10
0
 public csgjs_polygon()
 {
     vertices = new List <csgjs_vertex>();
     plane    = new csgjs_plane();
 }