public static AABBTree AABBTree(Model model, AABBNodeInfo tree_info)
        {
            List<TriangleVertexIndices> indices = new List<TriangleVertexIndices>();
              List<Vector3> points = new List<Vector3>();
              AABBFactory.ExtractData(model, points, indices, true);

              VertexPositionColor[] vertices = new VertexPositionColor[indices.Count * 3];

              List<float[]> triangles = new List<float[]>();

              int i = 0;
              foreach (TriangleVertexIndices index in indices)
              {
            vertices[i++] = new VertexPositionColor(points[index.I0], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I1], Color.White);
            vertices[i++] = new VertexPositionColor(points[index.I2], Color.White);

            float[] tri = new float[3];
            tri[0] = points[index.I0].X;
            tri[1] = points[index.I1].Y;
            tri[2] = points[index.I2].Z;
            triangles.Add(tri);
              }
              return new AABBTree(triangles, tree_info);
        }
示例#2
0
        public AABBNode(List<float[]> vertices, AABBNodeInfo tree_information, int depth)
        {
            _Marked = false; //doubly so!
            _tree_info = tree_information;
            _depth = depth;

            _BuildTree_PreserveTriangles(vertices);
        }
        public static AABBTree AABBTree(Model model)
        {
            AABBNodeInfo tree_info = new AABBNodeInfo();
              tree_info.leaf_min_verts = 6;
              tree_info.max_tree_depth = 4;

              return AABBTree(model, tree_info);
        }
示例#4
0
 public AABBTree(List<float[]> vertices, AABBNodeInfo tree_information)
 {
     root = new AABBNode(vertices, tree_information, 0);
 }