-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyNode.js
45 lines (38 loc) · 887 Bytes
/
MyNode.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* MyNode class, saving the node information of scenegraph
* @constructor
* @param root - Reference to root node
*/
class MyNode {
constructor(root) {
// Origin Node
this.rootID = root;
// Transformation
this.transformation = mat4.create();
mat4.identity(this.transformation);
// Texture
this.texture = null;
// Material
this.material = null;
// Amplification
this.afs = 1.0;
this.aft = 1.0;
// All descendants nodes and leaves
this.descendants = [];
this.leaves = [];
}
/**
* Add descendants nodes
* @param node Descendant node
*/
addDescendants(node) {
this.descendants.push(node);
}
/**
* Add leaf nodes
* @param leaf Leaf node
*/
addLeaf(leaf) {
this.leaves.push(leaf);
}
}