Jazz3D API


com.sygem.jazz3d3
Class Shape

java.lang.Object
  |
  +--com.sygem.jazz3d3.Shape
Direct Known Subclasses:
Quad, Triangle

public class Shape
extends java.lang.Object

Base face class. Provides common functionality for faces.

Version:
3.0a
Author:
SyGem Software

Constructor Summary
Shape(int v1, int v2, int v3, int r, int g, int b)
          Default constructor.
 
Method Summary
 boolean getDoubleSided()
          Returns whether or not this face is double-sided.
 Vertex getFaceNormal()
          Returns the normal vector for this face.
 int getTransparency()
          Get the transparency value of this face.
 double getU(int u, boolean wrap)
          Get the U value of a particular vertex in this face
 double getV(int v, boolean wrap)
          Get the V value of a particular vertex in this face
 int getVertexID(int vert)
          Returns a vertex ID from this face.
 void setColour(int r, int g, int b)
          Set the colour of this face.
 void setDoubleSided(boolean ds)
          Set this face to be double-sided (culling not applied).
 void setFaceNormal(Vertex norm)
          Set the normal vector for this face.
 void setTransparency(int tr)
          Set the transparency value of this face.
 void setUV(double u1, double v1, double u2, double v2, double u3, double v3, double u4, double v4)
          Set the UV coordinates of a face.
 void setWrapUV(double u1, double v1, double u2, double v2, double u3, double v3, double u4, double v4)
          Set the UV coordinates of a face when using UV wrapping.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Shape

public Shape(int v1,
             int v2,
             int v3,
             int r,
             int g,
             int b)
Default constructor. Constructs a shape between 3 vertices, with colour (r,g,b)
Method Detail

setUV

public final void setUV(double u1,
                        double v1,
                        double u2,
                        double v2,
                        double u3,
                        double v3,
                        double u4,
                        double v4)
Set the UV coordinates of a face. Specified in pairs i.e. (u1,v1),(u2,v2) etc..

setWrapUV

public final void setWrapUV(double u1,
                            double v1,
                            double u2,
                            double v2,
                            double u3,
                            double v3,
                            double u4,
                            double v4)
Set the UV coordinates of a face when using UV wrapping. Specified in pairs i.e. (u1,v1),(u2,v2) etc..

getU

public final double getU(int u,
                         boolean wrap)
Get the U value of a particular vertex in this face
Parameters:
u - A value between 1 & 4 - the vertex being queried
wrap - Set to true if you want the UV wrapping co-ord

getV

public final double getV(int v,
                         boolean wrap)
Get the V value of a particular vertex in this face
Parameters:
v - A value between 1 & 4 - the vertex being queried
wrap - Set to true if you want the UV wrapping co-ord

setTransparency

public final void setTransparency(int tr)
Set the transparency value of this face.

Note: This is only used by the transparent renderer.

See Also:
RenderTransparent

getTransparency

public final int getTransparency()
Get the transparency value of this face.

Note: This is only used by the transparent renderer.

See Also:
RenderTransparent

setColour

public final void setColour(int r,
                            int g,
                            int b)
Set the colour of this face.
Parameters:
r - The red component of the new colour (0 - 255)
g - The green component of the new colour (0 - 255)
b - The blue component of the new colour (0 - 255)
See Also:
Object3d.setFaceColour(int, int, int, int)

getFaceNormal

public final Vertex getFaceNormal()
Returns the normal vector for this face. The normal is actually returned as a Vertex.
See Also:
setFaceNormal(com.sygem.jazz3d3.Vertex)

setFaceNormal

public final void setFaceNormal(Vertex norm)
Set the normal vector for this face. The normal is actually represented by a Vertex.
Parameters:
norm - The new face normal
See Also:
getFaceNormal()

setDoubleSided

public final void setDoubleSided(boolean ds)
Set this face to be double-sided (culling not applied).

getDoubleSided

public final boolean getDoubleSided()
Returns whether or not this face is double-sided.

getVertexID

public final int getVertexID(int vert)
Returns a vertex ID from this face. These vertex IDs map directly into the object's vertex container, so they can be used to reference specific vertices in the object. They are selected using an index 1-4 in the method call.

©2001 SyGem Software