Public Member Functions | Protected Attributes | Properties

CC3ShadowVolumeMeshNode Class Reference

The mesh node used to build a shadow volume. More...

#import <CC3ShadowVolumes.h>

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

List of all members.

Public Member Functions

(void) - drawToStencilWithVisitor:

Protected Attributes

CC3Lightlight

Properties

BOOL shouldDrawTerminator: 1

Detailed Description

The mesh node used to build a shadow volume.

A single CC3ShadowVolumeMeshNode instance represents the shadow from a single light for a single shadow-casting node.

As a mesh node, the CC3ShadowVolumeMeshNode instance is added as a child to the node whose shadow is to be represented. To automatically create a CC3ShadowVolumeMeshNode and add it to the shadow-casting node, use the addShadowVolumesForLight: method on the shadow-casting node (or any structural ancestor of that node).

CC3ShadowVolumeMeshNode implements the CC3ShadowProtocol. The implementation of the updateShadow method populates a shadow volume mesh that encompasses the volume of space shadowed by the shadow-casting node. Any other object with this shadow volume will be shadowed by that node.

The shadow volume mesh of this node is invisible in itself, but by depth-testing against other drawn nodes, a stencil is created indicating which view pixels will be in shadow. Those view pixels are then darkened accordingly.

Of all shadowing techniques, shadow volumes result in the most accurate shadows, but are also the most computationally intensive.

Shadow volumes use a stencil buffer to determine the areas that require shading. The stencil buffer must be allocated within the EAGLView when the view is created and initialized. On the iOS, the sencil buffer is combined with the depth buffer. You create a stencil buffer by passing the value GL_DEPTH24_STENCIL8_OES as the depth format argument in the CC3EAGLView method viewWithFrame:pixelFormat:depthFormat:preserveBackbuffer:sharegroup:multiSampling:numberOfSamples:.


Member Function Documentation

- (void) drawToStencilWithVisitor: (CC3NodeDrawingVisitor *)  visitor

Draws this node to a stencil.

The stencil is marked wherever another node intersects the mesh volume of this node, and is therefore in shadow.

The application should not use this method. The method signature, and use of this method will change as additional shadow-casting techniques are introduced.


Member Data Documentation

- (CC3Light*) light [protected]

The light casting this shadow.

Reimplemented from <CC3ShadowProtocol>.


Property Documentation

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

Indicates that this should display the terminator line of the shadow-casting node.

The terminator line is the line that separates the illuminated side of the shadow-casting object from the dark side. It defines the start of the shadow volume mesh that is attached to the shadow-casting node.

This property can be useful for diagnostics during development. This property only has effect if the visible property is set to YES for this shadow-volume node.


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