#import <CC3NodeVisitor.h>
Instance Methods | |
(CC3TextureUnit *) | - currentTextureUnitAt: |
(NSString *) | - fullDescription |
(CC3Light *) | - lightAt: |
(CC3LightProbe *) | - lightProbeAt: |
(void) | - requestRemovalOf: |
(BOOL) | - visit: |
Class Methods | |
(id) | + visitor |
Properties | |
CC3Camera * | camera |
CC3Material * | currentMaterial |
CC3Mesh * | currentMesh |
CC3MeshNode * | currentMeshNode |
CC3Node * | currentNode |
CC3ShaderProgram * | currentShaderProgram |
CC3Camera * | defaultCamera |
GLuint | lightCount |
GLuint | lightProbeCount |
CC3PerformanceStatistics * | performanceStatistics |
CC3Scene * | scene |
BOOL | shouldVisitChildren |
CC3Node * | startingNode |
GLuint | textureCount |
A CC3NodeVisitor is a context object that is passed to a node when it is visited during a traversal of the node hierarchy.
To initiate a visitation run, invoke the visit: method on any CC3Node.
Subclasses will override template methods to customize the behaviour prior to, during, and after the node traversal.
If a node is to be removed from the node structural hierarchy during a visitation run, the requestRemovalOf: method can be used instead of directly invoking the remove method on the node itself. A visitation run involves iterating through collections of child nodes, and removing a node during the iteration of a collection raises an error.
- (CC3TextureUnit*) currentTextureUnitAt: | (GLuint) | texUnit |
Returns the texture unit at the specified index from the mesh node that is currently being visited, or returns nil if the material covering the node has no corresponding texture unit.
It is up to the invoker to make sure that the current node actually is a CC3MeshNode.
The value returned by this method is only valid during the traversal of the node returned by the currentMeshNode property, and will be nil both before and after the visit: method is invoked on that node.
- (NSString*) fullDescription |
Returns a more detailed description of this instance.
- (CC3Light*) lightAt: | (GLuint) | index |
Returns the light indicated by the index, or nil if the specified index is greater than the number of lights currently existing in the scene.
The specified index is an index into the lights array of the scene, and is not necessarily the same as the lightIndex property of the CC3Light.
- (CC3LightProbe*) lightProbeAt: | (GLuint) | index |
Returns the light probe indicated by the index, or nil if the specified index is greater than the number of light probes currently existing in the scene.
The specified index is an index into the lightProbes array of the scene.
- (void) requestRemovalOf: | (CC3Node *) | aNode |
Requests the removal of the specfied node.
During a visitation run, to remove a node from the hierarchy, you must use this method instead of directly invoking the remove method on the node itself. Visitation involves iterating through collections of child nodes, and removing a node during the iteration of a collection raises an error.
This method can safely be invoked while a node is being visited. The visitor keeps track of the requests, and safely removes all requested nodes as part of the close method, once the visitation of the full node assembly is finished.
- (BOOL) visit: | (CC3Node *) | aNode |
Visits the specified node, then if the shouldVisitChildren property is set to YES, invokes this visit: method on each child node as well.
Returns whether the visitation run was stopped once a desired result was accomplished. Depending on the type of visitation, this might occur if a particular node was reached, or some other desired result has been accomplished. The purpose of the returned value is not to indicate whether all node have been visited, or even that the visitation was aborted. Instead, you should think of the returned value as a way of indicating that a desired result has been accomplished, and that there is no need to visit further nodes. For visitations that normally visit all nodes, such as drawing, or updating, the return value will generally be NO.
Subclasses will override several template methods to customize node visitation behaviour.
+ (id) visitor |
Allocates and initializes an autoreleased instance.
|
readwritenonatomicretain |
The camera that is viewing the 3D scene.
If this property is not set in advance, it is lazily initialized to the value of the defaultCamera property when first accessed during a visitation run.
The value of this property is not cleared at the end of the visitation run.
|
readnonatomicassign |
Returns the material of the mesh node that is currently being visited, or returns nil if that mesh node has no material.
It is up to the invoker to make sure that the current node actually is a CC3MeshNode.
This property is only valid during the traversal of the node returned by the currentMeshNode property, and will be nil both before and after the visit: method is invoked on that node.
|
readnonatomicassign |
Returns the mesh of the mesh node that is currently being visited.
It is up to the invoker to make sure that the current node actually is a CC3MeshNode.
This property is only valid during the traversal of the node returned by this property, and will be nil both before and after the visit: method is invoked on the node.
|
readnonatomicassign |
Returns the mesh node that is currently being visited.
This is a convenience property that returns the value of the currentNode property, cast as a CC3MeshNode. It is up to the invoker to make sure that the current node actually is a CC3MeshNode.
This property is only valid during the traversal of the node returned by this property, and will be nil both before and after the visit: method is invoked on that node.
|
readnonatomicassign |
The CC3Node that is currently being visited.
This property is only valid during the traversal of the node returned by this property, and will be nil both before and after the visit: method is invoked on the node.
|
readnonatomicassign |
Under OpenGL ES 2.0 & OpenGL, returns the shader program of the mesh node that is currently being visited, or returns nil if that mesh node has no shader program, or when using OpenGL ES 1.1.
It is up to the invoker to make sure that the current node actually is a CC3MeshNode.
This property is only valid during the traversal of the node returned by the currentMeshNode property, and will be nil both before and after the visit: method is invoked on that node.
|
readnonatomicretain |
The default camera to use when visiting a node assembly.
This implementation returns the activeCamera property of the starting node. Subclasses may override.
|
readnonatomicassign |
Number of lights in the scene.
|
readnonatomicassign |
Min of number of light probes in the scene, and the number used by the shader program.
|
readnonatomicassign |
The performanceStatistics being accumulated during the visitation runs.
This is extracted from the startingNode, and may be nil if that node is not collecting statistics.
|
readnonatomicassign |
Returns the CC3Scene.
This is a convenience property that returns the scene property of the startingNode property.
|
readwritenonatomicassign |
Indicates whether this visitor should traverse the child nodes of any node it visits.
The initial value of this property is YES.
|
readnonatomicassign |
The CC3Node on which this visitation traversal was intitiated.
This is the node on which the visit: method was first invoked to begin a traversal of the node structural hierarchy.
This property is only valid during the traversal, and will be nil both before and after the visit: method is invoked.
|
readnonatomicassign |
Returns the number of textures in the current mesh node.
It is up to the invoker to make sure that the current node actually is a CC3MeshNode.