-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyNode.js
48 lines (40 loc) · 970 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
46
47
48
/**
* MyNode class, saving the node information of scenegraph
* @constructor
* @param {nodeID} 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 = [];
// Animation
this.animation = null;
}
/**
* Add descendants nodes
* @param {nodeID} node Descendant node
*/
addDescendants(node) {
this.descendants.push(node);
}
/**
* Add leaf nodes
* @param {CGFobject} leaf Leaf node
*/
addLeaf(leaf) {
this.leaves.push(leaf);
}
}