-
Notifications
You must be signed in to change notification settings - Fork 7
Transform nodes
Transform nodes contains spatial data to define object position, orientation and etc in space.
Each such node must implement ITransformNode interface.
Default transform node in Thelema is Node. It contains TRS data: position (translation), rotation and scale. These data is used to build worldMatrix
(also known as model matrix). worldMatrix
matrix is global and can be passed to shader.
Transform node can have children. Child node contains local transform data and, when updated, will compute the global world matrix by applying parent's matrix to its local data.
After changing data of node, you have to call updateTransform()
to update matrix. You can specify parameter recursive
as true, to update whole children tree.
Some transform node implementations may not have full TRS data. For example it may contain only position, and world matrix will be build with default rotation (0, 0, 0, 1) and scale (1, 1, 1).
You can create custom transform node class that must implement ITransformNode
and you can there define transform data that you want.
If you referencing to node, it is recommended to use ITransformNode
as type in class properties or method parameters.
val root = Node()
root.scale.set(0.5f, 0f, 0f)
val child = Node()
child.position.set(5f, 0f, 0f)
root.addChildNode(child)
root.updateTransform(recursive = true)
println(child.worldMatrix)
-
Quick Start
-
3D graphics
-
Math