Add enumerate function for node.
This commit is contained in:
parent
bb9724578d
commit
ccfe303f93
@ -46,6 +46,14 @@ OV.Node = class
|
||||
return this.meshIndices;
|
||||
}
|
||||
|
||||
Enumerate (processor)
|
||||
{
|
||||
processor (this);
|
||||
for (const childNode of this.childNodes) {
|
||||
childNode.Enumerate (processor);
|
||||
}
|
||||
}
|
||||
|
||||
EnumerateChildren (processor)
|
||||
{
|
||||
for (const childNode of this.childNodes) {
|
||||
|
||||
@ -51,11 +51,16 @@ describe ('Node', function() {
|
||||
child1.AddChildNode (child12);
|
||||
|
||||
let enumerated = [];
|
||||
node.EnumerateChildren ((child) => {
|
||||
node.Enumerate ((child) => {
|
||||
enumerated.push (child);
|
||||
});
|
||||
assert.deepStrictEqual (enumerated, [node, child1, child11, child12, child2]);
|
||||
|
||||
assert.deepStrictEqual (enumerated, [child1, child11, child12, child2]);
|
||||
let enumeratedChildren = [];
|
||||
node.EnumerateChildren ((child) => {
|
||||
enumeratedChildren.push (child);
|
||||
});
|
||||
assert.deepStrictEqual (enumeratedChildren, [child1, child11, child12, child2]);
|
||||
});
|
||||
|
||||
it ('Recursive Mesh Index Enumeration', function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user