Public Member Functions | Static Public Member Functions | Protected Attributes | Properties

CC3LocalContentNode Class Reference

CC3LocalContentNode is an abstract class that forms the basis for nodes that have local content to draw. More...

#import <CC3Node.h>

Inheritance diagram for CC3LocalContentNode:
Inheritance graph
[legend]
Collaboration diagram for CC3LocalContentNode:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(void) - checkDrawingOrder

Static Public Member Functions

(ccColor4F) + localContentWireframeBoxColor
(void) + setLocalContentWireframeBoxColor:

Protected Attributes

GLint zOrder

Properties

CC3BoundingBox globalLocalContentBoundingBox
CC3BoundingBox localContentBoundingBox
CC3WireframeBoundingBoxNodelocalContentWireframeBoxNode
BOOL shouldDrawLocalContentWireframeBox

Detailed Description

CC3LocalContentNode is an abstract class that forms the basis for nodes that have local content to draw.

You can cause a wireframe box to be drawn around the local content of the node by setting the shouldDrawLocalContentWireframeBox property to YES. This can be particularly useful during development to locate the boundaries of a node, or to locate a node that is not drawing properly. You can set the default color of this wireframe using the class-side defaultLocalContentWireframeBoxColor property.


Member Function Documentation

- (void) checkDrawingOrder

Checks that this node is in the correct drawing order relative to other nodes.

This implementation forwards this notification up the ancestor chain to the CC3World, which checks if the node is correctly positioned in the drawing sequence, and repositions the node if needed.

By default, nodes are automatically repositioned on each drawing frame to optimize the drawing order, so you should usually have no need to use this method.

However, in order to eliminate the overhead of checking each node during each drawing frame, you can disable this automatic behaviour by setting the allowSequenceUpdates property of specific drawing sequencers to NO.

In that case, if you modify the properties of a node or its content, such as mesh or material opacity, and your CC3World drawing sequencer uses that criteria to sort nodes, you can invoke this method to force the node to be repositioned in the correct drawing order.

You don't need to invoke this method when initially setting the properties. You only need to invoke this method if you modify the properties after the node has been added to the CC3World, either by itself, or as part of a node assembly.

Implements CC3Node.

+ (ccColor4F) localContentWireframeBoxColor

Returns the color that local content wireframe bounding boxes will be drawn in when created using the shouldDrawLocalContentWireframeBox property.

Setting this property to kCCC4FBlackTransparent will cause the color of any new local content wireframe bounding boxes to be set to the value of the color property of the node instead.

The initial value of this class property is kCCC4FMagenta.

+ (void) setLocalContentWireframeBoxColor: (ccColor4F)  aColor

Sets the color that local content wireframes will be drawn in when created using the shouldDrawWireframeBox property.

Changing this property will affect the color of any new local content wireframe bounding boxes created. It does not affect any instances that already have a wireframe bounding box established.

Setting this property to kCCC4FBlackTransparent will cause the color of any new local content wireframe bounding boxes to be set to the value of the color property of the node instead.

The initial value of this class property is kCCC4FMagenta.


Member Data Documentation

- (GLint) zOrder [protected]

Indicates the order in which this node should be drawn when compared to other nodes, when drawing order should be determined by distance from the camera (Z-order).

Sequencing nodes for drawing based on distance from the camera is necessary for translucent nodes.

In a drawing sequencer that sorts nodes by drawing order based on distance from the camera, the value of this property overrides the distances of the nodes from the camera. Sorting occurs on the value of this property first, and then on distance from the camera.

Sorting based on distance to the camera alone is quite effective. In almost all cases, it is not necessary to set the value of this property, and if nodes are moving around, setting a value to this property can actually interfere with the dynamic determination of the correct drawing order. Only use this property if you have reason to force a node to be drawn before or after another node for visual effect.

The smaller the value of this property, the closer to the camera the node is deemed to be. This property may be assigned a negative value.

The initial value of this property is zero.

The CC3World must be configured with a drawing sequencer that sorts by Z-order for this property to be effective.

This property only has effect for nodes with local content to draw (instances of CC3LocalContentNode). Setting this property passes the value to all descendent nodes. Reading this value returns the average value of all child nodes, or returns zero if there are no child nodes.

Implements CC3Node.


Property Documentation

- (CC3BoundingBox) globalLocalContentBoundingBox [read, assign]

Returns the bounding box of this node's mesh, in the global coordinate system, by transforming the eight vertices derived from the localContentBoundingBox property, using the transformMatrix of this node, and constructing another bounding box that surrounds all eight transformed vertices.

If this node has no local content, returns kCC3BoundingBoxNull.

Since all bounding boxes are axis-aligned (AABB), if this node is rotated, the globalLocalContentBoundingBox will generally be significantly larger than the localContentBoundingBox.

- (CC3BoundingBox) localContentBoundingBox [read, assign]

Returns the bounding box of this node's local content, in this node's local coordinate system.

If this node has no local content, returns kCC3BoundingBoxNull.

- (CC3WireframeBoundingBoxNode*) localContentWireframeBoxNode [read, assign]

If the shouldDrawLocalContentWireframeBox is set to YES, returns the child node that draws the wireframe around the local content of this node.

Otherwise, returns nil.

- (BOOL) shouldDrawLocalContentWireframeBox [read, write, assign]

Indicates whether the node should display a wireframe box around the local content of this node.

This property is distinct from the inherited shouldDrawWireframeBox property. The shouldDrawWireframeBox property draws a wireframe that encompasses this node and any child nodes, where this property draws a wireframe that encompasses just the local content for this node alone. If this node has no children, then the two wireframes will surround the same volume.

The wireframe box is drawn by creating and adding a CC3WireframeBoundingBoxNode as a child node to this node. The dimensions of the child node are set from the localContentBoundingBox property of this node. Setting this property to YES adds the wireframe child node, and setting this property to NO removes the wireframe child node.

Setting this property to YES can be useful during development in determining the boundaries of the local drawn content of a node.

The color of the wireframe box will be the value of the class-side defaultLocalContentWireframeBoxColor property, or the value of the color property of this node if defaultLocalContentWireframeBoxColor is equal to kCCC4FBlackTransparent.


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