CHAPTER 8: Putting It All Together (^259)
Figure 8-4. The hover mode lets you rotate the arth at will.
So, that’s part one of today’s exercise. Remember those lens flare things from Chapter
7? Now we can put them to use.
Adding Some Flare
From Chapter 7, grab the four source files from the lens flare exercise, and add them to
your project along with the artwork. This will require some substantial updates to your
main execute method in the solar-system controller, mainly for managing the lens flare
object in terms of both positioning and highlighting.
Something like a lens flare effect has all sorts of small issues that will be addressed.
Namely, if the flare’s source object, in the case the sun, goes behind the earth, the flare
itself should vanish. Also note that it won’t vanish immediately but will actually fade out.
There are a couple of new utility routines that need to be added before the flare itself
can be rendered.
For starters, though, you’ll need to allocate both the lens flare object and a new texture
object for rendering the sun. Add the following two lines to the init routine of the solar-
system controller:
m_LensFlare=[[LensFlare alloc]init];
m_FlareSource= m_FlareSource=[[OpenGLCreateTexture
getObject]loadTexture:@"gimp_sun3.png"];
singke
(singke)
#1