public void UpdateBVHSelection() { treeBVHNode.BeginUpdate(); treeBVHNode.Nodes.Clear(); if (treeBVH.SelectedNode == null) { return; } object tag = treeBVH.SelectedNode.Tag; if (tag is BVH <Primitive> bvhNode) { TreeNode root = Nodifier.CreateBVHInfo(bvhNode, null); root.Expand(); if (root.Nodes.ContainsKey("Object")) { root.Nodes["Object"].Expand(); } root.Nodes["Volume"].Expand(); treeBVHNode.Nodes.Add(root); treeBVHNode.SelectedNode = root; } treeBVHNode.EndUpdate(); }
private TreeNode CreateBVHNode(BVH <Primitive> bvhNode) { TreeNode node = Nodifier.CreateBVHNode(bvhNode); if (!bvhNode.IsLeaf) { node.Nodes.Add(new TreeNode("...") { Tag = BVHPlaceholder }); } return(node); }
public void UpdateBVH() { treeBVH.BeginUpdate(); treeBVH.Nodes.Clear(); if (_Scene.Accelerator != null) { TreeNode root = Nodifier.CreateBVHNode(_Scene.Accelerator, "Root"); ExpandBVHNode(root, true); root.Expand(); treeBVH.Nodes.Add(root); treeBVH.SelectedNode = root; } treeBVH.EndUpdate(); }
public void UpdateSceneSelection() { treePrimitive.BeginUpdate(); treePrimitive.Nodes.Clear(); if (treeScene.SelectedNode == null) { return; } object tag = treeScene.SelectedNode.Tag; if (tag is Primitive primitive) { TreeNode root = Nodifier.CreatePrimitive(primitive, "Primitive"); root.Expand(); treePrimitive.Nodes.Add(root); treePrimitive.SelectedNode = root; } treePrimitive.EndUpdate(); }
private void AddSceneSet() { const int batchSize = 1000; int count = treeScene.Nodes.Count; if (count == 0 || treeScene.Nodes[count - 1] == LoadMoreNode) { treeScene.BeginUpdate(); if (count > 0) { treeScene.Nodes.RemoveAt(count - 1); } int firstNew = treeScene.Nodes.Count; int countLeft = Objects.Count + Primitives.Count - firstNew; TreeNode[] nodes = new TreeNode[Math.Min(batchSize, countLeft)]; for (int i = 0; i < nodes.Length; i++) { int current = firstNew + i; if (current < Objects.Count) { IObject obj = Objects[current]; List <Primitive> children = ObjectPrimitives[obj]; TreeNode objectNode = Nodifier.Create($"Object {current} ({obj.Name}):"); objectNode.Tag = obj; objectNode.Expand(); foreach (Primitive child in children) { TreeNode childNode = Nodifier.Create($"#{child.ID} ({child.Name})"); childNode.Tag = child; objectNode.Nodes.Add(childNode); } nodes[i] = objectNode; } else { Primitive primitive = Primitives[current - Objects.Count]; TreeNode primitiveNode = Nodifier.Create($"#{primitive.ID} ({primitive.Name})"); primitiveNode.Tag = primitive; nodes[i] = primitiveNode; } } treeScene.Nodes.AddRange(nodes); if (countLeft > batchSize) { treeScene.Nodes.Add(LoadMoreNode); } treeScene.EndUpdate(); } }