jme.geometry.primitive
Class Quad

java.lang.Object
  extended byjme.geometry.primitive.Primitive
      extended byjme.geometry.primitive.Quad
All Implemented Interfaces:
Geometry

public class Quad
extends Primitive

Quad handles the rendering of a single quad shape. This quad shape is defined by four points and maintained in an array of four Vector values. The ordering of the array is important as each index represents a corner of the quad.

0 - TopLeft
1 - TopRight
2 - BottomRight
3 - BottomLeft

Version:
$Id: Quad.java,v 1.7 2003/09/08 20:29:27 mojomonkey Exp $
Author:
Mark Powell

Field Summary
(package private)  Vector[] points
           
 
Fields inherited from class jme.geometry.primitive.Primitive
alpha, blue, green, red
 
Constructor Summary
Quad(Vector[] points)
          Constructor instantiates a new Quad with the given set of points.
 
Method Summary
 Vector[] getPoints()
          getPoints returns an array of Vectors that represents each point that makes up the piece of geometry.
 void initialize()
          initialize sets up the quad to prepare it for usage.
 void preRender()
          preRender does nothing for quad.
 void render()
          render renders a single quad with the defined points.
 void setPoint(int index, Vector point)
          setPoint sets a specific corner to the given point.
 void setPoints(Vector[] points)
          setPoints sets the points that define the quad shape.
 
Methods inherited from class jme.geometry.primitive.Primitive
clean, getTextureId, setColor, setTexture, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

points

Vector[] points
Constructor Detail

Quad

public Quad(Vector[] points)
Constructor instantiates a new Quad with the given set of points.

Parameters:
points - the points that make up the quad.
Throws:
MonkeyRuntimeException - if points are null.
Method Detail

setPoints

public void setPoints(Vector[] points)
setPoints sets the points that define the quad shape.

Parameters:
points - the points that make up the quad.
Throws:
MonkeyRuntimeException - if points are null.

setPoint

public void setPoint(int index,
                     Vector point)
setPoint sets a specific corner to the given point. The index of the point should match:

0 - TopLeft
1 - TopRight
2 - BottomRight
3 - BottomLeft

Parameters:
index - the corner to change.
point - the new point of the corner.

render

public void render()
render renders a single quad with the defined points.

Specified by:
render in interface Geometry
Specified by:
render in class Primitive

initialize

public void initialize()
initialize sets up the quad to prepare it for usage.


preRender

public void preRender()
preRender does nothing for quad.


getPoints

public Vector[] getPoints()
Description copied from interface: Geometry
getPoints returns an array of Vectors that represents each point that makes up the piece of geometry.

Returns:
the array of vectors for the points.