![]() |
KudanAR - iOS
|
#import <ARNode.h>
Inheritance diagram for ARNode:
Collaboration diagram for ARNode:Instance Methods | |
| (void) | - addChild: |
| (void) | - addChildren: |
| (void) | - removeChild: |
| (void) | - removeAllChildren |
| (void) | - remove |
| (ARNode *) | - findChildWithName: |
| (void) | - markWorldTransformAsDirty |
| (void) | - translateByX:y:z: |
| (void) | - translateByX:y:z:transformSpace: |
| (void) | - translateByVector: |
| (void) | - translateByVector:transformSpace: |
| (void) | - scaleByUniform: |
| (void) | - scaleByX:y:z: |
| (void) | - scaleByVector: |
| (void) | - rotateByDegrees:axisX:y:z: |
| (void) | - rotateByRadians:axisX:y:z: |
| (void) | - rotateByQuaternion: |
| (ARVector3 *) | - positionToWorld: |
| (ARVector3 *) | - positionToEye: |
| (ARQuaternion *) | - orientationToWorld: |
| (ARQuaternion *) | - orientationToEye: |
| (CGPoint) | - viewPortFromNodePosition: |
| (void) | - render |
| (void) | - preRender |
| (void) | - postRender |
| (void) | - addTouchTarget:withAction: |
| (void) | - didReceiveTouch |
| (ARVector3 *) | - nodeFromViewPort: |
Class Methods | |
| (instancetype) | + nodeWithName: |
Protected Member Functions | |
| (typedef) | - NS_ENUM |
Properties | |
| NSString * | name |
| ARNode * | parent |
| NSArray< ARNode * > * | children |
| NSArray * | descendants |
| ARVector3 * | position |
| ARVector3 * | scale |
| ARQuaternion * | orientation |
| ARMatrix4 * | localTransform |
| ARMatrix4 * | worldTransform |
| ARMatrix4 * | fullTransform |
| ARQuaternion * | fullOrientation |
| ARQuaternion * | worldOrientation |
| ARVector3 * | worldScale |
| ARVector3 * | worldPosition |
| ARVector3 * | fullPosition |
| ARNode * | world |
| NSUInteger | childCount |
| BOOL | visible |
An ARNode represents the base object of the scene-graph. It is responsible for the spatial layout of content, and is the node type from which all other nodes derive.
| - (void) addChild: | (ARNode *) | child |
Adds a node as a child of this node. Any transformations applied to a node also apply to all its children.
Example of use:
| child | The node to be added. |
| - (void) addChildren: | (NSArray *) | children |
Add a list of nodes as children of this node.
Example of use:
| children | The array of nodes to be added. |
| - (void) addTouchTarget: | (id) | target | |
| withAction: | (SEL) | action | |
Add an action that is triggered whenever this node or one of its children is touched.
Example of use:
| target | The object to receive the event. |
| action | The method to call on the object. |
| - (void) didReceiveTouch |
Method called whenever this node or one of its children is touched. This shouldn't be altered, instead simply create a new selector to run your code when the event fires.
| - (ARNode *) findChildWithName: | (NSString *) | name |
Find a child of this node with the given name. If there are multiple child nodes with the same name, they cannot be found using this method, as it will always return the first one. In order to be able to find all child nodes, they must all have unique names.
Example of use:
| name | The name of the node to search for. |
| - (ARVector3 *) nodeFromViewPort: | (CGPoint) | point |
Unproject a 2D position in the ARViewPort to this nodes coordinate space.
Example of use:
| point | The 2D position in the viewport. |
| + (instancetype) nodeWithName: | (NSString *) | name |
| - (typedef) NS_ENUM | (NSInteger) | ||
| (TransformSpace) | |||
Different transformation spaces that the various transformation methods can act in.
Transform is applied relative to the existing local transform. Translations take the local rotation into account. If, for example, an object rotated at 45 degrees were translated to move up in its own local space, it would move diagonally relative to the camera, following the trajectory of the rotation.
Transform is applied relative to the parent's transform. Translations are unaffected by the local scale and rotation. If, for example, an object rotated at 45 degrees were translated to move up in its parent space, it would move upwards relative to the camera.
Transform is applied relative to the node's closest ARWorld grandparent. This is useful for moving around in world space. If, for example, an object and its child were both rotated 45 degrees, and they were translated both translated upwards in world space, both objects would move upwards relative to the camera.
Convert an ARVector3 position from this node's local space to eye/camera space.
Example of use:
| position | The position in this node's local space as a vector. |
Convert an ARVector3 position from this node's local space to the nearest world space.
Example of use:
| position | The position in this node's local space as a vector. |
| - (void) postRender |
Method called just after this node has been rendered.
| - (void) preRender |
Method called just before this node is rendered.
| - (void) remove |
Remove this node from its parent node.
Example of use:
| - (void) removeAllChildren |
| - (void) removeChild: | (ARNode *) | child |
Remove a node from this node's children.
Example of use:
| child | The node to be removed. |
| - (void) render |
Method called when this node is being rendered.
| - (void) rotateByDegrees: | (float) | angle | |
| axisX: | (float) | x | |
| y: | (float) | y | |
| z: | (float) | z | |
Rotate this node by the given number of degrees around each noted axis.
Example of use:
| angle | The angle, in degrees, to rotate by. |
| x | Whether or not to rotate about this node's X axis. 0 for no, 1 for yes. |
| y | Whether or not to rotate about this node's Y axis. 0 for no, 1 for yes. |
| z | Whether or not to rotate about this node's Z axis. 0 for no, 1 for yes. |
| - (void) rotateByQuaternion: | (ARQuaternion *) | rotation |
Multiply this node's orientation by a quaternion. For simple rotations, using rotateByDegrees is recommended instead.
Example of use:
| rotation | The quaternion to rotate this node by. |
| - (void) rotateByRadians: | (float) | angle | |
| axisX: | (float) | x | |
| y: | (float) | y | |
| z: | (float) | z | |
Rotate this node by the given number of radians around each noted axis.
Example of use:
| angle | The angle, in radians, to rotate by. |
| x | Whether or not to rotate about this node's X axis. 0 for no, 1 for yes. |
| y | Whether or not to rotate about this node's Y axis. 0 for no, 1 for yes. |
| z | Whether or not to rotate about this node's Z axis. 0 for no, 1 for yes. |
| - (void) scaleByUniform: | (float) | scale |
Scales the node uniformly across each axis. This does not set the scale, but rather adds to the existing scales by the given amount. For example, if you scale a node by 2, then by 4, its overall scale will be 8 times bigger. Likewise, if you scale by 0.5, then by 0.5 again, the overall scale will be 0.25 times bigger, or 4 times smaller. Scaling occurs in the node's local space.
Example of use:
| scale | The amount to scale by. |
| - (void) scaleByVector: | (ARVector3 *) | scale |
Scale this node separately along each axis using values taken from a vector. Scale can be non-uniform. Scaling occurs in the node's local space.
Example of use:
| scale | A vector containing the x, y and z scale factors. |
| - (void) scaleByX: | (float) | x | |
| y: | (float) | y | |
| z: | (float) | z | |
| - (void) translateByVector: | (ARVector3 *) | translation |
Translate the position of this node by the given vector in local space.
Example of use:
| translation | A vector containing the x, y and z units to translate by. |
| - (void) translateByVector: | (ARVector3 *) | translation | |
| transformSpace: | (TransformSpace) | transformSpace | |
Translate the position of this node by the given vector, relative to the given transform space.
Example of use:
| translation | A vector containing the x, y and z units to translate by. |
| transformSpace | the specified TransformSpace determines the coordinate system of the units. |
| - (void) translateByX: | (float) | x | |
| y: | (float) | y | |
| z: | (float) | z | |
Translate the position of this node by a number of units in each axis in local space.
Example of use:
| x | units to translate along the x-axis. |
| y | units to translate along the y-axis. |
| z | units to translate along the z-axis. |
| - (void) translateByX: | (float) | x | |
| y: | (float) | y | |
| z: | (float) | z | |
| transformSpace: | (TransformSpace) | transformSpace | |
Translate the position of this node by a number of units in each axis, relative to the given transform space.
Example of use:
| x | Units to translate along the x-axis. |
| y | Units to translate along the y-axis. |
| z | Units to translate along the z-axis. |
| transformSpace | The specified TransformSpace determines the coordinate system of the units. Local space to translate the node relative to its own transform. Parent space to translate the node relative to its parent's transform. World space to translate the node relative to the nearest ARWorld's transform. |
| - (CGPoint) viewPortFromNodePosition: | (ARVector3 *) | position |
Project a point in this node's coordinate space to its position in the ARViewPort this node is attached to.
Example of use:
| position | The 3D position in this node's coordinate space to project. |
|
readnonatomicassign |
The number of direct children this node has. This is the number of elements in the children array.
|
readnonatomicassign |
Array containing all direct child nodes of this node. This returns only nodes added to this node as children. Any nodes added to those nodes will not be listed here.
|
readnonatomicassign |
Array containing all child nodes of this node. This returns nodes added to this node and any nodes added to them, and so on, checking the entire graph. If this is the root node of the graph, this will return all nodes in the graph.
|
readnonatomicassign |
The full orientation of this node in eye space.
|
readnonatomicassign |
The full orientation of this node in eye space.
|
readnonatomicassign |
The full transformation of this node in eye space.
|
readnonatomicassign |
The combination of the local position, scale and orientation of this node.
|
readwritenonatomicassign |
The name of this node. The name should be unique so that the tracker can find it when using findChildByName.
|
readwritenonatomicassign |
This node's orientation relative to its parent in the form (X, Y, Z, W).
|
readwritenonatomicweak |
This node's parent node. If it's parent is a root node, this returns nil.
|
readwritenonatomicassign |
This node's position relative to its parent in the form (X, Y, Z).
|
readwritenonatomicassign |
This node's scale relative to its parent in the form (X, Y, Z).
|
readwritenonatomicassign |
Whether or not this node and all its children should be drawn. If NO, this node and all of its child nodes will not render, even if the child's visibility is set to YES. Default is YES.
|
readnonatomicassign |
The orientation of this node in the space of the nearest ARWorld this node descends from.
|
readnonatomicassign |
The position of this node in the space of the nearest ARWorld this node descends from.
|
readnonatomicassign |
The scale of this node in the space of the nearest ARWorld this node descends from.
|
readnonatomicassign |
The transformation of the nearest ARWorld that this node descends from.