< Zurück | Inhalt | Weiter >

Loading and creating the world from a 2D map

One nice feature of the example is that the definition of the 3D world is a 2D map (figure 11.4). The map is loaded from a standard GIF image, and the colors of the pixels within the image are queried one by one.


Figure 11.4 A map for the KeyNavigateTest example application. Colored pixels within the image denote the different classes of objects: bookcases, walls, guards, water, and lights

The RGB (red, green, blue) color of each pixel in the image is compared against the color values that are used to denote each class of object within the world. These colors are defined as follows:


From KeyNavigateTest.java