64
Figure 4 M3G Application Methods
The World object contains the objects that define a complete 3D scene - geometry,
textures, lights, cameras, and animations. The World object mediates access to the
objects within the world. It can be passed as a block to the renderer, the Graphics3D
class.
The Loader object, populates a World by loading an M3G file from a URI or other asset
source, such as a buffer of bytes in M3G format. The Loader is not restricted to loading
just Worlds, each file can contain as little as a single object and multiple files can be
merged together on the device, or you can put everything into a single file.
The rendering class Graphics3D (by analogy to the MIDP Graphics class) takes a whole
scene (or part of a scene graph), and renders a view onto that scene using the current
camera and lighting setup. This view can be to the screen, to a MIDP image, or to a
texture in the scene for special effects. You can pass a whole world in one go (retained
mode) or you can pass individual objects (immediate mode). There is only one
Graphics3D object present at one time, so that hardware accelerators can be used.
The figure 5 shows the structure of a more typical MIDlet.