|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.motorola.iden.micro3d.Object3D | +--com.motorola.iden.micro3d.Primitive | +--com.motorola.iden.micro3d.Triangle
Triangle primitive. The Triangle
primitive is a triangular
polygon that is defined by three points. A triangle can be rendered either
with a solid color or texture mapped. If a texture has been assigned to
a triangle then the triangle will be rendered with that texture; otherwise,
the triangle will be rendered with the specified color. The blending type
is applicable to the triangle regardless of whether it is rendered with a
solid color or with a texture. If a sphere texture has been assigned to
a triangle, environment mapping will be enabled for that triangle.
Triangle
can use any of the supported shading modes and
is affected by lighting parameters. In order for a Triangle
to
be affected by lighting parameters, it must have either a face normal or a
normal for each of its vertices. If no normals are assigned to the
triangle, it will be not be affected by the lighting and shading parameters.
Vector3D
objects which contain
the coordinates of the three points that define the polygon. Therefore the
valid vertex IDs for the Triangle
are
Primitive.VERTEX_A
, Primitive.VERTEX_B
,
and Primitive.VERTEX_C
. In order to assign a face normal for
the triangle the constant Primitive.FACE_NORMAL
is used. For
assigning normals to vertices the vertex constants are combined with the
Primitive.NORMAL
constant. For example, to assign a normal to
vertex B, the vertex ID would be (Primitive.VERTEX_B |
Primitive.NORMAL)
. When assigning vertex normals it is important to
assign a vertex normal for each vertex. If any of the vertices does not
have a normal assigned to it, the triangle will not be affected by
lighting parameters. A triangle cannot have a face normal and vertex
normals assigned to it at the same time. When a face normal is assigned
to a triangle, the vertex normals are automatically discarded. Similarily,
once a vertex normal is assigned to a triangle, its face normal will be
discarded.
When a texture is assigned to a triangle, it is necessary to specify how
the texture will be applied to the triangle. This is accomplished by
specifing X and Y coordinates for each of the triangle's vertices. Those
X and Y coordinates are then mapped to the target texture.
Fields inherited from class com.motorola.iden.micro3d.Primitive |
BLENDING_ADD, BLENDING_HALF, BLENDING_NONE, BLENDING_SUB, FACE_NORMAL, NORMAL, VERTEX_A, VERTEX_B, VERTEX_C, VERTEX_D |
Constructor Summary | |
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
int textureXA,
int textureYA,
int textureXB,
int textureYB,
int textureXC,
int textureYC,
Layout3D layout,
Texture texture)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters. |
|
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
Layout3D layout,
int color)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters. |
|
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
Vector3D faceNormal,
int textureXA,
int textureYA,
int textureXB,
int textureYB,
int textureXC,
int textureYC,
Layout3D layout,
Texture texture)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters and oriented with the normal specified with
faceNormal . |
|
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
Vector3D faceNormal,
Layout3D layout,
int color)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters and oriented with the normal specified by
the faceNormal parameter. |
|
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
Vector3D normalA,
Vector3D normalB,
Vector3D normalC,
int textureXA,
int textureYA,
int textureXB,
int textureYB,
int textureXC,
int textureYC,
Layout3D layout,
Texture texture)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters and oriented with the normal specified
for each vertex. |
|
Triangle(Vector3D vertexA,
Vector3D vertexB,
Vector3D vertexC,
Vector3D normalA,
Vector3D normalB,
Vector3D normalC,
Layout3D layout,
int color)
Creates a Triangle primitive with the vertices at the positions
specified by vertexA , vertexB , and
vertexC parameters and oriented with the normal specified for
each vertex. |
Method Summary | |
int |
getTextureCoordinateX(int vertexID)
Returns the X component of the texture coordinate for the specified vertex. |
int |
getTextureCoordinateY(int vertexID)
Returns the Y component of the texture coordinate for the specified vertex. |
Vector3D |
getVector(int vectorID)
Returns the Vector3D for the specified vector.
|
void |
setTextureCoordinates(int vertexID,
int x,
int y)
Sets the texture coordinates for the specified vertex. |
void |
setVector(int vectorID,
Vector3D vector)
Sets the specified vertex to the Vector3D provided.
|
Methods inherited from class com.motorola.iden.micro3d.Primitive |
enableColorKeyTransparency, getBlendingType, getColor, hasColorKeyTransparency, setBlendingType, setColor |
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 |
Constructor Detail |
public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, int textureXA, int textureYA, int textureXB, int textureYB, int textureXC, int textureYC, Layout3D layout, Texture texture) throws java.lang.NullPointerException
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters. The Triangle
will be rendered
using the specified texture and Layout3D
. Portions of the
Texture
to use for the triangle can be specified using the
textureXA
, textureYA
, textureXB
,
textureYB
, textureXC
, and textureYC
parameters.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered. If the Texture
is set to null
the Triangle
will be rendered with the default color.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.textureXA
- the x coordinate in the texture that will map to the
vertex A of the Triangle
.textureYA
- the y coordinate in the texture that will map to the
vertex A of the Triangle
.textureXB
- the x coordinate in the texture that will map to the
vertex B of the Triangle
.textureYB
- the y coordinate in the texture that will map to the
vertex B of the Triangle
.textureXC
- the x coordinate in the texture that will map to the
vertex C of the Triangle
.textureYC
- the y coordinate in the texture that will map to the
vertex C of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.texture
- the Texture
to use when rendering this
Triangle
.public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, Vector3D faceNormal, int textureXA, int textureYA, int textureXB, int textureYB, int textureXC, int textureYC, Layout3D layout, Texture texture)
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters and oriented with the normal specified with
faceNormal
. The Triangle
will be rendered using
the the specified Texture
and Layout3D
. Portions
of the Texture
to use for the triangle can be specified using
the textureXA
, textureYA
, textureXB
,
textureYB
, textureXC
, and textureYC
parameters.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered. If the Texture
is set to null
the Triangle
will be rendered with the default color.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.faceNormal
- the face normal of the Triangle
.textureXA
- the x coordinate in the texture that will map to the
vertex A of the Triangle
.textureYA
- the y coordinate in the texture that will map to the
vertex A of the Triangle
.textureXB
- the x coordinate in the texture that will map to the
vertex B of the Triangle
.textureYB
- the y coordinate in the texture that will map to the
vertex B of the Triangle
.textureXC
- the x coordinate in the texture that will map to the
vertex C of the Triangle
.textureYC
- the y coordinate in the texture that will map to the
vertex C of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.texture
- the Texture
to use when rendering this
Triangle
.java.lang.NullPointerException
- if any of the vertices or the face normal
are null
.public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, Vector3D normalA, Vector3D normalB, Vector3D normalC, int textureXA, int textureYA, int textureXB, int textureYB, int textureXC, int textureYC, Layout3D layout, Texture texture)
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters and oriented with the normal specified
for each vertex. The Triangle
will be rendered using the
Texture
and Layout3D
provided. Portions of the
Texture
to use for the triangle can be specified using the
textureXA
, textureYA
, textureXB
,
textureYB
, textureXC
, and textureYC
parameters.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered. If the Texture
is set to null
the Triangle
will be rendered with the default color.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.normalA
- the normal at vertex A of the Triangle
.normalB
- the normal at vertex B of the Triangle
.normalC
- the normal at vertex C of the Triangle
.textureXA
- the x coordinate in the texture that will map to the
vertex A of the Triangle
.textureYA
- the y coordinate in the texture that will map to the
vertex A of the Triangle
.textureXB
- the x coordinate in the texture that will map to the
vertex B of the Triangle
.textureYB
- the y coordinate in the texture that will map to the
vertex B of the Triangle
.textureXC
- the x coordinate in the texture that will map to the
vertex C of the Triangle
.textureYC
- the y coordinate in the texture that will map to the
vertex C of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.texture
- the Texture
to use when rendering this
Triangle
.java.lang.NullPointerException
- if any of the specified vertices or normals
are null
.public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, Layout3D layout, int color) throws java.lang.NullPointerException
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters. The Triangle
will be rendered
using the specified color and Layout3D
.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.color
- the color to use when rendering this Triangle
.java.lang.NullPointerException
- if any of the specified vertices are
null
.Graphics
public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, Vector3D faceNormal, Layout3D layout, int color) throws java.lang.NullPointerException
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters and oriented with the normal specified by
the faceNormal
parameter. The Triangle
will be
rendered using the color and Layout3D
provided.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered. If the Texture
is set to null
the Triangle
will be rendered with the default color.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.faceNormal
- the face normal of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.color
- the color to use when rendering this Triangle
.java.lang.NullPointerException
- if any of the specified vertices or
the face normal are null
.Graphics
public Triangle(Vector3D vertexA, Vector3D vertexB, Vector3D vertexC, Vector3D normalA, Vector3D normalB, Vector3D normalC, Layout3D layout, int color) throws java.lang.NullPointerException
Triangle
primitive with the vertices at the positions
specified by vertexA
, vertexB
, and
vertexC
parameters and oriented with the normal specified for
each vertex. The Triangle
will be rendered using the color and
Layout3D
provided.
The specified vertices cannot be null
. If the specified
Layout3D
is null
the Triangle
will
not be rendered. If the Texture
is set to null
the Triangle
will be rendered with the default color.
vertexA
- vertex A of the Triangle
.vertexB
- vertex B of the Triangle
.vertexC
- vertex C of the Triangle
.normalA
- the normal at vertex A of the Triangle
.normalB
- the normal at vertex B of the Triangle
.normalC
- the normal at vertex C of the Triangle
.layout
- the Layout3D
to use to render this
Triangle
.color
- the color to use when rendering this Triangle
.java.lang.NullPointerException
- if any of the specified vertices or normals
are null
.Graphics
Method Detail |
public Vector3D getVector(int vectorID) throws java.lang.IllegalArgumentException
Vector3D
for the specified vector.
Triangle
supports the constants
Primitive.VERTEX_A
, Primitive.VERTEX_B
,
Primitive.VERTEX_C
, Primitive.FACE_NORMAL
, and
Primitive.NORMAL
.
getVector
in class Primitive
vectorID
- the ID of the vector to return.Vector3D
for the specified vector.java.lang.IllegalArgumentException
- if an invalid vectorID
is specified.Primitive.VERTEX_A
,
Primitive.VERTEX_B
,
Primitive.VERTEX_C
,
Primitive.FACE_NORMAL
,
Primitive.NORMAL
public void setVector(int vectorID, Vector3D vector) throws java.lang.NullPointerException, java.lang.IllegalArgumentException
Vector3D
provided.
A triangle is defined by three Vector3D
objects which represent
the coordinates of the three points that define the polygon. Therefore the
valid vertex IDs for the Triangle
are
Primitive.VERTEX_A
, Primitive.VERTEX_B
,
and Primitive.VERTEX_C
. In order to assign a face normal for
the triangle the constant Primitive.FACE_NORMAL
is used. For
assigning normals to vertices the vertex constants are combined with the
Primitive.NORMAL
constant. For example, to assign a normal to
vertex B, the vertex ID would be (Primitive.VERTEX_B |
Primitive.NORMAL)
. When assigning vertex normals it is important to
assign a vertex normal for each vertex. If any of the vertices does not
have a normal assigned to it, the triangle will not be affected by
lighting parameters. A triangle cannot have a face normal and vertex
normals assigned to it at the same time. When a face normal is assigned
to a triangle, the vertex normals are automatically discarded. Similarily,
once a vertex normal is assigned to a triangle, its face normal will be
discarded.
setVector
in class Primitive
vectorID
- the ID of the vector being set.vector
- the Vector3D
to set.java.lang.IllegalArgumentException
- if an invalid vectorID
is specified.java.lang.NullPointerException
- if the vector is null
.Primitive.VERTEX_A
,
Primitive.VERTEX_B
,
Primitive.VERTEX_C
,
Primitive.FACE_NORMAL
,
Primitive.NORMAL
public int getTextureCoordinateX(int vertexID) throws java.lang.IllegalArgumentException
vertexID
- vertex.java.lang.IllegalArgumentException
- if the specified vertexID is invalid.Primitive.VERTEX_A
,
Primitive.VERTEX_B
,
Primitive.VERTEX_C
public int getTextureCoordinateY(int vertexID) throws java.lang.IllegalArgumentException
vertexID
- vertex.java.lang.IllegalArgumentException
- if the specified vertexID is invalid.Primitive.VERTEX_A
,
Primitive.VERTEX_B
,
Primitive.VERTEX_C
public void setTextureCoordinates(int vertexID, int x, int y) throws java.lang.IllegalArgumentException
vertexID
- vertex.x
- X coordinate.y
- Y coordinate.java.lang.IllegalArgumentException
- if the specified vertexID is invalid.Primitive.VERTEX_A
,
Primitive.VERTEX_B
,
Primitive.VERTEX_C
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |