Motorola maxx V6 manual Draft Subject to Change 104/201, Initializing the world

Models: maxx V6

1 201
Download 201 pages 31.32 Kb
Page 104
Image 104

Java ME Developer Guide

Chapter 13 - JSR-184 - Mobile 3D Graphics API

Figure 8 Typical MIDlet Structure

13.4.3 Initializing the world

The Loader class is used to initialize the world. It has two static methods: one takes in a byte array, while the other takes a named resource, such as a URI or an indi- vidual file in the JAR package.

The load methods return an array of Object3Ds that are the root level objects in the file.

The following example calls Loader.load() and passes it an M3G file from the JAR file using a property in the JAD file. Alternatively, you could specify a URI, for example:

￿￿￿￿￿￿￿￿￿￿ ￿￿￿￿￿ ￿ ￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿￿

￿￿￿￿￿￿￿￿￿￿￿￿￿￿;

The example assumes that there is only one root node in the scene, which will be the world object. If the M3G file has multiple root nodes the code must be changed to re- flect this, but generally most M3G files have a single root node.

DRAFT - Subject to Change [104/201]

Page 104
Image 104
Motorola maxx V6 manual Draft Subject to Change 104/201, Initializing the world