Java Reference
In-Depth Information
startTime = System.currentTimeMillis() - mWorldStartTime;
mWorld.animate((int)startTime);
mGraphics3D.bindTarget(g);
mGraphics3D.render(mWorld);
mGraphics3D.releaseTarget();
flushGraphics();
try {Thread.sleep(100); }
catch(InterruptedException ie){
}
}
} // of while
}
private void cameraForward() {
mCam.translate(0f, 0f, 0.2f);
}
private void cameraBackward() {
mCam.translate(0f, 0f, -0.2f);
}
private void cameraLeft() {
mCam.translate(-0.2f, 0f, 0f);
}
private void cameraRight() {
mCam.translate(0.2f, 0f, 0f);
}
}
You can write the MIDlet container class yourself, or download it from
http://
www.apress.com/
.
Loading a Retained Mode 3D World
RetainedCanvas
is a subclass of
GameCanvas
. This MIDlet takes advantage of
GameCanvas
's easy
key polling and the simple rendering loop.
To load the retained mode world, an M3G
Loader
class is used. The sole purpose of a
Loader
is
to load in and reconstitute an instance of an
Object3D
subclass.
Object3D
subclasses include
many of the objects you've encountered, such as
VertexBuffer
,
VertexArray
,
Material
,
PolygonMode
, and so on.
World
is also an
Object3D
subclass.
A
World
is a complete serialized 3D world, including all the 3D objects, transformation,
light, camera, animation, etc.
Also, a
World
is a specialized
Group
, another M3G class. A
Group
can contain multiple other
Node
s. A
Node
can be a
Camera
,
Mesh
,
Light
,
Group
, or
Sprite3D
. This forms the data structure that
Search WWH ::
Custom Search