|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectm3g05.WireframeEngine
public class WireframeEngine
Wireframe engine that displays 3D models as line drawings. It uses M3G's matrix operations to transform 3D vertex coordinates to a 2D screen representation and draws the model on a MIDP graphics context.
WireframeSample| Field Summary | |
|---|---|
private javax.microedition.m3g.Camera |
camera
Camera object that represents the viewer of the 3D scene. |
private int |
halfViewportHeight
Half the viewport height. |
private int |
halfViewportWidth
Half the viewport width. |
private javax.microedition.m3g.Transform |
invertedCameraTransform
Transformation for camera. |
private int |
viewportX
Viewport x. |
private int |
viewportY
Viewport y. |
| Constructor Summary | |
|---|---|
WireframeEngine(int viewportX,
int viewportY,
int viewportWidth,
int viewportHeight)
Creates a new WireframeEngine with the given viewport attributes. |
|
| Method Summary | |
|---|---|
protected void |
draw(javax.microedition.lcdui.Graphics graphics,
float[] vertices,
int[] triangleIndices,
int[] triangleLengths)
Draws a wireframe model on the given graphics context. |
void |
render(javax.microedition.lcdui.Graphics graphics,
javax.microedition.m3g.Mesh mesh,
javax.microedition.m3g.Transform meshTransform,
int[] triangleIndices,
int[] triangleLengths)
Renders a 3D model as wireframe. |
void |
setCamera(javax.microedition.m3g.Camera camera,
javax.microedition.m3g.Transform cameraTransform)
Sets the camera that's used to represent the viewer of the scene. |
protected float[] |
transform(javax.microedition.m3g.Mesh mesh,
javax.microedition.m3g.Transform meshTransform,
javax.microedition.m3g.Camera camera,
javax.microedition.m3g.Transform invertedCameraTransform)
Transforms vertices from 3D to 2D. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private int viewportX
private int viewportY
private int halfViewportWidth
private int halfViewportHeight
private javax.microedition.m3g.Camera camera
private javax.microedition.m3g.Transform invertedCameraTransform
| Constructor Detail |
|---|
public WireframeEngine(int viewportX,
int viewportY,
int viewportWidth,
int viewportHeight)
viewportX - viewport x position.viewportY - viewport y position.viewportWidth - viewport width.viewportHeight - viewport height.| Method Detail |
|---|
public void setCamera(javax.microedition.m3g.Camera camera,
javax.microedition.m3g.Transform cameraTransform)
camera - camera.cameraTransform - camera transformation.
public void render(javax.microedition.lcdui.Graphics graphics,
javax.microedition.m3g.Mesh mesh,
javax.microedition.m3g.Transform meshTransform,
int[] triangleIndices,
int[] triangleLengths)
graphics - graphics context used for drawing.mesh - mesh to be drawn.meshTransform - the mesh's transformation.triangleIndices - triangle indices that define how to draw
the model.triangleLengths - lengths of the triangle array.
protected float[] transform(javax.microedition.m3g.Mesh mesh,
javax.microedition.m3g.Transform meshTransform,
javax.microedition.m3g.Camera camera,
javax.microedition.m3g.Transform invertedCameraTransform)
mesh - mesh to be transformed.invertedCameraTransform - inverted camera transformation.meshTransform - the mesh's transformation.camera - camera object that represents the viewer of the 3D
scene.
protected void draw(javax.microedition.lcdui.Graphics graphics,
float[] vertices,
int[] triangleIndices,
int[] triangleLengths)
graphics - graphics context for drawing.vertices - transformed vertices of the model.triangleIndices - triangle indices that define how to draw
the model.triangleLengths - lengths of the triangle array.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||