Class ARNode
java.lang.Object
com.codename1.ar.ARNode
A node in the small scene graph rendered at an ARAnchor. A node carries
an optional ARModel plus a local transform relative to its parent (or to
the anchor for the root node), and may hold child nodes.
Attach a root node to an anchor with ARAnchor#setNode(ARNode). After
attachment, transform and visibility changes are forwarded to the platform
renderer automatically. Mutate nodes on the EDT.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child node.getChildAt(int index) The child node at the supplied index.intThe number of child nodes.floatThe W component of the local rotation quaternion.floatThe X component of the local rotation quaternion.floatThe Y component of the local rotation quaternion.floatThe Z component of the local rotation quaternion.floatThe uniform local scale factor.floatThe local X position in meters.floatThe local Y position in meters.floatThe local Z position in meters.getModel()The model rendered at this node, or null for a grouping node.The parent node, or null for a root node.booleanTrue when this node (and therefore its children) is rendered.voidremoveChild(ARNode child) Removes a child node.setLocalPosition(float x, float y, float z) Sets the node position relative to its parent (or the anchor for a root node), in meters.setLocalRotation(float qx, float qy, float qz, float qw) Sets the node rotation relative to its parent as a quaternion.setLocalScale(float scale) Sets a uniform scale factor relative to the parent.setVisible(boolean visible) Shows or hides this node and its children.
-
Constructor Details
-
ARNode
public ARNode()Creates an empty grouping node with no geometry of its own. -
ARNode
Creates a node rendering the supplied model.
Parameters
model: the content to render at this node
-
-
Method Details
-
getModel
The model rendered at this node, or null for a grouping node. -
setLocalPosition
Sets the node position relative to its parent (or the anchor for a root node), in meters. -
setLocalRotation
Sets the node rotation relative to its parent as a quaternion. -
setLocalScale
Sets a uniform scale factor relative to the parent. Default1. -
setVisible
Shows or hides this node and its children. Default visible. -
getLocalX
public float getLocalX()The local X position in meters. -
getLocalY
public float getLocalY()The local Y position in meters. -
getLocalZ
public float getLocalZ()The local Z position in meters. -
getLocalQx
public float getLocalQx()The X component of the local rotation quaternion. -
getLocalQy
public float getLocalQy()The Y component of the local rotation quaternion. -
getLocalQz
public float getLocalQz()The Z component of the local rotation quaternion. -
getLocalQw
public float getLocalQw()The W component of the local rotation quaternion. -
getLocalScale
public float getLocalScale()The uniform local scale factor. -
isVisible
public boolean isVisible()True when this node (and therefore its children) is rendered. -
addChild
Adds a child node. A node may have at most one parent.
Parameters
child: the node to add below this one
-
removeChild
Removes a child node. No-op when the node is not a child of this one.
Parameters
child: the node to remove
-
getChildCount
public int getChildCount()The number of child nodes. -
getChildAt
The child node at the supplied index. -
getParent
The parent node, or null for a root node.
-