espresso3d.engine.geometry
Class E3DQuad

java.lang.Object
  extended byespresso3d.engine.base.E3DEngineItem
      extended byespresso3d.engine.renderer.base.E3DRenderable
          extended byespresso3d.engine.renderer.base.E3DTexturedRenderable
              extended byespresso3d.engine.geometry.E3DQuad

public class E3DQuad
extends E3DTexturedRenderable

Author:
Curt A quad is a renderable, texturable rectangle. This is normally only used for particle geometry. But could be used elsewhere on the external renderable list if desired.

Constructor Summary
E3DQuad(E3DEngine engine)
           
E3DQuad(E3DEngine engine, double ax, double ay, double az, double bx, double by, double bz, double cx, double cy, double cz, double dx, double dy, double dz, double tax, double tay, double tbx, double tby, double tcx, double tcy, double tdx, double tdy, int glTextureID)
           
E3DQuad(E3DQuad toCopy)
           
 
Method Summary
 float[] getFloatNormalArray()
           
 float[] getFloatTexCoordArray()
           
 float[] getFloatVertexArray()
           
 float[] getFloatVertexColorArray()
           
 E3DVector3F getNormal()
           
 E3DVector4F getPlaneEquationCoords()
          Returns a vector with the 4 parameters of the quad's plane
 E3DVector3F[] getTextureCoord()
          Get array of texture coords for the quad.
 E3DVector3F getTextureCoordA()
          Get the first texture coordinate
 E3DVector3F getTextureCoordB()
          Get the second texture coordinate
 E3DVector3F getTextureCoordC()
          Get the third texture coordinate
 E3DVector3F getTextureCoordD()
          Get the fourth texture coordinate
 E3DVector3F[] getVertex()
          Get an array of vertices that make up the quad.
 E3DVector3F getVertexA()
          Get the first vertex of the quad
 E3DVector3F getVertexB()
          Get the second vertex of the quad
 E3DVector3F getVertexC()
          Get the third vertex of the quad
 E3DVector3F[] getVertexColor()
          Get the color of the vertices.
 E3DVector3F getVertexColorA()
          Get the color of the first vertex of the quad
 E3DVector3F getVertexColorB()
          Get the color of the second vertex of the quad
 E3DVector3F getVertexColorC()
          Get the color of the third vertex of the quad
 E3DVector3F getVertexColorD()
          Get the color of the fourth vertex of the quad
 E3DVector3F getVertexD()
          Get the fourth vertex of the quad
 void normaliseVertexColors()
          Ensures all vertex colors are <= 1.0
 void renderAtPosition(E3DVector3F atPosition)
          To render outside of the normal rendering loop, this can be added to the external renderable list of the engine's because it implements renderAtPosition.
 void resetVertexColor(double color)
          Resets all the vertex colors to all be color.
 void rotate(double angle, E3DVector3F upVec, E3DVector3F translatedAmt)
          Rotate the quad around aroundVec.
 void scale(double scaleAmt)
          Scale the quad
 void setTextureCoord(E3DVector3F[] textureCoord)
          Set the texture coordinates of the quad
 void setTextureCoord(E3DVector3F texCoordA, E3DVector3F textCoordB, E3DVector3F texCoordC, E3DVector3F texCoordD)
          Set the texture coordinates of the quad
 void setVertex(E3DVector3F[] vertex)
          Set the vertices of the quad.
 void setVertex(E3DVector3F vertexA, E3DVector3F vertexB, E3DVector3F vertexC, E3DVector3F vertexD)
          Set the vertices of the quad
 void setVertexColor(E3DVector3F[] vertexColor)
          Set the color of the vertices of the quad
 void setVertexColor(E3DVector3F vertexColorA, E3DVector3F vertexColorB, E3DVector3F vertexColorC, E3DVector3F vertexColorD)
          Set the color of the vertices of the quad
 java.lang.String toString()
          Get a string with the quads vertice values listed
 void translate(E3DVector3F translationAmt)
          Translate the quad vertices
 
Methods inherited from class espresso3d.engine.renderer.base.E3DTexturedRenderable
getGlTextureID, getTextureName, setGlTextureID, setTextureName
 
Methods inherited from class espresso3d.engine.renderer.base.E3DRenderable
render
 
Methods inherited from class espresso3d.engine.base.E3DEngineItem
getEngine, setEngine
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

E3DQuad

public E3DQuad(E3DEngine engine)

E3DQuad

public E3DQuad(E3DQuad toCopy)

E3DQuad

public E3DQuad(E3DEngine engine,
               double ax,
               double ay,
               double az,
               double bx,
               double by,
               double bz,
               double cx,
               double cy,
               double cz,
               double dx,
               double dy,
               double dz,
               double tax,
               double tay,
               double tbx,
               double tby,
               double tcx,
               double tcy,
               double tdx,
               double tdy,
               int glTextureID)
