Briefly
Now, mobile games and mobile apps are very popular! The game needs to have fashionable and beautiful graphics, its design standard is higher than any time before. This article will show you how to use the cool mobile 3D graphics API to develop 3D graphics games for J2ME devices.
If you're programming with MIDP1.0, there are two paths you can choose from: Using advanced UI classes or starting from scratch. As game developers, the first option is often impossible; This is why game developers have to develop their own 3D engines for their advanced games. There is no doubt that this will take a lot of time and effort, and the lack of floating-point support for CLDC 1.0 (MIDP 1.0 is built on it) does little to solve the problem.
In MIDP 2.0, there is an optional package called the Mobile 3D graphics API, or JSR 184. The API is the first three-dimensional graphics package on a mobile device based on Java standard development. The API has both high-level and low-level graphic features, where advanced features are called retention modes, and low-level features are called immediate patterns. Retention mode makes it possible for the developer to use the scene graph and make the objects in the scene according to the virtual camera and the location of the lights to color themselves. Immediate mode allows the application to draw directly from the object. If you want, you can use both modes in the same application. This article focuses on immediate mode.
3D API
Let's start by enumerating and interpreting the classes in the 3D API. In addition to these APIs, JSR 184 includes a scene graphic structure and a corresponding file format to effectively manage and configure 3D content. The file format defines a m3g file that is typically converted from a 3D modeling file application.
Table 1. 3D API Class
Class |
Describe |
Animationcontroller |
Controls animation order. |
Animationtrack |
To correlate a keyframesequence with a animationcontroller. |
Appearance |
A set of objects that define a mesh (mesh) or a spring3d shaded property. |
Background |
Defines how the view is cleared. |
Camera |
A vertex of a scene graph that defines the position of the observer in the scene and the projection from 3D to 2D. |
CompositingMode |
A appearance class that encapsulates the composite properties of each pixel. |
Fog |
A appearance class that contains the relevant properties of the atomization. |
Graphics3d |
A separate 3D graphics context. All shader operations are implemented in the render () method in the class. |
Group |
A scene graph node that stores a unordered set of nodes as its sub nodes. |
Image2d |
A two-dimensional image that can be used for textures, backgrounds, or sprite images. |
IndexBuffer |
This class defines how vertices are connected to form a geometry. |
Keyframesequence |
Encapsulates a series of animated data with timestamp and vector-valued keyframes. |
Light |
Describes the different types of light sources. |
Loader |
Download and drag the row Graph node and node components, as well as the entire scene graph. |
Material |
Encapsulates the material properties for optical calculations. |
Mesh |
Describes a 3D object, which is defined with a polygon surface. |
Morphingmesh |
Describes a vertex-deformed polygon mesh. |
Node |
Abstract base class for all scene graph nodes. Its five specific subclasses are: Camera,mesh,sprite3d,light and group. |
Object3d |
Abstract base class for all objects that can be part of the 3D world. |
Polygonmode |
Encapsulates the polygon-level attribute. |
Rayintersection |
A reference to a segmented mesh or sprite3d is stored, along with information about the split point. |
Skinnedmesh |
Describes the polygonal mesh of a frame animation. |
Sprite3d |
Describes a 2D image in 3D position. |
Texture2d |
Encapsulates a 2D texture image and a collection of attributes that indicate how the image is applied to the child mesh. |
Transform |
A general-purpose 4x4 floating-point number matrix used to describe a transformation. |
transformable |
Abstract base class for node and Texture2d classes. |
Trianglestriparray |
Defines a triangle with an array. |
Vertexarray |
An integer vector array that describes the vertex position, normal, color, or texture coordinates. |
VertexBuffer |
Stores a reference to the vertexarrays that contains the position, color, normals, and texture coordinates of a vertex set. |
World |
A special group node that serves as the topmost container for the scene graph. |