Skip to Main Content
Killer Game Programming in Java
book

Killer Game Programming in Java

by Andrew Davison
May 2005
Intermediate to advanced content levelIntermediate to advanced
998 pages
26h
English
O'Reilly Media, Inc.
Content preview from Killer Game Programming in Java

Loaders in Java 3D

Before WrapLoaderInfo3D can traverse or change the external model's scene graph, the model has to be loaded. Java 3D supports external model loading through its Loader interface and the Scene class.Loader takes as input the model's filename and flags for enabling and disabling the loading of certain elements of the model, such as light nodes, sound nodes, and view graphs.

Java 3D's utilities package includes two subclasses of Loader aimed at particular file formats: Lw3dLoader handles Lightwave 3D scene files, and ObjectFile processes Wavefront OBJ files. A third subclass, LoaderBase , implements the Loader interface in a generic way to encourage the building of loaders for other 3D formats through subclassing.

The Scene class uses a Loader object to extract details about a model, the most significant being its BranchGroup, usually for the purpose of adding it to the application scene. Information about other aspects of the model may be available, including the model's light nodes, object names, viewpoints, and behavior nodes. However, not all loaders supply this information, i.e., the relevant methods may return nothing.

There's a wide range of Java 3D loaders for different file formats, written by third-party developers. A good list is maintained at http://www.j3d.org/utilities/loaders.html.

Tip

Loaders specifically aimed at gaming are listed in Chapter 14.

In this and other chapters, I employ the loaders in the NCSA Portfolio package (available from http://www.ncsa.uiuc.edu/~srp/Java3D/portfolio/ ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java Game Development with LibGDX: From Beginner to Professional

Java Game Development with LibGDX: From Beginner to Professional

Lee Stemkoski

Publisher Resources

ISBN: 0596007302Supplemental ContentErrata Page