Package gaiasky.scene.component
Class GraphNode
java.lang.Object
gaiasky.scene.component.GraphNode
- All Implemented Interfaces:
com.badlogic.ashley.core.Component
,ICopy
-
Field Summary
Modifier and TypeFieldDescriptioncom.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity>
List of children entities.com.badlogic.gdx.math.Matrix4
Local transform matrix.Functions.Function3<GraphUpdater,
com.badlogic.ashley.core.Entity, GraphNode, Boolean> Reference to the function that returns whether this object must be updated.int
The total number of descendants under this node.This transform stores only the orientation of the object.com.badlogic.ashley.core.Entity
The parent entity.The first name of the parent object.Consumers.Consumer3<GraphUpdater,
com.badlogic.ashley.core.Entity, GraphNode> Reference to the method to update the position of this object.Cumulative translation object. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
addChild
(com.badlogic.ashley.core.Entity me, com.badlogic.ashley.core.Entity child, boolean updateAncestorCount, int numChildren) Adds a child to the given node and updates the number of children in this entity and in all ancestors.com.badlogic.ashley.core.Entity
getChildByName
(String name) com.badlogic.ashley.core.Component
getCopy
(com.badlogic.ashley.core.Engine engine) com.badlogic.ashley.core.Entity
getRoot
(com.badlogic.ashley.core.Entity me) int
void
initChildren
(int size) final void
removeChild
(com.badlogic.ashley.core.Entity child, boolean updateAncestorCount) Removes the given child from this node, if it exists.void
Sets the name of the parent.
-
Field Details
-
positionUpdaterConsumer
public Consumers.Consumer3<GraphUpdater,com.badlogic.ashley.core.Entity, positionUpdaterConsumerGraphNode> Reference to the method to update the position of this object. -
mustUpdateFunction
public Functions.Function3<GraphUpdater,com.badlogic.ashley.core.Entity, mustUpdateFunctionGraphNode, Boolean> Reference to the function that returns whether this object must be updated. -
parentName
The first name of the parent object. -
parent
public com.badlogic.ashley.core.Entity parentThe parent entity. -
children
public com.badlogic.gdx.utils.Array<com.badlogic.ashley.core.Entity> childrenList of children entities. -
translation
Cumulative translation object. In contrast with the position, which contains the position relative to the parent, this contains the absolute position in the internal reference system. -
localTransform
public com.badlogic.gdx.math.Matrix4 localTransformLocal transform matrix. Contains the transform matrix and the transformations that will be applied to this object and not to its children. -
orientation
This transform stores only the orientation of the object. For example in planets, it stores their orientation with respect to their equatorial plane, but not other transformations applied to the object such as the size or the rotation angle at the time. -
numChildren
public int numChildrenThe total number of descendants under this node.
-
-
Constructor Details
-
GraphNode
public GraphNode()
-
-
Method Details
-
setParent
Sets the name of the parent.- Parameters:
parentName
- The parent name.
-
getSceneGraphDepth
public int getSceneGraphDepth() -
initChildren
public void initChildren(int size) -
addChild
public final void addChild(com.badlogic.ashley.core.Entity me, com.badlogic.ashley.core.Entity child, boolean updateAncestorCount, int numChildren) Adds a child to the given node and updates the number of children in this entity and in all ancestors.- Parameters:
me
- The current entity that owns this graph node.child
- The child entity to add.updateAncestorCount
- Whether to update the ancestors number of children.numChildren
- The number of children this will hold.
-
removeChild
public final void removeChild(com.badlogic.ashley.core.Entity child, boolean updateAncestorCount) Removes the given child from this node, if it exists.- Parameters:
child
- The child node to remove.updateAncestorCount
- Whether to update the ancestors number of children.
-
getRoot
public com.badlogic.ashley.core.Entity getRoot(com.badlogic.ashley.core.Entity me) -
getCopy
public com.badlogic.ashley.core.Component getCopy(com.badlogic.ashley.core.Engine engine) -
getChildByName
-