cocos3d  2.0.0
Instance Methods | Properties | List of all members
CC3NodeTransformingVisitor Class Reference

#import <CC3NodeVisitor.h>

Inheritance diagram for CC3NodeTransformingVisitor:
Inheritance graph
[legend]

Instance Methods

(CC3Matrix *) - parentTansformMatrixFor:
 
- Instance Methods inherited from CC3NodeVisitor
(CC3TextureUnit *) - currentTextureUnitAt:
 
(NSString *) - fullDescription
 
(CC3Light *) - lightAt:
 
(void) - requestRemovalOf:
 
(BOOL) - visit:
 

Properties

BOOL isTransformDirty
 
BOOL shouldLocalizeToStartingNode
 
BOOL shouldRestoreTransforms
 
- Properties inherited from CC3NodeVisitor
CC3Cameracamera
 
CC3MaterialcurrentMaterial
 
CC3MeshcurrentMesh
 
CC3MeshNodecurrentMeshNode
 
CC3NodecurrentNode
 
CC3ShaderProgramcurrentShaderProgram
 
CC3CameradefaultCamera
 
NSUInteger lightCount
 
CC3PerformanceStatisticsperformanceStatistics
 
CC3Scenescene
 
BOOL shouldVisitChildren
 
CC3NodestartingNode
 
GLuint textureCount
 

Additional Inherited Members

- Class Methods inherited from CC3NodeVisitor
(id) + visitor
 

Detailed Description

CC3NodeTransformingVisitor is a CC3NodeVisitor that is passed to a node when it is visited during transformation operations.

This visitor encapsulates whether the transformation matrix needs to be recalculated. The transformation matrix needs to be recalculated if any of the node's transform properties (location, rotation, scale) have changed, or if those of an ancestor node were changed.

The transforms can be calculated from the CC3Scene or from the startingNode, depending on the value of the shouldLocalizeToStartingNode property. Normally, the transforms are calculated from the CC3Scene, but localizing to the startingNode can be useful for determining relative transforms between ancestors and descendants.

Method Documentation

- (CC3Matrix*) parentTansformMatrixFor: (CC3Node *)  aNode

Returns the transform matrix to use as the parent matrix when transforming the specified node.

This usually returns the value of the parentGlobalTransformMatrix of the specified node. However, if the shouldLocalizeToStartingNode property is set to YES and the startingNode is either the specified node or its parent, this method returns nil.

Property Documentation

- (BOOL) isTransformDirty
readnonatomicassign

Returns whether the transform matrix of the node currently being visited is dirty and needs to be recalculated.

The value of this property is consistent throughout the processing of a particular node. It is set before each node is visited, and is not changed until after the node has finished being processed, even if the node's transform matrix is recalculated during processing. This allows any post-node-processing activities, either within the visitor or within the node, to know that the transform matrix was changed.

- (BOOL) shouldLocalizeToStartingNode
readwritenonatomicassign

Indicates whether all transforms should be localized to the local coordinate system of the startingNode.

If this property is set to NO, the transforms of all ancestors of each node, all the way to CC3Scene, will be included when calculating the globalTransformMatrix and global properties of that node. This is the normal situation.

If this property is set to YES the transforms of the startingNode and its ancestors, right up to the CC3Scene, will be ignored. The result is that the globalTransformMatrix and all global properties (globalLocation, etc) will be relative to the startingNode.

This can be useful when you want to coordinate node positioning within a particular common ancestor, by using their global properties relative to that common ancestor node.

It is also used when determine the boundingBox property of a node, by transforming all descendant nodes by all transforms between the node and each descendant, but ignoring the transforms of the ancestor nodes of the node whose local bounding box is being calculated.

Setting this property to YES will force the recalculation of the globalTransformMatrix of each node visited, to ensure that they are relative to the startingNode. Further, once the visitation run is complete, if this property is set to YES, the close method will rebuild the transformMatrices of the startingNode and its descendants, to leave the transformMatrices in their normal global form.

The initial value of this property is NO.

- (BOOL) shouldRestoreTransforms
readwritenonatomicassign

This property only has effect when the shouldLocalizeToStartingNode property is set to YES.

Indicates whether the full global transforms should be restored afte the localized transforms have been calculated and consumed. Setting this to YES is useful when the localized transform is being temporarily calculated for a specialized purpose such as determining a local bounding box, but then the full global transform should be immediately restored for further use.

The initial value of this property is NO. However, specialized subclasses may set to YES initially as appropriate.


The documentation for this class was generated from the following file: