瀏覽代碼

Node dispose disposes all children as well

Christian Wolfgang 5 年之前
父節點
當前提交
e55b0cc7a8
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      core/node.go

+ 5 - 1
core/node.go

@@ -132,7 +132,11 @@ func (n *Node) BoundingBox() math32.Box3 {
 func (n *Node) Render(gs *gls.GLS) {}
 func (n *Node) Render(gs *gls.GLS) {}
 
 
 // Dispose satisfies the INode interface.
 // Dispose satisfies the INode interface.
-func (n *Node) Dispose() {}
+func (n *Node) Dispose() {
+	for _, child := range n.children {
+		child.Dispose()
+	}
+}
 
 
 // Clone clones the Node and satisfies the INode interface.
 // Clone clones the Node and satisfies the INode interface.
 func (n *Node) Clone() INode {
 func (n *Node) Clone() INode {