de.enough.polish.graphics3d.m3g.utils
Class NodeFactory

java.lang.Object
  extended by de.enough.polish.graphics3d.m3g.utils.NodeFactory

public class NodeFactory
extends Object

Factory class for common M3G nodes and shapes.

Author:
Anders Bo Pedersen, anders@wicore.dk

Field Summary
static int[] CUBE_INDEX
           
static byte[] CUBE_NORMS
           
static byte[] CUBE_TEXT_COORDS
           
static byte[] CUBE_VERTS
           
static int[] QUAD_INDEX
           
static byte[] QUAD_NORMS
           
static byte[] QUAD_TEXT_COORDS
           
static byte[] QUAD_VERTS
           
 
Constructor Summary
NodeFactory()
           
 
Method Summary
static javax.microedition.m3g.Light createAmbientLight(int color, float intensity)
          Creates a ambient light source using argument settings
static javax.microedition.m3g.Mesh createCube(boolean useNormals, boolean useTextCords)
          Creates a Cube mesh
static javax.microedition.m3g.Light createDirectionalLight(int color, float intensity, float[] directionVec)
          Creates a directional light source using argument settings
static javax.microedition.m3g.Mesh createQuad(boolean useNormals, boolean useTextCords)
          Creates a quad mesh using argument Apperance object
static javax.microedition.m3g.Appearance getDefaultApperance()
          Creates a default Appearance object with lighting turned on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUAD_VERTS

public static final byte[] QUAD_VERTS

QUAD_INDEX

public static final int[] QUAD_INDEX

QUAD_NORMS

public static final byte[] QUAD_NORMS

QUAD_TEXT_COORDS

public static final byte[] QUAD_TEXT_COORDS

CUBE_VERTS

public static final byte[] CUBE_VERTS

CUBE_INDEX

public static final int[] CUBE_INDEX

CUBE_NORMS

public static final byte[] CUBE_NORMS

CUBE_TEXT_COORDS

public static final byte[] CUBE_TEXT_COORDS
Constructor Detail

NodeFactory

public NodeFactory()
Method Detail

createQuad

public static javax.microedition.m3g.Mesh createQuad(boolean useNormals,
                                                     boolean useTextCords)
Creates a quad mesh using argument Apperance object

Parameters:
appearance -
Returns:
Mesh a quad

createCube

public static javax.microedition.m3g.Mesh createCube(boolean useNormals,
                                                     boolean useTextCords)
Creates a Cube mesh

Parameters:
appearance -
Returns:
Mesh a cube

createAmbientLight

public static javax.microedition.m3g.Light createAmbientLight(int color,
                                                              float intensity)
Creates a ambient light source using argument settings

Parameters:
color -
intensity -
Returns:
a ambient light node

createDirectionalLight

public static javax.microedition.m3g.Light createDirectionalLight(int color,
                                                                  float intensity,
                                                                  float[] directionVec)
Creates a directional light source using argument settings

Parameters:
color -
intensity -
directionVec -
Returns:
a directional light node

getDefaultApperance

public static javax.microedition.m3g.Appearance getDefaultApperance()
Creates a default Appearance object with lighting turned on.

Returns:
default apperance