The Code So Far

[Previous] [Next]

At this point, you should compile this chapter's code and "walk around" the 3D world you've created. Because you now have both keyboard and joystick input supported by DirectInput, you can use the keys or the joystick to maneuver around the 3D environment. Use the up arrow key to move forward, the down arrow key to move backward, the left arrow key to turn left, or the right arrow key to turn right. Different facets of the scene come into focus as you move close enough to them (and disappear as you "step" away) so that the rendering speed remains as high as possible.

Figure 8-7 depicts the 3D world rendered by this chapter's code, illustrating how the textures applied to the primitives you're using for roads, buildings, and gas pumps make this world more realistic. In this figure, the lights actually illuminate the road (because the rendering time required vs. the rendering results make it worth the computation time to use real lighting), but you could choose to use light maps and just a simple ambient lighting. The sky texture is animated by adjusting the u and v coordinates of the sky primitive before rendering each frame.

click to view at full size.

Figure 8-7 What the code looks like now



Inside Direct3D
Inside Direct3D (Dv-Mps Inside)
ISBN: 0735606137
EAN: 2147483647
Year: 1999
Pages: 131

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net