Scenery Creation


Class Diagrams for Terra3D

Figure 27-3 shows the class diagrams for the Terra3D application. The class names and public methods are included.

Figure 27-2. Desert with sagebrush


Terra3D is the top-level JFrame for the application. WrapTerra3D creates the world, including the lighting and background. However, most of the work is delegated to a Landscape object that loads the landscape (a combination of an OBJ file for the mesh and JPG image for the texture) and places walls around it. Each wall is an instance of TexturedPlane, so a mountain range image can be displayed.

The 3D scenery models are loaded with PropManager objects, and the 2D images are represented by GroundShape objects. A GroundCover object manages the placement of the ground cover and the sharing of the GroundShape objects.

The KeyBehavior class is similar to the one in FractalLand3D in Chapter 26. The user can move forward, backward, left, right, up, down (but not below the ground) and can turn left and right. In addition, the w key prints the user's location in the landscape to System.out.

Terrain picking is handled by a HeightFinder thread, which communicates its answer back to KeyBehavior when the picking is completed.

The code for this example can be found in the Terra3D/ directory.




Killer Game Programming in Java
Killer Game Programming in Java
ISBN: 0596007302
EAN: 2147483647
Year: 2006
Pages: 340

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