v2.0.2
List of all members
CC3NodeArrayZOrderSequencer Class Reference

#import <CC3NodeSequencer.h>

Inheritance diagram for CC3NodeArrayZOrderSequencer:
Inheritance graph
[legend]

Additional Inherited Members

- Instance Methods inherited from CC3NodeArraySequencer
(BOOL) - shouldInsertNode:between:and:withVisitor:
 
- Class Methods inherited from CC3NodeSequencer
(id) + sequencer
 
(id) + sequencerWithEvaluator:
 
- Properties inherited from CC3NodeSequencer
BOOL allowSequenceUpdates
 
CC3NodeEvaluatorevaluator
 
NSArray * nodes
 
BOOL shouldUseOnlyForwardDistance
 

Detailed Description

An CC3NodeArrayZOrderSequencer is a type of CC3NodeArraySequencer that sorts the contained nodes by their Z-order, which is a combination of the explicit Z-order property of each node, and a measure of the distance from the camera to the globalCenterOfGravity of the node's bounding volume.

Use this sequencer for translucent nodes. There is no need to use this sequencer for nodes that are opaque (whose isOpaque property returns YES), and the overhead of testing each node on each update should be avoided in that case.

The nodes are sorted using the Z-order property and the cameraDistanceProduct property of the boundingVolume of each node, from furthest from the camera to closest. Nodes without a boundingVolume are added to the end of the array.

Explicit Z-order sequence takes priority over distance to camera. However, sorting based on distance to the camera alone is quite effective. In almost all cases, it is not necessary to set the Z-order property of the nodes, and if the nodes are moving around, assigning an explicit Z-order to each node can actually interfere with the dynamic determination of the correct drawing order. Only use the Z-order property if you have reason to force a specific node to be drawn before or after another node for visual effect.

The distance between a node and the camera can be measured in one of two ways:

  1. The true 3D straight-line distance between the node and the camera.
  2. The distance from the camera to the node measured "straight out" from the camera, ignoring how far the node is away from the center of the camera's view.

The value of the shouldUseOnlyForwardDistance property determines which of these two methods will be used. See the notes of that property in the CC3NodeSequencer for more information. By default, the true 3D distance is used.

Since all nodes, and the camera, can move around on each update, this sequencer will test and re-order its nodes on each update.

Be careful about setting the allowSequenceUpdates property to NO on this sequencer. Since this sequencer will generally only be used to keep translucent nodes in their correct drawing order, setting allowSequenceUpdates to NO will defeat the purpose, and will result in translucent nodes not properly displaying other translucent objects that are behind them.


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