230 CHAPTER 7: Well-Rendered Miscellany^
Figure 7-11. Projection of a shadow on a flat plane that is then ‘‘reprojected’’ out to poke the viewer’s eye
The shaded area is calculated by using the intersection of the vectors and the plane,
which travel from the light source by way of each of the vertices. Each point on the
plane forms a ‘‘new’’ object that can then be transformed, as anything else on the plane
would be. Listing 7-15 shows how this is coded.
Let’s start again with the basic bouncy cube demo (even though much of it will be
changed for the shadow code, it’ll still serve as a working template), but we’ll swap in
new view controller code. Listing 7-11 covers some of the initialization parameters.
Listing 7-11. The initialization stuff to add to the view controller
- (void)viewDidLoad
{
[super viewDidLoad];
//Normal wizard-produced code deleted for clarity.
m_WorldRotationX=35.0; //1
m_WorldRotationY=0.0;