private int InitScene(out List <Node> tree, out List <Triangle> datas, out List <PathTracerMaterial> materials) { Bounds bounds; var triangles = GetTrianglesInScene(out bounds); tree = null; datas = null; materials = new List <PathTracerMaterial>(); List <Triangle> tris = new List <Triangle>(); foreach (var t in triangles) { for (int i = 0; i < t.Value.Count; i++) { Triangle triangle = t.Value[i]; triangle.matid = materials.Count; tris.Add(triangle); } PathTracerMaterial mat = t.Key.GetMaterial(); materials.Add(mat); } return(LBVH.BuildBVH(tris, bounds, ref tree, ref datas)); }
private int InitScene(out List <Node> tree, out List <Triangle> datas) { Bounds bounds; var triangles = Utils.GetTrianglesInScene(true, out bounds); tree = null; datas = null; //return LKDTree.BuildKDTree(triangles, 0, 7, ref tree, ref datas); return(LBVH.BuildBVH(triangles, bounds, ref tree, ref datas)); }