#import <CC3ShadowVolumes.h>
Class Methods | |
(BOOL) | + defaultVisible |
(void) | + setDefaultVisible: |
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. Under iOS, the sencil buffer is combined with the depth buffer, and you create a stencil buffer by passing the value GL_DEPTH24_STENCIL8 as the depth format argument in the CCGLView method viewWithFrame:pixelFormat:depthFormat:preserveBackbuffer:sharegroup:multiSampling:numberOfSamples:.
+ (BOOL) defaultVisible |
Returns the default value to which the visible property will be set when an instance is created and initialized.
The initial value of this property is NO. Normally, shadow volumes affect the contents of the stencil buffer, but are not directly visible themselves. However, during development debugging, you can set this property to YES to make the shadow volumes visible within the scene, to help visualize how the shadow volumes are interacting with the scene.
- (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.
+ (void) setDefaultVisible: | (BOOL) | defaultVisible |
Sets the default value to which the visible property will be set when an instance is created and initialized.
The initial value of this property is NO. Normally, shadow volumes affect the contents of the stencil buffer, but are not directly visible themselves. However, during development debugging, you can set this property to YES to make the shadow volumes visible within the scene, to help visualize how the shadow volumes are interacting with the scene.
|
readwritenonatomicassign |
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.