Method Detail

renderAtPosition

public void renderAtPosition(E3DVector3F atPosition)
To render outside of the normal rendering loop, this can be added to the external renderable list of the engine's because it implements renderAtPosition.

Specified by:
renderAtPosition in class E3DTexturedRenderable

getTextureCoord

public E3DVector3F[] getTextureCoord()
Get array of texture coords for the quad. There will be 4

Returns:

getTextureCoordA

public E3DVector3F getTextureCoordA()
Get the first texture coordinate

Returns:

getTextureCoordB

public E3DVector3F getTextureCoordB()
Get the second texture coordinate

Returns:

getTextureCoordC

public E3DVector3F getTextureCoordC()
Get the third texture coordinate

Returns:

getTextureCoordD

public E3DVector3F getTextureCoordD()
Get the fourth texture coordinate

Returns:

setTextureCoord

public void setTextureCoord(E3DVector3F[] textureCoord)
Set the texture coordinates of the quad

Parameters:
textureCoord - An array of 4 E3DVector3F's

setTextureCoord

public void setTextureCoord(E3DVector3F texCoordA,
                            E3DVector3F textCoordB,
                            E3DVector3F texCoordC,
                            E3DVector3F texCoordD)
Set the texture coordinates of the quad

Parameters:
texCoordA -
textCoordB -
texCoordC -
texCoordD -

getVertex

public E3DVector3F[] getVertex()
Get an array of vertices that make up the quad. There will be 4

Returns:

getVertexA

public E3DVector3F getVertexA()
Get the first vertex of the quad

Returns:

getVertexB

public E3DVector3F getVertexB()
Get the second vertex of the quad

Returns:

getVertexC

public E3DVector3F getVertexC()
Get the third vertex of the quad

Returns:

getVertexD

public E3DVector3F getVertexD()
Get the fourth vertex of the quad

Returns:

setVertex

public void setVertex(E3DVector3F[] vertex)
Set the vertices of the quad.

Parameters:
vertex - An array of 4 E3DVector3F's

setVertex

public void setVertex(E3DVector3F vertexA,
                      E3DVector3F vertexB,
                      E3DVector3F vertexC,
                      E3DVector3F vertexD)
Set the vertices of the quad

Parameters:
vertexA -
vertexB -
vertexC -
vertexD -

getVertexColor

public E3DVector3F[] getVertexColor()
Get the color of the vertices.

Returns:
Array containing 4 E3DVector3F's

getVertexColorA

public E3DVector3F getVertexColorA()
Get the color of the first vertex of the quad

Returns:

getVertexColorB

public E3DVector3F getVertexColorB()
Get the color of the second vertex of the quad

Returns:

getVertexColorC

public E3DVector3F getVertexColorC()
Get the color of the third vertex of the quad

Returns:

getVertexColorD

public E3DVector3F getVertexColorD()
Get the color of the fourth vertex of the quad

Returns:

setVertexColor

public void setVertexColor(E3DVector3F[] vertexColor)
Set the color of the vertices of the quad

Parameters:
vertexColor - An array of 4 E3DVector3F's

setVertexColor

public void setVertexColor(E3DVector3F vertexColorA,
                           E3DVector3F vertexColorB,
                           E3DVector3F vertexColorC,
                           E3DVector3F vertexColorD)
Set the color of the vertices of the quad

Parameters:
vertexColorA -
vertexColorB -
vertexColorC -
vertexColorD -

resetVertexColor

public void resetVertexColor(double color)
Resets all the vertex colors to all be color. Value between 0 and 1 should be used

Parameters:
color - Value between 0 and 1 to set all R,G,B values to for all vertices

normaliseVertexColors

public void normaliseVertexColors()
Ensures all vertex colors are <= 1.0


getFloatVertexArray

public float[] getFloatVertexArray()

getFloatVertexColorArray

public float[] getFloatVertexColorArray()

getFloatNormalArray

public float[] getFloatNormalArray()

getFloatTexCoordArray

public float[] getFloatTexCoordArray()

getNormal

public E3DVector3F getNormal()
Returns:
Returns the normal of the quad

getPlaneEquationCoords

public E3DVector4F getPlaneEquationCoords()
Returns a vector with the 4 parameters of the quad's plane

Returns:

translate

public void translate(E3DVector3F translationAmt)
Translate the quad vertices


scale

public void scale(double scaleAmt)
Scale the quad

Parameters:
scaleAmt -

toString

public java.lang.String toString()
Get a string with the quads vertice values listed


rotate

public void rotate(double angle,
                   E3DVector3F upVec,
                   E3DVector3F translatedAmt)
Rotate the quad around aroundVec. Translated amt is how far the quad has been translated from the origin (it needsd this so it can be centered around the up vec correctly and then rotate and moved back)

Parameters:
angle -
upVec -
translatedAmt -