Class Diagrams for Terra3DFigure 27-3 shows the class diagrams for the Terra3D application. The class names and public methods are included. Figure 27-2. Desert with sagebrushTerra3D 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.
|