The WorldRender Class
Recall what you have to render in 3D:
- The ship, using the ship model and texture, and applying lighting.
- The invaders, using the invader model and texture, again with lighting.
- Any shots on the playfield, based on the shot model, this time without texturing but with lighting.
- The shield blocks, based on the shield block model, again without texturing, but with lighting and transparency (see Figure 12–3).
- Explosions instead of the ship or invader model, in case the ship or invader is exploding. The explosion is not lit, of course.
You know how to code the first four items on this list. But what about the explosions?
It turns out that you can abuse the
SpriteBatcher for this. Based on the state time of the exploding ship ...