Constructor
new Node(nameopt)
A Node can represent something like a light, a mesh, a sprite, a camera or a text
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
string |
<optional> |
A string |
Extends
Methods
computeTransformationMatrix(parentMatrix, forceUpdate) → {boolean}
Update matrix
Parameters:
Name | Type | Description |
---|---|---|
parentMatrix |
?Array.<number> | mat4 | Parent transformable's matrix |
forceUpdate |
boolean | True to force an update |
- Inherited From:
True if the matrix have been updated, otherwise false
boolean
enable(value) → {Node}
Set node's state
Parameters:
Name | Type | Description |
---|---|---|
value |
boolean | True to enable, false to disable |
A reference to the instance
findChild(name) → (nullable) {Node}
Find the child with the given name
Parameters:
Name | Type | Description |
---|---|---|
name |
string | A string |
A Node instance of null
getNormalMatrix() → {Array.<number>|mat4}
Return computed normal matrix
- Inherited From:
A matrix
Array.<number>
|
mat4
getOrigin() → {Array.<number>|vec3}
Return the origin
- Inherited From:
A vector with the value for each axis
Array.<number>
|
vec3
getPosition() → {Array.<number>|vec3}
Return relative position
- Inherited From:
A vector with the value for each axis
Array.<number>
|
vec3
getRotation() → {Array.<number>}
Return the rotation in degrees
- Inherited From:
- To Do:
-
- Implement this function
A vector with the value for each axis in degrees
Array.<number>
getScale() → {Array.<number>|vec3}
Return the scale
- Inherited From:
A vector with the value for each axis
Array.<number>
|
vec3
getTransformationMatrix() → {Array.<number>|mat4}
Return computed matrix
- Inherited From:
A reference to the object's matrix
Array.<number>
|
mat4
isEnabled() → {boolean}
Get state
True if the node is enabled, otherwise false
boolean
isRoot() → {boolean}
Indicates if the current node is the scene's root
True if it's the root node, otherwise false
boolean
lookAt(position, up) → {Transformable}
Look at the given position
Parameters:
Name | Type | Description |
---|---|---|
position |
Array.<number> | Float32Array | Float64Array | An array with value for each axis |
up |
Array.<number> | Float32Array | Float64Array | An array with value for each axis |
- Inherited From:
A reference to the instance
removeChild(node) → {boolean}
Remove a child from the node
Parameters:
Name | Type | Description |
---|---|---|
node |
Node | A Node instance |
True if the operation is a success
boolean
setChildren(nodes)
Force add children without setting parent node, carefully use this one.
Parameters:
Name | Type | Description |
---|---|---|
nodes |
Array.<Node> | An array of nodes |
setName(name) → {Node}
Set the name to easily retrieve it later
Parameters:
Name | Type | Description |
---|---|---|
name |
string | A string |
A reference to the instance
setOrigin(x, ynullable, znullable) → {Transformable}
Set origin
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number | Array.<number> | Origin on X or an array with origin on each axis | |
y |
number |
<nullable> |
Origin on Y |
z |
number |
<nullable> |
Origin on Z |
- Inherited From:
A reference to the instance
setPosition(x, ynullable, znullable) → {Transformable}
Set position
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number | Array.<number> | Position on X or an array with position on each axis | |
y |
number |
<nullable> |
Position on Y |
z |
number |
<nullable> |
Position on Z |
- Inherited From:
A reference to the instance
setRotation(x, ynullable, znullable) → {Transformable}
Set rotation using values in degrees
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
number | Array.<number> | Rotation on X in degrees or an array with rotation on each axis | ||
y |
number |
<nullable> |
0 | Rotation on Y in degrees |
z |
number |
<nullable> |
0 | Rotation on Z in degrees |
- Inherited From:
A reference to the instance
setRotationFromMatrix(matrix) → {Transformable}
Set rotation from a rotation matrix
Parameters:
Name | Type | Description |
---|---|---|
matrix |
mat4 | A Matrix |
- Inherited From:
A reference to the instance
setRotationFromQuaternion(quaternion) → {Transformable}
Set rotation from a quaternion
Parameters:
Name | Type | Description |
---|---|---|
quaternion |
quat | A quaternion |
- Inherited From:
A reference to the instance
setScale(x, ynullable, znullable) → {Transformable}
Set scale
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number | Array.<number> | Scale on X or an array with scale on each axis | |
y |
number |
<nullable> |
Scale on Y |
z |
number |
<nullable> |
Scale on Z |
- Inherited From:
A reference to the instance
update(deltaTime, forceUpdatenullable) → {boolean}
Update the node and his children
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
deltaTime |
number | A floating value representing time elapsed between two frames | ||
forceUpdate |
boolean |
<nullable> |
false | Set to true to force an update |
True if the node has been updated
boolean
visit(renderTarget) → {boolean}
Visit the node and his children
Parameters:
Name | Type | Description |
---|---|---|
renderTarget |
RenderTarget | Renderer who called this method |
True if visiting was successful, otherwise false
boolean