Retained mode

The 3D graphics of the game have been implemented using the Retained Mode of Mobile 3D Graphics API for J2ME (abbreviated M3G). The Retained Mode is the high-level implementation mode of the API. The low-level access is called Immediate Mode, and it provides OpenGL-like APIs. These modes can also be mixed. If you are new to M3G, see ​this guide: Getting Started With the Mobile 3D Graphics API for J2ME.

The Mobile 3D Graphics API classes used in aMaze are described in the following table. The classes especially relevant are highlighted.

Class*

Description

How is it used in aMaze?

Appearance

A set of component objects that define the rendering attributes of a Mesh or Sprite3D.

For creating the textures for maze walls, floor etc. Used together with CompositingMode. See WorldBuilder.java

Background

Defines whether and how to clear the viewport.

The space-like background behind the maze. When enabled causes significant drop in FPS.

Camera

A scene graph node that defines the position of the viewer in the scene and the projection from 3D to 2D.

aMaze has two cameras. One for the top view and another one for point-of-view mode. In addition, the transition animations are done by manipulating the camera transition and orientation.

Graphics3D

A singleton 3D graphics context that can be bound to a rendering target.

 
CompositingMode

An Appearance component encapsulating per-pixel compositing attributes.

See Appearance.

Image2D

A two-dimensional image that can be used as a texture, background, or sprite image.

 
Mesh

A scene graph node that represents a 3D object defined as a polygonal surface.

The marble, for instance, is represented by a Mesh object, so it is actually just a 2D image instead of ball-shape.

Node

An abstract base class for all scene graph nodes.

 
PolygonMode

An Appearance component encapsulating polygon-level attributes.

 
RayIntersection

A RayIntersection object is filled in by the pick methods in Group.

Used for collision detection in MazeCanvas.java.

Texture2D

An Appearance component encapsulating a two-dimensional texture image and a set of attributes specifying how the image is to be applied on submeshes.

 
Transform

A generic 4x4 floating point matrix, representing a transformation.

Used for setting the transform for all 3D objects including the cameras.

TriangleStripArray

TriangleStripArray defines an array of triangle strips.

 
VertexArray

An array of integer vectors representing vertex positions, normals, colours, or texture coordinates.

 
VertexBuffer

VertexBuffer holds references to VertexArrays that contain the positions, colours, normals, and texture coordinates for a set of vertices.

 
World

A special Group node that is a top-level container for scene graphs.

Contains every visible 3D objects.

*Click on class name for API reference.