com.motorola.iden.micro3d
Class Primitive

java.lang.Object
  |
  +--com.motorola.iden.micro3d.Object3D
        |
        +--com.motorola.iden.micro3d.Primitive
Direct Known Subclasses:
Line, Point, PointSprite, Quadrangle, Triangle

public abstract class Primitive
extends Object3D

Primitive class is the base for all the 3D primitives. The Micro3D engine supports rendering of several 3D primitives. The following 3D primitives are supported.


MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© COPYRIGHT 2003-2004 MOTOROLA, Inc. All Rights Reserved.


Field Summary
static int BLENDING_ADD
          Blending type - additive blending (dist 100%+src 100%).
static int BLENDING_HALF
          Blending type - 50%.
static int BLENDING_NONE
          Blending type - none.
static int BLENDING_SUB
          Blending type - subtractive blending (dist 100%-src 100%).
static int FACE_NORMAL
          Identifier for a vector that is serving as a face normal.
static int NORMAL
          Identifier for a vector that is serving as a vertex normal.
static int VERTEX_A
          Identifier for vertex A.
static int VERTEX_B
          Identifier for vertex B.
static int VERTEX_C
          Identifier for vertex C.
static int VERTEX_D
          Identifier for vertex D.
 
Method Summary
 void enableColorKeyTransparency(boolean enable)
          Enables/disables color key transparency.
 int getBlendingType()
          Returns the blending type.
 int getColor()
          Returns the color that is used for rendering this Primitive.
abstract  Vector3D getVector(int vectorID)
          Returns the Vector3D for the specified vector.
 boolean hasColorKeyTransparency()
          Determines whether the primitive has color key transparency enabled.
 void setBlendingType(int blendingType)
          Sets the blending type.
 void setColor(int color)
          Sets the color that should be used when rendering a Primitive.
abstract  void setVector(int vectorID, Vector3D vector)
          Sets the specified vector to the Vector3D provided.
 
Methods inherited from class com.motorola.iden.micro3d.Object3D
getLayout, getSphereTexture, getTexture, setLayout, setSphereTexture, setTexture
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERTEX_A

public static final int VERTEX_A
Identifier for vertex A.

VERTEX_B

public static final int VERTEX_B
Identifier for vertex B.

VERTEX_C

public static final int VERTEX_C
Identifier for vertex C.

VERTEX_D

public static final int VERTEX_D
Identifier for vertex D.

NORMAL

public static final int NORMAL
Identifier for a vector that is serving as a vertex normal.

FACE_NORMAL

public static final int FACE_NORMAL
Identifier for a vector that is serving as a face normal.

BLENDING_NONE

public static final int BLENDING_NONE
Blending type - none.

BLENDING_HALF

public static final int BLENDING_HALF
Blending type - 50%.

BLENDING_ADD

public static final int BLENDING_ADD
Blending type - additive blending (dist 100%+src 100%).

BLENDING_SUB

public static final int BLENDING_SUB
Blending type - subtractive blending (dist 100%-src 100%).
Method Detail

getVector

public abstract Vector3D getVector(int vectorID)
                            throws java.lang.IllegalArgumentException
Returns the Vector3D for the specified vector. Certain Primitive types support a specific set of Primitive constants. Always consult the extending class for the list of constants supported as vector descriptors.

Parameters:
vectorID - the ID of the vector to return.
Returns:
the Vector3D for the specified vector ID.
Throws:
java.lang.IllegalArgumentException - if an invalid vector ID is specified.
See Also:
VERTEX_A, VERTEX_B, VERTEX_C, VERTEX_D, FACE_NORMAL, NORMAL

setVector

public abstract void setVector(int vectorID,
                               Vector3D vector)
                        throws java.lang.NullPointerException,
                               java.lang.IllegalArgumentException
Sets the specified vector to the Vector3D provided. Certain Primitive types support a specific set of Primitive constants. Always consult the extending class for the list of constants supported as vector descriptors.

Parameters:
vectorID - the ID of the vector being set.
vector - the Vector3D to set.
Throws:
java.lang.IllegalArgumentException - if an invalid vectorID is specified.
java.lang.NullPointerException - if the vector is null.
See Also:
VERTEX_A, VERTEX_B, VERTEX_C, VERTEX_D, FACE_NORMAL, NORMAL

getColor

public int getColor()
Returns the color that is used for rendering this Primitive. Not all Primitive types use the color setting.

Returns:
the color that is used for rendering this Primitive.

setColor

public void setColor(int color)
Sets the color that should be used when rendering a Primitive. Not all Primitive types use the color setting and some will not use a color setting when they have a Texture mapped to them. See Graphics for information on specifying RGB values.

Parameters:
color - the color to use when rendering this Primitive.
See Also:
Graphics

getBlendingType

public int getBlendingType()
Returns the blending type.

Returns:
the blending type.
See Also:
BLENDING_NONE, BLENDING_HALF, BLENDING_ADD, BLENDING_SUB

setBlendingType

public void setBlendingType(int blendingType)
                     throws java.lang.IllegalArgumentException
Sets the blending type. This method specifies one of following blending types supported by the primitive.

In order for the primitive to be rendered with the specified blending type the Layout3D associated with this primitive must have semi-transparency enabled.

Parameters:
blendingType - blending type.
Throws:
java.lang.IllegalArgumentException - is the specified blending type is invalid.
See Also:
BLENDING_NONE, BLENDING_HALF, BLENDING_ADD, BLENDING_SUB, Layout3D.setSemiTransparent(boolean transparent)

hasColorKeyTransparency

public boolean hasColorKeyTransparency()
Determines whether the primitive has color key transparency enabled.
Returns:
true if color key transparency is enabled, false otherwise.

enableColorKeyTransparency

public void enableColorKeyTransparency(boolean enable)
Enables/disables color key transparency. When the color key transparency is enabled the CLUT0 color in the polygon texture will be transparent; other colors within the polygon texture will not be transparent. The CLUT0 color can be any color, but should be the first entry in the CLUT. It is recommended that the CLUT0 is specified to black (RGB 0x000000).
Color key transparency is not applicable to points, lines, and colored (non-textured) polygons. In those cases, enabling or disabling the color key transparency will not have any effect on the primitive.
Parameters:
enable - true to enable color key transparency, false to disable.