Chapter 16. Loading and Manipulating External Models

It’s possible to build complex geometries in Java 3D by using the GeometryArray class or one of its subclasses (e.g., a QuadArray or TriangleStripArray ). This amounts to calculating 3D coordinates for yourself and ensuring they’re ordered correctly inside the geometry objects. This is almost impossible to do manually for anything but the simplest shapes (such as boxes or cones). It makes much more sense to create an object using 3D modeling software and then load that object into your Java 3D application at runtime. I’ll refer to objects as external models since their geometry and appearance (e.g., their color and texture) are created outside of Java 3D.

This chapter describes two Java 3D programs that load external models, and then details placing those models into the checkerboard scene (discussed in Chapter 15). This illustrates many of the typical tasks a Java 3D program will perform: analyzing the contents of a model, adjusting its appearance, and repositioning the model in a scene. shows how a loaded object can be examined and its component shapes manipulated to change color, transparency, texture, and other attributes. Figure 16-1 shows two screenshots: the left one a robot with its original colors, the right one the same model after being turned blue., the other application examined in this chapter, shows how a loaded model’s position, orientation, and size can be adjusted. This information ...

Get Killer Game Programming in Java now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.