public class SceneNode
extends java.lang.Object
Constructor and Description |
---|
SceneNode()
Creates a SceneNode with default position (0,0,0)
|
SceneNode(Vector3 pos)
Creates a SceneNode at the passed position
|
Modifier and Type | Method and Description |
---|---|
void |
attachChild(SceneNode node)
Attaches a SceneNode as a child to this SceneNode
|
void |
attachSceneObject(SceneObject object)
Attaches a passed SceneObject to this SceneNode
|
SceneNode |
createChild()
Create a new child scene node at the parents origin
|
SceneNode |
createChild(Vector3 pos)
Create a new child scene node
|
void |
detach()
Detaches this node
|
void |
detachChild(SceneNode node)
Detaches a SceneNode
|
void |
detachSceneObject(SceneObject object)
Detaches a passed SceneObject from this SceneNode
|
void |
forceUpdate()
Force this node to update
|
Vector3 |
getAbsolutePos()
Gets the absolute position of this SceneNode
Currently iterates through all parent nodes, therefore expensive.
|
Quaternion |
getAbsoluteRot()
Gets the absolute rotation of this node in world space
|
Vector3 |
getAbsoluteScale()
Gets the absolute scaling of this SceneNode
Currently iterates through all parent nodes, therefore expensive.
|
Vector3 |
getCachedAbsolutePos()
Gives last calculated absolute world position of this node.
|
Quaternion |
getCachedAbsoluteRot()
Get the cashed absolute rotation of this node in world space
May be invalid.
|
Vector3 |
getCachedAbsoluteScale()
Gives last calculated absolute world scaling of this node.
|
int |
getCountAttachedObjects()
Get the total number of attached objects
|
int |
getCountChildren()
Gets the total number of child nodes
|
float[] |
getModelMatrix()
Get the model matrix for all children
|
SceneNode |
getParent()
Get the parent scene node
|
Vector3 |
getRelativePos()
Gets the position of this SceneNode relative to its parent
|
Quaternion |
getRelativeRot()
Gets the rotation of this node relative to its parent
|
Vector3 |
getRelativeScale()
Gets the scaling of this SceneNode relative to its parent
|
void |
rotate(Quaternion rotation)
Rotates this node by the passed rotation
|
void |
scale(Vector3 scale)
Scales this node by the passed scaling
|
void |
setAbsolutePos(Vector3 pos)
Sets the relative pos, so that the resulting
absolute pos will match with the desired position
|
void |
setAbsoluteRot(Quaternion rotation)
Sets the relative rotation of this node so that it will have
the passed absolute rotation of world space
|
void |
setAbsoluteScale(Vector3 scale)
Sets the relative scaling, so that the resulting
absolute scaling will match with the desired position
|
void |
setDirty() |
void |
setRelativePos(Vector3 pos)
Set the relative position
|
void |
setRelativeRot(Quaternion rotation)
Set the relative rotation of this node
|
void |
setRelativeScale(Vector3 scale)
Set the relative scaling
|
void |
translate(Vector3 translation)
Translate this node by a vector3
|
void |
update()
Root update
|
void |
update(Vector3 parentPos,
Quaternion parentRot,
Vector3 parentScale,
float[] parentTransform)
Updates the model matrix
|
void |
updateAll(Vector3 parentPos,
Quaternion parentRot,
Vector3 parentScale,
float[] parentTransform)
Updates the model matrix.
|
public SceneNode()
public SceneNode(Vector3 pos)
pos
- public void forceUpdate()
public void setDirty()
public Vector3 getAbsolutePos()
public Vector3 getCachedAbsolutePos()
public void setAbsolutePos(Vector3 pos)
pos
- The absolute world positionpublic Vector3 getRelativePos()
public void setRelativePos(Vector3 pos)
pos
- The new position relative to the parentpublic Quaternion getAbsoluteRot()
public Quaternion getCachedAbsoluteRot()
public void setAbsoluteRot(Quaternion rotation)
quaternion
- The rotation in world spacepublic void setRelativeRot(Quaternion rotation)
rotation
- The rotation relative to its parent this node will havepublic Quaternion getRelativeRot()
public Vector3 getAbsoluteScale()
public Vector3 getCachedAbsoluteScale()
public void setAbsoluteScale(Vector3 scale)
scale
- The absolute world scalingpublic Vector3 getRelativeScale()
public void setRelativeScale(Vector3 scale)
scale
- The new scale relative to the parentpublic void attachSceneObject(SceneObject object)
object
- The SceneObject to be attachedpublic void detachSceneObject(SceneObject object)
object
- The SceneObject to be detachedpublic int getCountAttachedObjects()
public void attachChild(SceneNode node)
node
- The node to be attachedpublic void detachChild(SceneNode node)
node
- The node to be detachedpublic int getCountChildren()
public void detach()
public SceneNode getParent()
public SceneNode createChild(Vector3 pos)
pos
- The position of the child scene node relative to this nodepublic SceneNode createChild()
public void update(Vector3 parentPos, Quaternion parentRot, Vector3 parentScale, float[] parentTransform)
public void update()
public void updateAll(Vector3 parentPos, Quaternion parentRot, Vector3 parentScale, float[] parentTransform)
public float[] getModelMatrix()
public void translate(Vector3 translation)
translation
- The vector3 by which this node will be translatedpublic void rotate(Quaternion rotation)
rotation
- The rotation which will be applied to this nodepublic void scale(Vector3 scale)
scale
- The scaling which will be applied to this node